1# Copyright (C) 2020 Red Hat, Inc.
2# This file is part of elfutils.
3#
4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# elfutils is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17. $srcdir/test-subr.sh
18
19# - retian.s
20#   .section        .data.retain,"R"
21#   .word   1
22#
23# as -o testfile-retain.o retain.s
24
25testfiles testfile-retain.o
26
27testrun_compare ${abs_top_builddir}/src/readelf -S testfile-retain.o << EOF
28There are 9 section headers, starting at offset 0x158:
29
30Section Headers:
31[Nr] Name                 Type         Addr             Off      Size     ES Flags Lk Inf Al
32[ 0]                      NULL         0000000000000000 00000000 00000000  0        0   0  0
33[ 1] .text                PROGBITS     0000000000000000 00000040 00000000  0 AX     0   0  1
34[ 2] .data                PROGBITS     0000000000000000 00000040 00000000  0 WA     0   0  1
35[ 3] .bss                 NOBITS       0000000000000000 00000040 00000000  0 WA     0   0  1
36[ 4] .data.retain         PROGBITS     0000000000000000 00000040 00000002  0 WAR    0   0  1
37[ 5] .note.gnu.property   NOTE         0000000000000000 00000048 00000030  0 A      0   0  8
38[ 6] .symtab              SYMTAB       0000000000000000 00000078 00000090 24        7   6  8
39[ 7] .strtab              STRTAB       0000000000000000 00000108 00000001  0        0   0  1
40[ 8] .shstrtab            STRTAB       0000000000000000 00000109 0000004c  0        0   0  1
41
42EOF
43
44testrun ${abs_top_builddir}/src/elflint --gnu testfile-retain.o
45