[PATCH] D40732: [LLD][ELF] Add linker script generated data to non-contiguous relro test [NFC].

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 13:47:47 PST 2017


Peter Smith via Phabricator <reviews at reviews.llvm.org> writes:

Gah, sorry. I committed a test already out of reflex when reverting a
change.

>
> Index: test/ELF/relro-non-contiguous.s
> ===================================================================
> --- test/ELF/relro-non-contiguous.s
> +++ test/ELF/relro-non-contiguous.s
> @@ -1,3 +1,4 @@
> +// REQUIRES: x86
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t.o
>  // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/copy-in-shared.s -o %t2.o
>  // RUN: ld.lld -shared %t.o %t2.o -o %t.so
> @@ -15,14 +16,36 @@
>  // RUN: not ld.lld %t3.o %t.so -z relro -o %t --script=%t.script 2>&1 | FileCheck %s
>  // No error when we do not request relro.
>  // RUN: ld.lld %t3.o %t.so -z norelro -o %t --script=%t.script
> -// REQUIRES: x86
>  
>  // CHECK: error: section: .bss.rel.ro is not contiguous with other relro sections
> +
> +// Insert a linkerscript command generating non-relro inbetween relro, these
> +// may not have been evaluated by the time we calculate relro. This test is to
> +// guard against skipping past non zero sized sections incorrectly.
> +// RUN: echo "SECTIONS { \
> +// RUN: .got.plt : { *(.got.plt) } \
> +// RUN: .nonempty : { BYTE(1); *(.empty) } \

I don't think the *(.empty) adds anything to the test.

> +// RUN: .dynamic : { *(.dynamic) } \
> +// RUN: } " > %t.script2
> +// RUN: not ld.lld %t3.o %t.so -z relro -o %t --script=%t.script2 2>&1 | FileCheck -check-prefix=CHECK-DYNAMIC %s
> +
> +// RUN: echo "SECTIONS { \
> +// RUN: .got.plt : { *(.got.plt) } \
> +// RUN: .nonempty : {  . = . + 3 ; *(.empty) } \
> +// RUN: .dynamic : { *(.dynamic) } \
> +// RUN: } " > %t.script3
> +// RUN: not ld.lld %t3.o %t.so -z relro -o %t --script=%t.script3 2>&1 | FileCheck -check-prefix=CHECK-DYNAMIC %s

This is almost exactly what I added as
test/ELF/relro-non-contiguous-script-data.s.

Would you mind rebasing this to add the BYTE case there instead?

Sorry,
Rafael



More information about the llvm-commits mailing list