<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jan 6, 2017 at 10:54 AM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">Peter Collingbourne via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> writes:<br>
<br>
<br>
</span>> Index: lld/test/ELF/relocation-copy-<wbr>relro.s<br>
> ==============================<wbr>==============================<wbr>=======<br>
> --- /dev/null<br>
> +++ lld/test/ELF/relocation-copy-<wbr>relro.s<br>
> @@ -0,0 +1,33 @@<br>
> +// REQUIRES: x86<br>
> +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o<br>
> +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy-<wbr>relro.s -o %t2.o<br>
> +// RUN: ld.lld -shared %t2.o -o %t.so<br>
> +// RUN: ld.lld %t.o %t.so -o %t3<br>
> +// RUN: llvm-readobj -program-headers -s -r %t3 | FileCheck %s<br>
> +<br>
> +// CHECK:        Index: 7<br>
<br>
I don't think the index is relevant for the test.<br></blockquote><div><br></div><div>Ok, I'll remove it.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> +// CHECK-NEXT:   Name: .<a href="http://data.rel.ro" rel="noreferrer" target="_blank">data.rel.ro</a> (48)<br>
<br>
Why not the original .<a href="http://bss.rel.ro" rel="noreferrer" target="_blank">bss.rel.ro</a> name?<br></blockquote><div><br></div><div>Sorry, this should be testing for .<a href="http://bss.rel.ro">bss.rel.ro</a> (and NOBITS below). I'll fix this once I update the remaining tests.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> +// CHECK-NEXT:   Type: SHT_PROGBITS (0x1)<br>
> +// CHECK-NEXT:   Flags [ (0x3)<br>
> +// CHECK-NEXT:     SHF_ALLOC (0x2)<br>
> +// CHECK-NEXT:     SHF_WRITE (0x1)<br>
> +// CHECK-NEXT:   ]<br>
> +// CHECK-NEXT:   Address: 0x2020B0<br>
> +// CHECK-NEXT:   Offset: 0x20B0<br>
> +// CHECK-NEXT:   Size: 8<br>
<br>
<br>
> -  // The TLS initialization block needs to be a single contiguous block in a R/W<br>
> -  // PT_LOAD, so stick TLS sections directly before R/W sections. The TLS NOBITS<br>
> -  // sections are placed here as they don't take up virtual address space in the<br>
> -  // PT_LOAD.<br>
>    bool AIsTls = A->Flags & SHF_TLS;<br>
>    bool BIsTls = B->Flags & SHF_TLS;<br>
> -  if (AIsTls != BIsTls)<br>
> -    return AIsTls;<br>
<br>
Why was it necessary to move TLS? Was there any problem with keeping it<br>
at the start of the RW PT_LOAD?<br></blockquote><div><br></div><div>All TLS sections are RELRO (see <a href="http://llvm-cs.pcc.me.uk/tools/lld/ELF/Writer.cpp#487">http://llvm-cs.pcc.me.uk/tools/lld/ELF/Writer.cpp#487</a>) so they need to be kept contiguous with the other RELRO sections.<br></div><div><br></div><div>Thanks,</div></div>-- <br><div class="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></div>