# Test basic linker script functionality
# By Ian Lance Taylor, Cygnus Support
-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
global nm_output
if ![ld_nm $nm "" tmpdir/script] {
- unresolved $testname
+ fail $testname
return
}
}
if {[info exists nm_output(tred)] \
- && $nm_output(tred) != (0x100 + 0x8000)} {
+ && $nm_output(tred) != (0x100 + 0x4000)} {
send_log "tred == $nm_output(tred)\n"
verbose "tred == $nm_output(tred)"
set passes 0
}
if {[info exists nm_output(fred)] \
- && $nm_output(fred) != (0x1000 + 0x10000)} {
+ && $nm_output(fred) != (0x1000 + 0x1000)} {
send_log "fred == $nm_output(fred)\n"
verbose "fred == $nm_output(fred)"
set passes 0
}
# PE targets need to set the image base to 0 to avoid complications from nm.
-set flags ""
-if {[istarget "*-*-pe*"] \
- || [istarget "*-*-cygwin*"] \
- || [istarget "*-*-mingw*"] \
- || [istarget "*-*-winnt*"] \
- || [istarget "*-*-nt"] \
- || [istarget "*-*-interix*"] } then {
- set flags "--image-base 0"
+set old_LDFLAGS $LDFLAGS
+if { [is_pecoff_format] } then {
+ append LDFLAGS " --image-base 0"
+} elseif { [is_xcoff_format] } then {
+ append LDFLAGS " -bnogc"
}
+set flags $LDFLAGS
if ![ld_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
fail $testname
}
set testname "MEMORY with symbols"
-if ![ld_link $ld tmpdir/script "$flags -defsym DATA_ORIGIN=0x1000 -defsym DATA_LENGTH=0x10000 -T $srcdir/$subdir/memory_sym.t tmpdir/script.o"] {
+if ![ld_link $ld tmpdir/script "$flags -defsym DATA_ORIGIN=0x1000 -defsym DATA_LENGTH=0x1000 -T $srcdir/$subdir/memory_sym.t tmpdir/script.o"] {
fail $testname
untested "extract symbols"
} else {
run_dump_test "align-with-input"
run_dump_test "pr20302"
+
+run_dump_test "segment-start" {{name (default)}}
+run_dump_test "segment-start" {{name (overridden)} \
+ {ld -Ttext-segment=0x10000000}}
+
+set LDFLAGS $old_LDFLAGS