1#! /bin/sh 2# Copyright (C) 2017 Red Hat, Inc. 3# This file is part of elfutils. 4# 5# This file is free software; you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation; either version 3 of the License, or 8# (at your option) any later version. 9# 10# elfutils is distributed in the hope that it will be useful, but 11# WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18. $srcdir/test-subr.sh 19 20# strip -o output and -f debug files 21tempfiles testfile.elf testfile.debug 22 23# A random 32bit testfile 24testfiles testfile 25 26# Explicitly keep .strtab (but not .symtab, so .strtab will be in both). 32bit 27echo strip --keep-section=.strtab testfile 28testrun ${abs_top_builddir}/src/strip --keep-section=.strtab -o testfile.elf -f testfile.debug testfile 29echo elflint testfile.elf 30testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf 31echo elflint testfile.debug 32testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug 33echo readelf testfile.elf 34testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF 35There are 27 section headers, starting at offset 0xaf8: 36 37Section Headers: 38[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 39[ 0] NULL 00000000 000000 000000 0 0 0 0 40[ 1] .interp PROGBITS 080480f4 0000f4 000013 0 A 0 0 1 41[ 2] .note.ABI-tag NOTE 08048108 000108 000020 0 A 0 0 4 42[ 3] .hash HASH 08048128 000128 000030 4 A 4 0 4 43[ 4] .dynsym DYNSYM 08048158 000158 000070 16 A 5 1 4 44[ 5] .dynstr STRTAB 080481c8 0001c8 00008e 0 A 0 0 1 45[ 6] .gnu.version GNU_versym 08048256 000256 00000e 2 A 4 0 2 46[ 7] .gnu.version_r GNU_verneed 08048264 000264 000030 0 A 5 1 4 47[ 8] .rel.got REL 08048294 000294 000008 8 A 4 19 4 48[ 9] .rel.plt REL 0804829c 00029c 000020 8 A 4 11 4 49[10] .init PROGBITS 080482bc 0002bc 000018 0 AX 0 0 4 50[11] .plt PROGBITS 080482d4 0002d4 000050 4 AX 0 0 4 51[12] .text PROGBITS 08048330 000330 00018c 0 AX 0 0 16 52[13] .fini PROGBITS 080484bc 0004bc 00001e 0 AX 0 0 4 53[14] .rodata PROGBITS 080484dc 0004dc 000008 0 A 0 0 4 54[15] .data PROGBITS 080494e4 0004e4 000010 0 WA 0 0 4 55[16] .eh_frame PROGBITS 080494f4 0004f4 000004 0 WA 0 0 4 56[17] .ctors PROGBITS 080494f8 0004f8 000008 0 WA 0 0 4 57[18] .dtors PROGBITS 08049500 000500 000008 0 WA 0 0 4 58[19] .got PROGBITS 08049508 000508 000020 4 WA 0 0 4 59[20] .dynamic DYNAMIC 08049528 000528 0000a0 8 WA 5 0 4 60[21] .bss NOBITS 080495c8 0005c8 00001c 0 WA 0 0 4 61[22] .comment PROGBITS 00000000 0005c8 000170 0 0 0 1 62[23] .note NOTE 00000000 000738 0000a0 0 0 0 1 63[24] .strtab STRTAB 00000000 0007d8 000235 0 0 0 1 64[25] .gnu_debuglink PROGBITS 00000000 000a10 000014 0 0 0 4 65[26] .shstrtab STRTAB 00000000 000a24 0000d1 0 0 0 1 66 67EOF 68echo readelf testfile.debug 69testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF 70There are 35 section headers, starting at offset 0x463c: 71 72Section Headers: 73[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 74[ 0] NULL 00000000 000000 000000 0 0 0 0 75[ 1] .interp NOBITS 080480f4 0000f4 000013 0 A 0 0 1 76[ 2] .note.ABI-tag NOTE 08048108 0000f4 000020 0 A 0 0 4 77[ 3] .hash NOBITS 08048128 000114 000030 4 A 4 0 4 78[ 4] .dynsym NOBITS 08048158 000114 000070 16 A 5 1 4 79[ 5] .dynstr NOBITS 080481c8 000114 00008e 0 A 0 0 1 80[ 6] .gnu.version NOBITS 08048256 000114 00000e 2 A 4 0 2 81[ 7] .gnu.version_r NOBITS 08048264 000114 000030 0 A 5 1 4 82[ 8] .rel.got NOBITS 08048294 000114 000008 8 A 4 19 4 83[ 9] .rel.plt NOBITS 0804829c 000114 000020 8 A 4 11 4 84[10] .init NOBITS 080482bc 000114 000018 0 AX 0 0 4 85[11] .plt NOBITS 080482d4 000114 000050 4 AX 0 0 4 86[12] .text NOBITS 08048330 000120 00018c 0 AX 0 0 16 87[13] .fini NOBITS 080484bc 000120 00001e 0 AX 0 0 4 88[14] .rodata NOBITS 080484dc 000120 000008 0 A 0 0 4 89[15] .data NOBITS 080494e4 000120 000010 0 WA 0 0 4 90[16] .eh_frame NOBITS 080494f4 000120 000004 0 WA 0 0 4 91[17] .ctors NOBITS 080494f8 000120 000008 0 WA 0 0 4 92[18] .dtors NOBITS 08049500 000120 000008 0 WA 0 0 4 93[19] .got NOBITS 08049508 000120 000020 4 WA 0 0 4 94[20] .dynamic NOBITS 08049528 000120 0000a0 8 WA 5 0 4 95[21] .sbss PROGBITS 080495c8 000120 000000 0 W 0 0 1 96[22] .bss NOBITS 080495c8 000120 00001c 0 WA 0 0 4 97[23] .stab PROGBITS 00000000 000120 000720 12 24 0 4 98[24] .stabstr STRTAB 00000000 000840 001934 0 0 0 1 99[25] .comment NOBITS 00000000 002174 000170 0 0 0 1 100[26] .debug_aranges PROGBITS 00000000 002174 000060 0 0 0 1 101[27] .debug_pubnames PROGBITS 00000000 0021d4 000055 0 0 0 1 102[28] .debug_info PROGBITS 00000000 002229 001678 0 0 0 1 103[29] .debug_abbrev PROGBITS 00000000 0038a1 0001d2 0 0 0 1 104[30] .debug_line PROGBITS 00000000 003a73 000223 0 0 0 1 105[31] .note NOTE 00000000 003c96 0000a0 0 0 0 1 106[32] .shstrtab STRTAB 00000000 003d36 00012e 0 0 0 1 107[33] .symtab SYMTAB 00000000 003e64 0005a0 16 34 68 4 108[34] .strtab STRTAB 00000000 004404 000235 0 0 0 1 109 110EOF 111 112# Explicitly keep .symtab (pulls in .strtab, so they will both be in elf). 32bit 113echo strip --keep-section=.symtab testfile 114testrun ${abs_top_builddir}/src/strip --keep-section=.symtab -o testfile.elf -f testfile.debug testfile 115echo elflint testfile.elf 116testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf 117echo elflint testfile.debug 118testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug 119echo readelf testfile.elf 120testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF 121There are 28 section headers, starting at offset 0x1010: 122 123Section Headers: 124[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 125[ 0] NULL 00000000 000000 000000 0 0 0 0 126[ 1] .interp PROGBITS 080480f4 0000f4 000013 0 A 0 0 1 127[ 2] .note.ABI-tag NOTE 08048108 000108 000020 0 A 0 0 4 128[ 3] .hash HASH 08048128 000128 000030 4 A 4 0 4 129[ 4] .dynsym DYNSYM 08048158 000158 000070 16 A 5 1 4 130[ 5] .dynstr STRTAB 080481c8 0001c8 00008e 0 A 0 0 1 131[ 6] .gnu.version GNU_versym 08048256 000256 00000e 2 A 4 0 2 132[ 7] .gnu.version_r GNU_verneed 08048264 000264 000030 0 A 5 1 4 133[ 8] .rel.got REL 08048294 000294 000008 8 A 4 19 4 134[ 9] .rel.plt REL 0804829c 00029c 000020 8 A 4 11 4 135[10] .init PROGBITS 080482bc 0002bc 000018 0 AX 0 0 4 136[11] .plt PROGBITS 080482d4 0002d4 000050 4 AX 0 0 4 137[12] .text PROGBITS 08048330 000330 00018c 0 AX 0 0 16 138[13] .fini PROGBITS 080484bc 0004bc 00001e 0 AX 0 0 4 139[14] .rodata PROGBITS 080484dc 0004dc 000008 0 A 0 0 4 140[15] .data PROGBITS 080494e4 0004e4 000010 0 WA 0 0 4 141[16] .eh_frame PROGBITS 080494f4 0004f4 000004 0 WA 0 0 4 142[17] .ctors PROGBITS 080494f8 0004f8 000008 0 WA 0 0 4 143[18] .dtors PROGBITS 08049500 000500 000008 0 WA 0 0 4 144[19] .got PROGBITS 08049508 000508 000020 4 WA 0 0 4 145[20] .dynamic DYNAMIC 08049528 000528 0000a0 8 WA 5 0 4 146[21] .bss NOBITS 080495c8 0005c8 00001c 0 WA 0 0 4 147[22] .comment PROGBITS 00000000 0005c8 000170 0 0 0 1 148[23] .note NOTE 00000000 000738 0000a0 0 0 0 1 149[24] .symtab SYMTAB 00000000 0007d8 000510 16 25 59 4 150[25] .strtab STRTAB 00000000 000ce8 000235 0 0 0 1 151[26] .gnu_debuglink PROGBITS 00000000 000f20 000014 0 0 0 4 152[27] .shstrtab STRTAB 00000000 000f34 0000d9 0 0 0 1 153 154EOF 155echo readelf testfile.debug 156testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF 157There are 35 section headers, starting at offset 0x3e64: 158 159Section Headers: 160[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 161[ 0] NULL 00000000 000000 000000 0 0 0 0 162[ 1] .interp NOBITS 080480f4 0000f4 000013 0 A 0 0 1 163[ 2] .note.ABI-tag NOTE 08048108 0000f4 000020 0 A 0 0 4 164[ 3] .hash NOBITS 08048128 000114 000030 4 A 4 0 4 165[ 4] .dynsym NOBITS 08048158 000114 000070 16 A 5 1 4 166[ 5] .dynstr NOBITS 080481c8 000114 00008e 0 A 0 0 1 167[ 6] .gnu.version NOBITS 08048256 000114 00000e 2 A 4 0 2 168[ 7] .gnu.version_r NOBITS 08048264 000114 000030 0 A 5 1 4 169[ 8] .rel.got NOBITS 08048294 000114 000008 8 A 4 19 4 170[ 9] .rel.plt NOBITS 0804829c 000114 000020 8 A 4 11 4 171[10] .init NOBITS 080482bc 000114 000018 0 AX 0 0 4 172[11] .plt NOBITS 080482d4 000114 000050 4 AX 0 0 4 173[12] .text NOBITS 08048330 000120 00018c 0 AX 0 0 16 174[13] .fini NOBITS 080484bc 000120 00001e 0 AX 0 0 4 175[14] .rodata NOBITS 080484dc 000120 000008 0 A 0 0 4 176[15] .data NOBITS 080494e4 000120 000010 0 WA 0 0 4 177[16] .eh_frame NOBITS 080494f4 000120 000004 0 WA 0 0 4 178[17] .ctors NOBITS 080494f8 000120 000008 0 WA 0 0 4 179[18] .dtors NOBITS 08049500 000120 000008 0 WA 0 0 4 180[19] .got NOBITS 08049508 000120 000020 4 WA 0 0 4 181[20] .dynamic NOBITS 08049528 000120 0000a0 8 WA 5 0 4 182[21] .sbss PROGBITS 080495c8 000120 000000 0 W 0 0 1 183[22] .bss NOBITS 080495c8 000120 00001c 0 WA 0 0 4 184[23] .stab PROGBITS 00000000 000120 000720 12 24 0 4 185[24] .stabstr STRTAB 00000000 000840 001934 0 0 0 1 186[25] .comment NOBITS 00000000 002174 000170 0 0 0 1 187[26] .debug_aranges PROGBITS 00000000 002174 000060 0 0 0 1 188[27] .debug_pubnames PROGBITS 00000000 0021d4 000055 0 0 0 1 189[28] .debug_info PROGBITS 00000000 002229 001678 0 0 0 1 190[29] .debug_abbrev PROGBITS 00000000 0038a1 0001d2 0 0 0 1 191[30] .debug_line PROGBITS 00000000 003a73 000223 0 0 0 1 192[31] .note NOTE 00000000 003c96 0000a0 0 0 0 1 193[32] .shstrtab STRTAB 00000000 003d36 00012e 0 0 0 1 194[33] .symtab NOBITS 00000000 003e64 0005a0 16 34 68 4 195[34] .strtab NOBITS 00000000 003e64 000235 0 0 0 1 196 197EOF 198 199# A random 64bit testfile 200testfiles testfile69.so 201# Explicitly keep .strtab (but not .symtab, so .strtab will be in both). 64bit 202echo strip --keep-section=.strtab testfile69.so 203testrun ${abs_top_builddir}/src/strip --keep-section=.strtab -o testfile.elf -f testfile.debug testfile69.so 204echo elflint testfile.elf 205testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf 206echo elflint testfile.debug 207testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug 208echo readelf testfile.elf 209testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF 210There are 27 section headers, starting at offset 0xad8: 211 212Section Headers: 213[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 214[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 215[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 216[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 0000003c 0 A 3 0 8 217[ 3] .dynsym DYNSYM 00000000000001f8 000001f8 00000108 24 A 4 2 8 218[ 4] .dynstr STRTAB 0000000000000300 00000300 00000077 0 A 0 0 1 219[ 5] .gnu.version GNU_versym 0000000000000378 00000378 00000016 2 A 3 0 2 220[ 6] .gnu.version_r GNU_verneed 0000000000000390 00000390 00000020 0 A 4 1 8 221[ 7] .rela.dyn RELA 00000000000003b0 000003b0 00000060 24 A 3 0 8 222[ 8] .rela.plt RELA 0000000000000410 00000410 00000018 24 A 3 10 8 223[ 9] .init PROGBITS 0000000000000428 00000428 00000018 0 AX 0 0 4 224[10] .plt PROGBITS 0000000000000440 00000440 00000020 16 AX 0 0 16 225[11] .text PROGBITS 0000000000000460 00000460 00000128 0 AX 0 0 16 226[12] .fini PROGBITS 0000000000000588 00000588 0000000e 0 AX 0 0 4 227[13] .eh_frame_hdr PROGBITS 0000000000000598 00000598 00000024 0 A 0 0 4 228[14] .eh_frame PROGBITS 00000000000005c0 000005c0 00000084 0 A 0 0 8 229[15] .ctors PROGBITS 0000000000200648 00000648 00000010 0 WA 0 0 8 230[16] .dtors PROGBITS 0000000000200658 00000658 00000010 0 WA 0 0 8 231[17] .jcr PROGBITS 0000000000200668 00000668 00000008 0 WA 0 0 8 232[18] .data.rel.ro PROGBITS 0000000000200670 00000670 00000008 0 WA 0 0 8 233[19] .dynamic DYNAMIC 0000000000200678 00000678 00000180 16 WA 4 0 8 234[20] .got PROGBITS 00000000002007f8 000007f8 00000018 8 WA 0 0 8 235[21] .got.plt PROGBITS 0000000000200810 00000810 00000020 8 WA 0 0 8 236[22] .bss NOBITS 0000000000200830 00000830 00000010 0 WA 0 0 8 237[23] .comment PROGBITS 0000000000000000 00000830 0000002c 1 MS 0 0 1 238[24] .strtab STRTAB 0000000000000000 0000085c 00000175 0 0 0 1 239[25] .gnu_debuglink PROGBITS 0000000000000000 000009d4 00000014 0 0 0 4 240[26] .shstrtab STRTAB 0000000000000000 000009e8 000000ee 0 0 0 1 241 242EOF 243echo readelf testfile.debug 244testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF 245There are 27 section headers, starting at offset 0x918: 246 247Section Headers: 248[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 249[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 250[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 251[ 2] .gnu.hash NOBITS 00000000000001b8 000001b8 0000003c 0 A 3 0 8 252[ 3] .dynsym NOBITS 00000000000001f8 000001b8 00000108 24 A 4 2 8 253[ 4] .dynstr NOBITS 0000000000000300 000001b8 00000077 0 A 0 0 1 254[ 5] .gnu.version NOBITS 0000000000000378 000001b8 00000016 2 A 3 0 2 255[ 6] .gnu.version_r NOBITS 0000000000000390 000001b8 00000020 0 A 4 1 8 256[ 7] .rela.dyn NOBITS 00000000000003b0 000001b8 00000060 24 A 3 0 8 257[ 8] .rela.plt NOBITS 0000000000000410 000001b8 00000018 24 A 3 10 8 258[ 9] .init NOBITS 0000000000000428 000001b8 00000018 0 AX 0 0 4 259[10] .plt NOBITS 0000000000000440 000001c0 00000020 16 AX 0 0 16 260[11] .text NOBITS 0000000000000460 000001c0 00000128 0 AX 0 0 16 261[12] .fini NOBITS 0000000000000588 000001c0 0000000e 0 AX 0 0 4 262[13] .eh_frame_hdr NOBITS 0000000000000598 000001c0 00000024 0 A 0 0 4 263[14] .eh_frame NOBITS 00000000000005c0 000001c0 00000084 0 A 0 0 8 264[15] .ctors NOBITS 0000000000200648 000001c0 00000010 0 WA 0 0 8 265[16] .dtors NOBITS 0000000000200658 000001c0 00000010 0 WA 0 0 8 266[17] .jcr NOBITS 0000000000200668 000001c0 00000008 0 WA 0 0 8 267[18] .data.rel.ro NOBITS 0000000000200670 000001c0 00000008 0 WA 0 0 8 268[19] .dynamic NOBITS 0000000000200678 000001c0 00000180 16 WA 4 0 8 269[20] .got NOBITS 00000000002007f8 000001c0 00000018 8 WA 0 0 8 270[21] .got.plt NOBITS 0000000000200810 000001c0 00000020 8 WA 0 0 8 271[22] .bss NOBITS 0000000000200830 000001c0 00000010 0 WA 0 0 8 272[23] .comment NOBITS 0000000000000000 000001c0 0000002c 1 MS 0 0 1 273[24] .shstrtab STRTAB 0000000000000000 000001c0 000000e7 0 0 0 1 274[25] .symtab SYMTAB 0000000000000000 000002a8 000004f8 24 26 44 8 275[26] .strtab STRTAB 0000000000000000 000007a0 00000175 0 0 0 1 276 277EOF 278 279# Explicitly keep .symtab (pulls in .strtab, so they will both be in elf). 64bit 280# Use --remove-comment to make sure testfile.debug isn't empty. 281echo strip --keep-section=.symtab --remove-comment testfile69.so 282testrun ${abs_top_builddir}/src/strip --keep-section=.symtab --remove-comment -o testfile.elf -f testfile.debug testfile69.so 283echo elflint testfile.elf 284testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf 285echo elflint testfile.debug 286testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug 287echo readelf testfile.elf 288testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF 289There are 27 section headers, starting at offset 0xf90: 290 291Section Headers: 292[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 293[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 294[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 295[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 0000003c 0 A 3 0 8 296[ 3] .dynsym DYNSYM 00000000000001f8 000001f8 00000108 24 A 4 2 8 297[ 4] .dynstr STRTAB 0000000000000300 00000300 00000077 0 A 0 0 1 298[ 5] .gnu.version GNU_versym 0000000000000378 00000378 00000016 2 A 3 0 2 299[ 6] .gnu.version_r GNU_verneed 0000000000000390 00000390 00000020 0 A 4 1 8 300[ 7] .rela.dyn RELA 00000000000003b0 000003b0 00000060 24 A 3 0 8 301[ 8] .rela.plt RELA 0000000000000410 00000410 00000018 24 A 3 10 8 302[ 9] .init PROGBITS 0000000000000428 00000428 00000018 0 AX 0 0 4 303[10] .plt PROGBITS 0000000000000440 00000440 00000020 16 AX 0 0 16 304[11] .text PROGBITS 0000000000000460 00000460 00000128 0 AX 0 0 16 305[12] .fini PROGBITS 0000000000000588 00000588 0000000e 0 AX 0 0 4 306[13] .eh_frame_hdr PROGBITS 0000000000000598 00000598 00000024 0 A 0 0 4 307[14] .eh_frame PROGBITS 00000000000005c0 000005c0 00000084 0 A 0 0 8 308[15] .ctors PROGBITS 0000000000200648 00000648 00000010 0 WA 0 0 8 309[16] .dtors PROGBITS 0000000000200658 00000658 00000010 0 WA 0 0 8 310[17] .jcr PROGBITS 0000000000200668 00000668 00000008 0 WA 0 0 8 311[18] .data.rel.ro PROGBITS 0000000000200670 00000670 00000008 0 WA 0 0 8 312[19] .dynamic DYNAMIC 0000000000200678 00000678 00000180 16 WA 4 0 8 313[20] .got PROGBITS 00000000002007f8 000007f8 00000018 8 WA 0 0 8 314[21] .got.plt PROGBITS 0000000000200810 00000810 00000020 8 WA 0 0 8 315[22] .bss NOBITS 0000000000200830 00000830 00000010 0 WA 0 0 8 316[23] .symtab SYMTAB 0000000000000000 00000830 000004e0 24 24 43 8 317[24] .strtab STRTAB 0000000000000000 00000d10 00000175 0 0 0 1 318[25] .gnu_debuglink PROGBITS 0000000000000000 00000e88 00000014 0 0 0 4 319[26] .shstrtab STRTAB 0000000000000000 00000e9c 000000ed 0 0 0 1 320 321EOF 322echo readelf testfile.debug 323testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF 324There are 27 section headers, starting at offset 0x2d8: 325 326Section Headers: 327[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 328[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 329[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 330[ 2] .gnu.hash NOBITS 00000000000001b8 000001b8 0000003c 0 A 3 0 8 331[ 3] .dynsym NOBITS 00000000000001f8 000001b8 00000108 24 A 4 2 8 332[ 4] .dynstr NOBITS 0000000000000300 000001b8 00000077 0 A 0 0 1 333[ 5] .gnu.version NOBITS 0000000000000378 000001b8 00000016 2 A 3 0 2 334[ 6] .gnu.version_r NOBITS 0000000000000390 000001b8 00000020 0 A 4 1 8 335[ 7] .rela.dyn NOBITS 00000000000003b0 000001b8 00000060 24 A 3 0 8 336[ 8] .rela.plt NOBITS 0000000000000410 000001b8 00000018 24 A 3 10 8 337[ 9] .init NOBITS 0000000000000428 000001b8 00000018 0 AX 0 0 4 338[10] .plt NOBITS 0000000000000440 000001c0 00000020 16 AX 0 0 16 339[11] .text NOBITS 0000000000000460 000001c0 00000128 0 AX 0 0 16 340[12] .fini NOBITS 0000000000000588 000001c0 0000000e 0 AX 0 0 4 341[13] .eh_frame_hdr NOBITS 0000000000000598 000001c0 00000024 0 A 0 0 4 342[14] .eh_frame NOBITS 00000000000005c0 000001c0 00000084 0 A 0 0 8 343[15] .ctors NOBITS 0000000000200648 000001c0 00000010 0 WA 0 0 8 344[16] .dtors NOBITS 0000000000200658 000001c0 00000010 0 WA 0 0 8 345[17] .jcr NOBITS 0000000000200668 000001c0 00000008 0 WA 0 0 8 346[18] .data.rel.ro NOBITS 0000000000200670 000001c0 00000008 0 WA 0 0 8 347[19] .dynamic NOBITS 0000000000200678 000001c0 00000180 16 WA 4 0 8 348[20] .got NOBITS 00000000002007f8 000001c0 00000018 8 WA 0 0 8 349[21] .got.plt NOBITS 0000000000200810 000001c0 00000020 8 WA 0 0 8 350[22] .bss NOBITS 0000000000200830 000001c0 00000010 0 WA 0 0 8 351[23] .comment PROGBITS 0000000000000000 000001c0 0000002c 1 MS 0 0 1 352[24] .shstrtab STRTAB 0000000000000000 000001ec 000000e7 0 0 0 1 353[25] .symtab NOBITS 0000000000000000 000002d8 000004f8 24 26 44 8 354[26] .strtab NOBITS 0000000000000000 000002d8 00000175 0 0 0 1 355 356EOF 357 358# Explicitly remove .symtab (but not .strtab, so it will be in both). 32bit 359echo strip -g --remove-section=.symtab testfile 360testrun ${abs_top_builddir}/src/strip -g --remove-section=.symtab -o testfile.elf -f testfile.debug testfile 361echo elflint testfile.elf 362testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf 363echo elflint testfile.debug 364testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug 365echo readelf testfile.elf 366testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF 367There are 28 section headers, starting at offset 0xafc: 368 369Section Headers: 370[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 371[ 0] NULL 00000000 000000 000000 0 0 0 0 372[ 1] .interp PROGBITS 080480f4 0000f4 000013 0 A 0 0 1 373[ 2] .note.ABI-tag NOTE 08048108 000108 000020 0 A 0 0 4 374[ 3] .hash HASH 08048128 000128 000030 4 A 4 0 4 375[ 4] .dynsym DYNSYM 08048158 000158 000070 16 A 5 1 4 376[ 5] .dynstr STRTAB 080481c8 0001c8 00008e 0 A 0 0 1 377[ 6] .gnu.version GNU_versym 08048256 000256 00000e 2 A 4 0 2 378[ 7] .gnu.version_r GNU_verneed 08048264 000264 000030 0 A 5 1 4 379[ 8] .rel.got REL 08048294 000294 000008 8 A 4 19 4 380[ 9] .rel.plt REL 0804829c 00029c 000020 8 A 4 11 4 381[10] .init PROGBITS 080482bc 0002bc 000018 0 AX 0 0 4 382[11] .plt PROGBITS 080482d4 0002d4 000050 4 AX 0 0 4 383[12] .text PROGBITS 08048330 000330 00018c 0 AX 0 0 16 384[13] .fini PROGBITS 080484bc 0004bc 00001e 0 AX 0 0 4 385[14] .rodata PROGBITS 080484dc 0004dc 000008 0 A 0 0 4 386[15] .data PROGBITS 080494e4 0004e4 000010 0 WA 0 0 4 387[16] .eh_frame PROGBITS 080494f4 0004f4 000004 0 WA 0 0 4 388[17] .ctors PROGBITS 080494f8 0004f8 000008 0 WA 0 0 4 389[18] .dtors PROGBITS 08049500 000500 000008 0 WA 0 0 4 390[19] .got PROGBITS 08049508 000508 000020 4 WA 0 0 4 391[20] .dynamic DYNAMIC 08049528 000528 0000a0 8 WA 5 0 4 392[21] .sbss PROGBITS 080495c8 0005c8 000000 0 W 0 0 1 393[22] .bss NOBITS 080495c8 0005c8 00001c 0 WA 0 0 4 394[23] .comment PROGBITS 00000000 0005c8 000170 0 0 0 1 395[24] .note NOTE 00000000 000738 0000a0 0 0 0 1 396[25] .strtab STRTAB 00000000 0007d8 000235 0 0 0 1 397[26] .gnu_debuglink PROGBITS 00000000 000a10 000014 0 0 0 4 398[27] .shstrtab STRTAB 00000000 000a24 0000d7 0 0 0 1 399 400EOF 401echo readelf testfile.debug 402testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF 403There are 35 section headers, starting at offset 0x463c: 404 405Section Headers: 406[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 407[ 0] NULL 00000000 000000 000000 0 0 0 0 408[ 1] .interp NOBITS 080480f4 0000f4 000013 0 A 0 0 1 409[ 2] .note.ABI-tag NOTE 08048108 0000f4 000020 0 A 0 0 4 410[ 3] .hash NOBITS 08048128 000114 000030 4 A 4 0 4 411[ 4] .dynsym NOBITS 08048158 000114 000070 16 A 5 1 4 412[ 5] .dynstr NOBITS 080481c8 000114 00008e 0 A 0 0 1 413[ 6] .gnu.version NOBITS 08048256 000114 00000e 2 A 4 0 2 414[ 7] .gnu.version_r NOBITS 08048264 000114 000030 0 A 5 1 4 415[ 8] .rel.got NOBITS 08048294 000114 000008 8 A 4 19 4 416[ 9] .rel.plt NOBITS 0804829c 000114 000020 8 A 4 11 4 417[10] .init NOBITS 080482bc 000114 000018 0 AX 0 0 4 418[11] .plt NOBITS 080482d4 000114 000050 4 AX 0 0 4 419[12] .text NOBITS 08048330 000120 00018c 0 AX 0 0 16 420[13] .fini NOBITS 080484bc 000120 00001e 0 AX 0 0 4 421[14] .rodata NOBITS 080484dc 000120 000008 0 A 0 0 4 422[15] .data NOBITS 080494e4 000120 000010 0 WA 0 0 4 423[16] .eh_frame NOBITS 080494f4 000120 000004 0 WA 0 0 4 424[17] .ctors NOBITS 080494f8 000120 000008 0 WA 0 0 4 425[18] .dtors NOBITS 08049500 000120 000008 0 WA 0 0 4 426[19] .got NOBITS 08049508 000120 000020 4 WA 0 0 4 427[20] .dynamic NOBITS 08049528 000120 0000a0 8 WA 5 0 4 428[21] .sbss NOBITS 080495c8 000120 000000 0 W 0 0 1 429[22] .bss NOBITS 080495c8 000120 00001c 0 WA 0 0 4 430[23] .stab PROGBITS 00000000 000120 000720 12 24 0 4 431[24] .stabstr STRTAB 00000000 000840 001934 0 0 0 1 432[25] .comment NOBITS 00000000 002174 000170 0 0 0 1 433[26] .debug_aranges PROGBITS 00000000 002174 000060 0 0 0 1 434[27] .debug_pubnames PROGBITS 00000000 0021d4 000055 0 0 0 1 435[28] .debug_info PROGBITS 00000000 002229 001678 0 0 0 1 436[29] .debug_abbrev PROGBITS 00000000 0038a1 0001d2 0 0 0 1 437[30] .debug_line PROGBITS 00000000 003a73 000223 0 0 0 1 438[31] .note NOTE 00000000 003c96 0000a0 0 0 0 1 439[32] .shstrtab STRTAB 00000000 003d36 00012e 0 0 0 1 440[33] .symtab SYMTAB 00000000 003e64 0005a0 16 34 68 4 441[34] .strtab STRTAB 00000000 004404 000235 0 0 0 1 442 443EOF 444 445# Explicitly remove both .symtab and .strtab. Keep .stab and .stabstr 32bit 446echo strip -g --remove-section=".s[yt][mr]tab" --keep-section=".stab*" testfile 447testrun ${abs_top_builddir}/src/strip -g --remove-section=".s[yt][mr]tab" --keep-section=".stab*" -o testfile.elf -f testfile.debug testfile 448echo elflint testfile.elf 449testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf 450echo elflint testfile.debug 451testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug 452echo readelf testfile.elf 453testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF 454There are 29 section headers, starting at offset 0x2920: 455 456Section Headers: 457[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 458[ 0] NULL 00000000 000000 000000 0 0 0 0 459[ 1] .interp PROGBITS 080480f4 0000f4 000013 0 A 0 0 1 460[ 2] .note.ABI-tag NOTE 08048108 000108 000020 0 A 0 0 4 461[ 3] .hash HASH 08048128 000128 000030 4 A 4 0 4 462[ 4] .dynsym DYNSYM 08048158 000158 000070 16 A 5 1 4 463[ 5] .dynstr STRTAB 080481c8 0001c8 00008e 0 A 0 0 1 464[ 6] .gnu.version GNU_versym 08048256 000256 00000e 2 A 4 0 2 465[ 7] .gnu.version_r GNU_verneed 08048264 000264 000030 0 A 5 1 4 466[ 8] .rel.got REL 08048294 000294 000008 8 A 4 19 4 467[ 9] .rel.plt REL 0804829c 00029c 000020 8 A 4 11 4 468[10] .init PROGBITS 080482bc 0002bc 000018 0 AX 0 0 4 469[11] .plt PROGBITS 080482d4 0002d4 000050 4 AX 0 0 4 470[12] .text PROGBITS 08048330 000330 00018c 0 AX 0 0 16 471[13] .fini PROGBITS 080484bc 0004bc 00001e 0 AX 0 0 4 472[14] .rodata PROGBITS 080484dc 0004dc 000008 0 A 0 0 4 473[15] .data PROGBITS 080494e4 0004e4 000010 0 WA 0 0 4 474[16] .eh_frame PROGBITS 080494f4 0004f4 000004 0 WA 0 0 4 475[17] .ctors PROGBITS 080494f8 0004f8 000008 0 WA 0 0 4 476[18] .dtors PROGBITS 08049500 000500 000008 0 WA 0 0 4 477[19] .got PROGBITS 08049508 000508 000020 4 WA 0 0 4 478[20] .dynamic DYNAMIC 08049528 000528 0000a0 8 WA 5 0 4 479[21] .sbss PROGBITS 080495c8 0005c8 000000 0 W 0 0 1 480[22] .bss NOBITS 080495c8 0005c8 00001c 0 WA 0 0 4 481[23] .stab PROGBITS 00000000 0005c8 000720 12 24 0 4 482[24] .stabstr STRTAB 00000000 000ce8 001934 0 0 0 1 483[25] .comment PROGBITS 00000000 00261c 000170 0 0 0 1 484[26] .note NOTE 00000000 00278c 0000a0 0 0 0 1 485[27] .gnu_debuglink PROGBITS 00000000 00282c 000014 0 0 0 4 486[28] .shstrtab STRTAB 00000000 002840 0000de 0 0 0 1 487 488EOF 489echo readelf testfile.debug 490testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF 491There are 35 section headers, starting at offset 0x25e8: 492 493Section Headers: 494[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 495[ 0] NULL 00000000 000000 000000 0 0 0 0 496[ 1] .interp NOBITS 080480f4 0000f4 000013 0 A 0 0 1 497[ 2] .note.ABI-tag NOTE 08048108 0000f4 000020 0 A 0 0 4 498[ 3] .hash NOBITS 08048128 000114 000030 4 A 4 0 4 499[ 4] .dynsym NOBITS 08048158 000114 000070 16 A 5 1 4 500[ 5] .dynstr NOBITS 080481c8 000114 00008e 0 A 0 0 1 501[ 6] .gnu.version NOBITS 08048256 000114 00000e 2 A 4 0 2 502[ 7] .gnu.version_r NOBITS 08048264 000114 000030 0 A 5 1 4 503[ 8] .rel.got NOBITS 08048294 000114 000008 8 A 4 19 4 504[ 9] .rel.plt NOBITS 0804829c 000114 000020 8 A 4 11 4 505[10] .init NOBITS 080482bc 000114 000018 0 AX 0 0 4 506[11] .plt NOBITS 080482d4 000114 000050 4 AX 0 0 4 507[12] .text NOBITS 08048330 000120 00018c 0 AX 0 0 16 508[13] .fini NOBITS 080484bc 000120 00001e 0 AX 0 0 4 509[14] .rodata NOBITS 080484dc 000120 000008 0 A 0 0 4 510[15] .data NOBITS 080494e4 000120 000010 0 WA 0 0 4 511[16] .eh_frame NOBITS 080494f4 000120 000004 0 WA 0 0 4 512[17] .ctors NOBITS 080494f8 000120 000008 0 WA 0 0 4 513[18] .dtors NOBITS 08049500 000120 000008 0 WA 0 0 4 514[19] .got NOBITS 08049508 000120 000020 4 WA 0 0 4 515[20] .dynamic NOBITS 08049528 000120 0000a0 8 WA 5 0 4 516[21] .sbss NOBITS 080495c8 000120 000000 0 W 0 0 1 517[22] .bss NOBITS 080495c8 000120 00001c 0 WA 0 0 4 518[23] .stab NOBITS 00000000 000120 000720 12 24 0 4 519[24] .stabstr NOBITS 00000000 000120 001934 0 0 0 1 520[25] .comment NOBITS 00000000 000120 000170 0 0 0 1 521[26] .debug_aranges PROGBITS 00000000 000120 000060 0 0 0 1 522[27] .debug_pubnames PROGBITS 00000000 000180 000055 0 0 0 1 523[28] .debug_info PROGBITS 00000000 0001d5 001678 0 0 0 1 524[29] .debug_abbrev PROGBITS 00000000 00184d 0001d2 0 0 0 1 525[30] .debug_line PROGBITS 00000000 001a1f 000223 0 0 0 1 526[31] .note NOTE 00000000 001c42 0000a0 0 0 0 1 527[32] .shstrtab STRTAB 00000000 001ce2 00012e 0 0 0 1 528[33] .symtab SYMTAB 00000000 001e10 0005a0 16 34 68 4 529[34] .strtab STRTAB 00000000 0023b0 000235 0 0 0 1 530 531EOF 532 533# Explicitly remove .symtab (but not .strtab, so it will be in both). 64bit 534echo strip -g --remove-section=.symtab testfile69.so 535testrun ${abs_top_builddir}/src/strip -g --remove-section=.symtab -o testfile.elf -f testfile.debug testfile69.so 536echo elflint testfile.elf 537testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf 538echo elflint testfile.debug 539testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug 540echo readelf testfile.elf 541testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF 542There are 27 section headers, starting at offset 0xad8: 543 544Section Headers: 545[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 546[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 547[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 548[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 0000003c 0 A 3 0 8 549[ 3] .dynsym DYNSYM 00000000000001f8 000001f8 00000108 24 A 4 2 8 550[ 4] .dynstr STRTAB 0000000000000300 00000300 00000077 0 A 0 0 1 551[ 5] .gnu.version GNU_versym 0000000000000378 00000378 00000016 2 A 3 0 2 552[ 6] .gnu.version_r GNU_verneed 0000000000000390 00000390 00000020 0 A 4 1 8 553[ 7] .rela.dyn RELA 00000000000003b0 000003b0 00000060 24 A 3 0 8 554[ 8] .rela.plt RELA 0000000000000410 00000410 00000018 24 A 3 10 8 555[ 9] .init PROGBITS 0000000000000428 00000428 00000018 0 AX 0 0 4 556[10] .plt PROGBITS 0000000000000440 00000440 00000020 16 AX 0 0 16 557[11] .text PROGBITS 0000000000000460 00000460 00000128 0 AX 0 0 16 558[12] .fini PROGBITS 0000000000000588 00000588 0000000e 0 AX 0 0 4 559[13] .eh_frame_hdr PROGBITS 0000000000000598 00000598 00000024 0 A 0 0 4 560[14] .eh_frame PROGBITS 00000000000005c0 000005c0 00000084 0 A 0 0 8 561[15] .ctors PROGBITS 0000000000200648 00000648 00000010 0 WA 0 0 8 562[16] .dtors PROGBITS 0000000000200658 00000658 00000010 0 WA 0 0 8 563[17] .jcr PROGBITS 0000000000200668 00000668 00000008 0 WA 0 0 8 564[18] .data.rel.ro PROGBITS 0000000000200670 00000670 00000008 0 WA 0 0 8 565[19] .dynamic DYNAMIC 0000000000200678 00000678 00000180 16 WA 4 0 8 566[20] .got PROGBITS 00000000002007f8 000007f8 00000018 8 WA 0 0 8 567[21] .got.plt PROGBITS 0000000000200810 00000810 00000020 8 WA 0 0 8 568[22] .bss NOBITS 0000000000200830 00000830 00000010 0 WA 0 0 8 569[23] .comment PROGBITS 0000000000000000 00000830 0000002c 1 MS 0 0 1 570[24] .strtab STRTAB 0000000000000000 0000085c 00000175 0 0 0 1 571[25] .gnu_debuglink PROGBITS 0000000000000000 000009d4 00000014 0 0 0 4 572[26] .shstrtab STRTAB 0000000000000000 000009e8 000000ee 0 0 0 1 573 574EOF 575echo readelf testfile.debug 576testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF 577There are 27 section headers, starting at offset 0x918: 578 579Section Headers: 580[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 581[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 582[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 583[ 2] .gnu.hash NOBITS 00000000000001b8 000001b8 0000003c 0 A 3 0 8 584[ 3] .dynsym NOBITS 00000000000001f8 000001b8 00000108 24 A 4 2 8 585[ 4] .dynstr NOBITS 0000000000000300 000001b8 00000077 0 A 0 0 1 586[ 5] .gnu.version NOBITS 0000000000000378 000001b8 00000016 2 A 3 0 2 587[ 6] .gnu.version_r NOBITS 0000000000000390 000001b8 00000020 0 A 4 1 8 588[ 7] .rela.dyn NOBITS 00000000000003b0 000001b8 00000060 24 A 3 0 8 589[ 8] .rela.plt NOBITS 0000000000000410 000001b8 00000018 24 A 3 10 8 590[ 9] .init NOBITS 0000000000000428 000001b8 00000018 0 AX 0 0 4 591[10] .plt NOBITS 0000000000000440 000001c0 00000020 16 AX 0 0 16 592[11] .text NOBITS 0000000000000460 000001c0 00000128 0 AX 0 0 16 593[12] .fini NOBITS 0000000000000588 000001c0 0000000e 0 AX 0 0 4 594[13] .eh_frame_hdr NOBITS 0000000000000598 000001c0 00000024 0 A 0 0 4 595[14] .eh_frame NOBITS 00000000000005c0 000001c0 00000084 0 A 0 0 8 596[15] .ctors NOBITS 0000000000200648 000001c0 00000010 0 WA 0 0 8 597[16] .dtors NOBITS 0000000000200658 000001c0 00000010 0 WA 0 0 8 598[17] .jcr NOBITS 0000000000200668 000001c0 00000008 0 WA 0 0 8 599[18] .data.rel.ro NOBITS 0000000000200670 000001c0 00000008 0 WA 0 0 8 600[19] .dynamic NOBITS 0000000000200678 000001c0 00000180 16 WA 4 0 8 601[20] .got NOBITS 00000000002007f8 000001c0 00000018 8 WA 0 0 8 602[21] .got.plt NOBITS 0000000000200810 000001c0 00000020 8 WA 0 0 8 603[22] .bss NOBITS 0000000000200830 000001c0 00000010 0 WA 0 0 8 604[23] .comment NOBITS 0000000000000000 000001c0 0000002c 1 MS 0 0 1 605[24] .shstrtab STRTAB 0000000000000000 000001c0 000000e7 0 0 0 1 606[25] .symtab SYMTAB 0000000000000000 000002a8 000004f8 24 26 44 8 607[26] .strtab STRTAB 0000000000000000 000007a0 00000175 0 0 0 1 608 609EOF 610 611# Explicitly remove both .symtab and .strtab. Keep .comment section. 64bit 612echo strip -g --remove-section=".s[yt][mr]tab" --keep-section=.comment testfile69.so 613testrun ${abs_top_builddir}/src/strip -g --remove-section=".s[yt][mr]tab" --keep-section=.comment -o testfile.elf -f testfile.debug testfile69.so 614echo elflint testfile.elf 615testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf 616echo elflint testfile.debug 617testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug 618echo readelf testfile.elf 619testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF 620There are 26 section headers, starting at offset 0x958: 621 622Section Headers: 623[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 624[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 625[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 626[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 0000003c 0 A 3 0 8 627[ 3] .dynsym DYNSYM 00000000000001f8 000001f8 00000108 24 A 4 2 8 628[ 4] .dynstr STRTAB 0000000000000300 00000300 00000077 0 A 0 0 1 629[ 5] .gnu.version GNU_versym 0000000000000378 00000378 00000016 2 A 3 0 2 630[ 6] .gnu.version_r GNU_verneed 0000000000000390 00000390 00000020 0 A 4 1 8 631[ 7] .rela.dyn RELA 00000000000003b0 000003b0 00000060 24 A 3 0 8 632[ 8] .rela.plt RELA 0000000000000410 00000410 00000018 24 A 3 10 8 633[ 9] .init PROGBITS 0000000000000428 00000428 00000018 0 AX 0 0 4 634[10] .plt PROGBITS 0000000000000440 00000440 00000020 16 AX 0 0 16 635[11] .text PROGBITS 0000000000000460 00000460 00000128 0 AX 0 0 16 636[12] .fini PROGBITS 0000000000000588 00000588 0000000e 0 AX 0 0 4 637[13] .eh_frame_hdr PROGBITS 0000000000000598 00000598 00000024 0 A 0 0 4 638[14] .eh_frame PROGBITS 00000000000005c0 000005c0 00000084 0 A 0 0 8 639[15] .ctors PROGBITS 0000000000200648 00000648 00000010 0 WA 0 0 8 640[16] .dtors PROGBITS 0000000000200658 00000658 00000010 0 WA 0 0 8 641[17] .jcr PROGBITS 0000000000200668 00000668 00000008 0 WA 0 0 8 642[18] .data.rel.ro PROGBITS 0000000000200670 00000670 00000008 0 WA 0 0 8 643[19] .dynamic DYNAMIC 0000000000200678 00000678 00000180 16 WA 4 0 8 644[20] .got PROGBITS 00000000002007f8 000007f8 00000018 8 WA 0 0 8 645[21] .got.plt PROGBITS 0000000000200810 00000810 00000020 8 WA 0 0 8 646[22] .bss NOBITS 0000000000200830 00000830 00000010 0 WA 0 0 8 647[23] .comment PROGBITS 0000000000000000 00000830 0000002c 1 MS 0 0 1 648[24] .gnu_debuglink PROGBITS 0000000000000000 0000085c 00000014 0 0 0 4 649[25] .shstrtab STRTAB 0000000000000000 00000870 000000e6 0 0 0 1 650 651EOF 652echo readelf testfile.debug 653testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF 654There are 27 section headers, starting at offset 0x918: 655 656Section Headers: 657[Nr] Name Type Addr Off Size ES Flags Lk Inf Al 658[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 659[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 660[ 2] .gnu.hash NOBITS 00000000000001b8 000001b8 0000003c 0 A 3 0 8 661[ 3] .dynsym NOBITS 00000000000001f8 000001b8 00000108 24 A 4 2 8 662[ 4] .dynstr NOBITS 0000000000000300 000001b8 00000077 0 A 0 0 1 663[ 5] .gnu.version NOBITS 0000000000000378 000001b8 00000016 2 A 3 0 2 664[ 6] .gnu.version_r NOBITS 0000000000000390 000001b8 00000020 0 A 4 1 8 665[ 7] .rela.dyn NOBITS 00000000000003b0 000001b8 00000060 24 A 3 0 8 666[ 8] .rela.plt NOBITS 0000000000000410 000001b8 00000018 24 A 3 10 8 667[ 9] .init NOBITS 0000000000000428 000001b8 00000018 0 AX 0 0 4 668[10] .plt NOBITS 0000000000000440 000001c0 00000020 16 AX 0 0 16 669[11] .text NOBITS 0000000000000460 000001c0 00000128 0 AX 0 0 16 670[12] .fini NOBITS 0000000000000588 000001c0 0000000e 0 AX 0 0 4 671[13] .eh_frame_hdr NOBITS 0000000000000598 000001c0 00000024 0 A 0 0 4 672[14] .eh_frame NOBITS 00000000000005c0 000001c0 00000084 0 A 0 0 8 673[15] .ctors NOBITS 0000000000200648 000001c0 00000010 0 WA 0 0 8 674[16] .dtors NOBITS 0000000000200658 000001c0 00000010 0 WA 0 0 8 675[17] .jcr NOBITS 0000000000200668 000001c0 00000008 0 WA 0 0 8 676[18] .data.rel.ro NOBITS 0000000000200670 000001c0 00000008 0 WA 0 0 8 677[19] .dynamic NOBITS 0000000000200678 000001c0 00000180 16 WA 4 0 8 678[20] .got NOBITS 00000000002007f8 000001c0 00000018 8 WA 0 0 8 679[21] .got.plt NOBITS 0000000000200810 000001c0 00000020 8 WA 0 0 8 680[22] .bss NOBITS 0000000000200830 000001c0 00000010 0 WA 0 0 8 681[23] .comment NOBITS 0000000000000000 000001c0 0000002c 1 MS 0 0 1 682[24] .shstrtab STRTAB 0000000000000000 000001c0 000000e7 0 0 0 1 683[25] .symtab SYMTAB 0000000000000000 000002a8 000004f8 24 26 44 8 684[26] .strtab STRTAB 0000000000000000 000007a0 00000175 0 0 0 1 685 686EOF 687 688exit 0 689