diff options
author | Ian Lance Taylor <ian@airs.com> | 2008-04-19 18:30:58 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2008-04-19 18:30:58 +0000 |
commit | d491d34e930046f820def9d3d67a2491df8a2198 (patch) | |
tree | 7e955be0ab4ec83f4711c309a6dcf130f341da99 /gold/testsuite | |
parent | 8e91f0232ca9c286299092c896288b8657c9311b (diff) | |
download | gdb-d491d34e930046f820def9d3d67a2491df8a2198.zip gdb-d491d34e930046f820def9d3d67a2491df8a2198.tar.gz gdb-d491d34e930046f820def9d3d67a2491df8a2198.tar.bz2 |
* object.cc (Xindex::initialize_symtab_xindex): New function.
(Xindex::read_symtab_xindex): New function.
(Xindex::sym_xindex_to_shndx): New function.
(Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
available.
(Sized_relobj::do_initialize_xindex): New function.
(Sized_relobj::do_read_symbols): Adjust section links.
(Sized_relobj::symbol_section_and_value): Add is_ordinary
parameter. Change all callers.
(Sized_relobj::include_section_group): Adjust section links and
symbol section indexes.
(Sized_relobj::do_layout): Adjust section links.
(Sized_relobj::do_count_local_symbols): Adjust section links and
symbol section indexes.
(Sized_relobj::do_finalize_local_symbols): Distinguish between
ordinary and special symbols.
(Sized_relobj::write_local_symbols): Add symtab_xindex and
dynsym_xindex parameters. Change all callers. Adjust section
links. Use SHN_XINDEX when needed.
(Sized_relobj::get_symbol_location_info): Adjust section links.
Don't get fooled by special symbols.
* object.h (class Xindex): Define.
(class Object): Add xindex_ parameter. Declare virtual functoin
do_initialize_xindex.
(Object::adjust_sym_shndx): New function.
(Object::set_xindex): New protected function.
(class Symbol_value): Add is_ordinary_shndx_ field.
(Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
(Symbol_value::value): Assert ordinary section.
(Symbol_value::initialize_input_to_output_map): Likewise.
(Symbol_value::set_input_shndx): Add is_ordinary parameter.
Change all callers.
(Symbol_value::input_shndx): Add is_ordinary parameter. Change
all callers.
(class Sized_relobj): Update declarations.
(Sized_relobj::local_symbol_input_shndx): Add is_ordinary
parameter. Change all callers.
(Sized_relobj::adjust_shndx): New function.
* dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
field.
(Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
(Sized_dynobj::read_dynsym_section): Adjust section links.
(Sized_dynobj::read_dynamic): Likewise.
(Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
section links.
(Sized_dynobj::do_initialize_xindex): New function.
* dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
do_initialize_xindex.
(Sized_dynobj::adjust_shndx): New function.
* layout.cc (Layout::Layout): Initialize symtab_xindex_ and
dynsym_xindex_ fields.
(Layout::finalize): Add a call to set_section_indexes before
creating the symtab sections.
(Layout::set_section_indexes): Don't do anything if the section
already has a section index.
(Layout::create_symtab_sections): Add shnum parameter. Change
caller. Create .symtab_shndx section if needed.
(Layout::create_shdrs): Add shstrtab_section parameter. Change
caller.
(Layout::allocated_output_section_count): New function.
(Layout::create_dynamic_symtab): Create .dynsym_shndx section if
needed.
* layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
fields. Update declarations.
(Layout::symtab_xindex): New function.
(Layout::dynsym_xindex): New function.
(class Write_symbols_task): Add layout_ field.
(Write_symbols_task::Write_symbols_task): Add layout parameter.
Change caller.
* output.cc (Output_section_headers::Output_section_headers): Add
shstrtab_section parameter. Change all callers.
(Output_section_headers::do_sized_write): Store overflow values
for section count and section string table section index in
section header zero.
(Output_file_header::do_sized_write): Check for overflow of
section count and section string table section index.
(Output_symtab_xindex::do_write): New function.
(Output_symtab_xindex::endian_do_write): New function.
* output.h (class Output_section_headers): Add shstrtab_section_.
Update declarations.
(class Output_symtab_xindex): Define.
(Output_section::has_out_shndx): New function.
* symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
field.
(Symbol::init_base): Add st_shndx and is_ordinary parameters.
Change all callers.
(Sized_symbol::init): Likewise.
(Symbol::output_section): Check for ordinary symbol.
(Symbol_table::add_from_object): Remove orig_sym parameter. Add
st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
callers.
(Symbol_table::add_from_relobj): Add symndx_offset parameter.
Change all callers. Simplify handling of symbols from sections
not included in the link.
(Symbol_table::add_from_dynobj): Handle ordinary symbol
distinction.
(Weak_alias_sorter::operator()): Assert that symbols are
ordinary.
(Symbol_table::sized_finalize_symbol): Handle ordinary symbol
distinction.
(Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
parameters. Change all callers.
(Symbol_table::sized_write_globals): Likewise. Handle ordinary
symbol distinction. Use SHN_XINDEX when needed.
(Symbol_table::write_section_symbol): Add symtab_xindex
parameter. Change all callers.
(Symbol_table::sized_write_section_symbol): Likewise. Use
SHN_XINDEX when needed.
* symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
declarations.
(Symbol::shndx): Add is_ordinary parameter. Change all callers.
(Symbol::is_defined): Check is_ordinary.
(Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
(Symbol::is_absolute, Symbol::is_common): Likewise.
(class Sized_symbol): Update declarations.
(class Symbol_table): Update declarations.
* resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
parameters. Change all callers.
(Sized_symbol::override): Likewise.
(Symbol_table::override): Likewise.
(symbol_to_bits): Add is_ordinary parameter. Change all callers.
(Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
is_ordinary, and orig_st_shndx parameters. Change all callers.
* copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
to be in an ordinary section.
* dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
object and is_ordinary parameters. Change all callers.
(Sized_dwarf_line_info::read_relocs): Add object parameter.
Change all callers. Don't add undefined or non-ordinary symbols
to reloc_map_.
(Sized_dwarf_line_info::read_line_mappings): Add object parameter.
Change all callers.
* dwarf_reader.h (class Sized_dwarf_line_info): Update
declarations.
* ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
* reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
(Sized_relobj::relocate_sections): Likewise.
* target-reloc.h (scan_relocs): Adjust section symbol index.
(scan_relocatable_relocs): Likewise.
* i386.cc (Scan::local): Check for ordinary symbols.
* sparc.cc (Scan::local): Likewise.
* x86_64.cc (Scan::local): Likewise.
* testsuite/binary_unittest.cc (Sized_binary_test): Update calls
to symbol_section_and_value.
* testsuite/many_sections_test.cc: New file.
* testsuite/Makefile.am (BUILT_SOURCES): Define.
(check_PROGRAMS): Add many_sections_test.
(many_sections_test_SOURCES): Define.
(many_sections_test_DEPENDENCIES): Define.
(many_sections_test_LDFLAGS): Define.
(BUILT_SOURCES): Add many_sections_define.h.
(many_sections_define.h): New target.
(BUILT_SOURCES): Add many_sections_check.h.
(many_sections_check.h): New target.
(check_PROGRAMS): Add many_sections_r_test.
(many_sections_r_test_SOURCES): Define.
(many_sections_r_test_DEPENDENCIES): Define.
(many_sections_r_test_LDFLAGS): Define.
(many_sections_r_test_LDADD): Define.
(many_sections_r_test.o): New target.
* testsuite/Makefile.in: Rebuild.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 28 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 91 | ||||
-rw-r--r-- | gold/testsuite/binary_unittest.cc | 14 | ||||
-rw-r--r-- | gold/testsuite/many_sections_test.cc | 37 |
4 files changed, 148 insertions, 22 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index fc4e78b..c538aca 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -43,6 +43,8 @@ MOSTLYCLEANFILES = *.so check_SCRIPTS = check_DATA = check_PROGRAMS = +BUILT_SOURCES = + TESTS = $(check_SCRIPTS) $(check_PROGRAMS) # --------------------------------------------------------------------- @@ -548,6 +550,32 @@ endif FN_PTRS_IN_SO_WITHOUT_PIC endif TLS +check_PROGRAMS += many_sections_test +many_sections_test_SOURCES = many_sections_test.cc +many_sections_test_DEPENDENCIES = gcctestdir/ld +many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic + +BUILT_SOURCES += many_sections_define.h +many_sections_define.h: + (for i in `seq 1 70000`; do \ + echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \ + done) > $@.tmp + mv -f $@.tmp $@ + +BUILT_SOURCES += many_sections_check.h +many_sections_check.h: + (for i in `seq 1 70000`; do \ + echo "assert(var_$$i == $$i);"; \ + done) > $@.tmp + mv -f $@.tmp $@ + +check_PROGRAMS += many_sections_r_test +many_sections_r_test_SOURCES = +many_sections_r_test_DEPENDENCIES = gcctestdir/ld many_sections_r_test.o +many_sections_r_test_LDFLAGS = -Bgcctestdir/ +many_sections_r_test_LDADD = many_sections_r_test.o +many_sections_r_test.o: many_sections_test.o gcctestdir/ld + gcctestdir/ld -r -o $@ many_sections_test.o if CONSTRUCTOR_PRIORITY diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 8896a3f..c47de28 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -47,7 +47,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \ $(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \ $(am__EXEEXT_10) $(am__EXEEXT_11) $(am__EXEEXT_12) \ - $(am__EXEEXT_13) $(am__EXEEXT_14) + $(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_15) @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_1 = basic_test \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_static_test basic_pic_test \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_static_pic_test \ @@ -155,7 +155,18 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am__append_9 = tls_static_test \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@ tls_static_pic_test @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_10 = tls_shared_nonpic_test -@CONSTRUCTOR_PRIORITY_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_11 = initpri1 +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_11 = many_sections_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_r_test +@GCC_FALSE@many_sections_test_DEPENDENCIES = libgoldtest.a \ +@GCC_FALSE@ ../libgold.a ../../libiberty/libiberty.a \ +@GCC_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +@NATIVE_LINKER_FALSE@many_sections_test_DEPENDENCIES = libgoldtest.a \ +@NATIVE_LINKER_FALSE@ ../libgold.a ../../libiberty/libiberty.a \ +@NATIVE_LINKER_FALSE@ $(am__DEPENDENCIES_1) \ +@NATIVE_LINKER_FALSE@ $(am__DEPENDENCIES_1) +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_12 = many_sections_define.h \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_check.h +@CONSTRUCTOR_PRIORITY_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_13 = initpri1 @CONSTRUCTOR_PRIORITY_FALSE@initpri1_DEPENDENCIES = libgoldtest.a \ @CONSTRUCTOR_PRIORITY_FALSE@ ../libgold.a \ @CONSTRUCTOR_PRIORITY_FALSE@ ../../libiberty/libiberty.a \ @@ -172,7 +183,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ # Test --detect-odr-violations # Similar to --detect-odr-violations: check for undefined symbols in .so's -@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_12 = debug_msg.sh \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_14 = debug_msg.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.sh ver_test_2.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.sh ver_test_5.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.sh \ @@ -186,7 +197,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ # We also want to make sure we do something reasonable when there's no # debug info available. For the best test, we use .so's. -@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_13 = debug_msg.err \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_15 = 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 ver_test_2.syms \ @@ -195,7 +206,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@am__append_14 = debug_msg.err \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_16 = 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 \ @@ -204,17 +215,17 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @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_15 = flagstest_o_specialfile +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_17 = flagstest_o_specialfile # Test --compress-debug-sections. FIXME: check we actually compress. # The specialfile output has a tricky case when we also compress debug # sections, because it requires output-file resizing. -@GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@am__append_16 = flagstest_compress_debug_sections \ +@GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@am__append_18 = flagstest_compress_debug_sections \ @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile_and_compress_debug_sections # Test symbol versioning. -@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_17 = ver_test ver_test_2 \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_19 = ver_test ver_test_2 \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_6 script_test_1 \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2 justsyms \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ binary_test script_test_3 @@ -318,11 +329,14 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) @GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am__EXEEXT_9 = tls_static_test$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@ tls_static_pic_test$(EXEEXT) @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__EXEEXT_10 = tls_shared_nonpic_test$(EXEEXT) -@CONSTRUCTOR_PRIORITY_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_11 = initpri1$(EXEEXT) -@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_12 = flagstest_o_specialfile$(EXEEXT) -@GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_13 = flagstest_compress_debug_sections$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_11 = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_r_test$(EXEEXT) +@CONSTRUCTOR_PRIORITY_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_12 = initpri1$(EXEEXT) +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_13 = flagstest_o_specialfile$(EXEEXT) +@GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_14 = flagstest_compress_debug_sections$(EXEEXT) \ @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile_and_compress_debug_sections$(EXEEXT) -@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_14 = ver_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_15 = ver_test$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_2$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_6$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_1$(EXEEXT) \ @@ -464,6 +478,13 @@ am__justsyms_SOURCES_DIST = justsyms_1.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms_1.$(OBJEXT) justsyms_OBJECTS = $(am_justsyms_OBJECTS) justsyms_LDADD = $(LDADD) +am_many_sections_r_test_OBJECTS = +many_sections_r_test_OBJECTS = $(am_many_sections_r_test_OBJECTS) +am__many_sections_test_SOURCES_DIST = many_sections_test.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_many_sections_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_test.$(OBJEXT) +many_sections_test_OBJECTS = $(am_many_sections_test_OBJECTS) +many_sections_test_LDADD = $(LDADD) am_object_unittest_OBJECTS = object_unittest.$(OBJEXT) object_unittest_OBJECTS = $(am_object_unittest_OBJECTS) object_unittest_LDADD = $(LDADD) @@ -710,6 +731,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \ flagstest_compress_debug_sections.c flagstest_o_specialfile.c \ flagstest_o_specialfile_and_compress_debug_sections.c \ $(initpri1_SOURCES) $(justsyms_SOURCES) \ + $(many_sections_r_test_SOURCES) $(many_sections_test_SOURCES) \ $(object_unittest_SOURCES) $(script_test_1_SOURCES) \ $(script_test_2_SOURCES) script_test_3.c \ $(tls_pic_test_SOURCES) $(tls_shared_gd_to_ie_test_SOURCES) \ @@ -755,6 +777,8 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \ flagstest_compress_debug_sections.c flagstest_o_specialfile.c \ flagstest_o_specialfile_and_compress_debug_sections.c \ $(am__initpri1_SOURCES_DIST) $(am__justsyms_SOURCES_DIST) \ + $(many_sections_r_test_SOURCES) \ + $(am__many_sections_test_SOURCES_DIST) \ $(object_unittest_SOURCES) $(am__script_test_1_SOURCES_DIST) \ $(am__script_test_2_SOURCES_DIST) script_test_3.c \ $(am__tls_pic_test_SOURCES_DIST) \ @@ -956,13 +980,14 @@ TEST_STRIP = $(top_builddir)/../binutils/strip-new # .o's), but not all of them (such as .so's and .err files). We # improve on that here. automake-1.9 info docs say "mostlyclean" is # the right choice for files 'make' builds that people rebuild. -MOSTLYCLEANFILES = *.so $(am__append_14) +MOSTLYCLEANFILES = *.so $(am__append_16) # We will add to these later, for each individual test. Note # that we add each test under check_SCRIPTS or check_PROGRAMS; # the TESTS variable is automatically populated from these. -check_SCRIPTS = $(am__append_12) -check_DATA = $(am__append_13) +check_SCRIPTS = $(am__append_14) +check_DATA = $(am__append_15) +BUILT_SOURCES = $(am__append_12) TESTS = $(check_SCRIPTS) $(check_PROGRAMS) # --------------------------------------------------------------------- @@ -1216,6 +1241,13 @@ binary_unittest_SOURCES = binary_unittest.cc @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_test_SOURCES = many_sections_test.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_test_DEPENDENCIES = gcctestdir/ld +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_r_test_SOURCES = +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_r_test_DEPENDENCIES = gcctestdir/ld many_sections_r_test.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_r_test_LDFLAGS = -Bgcctestdir/ +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_r_test_LDADD = many_sections_r_test.o @CONSTRUCTOR_PRIORITY_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@initpri1_SOURCES = initpri1.c @CONSTRUCTOR_PRIORITY_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@initpri1_DEPENDENCIES = gcctestdir/ld @CONSTRUCTOR_PRIORITY_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@initpri1_LDFLAGS = -Bgcctestdir/ @@ -1243,7 +1275,8 @@ binary_unittest_SOURCES = binary_unittest.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@binary_test_SOURCES = binary_test.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@binary_test_DEPENDENCIES = gcctestdir/ld binary.txt @GCC_TRUE@@NATIVE_LINKER_TRUE@binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf -all: all-am +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .cc .o .obj @@ -1376,6 +1409,12 @@ initpri1$(EXEEXT): $(initpri1_OBJECTS) $(initpri1_DEPENDENCIES) justsyms$(EXEEXT): $(justsyms_OBJECTS) $(justsyms_DEPENDENCIES) @rm -f justsyms$(EXEEXT) $(CXXLINK) $(justsyms_LDFLAGS) $(justsyms_OBJECTS) $(justsyms_LDADD) $(LIBS) +many_sections_r_test$(EXEEXT): $(many_sections_r_test_OBJECTS) $(many_sections_r_test_DEPENDENCIES) + @rm -f many_sections_r_test$(EXEEXT) + $(LINK) $(many_sections_r_test_LDFLAGS) $(many_sections_r_test_OBJECTS) $(many_sections_r_test_LDADD) $(LIBS) +many_sections_test$(EXEEXT): $(many_sections_test_OBJECTS) $(many_sections_test_DEPENDENCIES) + @rm -f many_sections_test$(EXEEXT) + $(CXXLINK) $(many_sections_test_LDFLAGS) $(many_sections_test_OBJECTS) $(many_sections_test_LDADD) $(LIBS) object_unittest$(EXEEXT): $(object_unittest_OBJECTS) $(object_unittest_DEPENDENCIES) @rm -f object_unittest$(EXEEXT) $(CXXLINK) $(object_unittest_LDFLAGS) $(object_unittest_OBJECTS) $(object_unittest_LDADD) $(LIBS) @@ -1528,6 +1567,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flagstest_o_specialfile_and_compress_debug_sections.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initpri1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/justsyms_1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/many_sections_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_unittest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script_test_1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script_test_2.Po@am__quote@ @@ -1733,10 +1773,12 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) $(check_PROGRAMS) \ $(check_SCRIPTS) $(check_DATA) $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile installdirs: -install: install-am +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -1761,6 +1803,7 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-checkLIBRARIES clean-checkPROGRAMS clean-generic \ @@ -1965,6 +2008,18 @@ uninstall-am: uninstall-info-am @GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_DESCRIPTORS_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_define.h: +@GCC_TRUE@@NATIVE_LINKER_TRUE@ (for i in `seq 1 70000`; do \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ done) > $@.tmp +@GCC_TRUE@@NATIVE_LINKER_TRUE@ mv -f $@.tmp $@ +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_check.h: +@GCC_TRUE@@NATIVE_LINKER_TRUE@ (for i in `seq 1 70000`; do \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ echo "assert(var_$$i == $$i);"; \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ done) > $@.tmp +@GCC_TRUE@@NATIVE_LINKER_TRUE@ mv -f $@.tmp $@ +@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_r_test.o: many_sections_test.o gcctestdir/ld +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -r -o $@ many_sections_test.o @GCC_TRUE@@NATIVE_LINKER_TRUE@debug_msg.o: debug_msg.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@odr_violation1.o: odr_violation1.cc diff --git a/gold/testsuite/binary_unittest.cc b/gold/testsuite/binary_unittest.cc index 229be7e..44db01e 100644 --- a/gold/testsuite/binary_unittest.cc +++ b/gold/testsuite/binary_unittest.cc @@ -94,13 +94,19 @@ Sized_binary_test(Target* target) Sized_relobj<size, big_endian>* relobj = static_cast<Sized_relobj<size, big_endian>*>(object); typename Sized_relobj<size, big_endian>::Address value; - CHECK(relobj->symbol_section_and_value(0, &value) == 0); + bool is_ordinary; + CHECK(relobj->symbol_section_and_value(0, &value, &is_ordinary) == 0); + CHECK(is_ordinary); CHECK(value == 0); - CHECK(relobj->symbol_section_and_value(1, &value) == 1); + CHECK(relobj->symbol_section_and_value(1, &value, &is_ordinary) == 1); + CHECK(is_ordinary); CHECK(value == 0); - CHECK(relobj->symbol_section_and_value(2, &value) == 1); + CHECK(relobj->symbol_section_and_value(2, &value, &is_ordinary) == 1); + CHECK(is_ordinary); CHECK(static_cast<off_t>(value) == st.st_size); - CHECK(relobj->symbol_section_and_value(3, &value) == elfcpp::SHN_ABS); + CHECK(relobj->symbol_section_and_value(3, &value, &is_ordinary) + == elfcpp::SHN_ABS); + CHECK(!is_ordinary); CHECK(static_cast<off_t>(value) == st.st_size); object->unlock(task); diff --git a/gold/testsuite/many_sections_test.cc b/gold/testsuite/many_sections_test.cc new file mode 100644 index 0000000..dcb1cd2 --- /dev/null +++ b/gold/testsuite/many_sections_test.cc @@ -0,0 +1,37 @@ +// many_sections_test.cc -- test lots of sections 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. + +// This program tests having many sections. It uses a generated .h +// files to define 70,000 variables, each in a different section. It +// uses another generated .h file to verify that they all have the +// right value. + +#include <cassert> + +#include "many_sections_define.h" + +int +main(int, char**) +{ +#include "many_sections_check.h" + return 0; +} |