blob: c71c8e5decdc3348c8dca58a02d7265a112f2b88 [file] [log] [blame]
Peter Smith80e4be72017-11-24 08:48:29 +00001// 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 Song40a9f222018-07-02 17:48:23 +000019// RUN: ld.lld %t3.o %t.so -o /dev/null --script=%t.script --print-map | FileCheck %s
Peter Smith80e4be72017-11-24 08:48:29 +000020
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