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