public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/31676] New: Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
Date: Tue, 23 Apr 2024 19:12:41 +0000	[thread overview]
Message-ID: <bug-31676-131@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2024-04-23 19:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 19:12 fweimer at redhat dot com [this message]
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
2024-06-09  8:36 ` sam at gentoo dot org
2024-06-09  9:36 ` sam at gentoo dot org
2024-06-15 14:19 ` dilfridge at gentoo dot org
2024-06-19 21:49 ` dilfridge at gentoo dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31676-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).