[all-commits] [llvm/llvm-project] 66d443: [ELF] Combine foo at v1 and foo with the same version...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Wed Aug 4 09:06:17 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 66d4430492131a2205f159071c15e90c10e2fced
https://github.com/llvm/llvm-project/commit/66d4430492131a2205f159071c15e90c10e2fced
Author: Fangrui Song <i at maskray.me>
Date: 2021-08-04 (Wed, 04 Aug 2021)
Changed paths:
M lld/ELF/Driver.cpp
A lld/test/ELF/symver-non-default.s
M lld/test/ELF/version-script-symver.s
M lld/test/ELF/version-symbol-undef.s
Log Message:
-----------
[ELF] Combine foo at v1 and foo with the same versionId if both are defined
Due to an assembler design flaw (IMO), `.symver foo,foo at v1` produces two symbols `foo` and `foo at v1` if `foo` is defined.
* `v1 {};` produces both `foo` and `foo at v1`, but GNU ld only produces `foo at v1`
* `v1 { foo; };` produces both `foo@@v1` and `foo at v1`, but GNU ld only produces `foo at v1`
* `v2 { foo; };` produces both `foo@@v2` and `foo at v1`, matching GNU ld. (Tested by symver.s)
This patch implements the GNU ld behavior by reusing the symbol redirection mechanism
in D92259. The new test symver-non-default.s checks the first two cases.
Without the patch, the second case will produce `foo at v1` and `foo@@v1` which
looks weird and makes foo unnecessarily default versioned.
Note: `.symver foo,foo at v1,remove` exists but the unfortunate `foo` will not go
away anytime soon.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D107235
More information about the All-commits
mailing list