[llvm] [llvm-objcopy] Preserve symbols with st_shndx in [SHN_LOOS, SHN_HIOS] (PR #228665)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 00:39:09 PDT 2026
jh7370 wrote:
I didn't address the point about "what GNU objcopy etc do". llvm-objcopy's long-standing compatibility promise is that we will aim for compatibility with GNU tools where it makes sense. There are several other cases within the llvm-objcopy behaviour where we deliberately diverge from GNU's behaviour because it doesn't make sense. Hence, I think it's fine to diverge here. I also prefer our approach of not letting people break their binaries accidentally and requiring specific opt in to "dangerous" behaviour.
I will say that if we really want to accept all OS-specific values (as opposed to SHN_LIVEPATCH + the appropriate OS/ABI, which we can manually add support for), we could add a more general-purpose option than the one in my aside, namely something like `--ignore-unknown-section-indexes`. If a downstream OS has a lot of OS-specific values that they don't want to publish upstream and don't need special handling for, it acts as a convenient hook that they can either add to their build scripts or patch in a downstream llvm-objcopy.
https://github.com/llvm/llvm-project/pull/228665
More information about the llvm-commits
mailing list