Cary Coutant
edfbb02953
* i386.cc (Target_i386::define_tls_base_symbol): New function.
...
(Target_i386::tls_base_symbol_defined_): New field.
(Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
(Target_i386::Scan::global): Likewise.
* symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
* x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
(Target_x86_64::tls_base_symbol_defined_): New field.
(Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
(Target_x86_64::Scan::global): Likewise.
2008-04-17 02:00:54 +00:00
Ian Lance Taylor
a4bb589a17
Fix typo in comment in last commit.
2008-04-10 00:58:58 +00:00
Ian Lance Taylor
99a37bfda0
* symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
...
aliases for symbols defined in the same object.
* testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
(weak_alias_test_SOURCES): New variable.
(weak_alias_test_DEPENDENCIES): New variable.
(weak_alias_test_LDFLAGS): New variable.
(weak_alias_test_LDADD): New variable.
(weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
(weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
(weak_alias_test_3.o): New target.
(weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
* testsuite/weak_alias_test_main.cc: New file.
* testsuite/weak_alias_test_1.cc: New file.
* testsuite/weak_alias_test_2.cc: New file.
* testsuite/weak_alias_test_3.cc: New file.
2008-04-09 22:45:08 +00:00
Ian Lance Taylor
0864d55193
* options.h (class General_options): Define --wrap as a special
...
option. Add wrap_symbols_ field.
(General_options::any_wrap_symbols): New function.
(General_options::is_wrap_symbol): New function.
* options.cc (General_options::parse_wrap): New function.
(General_options::General_options): Initialize wrap_symbols_.
* symtab.cc (Symbol_table::wrap_symbol): New function.
(Symbol_table::add_from_object): Handle --wrap.
* symtab.h (class Symbol_table): Declare wrap_symbol.
* target.h (Target::wrap_char): New function.
(Target::Target_info): Add wrap_char field.
* i386.cc (Target_i386::i386_info): Initialize wrap_char.
* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
* testsuite/testfile.cc (Target_test::test_target_info):
Likewise.
2008-04-09 00:48:13 +00:00
Ian Lance Taylor
686c8caf41
* symtab.cc (Symbol_table::do_define_as_constant): Don't force a
...
version symbol to be local.
* testsuite/ver_test_4.sh: New file.
* testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
(check_DATA): Add ver_test_4.syms.
(ver_test_4.syms): New target.
* testsuite/Makefile.in: Rebuild.
2008-03-29 08:39:26 +00:00
Ian Lance Taylor
479f65031f
* symtab.cc (Symbol_table::add_from_object): If we don't use the
...
new symbol when resolving, don't call set_is_default.
* testsuite/ver_test_7.cc: New file.
* testsuite/ver_test_7.sh: New file.
* testsuite/Makefile.am (ver_test_7.so): New target.
(ver_test_7.o): New target.
(check_SCRIPTS): Add ver_test_7.sh.
(check_DATA): Add ver_test_7.syms.
(ver_test_7.syms): New target.
2008-03-29 07:19:02 +00:00
Ian Lance Taylor
18e6b24e63
* symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
...
and commons_ correctly when NAME/VERSION does not override
NAME/NULL.
* testsuite/ver_test_6.c: New file.
* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
(ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
(ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2008-03-27 18:19:09 +00:00
Ian Lance Taylor
5871526fc2
* symtab.cc (Symbol_table::add_from_relobj): Don't set the version
...
of an undefined symbol from a version script.
* testsuite/Makefile.am (ver_test_5.so): New target.
(ver_test_5.o): New target.
(check_SCRIPTS): Add ver_test_5.sh.
(check_DATA): Add ver_test_5.syms.
(ver_test_5.syms): New target.
* testsuite/ver_test_5.cc: New file.
* testsuite/ver_test_5.script: New file.
* testsuite/ver_test_5.sh: New file.
* Makefile.in, testsuite/Makefile.in: Rebuild.
2008-03-27 06:11:57 +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
Cary Coutant
0a65a3a740
* i386.cc (Target_i386::Got_type): New enum declaration.
...
(Target_i386::Scan::local): Updated callers of Output_data_got
member functions.
(Target_i386::Scan::global): Likewise.
(Target_i386::Relocate::relocate): Likewise.
(Target_i386::Relocate::relocate_tls): Likewise.
* object.h (Got_offset_list): New class.
(Sized_relobj::local_has_got_offset): Added got_type parameter.
(Sized_relobj::local_got_offset): Likewise.
(Sized_relobj::set_local_got_offset): Likewise.
(Sized_relobj::local_has_tls_got_offset): Removed.
(Sized_relobj::local_tls_got_offset): Removed.
(Sized_relobj::set_local_tls_got_offset): Removed.
(Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
* output.cc (Output_data_got::add_global): Added got_type parameter.
(Output_data_got::add_global_with_rel): Likewise.
(Output_data_got::add_global_with_rela): Likewise.
(Output_data_got::add_global_pair_with_rel): New function.
(Output_data_got::add_global_pair_with_rela): New function.
(Output_data_got::add_local): Added got_type parameter.
(Output_data_got::add_local_with_rel): Likewise.
(Output_data_got::add_local_with_rela): Likewise.
(Output_data_got::add_local_pair_with_rel): New function.
(Output_data_got::add_local_pair_with_rela): New function.
(Output_data_got::add_global_tls): Removed.
(Output_data_got::add_global_tls_with_rel): Removed.
(Output_data_got::add_global_tls_with_rela): Removed.
(Output_data_got::add_local_tls): Removed.
(Output_data_got::add_local_tls_with_rel): Removed.
(Output_data_got::add_local_tls_with_rela): Removed.
* output.h (Output_data_got::add_global): Added got_type parameter.
(Output_data_got::add_global_with_rel): Likewise.
(Output_data_got::add_global_with_rela): Likewise.
(Output_data_got::add_global_pair_with_rel): New function.
(Output_data_got::add_global_pair_with_rela): New function.
(Output_data_got::add_local): Added got_type parameter.
(Output_data_got::add_local_with_rel): Likewise.
(Output_data_got::add_local_with_rela): Likewise.
(Output_data_got::add_local_pair_with_rel): New function.
(Output_data_got::add_local_pair_with_rela): New function.
(Output_data_got::add_global_tls): Removed.
(Output_data_got::add_global_tls_with_rel): Removed.
(Output_data_got::add_global_tls_with_rela): Removed.
(Output_data_got::add_local_tls): Removed.
(Output_data_got::add_local_tls_with_rel): Removed.
(Output_data_got::add_local_tls_with_rela): Removed.
* resolve.cc (Symbol::override_base_with_special): Removed
reference to has_got_offset_ field.
* symtab.cc (Symbol::init_fields): Replaced initialization
of got_offset_ with got_offsets_. Removed initialization
of has_got_offset_
*symtab.h (Symbol::has_got_offset): Aded got_type parameter.
(Symbol::got_offset): Likewise.
(Symbol::set_got_offset): Likewise.
(Symbol::has_tls_got_offset): Removed.
(Symbol::tls_got_offset): Removed.
(Symbol::set_tls_got_offset): Removed.
(Symbol::got_offset_): Removed.
(Symbol::tls_mod_got_offset_): Removed.
(Symbol::tls_pair_got_offset_): Removed.
(Symbol::got_offsets_): New field.
(Symbol::has_got_offset): Removed.
(Symbol::has_tls_mod_got_offset): Removed.
(Symbol::has_tls_pair_got_offset): Removed.
* x86_64.cc (Target_x86_64::Got_type): New enum declaration.
(Target_x86_64::Scan::local): Updated callers of Output_data_got
member functions.
(Target_x86_64::Scan::global): Likewise.
(Target_x86_64::Relocate::relocate): Likewise.
(Target_x86_64::Relocate::relocate_tls): Likewise.
2008-03-25 18:37:16 +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
be3e620119
Don't get confused about whether a symbol is the default version if we
...
see a later reference to it. Add tests for this case.
2008-03-14 05:57:19 +00:00
Ian Lance Taylor
7d1a9ebbf2
Remove gcc 3.2 compatibility hacks.
2008-02-29 19:19:17 +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
caa9d5d919
Assignments in linker scripts override definitions from object files.
2008-02-13 01:20:38 +00:00
Ian Lance Taylor
77e655378d
Track sections for expressions.
2008-02-09 01:22:17 +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
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
a445fddf82
Fully implement the SECTIONS clause.
2008-02-04 05:43:05 +00:00
Ian Lance Taylor
65778909ad
From Cary Coutant: Ignore hidden symbols in a dynamic object.
2008-02-01 00:42:24 +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
55a934330a
Originally from Craig Silverstein, with changes: support using a
...
version script to force symbols to be local.
2008-01-24 00:15:00 +00:00
Ian Lance Taylor
091244672e
From Andrew Chatham and Craig Silverstein: Add support for version
...
scripts.
2008-01-15 23:41:28 +00:00
Ian Lance Taylor
e5756efb6d
Support assignments and expressions in linker scripts.
2008-01-09 19:57:45 +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
99f8facac9
From Cary Coutant: Fix handling of versioned symbols, add some tests.
2007-12-21 23:31:19 +00:00
Ian Lance Taylor
fe8718a463
Convert more instances of off_t to be 32-bit types.
2007-12-20 21:21:24 +00:00
Ian Lance Taylor
c0873094f5
Use string length when available when calling Stringpool. Compare
...
pointers first when looking up Stringpool entries.
2007-12-19 00:29:28 +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
6d01333390
From Craig Silverstein: size hash tables to avoid resizing.
2007-12-14 05:24:17 +00:00
Ian Lance Taylor
e8c846c359
From Cary Coutant: Fix handling of RELATIVE RELA relocs.
2007-12-07 19:32:59 +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
ad8f37d1ba
Stringpool stats. Also make Symbol_table support functions inline.
2007-12-05 00:48:49 +00:00
Ian Lance Taylor
abaa399568
Print symbol table statistics with --stats.
2007-12-04 23:11:35 +00:00
Ian Lance Taylor
c79126688f
Add threading support.
2007-11-22 00:05:51 +00:00
Ian Lance Taylor
dd8670e56c
From Craig Silverstein: Quote the symbol name in the ODR violation
...
message to avoid a gcc collect2 demangling bug.
2007-11-17 02:49:22 +00:00
Ian Lance Taylor
ff541f308a
When looking for ODR violations, only check the file base name. Also,
...
never demangle if --no-demangle was used.
2007-11-16 16:54:19 +00:00
Ian Lance Taylor
b01c0a4adb
Workaround bug in gcc 4.0.3 STL.
2007-11-15 20:41:19 +00:00
Ian Lance Taylor
a2b1aa12f7
From Craig Silverstein: Add support for --demangle.
2007-11-15 01:12:55 +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
601e4987b8
Revert last patch.
2007-11-14 08:03:41 +00:00
Ian Lance Taylor
3728821ffc
Support special always-defined symbols for targets.
2007-11-14 07:52:21 +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
70e654ba48
From Craig Silverstein: First cut at detecting ODR violations.
2007-11-13 20:02:32 +00:00
Ian Lance Taylor
d61c6bd41c
From Cary Coutant: More shared library support, some refactorization.
2007-11-09 19:45:08 +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
35cdfc9a87
Add support for PT_GNU_STACK.
2007-10-23 05:05:48 +00:00
Ian Lance Taylor
46fe162319
Fix versions of copied symbols.
2007-10-22 23:08:22 +00:00
Ian Lance Taylor
436ca963fd
From Cary Coutant: preliminary shared library support.
2007-10-16 23:23:08 +00:00
Ian Lance Taylor
aeddab66fe
Keep track of weak aliases, so that overriding environ works.
2007-10-14 15:35:27 +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
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
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
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
ab5c9e90a6
Use special value when we refer a function symbol in some way other
...
than calling it.
2007-09-23 05:31:48 +00:00
Ian Lance Taylor
6cb15b7f89
Add licensing text to every source file.
2007-09-22 21:02:10 +00:00
Ian Lance Taylor
d4f5281bde
It's OK to have a version if we have an existing symbol.
2007-09-22 20:08:16 +00:00
Ian Lance Taylor
306d9ef048
Canonicalize name and version when working with special symbols.
2007-09-22 04:40:13 +00:00
Ian Lance Taylor
86f2e68346
Let special symbols override existing symbols rather than
...
reinitializing them.
2007-09-19 06:02:29 +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
64707334c7
Ignore VER_NDX_LOCAL for an undefined symbol.
2007-09-04 17:59:53 +00:00
Ian Lance Taylor
1ebd95fdf1
Copy in_reg and in_dyn when resolving NAME/VERSION with NAME/NULL.
2007-08-29 03:42:51 +00:00
Ian Lance Taylor
f4151f8959
Initialize plt_offset_ and has_plt_offset_ in a Symbol.
2007-08-28 04:11:50 +00:00
Ian Lance Taylor
a6badf5a97
Add support for -E/--export-dynamic. Also clean up --help output a bit.
2007-08-22 05:06:38 +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
14b3174058
Generate version information.
2006-12-06 00:02:36 +00:00
Ian Lance Taylor
6a4699867a
gcc 3.2.2 portability hacks.
2006-12-01 16:58:12 +00:00
Ian Lance Taylor
16649710df
Can now dynamically link hello, world.
2006-12-01 16:51:25 +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
593f47df45
gcc 3.2.2 portability hacks.
2006-11-03 18:38:43 +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
a783673bd6
Avoid multiple definition errors from linkonce sections.
2006-10-10 18:54:06 +00:00
Ian Lance Taylor
5482377ddc
Clean up HAVE_MEMBER_TEMPLATE_SPECIFICATIONS somewhat.
2006-09-29 22:34:01 +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
274e99f9ae
g++ 3.2.2 portability fixes.
2006-09-26 21:50:25 +00:00
Ian Lance Taylor
54dc642545
More section layout code.
2006-09-26 21:00:34 +00:00
Ian Lance Taylor
1564db8db6
More symbol resolution code.
2006-09-07 21:21:41 +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