1 # Copyright 2018-2024 Free Software Foundation, Inc.
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.
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.
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/>.
16 # This file is part of the gdb testsuite
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.
26 # Build executable with stripped startup code and text section starting at zero
30 lappend opts "ldflags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"
31 lappend opts additional_flags=-static
33 set ld_flags ldflags=-Wl,--no-warn-rwx-segments
34 if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executable \
36 lappend opts $ld_flags
39 if {[build_executable $testfile.exp $testfile $srcfile $opts] == -1} {
40 untested "failed to compile"
46 # Load symbols at an offset 0xffff0000 using add-symbol-file
48 gdb_test "add-symbol-file $binfile 0xffff0000" \
49 "Reading symbols from .*" \
51 "add symbol table from file \".*\" at.*\\(y or n\\) " "y"
53 # Check if we are able to read offset adjusted line information of main
55 gdb_test "info line main" \
56 "Line.*starts at address 0xffff0000.*and ends at.*"