| Issue |
174363
|
| Summary |
lld: version script ignores local:*; (without space) while GNU ld accepts it
|
| Labels |
lld
|
| Assignees |
|
| Reporter |
hongguifeng
|
Observed behavior:
When using a GNU-style version script with:
local:*;
lld ignores the local rule and exports all non-global symbols.
Adding a space:
local: *;
makes lld behave correctly.
Expected behavior:
`local:*;` and `local: *;` should be equivalent, as they are in GNU ld (bfd) and gold.
Tested linkers:
- ld.bfd: OK
- ld.gold: OK
- ld.lld 19.x: broken
- ld.lld 21.x: broken
This suggests a lexer/parser issue in lld's version script handling.
Demo:
[build.sh](https://github.com/user-attachments/files/24427998/build.sh)
[foo.cpp](https://github.com/user-attachments/files/24427999/foo.cpp)
[map_no_space.map.txt](https://github.com/user-attachments/files/24428000/map_no_space.map.txt)
[map_with_space.map.txt](https://github.com/user-attachments/files/24427997/map_with_space.map.txt)
The output of build.sh:
```
root@8ea318a5f14e:/work# ./build.sh
=== bfd_no_space (bfd, map_no_space.map.txt) ===
Exported symbols:
VERS_1
api_func@@VERS_1
=== bfd_with_space (bfd, map_with_space.map.txt) ===
Exported symbols:
VERS_1
api_func@@VERS_1
=== gold_no_space (gold, map_no_space.map.txt) ===
Exported symbols:
VERS_1
api_func@@VERS_1
=== gold_with_space (gold, map_with_space.map.txt) ===
Exported symbols:
VERS_1
api_func@@VERS_1
=== lld_no_space (lld, map_no_space.map.txt) ===
Exported symbols:
_ZN8internal10cpp_hiddenEv
api_func@@VERS_1
hidden_func1
hidden_func2
=== lld_with_space (lld, map_with_space.map.txt) ===
Exported symbols:
api_func@@VERS_1
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs