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
Unknown Object (File)
Mon, Oct 13, 5:49 AM
Unknown Object (File)
Sat, Oct 11, 8:07 AM
Unknown Object (File)
Sat, Oct 11, 8:07 AM
Unknown Object (File)
Sat, Oct 11, 8:07 AM
Unknown Object (File)
Sat, Oct 11, 12:46 AM
Unknown Object (File)
Fri, Oct 10, 6:09 PM
Unknown Object (File)
Wed, Sep 17, 5:22 PM
Unknown Object (File)
Wed, Sep 17, 7:36 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