diff options
author | Ian Lance Taylor <ian@airs.com> | 2008-04-15 22:50:37 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2008-04-15 22:50:37 +0000 |
commit | e6188289b9a48047e47a8d47cd812bbcc75db554 (patch) | |
tree | bebebbfecdff778e8bfca117c30de83b32c86b14 /gold/testsuite | |
parent | 4f2a9edd9c29db95518668e73369d590ecf6984b (diff) | |
download | gdb-e6188289b9a48047e47a8d47cd812bbcc75db554.zip gdb-e6188289b9a48047e47a8d47cd812bbcc75db554.tar.gz gdb-e6188289b9a48047e47a8d47cd812bbcc75db554.tar.bz2 |
* script-sections.cc (Script_sections::create_segments): Use
header_size_adjustment even when there is enough room for the
headers.
* testsuite/script_test_4.sh: New file.
* testsuite/script_test_4.t: New file.
* testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
(check_DATA): Add script_test_4.stdout.
(MOSTLYCLEANFILES): Likewise.
(script_test_4): New target.
(script_test_4.stdout): New target.
* testsuite/Makefile.in: Rebuild.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 8 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 24 | ||||
-rwxr-xr-x | gold/testsuite/script_test_4.sh | 41 | ||||
-rw-r--r-- | gold/testsuite/script_test_4.t | 40 |
4 files changed, 108 insertions, 5 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 8859520..2f950cc 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -734,5 +734,13 @@ script_test_3: basic_test.o gcctestdir/ld script_test_3.t script_test_3.stdout: script_test_3 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout +check_SCRIPTS += script_test_4.sh +check_DATA += script_test_4.stdout +MOSTLYCLEANFILES += script_test_4.stdout +script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t + $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t +script_test_4.stdout: script_test_4 + $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout + endif GCC endif NATIVE_LINKER diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index b46861f..b4b5000 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -178,7 +178,8 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.sh ver_test_5.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_matching_test.sh \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.sh +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.sh \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_4.sh # Create the data files that debug_msg.sh analyzes. @@ -193,13 +194,15 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.syms ver_test_5.syms \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.syms \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_matching_test.stdout \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.stdout +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.stdout \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_4.stdout @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_12 = debug_msg.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_so.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_ndebug.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_matching_test.stdout \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.stdout +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.stdout \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_4.stdout # Test -o when emitting to a special file (such as something in /dev). @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_13 = flagstest_o_specialfile @@ -819,6 +822,7 @@ GCC_FALSE = @GCC_FALSE@ GCC_TRUE = @GCC_TRUE@ GENCAT = @GENCAT@ GMSGFMT = @GMSGFMT@ +GREP = @GREP@ HAVE_ZLIB_FALSE = @HAVE_ZLIB_FALSE@ HAVE_ZLIB_TRUE = @HAVE_ZLIB_TRUE@ INCINTL = @INCINTL@ @@ -875,10 +879,9 @@ WARN_CFLAGS = @WARN_CFLAGS@ WARN_CXXFLAGS = @WARN_CXXFLAGS@ XGETTEXT = @XGETTEXT@ YACC = @YACC@ +YFLAGS = @YFLAGS@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -895,23 +898,30 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ @@ -2030,6 +2040,10 @@ uninstall-am: uninstall-info-am @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t @GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_3.stdout: script_test_3 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout +@GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t +@GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_4.stdout: script_test_4 +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/gold/testsuite/script_test_4.sh b/gold/testsuite/script_test_4.sh new file mode 100755 index 0000000..e84c580 --- /dev/null +++ b/gold/testsuite/script_test_4.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# script_test_4.sh -- test load segment + +# Copyright 2008 Free Software Foundation, Inc. +# Written by Ian Lance Taylor <iant@google.com>. + +# This file is part of gold. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +# This file goes with script_test_4.t, which is a linker script which +# starts the program at an unaligned address. + +check() +{ + if ! grep -q "$2" "$1" + then + echo "Did not find expected segment in $1:" + echo " $2" + echo "" + echo "Actual output below:" + cat "$1" + exit 1 + fi +} + +check script_test_4.stdout "\\.interp[ ]*PROGBITS[ ]*10000400" diff --git a/gold/testsuite/script_test_4.t b/gold/testsuite/script_test_4.t new file mode 100644 index 0000000..47ae066 --- /dev/null +++ b/gold/testsuite/script_test_4.t @@ -0,0 +1,40 @@ +/* script_test_4.t -- linker script test 4 for gold + + Copyright 2008 Free Software Foundation, Inc. + Written by Ian Lance Taylor <iant@google.com>. + + This file is part of gold. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* We won't try to run this program, just ensure that it links + as expected. */ + +SECTIONS +{ + . = 0x10000400; + + /* With luck this will be enough to get the program working. */ + .interp : { *(.interp) } + .text : { *(.text) } + . += 0x100000; + . = ALIGN(0x100); + .dynamic : { *(.dynamic) } + .data : { *(.data) } + . += 0x100000; + . = ALIGN(0x100); + .bss : { *(.bss) } +} |