Page MenuHomeFreeBSD

llvm-objcopy: --discard-locals/--discard-all: allow and keep symbols referenced by relocations
ClosedPublic

Authored by emaste on Aug 28 2025, 12:11 AM.
Tags
None
Referenced Files
F151128887: D52198.id.diff
Mon, Apr 6, 6:55 AM
F151119768: D52198.id161094.diff
Mon, Apr 6, 5:22 AM
F151089103: D52198.id.diff
Sun, Apr 5, 10:47 PM
F151066222: D52198.id161094.diff
Sun, Apr 5, 6:22 PM
Unknown Object (File)
Sun, Apr 5, 12:32 PM
Unknown Object (File)
Fri, Apr 3, 2:11 PM
Unknown Object (File)
Fri, Apr 3, 1:00 PM
Unknown Object (File)
Tue, Mar 31, 8:33 AM
Subscribers

Details

Summary
In GNU objcopy, symbols referenced by relocations are retained. Our COFF
(https://reviews.llvm.org/D56480) and Mach-O
(https://reviews.llvm.org/D75104) ports port the behavior, but the ELF
port doesn't.
 
This PR implements the behavior for ELF.
Close #47468 (tcl has a use case that requires `strip -x tclStubLib.o`
to strip local symbols not referenced by relocations.)
 
Pull Request: https://github.com/llvm/llvm-project/pull/130704

Pulled from LLVM, https://github.com/llvm/llvm-project/commit/7a66a26658f40d00ad4c298260d9c3b8f91e1368 for PR 258820.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable