1 2008-06-18 Craig Silverstein <csilvers@google.com>
3 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
4 constant 0xFFFF to type Valtype.
5 (Powerpc_relocate_functions::rel16_ha): Likewise.
7 2008-06-17 Ian Lance Taylor <iant@google.com>
9 * output.h (Output_section::Input_section): Initialize p2align_ to
10 zero for Output_section_data constructors.
11 (Output_section::Input_section::addralign): If not an input
12 section, return the alignment of the Output_section_data.
13 * testsuite/copy_test.cc: New file.
14 * testsuite/copy_test_1.cc: New file.
15 * testsuite/copy_test_2.cc: New file.
16 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
17 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
18 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
19 (copy_test_1_pic.o, copy_test_1.so): New targets.
20 (copy_test_2_pic.o, copy_test_2.so): New targets.
21 * testsuite/Makefile.in: Rebuild.
23 * script-sections.cc (Script_sections::place_orphan): Initialize
26 2008-06-13 David Edelsohn <edelsohn@gnu.org>
28 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
30 2008-06-12 David Edelsohn <edelsohn@gnu.org>
31 David S. Miller <davem@davemloft.net>
33 * powerpc.cc: New file.
34 * Makefile.am (TARGETSOURCES): Add powerpc.cc
35 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
36 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
37 * Makefile.in: Rebuild.
39 2008-06-09 Ian Lance Taylor <iant@google.com>
41 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
43 (throwing, orig_terminate): New static variables.
44 (terminate_handler): New static function.
45 (t2): Set terminate handler.
47 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
50 * binary.cc (Binary_to_elf::sized_convert): Fix .data
53 2008-05-30 Cary Coutant <ccoutant@google.com>
55 * archive.cc (Archive::include_all_members) Correct to step
56 over symbol table and extended name table in thin archives.
58 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
61 * target-reloc.h (relocate_for_relocatable): Fix new_offset
64 2008-05-28 Caleb Howe <cshowe@google.com>
66 * reduced_debug_output.cc: New file.
67 * reduced_debug_output.h: New file.
68 * options.h (class General_optoins): Add --strip-debug-non-line.
69 * options.cc (General_options::finalize): Add strip_debug_non_line
70 to the strip heirarchy.
71 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
73 * layout.cc: Include "reduced_debug_output.h".
74 (Layout::Layout): Initialize new fields.
75 (line_only_debug_sections): New static array.
76 (is_lines_only_debug_sections): New static inline function.
77 (Layout::include_section): Handle --strip-debug-non-line.
78 (Layout::make_output_section): If --strip-debug-non-line, build
79 new output sections for .debug_abbrev and .debug_info.
80 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
81 gold. Warn about possible overflow.
82 (read_signed_LEB_128): Likewise.
83 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
84 (read_signed_LEB_128): Declare.
85 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
86 (HFILES): Add reduced_debug_output.h.
87 * Makefile.in: Rebuild.
89 2008-05-21 Ian Lance Taylor <iant@google.com>
91 * mapfile.cc: New file.
92 * mapfile.h: New file.
93 * options.h (class General_options): Add -M/--print-map and -Map.
94 * options.cc (General_options::finalize): Make -M equivalent to
96 * main.cc: Include <cstdio> and "mapfile.h".
97 (main): Open mapfile if requested.
98 * gold.cc (class Middle_runner): Add mapfile_ field. Update
99 constructor. Change caller.
100 (queue_initial_tasks): Add mapfile parameter. Change caller.
101 (queue_middle_tasks): Likewise.
102 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
104 * archive.cc: Include "mapfile.h".
105 (Archive::add_symbols): Add mapfile parameter. Change all
106 callers. Pass mapfile, symbol, and reason to include_member.
107 (Archive::include_all_members): Add mapfile parameter. Change all
109 (Archive::include_member): Add mapfile, sym, and why parameters.
110 Change all callers. Report inclusion to map file.
111 * archive.h: Include "fileread.h".
112 (class Archive): Update declarations.
113 (Archive::file): New const method.
114 (class Add_archive_symbols): Add mapfile_ field. Update
115 constructor. Change all callers.
116 * readsyms.h (class Read_symbols): Likewise.
117 (class Finish_group): Likewise.
118 (class Read_script): Likewise.
119 * common.cc: Include "mapfile.h".
120 (Symbol_table::allocate_commons): Add mapfile parameter. Change
122 (Symbol_table::do_allocate_commons): Likewise.
123 (Symbol_table::do_allocate_commons_list): Likewise. Report common
124 symbol allocation to mapfile.
125 * common.h (class Allocate_commons_task): Add mapfile_ field.
126 Update constructor. Change all callers.
127 * symtab.h (class Symbol_table): Update declarations.
128 * layout.cc: Include "mapfile.h".
129 (Layout_task_runner::run): Print information to mapfile.
130 (Layout::create_gold_note): Change Output_data_fixed_space to
131 Output_data_zero_fill.
132 (Layout::create_build_id): Likewise.
133 (Layout::print_to_mapfile): New function.
134 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
135 constructor. Change caller.
136 (class Layout): Declare print_to_mapfile.
137 * output.cc (Output_section::Input_section::print_to_mapfile): New
139 (Output_section::add_input_section): If producing a map, always
140 add to input_sections_ list.
141 (Output_section::do_print_to_mapfile): New function.
142 (Output_segment::print_sections_to_mapfile): New function.
143 (Output_segment::print_section_list_to_mapfile): New function.
144 * output.h: Include "mapfile.h".
145 (Output_data::print_to_mapfile): New function.
146 (Output_data::do_print_to_mapfile): New virtual function.
147 (Output_segment_headers::do_print_to_mapfile): New function.
148 (Output_file_header::do_print_to_mapfile): New function.
149 (Output_data_const::do_print_to_mapfile): New function.
150 (class Output_data_const_buffer): Add map_name_ field. Update
151 constructor. Change all callers. Add do_print_to_mapfile
153 (class Output_data_fixed_space): Likewise.
154 (class Output_data_space): Likewise.
155 (class Output_data_zero_fill): New class.
156 (Output_data_strtab::do_print_to_mapfile): New function.
157 (Output_data_reloc_base::do_print_to_mapfile): New function.
158 (Output_relocatable_relocs::do_print_to_mapfile): New function.
159 (Output_data_group::do_print_to_mapfile): New function.
160 (Output_data_got::do_print_to_mapfile): New function.
161 (Output_data_dynamic::do_print_to_mapfile): New function.
162 (Output_symtab_xindex::do_print_to_mapfile): New function.
163 (class Output_section): Declare do_print_to_mapflie. Declare
164 print_to_mapfile in Input_section.
165 (class Output_segment): Declare new functions.
166 * object.h (Sized_relobj::symbol_count): New function.
168 (Output_section_element_dot_assignment::set_section_addresses):
169 Change Output_data_fixed_space to Output_data_zero_fill.
170 (Output_data_expression::do_print_to_mapfile): New function.
171 * script.cc (read_input_script): Add mapfile parameter. Change
173 * script.h (read_input_script): Update declaration.
174 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
175 (Eh_frame::do_print_to_mapfile): New function.
176 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
177 (Output_merge_string::do_print_to_mapfile): New function.
178 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
180 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
182 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
184 * Makefile.am (CCFILES): Add mapfile.cc.
185 (HFILES): Add mapfile.h.
186 * Makefile.in: Rebuild.
188 2008-05-19 Ian Lance Taylor <iant@google.com>
190 * options.h (class General_options): Add -z relro.
191 * layout.cc (Layout::Layout): Initialize relro_segment_.
192 (Layout::add_output_section_data): Return the output section.
193 (Layout::make_output_section): Rcognize relro sections and mark
195 (Layout::attach_allocated_section_to_segment): Put relro sections
196 in a PT_GNU_RELRO segment.
197 (Layout::create_initial_dynamic_sections): Mark the .dynamic
199 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
201 (Layout::linkonce_mapping): Map d.rel.ro.local to
203 (Layout::output_section_name): Us .data.rel.ro.local for any
204 section which begins with that.
205 * layout.h (class Layout): Update add_output_section_data
206 declaration. Add relro_segment_ field.
207 * output.cc (Output_section::Output_section): Initialize is_relro_
208 and is_relro_local_ fields.
209 (Output_segment::add_output_section): Group relro sections.
210 (Output_segment::is_first_section_relro): New function.
211 (Output_segment::maximum_alignment): If there is a relro section,
212 align the segment to the common page size.
213 (Output_segment::set_section_addresses): Track whether we are
214 looking at relro sections. If the last section is a relro
215 section, align to the common page size.
216 (Output_segment::set_section_list_addresses): Add in_relro
217 parameter. Change all callers. Align to the page size when
218 moving from relro to non-relro section.
219 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
221 * output.h (class Output_section): Add is_relro_ and
222 is_relro_local_ fields.
223 (Output_section::is_relro): New function.
224 (Output_section::set_is_relro): New function.
225 (Output_section::is_relro_local): New function.
226 (Output_section::set_is_relro_local): New function.
227 (class Output_segment): Update declarations.
228 * i386.cc (Target_i386::got_section): Mark .got section as relro.
229 * sparc.cc (Target_sparc::got_section): Likewise.
230 * x86_64.cc (Target_x86_64::got_section): Likewise.
231 * testsuite/relro_test_main.cc: New file.
232 * testsuite/relro_test.cc: New file.
233 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
234 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
235 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
236 (relro_test.so, relro_test_pic.o): New targets.
237 * testsuite/Makefile.in: Rebuild.
239 2008-05-16 Ian Lance Taylor <iant@google.com>
241 * output.cc (Output_segment::add_output_section): Remove front
243 * output.h (class Output_segment): Remove
244 add_initial_output_section and overloaded add_output_section.
245 Update declaration of remaining add_output_section.
246 * layout.cc (Layout::create_interp): Call add_output_section
247 rather than add_initial_output_section.
248 (Layout::finish_dynamic_section): Likewise.
250 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
251 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
252 know the dynamic type.
253 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
254 field. Initialize it in constructor.
255 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
256 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
257 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
260 * output.cc (Output_reloc::get_address): Change return type to
262 * output.h (class Output_reloc): Update get_address declaration.
263 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
264 for section addresses.
266 2008-05-09 Ian Lance Taylor <iant@google.com>
269 * gold.cc (gold_nomem): Use return value of write.
271 2008-05-08 Ian Lance Taylor <iant@google.com>
273 * symtab.c (Symbol::init_base_output_data): Add version
274 parameter. Change all callers.
275 (Symbol::init_base_output_segment): Likewise.
276 (Symbol::init_base_constant): Likewise.
277 (Symbol::init_base_undefined): Likewise.
278 (Sized_symbol::init_output_data): Likewise.
279 (Sized_symbol::init_output_segment): Likewise.
280 (Sized_symbol::init_constant): Likewise.
281 (Sized_symbol::init_undefined): Likewise.
282 (Symbol_table::do_define_in_output_data): If the new symbol has a
283 version, mark it as the default.
284 (Symbol_table::do_define_in_output_segment): Likewise.
285 (Symbol_table::do_define_as_constant): Likewise.
286 * symtab.h (class Symbol): Update declarations.
287 (class Sized_symbol): Likewise.
288 * resolve.cc (Symbol::override_version): New function.
289 (Symbol::override_base): Call override_version.
290 (Symbol::override_base_with_special): Likewise.
291 * testsuite/ver_script_8.script: New file.
292 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
293 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
294 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
295 (ver_test_8_1.so, ver_test_8_2.so): New targets.
297 2008-05-06 Ian Lance Taylor <iant@google.com>
300 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
302 (class General_options): Remove existing --undefined, and add
303 --no-undefined instead. Add new --undefined as synonym for -u.
304 * archive.cc (Archive::add_symbols): Check whether symbol was
306 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
307 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
308 all uses. Add IS_UNDEFINED. Update declarations to split
309 different versions of init_base. Declare init_base_undefined.
310 (Symbol::is_defined): Handle IS_UNDEFINED.
311 (Symbol::is_undefined): Likewise.
312 (Symbol::is_weak_undefined): Call is_undefined.
313 (Symbol::is_absolute): Handle IS_CONSTANT.
314 (class Sized_symbol): Update declarations to split different
315 versions of init. Declare init_undefined.
316 (class Symbol_table): Declare new functions.
317 * symtab.cc (Symbol::init_base_object): Rename from init_base.
319 (Symbol::init_base_output_data): Likewise.
320 (Symbol::init_base_output_segment): Likewise.
321 (Symbol::init_base_constant): Likewise.
322 (Symbol::init_base_undefined): New function.
323 (Sized_symbol::init_object): Rename from init. Change all
325 (Sized_symbol::init_output_data): Likewise.
326 (Sized_symbol::init_output_segment): Likewise.
327 (Sized_symbol::init_constant): Likewise.
328 (Sized_symbol::init_undefined): New function.
329 (Symbol_table::add_undefined_symbols_from_command_line): New
331 (Symbol_table::do_add_undefined_symbols_from_command_line): New
333 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
334 (Symbol::output_section): Likewise.
335 (Symbol::set_output_section): Likewise.
336 (Symbol_table::sized_finalize_symbol): Likewise.
337 (Symbol_table::sized_write_globals): Likewise.
338 * resolve.cc (Symbol_table::should_override): Likewise.
339 (Symbol::override_base_with_special): Likewise.
341 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
342 symbol, change it to have default visibility.
343 * testsuite/protected_1.cc: New file.
344 * testsuite/protected_2.cc: New file.
345 * testsuite/protected_3.cc: New file.
346 * testsuite/protected_main_1.cc: New file.
347 * testsuite/protected_main_2.cc: New file.
348 * testsuite/protected_main_3.cc: New file.
349 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
350 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
351 (protected_1_LDFLAGS, protected_1_LDADD): Define.
352 (protected_1.so): New target.
353 (protected_1_pic.o, protected_2_pic.o): New targets.
354 (protected_3_pic.o): New target.
355 (check_PROGRAMS): Add protected_2.
356 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
357 (protected_2_LDFLAGS, protected_2_LDADD): Define.
358 * testsuite/Makefile.in: Rebuild.
360 * options.h (DEFINE_var): Add set_user_set_##varname__.
361 (DEFINE_bool_alias): New macro.
362 (class General_options): Define -Bstatic using DEFINE_bool_alias
363 rather than DEFINE_special. Add --undefined as an alias for -z
365 * options.cc (General_options::parse_Bstatic): Remove.
367 * options.h (class General_options): Add --fatal-warnings.
368 * main.cc (main): Implement --fatal-warnings.
369 * errors.h (Errors::warning_count): New function.
371 * options.h (class General_options): Add -Bsymbolic-functions.
372 * symtab.h (Symbol::is_preemptible): Check for
373 -Bsymbolic-functions.
375 2008-05-05 Ian Lance Taylor <iant@google.com>
377 * options.h (DEFINE_bool): For DASH_Z, create the negative option
378 as noVARNAME rather than no-VARNAME.
379 (class General_options): Add option -z combreloc.
380 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
382 (Output_reloc::sort_before) [SHT_REL]: New function.
383 (Output_reloc::sort_before) [SHT_RELA]: New function.
384 (class Output_data_reloc_base): Add sort_relocs_ field. Define
385 Sort_relocs_comparison.
386 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
387 parameter. Change all callers.
388 (Output_data_reloc::Output_data_reloc) [both versions]: Add
389 sort_relocs parameter. Change all callers.
390 * output.cc (Output_reloc::get_address): New function, broken out
392 (Output_reloc::write_rel): Call it.
393 (Output_reloc::compare): New function.
394 (Output_data_reloc_base::do_write): Optionally sort relocs.
396 * configure.ac: If targ_extra_obj is set, link it in.
397 * configure.tgt: Initialize all variables.
398 (x86_64*): Set targ_extra_obj and targ_extra_size.
399 * configure: Rebuild.
401 * object.cc (Sized_relobj::include_section_group): Adjust section
402 indexes read from group data. Build vector to pass to
404 * layout.cc (Layout::layout_group): Add flags and shndxes
405 parameters. Remove contents parameter. Change caller. Update
406 explicit instantiations.
407 * layout.h (class Layout): Update layout_group declaration.
408 * output.cc (Output_data_group::Output_data_group): Add flags and
409 input_shndxes parameters. Remove contents parameter. Change
411 (Output_data_group::do_write): Change input_sections_ to
413 * output.h (class Output_data_group): Update constructor
414 declaration. Rename input_sections_ to input_shndxes_.
415 * testsuite/many_sections_test.cc: Add template.
417 2008-04-30 Cary Coutant <ccoutant@google.com>
419 * target-reloc.h (relocate_section): Fix dead-pointer bug.
421 * layout.cc (Layout::include_section): Refactored check for debug
423 (Layout::add_comdat): Add new parameters. Change type
424 of signature parameter. Add object and shndx to signatures table.
425 (Layout::find_kept_object): New function.
426 * layout.h: Include <cstring>.
427 (Layout::is_debug_info_section): New function.
428 (Layout::add_comdat): Add new parameters.
429 (Layout::find_kept_object): New function.
430 (Layout::Kept_section): New struct.
431 (Layout::Signatures): Change type of map range.
432 * object.cc (Relobj::output_section_address): New function.
433 (Sized_relobj::include_section_group): Add new parameters. Change
434 calls to Layout::add_comdat. Change to build table of kept comdat
435 groups and table mapping discarded sections to kept sections.
436 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
437 (Sized_relobj::do_layout): Change calls to include_section_group and
438 include_linkonce_section.
439 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
440 value to zero when section is discarded.
441 (Sized_relobj::map_to_kept_section): New function.
442 * object.h (Relobj::output_section_address): New function.
443 (Relobj::Comdat_group): New type.
444 (Relobj::find_comdat_group): New function.
445 (Relobj::Comdat_group_table): New type.
446 (Relobj::Kept_comdat_section): New type.
447 (Relobj::Kept_comdat_section_table): New type.
448 (Relobj::add_comdat_group): New function.
449 (Relobj::set_kept_comdat_section): New function.
450 (Relobj::get_kept_comdat_section): New function.
451 (Relobj::comdat_groups_): New field.
452 (Relobj::kept_comdat_sections_): New field.
453 (Symbol_value::input_value): Update comment.
454 (Sized_relobj::map_to_kept_section) New function.
455 (Sized_relobj::include_linkonce_section): Add new parameter.
456 * target-reloc.h (Comdat_behavior): New type.
457 (get_comdat_behavior): New function.
458 (relocate_section): Add code to map a discarded section to the
459 corresponding kept section when applying a relocation.
461 2008-04-30 Craig Silverstein <csilvers@google.com>
463 * dwarf_reader.cc (next_generation_count): New static var.
464 (Addr2line_cache_entry): New struct.
465 (addr2line_cache): New static var.
466 (Dwarf_line_info::one_addr2line): Added caching.
467 (Dwarf_line_info::clear_addr2line_cache): New function.
468 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
469 cache-size parameter.
470 (Dwarf_line_info::one_addr2line_cache): New function.
471 * symtab.cc (Symbol_table::detect_odr_violations): Pass
472 new cache-size argument to one_addr2line(), and clear cache.
474 2008-04-28 Cary Coutant <ccoutant@google.com>
476 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
477 R_386_PC8 relocations.
479 2008-04-23 Ian Lance Taylor <iant@google.com>
481 * object.cc (Sized_relobj::include_section_group): Check for
482 invalid section group.
484 * object.cc (make_elf_object): Correct test for 64-bit ELF file
487 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
488 than read for file header.
489 * archive.cc (Archive::include_member): Likewise.
491 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
493 * aclocal.m4: Regenerate.
494 * configure: Regenerate.
496 2008-04-19 Ian Lance Taylor <iant@google.com>
498 * version.cc (version_string): Bump to 1.6.
500 * testsuite/Makefile.am (many_sections_r_test): New target.
501 (many_sections_r_test_SOURCES): Remove.
502 (many_sections_r_test_DEPENDENCIES): Remove.
503 (many_sections_r_test_LDFLAGS): Remove.
504 (many_sections_r_test_LDADD): Remove.
506 * object.cc (Sized_relobj::do_add_symbols): Always pass
507 local_symbol_count_ to add_from_relobj.
509 * testsuite/Makefile.am (many_sections_check.h): Only check one in
510 every thousand variables.
511 * testsuite/Makefile.in: Rebuild.
513 * object.cc (Xindex::initialize_symtab_xindex): New function.
514 (Xindex::read_symtab_xindex): New function.
515 (Xindex::sym_xindex_to_shndx): New function.
516 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
518 (Sized_relobj::do_initialize_xindex): New function.
519 (Sized_relobj::do_read_symbols): Adjust section links.
520 (Sized_relobj::symbol_section_and_value): Add is_ordinary
521 parameter. Change all callers.
522 (Sized_relobj::include_section_group): Adjust section links and
523 symbol section indexes.
524 (Sized_relobj::do_layout): Adjust section links.
525 (Sized_relobj::do_count_local_symbols): Adjust section links and
526 symbol section indexes.
527 (Sized_relobj::do_finalize_local_symbols): Distinguish between
528 ordinary and special symbols.
529 (Sized_relobj::write_local_symbols): Add symtab_xindex and
530 dynsym_xindex parameters. Change all callers. Adjust section
531 links. Use SHN_XINDEX when needed.
532 (Sized_relobj::get_symbol_location_info): Adjust section links.
533 Don't get fooled by special symbols.
534 * object.h (class Xindex): Define.
535 (class Object): Add xindex_ parameter. Declare virtual functoin
536 do_initialize_xindex.
537 (Object::adjust_sym_shndx): New function.
538 (Object::set_xindex): New protected function.
539 (class Symbol_value): Add is_ordinary_shndx_ field.
540 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
541 (Symbol_value::value): Assert ordinary section.
542 (Symbol_value::initialize_input_to_output_map): Likewise.
543 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
545 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
547 (class Sized_relobj): Update declarations.
548 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
549 parameter. Change all callers.
550 (Sized_relobj::adjust_shndx): New function.
551 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
553 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
554 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
555 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
556 (Sized_dynobj::read_dynsym_section): Adjust section links.
557 (Sized_dynobj::read_dynamic): Likewise.
558 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
560 (Sized_dynobj::do_initialize_xindex): New function.
561 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
562 do_initialize_xindex.
563 (Sized_dynobj::adjust_shndx): New function.
564 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
565 dynsym_xindex_ fields.
566 (Layout::finalize): Add a call to set_section_indexes before
567 creating the symtab sections.
568 (Layout::set_section_indexes): Don't do anything if the section
569 already has a section index.
570 (Layout::create_symtab_sections): Add shnum parameter. Change
571 caller. Create .symtab_shndx section if needed.
572 (Layout::create_shdrs): Add shstrtab_section parameter. Change
574 (Layout::allocated_output_section_count): New function.
575 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
577 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
578 fields. Update declarations.
579 (Layout::symtab_xindex): New function.
580 (Layout::dynsym_xindex): New function.
581 (class Write_symbols_task): Add layout_ field.
582 (Write_symbols_task::Write_symbols_task): Add layout parameter.
584 * output.cc (Output_section_headers::Output_section_headers): Add
585 shstrtab_section parameter. Change all callers.
586 (Output_section_headers::do_sized_write): Store overflow values
587 for section count and section string table section index in
589 (Output_file_header::do_sized_write): Check for overflow of
590 section count and section string table section index.
591 (Output_symtab_xindex::do_write): New function.
592 (Output_symtab_xindex::endian_do_write): New function.
593 * output.h (class Output_section_headers): Add shstrtab_section_.
595 (class Output_symtab_xindex): Define.
596 (Output_section::has_out_shndx): New function.
597 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
599 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
601 (Sized_symbol::init): Likewise.
602 (Symbol::output_section): Check for ordinary symbol.
603 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
604 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
606 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
607 Change all callers. Simplify handling of symbols from sections
608 not included in the link.
609 (Symbol_table::add_from_dynobj): Handle ordinary symbol
611 (Weak_alias_sorter::operator()): Assert that symbols are
613 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
615 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
616 parameters. Change all callers.
617 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
618 symbol distinction. Use SHN_XINDEX when needed.
619 (Symbol_table::write_section_symbol): Add symtab_xindex
620 parameter. Change all callers.
621 (Symbol_table::sized_write_section_symbol): Likewise. Use
622 SHN_XINDEX when needed.
623 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
625 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
626 (Symbol::is_defined): Check is_ordinary.
627 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
628 (Symbol::is_absolute, Symbol::is_common): Likewise.
629 (class Sized_symbol): Update declarations.
630 (class Symbol_table): Update declarations.
631 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
632 parameters. Change all callers.
633 (Sized_symbol::override): Likewise.
634 (Symbol_table::override): Likewise.
635 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
636 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
637 is_ordinary, and orig_st_shndx parameters. Change all callers.
638 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
639 to be in an ordinary section.
640 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
641 object and is_ordinary parameters. Change all callers.
642 (Sized_dwarf_line_info::read_relocs): Add object parameter.
643 Change all callers. Don't add undefined or non-ordinary symbols
645 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
647 * dwarf_reader.h (class Sized_dwarf_line_info): Update
649 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
650 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
651 (Sized_relobj::relocate_sections): Likewise.
652 * target-reloc.h (scan_relocs): Adjust section symbol index.
653 (scan_relocatable_relocs): Likewise.
654 * i386.cc (Scan::local): Check for ordinary symbols.
655 * sparc.cc (Scan::local): Likewise.
656 * x86_64.cc (Scan::local): Likewise.
657 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
658 to symbol_section_and_value.
659 * testsuite/many_sections_test.cc: New file.
660 * testsuite/Makefile.am (BUILT_SOURCES): Define.
661 (check_PROGRAMS): Add many_sections_test.
662 (many_sections_test_SOURCES): Define.
663 (many_sections_test_DEPENDENCIES): Define.
664 (many_sections_test_LDFLAGS): Define.
665 (BUILT_SOURCES): Add many_sections_define.h.
666 (many_sections_define.h): New target.
667 (BUILT_SOURCES): Add many_sections_check.h.
668 (many_sections_check.h): New target.
669 (check_PROGRAMS): Add many_sections_r_test.
670 (many_sections_r_test_SOURCES): Define.
671 (many_sections_r_test_DEPENDENCIES): Define.
672 (many_sections_r_test_LDFLAGS): Define.
673 (many_sections_r_test_LDADD): Define.
674 (many_sections_r_test.o): New target.
675 * testsuite/Makefile.in: Rebuild.
677 2008-04-17 Cary Coutant <ccoutant@google.com>
679 * errors.cc (Errors::info): New function.
680 (gold_info): New function.
681 * errors.h (Errors::info): New function.
682 * gold.h (gold_info): New function.
683 * object.cc (Input_objects::add_object): Print trace output.
684 * options.cc (options::parse_set): New function.
685 (General_options::parse_wrap): Deleted.
686 (General_options::General_options): Deleted initializer.
687 * options.h (options::String_set): New typedef.
688 (options::parse_set): New function.
689 (DEFINE_set): New macro.
690 (General_options::wrap): Changed to use DEFINE_set. Changed
691 callers of any_wrap_symbols and is_wrap_symbol.
692 (General_options::trace, General_options::trace_symbol):
694 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
695 (General_options::wrap_symbols_): Deleted.
696 * symtab.cc (Symbol_table::add_from_object): Print trace output.
698 2008-04-17 David S. Miller <davem@davemloft.net>
700 * options.cc (General_options::parse_V): New function.
701 * options.h: Add entries for -V and -Qy.
703 2008-04-17 Ian Lance Taylor <iant@google.com>
705 * common.cc (Symbol_table::allocate_commons): Remove options
706 parameter. Change caller.
707 (Symbol_table::do_allocate_commons): Remove options parameter.
708 Change caller. Just call do_allocate_commons_list twice.
709 (Symbol_table::do_allocate_commons_list): New function, broken out
710 of do_allocate_commons.
711 * common.h (class Allocate_commons_task): Remove options_ field.
713 * symtab.cc (Symbol_table::Symbol_table): Initialize
715 (Symbol_table::add_from_object): Put TLS common symbols on
717 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
718 which are IN_OUTPUT_DATA.
719 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
720 allocate_commons and do_allocate_commons declarations. Declare
721 do_allocate_commons_list.
722 * gold.cc (queue_middle_tasks): Update creation of
723 Allocate_commons_task to not pass options.
724 * testsuite/Makefile.am (INCLUDES): Add -I.. .
725 (TLS_TEST_C_FLAGS): New variable.
726 (tls_test_c_pic.o): New target.
727 (tls_test_shared.so): Link in tls_test_c_pic.o.
728 (tls_test_c_pic_ie.o): New target.
729 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
730 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
731 (tls_test_c.o): New target.
732 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
733 (tls_pic_test_LDADD): Likewise.
734 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
735 (tls_shared_gd_to_ie_test_LDADD): Likewise.
736 (tls_test_c_gnu2.o): New target.
737 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
739 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
740 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
741 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
742 * testsuite/tls_test.cc: Include "config.h".
743 (t_last): Call t11_last.
744 * testsuite/tls_test.h (t11, t11_last): Declare.
745 * testsuite/tls_test_c.c: New file.
746 * testsuite/tls_test_main.cc (thread_routine): Call t11.
747 * configure.ac: Check for OpenMP support.
748 * configure, config.in, Makefile.in: Rebuild.
749 * testsuite/Makefile.in: Rebuild.
751 2008-04-16 Cary Coutant <ccoutant@google.com>
753 * i386.cc (Target_i386::define_tls_base_symbol): New function.
754 (Target_i386::tls_base_symbol_defined_): New field.
755 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
756 (Target_i386::Scan::global): Likewise.
757 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
758 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
759 (Target_x86_64::tls_base_symbol_defined_): New field.
760 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
761 (Target_x86_64::Scan::global): Likewise.
763 2008-04-16 Cary Coutant <ccoutant@google.com>
765 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
766 (Symbol::needs_plt_entry): Allow weak undefined symbols.
767 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
768 building shared libraries.
769 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
770 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
771 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
772 * testsuite/Makefile.in: Rebuild.
773 * testsuite/weak_undef.h: New file.
774 * testsuite/weak_undef_file1.cc: Add extra test cases.
775 * testsuite/weak_undef_file2.cc: Likewise.
776 * testsuite/weak_undef_test.cc: Likewise.
778 2008-04-16 David S. Miller <davem@davemloft.net>
780 * sparc.cc (Target_sparc::Scan): Change from struct to class.
781 Add issued_non_pic_error_ field. Declare check_non_pic.
782 (Target_sparc::Scan::check_non_pic): New function.
783 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
784 (Target_sparc::Scan::global): Likewise.
786 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
787 * configure: Rebuild.
789 * options.h (DEFINE_enable): New macro.
790 (new_dtags): New enable option.
791 (initfirst, interpose, loadfltr, nodefaultlib,
792 nodelete, nodlopen, nodump): New -z options.
793 * layout.cc (Layout:finish_dynamic_section): If new
794 dtags enabled, emit DT_RUNPATH. Also, emit a
795 DT_FLAGS_1 containing any specified -z flags.
797 2008-04-16 Ian Lance Taylor <iant@google.com>
799 * copy-relocs.cc: New file.
800 * copy-relocs.h: New file.
801 * reloc.cc: Remove Copy_relocs code.
803 * reloc-types.h (struct Reloc_types) [both versions]: Add
804 get_reloc_addend_noerror.
805 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
806 variants of add_global which take an addend which must be zero.
807 * i386.cc: Include "copy-relocs.h".
808 (class Target_i386): Change type of copy_relocs_ to variable,
810 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
812 (Target_i386::do_finalize_sections): Change handling of
814 * sparc.cc: Include "copy-relocs.h".
815 (class Target_sparc): Change type of copy_relocs_ to variable,
817 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
819 (Target_sparc::do_finalize_sections): Change handling of
821 * x86_64.cc: Include "copy-relocs.h".
822 (class Target_x86_64): Change type of copy_relocs_ to variable,
824 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
825 class. Change all callers.
826 (Target_x86_64::do_finalize_sections): Change handling of
828 * Makefile.am (CCFILES): Add copy-relocs.cc.
829 (HFILES): Add copy-relocs.h.
831 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
833 * testsuite/script_test_4.sh: Permit leading zeroes.
835 2008-04-15 Ian Lance Taylor <iant@google.com>
837 * script-sections.cc (Script_sections::create_segments): Use
838 header_size_adjustment even when there is enough room for the
840 * testsuite/script_test_4.sh: New file.
841 * testsuite/script_test_4.t: New file.
842 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
843 (check_DATA): Add script_test_4.stdout.
844 (MOSTLYCLEANFILES): Likewise.
845 (script_test_4): New target.
846 (script_test_4.stdout): New target.
847 * testsuite/Makefile.in: Rebuild.
849 * sparc.cc: Add definitions for Output_data_plt_sparc class
852 2008-04-14 David S. Miller <davem@davemloft.net>
854 * sparc.cc: New file.
855 * Makefile.am (TARGETSOURCES): Add sparc.cc
856 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
857 * configure.tgt: Document targ_extra_size and
858 targ_extra_big_endian. Add entries for sparc-* and
860 * configure.ac: Handle targ_extra_size and
861 targ_extra_big_endian.
862 * Makefile.in: Rebuild.
863 * configure: Likewise.
864 * po/POTFILES.in: Likewise.
865 * po/gold.pot: Likewise.
867 2008-04-14 Ian Lance Taylor <iant@google.com>
869 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
870 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
871 in the name/type/flags to section mapping. Don't call
872 allocate_output_section.
873 (Layout::choose_output_section): Change parameter from adjust_name
874 to is_input_section. Don't permit input sections after sections
875 are attached to segments. Don't call allocate_output_section.
876 (Layout::layout_eh_frame): Call update_flags_for_input_section,
877 not write_enable_output_section.
878 (Layout::make_output_section): Don't push to
879 unattached_section_list_ nor call attach_to_segment. Call
880 attach_section_to_segment if sections are attached.
881 (Layout::attach_sections_to_segments): New function.
882 (Layout::attach_section_to_segment): New function.
883 (Layout::attach_allocated_section_to_segment): Rename from
884 attach_to_segment. Remove flags parameter.
885 (Layout::allocate_output_section): Remove function.
886 (Layout::write_enable_output_section): Remove function.
887 * layout.h (class Layout): Update for above changes. Add new
888 field sections_are_attached_.
889 * output.h (Output_section::update_flags_for_input_section): New
891 * output.cc (Output_section::add_input_section): Call
892 update_flags_for_input_section.
893 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
895 2008-04-11 Cary Coutant <ccoutant@google.com>
897 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
899 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
901 2008-04-11 Ian Lance Taylor <iant@google.com>
903 * output.h (class Output_section_data): Remove inline definition
905 * output.cc (Output_section_data::set_addralign): New function.
907 2008-04-11 Cary Coutant <ccoutant@google.com>
909 Add support for TLS descriptors for i386 and x86_64.
910 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
911 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
912 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
914 (Target_i386::got_mod_index_entry): Remove unnecessary code.
915 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
916 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
918 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
919 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
920 Fix problem with initial-exec relocations.
921 (Target_i386::Relocate::relocate_tls): Likewise.
922 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
924 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
925 support for section-plus-offset dynamic table entries.
926 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
927 (Output_data_dynamic::Dynamic_entry): Add support for
928 section-plus-offset dynamic table entries.
929 (Output_data_dynamic::Classification): Likewise.
930 (Output_data_dynamic::classification_): Renamed offset_.
931 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
932 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
933 (Target_x86_64::make_plt_section): New function.
934 (Target_x86_64::reserve_tlsdesc_entries): New function.
935 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
936 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
937 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
938 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
939 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
940 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
941 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
942 add extra PLT entry for TLS descriptors.
943 (Output_data_plt_x86_64::got_): New field.
944 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
945 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
947 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
949 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
950 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
951 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
952 R_386_TLS_DESC_CALL relocations.
953 (Target_x86_64::Scan::global): Likewise.
954 (Target_x86_64::do_finalize_sections): Add dynamic table entries
956 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
957 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
958 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
960 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
962 * Makefile.in: Rebuild.
963 * configure: Rebuild.
964 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
965 (tls_test_shared2.so): New target.
966 (tls_shared_gd_to_ie_test_SOURCES): New variable.
967 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
968 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
969 (tls_shared_gd_to_ie_test_LDADD): New variable.
970 (tls_shared_gnu2_gd_to_ie_test): New target.
971 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
973 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
974 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
975 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
976 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
977 (tls_shared_gnu2_test): New target.
978 (tls_test_gnu2_shared.so): New target.
979 (tls_shared_gnu2_test_SOURCES): New variable.
980 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
981 (tls_shared_gnu2_test_LDFLAGS): New variable.
982 (tls_shared_gnu2_test_LDADD): New variable.
983 * testsuite/Makefile.in: Rebuild.
984 * testsuite/Makefile.
986 2008-04-11 Ian Lance Taylor <iant@google.com>
988 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
990 * testsuite/Makefile.in: Rebuild.
992 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
994 * testsuite/script_test_2.cc (main): Adjust test.
996 2008-04-11 David S. Miller <davem@davemloft.net>
997 Ian Lance Taylor <iant@google.com>
999 * options.h (General_options): Add entries for '-Y' and
1001 * options.cc (General_options:finalize): If -Y was used, add those
1002 entries to the library path instead of the default "/lib" and
1005 2008-04-11 David S. Miller <davem@davemloft.net>
1007 * testsuite/justsyms.t: Start at 0x100.
1008 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1009 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1011 * testsuite/script_test_2.cc: Adjust string and section length
1014 2008-04-09 Ian Lance Taylor <iant@google.com>
1017 * script-sections.cc (Sections_element::allocate_to_segment): Add
1019 (Output_section_definition::allocate_to_segment): Likewise.
1020 (Orphan_output_section::allocate_to_segment): Likewise.
1021 (Script_sections::attach_sections_using_phdrs_clause): Don't
1022 propagate non-PT_LOAD segments to orphan sections.
1023 * testsuite/Makefile.am (script_test_3.stdout): Generate using
1024 readelf rather than objdump.
1025 * testsuite/script_test_3.sh: Adjust accordingly. Test that
1026 .interp section and PT_INTERP segment are the same size.
1027 * testsuite/Makefile.in: Rebuild.
1029 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1030 aliases for symbols defined in the same object.
1031 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1032 (weak_alias_test_SOURCES): New variable.
1033 (weak_alias_test_DEPENDENCIES): New variable.
1034 (weak_alias_test_LDFLAGS): New variable.
1035 (weak_alias_test_LDADD): New variable.
1036 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1037 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1038 (weak_alias_test_3.o): New target.
1039 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1040 * testsuite/weak_alias_test_main.cc: New file.
1041 * testsuite/weak_alias_test_1.cc: New file.
1042 * testsuite/weak_alias_test_2.cc: New file.
1043 * testsuite/weak_alias_test_3.cc: New file.
1045 2008-04-08 Ian Lance Taylor <iant@google.com>
1047 * options.h (class General_options): Add --noinhibit-exec option.
1048 * main.cc (main): Check --noinhibit-exec.
1050 * options.h (class General_options): Define --wrap as a special
1051 option. Add wrap_symbols_ field.
1052 (General_options::any_wrap_symbols): New function.
1053 (General_options::is_wrap_symbol): New function.
1054 * options.cc (General_options::parse_wrap): New function.
1055 (General_options::General_options): Initialize wrap_symbols_.
1056 * symtab.cc (Symbol_table::wrap_symbol): New function.
1057 (Symbol_table::add_from_object): Handle --wrap.
1058 * symtab.h (class Symbol_table): Declare wrap_symbol.
1059 * target.h (Target::wrap_char): New function.
1060 (Target::Target_info): Add wrap_char field.
1061 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1062 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1063 * testsuite/testfile.cc (Target_test::test_target_info):
1066 * errors.cc (Errors::undefined_symbol): Mention symbol version if
1069 * layout.h (class Layout): Add added_eh_frame_data_ field.
1070 * layout.cc (Layout::Layout): Initialize new field.
1071 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1072 output section until we find a section we merged successfully.
1073 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1074 that the size be non-zero.
1076 * merge.cc (Object_merge_map::get_output_offset): Remove inline
1079 2008-04-08 Craig Silverstein <csilvers@google.com>
1081 * configure.ac: Export new conditional variable HAVE_ZLIB.
1082 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1084 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1085 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1087 2008-04-07 Ian Lance Taylor <iant@google.com>
1089 * version.cc (version_string): Set to "1.5".
1091 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1092 Add issued_non_pic_error_ field. Declare check_non_pic.
1093 (Target_x86_64::Scan::check_non_pic): New function.
1094 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1095 (Target_x86_64::Scan::global): Likewise.
1097 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1098 addend parameter. Change caller. Handle merge sections.
1099 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1100 Address to Addend. Don't add in the result of
1101 local_section_offset, pass down the addend and use the returned
1103 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1104 Update declarations of local_section_offset and symbol_value.
1105 * testsuite/two_file_test_1.cc (t18): New function.
1106 * testsuite/two_file_test_2.cc (f18): New function.
1107 * testsuite/two_file_test_main.cc (main): Call t18.
1108 * testsuite/two_file_test.h (t18, f18): Declare.
1110 * configure.ac: Don't test for objdump, c++filt, or readelf.
1111 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1113 (TEST_READELF): New variable.
1114 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1115 (check_PROGRAMS): Add two_file_strip_test.
1116 (two_file_strip_test): New target.
1117 (check_PROGRAMS): Add two_file_same_shared_strip_test.
1118 (two_file_same_shared_strip_test_SOURCES): New variable.
1119 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1120 (two_file_same_shared_strip_test_LDFLAGS): New variable.
1121 (two_file_same_shared_strip_test_LDADD): New variable.
1122 (two_file_shared_strip.so): New target.
1123 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1124 (ver_test_5.syms, ver_test_7.syms): Likewise.
1125 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1126 (strip_test_3.stdout): Use TEST_OBJDUMP.
1127 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1129 2008-04-04 Cary Coutant <ccoutant@google.com>
1131 * symtab.h (Symbol::is_weak_undefined): New function.
1132 (Symbol::is_strong_undefined): New function.
1133 (Symbol::is_absolute): New function.
1134 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1135 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1137 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1138 (weak_undef_test): New target.
1139 * testsuite/Makefile.in: Rebuild.
1140 * testsuite/weak_undef_file1.cc: New file.
1141 * testsuite/weak_undef_file2.cc: New file.
1142 * testsuite/weak_undef_test.cc: New file.
1144 2008-04-03 Craig Silverstein <csilvers@google.com>
1146 * compressed_output.h (class Output_compressed_section): Use
1148 * compressed_output.cc (zlib_compress): Use unsigned buffers,
1150 (zlib_compressed_suffix): Removed.
1151 (Output_compressed_section::set_final_data_size): Use unsigned
1153 * testsuite/Makefile.am (flagstest_compress_debug_sections):
1154 Fix linker invocation.
1155 (flagstest_o_specialfile_and_compress_debug_sections):
1157 * testsuite/Makefile.in: Regenerated.
1159 2008-04-02 David S. Miller <davem@davemloft.net>
1161 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1162 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1164 2008-04-02 Craig Silverstein <csilvers@google.com>
1168 2008-04-02 Ian Lance Taylor <iant@google.com>
1170 * fileread.cc (File_read::find_view): Add byteshift and vshifted
1171 parameters. Update for new key type to views_. Change all
1173 (File_read::read): Adjust for byteshift in returned view.
1174 (File_read::add_view): New function, broken out of
1176 (File_read::make_view): New function, broken out of
1178 (File_read::find_or_make_view): Add offset and aligned
1179 parameters. Rewrite accordingly. Change all callers.
1180 (File_read::get_view): Add offset and aligned parameters. Adjust
1181 for byteshift in return value.
1182 (File_read::get_lasting_view): Likewise.
1183 * fileread.h (class File_read): Update declarations.
1184 (class File_read::View): Add byteshift_ field. Add byteshift to
1185 constructor. Add byteshift method.
1186 * archive.h (Archive::clear_uncached_views): New function.
1187 (Archive::get_view): Add aligned parameter. Change all callers.
1188 * object.h (Object::get_view): Add aligned parameter. Change all
1190 (Object::get_lasting_view): Likewise.
1192 * fileread.cc (File_read::release): Don't call clear_views if
1193 there are multiple objects.
1194 * fileread.h (File_read::clear_uncached_views): New function.
1195 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
1198 2008-03-31 Cary Coutant <ccoutant@google.com>
1200 Add thin archive support.
1201 * archive.cc (Archive::armagt): New const.
1202 (Archive::setup): Remove task parameter and calls to unlock.
1203 (Archive::unlock_nested_archives): New function.
1204 (Archive::read_header): Add nested_off parameter. Change
1206 (Archive::interpret_header): Likewise.
1207 (Archive::include_all_members): Change to handle thin
1209 (Archive::include_member): Likewise.
1210 * archive.h (Archive::Archive): Add new parameters and
1212 (Archive::armagt): New const.
1213 (Archive::setup): Remove task parameter.
1214 (Archive::unlock_nested_archives): New function.
1215 (Archive::read_header): Add nested_off parameter.
1216 (Archive::interpret_header): Likewise.
1217 (Archive::Nested_archive_table): New typedef.
1218 (Archive::is_thin_archive_): New field.
1219 (Archive::nested_archives_): New field.
1220 (Archive::options_): New field.
1221 (Archive::dirpath_): New field.
1222 (Archive::task_): New field.
1223 * readsyms.cc (Read_symbols::do_read_symbols): Add check
1224 for thin archives. Pass additional parameters to
1225 Archive::Archive. Unlock the archive file after calling
1228 2008-03-29 Ian Lance Taylor <iant@google.com>
1230 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
1231 version symbol to be local.
1232 * testsuite/ver_test_4.sh: New file.
1233 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
1234 (check_DATA): Add ver_test_4.syms.
1235 (ver_test_4.syms): New target.
1236 * testsuite/Makefile.in: Rebuild.
1239 (Output_section::Input_section_sort_entry::has_priority): New
1241 (Output_section::Input_section_sort_entry::match_file_name): New
1243 (Output_section::Input_section_sort_entry::match_section_name):
1245 (Output_section::Input_section_sort_entry::match_section_name_prefix):
1247 (Output_section::Input_section_sort_entry::match_section_file):
1249 (Output_section::Input_section_sort_compare::operator()): Rewrite
1250 using new Input_section_sort_entry functions. Sort crtbegin and
1251 crtend first. Sort sections with no priority before sections with
1253 * testsuite/initpri1.c (d3): Check j != 4.
1254 (cd5): New constructor/destructor function.
1255 (main): Check j != 2.
1257 * symtab.cc (Symbol_table::add_from_object): If we don't use the
1258 new symbol when resolving, don't call set_is_default.
1259 * testsuite/ver_test_7.cc: New file.
1260 * testsuite/ver_test_7.sh: New file.
1261 * testsuite/Makefile.am (ver_test_7.so): New target.
1262 (ver_test_7.o): New target.
1263 (check_SCRIPTS): Add ver_test_7.sh.
1264 (check_DATA): Add ver_test_7.syms.
1265 (ver_test_7.syms): New target.
1267 2008-03-28 Ian Lance Taylor <iant@google.com>
1269 * layout.cc (Layout::layout): If we see an input section with a
1270 name that needs sorting, set the must_sort flag for the output
1272 (Layout::make_output_section): If the name of the output section
1273 indicates that it might require sorting, set the may_sort flag.
1274 * output.h (Output_section::may_sort_attached_input_sections): New
1276 (Output_section::set_may_sort_attached_input_sections): New
1278 (Output_section::must_sort_attached_input_sections): New
1280 (Output_section::set_must_sort_attached_input_sections): New
1282 (class Output_section): Declare Input_section_sort_entry. Define
1283 Input_section_sort_compare. Declare
1284 sort_attached_input_sections. Add new fields:
1285 may_sort_attached_input_sections_,
1286 must_sort_attached_input_sections_,
1287 attached_input_sections_are_sorted_.
1288 * output.cc (Output_section::Output_section): Initialize new
1290 (Output_section::add_input_section): Add an entry to
1291 input_sections_ if may_sort or must_sort are true.
1292 (Output_section::set_final_data_size): Call
1293 sort_attached_input_sections if necessary.
1294 (Output_section::Input_section_sort_entry): Define new class.
1295 (Output_section::Input_section_sort_compare::operator()): New
1297 (Output_section::sort_attached_input_sections): New function.
1298 * configure.ac: Check whether the compiler supports constructor
1299 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
1300 * testsuite/initpri1.c: New file.
1301 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
1302 CONSTRUCTOR_PRIORITY.
1303 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
1304 (initpri1_LDFLAGS): New variable.
1305 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1307 2008-03-27 Ian Lance Taylor <iant@google.com>
1309 * common.cc (Sort_commons::operator): Correct sorting algorithm.
1310 * testsuite/common_test_1.c: New file.
1311 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
1312 (common_test_1_SOURCES): New variable.
1313 (common_test_1_DEPENDENCIES): New variable.
1314 (common_test_1_LDFLAGS): New variable.
1316 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
1317 and commons_ correctly when NAME/VERSION does not override
1319 * testsuite/ver_test_6.c: New file.
1320 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
1321 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
1322 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
1324 2008-03-26 Ian Lance Taylor <iant@google.com>
1326 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
1327 of an undefined symbol from a version script.
1328 * testsuite/Makefile.am (ver_test_5.so): New target.
1329 (ver_test_5.o): New target.
1330 (check_SCRIPTS): Add ver_test_5.sh.
1331 (check_DATA): Add ver_test_5.syms.
1332 (ver_test_5.syms): New target.
1333 * testsuite/ver_test_5.cc: New file.
1334 * testsuite/ver_test_5.script: New file.
1335 * testsuite/ver_test_5.sh: New file.
1336 * Makefile.in, testsuite/Makefile.in: Rebuild.
1339 Fix problems building gold with gcc 4.3.0.
1340 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
1341 (gold_error_at_location, gold_warning_at_location): Use it.
1342 * configure.ac: Check whether we can compile and use a template
1343 function with a printf attribute.
1344 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
1345 when jumping over bytes.
1346 * object.cc: Instantiate Object::read_section_data.
1347 * debug.h: Include <cstring>
1348 * dwarf_reader.cc: Include <algorithm>
1349 * main.cc: Include <cstring>.
1350 * options.cc: Include <cstring>.
1351 * output.cc: Include <cstring>.
1352 * script.cc: Include <cstring>.
1353 * script.h: Include <string>.
1354 * symtab.cc: Include <cstring> and <algorithm>.
1355 * target-select.cc: Include <cstring>.
1356 * version.cc: Include <string>.
1357 * testsuite/testmain.cc: Include <cstdlib>.
1358 * configure, config.in: Rebuild.
1360 2008-03-25 Ian Lance Taylor <iant@google.com>
1362 * options.cc: Include "../bfd/bfdver.h".
1363 (options::help): Print bug reporting address.
1365 * version.cc (print_version): Adjust output for current value of
1370 * options.cc (options::help): Print list of supported targets.
1371 * target-select.h: Include <vector>.
1372 (class Target_selector): Make machine_, size_, and is_big_endian_
1373 fields const. Add bfd_name_ and instantiated_target_ fields.
1374 (Target_selector::Target_selector): Add bfd_name parameter.
1375 (Target_selector::recognize): Make non-virtual, call
1377 (Target_selector::recognize_by_name): Make non-virtual, call
1378 do_recognize_by_name.
1379 (Target_selector::supported_names): New function.
1380 (Target_selector::bfd_name): New function.
1381 (Target_selector::do_instantiate_target): New pure virtual
1383 (Target_selector::do_recognize): New virtual function.
1384 (Target_selector::do_recognize_by_name): New virtual function.
1385 (Target_selector::instantiate_target): New private function.
1386 (supported_target_names): Declare.
1387 * target-select.cc (Target_selector::Target_selector): Update for
1388 new parameter and fields.
1389 (select_target_by_name): Check that the name matches before
1390 calling recognize_by_name.
1391 (supported_target_names): New function.
1392 * i386.cc (class Target_selector_i386): Update Target_selector
1393 constructor call. Remove recognize and recognize_by_name. Add
1394 do_instantiate_target.
1395 * x86_64.cc (class Target_selector_x86_64): Likewise.
1396 * testsuite/testfile.cc (class Target_selector_test): Update for
1397 changes to Target_selector.
1399 * README: Rewrite, with some notes on unsupported features.
1401 2008-03-24 Cary Coutant <ccoutant@google.com>
1403 * i386.cc (Target_i386::Got_type): New enum declaration.
1404 (Target_i386::Scan::local): Updated callers of Output_data_got
1406 (Target_i386::Scan::global): Likewise.
1407 (Target_i386::Relocate::relocate): Likewise.
1408 (Target_i386::Relocate::relocate_tls): Likewise.
1409 * object.h (Got_offset_list): New class.
1410 (Sized_relobj::local_has_got_offset): Added got_type parameter.
1411 (Sized_relobj::local_got_offset): Likewise.
1412 (Sized_relobj::set_local_got_offset): Likewise.
1413 (Sized_relobj::local_has_tls_got_offset): Removed.
1414 (Sized_relobj::local_tls_got_offset): Removed.
1415 (Sized_relobj::set_local_tls_got_offset): Removed.
1416 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
1417 * output.cc (Output_data_got::add_global): Added got_type parameter.
1418 (Output_data_got::add_global_with_rel): Likewise.
1419 (Output_data_got::add_global_with_rela): Likewise.
1420 (Output_data_got::add_global_pair_with_rel): New function.
1421 (Output_data_got::add_global_pair_with_rela): New function.
1422 (Output_data_got::add_local): Added got_type parameter.
1423 (Output_data_got::add_local_with_rel): Likewise.
1424 (Output_data_got::add_local_with_rela): Likewise.
1425 (Output_data_got::add_local_pair_with_rel): New function.
1426 (Output_data_got::add_local_pair_with_rela): New function.
1427 (Output_data_got::add_global_tls): Removed.
1428 (Output_data_got::add_global_tls_with_rel): Removed.
1429 (Output_data_got::add_global_tls_with_rela): Removed.
1430 (Output_data_got::add_local_tls): Removed.
1431 (Output_data_got::add_local_tls_with_rel): Removed.
1432 (Output_data_got::add_local_tls_with_rela): Removed.
1433 * output.h (Output_data_got::add_global): Added got_type parameter.
1434 (Output_data_got::add_global_with_rel): Likewise.
1435 (Output_data_got::add_global_with_rela): Likewise.
1436 (Output_data_got::add_global_pair_with_rel): New function.
1437 (Output_data_got::add_global_pair_with_rela): New function.
1438 (Output_data_got::add_local): Added got_type parameter.
1439 (Output_data_got::add_local_with_rel): Likewise.
1440 (Output_data_got::add_local_with_rela): Likewise.
1441 (Output_data_got::add_local_pair_with_rel): New function.
1442 (Output_data_got::add_local_pair_with_rela): New function.
1443 (Output_data_got::add_global_tls): Removed.
1444 (Output_data_got::add_global_tls_with_rel): Removed.
1445 (Output_data_got::add_global_tls_with_rela): Removed.
1446 (Output_data_got::add_local_tls): Removed.
1447 (Output_data_got::add_local_tls_with_rel): Removed.
1448 (Output_data_got::add_local_tls_with_rela): Removed.
1449 * resolve.cc (Symbol::override_base_with_special): Removed
1450 reference to has_got_offset_ field.
1451 * symtab.cc (Symbol::init_fields): Replaced initialization
1452 of got_offset_ with got_offsets_. Removed initialization
1454 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
1455 (Symbol::got_offset): Likewise.
1456 (Symbol::set_got_offset): Likewise.
1457 (Symbol::has_tls_got_offset): Removed.
1458 (Symbol::tls_got_offset): Removed.
1459 (Symbol::set_tls_got_offset): Removed.
1460 (Symbol::got_offset_): Removed.
1461 (Symbol::tls_mod_got_offset_): Removed.
1462 (Symbol::tls_pair_got_offset_): Removed.
1463 (Symbol::got_offsets_): New field.
1464 (Symbol::has_got_offset): Removed.
1465 (Symbol::has_tls_mod_got_offset): Removed.
1466 (Symbol::has_tls_pair_got_offset): Removed.
1467 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
1468 (Target_x86_64::Scan::local): Updated callers of Output_data_got
1470 (Target_x86_64::Scan::global): Likewise.
1471 (Target_x86_64::Relocate::relocate): Likewise.
1472 (Target_x86_64::Relocate::relocate_tls): Likewise.
1474 2008-03-25 Ben Elliston <bje@au.ibm.com>
1476 * yyscript.y: Fix spelling error in comment.
1478 2008-03-24 Ian Lance Taylor <iant@google.com>
1480 * options.h (class General_options): Define build_id option.
1481 * layout.h (class Layout): Declare write_build_id, create_note,
1482 create_build_id. Add build_id_note_ member.
1483 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
1484 "libiberty.h", "md5.h", "sha1.h".
1485 (Layout::Layout): Initialize eh_frame_data_,
1486 eh_frame_hdr_section_, and build_id_note_.
1487 (Layout::finalize): Call create_build_id.
1488 (Layout::create_note): New function, broken out of
1489 Layout::create_gold_note.
1490 (Layout::create_gold_note): Call create_note.
1491 (Layout::create_build_id): New function.
1492 (Layout::write_build_id): New function.
1493 (Close_task_runner::run): Call write_build_id.
1495 * x86_64.cc: Correct license to GPLv3.
1497 2008-03-23 Ian Lance Taylor <iant@google.com>
1499 * options.cc: Include "demangle.h".
1500 (parse_optional_string): New function.
1501 (parse_long_option): Handle takes_optional_argument.
1502 (parse_short_option): Update dash_z initializer. Handle
1503 takes_optional_argument.
1504 (General_options::General_options): Initialize do_demangle_.
1505 (General_options::finalize): Set do_demangle_. Handle demangling
1507 * options.h (parse_optional_string): Declare.
1508 (struct One_option): Add optional_arg field. Update constructor.
1509 Update call constructor calls. Add takes_optional_argument
1511 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
1512 (DEFINE_optional_string): Define.
1513 (General_options::demangle): Change from DEFINE_bool to
1514 DEFINE_optional_string.
1515 (General_options::no_demangle): New function.
1516 (General_options::do_demangle): New function.
1517 (General_options::set_do_demangle): New function.
1518 (General_options::execstack_status_): Move definition to end of
1520 (General_options::static_): Likewise.
1521 (General_options::do_demangle_): New field.
1522 * object.cc (big_endian>::get_symbol_location_info): Call
1523 Options::do_demangle, not Options::demangle.
1524 * symtab.cc (demangle): Likewise.
1526 2008-03-22 Ian Lance Taylor <iant@google.com>
1528 * gold.h: Include <cstddef> and <sys/types.h>
1529 * options.h: Include <cstring>.
1531 2008-03-21 Ian Lance Taylor <iant@google.com>
1533 * Added source code to GNU binutils.