[PATCH] D29278: [ELF] Bypass section type check #2

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 09:23:30 PST 2017


> +static bool canMergeToProgbits(unsigned Type) {
> +  return Type == SHT_NOBITS || Type == SHT_PROGBITS || Type == SHT_INIT_ARRAY ||
> +         Type == SHT_PREINIT_ARRAY || Type == SHT_FINI_ARRAY ||
> +         Type == SHT_NOTE;
> +}

Please add a comment on what it means. We allow nobits so that linker
script can force disk space to be allocated. The other ones are allowed
for compatibility since there doesn't seem to be a harm in merging
them and they don't require any extra treatment on top of progbits.

> ===================================================================
> --- test/ELF/compatible-section-types.s
> +++ test/ELF/compatible-section-types.s
> @@ -0,0 +1,17 @@
> +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
> +// RUN: ld.lld -shared %t.o -o %t

Check the size of .foo on the output to show that they are all there.


LGTM with the comment and the test change.

Cheers,
Rafael


More information about the llvm-commits mailing list