]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / infoline-reloc-main-from-zero.exp
CommitLineData
1d506c26 1# Copyright 2018-2024 Free Software Foundation, Inc.
7ab6656f
OJ
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# This file is part of the gdb testsuite
17
18#
19# PR gdb/21695
20# This tests if gdb can display line information of relocated symbols in the
21# case where executable text section was at address zero before relocation.
22#
23
24standard_testfile .c
25
7ab6656f
OJ
26# Build executable with stripped startup code and text section starting at zero
27
a2470500
TV
28set opts {}
29lappend opts debug
21f507ef 30lappend opts "ldflags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"
f98a7af8 31lappend opts additional_flags=-static
a2470500 32
21f507ef 33set ld_flags ldflags=-Wl,--no-warn-rwx-segments
a2470500
TV
34if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executable \
35 $ld_flags] } {
36 lappend opts $ld_flags
37}
7ab6656f
OJ
38
39if {[build_executable $testfile.exp $testfile $srcfile $opts] == -1} {
40 untested "failed to compile"
41 return -1
42}
43
44clean_restart
45
46# Load symbols at an offset 0xffff0000 using add-symbol-file
47
48gdb_test "add-symbol-file $binfile 0xffff0000" \
49 "Reading symbols from .*" \
50 "add-symbol-file" \
51 "add symbol table from file \".*\" at.*\\(y or n\\) " "y"
52
53# Check if we are able to read offset adjusted line information of main
54
55gdb_test "info line main" \
56 "Line.*starts at address 0xffff0000.*and ends at.*"