[all-commits] [llvm/llvm-project] ebb326: [ELF] Fix unnecessary inclusion of unreferenced pr...
partaror via All-commits
all-commits at lists.llvm.org
Mon Mar 25 16:11:44 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ebb326a51fec37b5a47e5702e8ea157cd4f835cd
https://github.com/llvm/llvm-project/commit/ebb326a51fec37b5a47e5702e8ea157cd4f835cd
Author: Parth Arora <quic_partaror at quicinc.com>
Date: 2024-03-25 (Mon, 25 Mar 2024)
Changed paths:
M lld/ELF/Driver.cpp
M lld/ELF/LinkerScript.cpp
M lld/ELF/LinkerScript.h
M lld/ELF/ScriptParser.cpp
M lld/ELF/SymbolTable.cpp
M lld/ELF/SymbolTable.h
A lld/test/ELF/gc-sections-with-provide.s
M lld/test/ELF/linkerscript/symbolreferenced.s
Log Message:
-----------
[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 at maskray.me>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list