summaryrefslogtreecommitdiffstats
path: root/lld/test/old-elf/linkerscript/phdrs-flags.test
blob: 0fac53e75302d38edfd69593446629d28843443c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
Test sections put to different segments with FLAGS attribute set.

RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o

RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1
RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-SECS %s
RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-HDRS %s
*/

ENTRY(_start)

PHDRS
{
    text PT_LOAD FLAGS(0x5);
    data PT_LOAD FLAGS(0x7);
}

SECTIONS
{
  .text : { *(.text) } :text
  .data : { *(.data) } :data
}

/*
FLAGS-PHDRS-SECS: .text {{[0-9a-f]+}} 0000000000401000
FLAGS-PHDRS-SECS: .data {{[0-9a-f]+}} 00000000004000e8

FLAGS-PHDRS-HDRS: ProgramHeader {
FLAGS-PHDRS-HDRS: Type: PT_LOAD (0x1)
FLAGS-PHDRS-HDRS: VirtualAddress: 0x400000
FLAGS-PHDRS-HDRS: Flags [ (0x7)
FLAGS-PHDRS-HDRS: PF_R (0x4)
FLAGS-PHDRS-HDRS: PF_W (0x2)
FLAGS-PHDRS-HDRS: PF_X (0x1)
FLAGS-PHDRS-HDRS: ]
FLAGS-PHDRS-HDRS: }
FLAGS-PHDRS-HDRS: ProgramHeader {
FLAGS-PHDRS-HDRS: Type: PT_LOAD (0x1)
FLAGS-PHDRS-HDRS: VirtualAddress: 0x401000
FLAGS-PHDRS-HDRS: Flags [ (0x5)
FLAGS-PHDRS-HDRS: PF_R (0x4)
FLAGS-PHDRS-HDRS: PF_X (0x1)
FLAGS-PHDRS-HDRS: ]
FLAGS-PHDRS-HDRS: }
*/
OpenPOWER on IntegriCloud