https://bugs.kde.org/show_bug.cgi?id=421321

            Bug ID: 421321
           Summary: gcc10 arm64 build needs __getauxval for linking with
                    libgcc
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: m...@klomp.org
  Target Milestone: ---

We link some core/tools with libgcc for helper functions. For gcc10 libgcc
added a dependency on glibc getauxval. But we don't link against glibc.
Causing:

 gcc  -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables
-fstack-clash-protection   -Wl,-z,relro -Wl,--as-needed 
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld  -o memcheck-arm64-linux  -O2 -g
-Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes
-Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body
-Wformat -Wformat-signedness -Wformat-security -Wignored-qualifiers
-Wmissing-parameter-type -Wlogical-op -Wenum-conversion
-Wimplicit-fallthrough=2 -Wold-style-declaration -finline-functions
-fno-stack-protector -fno-strict-aliasing -fno-builtin  -O2 -static
-nodefaultlibs -nostartfiles -u _start   memcheck_arm64_linux-mc_leakcheck.o
memcheck_arm64_linux-mc_malloc_wrappers.o memcheck_arm64_linux-mc_main.o
memcheck_arm64_linux-mc_main_asm.o memcheck_arm64_linux-mc_translate.o
memcheck_arm64_linux-mc_machine.o memcheck_arm64_linux-mc_errors.o
../coregrind/libcoregrind-arm64-linux.a ../VEX/libvex-arm64-linux.a -lgcc 
/usr/bin/ld: /usr/lib/gcc/aarch64-redhat-linux/10/libgcc.a(lse-init.o): in
function `init_have_lse_atomics':
(.text.startup+0xc): undefined reference to `__getauxval'
(.text.startup+0xc): relocation truncated to fit: R_AARCH64_CALL26 against
undefined symbol `__getauxval'
collect2: error: ld returned 1 exit status

We would need to provide a (fake) __getauxval() in coregrind/m_compiler.c.

See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91833

There is a build time fix in case the libc used to build libgcc doesn't provide
getauxval, but that doesn't help us at runtime.

https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/config/aarch64/lse-init.c;hb=HEAD

static void __attribute__((constructor))
init_have_lse_atomics (void)
{
  unsigned long hwcap = __getauxval (AT_HWCAP);
  __aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0;
}

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to