diff options
author | Ian Lance Taylor <iant@google.com> | 2007-09-26 05:44:38 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-09-26 05:44:38 +0000 |
commit | 3151305a47fc17a35bc76cc50578b3e8f9b93d9d (patch) | |
tree | 7579f01394de3af6a03a35d162ae8c59fefaf9a8 | |
parent | 4dffcebc10670489b064181a62e9588e72fb566a (diff) | |
download | gdb-3151305a47fc17a35bc76cc50578b3e8f9b93d9d.zip gdb-3151305a47fc17a35bc76cc50578b3e8f9b93d9d.tar.gz gdb-3151305a47fc17a35bc76cc50578b3e8f9b93d9d.tar.bz2 |
Add basic exception frame header, plus test.
-rw-r--r-- | gold/Makefile.am | 2 | ||||
-rw-r--r-- | gold/Makefile.in | 17 | ||||
-rw-r--r-- | gold/ehframe.cc | 126 | ||||
-rw-r--r-- | gold/ehframe.h | 64 | ||||
-rw-r--r-- | gold/layout.cc | 55 | ||||
-rw-r--r-- | gold/layout.h | 9 | ||||
-rw-r--r-- | gold/po/POTFILES.in | 2 | ||||
-rw-r--r-- | gold/po/gold.pot | 184 | ||||
-rw-r--r-- | gold/testsuite/Makefile.am | 65 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 168 | ||||
-rw-r--r-- | gold/testsuite/exception_test.h | 27 | ||||
-rw-r--r-- | gold/testsuite/exception_test_1.cc | 52 | ||||
-rw-r--r-- | gold/testsuite/exception_test_2.cc | 31 | ||||
-rw-r--r-- | gold/testsuite/exception_test_main.cc | 35 |
14 files changed, 737 insertions, 100 deletions
diff --git a/gold/Makefile.am b/gold/Makefile.am index 1710aa6..d69076a 100644 --- a/gold/Makefile.am +++ b/gold/Makefile.am @@ -26,6 +26,7 @@ CCFILES = \ defstd.cc \ dirsearch.cc \ dynobj.cc \ + ehframe.cc \ fileread.cc \ gold.cc \ gold-threads.cc \ @@ -50,6 +51,7 @@ HFILES = \ defstd.h \ dirsearch.h \ dynobj.h \ + ehframe.h \ fileread.h \ gold.h \ gold-threads.h \ diff --git a/gold/Makefile.in b/gold/Makefile.in index 2780238..3213572 100644 --- a/gold/Makefile.in +++ b/gold/Makefile.in @@ -71,13 +71,13 @@ ARFLAGS = cru libgold_a_AR = $(AR) $(ARFLAGS) libgold_a_LIBADD = am__objects_1 = archive.$(OBJEXT) common.$(OBJEXT) defstd.$(OBJEXT) \ - dirsearch.$(OBJEXT) dynobj.$(OBJEXT) fileread.$(OBJEXT) \ - gold.$(OBJEXT) gold-threads.$(OBJEXT) layout.$(OBJEXT) \ - merge.$(OBJEXT) object.$(OBJEXT) options.$(OBJEXT) \ - output.$(OBJEXT) parameters.$(OBJEXT) readsyms.$(OBJEXT) \ - reloc.$(OBJEXT) resolve.$(OBJEXT) script.$(OBJEXT) \ - symtab.$(OBJEXT) stringpool.$(OBJEXT) target-select.$(OBJEXT) \ - workqueue.$(OBJEXT) + dirsearch.$(OBJEXT) dynobj.$(OBJEXT) ehframe.$(OBJEXT) \ + fileread.$(OBJEXT) gold.$(OBJEXT) gold-threads.$(OBJEXT) \ + layout.$(OBJEXT) merge.$(OBJEXT) object.$(OBJEXT) \ + options.$(OBJEXT) output.$(OBJEXT) parameters.$(OBJEXT) \ + readsyms.$(OBJEXT) reloc.$(OBJEXT) resolve.$(OBJEXT) \ + script.$(OBJEXT) symtab.$(OBJEXT) stringpool.$(OBJEXT) \ + target-select.$(OBJEXT) workqueue.$(OBJEXT) am__objects_2 = am__objects_3 = yyscript.$(OBJEXT) am_libgold_a_OBJECTS = $(am__objects_1) $(am__objects_2) \ @@ -271,6 +271,7 @@ CCFILES = \ defstd.cc \ dirsearch.cc \ dynobj.cc \ + ehframe.cc \ fileread.cc \ gold.cc \ gold-threads.cc \ @@ -295,6 +296,7 @@ HFILES = \ defstd.h \ dirsearch.h \ dynobj.h \ + ehframe.h \ fileread.h \ gold.h \ gold-threads.h \ @@ -437,6 +439,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defstd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirsearch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynobj.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ehframe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gold-threads.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gold.Po@am__quote@ diff --git a/gold/ehframe.cc b/gold/ehframe.cc new file mode 100644 index 0000000..1e0583a --- /dev/null +++ b/gold/ehframe.cc @@ -0,0 +1,126 @@ +// ehframe.cc -- handle exception frame sections for gold + +// Copyright 2006, 2007 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. + +#include "gold.h" + +#include "elfcpp.h" +#include "dwarf.h" +#include "ehframe.h" + +namespace gold +{ + +// This file handles generation of the exception frame header that +// gcc's runtime support libraries use to find unwind information at +// runtime. + +// The exception frame header starts with four bytes: + +// 0: The version number, currently 1. + +// 1: The encoding of the pointer to the exception frames. This can +// be any DWARF unwind encoding (DW_EH_PE_*). It is normally a 4 +// byte PC relative offset (DW_EH_PE_pcrel | DW_EH_PE_sdata4). + +// 2: The encoding of the count of the number of FDE pointers in the +// lookup table. This can be any DWARF unwind encoding, and in +// particular can be DW_EH_PE_omit if the count is omitted. It is +// normally a 4 byte unsigned count (DW_EH_PE_udata4). + +// 3: The encoding of the lookup table entries. Currently gcc's +// libraries will only support DW_EH_PE_datarel | DW_EH_PE_sdata4, +// which means that the values are 4 byte offsets from the start of +// the table. + +// The exception frame header is followed by a pointer to the contents +// of the exception frame section (.eh_frame). This pointer is +// encoded as specified in the byte at offset 1 of the header (i.e., +// it is normally a 4 byte PC relative offset). + +// If there is a lookup table, this is followed by the count of the +// number of FDE pointers, encoded as specified in the byte at offset +// 2 of the header (i.e., normally a 4 byte unsigned integer). + +// This is followed by the table, which should start at an 4-byte +// aligned address in memory. Each entry in the table is 8 bytes. +// Each entry represents an FDE. The first four bytes of each entry +// are an offset to the starting PC for the FDE. The last four bytes +// of each entry are an offset to the FDE data. The offsets are from +// the start of the exception frame header information. The entries +// are in sorted order by starting PC. + +// FIXME: We currently always generate an empty exception frame +// header. + +const int eh_frame_hdr_size = 4; + +// Construct the exception frame header. + +Eh_frame_hdr::Eh_frame_hdr(const Target* target, + Output_section* eh_frame_section) + : Output_section_data(4), + target_(target), eh_frame_section_(eh_frame_section) +{ +} + +// Set the final address and size of the exception frame header. + +void +Eh_frame_hdr::do_set_address(uint64_t, off_t) +{ + this->set_data_size(eh_frame_hdr_size + 4); +} + +// Write the data to the flie. + +void +Eh_frame_hdr::do_write(Output_file* of) +{ + const off_t off = this->offset(); + const off_t oview_size = this->data_size(); + unsigned char* const oview = of->get_output_view(off, oview_size); + + // Version number. + oview[0] = 1; + + // Write out a 4 byte PC relative offset to the address of the + // .eh_frame section. + oview[1] = elfcpp::DW_EH_PE_pcrel | elfcpp::DW_EH_PE_sdata4; + uint64_t eh_frame_address = this->eh_frame_section_->address(); + uint64_t eh_frame_hdr_address = this->address(); + uint64_t eh_frame_offset = (eh_frame_address - + (eh_frame_hdr_address + 4)); + if (this->target_->is_big_endian()) + elfcpp::Swap<32, true>::writeval(oview + 4, eh_frame_offset); + else + elfcpp::Swap<32, false>::writeval(oview + 4, eh_frame_offset); + + // We don't currently write out the sorted table. + oview[2] = elfcpp::DW_EH_PE_omit; + oview[3] = elfcpp::DW_EH_PE_omit; + + gold_assert(oview_size == 8); + + of->write_output_view(off, oview_size, oview); +} + +} // End namespace gold. diff --git a/gold/ehframe.h b/gold/ehframe.h new file mode 100644 index 0000000..1f6c022 --- /dev/null +++ b/gold/ehframe.h @@ -0,0 +1,64 @@ +// ehframe.h -- handle exception frame sections for gold -*- C++ -*- + +// Copyright 2006, 2007 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. + +#ifndef GOLD_EHFRAME_H +#define GOLD_EHFRAME_H + +#include "output.h" + +namespace gold +{ + +// This class manages the .eh_frame_hdr section, which holds the data +// for the PT_GNU_EH_FRAME segment. gcc's unwind support code uses +// the PT_GNU_EH_FRAME segment to find the list of FDEs. This saves +// the time required to register the exception handlers at startup +// time and when a shared object is loaded, and the time required to +// deregister the exception handlers when a shared object is unloaded. + +// FIXME: gcc supports using storing a sorted lookup table for the +// FDEs in the PT_GNU_EH_FRAME segment, but we do not yet generate +// that. + +class Eh_frame_hdr : public Output_section_data +{ + public: + Eh_frame_hdr(const Target*, Output_section* eh_frame_section); + + // Set the final data size. + void + do_set_address(uint64_t address, off_t offset); + + // Write the data to the file. + void + do_write(Output_file*); + + private: + // The output target. + const Target* target_; + // The .eh_frame section. + Output_section* eh_frame_section_; +}; + +} // End namespace gold. + +#endif // !defined(GOLD_EHFRAME_H) diff --git a/gold/layout.cc b/gold/layout.cc index d45970d..a05ebf1 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -31,6 +31,7 @@ #include "output.h" #include "symtab.h" #include "dynobj.h" +#include "ehframe.h" #include "layout.h" namespace gold @@ -65,7 +66,8 @@ Layout::Layout(const General_options& options) section_name_map_(), segment_list_(), section_list_(), unattached_section_list_(), special_output_list_(), tls_segment_(NULL), symtab_section_(NULL), - dynsym_section_(NULL), dynamic_section_(NULL), dynamic_data_(NULL) + dynsym_section_(NULL), dynamic_section_(NULL), dynamic_data_(NULL), + eh_frame_section_(NULL) { // Make space for more than enough segments for a typical file. // This is just for efficiency--it's OK if we wind up needing more. @@ -206,6 +208,17 @@ Layout::layout(Relobj* object, unsigned int shndx, const char* name, shdr.get_sh_type(), shdr.get_sh_flags()); + // Special GNU handling of sections named .eh_frame. + if (!parameters->output_is_object() + && strcmp(name, ".eh_frame") == 0 + && shdr.get_sh_size() > 0 + && shdr.get_sh_type() == elfcpp::SHT_PROGBITS + && shdr.get_sh_flags() == elfcpp::SHF_ALLOC) + { + this->layout_eh_frame(object, shndx, name, shdr, os, off); + return os; + } + // FIXME: Handle SHF_LINK_ORDER somewhere. *off = os->add_input_section(object, shndx, name, shdr); @@ -213,6 +226,46 @@ Layout::layout(Relobj* object, unsigned int shndx, const char* name, return os; } +// Special GNU handling of sections named .eh_frame. They will +// normally hold exception frame data. + +template<int size, bool big_endian> +void +Layout::layout_eh_frame(Relobj* object, + unsigned int shndx, + const char* name, + const elfcpp::Shdr<size, big_endian>& shdr, + Output_section* os, off_t* off) +{ + if (this->eh_frame_section_ == NULL) + { + this->eh_frame_section_ = os; + + if (this->options_.create_eh_frame_hdr()) + { + Stringpool::Key hdr_name_key; + const char* hdr_name = this->namepool_.add(".eh_frame_hdr", + &hdr_name_key); + Output_section* hdr_os = + this->get_output_section(hdr_name, hdr_name_key, + elfcpp::SHT_PROGBITS, + elfcpp::SHF_ALLOC); + + Eh_frame_hdr* hdr_posd = new Eh_frame_hdr(object->target(), os); + hdr_os->add_output_section_data(hdr_posd); + + Output_segment* hdr_oseg = + new Output_segment(elfcpp::PT_GNU_EH_FRAME, elfcpp::PF_R); + this->segment_list_.push_back(hdr_oseg); + hdr_oseg->add_output_section(hdr_os, elfcpp::PF_R); + } + } + + gold_assert(this->eh_frame_section_ == os); + + *off = os->add_input_section(object, shndx, name, shdr); +} + // Add POSD to an output section using NAME, TYPE, and FLAGS. void diff --git a/gold/layout.h b/gold/layout.h index 38a3ad8..609de50 100644 --- a/gold/layout.h +++ b/gold/layout.h @@ -206,6 +206,13 @@ class Layout static const Linkonce_mapping linkonce_mapping[]; static const int linkonce_mapping_count; + // Handle an exception frame section. + template<int size, bool big_endian> + void + layout_eh_frame(Relobj*, unsigned int, const char*, + const elfcpp::Shdr<size, big_endian>&, + Output_section*, off_t*); + // Find the first read-only PT_LOAD segment, creating one if // necessary. Output_segment* @@ -356,6 +363,8 @@ class Layout Output_section* dynamic_section_; // The dynamic data which goes into dynamic_section_. Output_data_dynamic* dynamic_data_; + // The exception frame section. + Output_section* eh_frame_section_; }; // This task handles writing out data which is not part of a section diff --git a/gold/po/POTFILES.in b/gold/po/POTFILES.in index 6dcc015..c41e617 100644 --- a/gold/po/POTFILES.in +++ b/gold/po/POTFILES.in @@ -8,6 +8,8 @@ dirsearch.cc dirsearch.h dynobj.cc dynobj.h +ehframe.cc +ehframe.h fileread.cc fileread.h gold.cc diff --git a/gold/po/gold.pot b/gold/po/gold.pot index 5196fdd..e2caf15 100644 --- a/gold/po/gold.pot +++ b/gold/po/gold.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-09-22 13:59-0700\n" +"POT-Creation-Date: 2007-09-25 22:42-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -21,42 +21,42 @@ msgstr "" msgid "%s: %s: no archive symbol table (run ranlib)\n" msgstr "" -#: archive.cc:141 +#: archive.cc:144 #, c-format msgid "%s: %s: bad archive symbol table names\n" msgstr "" -#: archive.cc:173 +#: archive.cc:176 #, c-format msgid "%s; %s: malformed archive header at %ld\n" msgstr "" -#: archive.cc:194 +#: archive.cc:197 #, c-format msgid "%s: %s: malformed archive header size at %ld\n" msgstr "" -#: archive.cc:206 +#: archive.cc:209 #, c-format msgid "%s: %s: malformed archive header name at %ld\n" msgstr "" -#: archive.cc:232 +#: archive.cc:235 #, c-format msgid "%s: %s: bad extended name index at %ld\n" msgstr "" -#: archive.cc:243 +#: archive.cc:246 #, c-format msgid "%s: %s: bad extended name entry at header %ld\n" msgstr "" -#: archive.cc:338 +#: archive.cc:341 #, c-format msgid "%s: %s: short archive header at %ld\n" msgstr "" -#: archive.cc:387 archive.cc:400 +#: archive.cc:396 archive.cc:411 #, c-format msgid "%s: %s: member at %ld is not an ELF object" msgstr "" @@ -76,132 +76,142 @@ msgstr "" msgid "%s: %s: unexpected link in section %u header: %u != %u\n" msgstr "" -#: dynobj.cc:209 +#: dynobj.cc:210 #, c-format msgid "%s: %s: DYNAMIC section %u link out of range: %u\n" msgstr "" -#: dynobj.cc:219 +#: dynobj.cc:220 #, c-format msgid "%s: %s: DYNAMIC section %u link %u is not a strtab\n" msgstr "" -#: dynobj.cc:241 +#: dynobj.cc:242 #, c-format msgid "%s: %s: DT_SONAME value out of range: %lld >= %lld\n" msgstr "" -#: dynobj.cc:258 +#: dynobj.cc:259 #, c-format msgid "%s: %s: missing DT_NULL in dynamic segment\n" msgstr "" -#: dynobj.cc:306 +#: dynobj.cc:307 #, c-format msgid "%s: %s: invalid dynamic symbol table name index: %u\n" msgstr "" -#: dynobj.cc:314 +#: dynobj.cc:315 #, c-format msgid "%s: %s: dynamic symbol table name section has wrong type: %u\n" msgstr "" -#: dynobj.cc:388 object.cc:439 +#: dynobj.cc:390 object.cc:440 #, c-format msgid "%s: %s: bad section name offset for section %u: %lu\n" msgstr "" -#: dynobj.cc:419 +#: dynobj.cc:421 #, c-format msgid "%s: %s: duplicate definition for version %u\n" msgstr "" -#: dynobj.cc:451 +#: dynobj.cc:453 #, c-format msgid "%s: %s: unexpected verdef version %u\n" msgstr "" -#: dynobj.cc:467 +#: dynobj.cc:469 #, c-format msgid "%s: %s: verdef vd_cnt field too small: %u\n" msgstr "" -#: dynobj.cc:476 +#: dynobj.cc:478 #, c-format msgid "%s: %s: verdef vd_aux field out of range: %u\n" msgstr "" -#: dynobj.cc:488 +#: dynobj.cc:490 #, c-format msgid "%s: %s: verdaux vda_name field out of range: %u\n" msgstr "" -#: dynobj.cc:499 +#: dynobj.cc:501 #, c-format msgid "%s: %s: verdef vd_next field out of range: %u\n" msgstr "" -#: dynobj.cc:533 +#: dynobj.cc:535 #, c-format msgid "%s: %s: unexpected verneed version %u\n" msgstr "" -#: dynobj.cc:544 +#: dynobj.cc:546 #, c-format msgid "%s: %s: verneed vn_aux field out of range: %u\n" msgstr "" -#: dynobj.cc:559 +#: dynobj.cc:561 #, c-format msgid "%s: %s: vernaux vna_name field out of range: %u\n" msgstr "" -#: dynobj.cc:572 +#: dynobj.cc:574 #, c-format msgid "%s: %s: verneed vna_next field out of range: %u\n" msgstr "" -#: dynobj.cc:585 +#: dynobj.cc:587 #, c-format msgid "%s: %s: verneed vn_next field out of range: %u\n" msgstr "" -#: dynobj.cc:633 +#: dynobj.cc:635 #, c-format msgid "%s: %s: size of dynamic symbols is not multiple of symbol size\n" msgstr "" -#: dynobj.cc:1264 +#: dynobj.cc:1266 #, c-format msgid "%s: symbol %s has undefined version %s\n" msgstr "" -#: fileread.cc:75 +#: fileread.cc:48 +#, c-format +msgid "%s: munmap failed: %s\n" +msgstr "" + +#: fileread.cc:83 #, c-format msgid "%s: warning: close(%s) failed: %s" msgstr "" -#: fileread.cc:163 +#: fileread.cc:108 #, c-format -msgid "%s: %s: lseek to %lld failed: %s" +msgid "%s: %s: fstat failed: %s" msgstr "" -#: fileread.cc:173 +#: fileread.cc:198 #, c-format -msgid "%s: %s: read failed: %s\n" +msgid "%s: %s: pread failed: %s\n" msgstr "" -#: fileread.cc:193 fileread.cc:276 +#: fileread.cc:205 #, c-format msgid "%s: %s: file too short: read only %lld of %lld bytes at %lld\n" msgstr "" -#: fileread.cc:385 +#: fileread.cc:283 +#, c-format +msgid "%s: %s: mmap offset %lld size %lld failed: %s\n" +msgstr "" + +#: fileread.cc:402 #, c-format msgid "%s: cannot find %s\n" msgstr "" -#: fileread.cc:393 +#: fileread.cc:410 #, c-format msgid "%s: cannot open %s: %s\n" msgstr "" @@ -255,68 +265,68 @@ msgid "pthread_cond_signal failed" msgstr "" #. FIXME: This needs to specify the location somehow. -#: i386.cc:125 +#: i386.cc:130 #, c-format msgid "%s: missing expected TLS relocation\n" msgstr "" -#: i386.cc:746 i386.cc:896 i386.cc:1158 +#: i386.cc:751 i386.cc:912 i386.cc:1174 #, c-format msgid "%s: %s: unexpected reloc %u in object file\n" msgstr "" -#: i386.cc:783 i386.cc:803 +#: i386.cc:788 i386.cc:808 #, c-format msgid "%s: %s: unsupported reloc %u against local symbol\n" msgstr "" -#: i386.cc:932 i386.cc:953 +#: i386.cc:948 i386.cc:969 #, c-format msgid "%s: %s: unsupported reloc %u against global symbol %s\n" msgstr "" -#: i386.cc:976 +#: i386.cc:992 #, c-format msgid "%s: %s: unsupported RELA reloc section\n" msgstr "" -#: i386.cc:1066 +#: i386.cc:1082 #, c-format msgid "%s: %s: missing expected TLS relocation\n" msgstr "" -#: i386.cc:1190 i386.cc:1267 i386.cc:1278 +#: i386.cc:1206 i386.cc:1283 i386.cc:1294 #, c-format msgid "%s: %s: unsupported reloc %u\n" msgstr "" -#: i386.cc:1217 +#: i386.cc:1233 #, c-format msgid "%s: %s: TLS reloc but no TLS segment\n" msgstr "" -#: i386.cc:1252 +#: i386.cc:1268 #, c-format msgid "%s: %s: unsupported reloc type %u\n" msgstr "" -#: i386.cc:1461 +#: i386.cc:1477 #, c-format msgid "%s: %s: TLS relocation out of range\n" msgstr "" -#: i386.cc:1479 +#: i386.cc:1495 #, c-format msgid "%s: %s: TLS relocation against invalid instruction\n" msgstr "" -#: merge.cc:246 +#: merge.cc:247 #, c-format msgid "" "%s: %s: mergeable string section length not multiple of character size\n" msgstr "" -#: merge.cc:263 +#: merge.cc:264 #, c-format msgid "%s: %s: entry in mergeable string section not null terminated\n" msgstr "" @@ -346,92 +356,92 @@ msgstr "" msgid "%s: %s: section group %u info %u out of range\n" msgstr "" -#: object.cc:329 +#: object.cc:330 #, c-format msgid "%s: %s: symbol %u name offset %u out of range\n" msgstr "" -#: object.cc:363 +#: object.cc:364 #, c-format msgid "%s: %s: section %u in section group %u out of range" msgstr "" -#: object.cc:507 +#: object.cc:508 #, c-format msgid "%s: %s: size of symbols is not multiple of symbol size\n" msgstr "" -#: object.cc:595 +#: object.cc:597 #, c-format msgid "%s: %s: unknown section index %u for local symbol %u\n" msgstr "" -#: object.cc:606 +#: object.cc:608 #, c-format msgid "%s: %s: local symbol %u section index %u out of range\n" msgstr "" -#: object.cc:640 +#: object.cc:642 #, c-format msgid "%s: %s: local symbol %u section name out of range: %u >= %u\n" msgstr "" -#: object.cc:854 +#: object.cc:857 #, c-format msgid "%s: %s: unsupported ELF file type %d\n" msgstr "" -#: object.cc:873 object.cc:926 object.cc:961 +#: object.cc:876 object.cc:929 object.cc:964 #, c-format msgid "%s: %s: ELF file too short\n" msgstr "" -#: object.cc:882 +#: object.cc:885 #, c-format msgid "%s: %s: invalid ELF version 0\n" msgstr "" -#: object.cc:885 +#: object.cc:888 #, c-format msgid "%s: %s: unsupported ELF version %d\n" msgstr "" -#: object.cc:893 +#: object.cc:896 #, c-format msgid "%s: %s: invalid ELF class 0\n" msgstr "" -#: object.cc:900 +#: object.cc:903 #, c-format msgid "%s: %s: unsupported ELF class %d\n" msgstr "" -#: object.cc:908 +#: object.cc:911 #, c-format msgid "%s: %s: invalid ELF data encoding\n" msgstr "" -#: object.cc:915 +#: object.cc:918 #, c-format msgid "%s: %s: unsupported ELF data encoding %d\n" msgstr "" -#: object.cc:938 +#: object.cc:941 #, c-format msgid "%s: %s: not configured to support 32-bit big-endian object\n" msgstr "" -#: object.cc:951 +#: object.cc:954 #, c-format msgid "%s: %s: not configured to support 32-bit little-endian object\n" msgstr "" -#: object.cc:973 +#: object.cc:976 #, c-format msgid "%s: %s: not configured to support 64-bit big-endian object\n" msgstr "" -#: object.cc:986 +#: object.cc:989 #, c-format msgid "%s: %s: not configured to support 64-bit little-endian object\n" msgstr "" @@ -577,7 +587,7 @@ msgstr "" msgid "%s: use the --help option for usage information\n" msgstr "" -#: options.cc:617 script.cc:1153 +#: options.cc:617 script.cc:1158 #, c-format msgid "%s: %s: %s\n" msgstr "" @@ -587,73 +597,73 @@ msgstr "" msgid "%s: -%c: %s\n" msgstr "" -#: output.cc:921 +#: output.cc:922 #, c-format msgid "%s: %s: invalid alignment %lu for section \"%s\"\n" msgstr "" -#: output.cc:1570 +#: output.cc:1571 #, c-format msgid "%s: %s: open: %s\n" msgstr "" -#: output.cc:1579 +#: output.cc:1580 #, c-format msgid "%s: %s: lseek: %s\n" msgstr "" -#: output.cc:1586 +#: output.cc:1587 #, c-format msgid "%s: %s: write: %s\n" msgstr "" -#: output.cc:1596 +#: output.cc:1597 #, c-format msgid "%s: %s: mmap: %s\n" msgstr "" -#: output.cc:1610 +#: output.cc:1611 #, c-format msgid "%s: %s: munmap: %s\n" msgstr "" -#: output.cc:1618 +#: output.cc:1619 #, c-format msgid "%s: %s: close: %s\n" msgstr "" -#: readsyms.cc:113 +#: readsyms.cc:93 #, c-format -msgid "%s: %s: ordinary object found in input group\n" +msgid "%s: %s: file is empty\n" msgstr "" -#: readsyms.cc:154 +#: readsyms.cc:127 #, c-format -msgid "%s: %s: file is empty\n" +msgid "%s: %s: ordinary object found in input group\n" msgstr "" #. Here we have to handle any other input file types we need. -#: readsyms.cc:167 +#: readsyms.cc:175 #, c-format msgid "%s: %s: not an object or archive\n" msgstr "" -#: reloc.cc:189 reloc.cc:433 +#: reloc.cc:190 reloc.cc:436 #, c-format msgid "%s: %s: relocation section %u has bad info %u\n" msgstr "" -#: reloc.cc:208 reloc.cc:450 +#: reloc.cc:209 reloc.cc:453 #, c-format msgid "%s: %s: relocation section %u uses unexpected symbol table %u\n" msgstr "" -#: reloc.cc:224 reloc.cc:469 +#: reloc.cc:225 reloc.cc:472 #, c-format msgid "%s: %s: unexpected entsize for reloc section %u: %lu != %u" msgstr "" -#: reloc.cc:235 reloc.cc:480 +#: reloc.cc:236 reloc.cc:483 #, c-format msgid "%s: %s: reloc section %u size %lu uneven" msgstr "" @@ -698,12 +708,12 @@ msgstr "" msgid "%s: %s: versym for symbol %zu has no name: %u\n" msgstr "" -#: symtab.cc:1200 symtab.cc:1372 +#: symtab.cc:1200 symtab.cc:1373 #, c-format msgid "%s: %s: unsupported symbol section 0x%x\n" msgstr "" -#: symtab.cc:1565 +#: symtab.cc:1570 #, c-format msgid "%s: %s: warning: %s\n" msgstr "" diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 1ee388f..1663895 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -30,7 +30,14 @@ NATIVE_PROGS = \ two_file_shared_2_nonpic_test \ two_file_same_shared_nonpic_test \ two_file_separate_shared_12_nonpic_test \ - two_file_separate_shared_21_nonpic_test + two_file_separate_shared_21_nonpic_test \ + exception_test \ + exception_static_test \ + exception_shared_1_test \ + exception_shared_2_test \ + exception_same_shared_test \ + exception_separate_shared_12_test \ + exception_separate_shared_21_test NATIVE_TESTING = \ basic_test \ @@ -177,5 +184,61 @@ two_file_shared_2_nonpic.so: two_file_test_2.o two_file_shared_nonpic.so: two_file_test_1.o two_file_test_2.o $(CXXLINK) -shared two_file_test_1.o two_file_test_2.o +exception_test_SOURCES = \ + exception_test_main.cc \ + exception_test_1.cc \ + exception_test_2.cc \ + exception_test.h +exception_test_DEPENDENCIES = gcctestdir/ld +exception_test_LDFLAGS = -Bgcctestdir/ + +exception_static_test_SOURCES = \ + exception_test_main.cc \ + exception_test_1.cc \ + exception_test_2.cc +exception_static_test_DEPENDENCIES = gcctestdir/ld +exception_static_test_LDFLAGS = -Bgcctestdir/ -static + +exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc +exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so +exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +exception_shared_1_test_LDADD = exception_shared_1.so + +exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc +exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so +exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +exception_shared_2_test_LDADD = exception_shared_2.so + +exception_same_shared_test_SOURCES = exception_test_main.cc +exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so +exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +exception_same_shared_test_LDADD = exception_shared.so + +exception_separate_shared_12_test_SOURCES = exception_test_main.cc +exception_separate_shared_12_test_DEPENDENCIES = \ + gcctestdir/ld exception_shared_1.so exception_shared_2.so +exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +exception_separate_shared_12_test_LDADD = \ + exception_shared_1.so exception_shared_2.so + +exception_separate_shared_21_test_SOURCES = exception_test_main.cc +exception_separate_shared_21_test_DEPENDENCIES = \ + gcctestdir/ld exception_shared_1.so exception_shared_2.so +exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +exception_separate_shared_21_test_LDADD = \ + exception_shared_2.so exception_shared_1.so + +exception_test_1_pic.o: exception_test_1.cc + $(CXXCOMPILE) -c -fpic -o $@ $< +exception_test_2_pic.o: exception_test_2.cc + $(CXXCOMPILE) -c -fpic -o $@ $< + +exception_shared_1.so: exception_test_1_pic.o + $(CXXLINK) -shared exception_test_1_pic.o +exception_shared_2.so: exception_test_2_pic.o + $(CXXLINK) -shared exception_test_2_pic.o +exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o + $(CXXLINK) -shared exception_test_1_pic.o exception_test_2_pic.o + endif endif diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index edf32e8..57ac16a 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -53,6 +53,13 @@ check_PROGRAMS = object_unittest$(EXEEXT) $(am__EXEEXT_1) @GCC_FALSE@two_file_test_DEPENDENCIES = libgoldtest.a ../libgold.a @NATIVE_LINKER_FALSE@two_file_test_DEPENDENCIES = libgoldtest.a \ @NATIVE_LINKER_FALSE@ ../libgold.a +@GCC_FALSE@exception_test_DEPENDENCIES = libgoldtest.a ../libgold.a +@NATIVE_LINKER_FALSE@exception_test_DEPENDENCIES = libgoldtest.a \ +@NATIVE_LINKER_FALSE@ ../libgold.a +@GCC_FALSE@exception_static_test_DEPENDENCIES = libgoldtest.a \ +@GCC_FALSE@ ../libgold.a +@NATIVE_LINKER_FALSE@exception_static_test_DEPENDENCIES = \ +@NATIVE_LINKER_FALSE@ libgoldtest.a ../libgold.a subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -87,7 +94,14 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_nonpic_test$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_nonpic_test$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_nonpic_test$(EXEEXT) \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_nonpic_test$(EXEEXT) +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_nonpic_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_static_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_1_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_2_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_same_shared_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_12_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_21_test$(EXEEXT) am__constructor_static_test_SOURCES_DIST = constructor_test.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@am_constructor_static_test_OBJECTS = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test.$(OBJEXT) @@ -99,6 +113,53 @@ am__constructor_test_SOURCES_DIST = constructor_test.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test.$(OBJEXT) constructor_test_OBJECTS = $(am_constructor_test_OBJECTS) constructor_test_LDADD = $(LDADD) +am__exception_same_shared_test_SOURCES_DIST = exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_exception_same_shared_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.$(OBJEXT) +exception_same_shared_test_OBJECTS = \ + $(am_exception_same_shared_test_OBJECTS) +am__exception_separate_shared_12_test_SOURCES_DIST = \ + exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_exception_separate_shared_12_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.$(OBJEXT) +exception_separate_shared_12_test_OBJECTS = \ + $(am_exception_separate_shared_12_test_OBJECTS) +am__exception_separate_shared_21_test_SOURCES_DIST = \ + exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_exception_separate_shared_21_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.$(OBJEXT) +exception_separate_shared_21_test_OBJECTS = \ + $(am_exception_separate_shared_21_test_OBJECTS) +am__exception_shared_1_test_SOURCES_DIST = exception_test_2.cc \ + exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_exception_shared_1_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_2.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.$(OBJEXT) +exception_shared_1_test_OBJECTS = \ + $(am_exception_shared_1_test_OBJECTS) +am__exception_shared_2_test_SOURCES_DIST = exception_test_1.cc \ + exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_exception_shared_2_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_1.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.$(OBJEXT) +exception_shared_2_test_OBJECTS = \ + $(am_exception_shared_2_test_OBJECTS) +am__exception_static_test_SOURCES_DIST = exception_test_main.cc \ + exception_test_1.cc exception_test_2.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_exception_static_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_1.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_2.$(OBJEXT) +exception_static_test_OBJECTS = $(am_exception_static_test_OBJECTS) +exception_static_test_LDADD = $(LDADD) +am__exception_test_SOURCES_DIST = exception_test_main.cc \ + exception_test_1.cc exception_test_2.cc exception_test.h +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_exception_test_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_1.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_2.$(OBJEXT) +exception_test_OBJECTS = $(am_exception_test_OBJECTS) +exception_test_LDADD = $(LDADD) am_object_unittest_OBJECTS = object_unittest.$(OBJEXT) object_unittest_OBJECTS = $(am_object_unittest_OBJECTS) object_unittest_LDADD = $(LDADD) @@ -185,7 +246,14 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libgoldtest_a_SOURCES) $(constructor_static_test_SOURCES) \ - $(constructor_test_SOURCES) $(object_unittest_SOURCES) \ + $(constructor_test_SOURCES) \ + $(exception_same_shared_test_SOURCES) \ + $(exception_separate_shared_12_test_SOURCES) \ + $(exception_separate_shared_21_test_SOURCES) \ + $(exception_shared_1_test_SOURCES) \ + $(exception_shared_2_test_SOURCES) \ + $(exception_static_test_SOURCES) $(exception_test_SOURCES) \ + $(object_unittest_SOURCES) \ $(two_file_same_shared_nonpic_test_SOURCES) \ $(two_file_same_shared_test_SOURCES) \ $(two_file_separate_shared_12_nonpic_test_SOURCES) \ @@ -199,7 +267,13 @@ SOURCES = $(libgoldtest_a_SOURCES) $(constructor_static_test_SOURCES) \ DIST_SOURCES = $(libgoldtest_a_SOURCES) \ $(am__constructor_static_test_SOURCES_DIST) \ $(am__constructor_test_SOURCES_DIST) \ - $(object_unittest_SOURCES) \ + $(am__exception_same_shared_test_SOURCES_DIST) \ + $(am__exception_separate_shared_12_test_SOURCES_DIST) \ + $(am__exception_separate_shared_21_test_SOURCES_DIST) \ + $(am__exception_shared_1_test_SOURCES_DIST) \ + $(am__exception_shared_2_test_SOURCES_DIST) \ + $(am__exception_static_test_SOURCES_DIST) \ + $(am__exception_test_SOURCES_DIST) $(object_unittest_SOURCES) \ $(am__two_file_same_shared_nonpic_test_SOURCES_DIST) \ $(am__two_file_same_shared_test_SOURCES_DIST) \ $(am__two_file_separate_shared_12_nonpic_test_SOURCES_DIST) \ @@ -354,7 +428,14 @@ INCLUDES = -D_GNU_SOURCE \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_nonpic_test \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_nonpic_test \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_nonpic_test \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_nonpic_test +@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_nonpic_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_static_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_1_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_2_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_same_shared_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_12_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_21_test @GCC_TRUE@@NATIVE_LINKER_TRUE@NATIVE_TESTING = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_test \ @@ -451,6 +532,49 @@ object_unittest_SOURCES = object_unittest.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_separate_shared_21_nonpic_test_LDADD = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_test_SOURCES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.cc \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_1.cc \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_2.cc \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test.h + +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_test_DEPENDENCIES = gcctestdir/ld +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_test_LDFLAGS = -Bgcctestdir/ +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_static_test_SOURCES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.cc \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_1.cc \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_2.cc + +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_static_test_DEPENDENCIES = gcctestdir/ld +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_static_test_LDFLAGS = -Bgcctestdir/ -static +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_1_test_LDADD = exception_shared_1.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_2_test_LDADD = exception_shared_2.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_same_shared_test_SOURCES = exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_same_shared_test_LDADD = exception_shared.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_separate_shared_12_test_SOURCES = exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_separate_shared_12_test_DEPENDENCIES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld exception_shared_1.so exception_shared_2.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_separate_shared_12_test_LDADD = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_1.so exception_shared_2.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_separate_shared_21_test_SOURCES = exception_test_main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_separate_shared_21_test_DEPENDENCIES = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld exception_shared_1.so exception_shared_2.so + +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_separate_shared_21_test_LDADD = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_2.so exception_shared_1.so + all: all-am .SUFFIXES: @@ -500,6 +624,27 @@ constructor_static_test$(EXEEXT): $(constructor_static_test_OBJECTS) $(construct constructor_test$(EXEEXT): $(constructor_test_OBJECTS) $(constructor_test_DEPENDENCIES) @rm -f constructor_test$(EXEEXT) $(CXXLINK) $(constructor_test_LDFLAGS) $(constructor_test_OBJECTS) $(constructor_test_LDADD) $(LIBS) +exception_same_shared_test$(EXEEXT): $(exception_same_shared_test_OBJECTS) $(exception_same_shared_test_DEPENDENCIES) + @rm -f exception_same_shared_test$(EXEEXT) + $(CXXLINK) $(exception_same_shared_test_LDFLAGS) $(exception_same_shared_test_OBJECTS) $(exception_same_shared_test_LDADD) $(LIBS) +exception_separate_shared_12_test$(EXEEXT): $(exception_separate_shared_12_test_OBJECTS) $(exception_separate_shared_12_test_DEPENDENCIES) + @rm -f exception_separate_shared_12_test$(EXEEXT) + $(CXXLINK) $(exception_separate_shared_12_test_LDFLAGS) $(exception_separate_shared_12_test_OBJECTS) $(exception_separate_shared_12_test_LDADD) $(LIBS) +exception_separate_shared_21_test$(EXEEXT): $(exception_separate_shared_21_test_OBJECTS) $(exception_separate_shared_21_test_DEPENDENCIES) + @rm -f exception_separate_shared_21_test$(EXEEXT) + $(CXXLINK) $(exception_separate_shared_21_test_LDFLAGS) $(exception_separate_shared_21_test_OBJECTS) $(exception_separate_shared_21_test_LDADD) $(LIBS) +exception_shared_1_test$(EXEEXT): $(exception_shared_1_test_OBJECTS) $(exception_shared_1_test_DEPENDENCIES) + @rm -f exception_shared_1_test$(EXEEXT) + $(CXXLINK) $(exception_shared_1_test_LDFLAGS) $(exception_shared_1_test_OBJECTS) $(exception_shared_1_test_LDADD) $(LIBS) +exception_shared_2_test$(EXEEXT): $(exception_shared_2_test_OBJECTS) $(exception_shared_2_test_DEPENDENCIES) + @rm -f exception_shared_2_test$(EXEEXT) + $(CXXLINK) $(exception_shared_2_test_LDFLAGS) $(exception_shared_2_test_OBJECTS) $(exception_shared_2_test_LDADD) $(LIBS) +exception_static_test$(EXEEXT): $(exception_static_test_OBJECTS) $(exception_static_test_DEPENDENCIES) + @rm -f exception_static_test$(EXEEXT) + $(CXXLINK) $(exception_static_test_LDFLAGS) $(exception_static_test_OBJECTS) $(exception_static_test_LDADD) $(LIBS) +exception_test$(EXEEXT): $(exception_test_OBJECTS) $(exception_test_DEPENDENCIES) + @rm -f exception_test$(EXEEXT) + $(CXXLINK) $(exception_test_LDFLAGS) $(exception_test_OBJECTS) $(exception_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) @@ -544,6 +689,9 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constructor_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception_test_1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception_test_2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception_test_main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_unittest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testfile.Po@am__quote@ @@ -845,6 +993,18 @@ uninstall-am: uninstall-info-am @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared two_file_test_2.o @GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_nonpic.so: two_file_test_1.o two_file_test_2.o @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared two_file_test_1.o two_file_test_2.o + +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_test_1_pic.o: exception_test_1.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_test_2_pic.o: exception_test_2.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< + +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_1.so: exception_test_1_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared exception_test_1_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared_2.so: exception_test_2_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared exception_test_2_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -shared exception_test_1_pic.o exception_test_2_pic.o # 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/exception_test.h b/gold/testsuite/exception_test.h new file mode 100644 index 0000000..1f5c74f --- /dev/null +++ b/gold/testsuite/exception_test.h @@ -0,0 +1,27 @@ +// exception_test.h -- exception test case for gold, header file -*- C++ -*- + +// Copyright 2006, 2007 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 tests references between files. This is the shared header +// file. See exception_test_1.cc for details. + +extern bool t1(); +extern void f1(); diff --git a/gold/testsuite/exception_test_1.cc b/gold/testsuite/exception_test_1.cc new file mode 100644 index 0000000..faebce6 --- /dev/null +++ b/gold/testsuite/exception_test_1.cc @@ -0,0 +1,52 @@ +// exception_test_1.cc -- test exception handling for gold, file 1 of 2 + +// Copyright 2006, 2007 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 tests throwing an exception across various boundaries. This +// is a general test of the exception frame handling, and the +// interaction with the compiler support libraries. This is file 1, +// which catches the exception. We test in several different ways: + +// Files 1 and 2 linked together in executable. +// File 1 in executable, file 2 in shared library. +// File 1 in shared library, file 2 in executable. +// Files 1 and 2 linked together in shared library. +// Files 1 and 2 in different shared libraries. + +#include "exception_test.h" + +bool +t1() +{ + int i; + try + { + i = 0; + f1(); + i = 1; + } + catch (...) + { + return i == 0; + } + + return false; +} diff --git a/gold/testsuite/exception_test_2.cc b/gold/testsuite/exception_test_2.cc new file mode 100644 index 0000000..baced63 --- /dev/null +++ b/gold/testsuite/exception_test_2.cc @@ -0,0 +1,31 @@ +// exception_test_1.cc -- test exception handling for gold, file 1 of 2 + +// Copyright 2006, 2007 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. + +// Second part of exception test. See exception_test_1.cc for details. + +#include "exception_test.h" + +void +f1() +{ + throw 0; +} diff --git a/gold/testsuite/exception_test_main.cc b/gold/testsuite/exception_test_main.cc new file mode 100644 index 0000000..3976364 --- /dev/null +++ b/gold/testsuite/exception_test_main.cc @@ -0,0 +1,35 @@ +// exception_test_main.cc -- an exception test case for gold, main function + +// Copyright 2006, 2007 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 tests references between files. This is the main file. See +// two_file_test_1.cc for details. + +#include <cassert> + +#include "exception_test.h" + +int +main() +{ + assert(t1()); + return 0; +} |