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)
Wed, Nov 26, 8:14 AM
Unknown Object (File)
Nov 4 2025, 2:02 AM
Unknown Object (File)
Nov 2 2025, 11:45 PM
Unknown Object (File)
Oct 29 2025, 8:59 AM
Unknown Object (File)
Oct 29 2025, 8:57 AM
Unknown Object (File)
Oct 29 2025, 8:55 AM
Unknown Object (File)
Oct 29 2025, 8:33 AM
Unknown Object (File)
Oct 26 2025, 8:56 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