Index: test/ELF/relro-non-contiguous.s =================================================================== --- test/ELF/relro-non-contiguous.s +++ test/ELF/relro-non-contiguous.s @@ -18,6 +18,20 @@ // 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: .nonempty1 : { BYTE(1); *(.empty1) } \ +// RUN: .nonempty2 : { . = . + 3 ; *(.empty2) } \ +// 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 + +// CHECK-DYNAMIC: error: section: .dynamic is not contiguous with other relro sections + .section .text, "ax", @progbits .global _start .global bar @@ -26,3 +40,10 @@ .quad bar .quad foo + .section .empty1, "ax", @progbits + .global empty1 +empty1: + + .section .empty2, "ax", @progbits + .global empty2 +empty2: