Bug 28197 - compat_symbol should migrate to .symver *, *, remove
Summary: compat_symbol should migrate to .symver *, *, remove
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: build (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-05 18:17 UTC by Fangrui Song
Modified: 2021-08-05 18:17 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2021-08-05 18:17:45 UTC
Due to an assembler design flaw (IMO), .symver foo,foo@v1 produces two symbols `foo` and foo@v1 if foo is defined. This has caused all sorts of linker complexity (in all of GNU ld, gold, and ld.lld AFAICT from PRs). .symver should really behave like "rename" && there should only be one defined symbol 'foo@v1'

I implemented a hack for LLD 13.0.0: https://reviews.llvm.org/D107235

Due to PR gold/28196, gold linked libc.so has many default version symbols (e.g. __free_hook@@GLIBC_2.2.5) while they should be non-default version symbols instead.


Migrating to .symver foo,foo@v1, remove  can make all of GNU ld, gold, and ld.lld happier. They all implement some hacks to ensure foo and foo@v1 don't end up with two dynamic symbols. The migration is blocked on PR gas/28157 (make relocations work).

After glibc is migrated, if at some point the compatibility with the old `.symver foo,foo@v1` behavior is no longer needed, we can default gas to `,remove`. Over time, all linkers can drop their foo && foo@v1 combining hacks.