public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Martin.Jansa at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug build/29454] New: dl-cache.c:513: undefined reference to `strcpy' with -Og or -O1 (doesn't happen with -O2)
Date: Sun, 07 Aug 2022 13:50:31 +0000	[thread overview]
Message-ID: <bug-29454-131@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 29454
           Summary: dl-cache.c:513: undefined reference to `strcpy' with
                    -Og or -O1 (doesn't happen with -O2)
           Product: glibc
           Version: 2.36
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: Martin.Jansa at gmail dot com
                CC: carlos at redhat dot com
  Target Milestone: ---

When building glibc with -Og I've started to see "dl-cache.c:513: undefined
reference to `strcpy'" introduced in:

6b9006bfb0 x86: Move strcpy SSE2 implementation to multiarch/strcpy-sse2.S

x86_64-oe-linux-gcc (GCC) 12.1.0

x86_64-oe-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse 
--sysroot=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot
-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
-fmacro-prefix-map=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0=/usr/src/debug/glibc/2.36-r0
                    
-fdebug-prefix-map=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0=/usr/src/debug/glibc/2.36-r0
                    
-fdebug-prefix-map=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot=
                    
-fdebug-prefix-map=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot-native=
 -Wl,-z,relro,-z,now -fuse-ld=bfd  -nostdlib -nostartfiles -r -o
/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/librtld.os
'-Wl,-('
/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/dl-allobjs.os
/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/rtld-libc.a
-lgcc '-Wl,-)' \
         
-Wl,-Map,/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/librtld.os.map
x86_64-oe-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse 
--sysroot=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot
-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
-fmacro-prefix-map=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0=/usr/src/debug/glibc/2.36-r0
                    
-fdebug-prefix-map=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0=/usr/src/debug/glibc/2.36-r0
                    
-fdebug-prefix-map=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot=
                    
-fdebug-prefix-map=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot-native=
 -Wl,-z,relro,-z,now -fuse-ld=bfd  -nostdlib -nostartfiles -shared -o
/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/ld.so.new
             \
          -Wl,-z,relro -Wl,-z,defs -Wl,-z,now   \
          -Wl,-z,pack-relative-relocs \
         
/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/librtld.os
-Wl,--version-script=/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/ld.map
             \
          -Wl,-soname=ld-linux-x86-64.so.2
/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/12.1.0/ld.bfd:
/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/librtld.os:
in function `_dl_load_cache_lookup':
/usr/src/debug/glibc/2.36-r0/git/elf/dl-cache.c:513: undefined reference to
`strcpy'
collect2: error: ld returned 1 exit status

There was another build issue when building with -Og or -O1 in bug 29249.

As work around I'm reverting these 3 commits (the middle one is just to avoid
conflicts with the top one, but 6b9006bfb0 is where the strcpy was first
reproducible:

04538ceb0d Revert "x86: Move strcpy SSE2 implementation to
multiarch/strcpy-sse2.S"
3e31c3f7c6 Revert "x86: Add support to build st{p|r}{n}{cpy|cat} with explicit
ISA level"
e5ec49260b Revert "Linux: Implement a useful version of _startup_fatal"

I don't understand this code at all, but from poking what changed with objdump
I've noticed that the symbol in rtld-strcpy-sse2.os is now uppercase:

objdump -x build-x86_64-oe-linux/string/rtld-strcpy-sse2.os | grep -i strcpy
build-x86_64-oe-linux/string/rtld-strcpy-sse2.os:     file format elf64-x86-64
build-x86_64-oe-linux/string/rtld-strcpy-sse2.os
0000000000000000 g     F .text  00000000000000ec STRCPY

while build from the commit just before 6b9006bfb0 shows:

objdump -x build-x86_64-oe-linux/string/rtld-strcpy-sse2.os | grep -i strcpy
build-x86_64-oe-linux/string/rtld-strcpy-sse2.os:     file format elf64-x86-64
build-x86_64-oe-linux/string/rtld-strcpy-sse2.os
0000000000000000 g     F .text  00000000000000ec strcpy

This might be also interesting, librtld.os.map diff shows only
elf/rtld-libc.a(rtld-stpcpy.os) now, while before it was showing
elf/rtld-libc.a(rtld-stpcpy-sse2.os) and elf/rtld-libc.a(rtld-strcpy-sse2.os)

--- build-x86_64-oe-linux.O2/elf/librtld.mk     2022-08-07 13:20:11.154223394
+0000
+++ build-x86_64-oe-linux.Og/elf/librtld.mk     2022-08-07 13:18:29.389217048
+0000
@@ -16,6 +16,7 @@
 rtld-string +=stpcpy.os
 rtld-string +=strchr.os
 rtld-string +=strcmp.os
+rtld-string +=strcpy.os
 rtld-string +=strcspn.os
 rtld-string +=strdup.os
 rtld-string +=strerrorname_np.os
@@ -112,6 +113,16 @@
 rtld-string +=strcmp.os
 rtld-string +=strcmp-sse4_2.os
 rtld-string +=strcmp.os
+rtld-string +=strcpy-avx2.os
+rtld-string +=strcpy.os
+rtld-string +=strcpy-avx2-rtm.os
+rtld-string +=strcpy.os
+rtld-string +=strcpy-evex.os
+rtld-string +=strcpy.os
+rtld-string +=strcpy-sse2.os
+rtld-string +=strcpy.os
+rtld-string +=strcpy-sse2-unaligned.os
+rtld-string +=strcpy.os
 rtld-string +=strcspn-sse4.os
 rtld-string +=strcspn.os
 rtld-string +=strlen-avx2.os

Replacing -Og with -O2 fixes the issue (but unlike bug 29249 "-O1
-fexpensive-optimizations" instead of "-Og" isn't enough here).

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

             reply	other threads:[~2022-08-07 13:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 13:50 Martin.Jansa at gmail dot com [this message]
2022-08-07 13:51 ` [Bug build/29454] " Martin.Jansa at gmail dot com
2022-08-07 14:36 ` Martin.Jansa at gmail dot com
2022-08-07 14:43 ` goldstein.w.n at gmail dot com
2022-08-07 14:44 ` goldstein.w.n at gmail dot com
2022-08-07 15:00 ` Martin.Jansa at gmail dot com
2022-08-07 15:05 ` goldstein.w.n at gmail dot com
2022-08-07 15:12 ` Martin.Jansa at gmail dot com
2022-08-07 15:13 ` Martin.Jansa at gmail dot com
2022-08-07 15:26 ` goldstein.w.n at gmail dot com
2022-08-07 15:28 ` goldstein.w.n at gmail dot com
2022-08-07 15:28 ` goldstein.w.n at gmail dot com
2022-08-07 15:38 ` Martin.Jansa at gmail dot com
2022-08-07 15:38 ` Martin.Jansa at gmail dot com
2022-08-07 15:39 ` Martin.Jansa at gmail dot com
2022-08-07 15:39 ` Martin.Jansa at gmail dot com
2022-08-07 15:56 ` goldstein.w.n at gmail dot com
2022-08-07 15:56 ` goldstein.w.n at gmail dot com
2022-08-07 16:03 ` Martin.Jansa at gmail dot com
2022-08-07 16:07 ` goldstein.w.n at gmail dot com
2022-08-07 19:39 ` hjl.tools at gmail dot com
2022-08-08  2:52 ` goldstein.w.n at gmail dot com
2022-08-08  3:27 ` goldstein.w.n at gmail dot com
2022-08-08 10:27 ` yann at droneaud dot fr
2022-08-08 19:59 ` sam at gentoo dot org
2022-08-09 10:16 ` goldstein.w.n at gmail dot com
2022-08-09 14:49 ` hjl.tools at gmail dot com
2022-08-09 14:51 ` Martin.Jansa at gmail dot com
2022-08-11 15:33 ` goldstein.w.n at gmail dot com

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