[PATCH] D60324: [llvm-objcopy] Add switch to allow removing referenced sections
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 06:04:02 PDT 2019
jhenderson marked 2 inline comments as done.
jhenderson added inline comments.
================
Comment at: test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test:41
+# SECTIONS: Link
+# SECTIONS-SAME: : 0
----------------
grimar wrote:
> Why not just `SECTIONS: Link: 0`?
If the Link field is not 0 and I do `SECTIONS: Link: 0`, then it will find a different sh_link output later on with value 0, potentially. I could workaround this by doing CHECK-NEXT a few times on the unimportant fields, but it's not really ideal.
================
Comment at: tools/llvm-objcopy/ELF/Object.cpp:566
+ "referenced by the relocation section %s.",
+ Symbols->Name.data(), this->Name.data());
----------------
grimar wrote:
> It is a bit hard to follow `if`s it seems, I would suggest adding bracers,
> like you did for `removeSectionReferences` or
> or may be even doing something like next for better readability:
>
> ```
> if (ToRemove(Symbols)) {
> if (!AllowBrokenDependencies)
> return createStringError(
> llvm::errc::invalid_argument,
> "Symbol table %s cannot be removed because it is "
> "referenced by the relocation section %s.",
> Symbols->Name.data(), this->Name.data());
>
> Symbols = nullptr;
> }
> ```
I like this suggestion, thanks.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60324/new/
https://reviews.llvm.org/D60324
More information about the llvm-commits
mailing list