diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-09-30 00:06:24 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-09-30 00:06:24 +0000 |
| commit | 317c339f61d8546347a545ae442538a0b5f2a61a (patch) | |
| tree | ed3ebe83d4f58a335fb11eae88d3074f427d2aa3 | |
| parent | 877ccee8cc60ec54867ecdf535c710dc833f4888 (diff) | |
| download | bcm5719-llvm-317c339f61d8546347a545ae442538a0b5f2a61a.tar.gz bcm5719-llvm-317c339f61d8546347a545ae442538a0b5f2a61a.zip | |
Don't depend on lld creating space for the headers.
Currently lld will implicitly reserve space for the headers. This is
not the case is bfd, where it is the script responsibility to use
SIZEOF_HEADERS. This means that a script not using SIZEOF_HEADERS and
expecting the address of the first section to be 0 would fail with lld.
I am fixing that is the next commit. This one just makes the tests
explicitly use SIZEOF_HEADERS to avoid the dependency on the current
behaviour.
llvm-svn: 282814
| -rw-r--r-- | lld/test/ELF/arm-thumb-interwork-thunk.s | 1 | ||||
| -rw-r--r-- | lld/test/ELF/arm-thumb-narrow-branch-check.s | 1 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/align-empty.s | 1 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/common.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/data-segment-relro.s | 1 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/discard-interp.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/double-bss.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/extend-pt-load.s | 3 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/merge-sections.s | 5 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/orphan-align.s | 1 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/repsection-symbol.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/sections-keep.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/sort2.s | 6 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/symbol-conflict.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/symbol-only.s | 1 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/symbols-synthetic.s | 1 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/tbss.s | 7 | ||||
| -rw-r--r-- | lld/test/ELF/phdr-align.s | 1 |
18 files changed, 32 insertions, 9 deletions
diff --git a/lld/test/ELF/arm-thumb-interwork-thunk.s b/lld/test/ELF/arm-thumb-interwork-thunk.s index 65e76f5233e..3fd36b910cd 100644 --- a/lld/test/ELF/arm-thumb-interwork-thunk.s +++ b/lld/test/ELF/arm-thumb-interwork-thunk.s @@ -1,5 +1,6 @@ // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t // RUN: echo "SECTIONS { \ +// RUN: . = SIZEOF_HEADERS; \ // RUN: .R_ARM_JUMP24_callee_1 : { *(.R_ARM_JUMP24_callee_low) } \ // RUN: .R_ARM_THM_JUMP_callee_1 : { *(.R_ARM_THM_JUMP_callee_low)} \ // RUN: .text : { *(.text) } \ diff --git a/lld/test/ELF/arm-thumb-narrow-branch-check.s b/lld/test/ELF/arm-thumb-narrow-branch-check.s index b601b6d5dc2..82a7164f6df 100644 --- a/lld/test/ELF/arm-thumb-narrow-branch-check.s +++ b/lld/test/ELF/arm-thumb-narrow-branch-check.s @@ -1,5 +1,6 @@ // RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t // RUN: echo "SECTIONS { \ +// RUN: . = SIZEOF_HEADERS; \ // RUN: .R_ARM_PC11_1 : { *(.R_ARM_PC11_1) } \ // RUN: .caller : { *(.caller) } \ // RUN: .R_ARM_PC11_2 : { *(.R_ARM_PC11_2) } \ diff --git a/lld/test/ELF/linkerscript/align-empty.s b/lld/test/ELF/linkerscript/align-empty.s index 260e7964899..3ff71578410 100644 --- a/lld/test/ELF/linkerscript/align-empty.s +++ b/lld/test/ELF/linkerscript/align-empty.s @@ -2,6 +2,7 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: abc : { } \ # RUN: . = ALIGN(0x1000); \ # RUN: foo : { *(foo) } \ diff --git a/lld/test/ELF/linkerscript/common.s b/lld/test/ELF/linkerscript/common.s index ce2959f5902..2e5972d5237 100644 --- a/lld/test/ELF/linkerscript/common.s +++ b/lld/test/ELF/linkerscript/common.s @@ -1,6 +1,6 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { .common : { *(COMMON) } }" > %t.script +# RUN: echo "SECTIONS { . = SIZEOF_HEADERS; .common : { *(COMMON) } }" > %t.script # RUN: ld.lld -o %t1 --script %t.script %t # RUN: llvm-readobj -s -t %t1 | FileCheck %s diff --git a/lld/test/ELF/linkerscript/data-segment-relro.s b/lld/test/ELF/linkerscript/data-segment-relro.s index 53b2b1f182f..7f69319dde7 100644 --- a/lld/test/ELF/linkerscript/data-segment-relro.s +++ b/lld/test/ELF/linkerscript/data-segment-relro.s @@ -4,6 +4,7 @@ # RUN: ld.lld -shared %t2.o -o %t2.so # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: .plt : { *(.plt) } \ # RUN: .text : { *(.text) } \ # RUN: . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); \ diff --git a/lld/test/ELF/linkerscript/discard-interp.s b/lld/test/ELF/linkerscript/discard-interp.s index 6d86389d7ed..261509e2e76 100644 --- a/lld/test/ELF/linkerscript/discard-interp.s +++ b/lld/test/ELF/linkerscript/discard-interp.s @@ -2,7 +2,7 @@ // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/../Inputs/shared.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so // RUN: echo "PHDRS { text PT_LOAD FILEHDR PHDRS; } \ -// RUN: SECTIONS { .text : { *(.text) } : text }" > %t.script +// RUN: SECTIONS { . = SIZEOF_HEADERS; .text : { *(.text) } : text }" > %t.script // RUN: ld.lld -dynamic-linker /lib64/ld-linux-x86-64.so.2 -rpath foo -rpath bar --script %t.script --export-dynamic %t.o %t2.so -o %t // RUN: llvm-readobj -s %t | FileCheck %s diff --git a/lld/test/ELF/linkerscript/double-bss.s b/lld/test/ELF/linkerscript/double-bss.s index 6003c18727e..9f047333ac6 100644 --- a/lld/test/ELF/linkerscript/double-bss.s +++ b/lld/test/ELF/linkerscript/double-bss.s @@ -1,6 +1,6 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS { .text : { *(.text*) } }" > %t.script +# RUN: echo "SECTIONS { . = SIZEOF_HEADERS; .text : { *(.text*) } }" > %t.script # RUN: ld.lld -o %t1 --script %t.script %t # RUN: llvm-objdump -section-headers %t1 | FileCheck %s # CHECK: .bss 00000004 0000000000000122 BSS diff --git a/lld/test/ELF/linkerscript/extend-pt-load.s b/lld/test/ELF/linkerscript/extend-pt-load.s index 7a098cbbd0e..f9a77c8c12b 100644 --- a/lld/test/ELF/linkerscript/extend-pt-load.s +++ b/lld/test/ELF/linkerscript/extend-pt-load.s @@ -7,6 +7,7 @@ # First, run a test with no such section. # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: .dynsym : { } \ # RUN: .hash : { } \ # RUN: .dynstr : { } \ @@ -27,6 +28,7 @@ # cover the padding bits created by ALIGN. # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: .dynsym : { } \ # RUN: .hash : { } \ # RUN: .dynstr : { } \ @@ -49,6 +51,7 @@ # of the section. That is, handle the above like the following test. # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: .dynsym : { } \ # RUN: .hash : { } \ # RUN: .dynstr : { } \ diff --git a/lld/test/ELF/linkerscript/merge-sections.s b/lld/test/ELF/linkerscript/merge-sections.s index b98796400b8..7252fe57667 100644 --- a/lld/test/ELF/linkerscript/merge-sections.s +++ b/lld/test/ELF/linkerscript/merge-sections.s @@ -1,7 +1,10 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS {.foo : { begin = .; *(.foo.*) end = .;} }" > %t.script +# RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ +# RUN: .foo : { begin = .; *(.foo.*) end = .;} \ +# RUN: }" > %t.script # RUN: ld.lld -o %t1 --script %t.script %t -shared # RUN: llvm-readobj -s -t %t1 | FileCheck %s diff --git a/lld/test/ELF/linkerscript/orphan-align.s b/lld/test/ELF/linkerscript/orphan-align.s index 47995b1ad08..edd637b9282 100644 --- a/lld/test/ELF/linkerscript/orphan-align.s +++ b/lld/test/ELF/linkerscript/orphan-align.s @@ -1,6 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: .text : { *(.text) } \ # RUN: . = ALIGN(0x1000); \ # RUN: .data.rel.ro : { *(.data.rel.ro) } \ diff --git a/lld/test/ELF/linkerscript/repsection-symbol.s b/lld/test/ELF/linkerscript/repsection-symbol.s index acd8d2a6928..6786ac47255 100644 --- a/lld/test/ELF/linkerscript/repsection-symbol.s +++ b/lld/test/ELF/linkerscript/repsection-symbol.s @@ -2,6 +2,8 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ +# RUN: .text : { *(.text) } \ # RUN: .foo : {foo1 = .; *(.foo.*) foo2 = .; *(.bar) foo3 = .;} \ # RUN: }" > %t.script # RUN: ld.lld -o %t1 --script %t.script %t -shared diff --git a/lld/test/ELF/linkerscript/sections-keep.s b/lld/test/ELF/linkerscript/sections-keep.s index c39723c7ace..72837303ec1 100644 --- a/lld/test/ELF/linkerscript/sections-keep.s +++ b/lld/test/ELF/linkerscript/sections-keep.s @@ -34,6 +34,7 @@ ## first one doesn't have KEEP, the second one does. If section that have ## KEEP is the first in order then section is NOT collected. # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: .keep : { KEEP(*(.keep)) } \ # RUN: .nokeep : { *(.keep) }}" > %t.script # RUN: ld.lld --gc-sections -o %t1 --script %t.script %t @@ -53,6 +54,7 @@ ## bfd keeps it. Our current behavior is compatible with bfd although ## we can choose either way. # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: .nokeep : { *(.keep) } \ # RUN: .keep : { KEEP(*(.keep)) }}" > %t.script # RUN: ld.lld --gc-sections -o %t1 --script %t.script %t diff --git a/lld/test/ELF/linkerscript/sort2.s b/lld/test/ELF/linkerscript/sort2.s index 9a77c4635ed..1d42093d5aa 100644 --- a/lld/test/ELF/linkerscript/sort2.s +++ b/lld/test/ELF/linkerscript/sort2.s @@ -6,9 +6,9 @@ # RUN: llvm-objdump -s %t1 | FileCheck %s # CHECK: Contents of section .abc: -# CHECK: 00e8 01000000 00000000 02000000 00000000 -# CHECK: 00f8 03000000 00000000 04000000 00000000 -# CHECK: 0108 06000000 00000000 05000000 00000000 +# CHECK: 01000000 00000000 02000000 00000000 +# CHECK: 03000000 00000000 04000000 00000000 +# CHECK: 06000000 00000000 05000000 00000000 # RUN: echo "SECTIONS { \ # RUN: .abc : { *(SORT(.foo.* EXCLUDE_FILE (*file1.o) .bar.*) .bar.*) } \ diff --git a/lld/test/ELF/linkerscript/symbol-conflict.s b/lld/test/ELF/linkerscript/symbol-conflict.s index 42f3eee78d3..35596739ce9 100644 --- a/lld/test/ELF/linkerscript/symbol-conflict.s +++ b/lld/test/ELF/linkerscript/symbol-conflict.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t -# RUN: echo "SECTIONS {.text : {*(.text.*)} end = .;}" > %t.script +# RUN: echo "SECTIONS { . = SIZEOF_HEADERS; .text : {*(.text.*)} end = .;}" > %t.script # RUN: ld.lld -o %t1 --script %t.script %t # RUN: llvm-objdump -t %t1 | FileCheck %s # CHECK: 00000000000000e9 *ABS* 00000000 end diff --git a/lld/test/ELF/linkerscript/symbol-only.s b/lld/test/ELF/linkerscript/symbol-only.s index 7b69a512aa1..67da70c78fd 100644 --- a/lld/test/ELF/linkerscript/symbol-only.s +++ b/lld/test/ELF/linkerscript/symbol-only.s @@ -2,6 +2,7 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: abc : { foo = .; } \ # RUN: . = ALIGN(0x1000); \ # RUN: bar : { *(bar) } \ diff --git a/lld/test/ELF/linkerscript/symbols-synthetic.s b/lld/test/ELF/linkerscript/symbols-synthetic.s index b76ce6d65e4..da56445ad90 100644 --- a/lld/test/ELF/linkerscript/symbols-synthetic.s +++ b/lld/test/ELF/linkerscript/symbols-synthetic.s @@ -4,6 +4,7 @@ # is not location counter but offset from the beginning of output # section .foo # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: .foo : { \ # RUN: begin_foo = .; \ # RUN: PROVIDE(_begin_sec = .); \ diff --git a/lld/test/ELF/linkerscript/tbss.s b/lld/test/ELF/linkerscript/tbss.s index 431b3f9a4d1..de8ed50cb4a 100644 --- a/lld/test/ELF/linkerscript/tbss.s +++ b/lld/test/ELF/linkerscript/tbss.s @@ -1,6 +1,11 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -# RUN: echo "SECTIONS { foo : { *(foo) } bar : { *(bar) } }" > %t.script +# RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ +# RUN: .text : { *(.text) } \ +# RUN: foo : { *(foo) } \ +# RUN: bar : { *(bar) } \ +# RUN: }" > %t.script # RUN: ld.lld -T %t.script %t.o -o %t # RUN: llvm-readobj -s %t | FileCheck %s diff --git a/lld/test/ELF/phdr-align.s b/lld/test/ELF/phdr-align.s index 58d537b4684..354897eedd2 100644 --- a/lld/test/ELF/phdr-align.s +++ b/lld/test/ELF/phdr-align.s @@ -2,6 +2,7 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o # RUN: echo "SECTIONS { \ +# RUN: . = SIZEOF_HEADERS; \ # RUN: .bss : { *(.bss) } \ # RUN: .data : { *(.data) } \ # RUN: .text : { *(.text) } }" > %t.script |

