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

* [Bug dynamic-link/31676] Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
  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 ` fweimer at redhat dot com
  2024-04-23 19:23 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fweimer at redhat dot com @ 2024-04-23 19:13 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com,
                   |                            |hjl.tools at gmail dot com,
                   |                            |skpgkp2 at gmail dot com

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

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

* [Bug dynamic-link/31676] Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
  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
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-23 19:23 UTC (permalink / raw)
  To: glibc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Does such glibc binary require x86-64-v3 to run?

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

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

* [Bug dynamic-link/31676] Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-23 19:31 UTC (permalink / raw)
  To: glibc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |2.40

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

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

* [Bug dynamic-link/31676] Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
  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
                   ` (2 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fweimer at redhat dot com @ 2024-04-23 19:40 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to H.J. Lu from comment #1)
> Does such glibc binary require x86-64-v3 to run?

Yes, but we really want ld.so be able to print an error message on all CPUs, as
in “Fatal glibc error: CPU does not support x86-64-v3". See
sysdeps/x86/dl-get-cpu-features.c. This requires that we build part of ld.so
with -march=x86-64.

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

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

* [Bug dynamic-link/31676] Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
  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
                   ` (3 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-23 20:17 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 15480
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15480&action=edit
A patch

Please try this.

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

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

* [Bug dynamic-link/31676] Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
  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
                   ` (4 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: skpgkp1 at gmail dot com @ 2024-04-23 20:45 UTC (permalink / raw)
  To: glibc-bugs

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

skpgkp1 at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |skpgkp1 at gmail dot com

--- Comment #4 from skpgkp1 at gmail dot com ---
I reproduce the issue and try attached patch; it fixes the problem.

Patch looks good to me.

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

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

* [Bug dynamic-link/31676] Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
  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
                   ` (5 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-24 11:51 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #5 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=46c999741340ea559784c20a45077955b50aca43

commit 46c999741340ea559784c20a45077955b50aca43
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Apr 23 13:59:50 2024 -0700

    x86: Define MINIMUM_X86_ISA_LEVEL in config.h [BZ #31676]

    Define MINIMUM_X86_ISA_LEVEL at configure time to avoid

    /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

    when glibc is built with -march=x86-64-v3 and configured with
    --with-rtld-early-cflags=-march=x86-64, which is used to allow ld.so to
    print an error message on unsupported CPUs:

    Fatal glibc error: CPU does not support x86-64-v3

    This fixes BZ #31676.
    Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>

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

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

* [Bug dynamic-link/31676] Configuring with CC="gcc -march=x86-64-v3" --with-rtld-early-cflags=-march=x86-64 results in linker failure
  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
                   ` (6 preceding siblings ...)
  2024-04-24 11:51 ` cvs-commit at gcc dot gnu.org
@ 2024-04-25 11:18 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-25 11:18 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #6 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The release/2.39/master branch has been updated by Florian Weimer
<fw@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2f8f157eb0cc7f1d8d9a3fcaa8c55bed53b092a8

commit 2f8f157eb0cc7f1d8d9a3fcaa8c55bed53b092a8
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Apr 23 13:59:50 2024 -0700

    x86: Define MINIMUM_X86_ISA_LEVEL in config.h [BZ #31676]

    Define MINIMUM_X86_ISA_LEVEL at configure time to avoid

    /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

    when glibc is built with -march=x86-64-v3 and configured with
    --with-rtld-early-cflags=-march=x86-64, which is used to allow ld.so to
    print an error message on unsupported CPUs:

    Fatal glibc error: CPU does not support x86-64-v3

    This fixes BZ #31676.
    Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>

    (cherry picked from commit 46c999741340ea559784c20a45077955b50aca43)

-- 
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).