Ian Lance Taylor
c165fb930a
* object.cc (make_elf_object): Correct test for 64-bit ELF file
...
header size.
2008-04-23 17:32:53 +00:00
Ian Lance Taylor
7fcd3aa988
* object.cc (Sized_relobj::do_add_symbols): Always pass
...
local_symbol_count_ to add_from_relobj.
2008-04-19 19:34:41 +00:00
Ian Lance Taylor
d491d34e93
* 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.
2008-04-19 18:30:58 +00:00
Cary Coutant
c5818ff112
* errors.cc (Errors::info): New function.
...
(gold_info): New function.
* errors.h (Errors::info): New function.
* gold.h (gold_info): New function.
* object.cc (Input_objects::add_object): Print trace output.
* options.cc (options::parse_set): New function.
(General_options::parse_wrap): Deleted.
(General_options::General_options): Deleted initializer.
* options.h (options::String_set): New typedef.
(options::parse_set): New function.
(DEFINE_set): New macro.
(General_options::wrap): Changed to use DEFINE_set. Changed
callers of any_wrap_symbols and is_wrap_symbol.
(General_options::trace, General_options::trace_symbol):
New options.
(General_options::any_wrap_symbols, General_options::is_wrap_symbol)
(General_options::wrap_symbols_): Deleted.
* symtab.cc (Symbol_table::add_from_object): Print trace output.
2008-04-17 22:45:47 +00:00
Ian Lance Taylor
2c38906f72
* layout.h (class Layout): Add added_eh_frame_data_ field.
...
* layout.cc (Layout::Layout): Initialize new field.
(Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
output section until we find a section we merged successfully.
* object.cc (Sized_relobj::check_eh_frame_flags): Don't require
that the size be non-zero.
2008-04-09 00:26:48 +00:00
Ian Lance Taylor
39d0cb0e83
* fileread.cc (File_read::find_view): Add byteshift and vshifted
...
parameters. Update for new key type to views_. Change all
callers.
(File_read::read): Adjust for byteshift in returned view.
(File_read::add_view): New function, broken out of
find_and_make_view.
(File_read::make_view): New function, broken out of
find_and_make_view.
(File_read::find_or_make_view): Add offset and aligned
parameters. Rewrite accordingly. Change all callers.
(File_read::get_view): Add offset and aligned parameters. Adjust
for byteshift in return value.
(File_read::get_lasting_view): Likewise.
* fileread.h (class File_read): Update declarations.
(class File_read::View): Add byteshift_ field. Add byteshift to
constructor. Add byteshift method.
* archive.h (Archive::clear_uncached_views): New function.
(Archive::get_view): Add aligned parameter. Change all callers.
* object.h (Object::get_view): Add aligned parameter. Change all
callers.
(Object::get_lasting_view): Likewise.
* fileread.cc (File_read::release): Don't call clear_views if
there are multiple objects.
* fileread.h (File_read::clear_uncached_views): New function.
* archive.cc (Add_archive_symbols::run): Call clear_uncached_views
on the archive.
2008-04-02 20:58:21 +00:00
Ian Lance Taylor
04bf70729d
PR gold/5986
...
Fix problems building gold with gcc 4.3.0.
* gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
(gold_error_at_location, gold_warning_at_location): Use it.
* configure.ac: Check whether we can compile and use a template
function with a printf attribute.
* x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
when jumping over bytes.
* object.cc: Instantiate Object::read_section_data.
* debug.h: Include <cstring>
* dwarf_reader.cc: Include <algorithm>
* main.cc: Include <cstring>.
* options.cc: Include <cstring>.
* output.cc: Include <cstring>.
* script.cc: Include <cstring>.
* script.h: Include <string>.
* symtab.cc: Include <cstring> and <algorithm>.
* target-select.cc: Include <cstring>.
* version.cc: Include <string>.
* testsuite/testmain.cc: Include <cstdlib>.
* configure, config.in: Rebuild.
2008-03-26 23:36:46 +00:00
Ian Lance Taylor
086a18414a
* options.cc: Include "demangle.h".
...
(parse_optional_string): New function.
(parse_long_option): Handle takes_optional_argument.
(parse_short_option): Update dash_z initializer. Handle
takes_optional_argument.
(General_options::General_options): Initialize do_demangle_.
(General_options::finalize): Set do_demangle_. Handle demangling
style.
* options.h (parse_optional_string): Declare.
(struct One_option): Add optional_arg field. Update constructor.
Update call constructor calls. Add takes_optional_argument
function.
(DEFINE_var): Add optional_arg__ parameter. Change all callers.
(DEFINE_optional_string): Define.
(General_options::demangle): Change from DEFINE_bool to
DEFINE_optional_string.
(General_options::no_demangle): New function.
(General_options::do_demangle): New function.
(General_options::set_do_demangle): New function.
(General_options::execstack_status_): Move definition to end of
class definition.
(General_options::static_): Likewise.
(General_options::do_demangle_): New field.
* object.cc (big_endian>::get_symbol_location_info): Call
Options::do_demangle, not Options::demangle.
* symtab.cc (demangle): Likewise.
2008-03-24 03:48:29 +00:00
Ian Lance Taylor
d1f003c610
Fix handling of RELA relative relocs against local symbols in merge
...
sections.
2008-03-16 23:51:19 +00:00
Ian Lance Taylor
ebdbb4583d
Update copyright years. Update language files.
2008-03-13 21:04:21 +00:00
Ian Lance Taylor
1650c4ff50
Combine read-only .eh_frame sections with read-write .eh_frame
...
sections.
2008-03-12 04:38:42 +00:00
Ian Lance Taylor
0dfbdef4c4
Support -d/--define-common.
2008-02-28 20:35:39 +00:00
Ian Lance Taylor
8851eccaec
From Craig Silverstein: Have Parameters point to General_options.
2008-02-28 00:18:24 +00:00
Ian Lance Taylor
7019cd2565
Implement -q/--emit-relocs.
2008-02-27 22:38:18 +00:00
Ian Lance Taylor
dceae3c154
Support dynamic relocations against local section symbols.
2008-02-12 00:28:48 +00:00
Ian Lance Taylor
88dd47ac00
Implement --just-symbols, including -R FILE. Fix symbol values when
...
doing a relocatable link.
2008-02-07 01:51:25 +00:00
Ian Lance Taylor
fbfba50887
Support creating empty output when there are no input objects.
2008-02-06 20:32:10 +00:00
Ian Lance Taylor
6a74a71947
Initial -r support.
2008-02-06 08:13:50 +00:00
Ian Lance Taylor
cb29561284
Reduce the number of system calls. Use readv instead of pread. Do
...
better handling of cached views.
2008-01-02 23:48:49 +00:00
Ian Lance Taylor
8d32f93595
Correct handling of non-section symbol in merged section. Avoid some
...
64-bit signed/unsigned warnings.
2007-12-21 23:08:25 +00:00
Ian Lance Taylor
a9a60db689
Speed up relocations against local symbols in merged sections.
2007-12-21 21:19:45 +00:00
Ian Lance Taylor
8383303e0a
Add section_size_type and section_offset_type, use them to replace a
...
lot of instances of off_t.
2007-12-18 00:48:04 +00:00
Ian Lance Taylor
17a1d0a9b2
Rewrite workqueue. This version eliminates the master thread, and
...
reduces the amount of locking required to find a new thread to run.
2007-12-14 19:00:21 +00:00
Ian Lance Taylor
f2619d6c3b
Initialize variable to avoid warning.
2007-12-06 06:03:00 +00:00
Ian Lance Taylor
7bf1f8020f
From Cary Coutant: More support for generating shared libraries.
2007-12-06 05:55:50 +00:00
Ian Lance Taylor
96803768f1
Compress all debug sections.
2007-12-01 06:34:12 +00:00
Ian Lance Taylor
a2b1aa12f7
From Craig Silverstein: Add support for --demangle.
2007-11-15 01:12:55 +00:00
Ian Lance Taylor
9a2d698415
Add heuristics for undefined symbol warnings.
2007-11-14 16:53:25 +00:00
Ian Lance Taylor
e2827e5f52
Warn about undefined references in shared libraries if we have seen
...
all the DT_NEEDED entries for that library.
2007-11-14 07:34:53 +00:00
Ian Lance Taylor
a55ce7febf
From Craig Silverstein: Rework debug info code a bit, add option for
...
ODR violations, add test case.
2007-11-14 01:03:01 +00:00
Ian Lance Taylor
24badc6562
From Craig Silverstein: rework DWARF reader code a bit.
2007-11-12 19:56:20 +00:00
Ian Lance Taylor
aed38d0694
From Craig Silverstein: Initialize got_relocs.
2007-11-09 23:56:32 +00:00
Ian Lance Taylor
4c50553d98
From Craig Silverstein: Use relocations in reporting error message
...
locations.
2007-11-09 23:16:54 +00:00
Ian Lance Taylor
730cdc88f7
Generate a complete exception frame header. Discard duplicate
...
exception frame information.
2007-11-09 07:00:15 +00:00
Ian Lance Taylor
e43872e995
From Craig Silverstein: Templatize the Dwarf reader.
2007-11-07 00:49:56 +00:00
Ian Lance Taylor
019cdb1a59
From Craig Silverstein: Don't crash if we see a file we don't recognize.
2007-11-07 00:31:32 +00:00
Ian Lance Taylor
5c2c6c957b
From Craig Silverstein: Add first version of generating error messages
...
with file name and line number.
2007-11-02 23:02:44 +00:00
Ian Lance Taylor
f7e2ee4820
Reworked from Andrew Chatham: report error locations.
2007-11-02 03:28:52 +00:00
Ian Lance Taylor
35cdfc9a87
Add support for PT_GNU_STACK.
2007-10-23 05:05:48 +00:00
Ian Lance Taylor
ad435a2465
Adjust linkonce symbol name algorithm to work for
...
.gnu.linkonce.t.__i686.get_pc_thunk.bx.
2007-10-14 07:27:10 +00:00
Ian Lance Taylor
75f2446ec3
Run all error handling through an Errors object. Delete output file
...
on error.
2007-10-14 06:49:14 +00:00
Ian Lance Taylor
27b7985a73
From Craig Silverstein: add some internationalization calls.
2007-10-14 04:06:18 +00:00
Ian Lance Taylor
cfd73a4e26
Add an option for Stringpools to not copy strings.
2007-10-12 06:06:34 +00:00
Ian Lance Taylor
9e2dcb779c
Implement -s and -S options which strip symbols.
2007-10-10 19:02:56 +00:00
Ian Lance Taylor
e727fa71af
Add support for local GOT offsets.
2007-10-08 07:22:21 +00:00
Ian Lance Taylor
063f12a825
Correct handling of addends in merged sections.
2007-10-06 05:40:44 +00:00
Ian Lance Taylor
f5c3f2256f
From Craig Silverstein: avoid some signed/unsigned warnings from gcc 4.2.
2007-10-02 20:52:18 +00:00
Ian Lance Taylor
9025d29d14
Put size and endianness in parameters.
2007-09-26 07:01:35 +00:00
Ian Lance Taylor
9eb9fa57c2
Add cache parameter to get_view. Discard uncached views on unlock.
...
Fix bug this exposed in archive armap symbol name handling.
2007-09-25 17:50:26 +00:00
Ian Lance Taylor
6cb15b7f89
Add licensing text to every source file.
2007-09-22 21:02:10 +00:00
Ian Lance Taylor
7e1edb9089
Add global parameters.
2007-09-21 07:20:01 +00:00
Ian Lance Taylor
cba134d613
From Cary Coutant: only check for a linkonce section if the SHF_GROUP
...
flag is clear.
2007-09-20 06:02:06 +00:00
Ian Lance Taylor
193a53d920
Add support for --enable-target to control which template
...
specializations we generate.
2007-09-04 20:00:53 +00:00
Ian Lance Taylor
b8e6aad960
Add support for SHF_MERGE sections.
2007-05-16 17:42:48 +00:00
Ian Lance Taylor
008db82ec1
Don't emit symbols seen only in dynamic object, don't read duplicate
...
dynamic object.
2006-12-06 06:28:56 +00:00
Ian Lance Taylor
a3ad94edd4
Hash tables, dynamic section, i386 PLT, gold_assert.
2006-11-29 17:56:40 +00:00
Ian Lance Taylor
c06b7b0ba3
Snapshot. Includes first cut at output relocation sections.
2006-11-16 00:38:25 +00:00
Ian Lance Taylor
dbe717effb
More dynamic object support, initial scripting support.
2006-11-14 19:21:05 +00:00
Ian Lance Taylor
645f81233b
Add Elf_file interface which can be used by both Sized_relobj and
...
Sized_dynobj.
2006-11-07 18:51:39 +00:00
Ian Lance Taylor
f0641a0b38
Rework stringpool and hash tables so that we always generate the same
...
output regardless of randomize_va_space.
2006-11-07 04:40:46 +00:00
Ian Lance Taylor
f6ce93d6e9
Split Object into Dynobj and Relobj, incorporate elfcpp swapping changes.
2006-11-06 22:46:08 +00:00
Ian Lance Taylor
ead1e4244a
Can now do a full static link of hello, world in C or C++
2006-11-03 18:26:11 +00:00
Ian Lance Taylor
92e059d8dc
Framework for relocation scanning. Implement simple static TLS
...
relocations.
2006-10-20 20:40:49 +00:00
Ian Lance Taylor
a783673bd6
Avoid multiple definition errors from linkonce sections.
2006-10-10 18:54:06 +00:00
Ian Lance Taylor
12e14209f0
Lay out object file sections when we add the symbols to the symbol
...
table.
2006-10-06 20:40:16 +00:00
Ian Lance Taylor
61ba1cf936
Snapshot. Now able to produce a minimal executable which actually
...
runs.
2006-09-29 19:58:17 +00:00
Ian Lance Taylor
75f65a3e30
Finished layout code.
2006-09-27 22:53:42 +00:00
Ian Lance Taylor
54dc642545
More section layout code.
2006-09-26 21:00:34 +00:00
Ian Lance Taylor
a2fb1b05e4
New drop, with first cut of section layout code.
2006-09-21 22:13:18 +00:00
Ian Lance Taylor
14bfc3f555
Another snapshot of the current state of the sources. Gets to the
...
point of symbol resolution and can now issue a multiple definition
error. Also added target selection infrastructure.
2006-08-18 22:29:20 +00:00
Ian Lance Taylor
bae7f79e03
Initial CVS checkin of gold
2006-08-04 23:10:59 +00:00