Peter Smith | 80e4be7 | 2017-11-24 08:48:29 +0000 | [diff] [blame] | 1 | // REQUIRES: x86 |
| 2 | // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t.o |
| 3 | // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/copy-in-shared.s -o %t2.o |
| 4 | // RUN: ld.lld -shared %t.o %t2.o -o %t.so |
| 5 | |
| 6 | // ld.bfd and gold use .data.rel.ro rather than .bss.rel.ro. When a linker |
| 7 | // script, such as ld.bfd's internal linker script has a .data.rel.ro |
| 8 | // OutputSection we rename .bss.rel.ro to .data.rel.ro.bss in order to match in |
| 9 | // .data.rel.ro. This keeps the relro sections contiguous. |
| 10 | |
| 11 | // Use the same sections and ordering as the ld.bfd internal linker script. |
| 12 | // RUN: echo "SECTIONS { \ |
| 13 | // RUN: .data.rel.ro : { *(.data.rel.ro .data.rel.ro.*) } \ |
| 14 | // RUN: .dynamic : { *(.dynamic) } \ |
| 15 | // RUN: .got : { *(.got) } \ |
| 16 | // RUN: .got.plt : { *(.got.plt) } \ |
| 17 | // RUN: } " > %t.script |
| 18 | // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t3.o |
Fangrui Song | 40a9f22 | 2018-07-02 17:48:23 +0000 | [diff] [blame] | 19 | // RUN: ld.lld %t3.o %t.so -o /dev/null --script=%t.script --print-map | FileCheck %s |
Peter Smith | 80e4be7 | 2017-11-24 08:48:29 +0000 | [diff] [blame] | 20 | |
| 21 | // CHECK: .data.rel.ro |
| 22 | // CHECK-NEXT: <internal>:(.bss.rel.ro) |
| 23 | .section .text, "ax", @progbits |
| 24 | .global _start |
| 25 | .global bar |
| 26 | .global foo |
| 27 | _start: |
| 28 | .quad bar |
| 29 | .quad foo |