diff options
author | Parth Arora <quic_partaror@quicinc.com> | 2024-03-25 16:11:21 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2024-03-25 16:11:21 -0700 |
commit | ebb326a51fec37b5a47e5702e8ea157cd4f835cd (patch) | |
tree | 2df0d5c810bca1bc2c01bf0342ccaea9c9a162b0 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | b6dfaf4c291ee186481f6c1dcab03874d931c307 (diff) | |
download | llvm-ebb326a51fec37b5a47e5702e8ea157cd4f835cd.zip llvm-ebb326a51fec37b5a47e5702e8ea157cd4f835cd.tar.gz llvm-ebb326a51fec37b5a47e5702e8ea157cd4f835cd.tar.bz2 |
[ELF] Fix unnecessary inclusion of unreferenced provide symbols
Previously, linker was unnecessarily including a PROVIDE symbol which
was referenced by another unused PROVIDE symbol. For example, if a
linker script contained the below code and 'not_used_sym' provide symbol
is not included, then linker was still unnecessarily including 'foo' PROVIDE
symbol because it was referenced by 'not_used_sym'. This commit fixes
this behavior.
PROVIDE(not_used_sym = foo)
PROVIDE(foo = 0x1000)
This commit fixes this behavior by using dfs-like algorithm to find
all the symbols referenced in provide expressions of included provide
symbols.
This commit also fixes the issue of unused section not being garbage-collected
if a symbol of the section is referenced by an unused PROVIDE symbol.
Closes #74771
Closes #84730
Co-authored-by: Fangrui Song <i@maskray.me>
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions