[PATCH] D28272: ELF: Reserve space for copy relocations of read-only symbols in relro.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 6 10:54:24 PST 2017
Peter Collingbourne via Phabricator <reviews at reviews.llvm.org> writes:
> Index: lld/test/ELF/relocation-copy-relro.s
> ===================================================================
> --- /dev/null
> +++ lld/test/ELF/relocation-copy-relro.s
> @@ -0,0 +1,33 @@
> +// REQUIRES: x86
> +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
> +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy-relro.s -o %t2.o
> +// RUN: ld.lld -shared %t2.o -o %t.so
> +// RUN: ld.lld %t.o %t.so -o %t3
> +// RUN: llvm-readobj -program-headers -s -r %t3 | FileCheck %s
> +
> +// CHECK: Index: 7
I don't think the index is relevant for the test.
> +// CHECK-NEXT: Name: .data.rel.ro (48)
Why not the original .bss.rel.ro name?
> +// CHECK-NEXT: Type: SHT_PROGBITS (0x1)
> +// CHECK-NEXT: Flags [ (0x3)
> +// CHECK-NEXT: SHF_ALLOC (0x2)
> +// CHECK-NEXT: SHF_WRITE (0x1)
> +// CHECK-NEXT: ]
> +// CHECK-NEXT: Address: 0x2020B0
> +// CHECK-NEXT: Offset: 0x20B0
> +// CHECK-NEXT: Size: 8
> - // The TLS initialization block needs to be a single contiguous block in a R/W
> - // PT_LOAD, so stick TLS sections directly before R/W sections. The TLS NOBITS
> - // sections are placed here as they don't take up virtual address space in the
> - // PT_LOAD.
> bool AIsTls = A->Flags & SHF_TLS;
> bool BIsTls = B->Flags & SHF_TLS;
> - if (AIsTls != BIsTls)
> - return AIsTls;
Why was it necessary to move TLS? Was there any problem with keeping it
at the start of the RW PT_LOAD?
Cheers,
Rafael
More information about the llvm-commits
mailing list