[PATCH] D83264: [ELF] Add -z dead-reloc-in-nonalloc=<section_glob>=<value>
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 7 09:15:53 PDT 2020
MaskRay added inline comments.
================
Comment at: lld/ELF/Options.td:127
+defm dead_nonalloc_reloc_value : EEq<"dead-nonalloc-reloc-value",
+ "Resolve a relocation from a matched non-SHF_ALLOC section to a discarded "
----------------
psmith wrote:
> I think it will be worth mentioning that the there can be multiple occurrences and that the last takes precedence.
> "Resolve a relocation from a matched non-SHF_ALLOC section to a discarded symbol to the specified value. Accepts wildcards, in the event of a section matching more than one instance of this option, the last instance on the command-line takes precedence."
Thanks for the suggestion.
My fault, we don't actually have a help for `-z` options, so I can only leave the message in ld.lld.1
We probably should figure out a way to print `-z` options in `--help`.
I pick `-z` because nonalloc is an ELF specific concept.
================
Comment at: lld/test/ELF/debug-dead-reloc.s:27
+# OVERRIDE: Contents of section .debug_loc:
+# OVERRIDE-NEXT: 0000 2a000000 00000000 2a000000 00000000
+
----------------
grimar wrote:
> What about printing other sections content too?
> (seems there is no other test showing that when override the tombstone value for a debug section, the other ones
> remain unaffected)
>
> Probably it worth to combine `CHECK` and `OVERRIDE`:
>
> ```
> # CHECK: Contents of section .debug_loc:
> # NOOVERRIDE-NEXT: 0000 feffffff ffffffff feffffff ffffffff
> # OVERRIDE-NEXT: 0000 2a000000 00000000 2a000000 00000000
> ...
> ```
I think the value testing more section contents is low. This is just an auxiliary test showing that --gc-sections is similar to ICF.
(Moreover, NOOVERRIDE is longer than CHECK and I would need to re-align `CHECK-NEXT:` above.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83264/new/
https://reviews.llvm.org/D83264
More information about the llvm-commits
mailing list