[PATCH] D90438: [llvm-objcopy] Make --set-section-flags work with --add-section

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 08:49:29 PST 2020


MaskRay added a comment.

In D90438#2367654 <https://reviews.llvm.org/D90438#2367654>, @jhenderson wrote:

> I think it's unlikely any user is ever going to want to change the flags of .gnu_debuglink. I think there's a slightly higher chance that they might want to for .symtab, which could potentially be added later on. However, I don't see any particular reason to prevent it - in this case, I'd consider GNU's behaviour unhelpful as if somebody has explicitly asked to change the flags of one of these sections, they presumably actually want to and ignoring it is unhelpful. Consequently, where we can //easily// support it, we should (in this case, I believe it's just move the new code even later in the function), but I don't think it's worth doing if it's hard to support.

I know what you are getting at: `objcopy -R .symtab --add-symbol newsym=1234 --set-section-flags=.symtab=exclude a a2` => the flags of .symtab are unchanged. This may be due to BFD's special handling of .symtab
It is probably indeed an unhelpful behavior.

In this patch I don't want to touch that area:/ Changing the flags of .symtab is still an unlikely operation. `--add-sections .* set-section-flags` is more common.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90438/new/

https://reviews.llvm.org/D90438



More information about the llvm-commits mailing list