Bug 2148469
| Summary: | gcc: Attribute symver leads to linker failure with multiple symbol versions | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Florian Weimer <fweimer> |
| Component: | binutils | Assignee: | Nick Clifton <nickc> |
| binutils sub component: | system-version | QA Contact: | Miloš Prchlík <mprchlik> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | unspecified | ||
| Priority: | unspecified | CC: | ahajkova, berrange, dbelyavs, fweimer, jakub, jdenemar, mcermak, mprchlik, nickc, ohudlick, sipoyare |
| Version: | 9.2 | Keywords: | Bugfix, Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | binutils-2.35.2-35.el9 | Doc Type: | No Doc Update |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-05-09 08:24:17 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 2124466, 2133809 | ||
(In reply to Florian Weimer from comment #0) Hi Florian, > gcc -Wall -O2 -shared -fpic t.c -Wl,--version-script t.lds > gcc -flto -Wall -O2 -shared -fpic t.c -Wl,--version-script t.lds > /usr/bin/ld: /tmp/ccDIqhWD.ltrans0.ltrans.o: in function > `OPENSSL_strcasecmp': > <artificial>:(.text+0x0): multiple definition of `OPENSSL_strcasecmp' > Nick, does this look like a binutils issue to you? Definitely. Well 90%. I suppose that there is a possibility that this will turn out to be a bug in the lto plugin, rather than the linker itself. Would you mind filing this upstream ? Cheers Nick Never mind. I have found that the bug was fixed upstream some time between 2.37 and 2.38. Reassigning to me... Found it: https://sourceware.org/bugzilla/show_bug.cgi?id=28264 Working on a patch... Fixed in binutils-2.35.2-26.el9 Verified with binutils-2.35.2-33.el9. Right - should be fixed in binutils-2.35.2-35.el9 Verified with binutils-2.35.2-35.el9. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (binutils bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2023:2548 |
Package versions: binutils-2.35.2-24.el9.x86_64 gcc-11.3.1-2.1.el9.x86_64 This script produces a shared object with the expected alias: cat > t.c <<EOF int __attribute__ ((symver ("OPENSSL_strcasecmp.1"), symver ("OPENSSL_strcasecmp@@OPENSSL_3.0.3"))) OPENSSL_strcasecmp (const char *a, const char *b) { return 0; } EOF cat > t.lds <<EOF OPENSSL_3.0.1 { global: OPENSSL_strcasecmp; local: *; }; OPENSSL_3.0.3 { global: OPENSSL_strcasecmp; local: *; } OPENSSL_3.0.1; EOF gcc -Wall -O2 -shared -fpic t.c -Wl,--version-script t.lds But replacing the final command does not: gcc -flto -Wall -O2 -shared -fpic t.c -Wl,--version-script t.lds /usr/bin/ld: /tmp/ccDIqhWD.ltrans0.ltrans.o: in function `OPENSSL_strcasecmp': <artificial>:(.text+0x0): multiple definition of `OPENSSL_strcasecmp' /usr/bin/ld: /tmp/ccDIqhWD.ltrans0.ltrans.o:(*IND*+0x0): multiple definition of `OPENSSL_strcasecmp' collect2: error: ld returned 1 exit status The assembler difference from LTO non-LTO mode appears to be: .LFE0: .size OPENSSL_strcasecmp, .-OPENSSL_strcasecmp - .symver OPENSSL_strcasecmp, OPENSSL_strcasecmp.1 .symver OPENSSL_strcasecmp, OPENSSL_strcasecmp@@OPENSSL_3.0.3 + .symver OPENSSL_strcasecmp, OPENSSL_strcasecmp.1 .ident "GCC: (GNU) 11.3.1 20220421 (Red Hat 11.3.1-2)" .section .note.GNU-stack,"",@progbits And the symbol table order is similarly transposed: 7: 0000000000000000 0 SECTION LOCAL DEFAULT 4 8: 0000000000000000 3 FUNC GLOBAL DEFAULT 1 OPENSSL_strcasecmp - 9: 0000000000000000 3 FUNC GLOBAL DEFAULT 1 OPENSSL_strcasecmp@@OPENSSL_3.0.3 - 10: 0000000000000000 3 FUNC GLOBAL DEFAULT 1 OPENSSL_strcasecmp.1 + 9: 0000000000000000 3 FUNC GLOBAL DEFAULT 1 OPENSSL_strcasecmp.1 + 10: 0000000000000000 3 FUNC GLOBAL DEFAULT 1 OPENSSL_strcasecmp@@OPENSSL_3.0.3 I'm not sure if these are the differences that trigger the linker failure. Nick, does this look like a binutils issue to you?