* layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
fd06b4aa
CC
12008-12-05 Cary Coutant <ccoutant@google.com>
2
3 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4 Handle --strip-lto-sections option.
5 * options.h (strip_lto_sections): New option.
6
6c52134c
CC
72008-12-01 Cary Coutant <ccoutant@google.com>
8
9 * plugin.cc (ld_plugin_message): Change format parameter to const.
10 Fix mismatch between new[] and delete.
11
a45248e0
CC
122008-11-14 Cary Coutant <ccoutant@google.com>
13
14 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15 instead of -1U.
16
c82fbeee
CS
172008-11-05 Craig Silverstein <csilvers@google.com>
18
19 * options.cc (General_options::parse_dynamic_list): New function.
20 * options.h (General_options): New flags dynamic_list,
21 dynamic_list_data, dynamic_list_cpp_new, and
22 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
23 (General_options::in_dynamic_list): New function.
24 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
25 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
26 (Lex::can_continue_name): Likewise.
27 (yylex): Likewise.
28 (read_script_file): New parameter script_options.
29 (read_dynamic_list): New function.
30 (Script_options::define_dynamic_list): New function.
31 (dynamic_list_keyword_parsecodes): New variable.
32 (dynamic_list_keywords): New variable.
33 * script.h (Script_options::define_dynamic_list): New function
34 prototype.
35 (read_dynamic_list): New function prototype.
36 * symtab.cc (strprefix): New macro.
37 (Symbol::should_add_dynsym_entry): Support dynamic_list,
38 dynamic_list_data, dynamic_list_cpp_new, and
39 dynamic_list_cpp_typeinfo.
40 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
41 (dynamic_list_expr): New rule.
42 (dynamic_list_nodes): Likewise.
43 (dynamic_list_node): Likewise.
44 * testsuite/Makefile.am (dynamic_list): New test.
45 * testsuite/Makefile.in: Regenerated.
46 * testsuite/dynamic_list.t: New file.
47 * testsuite/dynamic_list.sh: New file.
48
e0bb29a5
CS
492008-11-05 Craig Silverstein <csilvers@google.com>
50
51 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
52 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
53 (t11_last): Likewise.
54 * testsuite/ver_test_6.c (main): Likewise.
55
4e1e25e0
CC
562008-10-07 Cary Coutant <ccoutant@google.com>
57
58 * options.c (General_options::finalize): Add check for -static and
59 -shared.
60 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
61 is not empty.
62
92f03fcb
CC
632008-10-02 Cary Coutant <ccoutant@google.com>
64
65 * plugin.cc (make_sized_plugin_object): Fix conditional
66 compilation to work when not all targets are enabled.
67
fbd8a257
CC
682008-09-29 Cary Coutant <ccoutant@google.com>
69
70 * archive.cc (Archive::get_file_and_offset): Use filename instead
71 of name to get library path.
72 (Archive::include_member): Unlock external member of a thin archive.
73
74 * testsuite/Makefile.am (TEST_AR): New variable.
75 (thin_archive_test_1): New test.
76 (thin_archive_test_2): New test.
81636b3f
CC
77 * testsuite/Makefile.in: Regenerate.
78 * testsuite/thin_archive_main.cc: New file.
79 * testsuite/thin_archive_test_1.cc: New file.
80 * testsuite/thin_archive_test_2.cc: New file.
81 * testsuite/thin_archive_test_3.cc: New file.
82 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 83
eff45813
CC
842008-09-29 Cary Coutant <ccoutant@google.com>
85
86 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
87 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
88 instead of -1U.
89 (Sized_relobj::do_finalize_local_symbols): Likewise.
90 (Sized_relobj::map_to_kept_section): Likewise.
91 * object.h (Sized_relobj::invalid_address): New constant.
92 (Sized_relobj::do_output_section_offset): Check for invalid_address
93 and return -1ULL.
94 * output.cc (Output_reloc::local_section_offset): Use constant
95 invalid_address instead of -1U.
96 (Output_reloc::get_address): Likewise.
97 (Output_section::output_address): Change -1U to -1ULL.
98 * output.h (Output_reloc::invalid_address): New constant.
99 * reloc.cc (Sized_relobj::write_sections): Use constant
100 invalid_address instead of -1U.
101 (Sized_relobj::relocate_sections): Likewise.
102 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
103 values for merge sections.
104 * target-reloc.h (relocate_for_relocatable): Use constant
105 invalid_address instead of -1U.
106
89fc3421
CC
1072008-09-19 Cary Coutant <ccoutant@google.com>
108
109 Add plugin functionality for link-time optimization (LTO).
110 * configure.ac (plugins): Add --enable-plugins option.
111 * configure: Regenerate.
112 * config.in: Regenerate.
113 * Makefile.am (LIBDL): New variable.
114 (CCFILES): Add plugin.cc.
115 (HFILES): Add plugin.h.
116 (ldadd_var): Add LIBDL.
117 * Makefile.in: Regenerate.
118
119 * archive.cc: Include "plugin.h".
120 (Archive::setup): Don't preread archive symbols when using a plugin.
121 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
122 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
123 files.
124 (Archive::include_member): Add symbols from plugin objects.
125 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
126 * descriptors.cc (Descriptors::open): Check for file descriptors
127 abandoned by plugins.
128 (Descriptors::claim_for_plugin): New function.
129 * descriptors.h (Descriptors::claim_for_plugin): New function.
130 (Open_descriptor::is_claimed): New field.
131 (claim_descriptor_for_plugin): New function.
132 * fileread.cc (File_read::claim_for_plugin): New function.
133 * fileread.h (File_read::claim_for_plugin): New function.
134 (File_read::descriptor): New function.
135 * gold.cc: Include "plugin.h".
136 (queue_initial_tasks): Add task to call plugin hooks for generating
137 new object files.
138 * main.cc: Include "plugin.h".
139 (main): Load plugin libraries.
140 * object.h (Pluginobj): Declare.
141 (Object::pluginobj): New function.
142 (Object::do_pluginobj): New function.
143 (Object::set_target): New function.
144 * options.cc: Include "plugin.h".
145 (General_options::parse_plugin): New function.
146 (General_options::General_options): Initialize plugins_ field.
147 (General_options::add_plugin): New function.
148 * options.h (Plugin_manager): Declare.
149 (General_options): Add --plugin option.
150 (General_options::has_plugins): New function.
151 (General_options::plugins): New function.
152 (General_options::add_plugin): New function.
153 (General_options::plugins_): New field.
154 * plugin.cc: New file.
155 * plugin.h: New file.
156 * readsyms.cc: Include "plugin.h".
157 (Read_symbols::do_read_symbols): Check for archive before checking
158 for ELF file. Call plugin hooks to claim files.
159 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
160 from a real object file; force override when processing replacement
161 files.
162 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
163 (Symbol::init_base_object): Likewise.
164 (Symbol::init_base_output_data): Likewise.
165 (Symbol::init_base_output_segment): Likewise.
166 (Symbol::init_base_constant): Likewise.
167 (Symbol::init_base_undefined): Likewise.
168 (Symbol::output_section): Assert that object is not a plugin.
169 (Symbol_table::add_from_pluginobj): New function.
170 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
171 undefined.
172 (Symbol_table::sized_write_globals): Likewise.
173 (Symbol_table::add_from_pluginobj): Instantiate template.
174 * symtab.h (Sized_pluginobj): Declare.
175 (Symbol::in_real_elf): New function.
176 (Symbol::set_in_real_elf): New function.
177 (Symbol::in_real_elf_): New field.
178 (Symbol_table::add_from_pluginobj): New function.
179
180 * testsuite/Makefile.am (AM_CFLAGS): New variable.
181 (LIBDL): New variable.
182 (LDADD): Add LIBDL.
183 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
184 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
185 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
186 (MOSTLYCLEANFILES): Likewise.
187 * testsuite/Makefile.in: Regenerate.
188 * testsuite/plugin_test.c: New file.
189 * testsuite/plugin_test_1.sh: New file.
190 * testsuite/plugin_test_2.sh: New file.
191
de31bda5
ILT
1922008-09-16 Ian Lance Taylor <iant@google.com>
193
9c2d0ef9
ILT
194 * target-reloc.h (relocate_section): Check whether a symbol is
195 defined by the ABI before reporting an undefined symbol error.
196 * target.h (Target::is_defined_by_abi): Make parameter const.
197 (Target::do_is_defined_by_abi): Likewise.
198 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
199 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
200 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
201 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
202 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
203 * testsuite/Makefile.in: Rebuild.
204
de31bda5
ILT
205 * fileread.cc (make_view): Add casts to avoid warning.
206
9fa33bee
AO
2072008-09-16 Alexandre Oliva <aoliva@redhat.com>
208
209 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
210 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
211
183fd0e3
AO
2122008-09-16 Alexandre Oliva <aoliva@redhat.com>
213
214 * options.h (General_options::output_is_executable): New.
215 (General_options::output_is_pie): New.
216 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
217 for shared libraries.
218 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
219
7be8330a
CD
2202008-09-11 Chris Demetriou <cgd@google.com>
221
222 * options.h (origin): New -z option.
223 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
224 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
225 in DT_FLAGS_1.
226
a9caad02
CC
2272008-09-05 Cary Coutant <ccoutant@google.com>
228
229 * fileread.cc (File_read::make_view): Add check for attempt to map
230 beyond end of file.
231
ae6dce4d
CC
2322008-09-05 Cary Coutant <ccoutant@google.com>
233
234 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
235 explicit instantiations.
236
d7ab2a47
KVH
2372008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
238
239 PR gold/6858
240 * options.cc (General_options::finalize): Allow undefined symbols
241 in shlibs if linking -shared.
242
243 PR gold/6859
244 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
245 symbols as not needing a dynsym entry.
246
1e52a9c1
CS
2472008-08-20 Craig Silverstein <csilvers@google.com>
248
249 * fileread.cc (File_read::open): Do not lock the file unless it
250 was successfully opened.
251
d85c80a3
CC
2522008-08-14 Cary Coutant <ccoutant@google.com>
253
254 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
255 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
256 * testsuite/tls_test.cc (struct int128): 128-bit struct
257 for testing TLS relocs with non-zero addend.
258 (v12): New TLS variable.
259 (t12): New test.
260 (t_last): Add check for v12.
261 * testsuite/tls_test.h (t12): New function.
262 * testsuite/tls_test_main.cc (thread_routine): Call new test.
263
2d924fd9
ILT
2642008-08-13 Ian Lance Taylor <iant@google.com>
265
266 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
267 set tls_segment_ or relro_segment_.
268 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
269 when appropriate.
270 * output.h (Output_section::clear_is_relro): New function.
271 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
272 sections specially even when output_data_ is empty.
273 (Output_segment::maximum_alignment): When first section is relro,
274 only force alignment for PT_LOAD segments.
275 * script.cc (script_data_segment_align): New function.
276 (script_data_segment_relro_end): New function.
277 * script-c.h (script_data_segment_align): Declare.
278 (script_data_segment_relro_end): Declare.
279 * script-sections.h (class Script_sections): Declare
280 data_segment_align and data_segment_relro_end. Add fields
281 segment_align_index_ and saw_relro_end_.
282 * script-sections.cc (class Sections_element): Add set_is_relro
283 virtual function. Add new bool* parameter to place_orphan_here.
284 Add get_output_section virtual function.
285 (class Output_section_definition): Add set_is_relro. Add new
286 bool* parameter to place_orphan_here. Add get_output_section.
287 Add is_relro_ field.
288 (Output_section_definition::Output_section_definition): Initialize
289 evaluated_address_, evaluated_load_address, evaluated_addralign_,
290 and is_relro_ fields.
291 (Output_section_definition::place_orphan_here): Add is_relro
292 parameter.
293 (Output_section_definition::set_section_addresses): Set relro for
294 output section.
295 (Output_section_definition::alternate_constraint): Likewise.
296 (class Orphan_output_section): Add new bool* parameter to
297 place_orphan_here. Add get_output_section.
298 (Orphan_output_section::place_orphan_here): Add is_relro
299 parameter.
300 (Script_sections::Script_sections): Initialize
301 data_segment_align_index_ and saw_relro_end_.
302 (Script_sections::data_segment_align): New function.
303 (Script_sections::data_segment_relro_end): New function.
304 (Script_sections::place_orphan): Set or clear is_relro.
305 (Script_sections::set_section_addresses): Force alignment of first
306 TLS section.
307 * yyscript.y (exp): Call script_data_segment_align and
308 script_data_segment_relro_end.
309 * testsuite/relro_script_test.t: New file.
310 * testsuite/relro_test.cc (using_script): Declare.
311 (t1, t2): Test using_script.
312 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
313 (relro_script_test_SOURCES): Define.
314 (relro_script_test_DEPENDENCIES): Define.
315 (relro_script_test_LDFLAGS): Define.
316 (relro_script_test_LDADD): Define.
317 (relro_script_test.so): New target.
318 * testsuite/Makefile.in: Rebuild.
319
f827c9a9
CC
3202008-08-06 Cary Coutant <ccoutant@google.com>
321
322 * archive.cc (Archive::total_archives, Archive::total_members)
323 (Archive::total_members_loaded): New variables.
324 (Archive::setup): Add parameter. Add option to preread
325 archive symbols.
326 (Archive::read_armap): Add counter.
327 (Archive::get_file_and_offset): New function.
328 (Archive::get_elf_object_for_member): New function.
329 (Archive::read_all_symbols): New function.
330 (Archive::read_symbols): New function.
331 (Archive::add_symbols): Add counters.
332 (Archive::include_all_members): Use armap to find members if it's
333 already built.
334 (Archive::include_member): Skip reading symbols if already read.
335 Factored code into Archive::get_file_and_offset and
336 Archive::get_elf_object_for_member. Changed call to
337 Mapfile::report_include_archive_member.
338 (Archive::print_stats): New function.
339 * archive.h: Declare Object and Read_symbols_data classes.
340 (Archive::Archive): Add initializers for new members.
341 (Archive::setup): Add parameter.
342 (Archive::print_stats): New function.
343 (Archive::total_archives, Archive::total_members)
344 (Archive::total_members_loaded): New variables.
345 (Archive::get_file_and_offset): New function.
346 (Archive::get_elf_object_for_member): New function.
347 (Archive::read_all_symbols): New function.
348 (Archive::read_symbols): New function.
349 (Archive::Archive_member): New class.
350 (Archive::members_): New member.
351 (Archive::num_members_): New member.
352 * main.cc: Include archive.h.
353 (main): Call Archive::print_stats.
354 * mapfile.cc (Mapfile::report_include_archive_member): Delete
355 archive parameter; member_name is now the fully-decorated name.
356 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
357 * options.h: (General_options): Add --preread-archive-symbols option.
358 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
359 Archive::setup.
360
de4c45bd
ILT
3612008-08-04 Ian Lance Taylor <iant@google.com>
362
363 * symtab.h (Symbol::use_plt_offset): New function.
364 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
365 * powerpc.cc (Relocate::relocate): Likewise.
366 * sparc.cc (Relocate::relocate): Likewise.
367 * x86_64.cc (Relocate::relocate): Likewise.
368 * testsuite/weak_plt.sh: New test.
369 * testsuite/weak_plt_main.cc: New test.
370 * testsuite/weak_plt_shared.cc: New test.
371 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
372 (check_PROGRAMS): Add weak_plt.
373 (check_DATA): Add weak_plt_shared.so.
374 (weak_plt_main_pic.o, weak_plt): New targets.
375 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
376 * testsuite/Makefile.in: Rebuild.
377
378 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
379 gcctestdir/ld.
380 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
381 * testsuite/Makefile.in: Rebuild.
382
323ee3f4
AM
3832008-08-04 Alan Modra <amodra@bigpond.net.au>
384
385 * Makefile.am (POTFILES.in): Set LC_ALL=C.
386 * Makefile.in: Regenerate.
387 * po/POTFILES.in: Regenerate.
388
7c07ecec
ILT
3892008-07-29 Ian Lance Taylor <iant@google.com>
390
391 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
392 symbols before other symbols.
393 * testsuite/script_test_2.cc (test_addr): Declare.
394 (test_addr_alias): Declare.
395 (main): Check that test_addr and test_addr_alias have the right
396 values.
397 * testsuite/script_test_2.t: Define test_addr_alias and
398 test_addr.
399
5778530e
ILT
4002008-07-24 Ian Lance Taylor <iant@google.com>
401
2a00e4fb
ILT
402 PR 5990
403 * descriptors.cc: New file.
404 * descriptors.h: New file.
405 * gold-threads.h (class Hold_optional_lock): New class.
406 * fileread.cc: Include "descriptors.h".
407 (File_read::~File_read): Release descriptor rather than closing
408 it.
409 (File_read::open) [file]: Call open_descriptor rather than open.
410 Set is_descriptor_opened_.
411 (File_read::open) [memory]: Assert that descriptor is not open.
412 (File_read::reopen_descriptor): New function.
413 (File_read::release): Release descriptor.
414 (File_read::do_read): Make non-const. Reopen descriptor.
415 (File_read::read): Make non-const.
416 (File_read::make_view): Reopen descriptor.
417 (File_read::do_readv): Likewise.
418 * fileread.h (class File_read): Add is_descriptor_opened_ field.
419 Update declarations.
420 * layout.cc: Include "descriptors.h".
421 (Layout::create_build_id): Use open_descriptor rather than open.
422 * output.cc: Include "descriptors.h".
423 (Output_file::open): Use open_descriptor rather than open.
424 * archive.cc (Archive::const_iterator): Change Archive to be
425 non-const.
426 (Archive::begin, Archive::end): Make non-const.
427 (Archive::count_members): Likewise.
428 * archive.h (class Archive): Update declarations.
429 * object.h (Object::read): Make non-const.
430 * Makefile.am (CCFILES): Add descriptors.cc.
431 (HFILES): Add descriptors.h.
432 * Makefile.in: Rebuild.
433
801647d1
ILT
434 PR 6716
435 * gold.h: Always include <clocale>. Add Solaris workarounds
436 following code in binutils/sysdep.h.
437
5edd166e
ILT
438 PR 6048
439 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
440 this->eh_frame_hdr_ is NULL before using it.
441
c89ad728
ILT
442 * dynobj.cc (Versions::Versions): Update comment.
443
aa86f06b
ILT
444 * dynobj.cc (Versions::Versions): If there is an soname, use it as
445 the base version name.
446
5778530e
ILT
447 * stringpool.cc (Stringpool_template::add_with_length): Set key to
448 array size plus one.
449 (Stringpool_template::set_string_offsets): Subtract one from key
450 before using it as an array index.
451 (Stringpool_template::get_offset_with_length): Likewise.
452 (Stringpool_template::write_to_buffer): Likewise.
453 * stringpool.h (Stringpool_template::get_offset_from_key):
454 Likewise.
455
057ead22
ILT
4562008-07-23 Ian Lance Taylor <iant@google.com>
457
7f649c59
ILT
458 PR 6658
459 * object.h (Merged_symbol_value::value): Do our best to handle a
460 negative addend.
461
057ead22
ILT
462 PR 6647
463 * script.cc (Version_script_info::get_versions): Don't add empty
464 version tag to return value.
465 (Version_script_info::get_symbol_version_helper): Change return
466 type to bool. Add pversion parameter. Change all callers.
467 (script_register_vers_node): Don't require a non-NULL tag.
468 * script.h (class Version_script_info): Update declarations.
469 (Version_script_info::get_symbol_version): Change return type to
470 bool. Add version parameter. Change all callers.
471 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
472 handling. Handle an empty version from a version script.
473 (Symbol_table::define_special_symbol): Likewise.
474 * testsuite/ver_test_10.script: New file.
475 * testsuite/ver_test_10.sh: New file.
476 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
477 (check_DATA): Add ver_test_10.syms.
478 (ver_test_10.syms, ver_test_10.so): New target.
479 * testsuite/Makefile.in: Rebuild.
480
58e54ac2
CD
4812008-07-23 Simon Baldwin <simonb@google.com>
482
483 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
484 to zero for undefined symbols from dynamic libraries.
485
95d14cd3
ILT
4862008-07-23 Ian Lance Taylor <iant@google.com>
487
488 * symtab.cc (Symbol_table::resolve): Remove version parameter.
489 Change all callers.
490 * symtab.h (class Symbol_table): Update declaration.
491 * testsuite/ver_test_9.cc: New file.
492 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
493 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
494 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
495 (ver_test_9.so, ver_test_9.o): New targets.
496 * testsuite/Makefile.in: Rebuild.
497
92de84a6
ILT
4982008-07-22 Ian Lance Taylor <iant@google.com>
499
34810851
ILT
500 * options.h (class General_options): Define --check-sections.
501 * layout.cc (Layout::set_segment_offsets): Handle
502 --check-sections.
503
af6156ef
ILT
504 * options.h (class General_options): Define -n/--nmagic and
505 -N/--omagic.
506 * options.cc (General_options::finalize): For -n/--nmagic or
507 -N/--omagic, set -static.
508 * layout.cc (Layout::attach_allocated_section_to_segment): If
509 -N/--omagic, don't put read-only and read-write sections in
510 different segments.
511 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
512 finding a read-only segment.
513 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
514 don't set the minimum segment alignment to the common page size,
515 and don't set the file offset to the address modulo the page size.
516 * script-sections.cc (Script_sections::create_segments): If
517 -n/--omagic, don't put read-only and read-write sections in
518 different segments.
519
92de84a6
ILT
520 * cref.cc: New file.
521 * cref.h: New file.
522 * options.h (class General_options): Add --print-symbol-counts.
523 * main.cc (main): Issue defined symbol report if requested.
524 * archive.cc (Archive::interpret_header): Make into a const member
525 function.
526 (Archive::add_symbols): Call Input_objects::archive_start and
527 archive_stop.
528 (Archive::const_iterator): Define new class.
529 (Archive::begin, Archive::end): New functions.
530 (Archive::include_all_members): Rewrite to use iterator.
531 (Archive::count_members): New function.
532 * archive.h (class Archive): Update declarations.
533 (Archive::filename): New function.
534 * object.cc: Include "cref.h".
535 (Sized_relobj::Sized_relobj): Initialize defined_count_.
536 (Sized_relobj::do_get_global_symbol_counts): New function.
537 (Input_objects::add_object): Add object to cross-referencer.
538 (Input_objects::archive_start): New function.
539 (Input_objects::archive_stop): New function.
540 (Input_objects::print_symbol_counts): New function.
541 * object.h: Declare Cref and Archive.
542 (Object::get_global_symbol_counts): New function.
543 (Object::do_get_global_symbol_counts): New pure virtual function.
544 (class Sized_relobj): Add defined_count_ field. Update
545 declarations.
546 (class Input_objects): Add cref_ field. Update constructor.
547 Update declarations.
548 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
549 defined_count_.
550 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
551 symbol counts.
552 (Sized_dynobj::do_get_global_symbol_counts): New function.
553 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
554 defined_count_. Update declarations. Define Symbols typedef.
555 * symtab.cc (Symbol_table::add_from_relobj): Add defined
556 parameter. Change all callers.
557 (Symbol_table::add_from_dynobj): Add sympointers and defined
558 parameters. Change all callers.
559 * symtab.h (class Symbol_table): Update declarations.
560 * Makefile.am (CCFILES): Add cref.cc.
561 (HFILES): Add cref.h.
562 * Makefile.in: Rebuild.
563
3f7c5e1d
CD
5642008-07-22 Simon Baldwin <simonb@google.com>
565
566 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
567 to zero when writing undefined symbols.
568
e0b64032
ILT
5692008-07-22 Ian Lance Taylor <iant@google.com>
570
571 * output.cc (Output_section::add_input_section): Don't try to
572 merge empty merge sections.
573
096b02cf
CS
5742008-07-21 Craig Silverstein <csilvers@google.com>
575
576 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
577 Include symbol version in error message.
578
1d1f116d
CD
5792008-07-20 Chris Demetriou <cgd@google.com>
580
581 * configure.ac (gold_cv_c_random_seed): New configured variable.
582 (RANDOM_SEED_CFLAGS): New substituted variable.
583 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
584 * configure: Rebuild.
585 * Makefile.in: Likewise.
586 * testsuite/Makefile.in: Likewise.
587
a18f591e
ILT
5882008-07-18 Ian Lance Taylor <iant@google.com>
589
590 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
591 where we see NAME/NULL and NAME/VERSION as separate symbols.
592 * testsuite/ver_test_main.cc (main): Call t4.
593 (t4, t4_2a): Define.
594 * testsuite/ver_test_2.cc (t4_2): Define.
595 * testsuite/ver_test_2.script: Put t4_2a in VER2.
596 * testsuite/ver_test_4.cc (t4_2a): Define.
597 * testsuite/ver_test_4.script: Put t4_2a in VER2.
598 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
599
c6e3f6ed
ILT
6002008-07-17 Ian Lance Taylor <iant@google.com>
601
602 * dynobj.cc (Versions::add_def): If we give an error about a
603 missing version, go ahead and create the version anyhow.
604
ef9beddf
ILT
6052008-07-10 Ian Lance Taylor <iant@google.com>
606
607 Handle output sections with more than 0x7fffffff bytes.
608 * object.h (class Relobj): Change map_to_output_ to
609 output_sections_, and just keep a section pointer. Change all
610 uses. Move comdat group support to Sized_relobj.
611 (Relobj::is_section_specially_mapped): Remove.
612 (Relobj::output_section): Remove poff parameter. Change all
613 callers.
614 (Relobj::output_section_offset): New function.
615 (Relobj::set_section_offset): Rewrite.
616 (Relobj::map_to_output): Remove.
617 (Relobj::output_sections): New function.
618 (Relobj::do_output_section_offset): New pure virtual function.
619 (Relobj::do_set_section_offset): Likewise.
620 (class Sized_relobj): Add section_offsets_ field. Add comdat
621 group support from Relobj. Update declarations.
622 (Sized_relobj::get_output_section_offset): New function.
623 (Sized_relobj::do_output_section_offset): New function.
624 (Sized_relobj::do_set_section_offset): New function.
625 * object.cc (Relobj::output_section_address): Remove.
626 (Sized_relobj::Sized_relobj): Initialize new fields.
627 (Sized_relobj::include_section_group): Cast find_kept_object to
628 Sized_relobj.
629 (Sized_relobj::include_linkonce_section): Likewise.
630 (Sized_relobj::do_layout): Use separate arrays for output section
631 and output offset.
632 (Sized_relobj::do_count_local_symbols): Change map_to_output to
633 output_sections.
634 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
635 output_sections and section_offsets.
636 (Sized_relobj::write_local_symbols): Likewise.
637 (map_to_kept_section): Compute output address directly.
638 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
639 output_sections and section_offsets.
640 (Sized_relobj::write_sections): Likewise.
641 (Sized_relobj::relocate_sections): Likewise.
642 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
643 * output.h (class Output_reloc): Update declarations. Change
644 u2_.relobj to Sized_relobj*.
645 (class Output_data_reloc): Change add functions to use
646 Sized_relobj*.
647 * output.cc (Output_reloc::Output_reloc): Change relobj to
648 Sized_relobj*.
649 (Output_reloc::local_section_offset): Change return type to
650 Elf_Addr. Use get_output_section_offset.
651 (Output_reloc::get_address): Likewise.
652 (Output_section::is_input_address_mapped): Don't call
653 is_section_specially_mapped.
654 (Output_section::output_offset): Likewise.
655 (Output_section::output_address): Likewise.
656 (Output_section::starting_output_address): Likewise.
657 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
658 parameter to Sized_relobj*.
659 (Copy_relocs::need_copy_reloc): Likewise.
660 (Copy_relocs::save): Likewise.
661 * copy-relocs.h (class Copy_relocs): Update declarations.
662 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
663 Sized_relobj*. Change relobj_ field to Sized_relobj*.
664 * target-reloc.h (relocate_for_relocatable): Change
665 offset_in_output_section type to Elf_Addr. Change code that uses
666 it as well.
667 * layout.cc (Layout::layout): Always set *off.
668 * mapfile.cc (Mapfile::print_input_section): Use
669 output_section_offset.
670 * i386.cc (Target_i386::copy_reloc): Change object parameter to
671 Sized_relobj*.
672 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
673 * sparc.cc (Target_sparc::copy_reloc): Likewise.
674 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
675
5cb66f97
ILT
6762008-07-03 Ian Lance Taylor <iant@google.com>
677
678 * layout.cc (Layout::include_section): Do not discard unrecognized
679 SHT_STRTAB sections.
680
afe47622
CS
6812008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
682
683 * script.cc (Lex::can_continue_name): Make '?' allowable in
684 version-script names.
685 * testsuite/version_script.map: Change glob pattern to use '?'
686
5adf9721
ILT
6872008-06-30 Manish Singh <yosh@gimp.org>
688
689 PR 6585
690 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
691 Correct typo.
692
e6fde208
ILT
6932008-06-30 Ian Lance Taylor <iant@google.com>
694
695 PR 6660
696 PR 6682
697 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
698 versions]: Don't try to read the value in the contents, since we
699 don't use it. Use the template endianness when writing.
700
3f2e6a2d
CC
7012008-06-25 Cary Coutant <ccoutant@google.com>
702
703 * fileread.cc (File_read::make_view): Assert on zero-length view.
704 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
705 symbol table when there are no symbols to read.
706
c43d3a48
CS
7072008-06-23 Craig Silverstein <csilvers@google.com>
708
709 * version.cc (version_string): Bump to 1.7
710
5f494ea0
CS
7112008-06-18 Craig Silverstein <csilvers@google.com>
712
713 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
714 constant 0xFFFF to type Valtype.
715 (Powerpc_relocate_functions::rel16_ha): Likewise.
716
c42e122e
ILT
7172008-06-17 Ian Lance Taylor <iant@google.com>
718
f34787f8
ILT
719 * output.h (Output_section::Input_section): Initialize p2align_ to
720 zero for Output_section_data constructors.
721 (Output_section::Input_section::addralign): If not an input
722 section, return the alignment of the Output_section_data.
723 * testsuite/copy_test.cc: New file.
724 * testsuite/copy_test_1.cc: New file.
725 * testsuite/copy_test_2.cc: New file.
726 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
727 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
728 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
729 (copy_test_1_pic.o, copy_test_1.so): New targets.
730 (copy_test_2_pic.o, copy_test_2.so): New targets.
731 * testsuite/Makefile.in: Rebuild.
732
c42e122e
ILT
733 * script-sections.cc (Script_sections::place_orphan): Initialize
734 local variable exact.
735
ce3ac18a
DE
7362008-06-13 David Edelsohn <edelsohn@gnu.org>
737
738 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
739
42cacb20
DE
7402008-06-12 David Edelsohn <edelsohn@gnu.org>
741 David S. Miller <davem@davemloft.net>
742
743 * powerpc.cc: New file.
744 * Makefile.am (TARGETSOURCES): Add powerpc.cc
745 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
746 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
747 * Makefile.in: Rebuild.
748
7b308235
ILT
7492008-06-09 Ian Lance Taylor <iant@google.com>
750
751 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
752 <exception>.
753 (throwing, orig_terminate): New static variables.
754 (terminate_handler): New static function.
755 (t2): Set terminate handler.
756
f0b886e3
ILT
7572008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
758
759 PR 6584
760 * binary.cc (Binary_to_elf::sized_convert): Fix .data
761 alignment.
762
3e90f135
CC
7632008-05-30 Cary Coutant <ccoutant@google.com>
764
765 * archive.cc (Archive::include_all_members) Correct to step
766 over symbol table and extended name table in thin archives.
767
e09ad04a
ILT
7682008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
769
770 PR 6407
771 * target-reloc.h (relocate_for_relocatable): Fix new_offset
772 calculation.
773
62b01cb5
ILT
7742008-05-28 Caleb Howe <cshowe@google.com>
775
776 * reduced_debug_output.cc: New file.
777 * reduced_debug_output.h: New file.
92de84a6 778 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
779 * options.cc (General_options::finalize): Add strip_debug_non_line
780 to the strip heirarchy.
781 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
782 fields.
783 * layout.cc: Include "reduced_debug_output.h".
784 (Layout::Layout): Initialize new fields.
785 (line_only_debug_sections): New static array.
786 (is_lines_only_debug_sections): New static inline function.
787 (Layout::include_section): Handle --strip-debug-non-line.
788 (Layout::make_output_section): If --strip-debug-non-line, build
789 new output sections for .debug_abbrev and .debug_info.
790 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
791 gold. Warn about possible overflow.
792 (read_signed_LEB_128): Likewise.
793 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
794 (read_signed_LEB_128): Declare.
795 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
796 (HFILES): Add reduced_debug_output.h.
797 * Makefile.in: Rebuild.
798
7d9e3d98
ILT
7992008-05-21 Ian Lance Taylor <iant@google.com>
800
801 * mapfile.cc: New file.
802 * mapfile.h: New file.
803 * options.h (class General_options): Add -M/--print-map and -Map.
804 * options.cc (General_options::finalize): Make -M equivalent to
805 -Map -.
806 * main.cc: Include <cstdio> and "mapfile.h".
807 (main): Open mapfile if requested.
808 * gold.cc (class Middle_runner): Add mapfile_ field. Update
809 constructor. Change caller.
810 (queue_initial_tasks): Add mapfile parameter. Change caller.
811 (queue_middle_tasks): Likewise.
812 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
813 declarations.
814 * archive.cc: Include "mapfile.h".
815 (Archive::add_symbols): Add mapfile parameter. Change all
816 callers. Pass mapfile, symbol, and reason to include_member.
817 (Archive::include_all_members): Add mapfile parameter. Change all
818 callers.
819 (Archive::include_member): Add mapfile, sym, and why parameters.
820 Change all callers. Report inclusion to map file.
821 * archive.h: Include "fileread.h".
822 (class Archive): Update declarations.
823 (Archive::file): New const method.
824 (class Add_archive_symbols): Add mapfile_ field. Update
825 constructor. Change all callers.
826 * readsyms.h (class Read_symbols): Likewise.
827 (class Finish_group): Likewise.
828 (class Read_script): Likewise.
829 * common.cc: Include "mapfile.h".
830 (Symbol_table::allocate_commons): Add mapfile parameter. Change
831 all callers.
832 (Symbol_table::do_allocate_commons): Likewise.
833 (Symbol_table::do_allocate_commons_list): Likewise. Report common
834 symbol allocation to mapfile.
835 * common.h (class Allocate_commons_task): Add mapfile_ field.
836 Update constructor. Change all callers.
837 * symtab.h (class Symbol_table): Update declarations.
838 * layout.cc: Include "mapfile.h".
839 (Layout_task_runner::run): Print information to mapfile.
840 (Layout::create_gold_note): Change Output_data_fixed_space to
841 Output_data_zero_fill.
842 (Layout::create_build_id): Likewise.
843 (Layout::print_to_mapfile): New function.
844 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
845 constructor. Change caller.
846 (class Layout): Declare print_to_mapfile.
847 * output.cc (Output_section::Input_section::print_to_mapfile): New
848 function.
849 (Output_section::add_input_section): If producing a map, always
850 add to input_sections_ list.
851 (Output_section::do_print_to_mapfile): New function.
852 (Output_segment::print_sections_to_mapfile): New function.
853 (Output_segment::print_section_list_to_mapfile): New function.
854 * output.h: Include "mapfile.h".
855 (Output_data::print_to_mapfile): New function.
856 (Output_data::do_print_to_mapfile): New virtual function.
857 (Output_segment_headers::do_print_to_mapfile): New function.
858 (Output_file_header::do_print_to_mapfile): New function.
859 (Output_data_const::do_print_to_mapfile): New function.
860 (class Output_data_const_buffer): Add map_name_ field. Update
861 constructor. Change all callers. Add do_print_to_mapfile
862 function.
863 (class Output_data_fixed_space): Likewise.
864 (class Output_data_space): Likewise.
865 (class Output_data_zero_fill): New class.
866 (Output_data_strtab::do_print_to_mapfile): New function.
867 (Output_data_reloc_base::do_print_to_mapfile): New function.
868 (Output_relocatable_relocs::do_print_to_mapfile): New function.
869 (Output_data_group::do_print_to_mapfile): New function.
870 (Output_data_got::do_print_to_mapfile): New function.
871 (Output_data_dynamic::do_print_to_mapfile): New function.
872 (Output_symtab_xindex::do_print_to_mapfile): New function.
873 (class Output_section): Declare do_print_to_mapflie. Declare
874 print_to_mapfile in Input_section.
875 (class Output_segment): Declare new functions.
876 * object.h (Sized_relobj::symbol_count): New function.
877 * script-sections.cc
878 (Output_section_element_dot_assignment::set_section_addresses):
879 Change Output_data_fixed_space to Output_data_zero_fill.
880 (Output_data_expression::do_print_to_mapfile): New function.
881 * script.cc (read_input_script): Add mapfile parameter. Change
882 all callers.
883 * script.h (read_input_script): Update declaration.
884 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
885 (Eh_frame::do_print_to_mapfile): New function.
886 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
887 (Output_merge_string::do_print_to_mapfile): New function.
888 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
889 function.
890 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
891 function.
892 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
893 function.
894 * Makefile.am (CCFILES): Add mapfile.cc.
895 (HFILES): Add mapfile.h.
896 * Makefile.in: Rebuild.
897
9f1d377b
ILT
8982008-05-19 Ian Lance Taylor <iant@google.com>
899
900 * options.h (class General_options): Add -z relro.
901 * layout.cc (Layout::Layout): Initialize relro_segment_.
902 (Layout::add_output_section_data): Return the output section.
903 (Layout::make_output_section): Rcognize relro sections and mark
904 them appropriately.
905 (Layout::attach_allocated_section_to_segment): Put relro sections
906 in a PT_GNU_RELRO segment.
907 (Layout::create_initial_dynamic_sections): Mark the .dynamic
908 section as relro.
909 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
910 PT_TLS segments.
911 (Layout::linkonce_mapping): Map d.rel.ro.local to
912 .data.rel.ro.local.
913 (Layout::output_section_name): Us .data.rel.ro.local for any
914 section which begins with that.
915 * layout.h (class Layout): Update add_output_section_data
916 declaration. Add relro_segment_ field.
917 * output.cc (Output_section::Output_section): Initialize is_relro_
918 and is_relro_local_ fields.
919 (Output_segment::add_output_section): Group relro sections.
920 (Output_segment::is_first_section_relro): New function.
921 (Output_segment::maximum_alignment): If there is a relro section,
922 align the segment to the common page size.
923 (Output_segment::set_section_addresses): Track whether we are
924 looking at relro sections. If the last section is a relro
925 section, align to the common page size.
926 (Output_segment::set_section_list_addresses): Add in_relro
927 parameter. Change all callers. Align to the page size when
928 moving from relro to non-relro section.
929 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
930 segment.
931 * output.h (class Output_section): Add is_relro_ and
932 is_relro_local_ fields.
933 (Output_section::is_relro): New function.
934 (Output_section::set_is_relro): New function.
935 (Output_section::is_relro_local): New function.
936 (Output_section::set_is_relro_local): New function.
937 (class Output_segment): Update declarations.
938 * i386.cc (Target_i386::got_section): Mark .got section as relro.
939 * sparc.cc (Target_sparc::got_section): Likewise.
940 * x86_64.cc (Target_x86_64::got_section): Likewise.
941 * testsuite/relro_test_main.cc: New file.
942 * testsuite/relro_test.cc: New file.
943 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
944 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
945 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
946 (relro_test.so, relro_test_pic.o): New targets.
947 * testsuite/Makefile.in: Rebuild.
948
a984ee1d
ILT
9492008-05-16 Ian Lance Taylor <iant@google.com>
950
01676dcd
ILT
951 * output.cc (Output_segment::add_output_section): Remove front
952 parameter.
953 * output.h (class Output_segment): Remove
954 add_initial_output_section and overloaded add_output_section.
955 Update declaration of remaining add_output_section.
956 * layout.cc (Layout::create_interp): Call add_output_section
957 rather than add_initial_output_section.
958 (Layout::finish_dynamic_section): Likewise.
959
497897f9
ILT
960 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
961 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
962 know the dynamic type.
963 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
964 field. Initialize it in constructor.
965 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
966 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
967 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
968 reloc.
969
a984ee1d
ILT
970 * output.cc (Output_reloc::get_address): Change return type to
971 Elf_Addr.
972 * output.h (class Output_reloc): Update get_address declaration.
973 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
974 for section addresses.
975
55ba0940
ILT
9762008-05-09 Ian Lance Taylor <iant@google.com>
977
978 PR 6493
979 * gold.cc (gold_nomem): Use return value of write.
980
75517b77
ILT
9812008-05-08 Ian Lance Taylor <iant@google.com>
982
983 * symtab.c (Symbol::init_base_output_data): Add version
984 parameter. Change all callers.
985 (Symbol::init_base_output_segment): Likewise.
986 (Symbol::init_base_constant): Likewise.
987 (Symbol::init_base_undefined): Likewise.
988 (Sized_symbol::init_output_data): Likewise.
989 (Sized_symbol::init_output_segment): Likewise.
990 (Sized_symbol::init_constant): Likewise.
991 (Sized_symbol::init_undefined): Likewise.
992 (Symbol_table::do_define_in_output_data): If the new symbol has a
993 version, mark it as the default.
994 (Symbol_table::do_define_in_output_segment): Likewise.
995 (Symbol_table::do_define_as_constant): Likewise.
996 * symtab.h (class Symbol): Update declarations.
997 (class Sized_symbol): Likewise.
998 * resolve.cc (Symbol::override_version): New function.
c42e122e 999 (Symbol::override_base): Call override_version.
75517b77
ILT
1000 (Symbol::override_base_with_special): Likewise.
1001 * testsuite/ver_script_8.script: New file.
1002 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
1003 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
1004 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
1005 (ver_test_8_1.so, ver_test_8_2.so): New targets.
1006
f1f70eae
ILT
10072008-05-06 Ian Lance Taylor <iant@google.com>
1008
f3e9c5c5
ILT
1009 PR 6049
1010 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
1011 functions.
1012 (class General_options): Remove existing --undefined, and add
1013 --no-undefined instead. Add new --undefined as synonym for -u.
1014 * archive.cc (Archive::add_symbols): Check whether symbol was
1015 named with -u.
1016 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
1017 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
1018 all uses. Add IS_UNDEFINED. Update declarations to split
1019 different versions of init_base. Declare init_base_undefined.
1020 (Symbol::is_defined): Handle IS_UNDEFINED.
1021 (Symbol::is_undefined): Likewise.
1022 (Symbol::is_weak_undefined): Call is_undefined.
1023 (Symbol::is_absolute): Handle IS_CONSTANT.
1024 (class Sized_symbol): Update declarations to split different
1025 versions of init. Declare init_undefined.
1026 (class Symbol_table): Declare new functions.
1027 * symtab.cc (Symbol::init_base_object): Rename from init_base.
1028 Change all callers.
1029 (Symbol::init_base_output_data): Likewise.
1030 (Symbol::init_base_output_segment): Likewise.
1031 (Symbol::init_base_constant): Likewise.
1032 (Symbol::init_base_undefined): New function.
1033 (Sized_symbol::init_object): Rename from init. Change all
1034 callers.
1035 (Sized_symbol::init_output_data): Likewise.
1036 (Sized_symbol::init_output_segment): Likewise.
1037 (Sized_symbol::init_constant): Likewise.
1038 (Sized_symbol::init_undefined): New function.
1039 (Symbol_table::add_undefined_symbols_from_command_line): New
1040 function.
1041 (Symbol_table::do_add_undefined_symbols_from_command_line): New
1042 function.
1043 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
1044 (Symbol::output_section): Likewise.
1045 (Symbol::set_output_section): Likewise.
1046 (Symbol_table::sized_finalize_symbol): Likewise.
1047 (Symbol_table::sized_write_globals): Likewise.
1048 * resolve.cc (Symbol_table::should_override): Likewise.
1049 (Symbol::override_base_with_special): Likewise.
1050
8bdcdf2c
ILT
1051 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
1052 symbol, change it to have default visibility.
1053 * testsuite/protected_1.cc: New file.
1054 * testsuite/protected_2.cc: New file.
1055 * testsuite/protected_3.cc: New file.
1056 * testsuite/protected_main_1.cc: New file.
1057 * testsuite/protected_main_2.cc: New file.
1058 * testsuite/protected_main_3.cc: New file.
1059 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
1060 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
1061 (protected_1_LDFLAGS, protected_1_LDADD): Define.
1062 (protected_1.so): New target.
1063 (protected_1_pic.o, protected_2_pic.o): New targets.
1064 (protected_3_pic.o): New target.
1065 (check_PROGRAMS): Add protected_2.
1066 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
1067 (protected_2_LDFLAGS, protected_2_LDADD): Define.
1068 * testsuite/Makefile.in: Rebuild.
1069
2b706932
ILT
1070 * options.h (DEFINE_var): Add set_user_set_##varname__.
1071 (DEFINE_bool_alias): New macro.
1072 (class General_options): Define -Bstatic using DEFINE_bool_alias
1073 rather than DEFINE_special. Add --undefined as an alias for -z
1074 defs.
1075 * options.cc (General_options::parse_Bstatic): Remove.
1076
d82a5bcc
ILT
1077 * options.h (class General_options): Add --fatal-warnings.
1078 * main.cc (main): Implement --fatal-warnings.
1079 * errors.h (Errors::warning_count): New function.
1080
f1f70eae
ILT
1081 * options.h (class General_options): Add -Bsymbolic-functions.
1082 * symtab.h (Symbol::is_preemptible): Check for
1083 -Bsymbolic-functions.
1084
8825ac63
ILT
10852008-05-05 Ian Lance Taylor <iant@google.com>
1086
d98bc257
ILT
1087 * options.h (DEFINE_bool): For DASH_Z, create the negative option
1088 as noVARNAME rather than no-VARNAME.
1089 (class General_options): Add option -z combreloc.
1090 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
1091 get_address.
1092 (Output_reloc::sort_before) [SHT_REL]: New function.
1093 (Output_reloc::sort_before) [SHT_RELA]: New function.
1094 (class Output_data_reloc_base): Add sort_relocs_ field. Define
1095 Sort_relocs_comparison.
1096 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
1097 parameter. Change all callers.
1098 (Output_data_reloc::Output_data_reloc) [both versions]: Add
1099 sort_relocs parameter. Change all callers.
1100 * output.cc (Output_reloc::get_address): New function, broken out
1101 of write_rel.
1102 (Output_reloc::write_rel): Call it.
1103 (Output_reloc::compare): New function.
1104 (Output_data_reloc_base::do_write): Optionally sort relocs.
1105
60b2b4e7
ILT
1106 * configure.ac: If targ_extra_obj is set, link it in.
1107 * configure.tgt: Initialize all variables.
1108 (x86_64*): Set targ_extra_obj and targ_extra_size.
1109 * configure: Rebuild.
1110
8825ac63
ILT
1111 * object.cc (Sized_relobj::include_section_group): Adjust section
1112 indexes read from group data. Build vector to pass to
1113 layout_group.
1114 * layout.cc (Layout::layout_group): Add flags and shndxes
1115 parameters. Remove contents parameter. Change caller. Update
1116 explicit instantiations.
1117 * layout.h (class Layout): Update layout_group declaration.
1118 * output.cc (Output_data_group::Output_data_group): Add flags and
1119 input_shndxes parameters. Remove contents parameter. Change
1120 caller.
1121 (Output_data_group::do_write): Change input_sections_ to
1122 input_shndxes_.
1123 * output.h (class Output_data_group): Update constructor
1124 declaration. Rename input_sections_ to input_shndxes_.
1125 * testsuite/many_sections_test.cc: Add template.
1126
e94cf127
CC
11272008-04-30 Cary Coutant <ccoutant@google.com>
1128
4418b2d5
CC
1129 * target-reloc.h (relocate_section): Fix dead-pointer bug.
1130
e94cf127
CC
1131 * layout.cc (Layout::include_section): Refactored check for debug
1132 info section.
1133 (Layout::add_comdat): Add new parameters. Change type
1134 of signature parameter. Add object and shndx to signatures table.
1135 (Layout::find_kept_object): New function.
1136 * layout.h: Include <cstring>.
1137 (Layout::is_debug_info_section): New function.
1138 (Layout::add_comdat): Add new parameters.
1139 (Layout::find_kept_object): New function.
1140 (Layout::Kept_section): New struct.
1141 (Layout::Signatures): Change type of map range.
1142 * object.cc (Relobj::output_section_address): New function.
1143 (Sized_relobj::include_section_group): Add new parameters. Change
1144 calls to Layout::add_comdat. Change to build table of kept comdat
1145 groups and table mapping discarded sections to kept sections.
1146 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
1147 (Sized_relobj::do_layout): Change calls to include_section_group and
1148 include_linkonce_section.
1149 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
1150 value to zero when section is discarded.
1151 (Sized_relobj::map_to_kept_section): New function.
1152 * object.h (Relobj::output_section_address): New function.
1153 (Relobj::Comdat_group): New type.
1154 (Relobj::find_comdat_group): New function.
1155 (Relobj::Comdat_group_table): New type.
1156 (Relobj::Kept_comdat_section): New type.
1157 (Relobj::Kept_comdat_section_table): New type.
1158 (Relobj::add_comdat_group): New function.
1159 (Relobj::set_kept_comdat_section): New function.
1160 (Relobj::get_kept_comdat_section): New function.
1161 (Relobj::comdat_groups_): New field.
1162 (Relobj::kept_comdat_sections_): New field.
1163 (Symbol_value::input_value): Update comment.
1164 (Sized_relobj::map_to_kept_section) New function.
1165 (Sized_relobj::include_linkonce_section): Add new parameter.
1166 * target-reloc.h (Comdat_behavior): New type.
1167 (get_comdat_behavior): New function.
1168 (relocate_section): Add code to map a discarded section to the
1169 corresponding kept section when applying a relocation.
1170
e4e5049b
CS
11712008-04-30 Craig Silverstein <csilvers@google.com>
1172
1173 * dwarf_reader.cc (next_generation_count): New static var.
1174 (Addr2line_cache_entry): New struct.
1175 (addr2line_cache): New static var.
1176 (Dwarf_line_info::one_addr2line): Added caching.
1177 (Dwarf_line_info::clear_addr2line_cache): New function.
1178 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
1179 cache-size parameter.
1180 (Dwarf_line_info::one_addr2line_cache): New function.
1181 * symtab.cc (Symbol_table::detect_odr_violations): Pass
1182 new cache-size argument to one_addr2line(), and clear cache.
1183
d09e9154
CC
11842008-04-28 Cary Coutant <ccoutant@google.com>
1185
1186 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
1187 R_386_PC8 relocations.
1188
7ef73768
ILT
11892008-04-23 Ian Lance Taylor <iant@google.com>
1190
55438702
ILT
1191 * object.cc (Sized_relobj::include_section_group): Check for
1192 invalid section group.
1193
c165fb93
ILT
1194 * object.cc (make_elf_object): Correct test for 64-bit ELF file
1195 header size.
1196
7ef73768
ILT
1197 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
1198 than read for file header.
1199 * archive.cc (Archive::include_member): Likewise.
1200
6194aaab
L
12012008-04-23 Paolo Bonzini <bonzini@gnu.org>
1202
1203 * aclocal.m4: Regenerate.
1204 * configure: Regenerate.
1205
d491d34e
ILT
12062008-04-19 Ian Lance Taylor <iant@google.com>
1207
5ea2bac6
ILT
1208 * version.cc (version_string): Bump to 1.6.
1209
7bc3e21a
ILT
1210 * testsuite/Makefile.am (many_sections_r_test): New target.
1211 (many_sections_r_test_SOURCES): Remove.
1212 (many_sections_r_test_DEPENDENCIES): Remove.
1213 (many_sections_r_test_LDFLAGS): Remove.
1214 (many_sections_r_test_LDADD): Remove.
1215
7fcd3aa9
ILT
1216 * object.cc (Sized_relobj::do_add_symbols): Always pass
1217 local_symbol_count_ to add_from_relobj.
1218
4c94d6ae
ILT
1219 * testsuite/Makefile.am (many_sections_check.h): Only check one in
1220 every thousand variables.
1221 * testsuite/Makefile.in: Rebuild.
1222
d491d34e
ILT
1223 * object.cc (Xindex::initialize_symtab_xindex): New function.
1224 (Xindex::read_symtab_xindex): New function.
1225 (Xindex::sym_xindex_to_shndx): New function.
1226 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
1227 available.
1228 (Sized_relobj::do_initialize_xindex): New function.
1229 (Sized_relobj::do_read_symbols): Adjust section links.
1230 (Sized_relobj::symbol_section_and_value): Add is_ordinary
1231 parameter. Change all callers.
1232 (Sized_relobj::include_section_group): Adjust section links and
1233 symbol section indexes.
1234 (Sized_relobj::do_layout): Adjust section links.
1235 (Sized_relobj::do_count_local_symbols): Adjust section links and
1236 symbol section indexes.
1237 (Sized_relobj::do_finalize_local_symbols): Distinguish between
1238 ordinary and special symbols.
1239 (Sized_relobj::write_local_symbols): Add symtab_xindex and
1240 dynsym_xindex parameters. Change all callers. Adjust section
1241 links. Use SHN_XINDEX when needed.
1242 (Sized_relobj::get_symbol_location_info): Adjust section links.
1243 Don't get fooled by special symbols.
1244 * object.h (class Xindex): Define.
1245 (class Object): Add xindex_ parameter. Declare virtual functoin
1246 do_initialize_xindex.
1247 (Object::adjust_sym_shndx): New function.
1248 (Object::set_xindex): New protected function.
1249 (class Symbol_value): Add is_ordinary_shndx_ field.
1250 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1251 (Symbol_value::value): Assert ordinary section.
1252 (Symbol_value::initialize_input_to_output_map): Likewise.
1253 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1254 Change all callers.
1255 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
1256 all callers.
1257 (class Sized_relobj): Update declarations.
1258 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1259 parameter. Change all callers.
1260 (Sized_relobj::adjust_shndx): New function.
1261 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1262 field.
1263 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1264 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
1265 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
1266 (Sized_dynobj::read_dynsym_section): Adjust section links.
1267 (Sized_dynobj::read_dynamic): Likewise.
1268 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
1269 section links.
1270 (Sized_dynobj::do_initialize_xindex): New function.
1271 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
1272 do_initialize_xindex.
1273 (Sized_dynobj::adjust_shndx): New function.
1274 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1275 dynsym_xindex_ fields.
1276 (Layout::finalize): Add a call to set_section_indexes before
1277 creating the symtab sections.
1278 (Layout::set_section_indexes): Don't do anything if the section
1279 already has a section index.
1280 (Layout::create_symtab_sections): Add shnum parameter. Change
1281 caller. Create .symtab_shndx section if needed.
1282 (Layout::create_shdrs): Add shstrtab_section parameter. Change
1283 caller.
1284 (Layout::allocated_output_section_count): New function.
1285 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1286 needed.
1287 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1288 fields. Update declarations.
1289 (Layout::symtab_xindex): New function.
1290 (Layout::dynsym_xindex): New function.
1291 (class Write_symbols_task): Add layout_ field.
1292 (Write_symbols_task::Write_symbols_task): Add layout parameter.
1293 Change caller.
1294 * output.cc (Output_section_headers::Output_section_headers): Add
1295 shstrtab_section parameter. Change all callers.
1296 (Output_section_headers::do_sized_write): Store overflow values
1297 for section count and section string table section index in
1298 section header zero.
1299 (Output_file_header::do_sized_write): Check for overflow of
1300 section count and section string table section index.
1301 (Output_symtab_xindex::do_write): New function.
1302 (Output_symtab_xindex::endian_do_write): New function.
1303 * output.h (class Output_section_headers): Add shstrtab_section_.
1304 Update declarations.
1305 (class Output_symtab_xindex): Define.
1306 (Output_section::has_out_shndx): New function.
1307 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1308 field.
1309 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1310 Change all callers.
1311 (Sized_symbol::init): Likewise.
1312 (Symbol::output_section): Check for ordinary symbol.
1313 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
1314 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
1315 callers.
1316 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1317 Change all callers. Simplify handling of symbols from sections
1318 not included in the link.
1319 (Symbol_table::add_from_dynobj): Handle ordinary symbol
1320 distinction.
1321 (Weak_alias_sorter::operator()): Assert that symbols are
1322 ordinary.
1323 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1324 distinction.
1325 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1326 parameters. Change all callers.
1327 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
1328 symbol distinction. Use SHN_XINDEX when needed.
1329 (Symbol_table::write_section_symbol): Add symtab_xindex
1330 parameter. Change all callers.
1331 (Symbol_table::sized_write_section_symbol): Likewise. Use
1332 SHN_XINDEX when needed.
1333 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
1334 declarations.
1335 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
1336 (Symbol::is_defined): Check is_ordinary.
1337 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1338 (Symbol::is_absolute, Symbol::is_common): Likewise.
1339 (class Sized_symbol): Update declarations.
1340 (class Symbol_table): Update declarations.
1341 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1342 parameters. Change all callers.
1343 (Sized_symbol::override): Likewise.
1344 (Symbol_table::override): Likewise.
1345 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
1346 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
1347 is_ordinary, and orig_st_shndx parameters. Change all callers.
1348 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1349 to be in an ordinary section.
1350 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1351 object and is_ordinary parameters. Change all callers.
1352 (Sized_dwarf_line_info::read_relocs): Add object parameter.
1353 Change all callers. Don't add undefined or non-ordinary symbols
1354 to reloc_map_.
1355 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1356 Change all callers.
1357 * dwarf_reader.h (class Sized_dwarf_line_info): Update
1358 declarations.
1359 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1360 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1361 (Sized_relobj::relocate_sections): Likewise.
1362 * target-reloc.h (scan_relocs): Adjust section symbol index.
1363 (scan_relocatable_relocs): Likewise.
1364 * i386.cc (Scan::local): Check for ordinary symbols.
1365 * sparc.cc (Scan::local): Likewise.
1366 * x86_64.cc (Scan::local): Likewise.
1367 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1368 to symbol_section_and_value.
1369 * testsuite/many_sections_test.cc: New file.
1370 * testsuite/Makefile.am (BUILT_SOURCES): Define.
1371 (check_PROGRAMS): Add many_sections_test.
1372 (many_sections_test_SOURCES): Define.
1373 (many_sections_test_DEPENDENCIES): Define.
1374 (many_sections_test_LDFLAGS): Define.
1375 (BUILT_SOURCES): Add many_sections_define.h.
1376 (many_sections_define.h): New target.
1377 (BUILT_SOURCES): Add many_sections_check.h.
1378 (many_sections_check.h): New target.
1379 (check_PROGRAMS): Add many_sections_r_test.
1380 (many_sections_r_test_SOURCES): Define.
1381 (many_sections_r_test_DEPENDENCIES): Define.
1382 (many_sections_r_test_LDFLAGS): Define.
1383 (many_sections_r_test_LDADD): Define.
1384 (many_sections_r_test.o): New target.
1385 * testsuite/Makefile.in: Rebuild.
1386
c5818ff1
CC
13872008-04-17 Cary Coutant <ccoutant@google.com>
1388
1389 * errors.cc (Errors::info): New function.
1390 (gold_info): New function.
1391 * errors.h (Errors::info): New function.
1392 * gold.h (gold_info): New function.
1393 * object.cc (Input_objects::add_object): Print trace output.
1394 * options.cc (options::parse_set): New function.
1395 (General_options::parse_wrap): Deleted.
1396 (General_options::General_options): Deleted initializer.
1397 * options.h (options::String_set): New typedef.
1398 (options::parse_set): New function.
1399 (DEFINE_set): New macro.
1400 (General_options::wrap): Changed to use DEFINE_set. Changed
1401 callers of any_wrap_symbols and is_wrap_symbol.
1402 (General_options::trace, General_options::trace_symbol):
1403 New options.
1404 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1405 (General_options::wrap_symbols_): Deleted.
1406 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1407
b5be4a7c
DM
14082008-04-17 David S. Miller <davem@davemloft.net>
1409
1410 * options.cc (General_options::parse_V): New function.
1411 * options.h: Add entries for -V and -Qy.
1412
155a0dd7
ILT
14132008-04-17 Ian Lance Taylor <iant@google.com>
1414
1415 * common.cc (Symbol_table::allocate_commons): Remove options
1416 parameter. Change caller.
1417 (Symbol_table::do_allocate_commons): Remove options parameter.
1418 Change caller. Just call do_allocate_commons_list twice.
1419 (Symbol_table::do_allocate_commons_list): New function, broken out
1420 of do_allocate_commons.
1421 * common.h (class Allocate_commons_task): Remove options_ field.
1422 Update constructor.
1423 * symtab.cc (Symbol_table::Symbol_table): Initialize
1424 tls_commons_.
1425 (Symbol_table::add_from_object): Put TLS common symbols on
1426 tls_commons_ list.
1427 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1428 which are IN_OUTPUT_DATA.
1429 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1430 allocate_commons and do_allocate_commons declarations. Declare
1431 do_allocate_commons_list.
1432 * gold.cc (queue_middle_tasks): Update creation of
1433 Allocate_commons_task to not pass options.
1434 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1435 (TLS_TEST_C_FLAGS): New variable.
1436 (tls_test_c_pic.o): New target.
1437 (tls_test_shared.so): Link in tls_test_c_pic.o.
1438 (tls_test_c_pic_ie.o): New target.
1439 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1440 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1441 (tls_test_c.o): New target.
1442 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1443 (tls_pic_test_LDADD): Likewise.
1444 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1445 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1446 (tls_test_c_gnu2.o): New target.
1447 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1448 tls_test_c_gnu2.o.
1449 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1450 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1451 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1452 * testsuite/tls_test.cc: Include "config.h".
1453 (t_last): Call t11_last.
1454 * testsuite/tls_test.h (t11, t11_last): Declare.
1455 * testsuite/tls_test_c.c: New file.
1456 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1457 * configure.ac: Check for OpenMP support.
1458 * configure, config.in, Makefile.in: Rebuild.
1459 * testsuite/Makefile.in: Rebuild.
1460
edfbb029
CC
14612008-04-16 Cary Coutant <ccoutant@google.com>
1462
1463 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1464 (Target_i386::tls_base_symbol_defined_): New field.
1465 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1466 (Target_i386::Scan::global): Likewise.
1467 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1468 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1469 (Target_x86_64::tls_base_symbol_defined_): New field.
1470 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1471 (Target_x86_64::Scan::global): Likewise.
1472
f3c69fca
CC
14732008-04-16 Cary Coutant <ccoutant@google.com>
1474
1475 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1476 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1477 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1478 building shared libraries.
1479 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1480 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1481 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1482 * testsuite/Makefile.in: Rebuild.
1483 * testsuite/weak_undef.h: New file.
1484 * testsuite/weak_undef_file1.cc: Add extra test cases.
1485 * testsuite/weak_undef_file2.cc: Likewise.
1486 * testsuite/weak_undef_test.cc: Likewise.
1487
7c414435
DM
14882008-04-16 David S. Miller <davem@davemloft.net>
1489
32b769e1
DM
1490 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1491 Add issued_non_pic_error_ field. Declare check_non_pic.
1492 (Target_sparc::Scan::check_non_pic): New function.
1493 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1494 (Target_sparc::Scan::global): Likewise.
1495
11936fb1
DM
1496 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1497 * configure: Rebuild.
1498
7c414435
DM
1499 * options.h (DEFINE_enable): New macro.
1500 (new_dtags): New enable option.
1501 (initfirst, interpose, loadfltr, nodefaultlib,
1502 nodelete, nodlopen, nodump): New -z options.
1503 * layout.cc (Layout:finish_dynamic_section): If new
1504 dtags enabled, emit DT_RUNPATH. Also, emit a
1505 DT_FLAGS_1 containing any specified -z flags.
1506
85c7bf8b
ILT
15072008-04-16 Ian Lance Taylor <iant@google.com>
1508
12c0daef
ILT
1509 * copy-relocs.cc: New file.
1510 * copy-relocs.h: New file.
1511 * reloc.cc: Remove Copy_relocs code.
1512 * reloc.h: Likewise.
1513 * reloc-types.h (struct Reloc_types) [both versions]: Add
1514 get_reloc_addend_noerror.
1515 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1516 variants of add_global which take an addend which must be zero.
1517 * i386.cc: Include "copy-relocs.h".
1518 (class Target_i386): Change type of copy_relocs_ to variable,
1519 update initializer.
1520 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1521 Change all callers.
1522 (Target_i386::do_finalize_sections): Change handling of
1523 copy_relocs_.
1524 * sparc.cc: Include "copy-relocs.h".
1525 (class Target_sparc): Change type of copy_relocs_ to variable,
1526 update initializer.
1527 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1528 Change all callers.
1529 (Target_sparc::do_finalize_sections): Change handling of
1530 copy_relocs_.
1531 * x86_64.cc: Include "copy-relocs.h".
1532 (class Target_x86_64): Change type of copy_relocs_ to variable,
1533 update initializer.
1534 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1535 class. Change all callers.
1536 (Target_x86_64::do_finalize_sections): Change handling of
1537 copy_relocs_.
1538 * Makefile.am (CCFILES): Add copy-relocs.cc.
1539 (HFILES): Add copy-relocs.h.
1540
4f4995b6
ILT
1541 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1542
85c7bf8b
ILT
1543 * testsuite/script_test_4.sh: Permit leading zeroes.
1544
4f2a9edd
ILT
15452008-04-15 Ian Lance Taylor <iant@google.com>
1546
e6188289
ILT
1547 * script-sections.cc (Script_sections::create_segments): Use
1548 header_size_adjustment even when there is enough room for the
1549 headers.
1550 * testsuite/script_test_4.sh: New file.
1551 * testsuite/script_test_4.t: New file.
1552 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1553 (check_DATA): Add script_test_4.stdout.
1554 (MOSTLYCLEANFILES): Likewise.
1555 (script_test_4): New target.
1556 (script_test_4.stdout): New target.
1557 * testsuite/Makefile.in: Rebuild.
1558
4f2a9edd
ILT
1559 * sparc.cc: Add definitions for Output_data_plt_sparc class
1560 constants.
1561
f5314dd5
DM
15622008-04-14 David S. Miller <davem@davemloft.net>
1563
1564 * sparc.cc: New file.
1565 * Makefile.am (TARGETSOURCES): Add sparc.cc
1566 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1567 * configure.tgt: Document targ_extra_size and
1568 targ_extra_big_endian. Add entries for sparc-* and
1569 sparc64-*.
1570 * configure.ac: Handle targ_extra_size and
1571 targ_extra_big_endian.
1572 * Makefile.in: Rebuild.
1573 * configure: Likewise.
1574 * po/POTFILES.in: Likewise.
1575 * po/gold.pot: Likewise.
1576
154e0e9a
ILT
15772008-04-14 Ian Lance Taylor <iant@google.com>
1578
1579 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1580 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1581 in the name/type/flags to section mapping. Don't call
1582 allocate_output_section.
1583 (Layout::choose_output_section): Change parameter from adjust_name
1584 to is_input_section. Don't permit input sections after sections
1585 are attached to segments. Don't call allocate_output_section.
1586 (Layout::layout_eh_frame): Call update_flags_for_input_section,
1587 not write_enable_output_section.
1588 (Layout::make_output_section): Don't push to
1589 unattached_section_list_ nor call attach_to_segment. Call
1590 attach_section_to_segment if sections are attached.
1591 (Layout::attach_sections_to_segments): New function.
1592 (Layout::attach_section_to_segment): New function.
1593 (Layout::attach_allocated_section_to_segment): Rename from
1594 attach_to_segment. Remove flags parameter.
1595 (Layout::allocate_output_section): Remove function.
1596 (Layout::write_enable_output_section): Remove function.
1597 * layout.h (class Layout): Update for above changes. Add new
1598 field sections_are_attached_.
1599 * output.h (Output_section::update_flags_for_input_section): New
1600 function.
1601 * output.cc (Output_section::add_input_section): Call
1602 update_flags_for_input_section.
1603 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1604
009a67a2
CC
16052008-04-11 Cary Coutant <ccoutant@google.com>
1606
1607 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1608 thought unnecessary.
1609 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1610
759b1a24
ILT
16112008-04-11 Ian Lance Taylor <iant@google.com>
1612
1613 * output.h (class Output_section_data): Remove inline definition
1614 of set_addralign.
1615 * output.cc (Output_section_data::set_addralign): New function.
1616
c2b45e22
CC
16172008-04-11 Cary Coutant <ccoutant@google.com>
1618
1619 Add support for TLS descriptors for i386 and x86_64.
1620 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1621 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1622 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1623 GOT_TYPE_TLS_DESC.
1624 (Target_i386::got_mod_index_entry): Remove unnecessary code.
1625 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1626 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
1627 relocations.
1628 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1629 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1630 Fix problem with initial-exec relocations.
1631 (Target_i386::Relocate::relocate_tls): Likewise.
1632 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1633 relaxation.
1634 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1635 support for section-plus-offset dynamic table entries.
1636 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1637 (Output_data_dynamic::Dynamic_entry): Add support for
1638 section-plus-offset dynamic table entries.
1639 (Output_data_dynamic::Classification): Likewise.
1640 (Output_data_dynamic::classification_): Renamed offset_.
1641 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1642 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1643 (Target_x86_64::make_plt_section): New function.
1644 (Target_x86_64::reserve_tlsdesc_entries): New function.
1645 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1646 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1647 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1648 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1649 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1650 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1651 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1652 add extra PLT entry for TLS descriptors.
1653 (Output_data_plt_x86_64::got_): New field.
1654 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1655 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1656 fields.
1657 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1658 descriptors.
1659 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1660 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1661 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1662 R_386_TLS_DESC_CALL relocations.
1663 (Target_x86_64::Scan::global): Likewise.
1664 (Target_x86_64::do_finalize_sections): Add dynamic table entries
1665 for TLS descriptors.
1666 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1667 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1668 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1669 GD-to-IE relaxation.
1670 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1671 and TLS_DESCRIPTORS.
1672 * Makefile.in: Rebuild.
1673 * configure: Rebuild.
1674 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1675 (tls_test_shared2.so): New target.
1676 (tls_shared_gd_to_ie_test_SOURCES): New variable.
1677 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1678 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1679 (tls_shared_gd_to_ie_test_LDADD): New variable.
1680 (tls_shared_gnu2_gd_to_ie_test): New target.
1681 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1682 New targets.
1683 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1684 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1685 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1686 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1687 (tls_shared_gnu2_test): New target.
1688 (tls_test_gnu2_shared.so): New target.
1689 (tls_shared_gnu2_test_SOURCES): New variable.
1690 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1691 (tls_shared_gnu2_test_LDFLAGS): New variable.
1692 (tls_shared_gnu2_test_LDADD): New variable.
1693 * testsuite/Makefile.in: Rebuild.
1694 * testsuite/Makefile.
1695
83bfb6b7
ILT
16962008-04-11 Ian Lance Taylor <iant@google.com>
1697
1698 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1699 justsyms.t.
1700 * testsuite/Makefile.in: Rebuild.
1701
1702 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1703 long.
1704 * testsuite/script_test_2.cc (main): Adjust test.
1705
706e1f5e
ILT
17062008-04-11 David S. Miller <davem@davemloft.net>
1707 Ian Lance Taylor <iant@google.com>
1708
1709 * options.h (General_options): Add entries for '-Y' and
1710 '-relax'.
1711 * options.cc (General_options:finalize): If -Y was used, add those
1712 entries to the library path instead of the default "/lib" and
1713 "/usr/lib".
1714
7c98e6bb
DM
17152008-04-11 David S. Miller <davem@davemloft.net>
1716
1717 * testsuite/justsyms.t: Start at 0x100.
1718 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
1719 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1720 long.
1721 * testsuite/script_test_2.cc: Adjust string and section length
1722 checks.
7c98e6bb 1723
99a37bfd
ILT
17242008-04-09 Ian Lance Taylor <iant@google.com>
1725
2cefc357
ILT
1726 PR gold/5996
1727 * script-sections.cc (Sections_element::allocate_to_segment): Add
1728 orphan parameter.
1729 (Output_section_definition::allocate_to_segment): Likewise.
1730 (Orphan_output_section::allocate_to_segment): Likewise.
1731 (Script_sections::attach_sections_using_phdrs_clause): Don't
1732 propagate non-PT_LOAD segments to orphan sections.
1733 * testsuite/Makefile.am (script_test_3.stdout): Generate using
1734 readelf rather than objdump.
1735 * testsuite/script_test_3.sh: Adjust accordingly. Test that
1736 .interp section and PT_INTERP segment are the same size.
1737 * testsuite/Makefile.in: Rebuild.
1738
99a37bfd
ILT
1739 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1740 aliases for symbols defined in the same object.
1741 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1742 (weak_alias_test_SOURCES): New variable.
1743 (weak_alias_test_DEPENDENCIES): New variable.
1744 (weak_alias_test_LDFLAGS): New variable.
1745 (weak_alias_test_LDADD): New variable.
1746 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1747 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1748 (weak_alias_test_3.o): New target.
1749 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1750 * testsuite/weak_alias_test_main.cc: New file.
1751 * testsuite/weak_alias_test_1.cc: New file.
1752 * testsuite/weak_alias_test_2.cc: New file.
1753 * testsuite/weak_alias_test_3.cc: New file.
1754
780e49c5
ILT
17552008-04-08 Ian Lance Taylor <iant@google.com>
1756
cdb0b8f5
ILT
1757 * options.h (class General_options): Add --noinhibit-exec option.
1758 * main.cc (main): Check --noinhibit-exec.
1759
0864d551
ILT
1760 * options.h (class General_options): Define --wrap as a special
1761 option. Add wrap_symbols_ field.
1762 (General_options::any_wrap_symbols): New function.
1763 (General_options::is_wrap_symbol): New function.
1764 * options.cc (General_options::parse_wrap): New function.
1765 (General_options::General_options): Initialize wrap_symbols_.
1766 * symtab.cc (Symbol_table::wrap_symbol): New function.
1767 (Symbol_table::add_from_object): Handle --wrap.
1768 * symtab.h (class Symbol_table): Declare wrap_symbol.
1769 * target.h (Target::wrap_char): New function.
1770 (Target::Target_info): Add wrap_char field.
1771 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1772 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1773 * testsuite/testfile.cc (Target_test::test_target_info):
1774 Likewise.
1775
789aa6de
ILT
1776 * errors.cc (Errors::undefined_symbol): Mention symbol version if
1777 there is one.
1778
2c38906f
ILT
1779 * layout.h (class Layout): Add added_eh_frame_data_ field.
1780 * layout.cc (Layout::Layout): Initialize new field.
1781 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1782 output section until we find a section we merged successfully.
1783 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1784 that the size be non-zero.
1785
780e49c5
ILT
1786 * merge.cc (Object_merge_map::get_output_offset): Remove inline
1787 qualifier.
1788
7fcd0256
ILT
17892008-04-08 Craig Silverstein <csilvers@google.com>
1790
1791 * configure.ac: Export new conditional variable HAVE_ZLIB.
1792 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1793 on HAVE_ZLIB.
1794 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1795 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1796
6835af53
ILT
17972008-04-07 Ian Lance Taylor <iant@google.com>
1798
e24f324c
ILT
1799 * version.cc (version_string): Set to "1.5".
1800
a036edd8
ILT
1801 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1802 Add issued_non_pic_error_ field. Declare check_non_pic.
1803 (Target_x86_64::Scan::check_non_pic): New function.
1804 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1805 (Target_x86_64::Scan::global): Likewise.
1806
624f8810
ILT
1807 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1808 addend parameter. Change caller. Handle merge sections.
1809 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1810 Address to Addend. Don't add in the result of
1811 local_section_offset, pass down the addend and use the returned
1812 value.
1813 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1814 Update declarations of local_section_offset and symbol_value.
1815 * testsuite/two_file_test_1.cc (t18): New function.
1816 * testsuite/two_file_test_2.cc (f18): New function.
1817 * testsuite/two_file_test_main.cc (main): Call t18.
1818 * testsuite/two_file_test.h (t18, f18): Declare.
1819
6835af53
ILT
1820 * configure.ac: Don't test for objdump, c++filt, or readelf.
1821 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1822 conditionals.
1823 (TEST_READELF): New variable.
1824 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1825 (check_PROGRAMS): Add two_file_strip_test.
1826 (two_file_strip_test): New target.
1827 (check_PROGRAMS): Add two_file_same_shared_strip_test.
1828 (two_file_same_shared_strip_test_SOURCES): New variable.
1829 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1830 (two_file_same_shared_strip_test_LDFLAGS): New variable.
1831 (two_file_same_shared_strip_test_LDADD): New variable.
1832 (two_file_shared_strip.so): New target.
1833 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1834 (ver_test_5.syms, ver_test_7.syms): Likewise.
1835 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1836 (strip_test_3.stdout): Use TEST_OBJDUMP.
1837 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1838
86925eef
CC
18392008-04-04 Cary Coutant <ccoutant@google.com>
1840
1841 * symtab.h (Symbol::is_weak_undefined): New function.
1842 (Symbol::is_strong_undefined): New function.
1843 (Symbol::is_absolute): New function.
1844 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1845 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1846 absolute symbols.
1847 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1848 (weak_undef_test): New target.
1849 * testsuite/Makefile.in: Rebuild.
1850 * testsuite/weak_undef_file1.cc: New file.
1851 * testsuite/weak_undef_file2.cc: New file.
1852 * testsuite/weak_undef_test.cc: New file.
1853
126f3ece
ILT
18542008-04-03 Craig Silverstein <csilvers@google.com>
1855
1856 * compressed_output.h (class Output_compressed_section): Use
1857 unsigned buffer.
1858 * compressed_output.cc (zlib_compress): Use unsigned buffers,
1859 add zlib header.
1860 (zlib_compressed_suffix): Removed.
1861 (Output_compressed_section::set_final_data_size): Use unsigned
1862 buffers.
1863 * testsuite/Makefile.am (flagstest_compress_debug_sections):
1864 Fix linker invocation.
1865 (flagstest_o_specialfile_and_compress_debug_sections):
1866 Likewise.
1867 * testsuite/Makefile.in: Regenerated.
1868
deae2a14
DM
18692008-04-02 David S. Miller <davem@davemloft.net>
1870
1871 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1872 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1873
70752818
ILT
18742008-04-02 Craig Silverstein <csilvers@google.com>
1875
1876 * TODO: New file.
1877
39d0cb0e
ILT
18782008-04-02 Ian Lance Taylor <iant@google.com>
1879
1880 * fileread.cc (File_read::find_view): Add byteshift and vshifted
1881 parameters. Update for new key type to views_. Change all
1882 callers.
1883 (File_read::read): Adjust for byteshift in returned view.
1884 (File_read::add_view): New function, broken out of
1885 find_and_make_view.
1886 (File_read::make_view): New function, broken out of
1887 find_and_make_view.
1888 (File_read::find_or_make_view): Add offset and aligned
1889 parameters. Rewrite accordingly. Change all callers.
1890 (File_read::get_view): Add offset and aligned parameters. Adjust
1891 for byteshift in return value.
1892 (File_read::get_lasting_view): Likewise.
1893 * fileread.h (class File_read): Update declarations.
1894 (class File_read::View): Add byteshift_ field. Add byteshift to
1895 constructor. Add byteshift method.
1896 * archive.h (Archive::clear_uncached_views): New function.
1897 (Archive::get_view): Add aligned parameter. Change all callers.
1898 * object.h (Object::get_view): Add aligned parameter. Change all
1899 callers.
1900 (Object::get_lasting_view): Likewise.
1901
1902 * fileread.cc (File_read::release): Don't call clear_views if
1903 there are multiple objects.
1904 * fileread.h (File_read::clear_uncached_views): New function.
1905 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
1906 on the archive.
1907
a1207466
CC
19082008-03-31 Cary Coutant <ccoutant@google.com>
1909
1910 Add thin archive support.
1911 * archive.cc (Archive::armagt): New const.
1912 (Archive::setup): Remove task parameter and calls to unlock.
1913 (Archive::unlock_nested_archives): New function.
1914 (Archive::read_header): Add nested_off parameter. Change
1915 all callers.
1916 (Archive::interpret_header): Likewise.
1917 (Archive::include_all_members): Change to handle thin
1918 archives.
1919 (Archive::include_member): Likewise.
1920 * archive.h (Archive::Archive): Add new parameters and
1921 initializers.
1922 (Archive::armagt): New const.
1923 (Archive::setup): Remove task parameter.
1924 (Archive::unlock_nested_archives): New function.
1925 (Archive::read_header): Add nested_off parameter.
1926 (Archive::interpret_header): Likewise.
1927 (Archive::Nested_archive_table): New typedef.
1928 (Archive::is_thin_archive_): New field.
1929 (Archive::nested_archives_): New field.
1930 (Archive::options_): New field.
1931 (Archive::dirpath_): New field.
1932 (Archive::task_): New field.
1933 * readsyms.cc (Read_symbols::do_read_symbols): Add check
1934 for thin archives. Pass additional parameters to
1935 Archive::Archive. Unlock the archive file after calling
1936 Archive::setup.
1937
479f6503
ILT
19382008-03-29 Ian Lance Taylor <iant@google.com>
1939
686c8caf
ILT
1940 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
1941 version symbol to be local.
1942 * testsuite/ver_test_4.sh: New file.
1943 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
1944 (check_DATA): Add ver_test_4.syms.
1945 (ver_test_4.syms): New target.
1946 * testsuite/Makefile.in: Rebuild.
1947
ab794b6b
ILT
1948 * output.cc
1949 (Output_section::Input_section_sort_entry::has_priority): New
1950 function.
1951 (Output_section::Input_section_sort_entry::match_file_name): New
1952 function.
1953 (Output_section::Input_section_sort_entry::match_section_name):
1954 Remove.
1955 (Output_section::Input_section_sort_entry::match_section_name_prefix):
1956 Remove.
1957 (Output_section::Input_section_sort_entry::match_section_file):
1958 Remove.
1959 (Output_section::Input_section_sort_compare::operator()): Rewrite
1960 using new Input_section_sort_entry functions. Sort crtbegin and
1961 crtend first. Sort sections with no priority before sections with
1962 a priority.
1963 * testsuite/initpri1.c (d3): Check j != 4.
1964 (cd5): New constructor/destructor function.
1965 (main): Check j != 2.
1966
479f6503
ILT
1967 * symtab.cc (Symbol_table::add_from_object): If we don't use the
1968 new symbol when resolving, don't call set_is_default.
1969 * testsuite/ver_test_7.cc: New file.
1970 * testsuite/ver_test_7.sh: New file.
1971 * testsuite/Makefile.am (ver_test_7.so): New target.
1972 (ver_test_7.o): New target.
1973 (check_SCRIPTS): Add ver_test_7.sh.
1974 (check_DATA): Add ver_test_7.syms.
1975 (ver_test_7.syms): New target.
1976
2fd32231
ILT
19772008-03-28 Ian Lance Taylor <iant@google.com>
1978
1979 * layout.cc (Layout::layout): If we see an input section with a
1980 name that needs sorting, set the must_sort flag for the output
1981 section.
1982 (Layout::make_output_section): If the name of the output section
1983 indicates that it might require sorting, set the may_sort flag.
1984 * output.h (Output_section::may_sort_attached_input_sections): New
1985 function.
1986 (Output_section::set_may_sort_attached_input_sections): New
1987 function.
1988 (Output_section::must_sort_attached_input_sections): New
1989 function.
1990 (Output_section::set_must_sort_attached_input_sections): New
1991 function.
1992 (class Output_section): Declare Input_section_sort_entry. Define
1993 Input_section_sort_compare. Declare
1994 sort_attached_input_sections. Add new fields:
1995 may_sort_attached_input_sections_,
1996 must_sort_attached_input_sections_,
1997 attached_input_sections_are_sorted_.
1998 * output.cc (Output_section::Output_section): Initialize new
1999 fields.
2000 (Output_section::add_input_section): Add an entry to
2001 input_sections_ if may_sort or must_sort are true.
2002 (Output_section::set_final_data_size): Call
2003 sort_attached_input_sections if necessary.
2004 (Output_section::Input_section_sort_entry): Define new class.
2005 (Output_section::Input_section_sort_compare::operator()): New
2006 function.
2007 (Output_section::sort_attached_input_sections): New function.
2008 * configure.ac: Check whether the compiler supports constructor
2009 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
2010 * testsuite/initpri1.c: New file.
2011 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
2012 CONSTRUCTOR_PRIORITY.
2013 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
2014 (initpri1_LDFLAGS): New variable.
2015 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2016
18e6b24e
ILT
20172008-03-27 Ian Lance Taylor <iant@google.com>
2018
49bdd526
ILT
2019 * common.cc (Sort_commons::operator): Correct sorting algorithm.
2020 * testsuite/common_test_1.c: New file.
2021 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
2022 (common_test_1_SOURCES): New variable.
2023 (common_test_1_DEPENDENCIES): New variable.
2024 (common_test_1_LDFLAGS): New variable.
2025
18e6b24e
ILT
2026 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
2027 and commons_ correctly when NAME/VERSION does not override
2028 NAME/NULL.
2029 * testsuite/ver_test_6.c: New file.
2030 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
2031 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
2032 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2033
04bf7072
ILT
20342008-03-26 Ian Lance Taylor <iant@google.com>
2035
5871526f
ILT
2036 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
2037 of an undefined symbol from a version script.
2038 * testsuite/Makefile.am (ver_test_5.so): New target.
2039 (ver_test_5.o): New target.
2040 (check_SCRIPTS): Add ver_test_5.sh.
2041 (check_DATA): Add ver_test_5.syms.
2042 (ver_test_5.syms): New target.
2043 * testsuite/ver_test_5.cc: New file.
2044 * testsuite/ver_test_5.script: New file.
2045 * testsuite/ver_test_5.sh: New file.
2046 * Makefile.in, testsuite/Makefile.in: Rebuild.
2047
04bf7072
ILT
2048 PR gold/5986
2049 Fix problems building gold with gcc 4.3.0.
2050 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
2051 (gold_error_at_location, gold_warning_at_location): Use it.
2052 * configure.ac: Check whether we can compile and use a template
2053 function with a printf attribute.
2054 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
2055 when jumping over bytes.
2056 * object.cc: Instantiate Object::read_section_data.
2057 * debug.h: Include <cstring>
2058 * dwarf_reader.cc: Include <algorithm>
2059 * main.cc: Include <cstring>.
2060 * options.cc: Include <cstring>.
2061 * output.cc: Include <cstring>.
2062 * script.cc: Include <cstring>.
2063 * script.h: Include <string>.
2064 * symtab.cc: Include <cstring> and <algorithm>.
2065 * target-select.cc: Include <cstring>.
2066 * version.cc: Include <string>.
2067 * testsuite/testmain.cc: Include <cstdlib>.
2068 * configure, config.in: Rebuild.
2069
874c5b28
ILT
20702008-03-25 Ian Lance Taylor <iant@google.com>
2071
819d6c3a
ILT
2072 * options.cc: Include "../bfd/bfdver.h".
2073 (options::help): Print bug reporting address.
2074
f4b2c6f5
ILT
2075 * version.cc (print_version): Adjust output for current value of
2076 BFD_VERSION_STRING.
2077
2078 * NEWS: New file.
2079
e96caa79
ILT
2080 * options.cc (options::help): Print list of supported targets.
2081 * target-select.h: Include <vector>.
2082 (class Target_selector): Make machine_, size_, and is_big_endian_
2083 fields const. Add bfd_name_ and instantiated_target_ fields.
2084 (Target_selector::Target_selector): Add bfd_name parameter.
2085 (Target_selector::recognize): Make non-virtual, call
2086 do_recognize.
2087 (Target_selector::recognize_by_name): Make non-virtual, call
2088 do_recognize_by_name.
2089 (Target_selector::supported_names): New function.
2090 (Target_selector::bfd_name): New function.
2091 (Target_selector::do_instantiate_target): New pure virtual
2092 function.
2093 (Target_selector::do_recognize): New virtual function.
2094 (Target_selector::do_recognize_by_name): New virtual function.
2095 (Target_selector::instantiate_target): New private function.
2096 (supported_target_names): Declare.
2097 * target-select.cc (Target_selector::Target_selector): Update for
2098 new parameter and fields.
2099 (select_target_by_name): Check that the name matches before
2100 calling recognize_by_name.
2101 (supported_target_names): New function.
2102 * i386.cc (class Target_selector_i386): Update Target_selector
2103 constructor call. Remove recognize and recognize_by_name. Add
2104 do_instantiate_target.
2105 * x86_64.cc (class Target_selector_x86_64): Likewise.
2106 * testsuite/testfile.cc (class Target_selector_test): Update for
2107 changes to Target_selector.
2108
874c5b28
ILT
2109 * README: Rewrite, with some notes on unsupported features.
2110
0a65a3a7
CC
21112008-03-24 Cary Coutant <ccoutant@google.com>
2112
2113 * i386.cc (Target_i386::Got_type): New enum declaration.
2114 (Target_i386::Scan::local): Updated callers of Output_data_got
2115 member functions.
2116 (Target_i386::Scan::global): Likewise.
2117 (Target_i386::Relocate::relocate): Likewise.
2118 (Target_i386::Relocate::relocate_tls): Likewise.
2119 * object.h (Got_offset_list): New class.
2120 (Sized_relobj::local_has_got_offset): Added got_type parameter.
2121 (Sized_relobj::local_got_offset): Likewise.
2122 (Sized_relobj::set_local_got_offset): Likewise.
2123 (Sized_relobj::local_has_tls_got_offset): Removed.
2124 (Sized_relobj::local_tls_got_offset): Removed.
2125 (Sized_relobj::set_local_tls_got_offset): Removed.
2126 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
2127 * output.cc (Output_data_got::add_global): Added got_type parameter.
2128 (Output_data_got::add_global_with_rel): Likewise.
2129 (Output_data_got::add_global_with_rela): Likewise.
2130 (Output_data_got::add_global_pair_with_rel): New function.
2131 (Output_data_got::add_global_pair_with_rela): New function.
2132 (Output_data_got::add_local): Added got_type parameter.
2133 (Output_data_got::add_local_with_rel): Likewise.
2134 (Output_data_got::add_local_with_rela): Likewise.
2135 (Output_data_got::add_local_pair_with_rel): New function.
2136 (Output_data_got::add_local_pair_with_rela): New function.
2137 (Output_data_got::add_global_tls): Removed.
2138 (Output_data_got::add_global_tls_with_rel): Removed.
2139 (Output_data_got::add_global_tls_with_rela): Removed.
2140 (Output_data_got::add_local_tls): Removed.
2141 (Output_data_got::add_local_tls_with_rel): Removed.
2142 (Output_data_got::add_local_tls_with_rela): Removed.
2143 * output.h (Output_data_got::add_global): Added got_type parameter.
2144 (Output_data_got::add_global_with_rel): Likewise.
2145 (Output_data_got::add_global_with_rela): Likewise.
2146 (Output_data_got::add_global_pair_with_rel): New function.
2147 (Output_data_got::add_global_pair_with_rela): New function.
2148 (Output_data_got::add_local): Added got_type parameter.
2149 (Output_data_got::add_local_with_rel): Likewise.
2150 (Output_data_got::add_local_with_rela): Likewise.
2151 (Output_data_got::add_local_pair_with_rel): New function.
2152 (Output_data_got::add_local_pair_with_rela): New function.
2153 (Output_data_got::add_global_tls): Removed.
2154 (Output_data_got::add_global_tls_with_rel): Removed.
2155 (Output_data_got::add_global_tls_with_rela): Removed.
2156 (Output_data_got::add_local_tls): Removed.
2157 (Output_data_got::add_local_tls_with_rel): Removed.
2158 (Output_data_got::add_local_tls_with_rela): Removed.
2159 * resolve.cc (Symbol::override_base_with_special): Removed
2160 reference to has_got_offset_ field.
2161 * symtab.cc (Symbol::init_fields): Replaced initialization
2162 of got_offset_ with got_offsets_. Removed initialization
2163 of has_got_offset_
53fcba31 2164 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
2165 (Symbol::got_offset): Likewise.
2166 (Symbol::set_got_offset): Likewise.
2167 (Symbol::has_tls_got_offset): Removed.
2168 (Symbol::tls_got_offset): Removed.
2169 (Symbol::set_tls_got_offset): Removed.
2170 (Symbol::got_offset_): Removed.
2171 (Symbol::tls_mod_got_offset_): Removed.
2172 (Symbol::tls_pair_got_offset_): Removed.
2173 (Symbol::got_offsets_): New field.
2174 (Symbol::has_got_offset): Removed.
2175 (Symbol::has_tls_mod_got_offset): Removed.
2176 (Symbol::has_tls_pair_got_offset): Removed.
2177 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
2178 (Target_x86_64::Scan::local): Updated callers of Output_data_got
2179 member functions.
2180 (Target_x86_64::Scan::global): Likewise.
2181 (Target_x86_64::Relocate::relocate): Likewise.
2182 (Target_x86_64::Relocate::relocate_tls): Likewise.
2183
bd52eafb
BE
21842008-03-25 Ben Elliston <bje@au.ibm.com>
2185
2186 * yyscript.y: Fix spelling error in comment.
2187
8b105e34
ILT
21882008-03-24 Ian Lance Taylor <iant@google.com>
2189
8ed814a9
ILT
2190 * options.h (class General_options): Define build_id option.
2191 * layout.h (class Layout): Declare write_build_id, create_note,
2192 create_build_id. Add build_id_note_ member.
2193 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
2194 "libiberty.h", "md5.h", "sha1.h".
2195 (Layout::Layout): Initialize eh_frame_data_,
2196 eh_frame_hdr_section_, and build_id_note_.
2197 (Layout::finalize): Call create_build_id.
2198 (Layout::create_note): New function, broken out of
2199 Layout::create_gold_note.
2200 (Layout::create_gold_note): Call create_note.
2201 (Layout::create_build_id): New function.
2202 (Layout::write_build_id): New function.
2203 (Close_task_runner::run): Call write_build_id.
2204
8b105e34
ILT
2205 * x86_64.cc: Correct license to GPLv3.
2206
086a1841
ILT
22072008-03-23 Ian Lance Taylor <iant@google.com>
2208
2209 * options.cc: Include "demangle.h".
2210 (parse_optional_string): New function.
2211 (parse_long_option): Handle takes_optional_argument.
2212 (parse_short_option): Update dash_z initializer. Handle
2213 takes_optional_argument.
2214 (General_options::General_options): Initialize do_demangle_.
2215 (General_options::finalize): Set do_demangle_. Handle demangling
2216 style.
2217 * options.h (parse_optional_string): Declare.
2218 (struct One_option): Add optional_arg field. Update constructor.
2219 Update call constructor calls. Add takes_optional_argument
2220 function.
2221 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
2222 (DEFINE_optional_string): Define.
2223 (General_options::demangle): Change from DEFINE_bool to
2224 DEFINE_optional_string.
2225 (General_options::no_demangle): New function.
2226 (General_options::do_demangle): New function.
2227 (General_options::set_do_demangle): New function.
2228 (General_options::execstack_status_): Move definition to end of
2229 class definition.
2230 (General_options::static_): Likewise.
2231 (General_options::do_demangle_): New field.
2232 * object.cc (big_endian>::get_symbol_location_info): Call
2233 Options::do_demangle, not Options::demangle.
2234 * symtab.cc (demangle): Likewise.
2235
cbb93e63
ILT
22362008-03-22 Ian Lance Taylor <iant@google.com>
2237
2238 * gold.h: Include <cstddef> and <sys/types.h>
2239 * options.h: Include <cstring>.
2240
ec531623
ILT
22412008-03-21 Ian Lance Taylor <iant@google.com>
2242
2243 * Added source code to GNU binutils.
2244
This page took 0.139921 seconds and 4 git commands to generate.