• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/data-segment-relro.s -o %t1.o
3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
4# RUN: ld.lld -shared %t2.o -o %t2.so
5
6## With relro or without DATA_SEGMENT_RELRO_END just aligns to
7## page boundary.
8
9# RUN: ld.lld --hash-style=sysv -z norelro %t1.o %t2.so --script %s -o %t
10# RUN: llvm-readobj -S %t | FileCheck %s
11
12# RUN: ld.lld --hash-style=sysv -z relro %t1.o %t2.so --script %s -o %t2
13# RUN: llvm-readobj -S %t2 | FileCheck %s
14
15SECTIONS {
16  . = SIZEOF_HEADERS;
17
18  .plt  : { *(.plt) }
19  .text : { *(.text) }
20
21  . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
22
23  .dynamic : { *(.dynamic) }
24  .got : { *(.got) }
25
26  . = DATA_SEGMENT_RELRO_END (1 ? 24 : 0, .);
27
28  .got.plt : { *(.got.plt) }
29  .data : { *(.data) }
30  .bss : { *(.bss) }
31
32  . = DATA_SEGMENT_END (.);
33}
34
35# CHECK:       Section {
36# CHECK:         Index:
37# CHECK:         Name: .got
38# CHECK-NEXT:    Type: SHT_PROGBITS
39# CHECK-NEXT:    Flags [
40# CHECK-NEXT:      SHF_ALLOC
41# CHECK-NEXT:      SHF_WRITE
42# CHECK-NEXT:    ]
43# CHECK-NEXT:    Address: 0x10F0
44# CHECK-NEXT:    Offset: 0x10F0
45# CHECK-NEXT:    Size:
46# CHECK-NEXT:    Link:
47# CHECK-NEXT:    Info:
48# CHECK-NEXT:    AddressAlignment:
49# CHECK-NEXT:    EntrySize:
50# CHECK-NEXT:  }
51# CHECK-NEXT:  Section {
52# CHECK-NEXT:    Index:
53# CHECK-NEXT:    Name: .got.plt
54# CHECK-NEXT:    Type: SHT_PROGBITS
55# CHECK-NEXT:    Flags [
56# CHECK-NEXT:      SHF_ALLOC
57# CHECK-NEXT:      SHF_WRITE
58# CHECK-NEXT:    ]
59# CHECK-NEXT:    Address: 0x2000
60# CHECK-NEXT:    Offset: 0x2000
61# CHECK-NEXT:    Size:
62# CHECK-NEXT:    Link:
63# CHECK-NEXT:    Info:
64# CHECK-NEXT:    AddressAlignment:
65# CHECK-NEXT:    EntrySize:
66# CHECK-NEXT:  }
67