public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/31676] New: Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
@ 2024-04-23 19:12 fweimer at redhat dot com
  2024-04-23 19:13 ` [Bug dynamic-link/31676] " fweimer at redhat dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: fweimer at redhat dot com @ 2024-04-23 19:12 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31676

            Bug ID: 31676
           Summary: Configuring with CC="gcc -march=x86-64-v3"
                    --with-rtld-early-cflags=-march=x86-64 results in
                    linker failure
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
  Target Milestone: ---

The error is:

gcc -march=x86-64-v3   -nostdlib -nostartfiles -shared -o …/build/elf/ld.so.new
              \
          -Wl,-z,relro -Wl,-z,defs      \
           \
          …/build/elf/librtld.os -Wl,--version-script=…/build/ld.map           
    \
          -Wl,-soname=ld-linux-x86-64.so.2
/usr/bin/ld: …/build/elf/librtld.os: in function `init_cpu_features':
…/git/elf/../sysdeps/x86/cpu-features.c:1202: undefined reference to
`_dl_runtime_resolve_fxsave'
/usr/bin/ld: …/build/elf/librtld.os: relocation R_X86_64_PC32 against undefined
hidden symbol `_dl_runtime_resolve_fxsave' can not be used when making a shared
object
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

The  reason is that we build with sysdeps/x86/dl-get-cpu-features.c with the
early CFLAGS (so -march=x86-64). This is necessary because the code runs very
early. But since

commit befe2d3c4dec8be2cdd01a47132e47bdb7020922
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Feb 28 09:51:14 2024 -0800

    x86-64: Don't use SSE resolvers for ISA level 3 or above

    When glibc is built with ISA level 3 or above enabled, SSE resolvers
    aren't available and glibc fails to build:

    ld: .../elf/librtld.os: in function `init_cpu_features':
    .../elf/../sysdeps/x86/cpu-features.c:1200:(.text+0x1445f): undefined
reference to `_dl_runtime_resolve_fxsave'
    ld: .../elf/librtld.os: relocation R_X86_64_PC32 against undefined hidden
symbol `_dl_runtime_resolve_fxsave' can not be used when making a shared object
    /usr/local/bin/ld: final link failed: bad value

    For ISA level 3 or above, don't use _dl_runtime_resolve_fxsave nor
    _dl_tlsdesc_dynamic_fxsave.

    This fixes BZ #31429.
    Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>

the referenced _dl_runtime_resolve_fxsave trampoline does not exist when the
rest of the dynamic linker is built for x86-64-v3.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-25 11:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23 19:12 [Bug dynamic-link/31676] New: Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure fweimer at redhat dot com
2024-04-23 19:13 ` [Bug dynamic-link/31676] " fweimer at redhat dot com
2024-04-23 19:23 ` hjl.tools at gmail dot com
2024-04-23 19:31 ` hjl.tools at gmail dot com
2024-04-23 19:40 ` fweimer at redhat dot com
2024-04-23 20:17 ` hjl.tools at gmail dot com
2024-04-23 20:45 ` skpgkp1 at gmail dot com
2024-04-24 11:51 ` cvs-commit at gcc dot gnu.org
2024-04-25 11:18 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).