2016-07-27 01:58:44 +08:00
|
|
|
# REQUIRES: x86
|
2018-03-01 12:21:42 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/data-segment-relro.s -o %t1.o
|
2016-07-27 01:58:44 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
|
|
|
|
# RUN: ld.lld -shared %t2.o -o %t2.so
|
|
|
|
|
|
|
|
## With relro or without DATA_SEGMENT_RELRO_END just aligns to
|
|
|
|
## page boundary.
|
2018-03-01 12:21:42 +08:00
|
|
|
|
|
|
|
# RUN: ld.lld --hash-style=sysv -z norelro %t1.o %t2.so --script %s -o %t
|
2019-05-01 13:49:01 +08:00
|
|
|
# RUN: llvm-readobj -S %t | FileCheck %s
|
2018-03-01 12:21:42 +08:00
|
|
|
|
|
|
|
# RUN: ld.lld --hash-style=sysv -z relro %t1.o %t2.so --script %s -o %t2
|
2019-05-01 13:49:01 +08:00
|
|
|
# RUN: llvm-readobj -S %t2 | FileCheck %s
|
2016-07-27 01:58:44 +08:00
|
|
|
|
2018-03-01 12:21:42 +08:00
|
|
|
SECTIONS {
|
|
|
|
. = SIZEOF_HEADERS;
|
|
|
|
|
|
|
|
.plt : { *(.plt) }
|
|
|
|
.text : { *(.text) }
|
|
|
|
|
|
|
|
. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
|
|
|
|
|
|
|
|
.dynamic : { *(.dynamic) }
|
|
|
|
.got : { *(.got) }
|
|
|
|
|
|
|
|
. = DATA_SEGMENT_RELRO_END (1 ? 24 : 0, .);
|
|
|
|
|
|
|
|
.got.plt : { *(.got.plt) }
|
|
|
|
.data : { *(.data) }
|
|
|
|
.bss : { *(.bss) }
|
|
|
|
|
|
|
|
. = DATA_SEGMENT_END (.);
|
|
|
|
}
|
|
|
|
|
2016-07-27 01:58:44 +08:00
|
|
|
# CHECK: Section {
|
2016-09-21 04:48:54 +08:00
|
|
|
# CHECK: Index:
|
|
|
|
# CHECK: Name: .got
|
2016-07-27 01:58:44 +08:00
|
|
|
# CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
# CHECK-NEXT: Flags [
|
|
|
|
# CHECK-NEXT: SHF_ALLOC
|
|
|
|
# CHECK-NEXT: SHF_WRITE
|
|
|
|
# CHECK-NEXT: ]
|
2016-09-28 08:09:20 +08:00
|
|
|
# CHECK-NEXT: Address: 0x10F0
|
2016-07-27 01:58:44 +08:00
|
|
|
# CHECK-NEXT: Offset: 0x10F0
|
|
|
|
# CHECK-NEXT: Size:
|
|
|
|
# CHECK-NEXT: Link:
|
|
|
|
# CHECK-NEXT: Info:
|
|
|
|
# CHECK-NEXT: AddressAlignment:
|
|
|
|
# CHECK-NEXT: EntrySize:
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Section {
|
2016-09-21 04:48:54 +08:00
|
|
|
# CHECK-NEXT: Index:
|
2016-07-27 01:58:44 +08:00
|
|
|
# CHECK-NEXT: Name: .got.plt
|
|
|
|
# CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
# CHECK-NEXT: Flags [
|
|
|
|
# CHECK-NEXT: SHF_ALLOC
|
|
|
|
# CHECK-NEXT: SHF_WRITE
|
|
|
|
# CHECK-NEXT: ]
|
2016-09-28 08:09:20 +08:00
|
|
|
# CHECK-NEXT: Address: 0x2000
|
2016-07-27 01:58:44 +08:00
|
|
|
# CHECK-NEXT: Offset: 0x2000
|
|
|
|
# CHECK-NEXT: Size:
|
|
|
|
# CHECK-NEXT: Link:
|
|
|
|
# CHECK-NEXT: Info:
|
|
|
|
# CHECK-NEXT: AddressAlignment:
|
|
|
|
# CHECK-NEXT: EntrySize:
|
|
|
|
# CHECK-NEXT: }
|