blob: ee196509673c4694df1b4dad6d1eef55a593ef3b [file] [log] [blame]
Hemant Kulkarni966b3ac2016-03-25 16:04:48 +00001#Source :
2#__thread int a = 1;
3#__thread int b;
4#
5#int main () {
6# b = 2;
7# throw (a + b) ;
8# return 0;
9#}
10# compiled as clang++ source.cpp
11# and clang++ -m32 source.cpp
12
13RUN: llvm-readobj -program-headers %p/Inputs/phdrs-elf.exe-i386 --elf-output-style=GNU \
14RUN: | FileCheck %s -check-prefix ELF32
Matt Davis50ca8ed2019-02-01 18:51:10 +000015RUN: llvm-readobj -program-headers %p/Inputs/phdrs-elf.exe-x86_64 --elf-output-style=GNU \
16RUN: | FileCheck %s -check-prefixes ELF64-PHDRS,ELF64-MAPPING
17RUN: llvm-readelf -program-headers %p/Inputs/phdrs-elf.exe-x86_64 \
18RUN: | FileCheck %s -check-prefixes ELF64-PHDRS,ELF64-MAPPING
19
20# Check that -section-mapping produces a mapping and not the program headers.
21RUN: llvm-readelf -section-mapping %p/Inputs/phdrs-elf.exe-x86_64 \
22RUN: | FileCheck %s -check-prefix ELF64-MAPPING -implicit-check-not="Program Headers:"
23
24# Check that -section-mapping=false -program-headers produces just program headers.
25RUN: llvm-readelf -section-mapping=false -program-headers %p/Inputs/phdrs-elf.exe-x86_64 \
26RUN: | FileCheck %s -check-prefix ELF64-PHDRS -implicit-check-not="Section to Segment mapping:"
27
28# Check that only one copy of the section/segment mapping table is produced.
29RUN: llvm-readelf -section-mapping -program-headers %p/Inputs/phdrs-elf.exe-x86_64 \
30RUN: | FileCheck %s -check-prefix ELF64-ONEMAPPING
Hemant Kulkarni966b3ac2016-03-25 16:04:48 +000031
32ELF32: Elf file type is EXEC (Executable file)
33ELF32-NEXT: Entry point 0x8048460
34ELF32-NEXT: There are 10 program headers, starting at offset 52
35
36ELF32: Program Headers:
37ELF32-NEXT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
38ELF32-NEXT: PHDR 0x000034 0x08048034 0x08048034 0x00140 0x00140 R E 0x4
39ELF32-NEXT: INTERP 0x000174 0x08048174 0x08048174 0x00013 0x00013 R 0x1
40ELF32-NEXT: [Requesting program interpreter: /lib/ld-linux.so.2]
41ELF32-NEXT: LOAD 0x000000 0x08048000 0x08048000 0x006d0 0x006d0 R E 0x1000
42ELF32-NEXT: LOAD 0x000ef0 0x08049ef0 0x08049ef0 0x00128 0x00140 RW 0x1000
43ELF32-NEXT: DYNAMIC 0x000f08 0x08049f08 0x08049f08 0x000e8 0x000e8 RW 0x4
44ELF32-NEXT: NOTE 0x000188 0x08048188 0x08048188 0x00044 0x00044 R 0x4
45ELF32-NEXT: TLS 0x000ef0 0x08049ef0 0x08049ef0 0x00004 0x00008 R 0x4
46ELF32-NEXT: GNU_EH_FRAME 0x000640 0x08048640 0x08048640 0x0001c 0x0001c R 0x4
47ELF32-NEXT: GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
48ELF32-NEXT: GNU_RELRO 0x000ef0 0x08049ef0 0x08049ef0 0x00110 0x00110 R 0x1
49
50ELF32: Section to Segment mapping:
51ELF32-NEXT: Segment Sections...
52ELF32-NEXT: 00
53ELF32-NEXT: 01 .interp
54ELF32-NEXT: 02 .interp .note.ABI-tag .note.gnu.build-id .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
55ELF32-NEXT: 03 .tdata .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
56ELF32-NEXT: 04 .dynamic
57ELF32-NEXT: 05 .note.ABI-tag .note.gnu.build-id
58ELF32-NEXT: 06 .tdata .tbss
59ELF32-NEXT: 07 .eh_frame_hdr
60ELF32-NEXT: 08
61ELF32-NEXT: 09 .tdata .ctors .dtors .jcr .dynamic .got
62
Matt Davis50ca8ed2019-02-01 18:51:10 +000063ELF64-PHDRS: Elf file type is EXEC (Executable file)
64ELF64-PHDRS-NEXT: Entry point 0x400610
65ELF64-PHDRS-NEXT: There are 10 program headers, starting at offset 64
Hemant Kulkarni966b3ac2016-03-25 16:04:48 +000066
Matt Davis50ca8ed2019-02-01 18:51:10 +000067ELF64-PHDRS: Program Headers:
68ELF64-PHDRS-NEXT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
69ELF64-PHDRS-NEXT: PHDR 0x000040 0x0000000000400040 0x0000000000400040 0x000230 0x000230 R E 0x8
70ELF64-PHDRS-NEXT: INTERP 0x000270 0x0000000000400270 0x0000000000400270 0x00001c 0x00001c R 0x1
71ELF64-PHDRS-NEXT: [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
72ELF64-PHDRS-NEXT: LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x000924 0x000924 R E 0x200000
73ELF64-PHDRS-NEXT: LOAD 0x000db4 0x0000000000600db4 0x0000000000600db4 0x000274 0x0002a4 RW 0x200000
74ELF64-PHDRS-NEXT: DYNAMIC 0x000dd0 0x0000000000600dd0 0x0000000000600dd0 0x000210 0x000210 RW 0x8
75ELF64-PHDRS-NEXT: NOTE 0x00028c 0x000000000040028c 0x000000000040028c 0x000044 0x000044 R 0x4
76ELF64-PHDRS-NEXT: TLS 0x000db4 0x0000000000600db4 0x0000000000600db4 0x000004 0x000008 R 0x4
77ELF64-PHDRS-NEXT: GNU_EH_FRAME 0x00083c 0x000000000040083c 0x000000000040083c 0x00002c 0x00002c R 0x4
78ELF64-PHDRS-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x8
79ELF64-PHDRS-NEXT: GNU_RELRO 0x000db4 0x0000000000600db4 0x0000000000600db4 0x00024c 0x00024c R 0x1
Hemant Kulkarni966b3ac2016-03-25 16:04:48 +000080
Matt Davis50ca8ed2019-02-01 18:51:10 +000081ELF64-MAPPING: Section to Segment mapping:
82ELF64-MAPPING-NEXT: Segment Sections...
83ELF64-MAPPING-NEXT: 00
84ELF64-MAPPING-NEXT: 01 .interp
85ELF64-MAPPING-NEXT: 02 .interp .note.ABI-tag .note.gnu.build-id .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
86ELF64-MAPPING-NEXT: 03 .tdata .init_array .fini_array .jcr .dynamic .got .got.plt .data .bss
87ELF64-MAPPING-NEXT: 04 .dynamic
88ELF64-MAPPING-NEXT: 05 .note.ABI-tag .note.gnu.build-id
89ELF64-MAPPING-NEXT: 06 .tdata .tbss
90ELF64-MAPPING-NEXT: 07 .eh_frame_hdr
91ELF64-MAPPING-NEXT: 08
92ELF64-MAPPING-NEXT: 09 .tdata .init_array .fini_array .jcr .dynamic .got
93
94ELF64-ONEMAPPING: Section to Segment mapping:
95ELF64-ONEMAPPING-NOT: Section to Segment mapping: