xref: /aosp_15_r20/external/elfutils/tests/run-pt_gnu_prop-tests.sh (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1*7304104dSAndroid Build Coastguard Worker#! /bin/sh
2*7304104dSAndroid Build Coastguard Worker# Copyright (C) 2020 Red Hat, Inc.
3*7304104dSAndroid Build Coastguard Worker# This file is part of elfutils.
4*7304104dSAndroid Build Coastguard Worker#
5*7304104dSAndroid Build Coastguard Worker# This file is free software; you can redistribute it and/or modify
6*7304104dSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by
7*7304104dSAndroid Build Coastguard Worker# the Free Software Foundation; either version 3 of the License, or
8*7304104dSAndroid Build Coastguard Worker# (at your option) any later version.
9*7304104dSAndroid Build Coastguard Worker#
10*7304104dSAndroid Build Coastguard Worker# elfutils is distributed in the hope that it will be useful, but
11*7304104dSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of
12*7304104dSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*7304104dSAndroid Build Coastguard Worker# GNU General Public License for more details.
14*7304104dSAndroid Build Coastguard Worker#
15*7304104dSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License
16*7304104dSAndroid Build Coastguard Worker# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17*7304104dSAndroid Build Coastguard Worker
18*7304104dSAndroid Build Coastguard Worker. $srcdir/test-subr.sh
19*7304104dSAndroid Build Coastguard Worker
20*7304104dSAndroid Build Coastguard Worker# On Fedora 31 with GCC 9.2.1 and binutils 2.32-31
21*7304104dSAndroid Build Coastguard Worker# echo "int main () { }" | \
22*7304104dSAndroid Build Coastguard Worker# gcc -o testfile_pt_gnu_prop \
23*7304104dSAndroid Build Coastguard Worker#     -Os -fstack-clash-protection -fcf-protection=full -xc - && \
24*7304104dSAndroid Build Coastguard Worker# eu-strip --remove-comment -R .gnu.build.attributes testfile_pt_gnu_prop
25*7304104dSAndroid Build Coastguard Worker#
26*7304104dSAndroid Build Coastguard Worker# echo "int main () { }" | \
27*7304104dSAndroid Build Coastguard Worker# gcc -m32 -o testfile_pt_gnu_prop \
28*7304104dSAndroid Build Coastguard Worker#     -Os -fstack-clash-protection -fcf-protection=full -xc - && \
29*7304104dSAndroid Build Coastguard Worker# eu-strip --remove-comment -R .gnu.build.attributes testfile_pt_gnu_prop32
30*7304104dSAndroid Build Coastguard Worker
31*7304104dSAndroid Build Coastguard Workertestfiles testfile_pt_gnu_prop testfile_pt_gnu_prop32
32*7304104dSAndroid Build Coastguard Worker
33*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/src/readelf -ln testfile_pt_gnu_prop32 <<\EOF
34*7304104dSAndroid Build Coastguard WorkerProgram Headers:
35*7304104dSAndroid Build Coastguard Worker  Type           Offset   VirtAddr   PhysAddr   FileSiz  MemSiz   Flg Align
36*7304104dSAndroid Build Coastguard Worker  PHDR           0x000034 0x08048034 0x08048034 0x000180 0x000180 R   0x4
37*7304104dSAndroid Build Coastguard Worker  INTERP         0x0001b4 0x080481b4 0x080481b4 0x000013 0x000013 R   0x1
38*7304104dSAndroid Build Coastguard Worker	[Requesting program interpreter: /lib/ld-linux.so.2]
39*7304104dSAndroid Build Coastguard Worker  LOAD           0x000000 0x08048000 0x08048000 0x000308 0x000308 R   0x1000
40*7304104dSAndroid Build Coastguard Worker  LOAD           0x001000 0x08049000 0x08049000 0x000224 0x000224 R E 0x1000
41*7304104dSAndroid Build Coastguard Worker  LOAD           0x002000 0x0804a000 0x0804a000 0x00015c 0x00015c R   0x1000
42*7304104dSAndroid Build Coastguard Worker  LOAD           0x002f0c 0x0804bf0c 0x0804bf0c 0x000108 0x00010c RW  0x1000
43*7304104dSAndroid Build Coastguard Worker  DYNAMIC        0x002f14 0x0804bf14 0x0804bf14 0x0000e8 0x0000e8 RW  0x4
44*7304104dSAndroid Build Coastguard Worker  NOTE           0x0001c8 0x080481c8 0x080481c8 0x000060 0x000060 R   0x4
45*7304104dSAndroid Build Coastguard Worker  GNU_PROPERTY   0x0001ec 0x080481ec 0x080481ec 0x00001c 0x00001c R   0x4
46*7304104dSAndroid Build Coastguard Worker  GNU_EH_FRAME   0x00200c 0x0804a00c 0x0804a00c 0x00004c 0x00004c R   0x4
47*7304104dSAndroid Build Coastguard Worker  GNU_STACK      0x000000 0x00000000 0x00000000 0x000000 0x000000 RW  0x10
48*7304104dSAndroid Build Coastguard Worker  GNU_RELRO      0x002f0c 0x0804bf0c 0x0804bf0c 0x0000f4 0x0000f4 R   0x1
49*7304104dSAndroid Build Coastguard Worker
50*7304104dSAndroid Build Coastguard Worker Section to Segment mapping:
51*7304104dSAndroid Build Coastguard Worker  Segment Sections...
52*7304104dSAndroid Build Coastguard Worker   00
53*7304104dSAndroid Build Coastguard Worker   01      [RO: .interp]
54*7304104dSAndroid Build Coastguard Worker   02      [RO: .interp .note.gnu.build-id .note.gnu.property .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt]
55*7304104dSAndroid Build Coastguard Worker   03      [RO: .init .plt .plt.sec .text .fini]
56*7304104dSAndroid Build Coastguard Worker   04      [RO: .rodata .eh_frame_hdr .eh_frame]
57*7304104dSAndroid Build Coastguard Worker   05      [RELRO: .init_array .fini_array .dynamic .got] .got.plt .data .bss
58*7304104dSAndroid Build Coastguard Worker   06      [RELRO: .dynamic]
59*7304104dSAndroid Build Coastguard Worker   07      [RO: .note.gnu.build-id .note.gnu.property .note.ABI-tag]
60*7304104dSAndroid Build Coastguard Worker   08      [RO: .note.gnu.property]
61*7304104dSAndroid Build Coastguard Worker   09      [RO: .eh_frame_hdr]
62*7304104dSAndroid Build Coastguard Worker   10
63*7304104dSAndroid Build Coastguard Worker   11      [RELRO: .init_array .fini_array .dynamic .got]
64*7304104dSAndroid Build Coastguard Worker
65*7304104dSAndroid Build Coastguard WorkerNote section [ 2] '.note.gnu.build-id' of 36 bytes at offset 0x1c8:
66*7304104dSAndroid Build Coastguard Worker  Owner          Data size  Type
67*7304104dSAndroid Build Coastguard Worker  GNU                   20  GNU_BUILD_ID
68*7304104dSAndroid Build Coastguard Worker    Build ID: 2fcce91f5c2532f78b00a9f5f565354d2f44bc19
69*7304104dSAndroid Build Coastguard Worker
70*7304104dSAndroid Build Coastguard WorkerNote section [ 3] '.note.gnu.property' of 28 bytes at offset 0x1ec:
71*7304104dSAndroid Build Coastguard Worker  Owner          Data size  Type
72*7304104dSAndroid Build Coastguard Worker  GNU                   12  GNU_PROPERTY_TYPE_0
73*7304104dSAndroid Build Coastguard Worker    X86 FEATURE_1_AND: 00000003 IBT SHSTK
74*7304104dSAndroid Build Coastguard Worker
75*7304104dSAndroid Build Coastguard WorkerNote section [ 4] '.note.ABI-tag' of 32 bytes at offset 0x208:
76*7304104dSAndroid Build Coastguard Worker  Owner          Data size  Type
77*7304104dSAndroid Build Coastguard Worker  GNU                   16  GNU_ABI_TAG
78*7304104dSAndroid Build Coastguard Worker    OS: Linux, ABI: 3.2.0
79*7304104dSAndroid Build Coastguard WorkerEOF
80*7304104dSAndroid Build Coastguard Worker
81*7304104dSAndroid Build Coastguard Workertestrun ${abs_top_builddir}/src/elflint --gnu testfile_pt_gnu_prop32
82*7304104dSAndroid Build Coastguard Worker
83*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/src/readelf -ln testfile_pt_gnu_prop <<\EOF
84*7304104dSAndroid Build Coastguard WorkerProgram Headers:
85*7304104dSAndroid Build Coastguard Worker  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
86*7304104dSAndroid Build Coastguard Worker  PHDR           0x000040 0x0000000000400040 0x0000000000400040 0x0002d8 0x0002d8 R   0x8
87*7304104dSAndroid Build Coastguard Worker  INTERP         0x000318 0x0000000000400318 0x0000000000400318 0x00001c 0x00001c R   0x1
88*7304104dSAndroid Build Coastguard Worker	[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
89*7304104dSAndroid Build Coastguard Worker  LOAD           0x000000 0x0000000000400000 0x0000000000400000 0x000498 0x000498 R   0x1000
90*7304104dSAndroid Build Coastguard Worker  LOAD           0x001000 0x0000000000401000 0x0000000000401000 0x0001a5 0x0001a5 R E 0x1000
91*7304104dSAndroid Build Coastguard Worker  LOAD           0x002000 0x0000000000402000 0x0000000000402000 0x000100 0x000100 R   0x1000
92*7304104dSAndroid Build Coastguard Worker  LOAD           0x002e50 0x0000000000403e50 0x0000000000403e50 0x0001cc 0x0001d0 RW  0x1000
93*7304104dSAndroid Build Coastguard Worker  DYNAMIC        0x002e60 0x0000000000403e60 0x0000000000403e60 0x000190 0x000190 RW  0x8
94*7304104dSAndroid Build Coastguard Worker  NOTE           0x000338 0x0000000000400338 0x0000000000400338 0x000020 0x000020 R   0x8
95*7304104dSAndroid Build Coastguard Worker  NOTE           0x000358 0x0000000000400358 0x0000000000400358 0x000044 0x000044 R   0x4
96*7304104dSAndroid Build Coastguard Worker  GNU_PROPERTY   0x000338 0x0000000000400338 0x0000000000400338 0x000020 0x000020 R   0x8
97*7304104dSAndroid Build Coastguard Worker  GNU_EH_FRAME   0x002010 0x0000000000402010 0x0000000000402010 0x000034 0x000034 R   0x4
98*7304104dSAndroid Build Coastguard Worker  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0x10
99*7304104dSAndroid Build Coastguard Worker  GNU_RELRO      0x002e50 0x0000000000403e50 0x0000000000403e50 0x0001b0 0x0001b0 R   0x1
100*7304104dSAndroid Build Coastguard Worker
101*7304104dSAndroid Build Coastguard Worker Section to Segment mapping:
102*7304104dSAndroid Build Coastguard Worker  Segment Sections...
103*7304104dSAndroid Build Coastguard Worker   00
104*7304104dSAndroid Build Coastguard Worker   01      [RO: .interp]
105*7304104dSAndroid Build Coastguard Worker   02      [RO: .interp .note.gnu.property .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn]
106*7304104dSAndroid Build Coastguard Worker   03      [RO: .init .text .fini]
107*7304104dSAndroid Build Coastguard Worker   04      [RO: .rodata .eh_frame_hdr .eh_frame]
108*7304104dSAndroid Build Coastguard Worker   05      [RELRO: .init_array .fini_array .dynamic .got] .got.plt .data .bss
109*7304104dSAndroid Build Coastguard Worker   06      [RELRO: .dynamic]
110*7304104dSAndroid Build Coastguard Worker   07      [RO: .note.gnu.property]
111*7304104dSAndroid Build Coastguard Worker   08      [RO: .note.gnu.build-id .note.ABI-tag]
112*7304104dSAndroid Build Coastguard Worker   09      [RO: .note.gnu.property]
113*7304104dSAndroid Build Coastguard Worker   10      [RO: .eh_frame_hdr]
114*7304104dSAndroid Build Coastguard Worker   11
115*7304104dSAndroid Build Coastguard Worker   12      [RELRO: .init_array .fini_array .dynamic .got]
116*7304104dSAndroid Build Coastguard Worker
117*7304104dSAndroid Build Coastguard WorkerNote section [ 2] '.note.gnu.property' of 32 bytes at offset 0x338:
118*7304104dSAndroid Build Coastguard Worker  Owner          Data size  Type
119*7304104dSAndroid Build Coastguard Worker  GNU                   16  GNU_PROPERTY_TYPE_0
120*7304104dSAndroid Build Coastguard Worker    X86 FEATURE_1_AND: 00000003 IBT SHSTK
121*7304104dSAndroid Build Coastguard Worker
122*7304104dSAndroid Build Coastguard WorkerNote section [ 3] '.note.gnu.build-id' of 36 bytes at offset 0x358:
123*7304104dSAndroid Build Coastguard Worker  Owner          Data size  Type
124*7304104dSAndroid Build Coastguard Worker  GNU                   20  GNU_BUILD_ID
125*7304104dSAndroid Build Coastguard Worker    Build ID: 84fa4d40bad074bc82431575821902da624a5b22
126*7304104dSAndroid Build Coastguard Worker
127*7304104dSAndroid Build Coastguard WorkerNote section [ 4] '.note.ABI-tag' of 32 bytes at offset 0x37c:
128*7304104dSAndroid Build Coastguard Worker  Owner          Data size  Type
129*7304104dSAndroid Build Coastguard Worker  GNU                   16  GNU_ABI_TAG
130*7304104dSAndroid Build Coastguard Worker    OS: Linux, ABI: 3.2.0
131*7304104dSAndroid Build Coastguard WorkerEOF
132*7304104dSAndroid Build Coastguard Worker
133*7304104dSAndroid Build Coastguard Workertestrun ${abs_top_builddir}/src/elflint --gnu testfile_pt_gnu_prop
134*7304104dSAndroid Build Coastguard Worker
135*7304104dSAndroid Build Coastguard Workerexit 0
136