<div dir="ltr">LGTM. A few minor comments.<div><br><div><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ // Sort by section position preference.<br>
+ DefinedAtom::SectionPosition leftPos = left->sectionPosition();<br>
+ DefinedAtom::SectionPosition rightPos = right->sectionPosition();<br>
+<br>
+ DEBUG(llvm::dbgs() << "Sorting by sectionPos"<br>
+ << "(" << leftPos << "," << rightPos << ")\n");<br></blockquote><div><br></div><div style>I'd move this part into the following "if (leftSpecialPos || rightSpecialPos)" block.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> } else {<br>
- _ordinalOverrideMap[atom] = index;<br>
+ _ordinalOverrideMap[atom] = index++;<br>
}<br>
}<br>
}<br></blockquote><div><br></div><div style>I remember that the first time I read this code I thought this looks suspicious. I should have asked you if this is correct.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Modified: lld/trunk/test/elf/Hexagon/dynlib-gotoff.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Hexagon/dynlib-gotoff.test?rev=182494&r1=182493&r2=182494&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Hexagon/dynlib-gotoff.test?rev=182494&r1=182493&r2=182494&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf/Hexagon/dynlib-gotoff.test (original)<br>
+++ lld/trunk/test/elf/Hexagon/dynlib-gotoff.test Wed May 22 12:41:04 2013<br>
@@ -82,6 +82,62 @@ CHECKGOTPLT: offset: 8<br>
CHECKGOTPLT: - kind: R_HEX_B22_PCREL<br>
CHECKGOTPLT: offset: 12<br>
target: __plt_fn2<br>
+ - name: .PLT0<br>
+CHECKGOTPLT: type: stub<br>
+CHECKGOTPLT: content: [ 00, 40, 00, 00, 1C, C0, 49, 6A, 0E, 42, 9C, E2,<br>
+CHECKGOTPLT: 4F, 40, 9C, 91, 3C, C0, 9C, 91, 0E, 42, 0E, 8C,<br>
+CHECKGOTPLT: 00, C0, 9C, 52 ]<br>
+CHECKGOTPLT: alignment: 2^4<br>
+CHECKGOTPLT: section-name: .plt<br>
+CHECKGOTPLT: references:<br>
+CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X<br>
+CHECKGOTPLT: offset: 0<br>
+ target: __got0<br>
+CHECKGOTPLT: - kind: R_HEX_6_PCREL_X<br>
+CHECKGOTPLT: offset: 4<br>
+ target: __got0<br>
+ - name: __plt_fn<br>
+CHECKGOTPLT: type: stub<br>
+CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91,<br>
+CHECKGOTPLT: 00, C0, 9C, 52 ]<br>
+CHECKGOTPLT: alignment: 2^4<br>
+CHECKGOTPLT: section-name: .plt<br>
+CHECKGOTPLT: references:<br>
+CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X<br>
+CHECKGOTPLT: offset: 0<br>
+ target: __got_fn<br>
+CHECKGOTPLT: - kind: R_HEX_6_PCREL_X<br>
+CHECKGOTPLT: offset: 4<br>
+ target: __got_fn<br>
+CHECKGOTPLT: addend: 4<br>
+ - name: __plt_fn1<br>
+CHECKGOTPLT: type: stub<br>
+CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91,<br>
+CHECKGOTPLT: 00, C0, 9C, 52 ]<br>
+CHECKGOTPLT: alignment: 2^4<br>
+CHECKGOTPLT: section-name: .plt<br>
+CHECKGOTPLT: references:<br>
+CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X<br>
+CHECKGOTPLT: offset: 0<br>
+ target: __got_fn1<br>
+CHECKGOTPLT: - kind: R_HEX_6_PCREL_X<br>
+CHECKGOTPLT: offset: 4<br>
+ target: __got_fn1<br>
+CHECKGOTPLT: addend: 4<br>
+ - name: __plt_fn2<br>
+CHECKGOTPLT: type: stub<br>
+CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91,<br>
+CHECKGOTPLT: 00, C0, 9C, 52 ]<br>
+CHECKGOTPLT: alignment: 2^4<br>
+CHECKGOTPLT: section-name: .plt<br>
+CHECKGOTPLT: references:<br>
+CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X<br>
+CHECKGOTPLT: offset: 0<br>
+ target: __got_fn2<br>
+CHECKGOTPLT: - kind: R_HEX_6_PCREL_X<br>
+CHECKGOTPLT: offset: 4<br>
+ target: __got_fn2<br>
+CHECKGOTPLT: addend: 4<br>
- name: __got0<br>
CHECKGOTPLT: type: got<br>
CHECKGOTPLT: content: [ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,<br>
@@ -147,59 +203,3 @@ CHECKGOTPLT: target: fn2<br>
CHECKGOTPLT: - kind: R_HEX_32<br>
CHECKGOTPLT: offset: 0<br>
target: .PLT0<br>
- - name: .PLT0<br>
-CHECKGOTPLT: type: stub<br>
-CHECKGOTPLT: content: [ 00, 40, 00, 00, 1C, C0, 49, 6A, 0E, 42, 9C, E2,<br>
-CHECKGOTPLT: 4F, 40, 9C, 91, 3C, C0, 9C, 91, 0E, 42, 0E, 8C,<br>
-CHECKGOTPLT: 00, C0, 9C, 52 ]<br>
-CHECKGOTPLT: alignment: 2^4<br>
-CHECKGOTPLT: section-name: .plt<br>
-CHECKGOTPLT: references:<br>
-CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X<br>
-CHECKGOTPLT: offset: 0<br>
- target: __got0<br>
-CHECKGOTPLT: - kind: R_HEX_6_PCREL_X<br>
-CHECKGOTPLT: offset: 4<br>
- target: __got0<br>
- - name: __plt_fn<br>
-CHECKGOTPLT: type: stub<br>
-CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91,<br>
-CHECKGOTPLT: 00, C0, 9C, 52 ]<br>
-CHECKGOTPLT: alignment: 2^4<br>
-CHECKGOTPLT: section-name: .plt<br>
-CHECKGOTPLT: references:<br>
-CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X<br>
-CHECKGOTPLT: offset: 0<br>
- target: __got_fn<br>
-CHECKGOTPLT: - kind: R_HEX_6_PCREL_X<br>
-CHECKGOTPLT: offset: 4<br>
- target: __got_fn<br>
-CHECKGOTPLT: addend: 4<br>
- - name: __plt_fn1<br>
-CHECKGOTPLT: type: stub<br>
-CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91,<br>
-CHECKGOTPLT: 00, C0, 9C, 52 ]<br>
-CHECKGOTPLT: alignment: 2^4<br>
-CHECKGOTPLT: section-name: .plt<br>
-CHECKGOTPLT: references:<br>
-CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X<br>
-CHECKGOTPLT: offset: 0<br>
- target: __got_fn1<br>
-CHECKGOTPLT: - kind: R_HEX_6_PCREL_X<br>
-CHECKGOTPLT: offset: 4<br>
- target: __got_fn1<br>
-CHECKGOTPLT: addend: 4<br>
- - name: __plt_fn2<br>
-CHECKGOTPLT: type: stub<br>
-CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91,<br>
-CHECKGOTPLT: 00, C0, 9C, 52 ]<br>
-CHECKGOTPLT: alignment: 2^4<br>
-CHECKGOTPLT: section-name: .plt<br>
-CHECKGOTPLT: references:<br>
-CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X<br>
-CHECKGOTPLT: offset: 0<br>
- target: __got_fn2<br>
-CHECKGOTPLT: - kind: R_HEX_6_PCREL_X<br>
-CHECKGOTPLT: offset: 4<br>
- target: __got_fn2<br>
-CHECKGOTPLT: addend: 4<br>
<br>
Modified: lld/trunk/test/elf/dynamic.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/dynamic.test?rev=182494&r1=182493&r2=182494&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/dynamic.test?rev=182494&r1=182493&r2=182494&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf/dynamic.test (original)<br>
+++ lld/trunk/test/elf/dynamic.test Wed May 22 12:41:04 2013<br>
@@ -13,13 +13,13 @@ CHECK: kind: R_X86_64_PC32<br>
CHECK: offset: 18<br>
CHECK: target: [[PLTNAME:[-a-zA-Z0-9_]+]]<br>
<br>
+CHECK: name: [[PLTNAME]]<br>
+CHECK: type: stub<br>
+<br>
CHECK: type: got<br>
CHECK: references:<br>
CHECK: kind: R_X86_64_JUMP_SLOT<br>
<br>
-CHECK: name: [[PLTNAME]]<br>
-CHECK: type: stub<br>
-<br>
CHECK: shared-library-atoms:<br>
CHECK: name: foo<br>
CHECK: load-name: shared.so-x86-64<br>
<br>
Modified: lld/trunk/test/elf/ifunc.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ifunc.test?rev=182494&r1=182493&r2=182494&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ifunc.test?rev=182494&r1=182493&r2=182494&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf/ifunc.test (original)<br>
+++ lld/trunk/test/elf/ifunc.test Wed May 22 12:41:04 2013<br>
@@ -30,12 +30,6 @@ PLT: references:<br>
PLT: kind: R_X86_64_PC32<br>
PLT: target: [[PLTNAME]]<br>
<br>
-// Make sure there's a got entry with a IRELATIVE relocation.<br>
-PLT: type: got<br>
-PLT: references:<br>
-PLT: kind: R_X86_64_IRELATIVE<br>
-PLT: target: hey<br>
-<br>
// Make sure the target of main's relocation is a stub with a PC32 relocation.<br>
// This relocation is to the got atom, but you can't really write that check in<br>
// FileCheck.<br>
@@ -44,6 +38,12 @@ PLT: type: stub<br>
PLT: references<br>
PLT: kind: R_X86_64_PC32<br>
<br>
+// Make sure there's a got entry with a IRELATIVE relocation.<br>
+PLT: type: got<br>
+PLT: references:<br>
+PLT: kind: R_X86_64_IRELATIVE<br>
+PLT: target: hey<br>
+<br>
CHECK: name: hey<br>
CHECK: scope: global<br>
CHECK: type: resolver<br>
<br>
Modified: lld/trunk/test/elf/rodata.objtxt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/rodata.objtxt?rev=182494&r1=182493&r2=182494&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/rodata.objtxt?rev=182494&r1=182493&r2=182494&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf/rodata.objtxt (original)<br>
+++ lld/trunk/test/elf/rodata.objtxt Wed May 22 12:41:04 2013<br>
@@ -4,6 +4,6 @@ RUN: llvm-objdump -section-headers %t1 |<br>
RUN: lld -flavor gnu -target hexagon -o %t2 %p/Inputs/rodata-test.hexagon --noinhibit-exec<br>
RUN: llvm-objdump -section-headers %t2 | FileCheck -check-prefix=hexagon %s<br>
<br>
-i386: .rodata 00000004 0000000000000111 DATA<br>
+i386: .rodata 00000004 0000000000000114 DATA<br>
<br>
-hexagon: .rodata 00000004 0000000000000111 DATA<br>
+hexagon: .rodata 00000004 0000000000000114 DATA<br>
<br>
Modified: lld/trunk/test/elf/x86-64-dynamic.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/x86-64-dynamic.test?rev=182494&r1=182493&r2=182494&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/x86-64-dynamic.test?rev=182494&r1=182493&r2=182494&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf/x86-64-dynamic.test (original)<br>
+++ lld/trunk/test/elf/x86-64-dynamic.test Wed May 22 12:41:04 2013<br>
@@ -18,17 +18,6 @@ CHECK: offset: 25<br>
CHECK: target: [[GOTNAME:[-a-zA-Z0-9_]+]]<br>
CHECK: addend: -4<br>
<br>
-CHECK: name: [[GOTNAME]]<br>
-CHECK: type: got<br>
-CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]<br>
-CHECK: section-choice: custom-required<br>
-CHECK: section-name: .got.dyn<br>
-CHECK: permissions: rw-<br>
-CHECK: references:<br>
-CHECK: - kind: R_X86_64_GLOB_DAT<br>
-CHECK: offset: 0<br>
-CHECK: target: i<br>
-<br>
- name: .PLT0<br>
CHECK: type: stub<br>
CHECK: content: [ FF, 35, 00, 00, 00, 00, FF, 25, 00, 00, 00, 00,<br>
@@ -64,6 +53,17 @@ CHECK: - kind: R_X86_64_<br>
CHECK: offset: 12<br>
target: .PLT0<br>
CHECK: addend: -4<br>
+CHECK: name: [[GOTNAME]]<br>
+CHECK: type: got<br>
+CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]<br>
+CHECK: section-choice: custom-required<br>
+CHECK: section-name: .got.dyn<br>
+CHECK: permissions: rw-<br>
+CHECK: references:<br>
+CHECK: - kind: R_X86_64_GLOB_DAT<br>
+CHECK: offset: 0<br>
+CHECK: target: i<br>
+<br>
<br>
<br>
CHECK:shared-library-atoms:<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div></div></div></div>