public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/27318] New: glibc fails to load binaries when built with -march=sandybridge:  CPU ISA level is lower than required
@ 2021-02-02 19:48 slyfox at inbox dot ru
  2021-02-02 20:19 ` [Bug dynamic-link/27318] " fweimer at redhat dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: slyfox at inbox dot ru @ 2021-02-02 19:48 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 27318
           Summary: glibc fails to load binaries when built with
                    -march=sandybridge:  CPU ISA level is lower than
                    required
           Product: glibc
           Version: 2.33
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: slyfox at inbox dot ru
                CC: hjl.tools at gmail dot com
  Target Milestone: ---

The system uses binutils-2.36 and gcc-11 (master). Configure glibc as:

$ ../glibc/configure --host=x86_64-pc-linux-gnu CC="x86_64-pc-linux-gnu-gcc
-march=sandybridge" --prefix=/usr --disable-werror

$ ./elf/ld.so ./libc.so
./libc.so: (p) CPU ISA level is lower than required: needed: 7; got: 3

The CPU is `Intel(R) Core(TM) i7-2700K CPU @ 3.50GHz` (sandbybridge + AES).

After adding a bit of debug glibc contains ISA_1_V3 level (too high) while CPU
contains ISA_1_V2 level (ok).

I patched glibc slightly to get ISA levels:

--- a/sysdeps/x86/dl-prop.h
+++ b/sysdeps/x86/dl-prop.h
@@ -54,8 +54,8 @@ dl_isa_level_check (struct link_map *m, const char *program)
          != l->l_x86_isa_1_needed)
        {
          if (program)
-           _dl_fatal_printf ("%s: CPU ISA level is lower than required\n",
-                             *l->l_name != '\0' ? l->l_name : program);
+           _dl_fatal_printf ("%s: (p) CPU ISA level is lower than required:
needed: %d; got: %d\n",
+                             *l->l_name != '\0' ? l->l_name : program,
l->l_x86_isa_1_needed, cpu_features->isa_1);
          else
            _dl_signal_error (0, l->l_name, "dlopen",
                              N_("CPU ISA level is lower than required"));

I suspect that binutils somehow managed to infer too high ISA level for final
binary. 

$ readelf -a elf/ld.so | tail -n 5
Displaying notes found in: .note.gnu.property
  Owner                Data size        Description
  GNU                  0x00000020       NT_GNU_PROPERTY_TYPE_0
      Properties: x86 feature used: x86, x87, XMM, YMM, ZMM, FXSR, XSAVE,
XSAVEC
        x86 ISA used: x86-64-baseline, x86-64-v3, x86-64-v4

$ LANG=C h readelf -a libc.so | tail -n 5

Displaying notes found in: .note.ABI-tag
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 3.2.0

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

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

end of thread, other threads:[~2023-08-17  4:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 19:48 [Bug dynamic-link/27318] New: glibc fails to load binaries when built with -march=sandybridge: CPU ISA level is lower than required slyfox at inbox dot ru
2021-02-02 20:19 ` [Bug dynamic-link/27318] " fweimer at redhat dot com
2021-02-02 20:54 ` slyfox at inbox dot ru
2021-02-02 21:11 ` hjl.tools at gmail dot com
2021-02-02 21:19 ` hjl.tools at gmail dot com
2021-02-02 21:52 ` hjl.tools at gmail dot com
2021-02-08  1:46 ` xry111 at mengyan1223 dot wang
2021-02-08  2:27 ` xry111 at mengyan1223 dot wang
2021-02-08  7:18 ` slyfox at inbox dot ru
2021-03-01 14:54 ` schwab@linux-m68k.org
2021-03-06 16:49 ` hjl.tools at gmail dot com
2021-03-16 22:28 ` sam at gentoo dot org
2021-04-27 17:16 ` sourceware at mattwhitlock dot name
2021-04-27 17:22 ` fweimer at redhat dot com
2021-04-27 17:47 ` sourceware at mattwhitlock dot name
2023-08-17  4:18 ` sam at gentoo dot 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).