diff options
author | Cary Coutant <ccoutant@google.com> | 2009-02-25 19:05:21 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2009-02-25 19:05:21 +0000 |
commit | 401a9a73922f3b3ad7099859b7d3bc3c80397f3a (patch) | |
tree | 6a74503c6b496930ef074603db18cb9c9b5dbbd2 /gold/testsuite | |
parent | 784788d2f758e76488ce5c12242fb97907d27b53 (diff) | |
download | gdb-401a9a73922f3b3ad7099859b7d3bc3c80397f3a.zip gdb-401a9a73922f3b3ad7099859b7d3bc3c80397f3a.tar.gz gdb-401a9a73922f3b3ad7099859b7d3bc3c80397f3a.tar.bz2 |
* layout.cc (Layout::choose_output_section): Don't rename sections
when using a linker script that has a SECTIONS clause.
* Makefile.in: Regenerate.
* testsuite/Makefile.am (script_test_5.sh): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/script_test_5.cc: New file.
* testsuite/script_test_5.sh: New file.
* testsuite/script_test_5.t: New file.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 8 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 9 | ||||
-rw-r--r-- | gold/testsuite/script_test_5.cc | 45 | ||||
-rwxr-xr-x | gold/testsuite/script_test_5.sh | 43 | ||||
-rw-r--r-- | gold/testsuite/script_test_5.t | 40 |
5 files changed, 144 insertions, 1 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index c318718..46c661f 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -903,6 +903,14 @@ script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t script_test_4.stdout: script_test_4 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout +check_SCRIPTS += script_test_5.sh +check_DATA += script_test_5.stdout +MOSTLYCLEANFILES += script_test_5.stdout +script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t + $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t +script_test_5.stdout: script_test_5 + $(TEST_READELF) -SW script_test_5 > script_test_5.stdout + # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new, # and --dynamic-list-cpp-typeinfo diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index c1ad9c3..6703f6f 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -171,7 +171,8 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.sh ver_test_10.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_4.sh dynamic_list.sh +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_4.sh \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_5.sh dynamic_list.sh # Create the data files that debug_msg.sh analyzes. @@ -188,6 +189,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @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_4.stdout \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_5.stdout \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ dynamic_list.stdout @GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_8 = tls_test \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_pic_test \ @@ -234,6 +236,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @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_4.stdout \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_5.stdout \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ dynamic_list.stdout # Test -o when emitting to a special file (such as something in /dev). @@ -2467,6 +2470,10 @@ uninstall-am: uninstall-info-am @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 +@GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t +@GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_5.stdout: script_test_5 +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SW script_test_5 > script_test_5.stdout @GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ basic_test.o \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ -Wl,--dynamic-list $(srcdir)/dynamic_list.t \ diff --git a/gold/testsuite/script_test_5.cc b/gold/testsuite/script_test_5.cc new file mode 100644 index 0000000..b5aec29 --- /dev/null +++ b/gold/testsuite/script_test_5.cc @@ -0,0 +1,45 @@ +// script_test_5.cc -- a test case for gold + +// Copyright 2009 Free Software Foundation, Inc. +// Written by Cary Coutant <ccoutant@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 program checks that the default renaming of ".text.xxx" +// sections does not take place in the presence of a linker script +// with a SECTIONS clause. + +bool +t1() __attribute__ ((section (".text.foo"))); + +bool +t1() +{ + return 1; +} + +// Main function. Initialize variables and call test functions. + +int +main() +{ + if (t1()) + return 0; + else + return 1; +} diff --git a/gold/testsuite/script_test_5.sh b/gold/testsuite/script_test_5.sh new file mode 100755 index 0000000..9415483 --- /dev/null +++ b/gold/testsuite/script_test_5.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# script_test_5.sh -- test linker script with uncovered sections + +# Copyright 2009 Free Software Foundation, Inc. +# Written by Cary Coutant <ccoutant@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_5.t, which is a linker script with +# a SECTIONS clause that does not explicitly mention one of the input +# sections in the test object file. We check to make sure that the +# correct output section is generated. + +check_count() +{ + if test "`grep -c "$2" "$1"`" != "$3" + then + echo "Did not find expected number ($3) of '$2' sections in $1" + echo "" + echo "Actual output below:" + cat "$1" + exit 1 + fi +} + +check_count script_test_5.stdout ".text " 1 +check_count script_test_5.stdout ".text.foo " 1 diff --git a/gold/testsuite/script_test_5.t b/gold/testsuite/script_test_5.t new file mode 100644 index 0000000..b5e83aa --- /dev/null +++ b/gold/testsuite/script_test_5.t @@ -0,0 +1,40 @@ +/* script_test_5.t -- linker script test 5 for gold + + Copyright 2009 Free Software Foundation, Inc. + Written by Cary Coutant <ccoutant@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 +{ + . = 0x10000000; + + /* 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) } +} |