From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EE0E83858004; Sun, 7 Aug 2022 13:50:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE0E83858004 From: "Martin.Jansa at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: build X-Bugzilla-Version: 2.36 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: Martin.Jansa at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2022 13:50:32 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29454 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=3Dcore2 -mtune=3Dcore2 -msse3 -mfpmath=3Ds= se=20 --sysroot=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r= 0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=3Dgnu -Wl,--as-needed -fmacro-prefix-map=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/gli= bc/2.36-r0=3D/usr/src/debug/glibc/2.36-r0 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 -fdebug-prefix-map=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/gli= bc/2.36-r0=3D/usr/src/debug/glibc/2.36-r0 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 -fdebug-prefix-map=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/gli= bc/2.36-r0/recipe-sysroot=3D =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 -fdebug-prefix-map=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/gli= bc/2.36-r0/recipe-sysroot-native=3D -Wl,-z,relro,-z,now -fuse-ld=3Dbfd -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,-)' \ =20=20=20=20=20=20=20=20=20 -Wl,-Map,/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/b= uild-x86_64-oe-linux/elf/librtld.os.map x86_64-oe-linux-gcc -m64 -march=3Dcore2 -mtune=3Dcore2 -msse3 -mfpmath=3Ds= se=20 --sysroot=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r= 0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=3Dgnu -Wl,--as-needed -fmacro-prefix-map=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/gli= bc/2.36-r0=3D/usr/src/debug/glibc/2.36-r0 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 -fdebug-prefix-map=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/gli= bc/2.36-r0=3D/usr/src/debug/glibc/2.36-r0 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 -fdebug-prefix-map=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/gli= bc/2.36-r0/recipe-sysroot=3D =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 -fdebug-prefix-map=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/gli= bc/2.36-r0/recipe-sysroot-native=3D -Wl,-z,relro,-z,now -fuse-ld=3Dbfd -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 \ =20=20=20=20=20=20=20=20=20 /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=3D/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/g= libc/2.36-r0/build-x86_64-oe-linux/ld.map \ -Wl,-soname=3Dld-linux-x86-64.so.2 /OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sys= root-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_6= 4-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 avo= id 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 expli= cit 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 objd= ump 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.o= s) --- build-x86_64-oe-linux.O2/elf/librtld.mk 2022-08-07 13:20:11.1542233= 94 +0000 +++ build-x86_64-oe-linux.Og/elf/librtld.mk 2022-08-07 13:18:29.3892170= 48 +0000 @@ -16,6 +16,7 @@ rtld-string +=3Dstpcpy.os rtld-string +=3Dstrchr.os rtld-string +=3Dstrcmp.os +rtld-string +=3Dstrcpy.os rtld-string +=3Dstrcspn.os rtld-string +=3Dstrdup.os rtld-string +=3Dstrerrorname_np.os @@ -112,6 +113,16 @@ rtld-string +=3Dstrcmp.os rtld-string +=3Dstrcmp-sse4_2.os rtld-string +=3Dstrcmp.os +rtld-string +=3Dstrcpy-avx2.os +rtld-string +=3Dstrcpy.os +rtld-string +=3Dstrcpy-avx2-rtm.os +rtld-string +=3Dstrcpy.os +rtld-string +=3Dstrcpy-evex.os +rtld-string +=3Dstrcpy.os +rtld-string +=3Dstrcpy-sse2.os +rtld-string +=3Dstrcpy.os +rtld-string +=3Dstrcpy-sse2-unaligned.os +rtld-string +=3Dstrcpy.os rtld-string +=3Dstrcspn-sse4.os rtld-string +=3Dstrcspn.os rtld-string +=3Dstrlen-avx2.os Replacing -Og with -O2 fixes the issue (but unlike bug 29249 "-O1 -fexpensive-optimizations" instead of "-Og" isn't enough here). --=20 You are receiving this mail because: You are on the CC list for the bug.=