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
Ian Lance Taylor
155a0dd763
* common.cc (Symbol_table::allocate_commons): Remove options
...
parameter. Change caller.
(Symbol_table::do_allocate_commons): Remove options parameter.
Change caller. Just call do_allocate_commons_list twice.
(Symbol_table::do_allocate_commons_list): New function, broken out
of do_allocate_commons.
* common.h (class Allocate_commons_task): Remove options_ field.
Update constructor.
* symtab.cc (Symbol_table::Symbol_table): Initialize
tls_commons_.
(Symbol_table::add_from_object): Put TLS common symbols on
tls_commons_ list.
(Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
which are IN_OUTPUT_DATA.
* symtab.h (class Symbol_table): Add tls_commons_ field. Update
allocate_commons and do_allocate_commons declarations. Declare
do_allocate_commons_list.
* gold.cc (queue_middle_tasks): Update creation of
Allocate_commons_task to not pass options.
* testsuite/Makefile.am (INCLUDES): Add -I.. .
(TLS_TEST_C_FLAGS): New variable.
(tls_test_c_pic.o): New target.
(tls_test_shared.so): Link in tls_test_c_pic.o.
(tls_test_c_pic_ie.o): New target.
(tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
(tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
(tls_test_c.o): New target.
(tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
(tls_pic_test_LDADD): Likewise.
(tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
(tls_shared_gd_to_ie_test_LDADD): Likewise.
(tls_test_c_gnu2.o): New target.
(tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
tls_test_c_gnu2.o.
(tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
(tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
(tls_test_shared_nonpic.so): Link in tls_test_c.o.
* testsuite/tls_test.cc: Include "config.h".
(t_last): Call t11_last.
* testsuite/tls_test.h (t11, t11_last): Declare.
* testsuite/tls_test_c.c: New file.
* testsuite/tls_test_main.cc (thread_routine): Call t11.
* configure.ac: Check for OpenMP support.
* configure, config.in, Makefile.in: Rebuild.
* testsuite/Makefile.in: Rebuild.
2008-04-17 07:12:00 +00:00
Ian Lance Taylor
154e0e9aa7
* layout.cc (Layout::Layout): Initialize sections_are_attached_.
...
(Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
in the name/type/flags to section mapping. Don't call
allocate_output_section.
(Layout::choose_output_section): Change parameter from adjust_name
to is_input_section. Don't permit input sections after sections
are attached to segments. Don't call allocate_output_section.
(Layout::layout_eh_frame): Call update_flags_for_input_section,
not write_enable_output_section.
(Layout::make_output_section): Don't push to
unattached_section_list_ nor call attach_to_segment. Call
attach_section_to_segment if sections are attached.
(Layout::attach_sections_to_segments): New function.
(Layout::attach_section_to_segment): New function.
(Layout::attach_allocated_section_to_segment): Rename from
attach_to_segment. Remove flags parameter.
(Layout::allocate_output_section): Remove function.
(Layout::write_enable_output_section): Remove function.
* layout.h (class Layout): Update for above changes. Add new
field sections_are_attached_.
* output.h (Output_section::update_flags_for_input_section): New
function.
* output.cc (Output_section::add_input_section): Call
update_flags_for_input_section.
* gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
2008-04-15 04:06:41 +00:00
Ian Lance Taylor
7cc619c3b1
From Craig Silverstein: rename some option functions in preparation
...
for reworking option handling.
2008-03-04 18:21:43 +00:00
Ian Lance Taylor
0dfbdef4c4
Support -d/--define-common.
2008-02-28 20:35:39 +00:00
Ian Lance Taylor
919ed24cbc
Don't check assertions until symbols are finalized. Create an output
...
section if the script uses a data statement with no input sections.
Don't create a loadable segment for the headers if there is no room.
2008-02-28 04:45:47 +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
45aa233bdc
From Craig Silverstein: rename option functions for future option
...
handling rewrite.
2008-02-26 21:45:30 +00:00
Ian Lance Taylor
0daa6f62c8
Support selecting target by name.
2008-02-13 02:44:50 +00:00
Ian Lance Taylor
bc644c6cfc
Add support for --format binary for input files.
2008-02-08 07:06:58 +00:00
Ian Lance Taylor
516cb3d01e
Support --oformat binary.
2008-02-07 07:33:46 +00:00
Ian Lance Taylor
5fe2a0f55b
Even when stripping all symbols, we need to write out the dynamic
...
symbol table.
2008-02-07 04:35:41 +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
755ab8af10
Fix group signature handling for relocatable link, add bootstrap
...
relocatable test.
2008-02-06 19:32:32 +00:00
Ian Lance Taylor
6a74a71947
Initial -r support.
2008-02-06 08:13:50 +00:00
Ian Lance Taylor
a445fddf82
Fully implement the SECTIONS clause.
2008-02-04 05:43:05 +00:00
Ian Lance Taylor
9b07f471e3
Don't pass around the target in order to define symbols; get it from
...
the parameters instead.
2008-01-26 01:17:45 +00:00
Ian Lance Taylor
494e05f440
Parse a SECTIONS clause in a linker script.
2008-01-23 01:31:13 +00:00
Ian Lance Taylor
e5756efb6d
Support assignments and expressions in linker scripts.
2008-01-09 19:57:45 +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
116724f39d
Don't write out the symbol table when stripping.
2007-12-06 05:00:00 +00:00
Ian Lance Taylor
27bc2bce09
Clean up setting address and section offset.
2007-11-29 20:10:17 +00:00
Ian Lance Taylor
2d6840917d
Don't try to delete the output file if we don't know its name yet.
2007-11-28 19:39:40 +00:00
Ian Lance Taylor
c79126688f
Add threading support.
2007-11-22 00:05:51 +00:00
Ian Lance Taylor
78f156961e
From Craig Silverstein: Report output file name with ODR violation
...
warning message.
2007-11-14 18:44:58 +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
70e654ba48
From Craig Silverstein: First cut at detecting ODR violations.
2007-11-13 20:02:32 +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
e536689126
Simplify some code to avoid extra tests of number of objects.
2007-10-26 22:27:52 +00:00
Ian Lance Taylor
2c0aeda459
Exit if we couldn't open any input files.
2007-10-26 22:12:03 +00:00
Ian Lance Taylor
fe9a4c1201
Add infrastructure for threading support.
2007-10-17 06:24:50 +00:00
Ian Lance Taylor
436ca963fd
From Cary Coutant: preliminary shared library support.
2007-10-16 23:23:08 +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
4eff2974c2
From Craig Silverstein: error if we see a dynamic object when the
...
-static option was given.
2007-10-14 02:52:13 +00:00
Ian Lance Taylor
b3b74ddc6e
Use parameters to track whether we are doing a static link. Fix up
...
final_value_is_known for weak undefined symbols. Pointed out by Cary
Coutant.
2007-09-28 06:36:25 +00:00
Ian Lance Taylor
9025d29d14
Put size and endianness in parameters.
2007-09-26 07:01:35 +00:00
Ian Lance Taylor
6cb15b7f89
Add licensing text to every source file.
2007-09-22 21:02:10 +00:00
Ian Lance Taylor
bfd58944a6
Define __start and __stop symbols.
2007-09-22 04:42:09 +00:00
Ian Lance Taylor
16649710df
Can now dynamically link hello, world.
2006-12-01 16:51:25 +00:00
Ian Lance Taylor
5a6f7e2db5
Added a testsuite. More support for COPY relocations.
2006-11-30 23:52:50 +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
dbe717effb
More dynamic object support, initial scripting support.
2006-11-14 19:21:05 +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
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