[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-27 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #13 from H.J. Lu --- (In reply to Andi Kleen from comment #12) > Okay. I only compared gcc-7 (working) vs gcc-9 (broken), but always with LTO. > > Looking at the kernel link it also uses --whole-archive. Perhaps that makes > a differ

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-27 Thread andi-gcc at firstfloor dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #12 from Andi Kleen --- Okay. I only compared gcc-7 (working) vs gcc-9 (broken), but always with LTO. Looking at the kernel link it also uses --whole-archive. Perhaps that makes a difference? I'll redo the test case with --whole-arc

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-27 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #11 from H.J. Lu --- (In reply to Andi Kleen from comment #9) > I think the STB_SECONDARY stuff is only needed if ld -r is used, but not for > ar Linker won't search archive to resolve weak definition. Since SECONDARY is between WEAK

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-27 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #10 from H.J. Lu --- (In reply to Andi Kleen from comment #8) > It works fine without LTO. > > Otherwise the Linux kernel wouldn't work. It relies on this behavior for its > syscalls. > [hjl@gnu-cfl-2 pr95928]$ make /usr/gcc-9.3.1-

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-27 Thread andi-gcc at firstfloor dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #9 from Andi Kleen --- I think the STB_SECONDARY stuff is only needed if ld -r is used, but not for ar

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-27 Thread andi-gcc at firstfloor dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #8 from Andi Kleen --- It works fine without LTO. Otherwise the Linux kernel wouldn't work. It relies on this behavior for its syscalls. The test case is extracted from there.

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-27 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #7 from H.J. Lu --- (In reply to H.J. Lu from comment #6) > It has nothing to do with LTO. You get the same behavior without LTO. > This is how weak symbol works. BTW, this is why I proposed STB_SECONDARY: https://gcc.gnu.org/legac

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-27 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 H.J. Lu changed: What|Removed |Added CC||hjl.tools at gmail dot com --- Comment #6 from

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-26 Thread andi-gcc at firstfloor dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #5 from Andi Kleen --- It doesn't seem to be the plugin itself, I compiled trunk with the gcc-7 lto-plugin.c and it fails too.

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-26 Thread andi-gcc at firstfloor dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #4 from Andi Kleen --- Reproduced on trunk too 11.0-200626 e74c281bf4955eea7fdc5f21b43e29fa0235a5b0

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-26 Thread andi-gcc at firstfloor dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #3 from Andi Kleen --- Versions reproduced: gcc version 10.1.1 20200507 [revision dd38686d9c810cecbaa80bb82ed91caaa58ad635] (SUSE Linux) gcc-9 (SUSE Linux) 9.3.1 20200406 [revision 6db837a5288ee3ca5ec504fbd5a765817e556ac2] Versio

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-26 Thread andi-gcc at firstfloor dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #1 from Andi Kleen --- Created attachment 48792 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48792&action=edit sys_ni.i

[Bug lto/95928] LTO through ar breaks weak function resolution

2020-06-26 Thread andi-gcc at firstfloor dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95928 --- Comment #2 from Andi Kleen --- Created attachment 48793 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48793&action=edit capability.i