* layout.cc (Layout::set_segment_offsets): Align the file offset
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
661be1e2
ILT
12009-10-15 Ian Lance Taylor <iant@google.com>
2
3 * layout.cc (Layout::set_segment_offsets): Align the file offset
4 to the segment aligment for -N or -n with no load segment.
5 * output.cc (Output_segment::add_output_section): Don't crash if
6 the first section is a TLS section.
7 (Output_segment::set_section_list_addresses): Print an error
8 message if the address moves backward in a linker script.
9 * script-sections.cc
10 (Output_section_element_input::set_section_addresses): Don't
11 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12 (Orphan_output_section::set_section_addresses): Likewise.
13
f15f61a7
DK
142009-10-15 Doug Kwan <dougkwan@google.com>
15
16 * layout.cc (Layout::finish_dynamic_section): Generate tags
17 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
18 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
19 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
20
82bb573a
ILT
212009-10-14 Ian Lance Taylor <iant@google.com>
22
23 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
24 fields.
25 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
26 data_shdr fields of relinfo.
27 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
28 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
29 R_386_TLS_LDO_32, adjust based on section flags.
30 (Target_i386::Relocate::fix_up_ldo): Remove.
31
374ad285
ILT
322009-10-13 Ian Lance Taylor <iant@google.com>
33
34 Add support for -pie.
35 * options.h (class General_options): Add -pie and
36 --pic-executable.
37 (General_options::output_is_position_independent): Test -pie.
38 (General_options::output_is_executable): Return true if not shared
39 and not relocatable.
40 (General_options::output_is_pie): Remove.
41 * options.cc (General_options::finalize): Reject incompatible uses
42 of -pie.
43 * gold.cc (queue_middle_tasks): A -pie link is not static.
44 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
45 * symtab.cc (Symbol::final_value_is_known): Return false if
46 output_is_position_independent.
47 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
48 output_is_position_independent.
49 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
50 output_is_position_independent.
51 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
52 output_is_position_independent.
53 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
54 two_file_pie_test.
55 (basic_pie_test.o, basic_pie_test): New targets.
56 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
57 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
58 (two_file_pie_test): New target.
59 * testsuite/Makefile.in: Rebuild.
60 * README: Remove note saying that -pie is not supported.
61
c6585162
ILT
622009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
63
64 * options.h (class General_options): Add -init and -fini.
65 * layout.cc (Layout::finish_dynamic_section): Emit
66 given init and fini functions.
67
032ce4e9
ST
682009-10-13 Sriraman Tallam <tmsriram@google.com>
69
70 * gc.h (gc_process_relocs): Check if icf is enabled using new
71 function.
72 * gold.cc (queue_initial_tasks): Likewise.
73 (queue_middle_tasks): Likewise.
74 * object.cc (do_layout): Likewise.
75 * symtab.cc (is_section_folded): Likewise.
76 * main.cc (main): Likewise.
77 * reloc.cc (Read_relocs::run): Likewise.
78 (Sized_relobj::do_scan_relocs): Likewise.
79 * icf.cc (is_function_ctor_or_dtor): New function.
80 (Icf::find_identical_sections): Check if function is ctor or dtor when
81 safe icf is chosen.
82 * options.h (General_options::icf): Change option to be an enum.
83 (Icf_status): New enum.
84 (icf_enabled): New method.
85 (icf_safe_folding): New method.
86 (set_icf_status): New method.
87 (icf_status_): New variable.
88 * (options.cc) (General_options::finalize): Set icf_status_.
89 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
90 icf_test and icf_keep_unique_test to use the --icf enum flag.
91 * testsuite/icf_safe_test.sh: New file.
92 * testsuite/icf_safe_test.cc: New file.
93
f345227a
ST
942009-10-12 Sriraman Tallam <tmsriram@google.com>
95
96 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
97 includes to gc.h and icf.h.
98 * arm.cc: Include gc.h.
99 * gold.cc: Likewise.
100 * i386.cc: Likewise.
101 * powerpc.cc: Likewise.
102 * sparc.cc: Likewise.
103 * x86_64.cc: Likewise.
104 * gc.h: Include icf.h.
105
1c7814ed
ILT
1062009-10-11 Ian Lance Taylor <iant@google.com>
107
108 * plugin.cc: Include "gold.h" before other header files.
109
ae3b5189
CD
1102009-10-10 Chris Demetriou <cgd@google.com>
111
112 * options.h (Input_file_argument::Input_file_type): New enum.
113 (Input_file_argument::is_lib_): Replace with...
114 (Input_file_argument::type_): New member.
115 (Input_file_argument::Input_file_argument): Take Input_file_type
116 'type' rather than boolean 'is_lib' as second argument.
117 (Input_file_argument::is_lib): Use type_.
118 (Input_file_argument::is_searched_file): New function.
119 (Input_file_argument::may_need_search): Handle is_searched_file.
120 * options.cc (General_options::parse_library): Support -l:filename.
121 (General_options::parse_just_symbols): Update for Input_file_argument
122 changes.
123 (Command_line::process): Likewise.
124 * archive.cc (Archive::get_file_and_offset): Likewise.
125 * plugin.cc (Plugin_manager::release_input_file): Likewise.
126 * script.cc (read_script_file, script_add_file): Likewise.
127 * fileread.cc (Input_file::Input_file): Likewise.
128 (Input_file::will_search_for): Handle is_searched_file.
129 (Input_file::open): Likewise.
130 * readsyms.cc (Read_symbols::get_name): Likewise.
131 * testsuite/Makefile.am (searched_file_test): New test.
132 * testsuite/Makefile.in: Regenerate.
133 * testsuite/searched_file_test.cc: New file.
134 * testsuite/searched_file_test_lib.cc: New file.
135
f3048a1d
ILT
1362009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
137 Ian Lance Taylor <iant@google.com>
138
139 * descriptor.cc: Include <cstdio> and "binary-io.h".
140 (Descriptors::open): Open the files in binary mode always.
141 * script.cc (Lex::get_token): Treat \r as whitespace.
142
d4780e57
ILT
1432009-10-09 Ian Lance Taylor <iant@google.com>
144
145 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
146
d9a893b8
ILT
1472009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
148 Ian Lance Taylor <iant@google.com>
149
150 * configure.ac: Check for readv function also.
151 * fileread.cc (readv): Define if not HAVE_READV.
152 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
153 does not exist.
154 * config.in: Regenerate.
155 * configure: Regenerate.
156
c0a62865
DK
1572009-10-09 Doug Kwan <dougkwan@google.com>
158
159 * layout.cc (Layout::make_output_section): Call target hook to make
160 ordinary output section.
161 (Layout::finalize): Adjust parameter list of call the
162 Target::may_relax().
163 * layout.h (class Layout::section_list): New method.
164 * merge.h (Output_merge_base::entsize): Change visibility to public.
165 (Output_merge_base::is_string, Output_merge_base::do_is_string):
166 New methods.
167 (Output_merge_string::do_is_string): New method.
168 * object.cc (Sized_relobj::do_setup): renamed from
169 Sized_relobj::set_up.
170 * object.h (Sized_relobj::adjust_shndx,
171 Sized_relobj::initializ_input_to_output_maps,
172 Sized_relobj::free_input_to_output_maps): Change visibilities to
173 protected.
174 (Sized_relobj::setup): Virtualize.
175 (Sized_relobj::do_setup): New method declaration.
176 (Sized_relobj::invalidate_section_offset,
177 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
178 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
179 * options.cc (parse_int): New function.
180 * options.h (parse_int): New declaration.
181 (DEFINE_int): New macro.
182 (stub_group_size): New option.
183 * output.cc (Output_section::Output_section): Initialize memebers
184 merge_section_map_, merge_section_by_properties_map_,
185 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
186 (Output_section::add_input_section): Handled deferred code-fill
187 generation and remove an old comment.
188 (Output_section::add_relaxed_input_section): New method definition.
189 (Output_section::add_merge_input_section): Use merge section by
190 properties map to speed to search. Update merge section maps
191 as appropriate.
192 (Output_section::build_relaxation_map): New method definition.
193 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
194 Same.
195 (Output_section::relax_input_section): Renamed to
196 Output_section::convert_input_sections_to_relaxed_sections and change
197 interface to take a vector of pointers to relaxed sections.
198 (Output_section::find_merge_section,
199 Output_section::find_relaxed_input_section): New method definitions.
200 (Output_section::is_input_address_mapped,
201 Output_section::output_offset, Output_section::output_address):
202 Use output section data maps to speed up searching.
203 (Output_section::find_starting_output_address): Add comments.
204 (Output_section::do_write,
205 Output_section::write_to_postprocessing_buffer): Do code-fill
206 generation as appropriate.
207 (Output_section::get_input_sections): Invalidate relaxed input section
208 map.
209 (Output_section::restore_states): Adjust type of checkpoint .
210 Invalidate relaxed input section map.
211 * output.h (Output_merge_base): New class declaration.
212 (Input_section_specifier): New class defintion.
213 (class Output_relaxed_input_section) Change base class to
214 Output_section_data_build.
215 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
216 base class initializer.
217 (Output_section::add_relaxed_input_section): New method declaration.
218 (Output_section::Input_section): Change visibility to protected.
219 (Output_section::Input_section::relobj,
220 Output_section::Input_section::shndx): Handle relaxed input sections.
221 Output_section::input_sections) Change visibility to protected. Also
222 define overload to return a non-const pointer.
223 (Output_section::Merge_section_properties): New class defintion.
224 (Output_section::Merge_section_by_properties_map,
225 Output_section::Output_section_data_by_input_section_map,
226 Output_section::Relaxation_map): New types.
227 (Output_section::relax_input_section): Rename method to
228 Output_section::convert_input_sections_to_relaxed_sections and change
229 interface to take a vector of relaxed section pointers.
230 (Output_section::find_merge_section,
231 Output_section::find_relaxed_input_section,
232 Output_section::build_relaxation_map,
233 Output_section::convert_input_sections_in_list_to_relaxed_sections):
234 New method declarations.
235 (Output_section::merge_section_map_
236 Output_section::merge_section_by_properties_map_,
237 Output_section::relaxed_input_section_map_,
238 Output_section::is_relaxed_input_section_map_valid_,
239 Output_section::generate_code_fills_at_write_): New data members.
240 * script-sections.cc
241 (Output_section_element_input::set_section_addresses): Call
242 current_data_size and addralign methods of relaxed input sections.
243 (Orphan_output_section::set_section_addresses): Call current_data_size
244 and addralign methods of relaxed input sections.
245 * symtab.cc (Symbol_table::compute_final_value): Extract template
246 from the body of Symbol_table::sized_finalize_symbol.
247 (Symbol_table::sized_finalized_symbol): Call
248 Symbol_table::compute_final_value.
249 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
250 (Symbol_table::compute_final_value): New templated method declaration.
251 * target.cc (Target::do_make_output_section): New method defintion.
252 * target.h (Target::make_output_section): New method declaration.
253 (Target::relax): Add more parameters for input objects, symbol table
254 and layout. Adjust call to do_relax.
255 (Target::do_make_output_section): New method declaration.
256 (Target::do_relax): Add parameters for input objects, symbol table
257 and layout.
258
d446d6c4
ILT
2592009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
260
261 * pread.c: Include stdio.h.
262
bc06c745
ILT
2632009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
264
265 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
266 defined.
267
75aea3d0
ILT
2682009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
269
270 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
271 Change read_shndx type to unsigned int.
272 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
273 int.
274 (Sized_dwarf_line_info::read_line_mappings): Likewise.
275 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
276 Change read_shndx type to unsigned int.
277 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
278 int.
279 (Sized_dwarf_line_info::read_line_mappings): Likewise.
280 * layout.cc (Layout::create_symtab_sections): Cast the result of
281 local_symcount * symsize to off_t in the gold_assert.
282
be8fcb75
ILT
2832009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
284
285 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
286 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
287 R_ARM_BASE_ABS.
288 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
289 (Arm_relocate_functions::thm_abs5): New function.
290 (Arm_relocate_functions::abs12): New function.
291 (Arm_relocate_functions::abs16): New function.
292 (Arm_relocate_functions::base_abs): New function.
293 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
294 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
295 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
296 R_ARM_BASE_ABS.
297 (Scan::global): Likewise.
298 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
299 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
300 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
301 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
302 R_ARM_BASE_ABS.
303
c2a122b6
ILT
3042009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
305
306 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
307 (Arm_relocate_functions::movt_prel): New function.
308 (Arm_relocate_functions::thm_movw_prel_nc): New function.
309 (Arm_relocate_functions::thm_movt_prel): New function.
310 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
311 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
312 (Scan::global, Relocate::relocate): Likewise.
313 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
314
c4aa1e2d
ILT
3152009-10-09 Mikolaj Zalewski <mikolajz@google.com>
316
317 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
318 Incremental_checker.
319 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
320 unsigned int.
321 (class Incremental_inputs_header): New class.
322 (Incremental_inputs_header_writer): Edit comment.
323 (Incremental_inputs_entry): New class.
324 (Incremental_inputs_entry_writer): Edit comment.
325 (Sized_incremental_binary::do_find_incremental_inputs_section):
326 Add *strtab_shndx parameter, fill it.
327 (Sized_incremental_binary::do_check_inputs): New method.
328 (Incremental_checker::can_incrementally_link_output_file): Use
329 Sized_incremental_binary::check_inputs.
330 (Incremental_inputs::report_command_line): Save command line in
331 command_line_.
332 * incremental.h:
333 (Incremental_binary::find_incremental_inputs_section): New
334 method.
335 (Incremental_binary::do_find_incremental_inputs_section): Add
336 strtab_shndx parameter.
337 (Incremental_binary::do_check_inputs): New pure virtual method.
338 (Sized_incremental_binary::do_check_inputs): Declare.
339 (Incremental_checker::Incremental_checker): Add incremental_inputs
340 parameter, use it to initialize incremental_inputs_.
341 (Incremental_checker::incremental_inputs_): New field.
342 (Incremental_checker::command_line): New method.
343 (Incremental_checker::inputs): New method.
344 (Incremental_checker::command_line_): New field.
345
c549a694
ILT
3462009-10-09 Mikolaj Zalewski <mikolajz@google.com>
347
348 * incremental.cc: Include <cstdarg> and "target-select.h".
349 (vexplain_no_incremental): New function.
350 (explain_no_incremental): New function.
351 (Incremental_binary::error): New method.
352 (Sized_incremental_binary::do_find_incremental_inputs_section): New
353 method.
354 (make_sized_incremental_binary): New function.
355 (open_incremental_binary): New function.
356 (can_incrementally_link_file): Add checks if output is ELF and has
357 inputs section.
358 * incremental.h: Include "elfcpp_file.h" and "output.h".
359 (Incremental_binary): New class.
360 (Sized_incremental_binary): New class.
361 (open_incremental_binary): Declare.
362 * object.cc (is_elf_object): Use
363 elfcpp::Elf_recognizer::is_elf_file.
364 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
365 * output.h (Output_file::filesize): New method.
366
fd3c5f0b
ILT
3672009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
368
369 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
370 New function.
371 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
372 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
373 function.
374 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
375 function.
376 (Arm_relocate_functions::movw_abs_nc): New function.
377 (Arm_relocate_functions::movt_abs): New function.
378 (Arm_relocate_functions::thm_movw_abs_nc): New function.
379 (Arm_relocate_functions::thm_movt_abs): New function.
380 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
381 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
382 (Scan::global): Likewise.
383 (Relocate::relocate): Likewise.
384 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
385
7f5309a5
ILT
3862009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
387
388 * arm.cc (Arm_relocate_functions::got_prel) New function.
389 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
390 (Relocate::relocate): Likewise.
391 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
392
364c7fa5
ILT
3932009-10-06 Ian Lance Taylor <iant@google.com>
394
395 * options.h (class General_options): Define
396 split_stack_adjust_size parameter.
397 * object.h (class Object): Add uses_split_stack_ and
398 has_no_split_stack_ fields. Add uses_split_stack and
399 has_no_split_stack accessor functions. Declare
400 handle_split_stack_section.
401 (class Reloc_symbol_changes): Define.
402 (class Sized_relobj): Define Function_offsets. Declare
403 split_stack_adjust, split_stack_adjust_reltype, and
404 find_functions.
405 * object.cc (Object::handle_split_stack_section): New function.
406 (Sized_relobj::do_layout): Call handle_split_stack_section.
407 * dynobj.cc (Sized_dynobj::do_layout): Call
408 handle_split_stack_section.
409 * reloc.cc (Sized_relobj::relocate_sections): Call
410 split_stack_adjust for executable sections in split_stack
411 objects. Pass reloc_map to relocate_section.
412 (Sized_relobj::split_stack_adjust): New function.
413 (Sized_relobj::split_stack_adjust_reltype): New function.
414 (Sized_relobj::find_functions): New function.
415 * target-reloc.h: Include "object.h".
416 (relocate_section): Add reloc_symbol_changes parameter. Change
417 all callers.
418 * target.h (class Target): Add calls_non_split method. Declare
419 do_calls_non_split virtual method. Declare match_view and
420 set_view_to_nop.
421 * target.cc: Include "elfcpp.h".
422 (Target::do_calls_non_split): New function.
423 (Target::match_view): New function.
424 (Target::set_view_to_nop): New function.
425 * gold.cc (queue_middle_tasks): Give an error if mixing
426 split-stack and non-split-stack objects with -r.
427 * i386.cc (Target_i386::relocate_section): Add
428 reloc_symbol_changes parameter.
429 (Target_i386::do_calls_non_split): New function.
430 * x86_64.cc (Target_x86_64::relocate_section): Add
431 reloc_symbol_changes parameter.
432 (Target_x86_64::do_calls_non_split): New function.
433 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
434 parameter.
435 * powerpc.cc (Target_powerpc::relocate_section): Add
436 reloc_symbol_changes parameter.
437 * sparc.cc (Target_sparc::relocate_section): Add
438 reloc_symbol_changes parameter.
439 * configure.ac: Call AM_CONDITIONAL for the default target.
440 * configure: Rebuild.
441 * testsuite/Makefile.am (TEST_AS): New variable.
442 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
443 (check_DATA): Add split_i386 and split_x86_64 files.
444 (SPLIT_DEFSYMS): Define.
445 (split_i386_[1234n].o): New targets.
446 (split_i386_[124]): New targets.
447 (split_i386_[1234r].stdout): New targets.
448 (split_x86_64_[1234n].o): New targets.
449 (split_x86_64_[124]): New targets.
450 (split_x86_64_[1234r].stdout): New targets.
451 (MOSTLYCLEANFILES): Add new executables.
452 * testsuite/split_i386.sh: New file.
453 * testsuite/split_x86_64.sh: New file.
454 * testsuite/split_i386_1.s: New file.
455 * testsuite/split_i386_2.s: New file.
456 * testsuite/split_i386_3.s: New file.
457 * testsuite/split_i386_4.s: New file.
458 * testsuite/split_i386_n.s: New file.
459 * testsuite/split_x86_64_1.s: New file.
460 * testsuite/split_x86_64_2.s: New file.
461 * testsuite/split_x86_64_3.s: New file.
462 * testsuite/split_x86_64_4.s: New file.
463 * testsuite/split_x86_64_n.s: New file.
464 * testsuite/testfile.cc (Target_test): Update relocation_section
465 function.
466 * testsuite/Makefile.in: Rebuild.
467
e8a9fcda
ILT
4682009-10-06 Ian Lance Taylor <iant@google.com>
469
470 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
471 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
472 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
473 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
474 the address on ldo_addrs_.
475 (Target_i386::Relocate::fix_up_ldo): New function.
476
e99daf92
ILT
4772009-10-06 Rafael Espindola <espindola@google.com>
478
479 * plugin.cc (add_input_library): New.
480 (Plugin::load): Add add_input_library to tv.
481 (Plugin_manager::add_input_file): Add the is_lib argument.
482 (add_input_file): Update call to Plugin_manager::add_input_file.
483 (add_input_library): New.
484 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
485
966d4097
DK
4862009-09-30 Doug Kwan <dougkwan@google.com>
487
488 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
489 symbol and call Symbol::may_need_copy_reloc to determine if
490 a copy reloc is needed.
491 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
492 nocopyreloc is given in command line.
493 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
494 given in command line.
495 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
496 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
497 of the removed Target_i386::may_need_copy_reloc.
498 * options.h (copyreloc): New option with default value false.
499 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
500 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
501 instead of the removed Target_powerpc::may_need_copy_reloc.
502 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
503 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
504 instead of the removed Target_sparc::may_need_copy_reloc.
505 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
506 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
507 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
508 instead of the removed Target_x86_64::may_need_copy_reloc.
509
029ba973
ILT
5102009-09-30 Ian Lance Taylor <iant@google.com>
511
512 * object.h (class Object): Remove target_ field, and target,
513 sized_target, and set_target methods.
514 (Object::sized_target): Remove.
515 (class Sized_relobj): Update declarations. Remove sized_target.
516 * object.cc (Sized_relobj::setup): Remove target parameter.
517 Change all callers.
518 (Input_objects::add_object): Don't do anything with the target.
519 (make_elf_sized_object): Add punconfigured parameter. Change all
520 callers. Set or test parameter target.
521 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
522 Change all callers.
523 * parameters.cc (Parameters::set_target): Change parameter type to
524 be non-const.
525 (Parameters::default_target): Remove.
526 (set_parameters_target): Change parameter type to be non-const.
527 (parameters_force_valid_target): New function.
528 (parameters_clear_target): New function.
529 * parameters.h (class Parameters): Update declarations. Remove
530 default_target method. Add sized_target and clear_target
531 methods. Change target_ to be non-const.
532 (set_parameters_target): Update declaration.
533 (parameters_force_valid_target): Declare.
534 (parameters_clear_target): Declare.
535 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
536 as NULL if we aren't searching.
537 (Add_symbols::run): Don't check for compatible target.
538 * fileread.cc (Input_file::open_binary): Call
539 parameters_force_valid_target.
540 * gold.cc (queue_middle_tasks): Likewise.
541 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
542 set_target on object.
543 * dynobj.h (class Sized_dynobj): Update declarations.
544 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
545 make_elf_object returns NULL.
546 (Archive::include_member): Don't check whether object target is
547 compatible.
548 * output.cc (Output_section::add_input_section): Get target from
549 parameters.
550 (Output_section::relax_input_section): Likewise.
551 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
552 parameters.
553 (Sized_relobj::do_scan_relocs): Likewise.
554 (Sized_relobj::relocate_sections): Likewise.
555 * resolve.cc (Symbol_table::resolve): Likewise.
556 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
557 parameter. Change all callers.
558 (Symbol_table::add_from_object): Get target from parameters.
559 (Symbol_table::add_from_relobj): Don't check object target.
560 (Symbol_table::add_from_dynobj): Likewise.
561 (Symbol_table::define_special_symbol): Get target from
562 parameters.
563 * symtab.h (class Symbol_table): Update declaration.
564 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
565 parameter. Change all callers. Clear parameter target.
566 (Binary_test): Test target here.
567 * testsuite/object_unittest.cc (gold_testsuite): Remove
568 target_test_pointer parameter. Change all callers.
569 (Object_test): Test target here.
570
a6a22b83
ILT
5712009-09-26 Ian Lance Taylor <iant@google.com>
572
573 * testsuite/initpri1.c: Don't try to use constructor priorities if
574 compiling with gcc before 4.3.
575
6a8f49fe
ILT
5762009-09-22 Mikolaj Zalewski <mikolajz@google.com>
577
578 * testsuite/retain_symbols_file_test.sh (check_present): Change
579 output file name to retain_symbols_file_test.stdout.
580 (check_absent): Likewise.
581
8c604651
CS
5822009-09-18 Craig Silverstein <csilvers@google.com>
583
584 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
585 * options.cc: Include <cerrno> and <fstream>.
586 (General_options::finalize): Parse -retain-symbols-file tag.
587 * options.h: New flag.
588 (General_options): New method should_retain_symbol, new
589 variable symbols_to_retain.
590 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
591 should_retain_symbol map.
592 * testsuite/Makefile.am (retain_symbols_file_test): New test.
593 * testsuite/Makefile.in: Regenerate.
594 * testsuite/retain_symbols_file_test.sh: New file.
595
ca58b19f
NC
5962009-09-18 Nick Clifton <nickc@redhat.com>
597
598 * po/es.po: Updated Spanish translation.
599
20e6d0d6
DK
6002009-09-17 Doug Kwan <dougkwan@google.com>
601
602 * debug.h (DEBUG_RELAXATION): New constant.
603 (DEBUG_ALL): Add DEBUG_RELAXATION.
604 (debug_string_to_enum): Add relaxation debug option.
605 * layout.cc
606 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
607 Layout::Relaxation_debug_check::read_sections,
608 Layout::Relaxation_debug_check::read_sections): New method definitions.
609 (Layout::Layout): Initialize data members
610 record_output_section_data_from_scrips_,
611 script_output_section_data_list_ and relaxation_debug_check_.
612 (Layout::save_segments, Layout::restore_segments,
613 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
614 Layout::relaxation_loop_body): New method definitions.
615 (Layout::finalize): Support relaxation. Move section layout code to
616 Layout::relaxation_loop_body.
617 (Layout::set_asection_address_from_script): Move code for orphan
618 section placement out.
619 (Layout::place_orphan_sections_in_script): New method definition.
620 * layout.h (Output_segment_headers, Output_file_header):
621 New forward class declarations.
622 (Layout::~Layout): Define.
623 (Layout::new_output_section_data_from_script): New method definition.
624 (Layout::place_orphan_sections_in_script): New method declaration.
625 (Layout::Segment_states): New type declaration.
626 (Layout::save_segments, Layout::restore_segments,
627 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
628 Layout::relaxation_loop_body): New method declarations.
629 (Layout::Output_section_data_list): New type declaration.
630 (Layout::Relaxation_debug_check): New class definition.
631 (Layout::record_output_section_data_from_script_,
632 Layout::script_output_section_data_list_, Layout::segment_states_,
633 Layout::relaxation_debug_check_): New data members.
634 * output.cc: (Output_section_headers::do_size): New method definition.
635 (Output_section_headers::Output_section_headers): Move size
636 computation to Output_section_headers::do_size.
637 (Output_segment_headers::do_size): New method definition.
638 (Output_file_header::Output_file_header): Move size computation to
639 Output_file_header::do_size and call it.
640 (Output_file_header::do_size): New method definition.
641 (Output_data_group::Output_data_group): Adjust call to
642 Output_section_data.
643 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
644 (Output_symtab_xindex::do_write): Add array bound check.
645 (Output_section::Input_section::print_to_mapfile): Handle
646 RELAXED_INPUT_SECTION_CODE.
647 (Output_section::Output_section): Initialize data member checkpoint_.
648 (Output_section::~Output_section): Delete checkpoint object pointed
649 by checkpoint_.
650 (Output_section::add_input_section): Always add an Input_section if
651 relaxing.
652 (Output_section::add_merge_input_section): Add assert.
653 (Output_section::relax_input_section): New method definition.
654 (Output_section::set_final_data_size): Set load address to zero for
655 an unallocated section.
656 (Output_section::do_address_and_file_offset_have_reset_values):
657 New method definition.
658 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
659 Handle relaxed input section.
660 (Output_section::sort_attached_input_sections): Checkpoint input
661 section list lazily.
662 (Output_section::get_input_sections): Change type of input_sections to
663 list of Simple_input_section pointers. Checkpoint input section list
664 lazily. Also handle relaxed input sections.
665 (Output_section::add_input_section_for_script): Take a reference to
666 a Simple_input_section object instead of Relobj pointer and section
667 index as parameter. Handle relaxed input sections.
668 (Output_section::save_states, Output_section::restore_states): New
669 method definitions.
670 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
671 (Output_data::is_data_size_fixed): New method definition.
672 (Output_data::reset_addresss_and_file_offset): Do not reset data size
673 if it is fixed.
674 (Output_data::address_and_file_offset_have_reset_values): New method
675 definition.
676 (Output_data::do_address_and_file_offset_have_reset_values): New method
677 definition.
678 (Output_data::set_data_size): Check that data size is not fixed.
679 (Output_data::fix_data_size): New method definition.
680 (Output_data::is_data_size_fixed_): New data member.
681 (Output_section_headers::set_final_data_size): New method definition.
682 (Output_section_headers::do_size): New method declaration.
683 (Output_segment_headers::set_final_data_size): New method definition.
684 (Output_segment_headers::do_size): New method declaration.
685 (Output_file_header::set_final_data_size)::New method definition.
686 (Output_file_header::do_size)::New method declaration.
687 (Output_section_data::Output_section_data): Add new parameter
688 is_data_size_fixed and use it to fix data size.
689 (Output_data_const::Output_data_const): Adjust call to base class
690 constructor and fix data size.
691 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
692 base class constructor and fix data size.
693 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
694 base class constructor and fix data size.
695 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
696 class constructor and fix data size.
697 (Output_data_group::set_final_data_size): New method definition.
698 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
699 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
700 class constructor and fix data size.
701 (Output_relaxed_input_section): New class definition.
702 (Output_section::Simple_input_section): New class definition.
703 (Output_section::get_input_sections): Adjust parameter list.
704 (Output_section::add_input_section_for_script): Same.
705 (Output_section::save_states, Output_section::restore_states,
706 Output_section::do_address_and_file_offset_have_reset_values,
707 (Output_section::Input_section::Input_section): Handle
708 RELAXED_INPUT_SECTION_CODE. Add new overload for
709 Output_relaxed_input_section.
710 (Output_section::Input_section::is_input_section,
711 Output_section::Input_section::set_output_section): Handle relaxed
712 input section.
713 (Output_section::Input_section::is_relaxed_input_section,
714 Output_section::Input_section::output_section_data,
715 Output_section::Input_section::relaxed_input_section): New method
716 definitions.
717 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
718 value.
719 (Output_section::Input_section::u1_): Update comments.
720 (Output_section::Input_section::u2_): Add new union member poris.
721 (Output_section::Checkpoint_output_section): New classs definition.
722 (Output_section::relax_input_section): New method declaration.
723 (Output_section::checkpoint_): New data member.
724 (Output_segment): Update comments.
725 (Output_segment::Output_segment): Un-privatize copy constructor.
726 (Output_segment::operator=): Un-privatize.
727 * script-sections.cc (Output_section_element::Input_section_list):
728 Change element type to Output_section::Simple_input_section.
729 (Output_section_element_dot_assignment::set_section_addresses):
730 Register output section data for relaxation clean up.
731 (Output_data_exression::Output_data_expression): Adjust call to base
732 constructor to fix data size.
733 (Output_section_element_data::set_section_addresses): Register
734 Output_data_expression object for relaxation clean up.
735 (struct Input_section_info): Replace Relobj pointer and section index
736 pair with Output_section::Simple_input_section and Convert struct to a
737 class.
738 (Input_section_sorter::operator()): Adjust access to
739 Input_section_info data member to use accessors.
740 (Output_section_element_input::set_section_addresses): Use layout
741 parameter. Adjust code to use Output_section::Simple_input_section
742 and Input_secction_info classes. Register filler for relaxation
743 clean up.
744 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
745 and section index pair with Output_section::Simple_input_section
746 class. Adjust code accordingly.
747 (Phdrs_element::release_segment): New method definition.
748 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
749 segment list.
750 (Script_sections::release_segments): New method definition.
751 * gold/script-sections.h (Script_sections::release_segments): New
752 method declaration.
753 * gold/target.h (Target::may_relax, Target::relax,
754 Target::do_may_relax, Target::do_relax): New method definitions.
755
5e445df6
ILT
7562009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
757
758 * arm.cc (has_signed_unsigned_overflow): New function.
759 (Arm_relocate_functions::abs8): New function.
760 (Target_arm::Scan::local): Handle R_ARM_ABS8.
761 (Target_arm::Scan::global): Likewise.
762 (Target_arm::relocate::relocate): Likewise.
763 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
764 Likewise.
765
8c604651 7662009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
767
768 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
769 * testsuite/Makefile.in: Regenerate.
770
1e9cc1c2
NC
7712009-09-11 Nick Clifton <nickc@redhat.com>
772
773 * po/gold.pot: Updated by the Translation project.
774
6a89f575
CC
7752009-09-08 Cary Coutant <ccoutant@google.com>
776
777 * output.cc (Output_file::open): Add execute permission to empty file.
778 * testsuite/Makefile.am (permission_test): New test.
779 * testsuite/Makefile.in: Regenerate.
780
fdcac5af
ILT
7812009-09-02 Ian Lance Taylor <iant@google.com>
782
783 * output.cc (Output_file::resize): Call map_no_anonymous rather
784 than map.
785
44453f85
ILT
7862009-09-01 Mikolaj Zalewski <mikolajz@google.com>
787
788 * gold.cc: Include "incremental.h".
789 (queue_initial_tasks): Call Incremental_checker methods.
790 * incremental.cc: Include "output.h".
791 (Incremental_checker::can_incrementally_link_output_file): New
792 method.
793 * incremental.h (Incremental_checker): New class.
794
795 * output.cc (Output_file::open_for_modification): New method.
796 (Output_file::map_anonymous): Changed return type to bool. Record
797 map in base_ field.
798 (Output_file::map_no_anonymous): New method, broken out of map.
799 (Output_file::map): Use map_no_anonymous and map_anonymous.
800 * output.h (class Output_file): Update declarations.
801
293c1386
CC
8022009-08-24 Cary Coutant <ccoutant@google.com>
803
804 * options.h (Command_line::Pre_options): New class.
805 (Command_line::pre_options): New member.
806 * options.cc (gold::options::ready_to_register): New variable.
807 (One_option::register_option): Do nothing if not registering options.
808 Assert if same short option registered twice.
809 (General_options::General_options): Turn off option registration when
810 done constructing.
811 (Command_line::Pre_options::Pre_options): New constructor.
812
f773f3d2
CC
8132009-08-24 Cary Coutant <ccoutant@google.com>
814
06a73cfe
CC
815 * options.h (General_options::no_keep_memory): Remove incorrect
816 short option.
f773f3d2 817
a15af8e2
RW
8182009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
819
820 * Makefile.am (am__skiplex, am__skipyacc): New.
821 * Makefile.in: Regenerate.
822
c462b41b
RW
8232009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
824
14ec8efd
RW
825 * Makefile.am (AM_CPPFLAGS): Renamed from ...
826 (INCLUDES): ... this.
827 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
828 (AM_CPPFLAGS): Renamed from ...
829 (INCLUDE): ... this.
830 * Makefile.in, testsuite/Makefile.in: Regenerate.
831
81ecdfbb
RW
832 * Makefile.in: Regenerate.
833 * aclocal.m4: Likewise.
834 * config.in: Likewise.
835 * configure: Likewise.
836 * testsuite/Makefile.in: Likewise.
837
c462b41b
RW
838 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
839 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
840 * Makefile.in: Regenerate.
841 * testsuite/Makefile.in: Regenerate.
842
2da73f13
CC
8432009-08-19 Cary Coutant <ccoutant@google.com>
844
845 * resolve.cc (Symbol_table::resolve): Don't complain about defined
846 symbols in shared libraries overridden by hidden or internal symbols
847 in the main program.
848
2db70501
CD
8492009-08-19 Chris Demetriou <cgd@google.com>
850
851 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
852 checking source file names in error messages.
853
f733487b
DK
8542009-08-18 Doug Kwan <dougkwan@google.com>
855
856 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
857 an elcpp::Ehdr as parameter. Adjust call to set_target.
858 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
859 an elfcpp::Ehdr as parameter.
860 * object.cc (Object::set_target): Remove the version that looks up
861 a target and sets it.
862 (Sized_relobj::setup): Take a Target object instead of
863 an elfcpp::Ehdr as parameter. Adjust call to set_target.
864 (make_elf_sized_object): Find target and ask target to
865 make an ELF object.
866 * object.h: (Object::set_target): Remove the version that looks up
867 a target and sets it.
868 (Sized_relobj::setup): Take a Target object instead of
869 an elfcpp:Ehdr as parameter.
870 * target.cc: Include dynobj.h.
871 (Target::do_make_elf_object_implementation): New.
872 (Target::do_make_elf_object): New.
873 * target.h (Target::make_elf_object): New template declaration.
874 (Target::do_make_elf_object): New method declarations.
875 (Target::do_make_elf_object_implementation): New template declaration.
876
cc70f101
ILT
8772009-08-14 Ian Lance Taylor <iant@google.com>
878
879 * gold.h (FUNCTION_NAME): Define.
880 (gold_unreachable): Use FUNCTION_NAME.
881
ef5e0cb1
ST
8822009-08-12 Sriraman Tallam <tmsriram@google.com>
883
884 * icf.cc (Icf::find_identical_sections): Issue a warning when a
885 symbol in the --keep-unique list is not found.
886
48c187ce
ST
8872009-08-12 Sriraman Tallam <tmsriram@google.com>
888
889 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
890 been maked as --keep-unique.
891 (Icf::unfold_section): New function.
892 * icf.h (Icf::unfold_section): New function.
893 * options.h (General_options::keep_unique): New option.
894 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
895 * testsuite/Makefile.in: Regenerate.
896 * testsuite/icf_keep_unique_test.sh: New file.
897 * testsuite/icf_keep_unique_test.cc: New file.
898
645afe0c
CC
8992009-08-12 Cary Coutant <ccoutant@google.com>
900
901 PR 10471
902 * resolve.cc (Symbol_table::resolve): Check for references from
903 dynamic objects to hidden and internal symbols.
904 * testsuite/Makefile.am (hidden_test.sh): New test.
905 * testsuite/Makefile.in: Regenerate.
906 * testsuite/hidden_test.sh: New script.
907 * testsuite/hidden_test_1.c: New test source.
908 * testsuite/hidden_test_main.c: New test source.
909
11af873f
DK
9102009-08-11 Doug Kwan <dougkwan@google.com>
911
912 * arm.cc: Update comments.
913 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
914 segment to locate the .ARM.exidx section if present.
915
b9f7d72d
DK
9162009-08-09 Doug Kwan <dougkwan@google.com>
917
918 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
919 patch.
920
ddd3c53c
ST
9212009-08-07 Sriraman Tallam <tmsriram@google.com>
922 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
923 compiler warnings.
924
27721062
ST
9252009-08-06 Sriraman Tallam <tmsriram@google.com>
926
927 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
928 valid tls_segment only for non-debug-section relocations.
929 * testsuite/Makefile.am: Add gc_tls_test.
930 * testsuite/Makefile.in: Regenerate.
931 * testsuite/gc_tls_test.cc: New file.
932 * testsuite/gc_tls_test.sh: New file.
933
ef15dade
ST
9342009-08-05 Sriraman Tallam <tmsriram@google.com>
935
936 * icf.cc: New file.
937 * icf.h: New file.
938 * Makefile.am (CCFILES): Add icf.cc.
939 (HFILES): Add icf.h
940 * Makefile.in: Regenerate.
941 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
942 * gc.h (gc_process_relocs): Populate lists used by icf to contain
943 section, symbol and addend information for the relocs.
944 * gold.cc (queue_middle_tasks): Call identical code folding.
945 * gold.h: Add defines for multimap.
946 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
947 to the call of finalize_local_symbols.
948 * main.cc (main): Create object of class Icf.
949 * object.cc (Sized_relobj::do_layout): Allow this function to be
950 called twice during icf.
951 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
952 to sections marked as identical by icf.
953 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
954 when available.
955 (Sized_relobj::do_section_entsize): New function.
956 * object.h (Object::section_entsize): New function.
957 (Object::do_section_entsize): New pure virtual function.
958 (Relobj::finalize_local_symbols): Add new parameter.
959 (Relobj::do_section_entsize): New function.
960 * options.h (General_options::icf): New option.
961 (General_options::icf_iterations): New option.
962 (General_options::print_icf_sections): New option.
963 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
964 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
965 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
966 icf.
967 * symtab.cc (Symbol_table::is_section_folded): New function.
968 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
969 to sections marked as identical by icf.
970 * symtab.h (Symbol_table::set_icf): New function.
971 (Symbol_table::icf): New function.
972 (Symbol_table::is_section_folded): New function.
973 (Symbol_table::icf_): New data member.
974 * target-reloc.h (relocate_section): Ignore sections folded by icf.
975 * testsuite/Makefile.am: Add commands to build icf_test.
976 * testsuite/Makefile.in: Regenerate.
977 * testsuite/icf_test.sh: New file.
978 * testsuite/icf_test.cc: New file.
979
c3b65ac4
CD
9802009-07-24 Chris Demetriou <cgd@google.com>
981
982 * layout.cc (is_compressible_debug_section): Fix incorrect
983 comment about compressed section names.
984
1caf2c51
ILT
9852009-07-20 Ian Lance Taylor <ian@airs.com>
986
987 PR 10419
988 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
989
1ef4d87f
ILT
9902009-07-16 Ian Lance Taylor <iant@google.com>
991
992 PR 10400
993 * layout.h: #include <map>.
994 (class Kept_section): Change from struct to class. Add accessors
995 and setters. Add section size to Comdat_group mapping. Change
996 Comdat_group to std::map. Add is_comdat_ field. Add
997 linkonce_size field in union.
998 (class Layout): Update declaration of find_or_add_kept_section.
999 Don't declare find_kept_object.
1000 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
1001 parameter. Add object, shndx, is_comdat, and is_group_name
1002 parameters. Change all callers. Adjust for new Kept_section.
1003 (Layout::find_kept_object): Remove.
1004 * object.cc (Sized_relobj::include_section_group): Update use of
1005 Kept_section. Rename secnum to shndx. Only record
1006 Kept_comdat_section if sections are the same size.
1007 (Sized_relobj::include_linkonce_section): Update use of
1008 Kept_section. Only record Kept_comdat_section if sections are the
1009 same size. Set size of linkonce section.
1010 (Sized_relobj::map_to_kept_section): Update call to
1011 get_kept_comdat_section.
1012 * object.h (class Sized_relobj): Rename fields in
1013 Kept_comdat_section to drop trailing underscores; change object
1014 field to Relobj*. Change Kept_comdat_section_table to store
1015 struct rather than pointer.
1016 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
1017 Add kept_object and kept_shndx parameters. Change all callers.
1018 (Sized_relobj::get_kept_comdat_section): Change return type to
1019 bool. Add kept_object and kept_shndx parameters. Change all
1020 callers.
1021 * plugin.cc (Pluginobj::include_comdat_group): Update call to
1022 Layout::find_or_add_kept_section.
1023
37c3b7b0
ILT
10242009-07-09 Ian Lance Taylor <iant@google.com>
1025
1026 * merge.cc (Object_merge_map::initialize_input_to_output_map):
1027 Reserve space in the hash table.
1028
98fa85cb
ILT
10292009-07-06 Mikolaj Zalewski <mikolajz@google.com>
1030
1031 * fileread.cc (File_read::get_mtime): New method.
1032 * fileread.h (Timespec): New structure.
1033 (File_read::get_mtime): New method.
1034 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
1035 Renamed from timestamp_nsec.
1036 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
1037 Elf_Xword.
1038 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
1039 timestamp_nsec.
1040 (Incremental_inputs::report_archive): Save mtime; style fix.
1041 (Incremental_inputs::report_obejct): Save mtime; style fix.
1042 (Incremental_inputs::report_script): Save mtime; style fix.
1043 (Incremental_inputs::finalize_inputs): Style fix.
1044 (Incremental_inputs::finalize): Style fix.
1045 (Incremental_inputs::create_input_section_data): Store inputs
1046 mtime.
1047 * incremental.h (Incremental_inputs::report_script): Add mtime
1048 argument.
1049 (Incremental_inputs::Input_info::Input_info): Intialize only one
1050 union member.
1051 (Incremental_inputs::Input_info::archive): Move to nameless
1052 union.
1053 (Incremental_inputs::Input_info::obejct): Move to nameless union.
1054 (Incremental_inputs::Input_info::script): Move to nameless union.
1055 (Incremental_inputs::mtime): New field.
1056 * script.cc (read_input_script): Pass file mtime to
1057 Incremental_input.
1058 * script.h (Script_info::inputs): Style fix.
1059
c9d70757
ILT
10602009-07-01 Ian Lance Taylor <ian@airs.com>
1061
1062 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
1063 instead of 32.
1064
9c547ec3
ILT
10652009-06-24 Ian Lance Taylor <iant@google.com>
1066
1067 PR 10156
1068 * layout.cc (Layout::choose_output_section): If we find an
1069 existing section, update the flags.
1070 (Layout::create_notes): New function, broken out of
1071 Layout::finalize.
1072 (Layout::finalize): Don't create note sections.
1073 (Layout::create_note): Don't crash if linker script discards
1074 section.
1075 (Layout::create_gold_note): Likewise.
1076 (Layout::create_build_id): Likewise. Don't set
1077 after_input_sections on the section.
1078 (Layout::create_executable_stack_info): Remove target parameter.
1079 Change caller.
1080 * layout.h (class Layout): Declare create_notes. Update
1081 declaration of create_executable_stack_info.
1082 * gold.cc (queue_middle_tasks): Call create_notes.
1083 * output.cc (Output_section::update_flags_for_input_section): Move
1084 here from output.h. If SHF_ALLOC flag is newly set, mark address
1085 invalid.
1086 * output.h (Output_data::mark_address_invalid): New function.
1087 (class Output_section): Only declare, not define,
1088 update_flags_for_input_section. Remove set_flags.
1089
55458500
ILT
10902009-06-24 Ian Lance Taylor <iant@google.com>
1091
1092 * script-sections.cc (Output_section_definition::
1093 set_section_addresses): Rename shadowing local load_address to
1094 laddr.
1095
1307d6cd
ILT
10962009-06-24 Ian Lance Taylor <iant@google.com>
1097
1098 PR 10244
1099 * reloc.cc (relocate_sections): Skip empty relocation sections.
1100
ec3f783e
ILT
11012009-06-23 Ian Lance Taylor <iant@google.com>
1102
1103 PR 10156
1104 * layout.cc (Layout::create_note): Use choose_output_section
1105 rather than make_output_section.
1106
459c9f1c
ILT
11072009-06-23 Ian Lance Taylor <iant@google.com>
1108
1109 PR 10237
1110 * options.cc (General_options::parse_V): Set printed_version_.
1111 (General_options::General_options): Initialize printed_version_.
1112 * options.h (class General_options): Add printed_version_ field.
1113 * gold.cc (queue_initial_tasks): If there are no input files,
1114 don't give a fatal error if we printed the version information.
1115 (queue_middle_tasks): If using -r with a shared object, give a
1116 fatal error rather than an ordinary error.
1117
1518dc8f
ILT
11182009-06-23 Ian Lance Taylor <iant@google.com>
1119
1120 PR 10219
1121 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
1122 (Layout::make_output_section): Set have_stabstr_section_ if we see
1123 a .stab*str section.
1124 (Layout::finalize): Call link_stabs_sections.
1125 (Layout::link_stabs_sections): New file.
1126 * layout.h (class Layout): Add have_stabstr_section_ field.
1127 Declare link_stabs_sections.
1128
3d857b98
DK
11292009-06-23 Doug Kwan <dougkwan@google.com>
1130
1131 * Makefile.am (libgold_a_LIBADD): New.
1132 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
1133 * Makefile.in: Regenerate.
1134 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
1135 * configure: Regenerate.
1136 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
1137 * fileread.cc: Include sys/state.h
1138 * gold.h: Declare memmem and strndup if found missing.
1139 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
1140
0639a6f6
ILT
11412009-06-23 Ian Lance Taylor <iant@google.com>
1142
1143 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
1144 * configure: Rebuild.
1145
8d63875c
ILT
11462009-06-23 Ian Lance Taylor <iant@google.com>
1147
1148 PR 10147
1149 * object.cc (Object::section_contents): Don't try to get a view if
1150 the section has length zero.
1151 (Object::handle_gnu_warning_section): If the section is empty, use
1152 the name of the section as the warning.
1153
f7c8a183
ILT
11542009-06-23 Ian Lance Taylor <iant@google.com>
1155
1156 PR 10133
1157 * stringpool.h (class Stringpool_template): Add optimize_ field.
1158 (Stringpool_template::set_optimize): New function.
1159 * stringpool.cc (Stringpool_template::Stringpool_template):
1160 Initialize optimize_ field.
1161 (Stringpool_template::set_string_offsets): Test local optimize
1162 fild rather than parameter.
1163 * layout.cc (Layout::Layout): Call set_optimize on the section
1164 name stringpool.
1165
e6a307ba
ILT
11662009-06-22 Ian Lance Taylor <iant@google.com>
1167
1168 PR 10030
1169 * yyscript.y: Parse TARGET.
1170 * script.cc (script_set_target): New function.
1171 * script-c.h (script_set_target): Declare.
1172 * options.cc (General_options::string_to_object_format): Rename
1173 from string_to_object_format in anonymous namespace. Change
1174 callers.
1175 * options.h (class General_options): Declare
1176 string_to_object_format.
1177
3ee173de
ILT
11782009-06-22 Ian Lance Taylor <iant@google.com>
1179
1180 * script-sections.cc (Script_sections::create_segments): Don't put
1181 program headers in a PT_LOAD segment if -n or -N.
1182
11832009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
1184
1185 PR 10141
1186 * options.h (class General_options): Add -z lazy and -z now. Sort
1187 -z options into alphabetical order.
1188 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
1189
cd6739a1 11902009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
1191
1192 * layout.cc (Layout::make_output_section): Call
1193 Target::new_output_section.
1194 (Layout::attach_allocated_section_to_segment): Put large section
1195 sections in a separate load segment with the large segment flag
1196 set.
1197 (Layout::segment_precedes): Sort large data segments after other
1198 load segments.
1199 (align_file_offset): New static function.
1200 (Layout::set_segment_offsets): Use align_file_offset.
1201 * output.h (class Output_section): Add is_small_section_ and
1202 is_large_section_ fields.
1203 (Output_section::is_small_section): New function.
1204 (Output_section::set_is_small_section): New function.
1205 (Output_section::is_large_section): New function.
1206 (Output_section::set_is_large_section): New function.
1207 (Output_section::is_large_data_section): New function.
1208 (class Output_segment): Add is_large_data_segment_ field.
1209 (Output_segment::is_large_data_segment): New function.
1210 (Output_segment::set_is_large_data_segment): New function.
1211 * output.cc (Output_section::Output_section): Initialize new
1212 fields.
1213 (Output_segment::Output_segment): Likewise.
1214 (Output_segment::add_output_section): Add assertion that large
1215 data sections always go in large data segments. Force small data
1216 sections to the end of the list of data sections. Force small BSS
1217 sections to the start of the list of BSS sections. For large BSS
1218 sections to the end of the list of BSS sections.
1219 * symtab.h (class Symbol): Declare is_common_shndx.
1220 (Symbol::is_defined): Check Symbol::is_common_shndx.
1221 (Symbol::is_common): Likewise.
1222 (class Symbol_table): Define enum Commons_section_type. Update
1223 declarations. Add small_commons_ and large_commons_ fields.
1224 * symtab.cc (Symbol::is_common_shndx): New function.
1225 (Symbol_table::Symbol_table): Initialize new fields.
1226 (Symbol_table::add_from_object): Put small and large common
1227 symbols in the right list.
1228 (Symbol_table::sized_finalized_symbol): Check
1229 Symbol::is_common_shndx.
1230 (Symbol_table::sized_write_globals): Likewise.
1231 * common.cc (Symbol_table::do_allocate_commons): Allocate new
1232 common symbol lists. Don't call do_allocate_commons_list if the
1233 list is empty.
1234 (Symbol_table::do_allocate_commons_list): Remove is_tls
1235 parameter. Add comons_section_type parameter. Change all
1236 callers. Handle small and large common symbols.
1237 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
1238 Symbol::is_common_shndx.
1239 * resolve.cc (symbol_to_bits): Likewise.
1240 * target.h (Target::small_common_shndx): New function.
1241 (Target::small_common_section_flags): New function.
1242 (Target::large_common_shndx): New function.
1243 (Target::large_common_section_flags): New function.
1244 (Target::new_output_section): New function.
1245 (Target::Target_info): Add small_common_shndx, large_common_shndx,
1246 small_common_section_flags, and large_common_section_flags
1247 fields.
1248 (Target::do_new_output_section): New virtual function.
1249 * arm.cc (Target_arm::arm_info): Initialize new fields.
1250 * i386.cc (Target_i386::i386_info): Likewise.
1251 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1252 Likewise.
1253 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
1254 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1255 (Target_x86_64::do_new_output_section): New function.
1256 * configure.ac: Define conditional MCMODEL_MEDIUM.
1257 * testsuite/Makefile.am (check_PROGRAMS): Add large.
1258 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
1259 (large_LDFLAGS): Define.
1260 * testsuite/large.c: New file.
1261 * testsuite/testfile.cc (Target_test::test_target_info):
1262 Initialize new fields.
1263 * configure, testsuite/Makefile.in: Rebuild.
1264
bb04269c
DK
12652009-06-05 Doug Kwan <dougkwan@google.com>
1266
1267 * Makefile.am (CCFILES): Add target.cc.
1268 * Makefile.in: Regenerate.
1269 * i386.cc (class Target_i386): Define new virtual method to
1270 override do_is_local_label_name in parent.
1271 * object.cc (Sized_relobj::do_count_local_symbols): Discard
1272 local symbols if --discard-locals or -X is given.
1273 * options.h (class General_options): Declare new options
1274 '--discard-locals' and '-X' for discarding locals.
1275 * target.h (class Target): Define new methods is_local_label_name.
1276 Declare new virtual method do_is_local_label_name.
1277 * target.cc: New file.
1278 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
1279 (check_SCRIPTS): Add discard_locals_test.sh.
1280 (check_DATA): Add discard_local_tests.syms.
1281 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
1282 (discard_local_tests.syms, discard_locals_test.o): New make rules.
1283 * testsuite/Makefile.in: Regenerate.
1284 * testsuite/discard_locals_test.c: New file.
1285 * testsuite/discard_locals_test.sh: Same.
1286
805bb01c
DK
12872009-06-05 Doug Kwan <dougkwan@google.com>
1288
1289 * object.cc (Sized_relobj::Sized_relobj): Initialize
1290 discarded_eh_frame_shndx_ to -1U.
1291 (Sized_relobj::do_layout): Record index of a discard .eh_frame
1292 section.
1293 (Sized_relobj::do_count_local_symbols): Skip local symbols in
1294 a discarded .eh_frame section.
1295 (Sized_relobj::do_finalize_local_symbols): Ditto.
1296 * object.h (class Sized_relobj): Declare new member
1297 discarded_eh_frame_shndx_.
1298 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
1299 (local_labels_test.o, local_labels_test): New rules.
1300 * testsuite/Makefile.in: Regenerate.
1301
1dcd334d
DK
13022009-06-04 Doug Kwan <dougkwan@google.com>
1303
1304 * layout.cc (Layout::section_name_mapping): Add mapping for
1305 special ARM sections.
1306
96d49306
DK
13072009-06-03 Doug Kwan <dougkwan@google.com>
1308
1309 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
1310 (utils::has_overflow): Same.
1311
dff16297
ILT
13122009-06-03 Ian Lance Taylor <iant@google.com>
1313
1314 * layout.cc (Layout::section_name_mapping): New array, replacing
1315 Layout::linkonce_mapping.
1316 (Layout::section_name_mapping_count): New variable, replacing
1317 Layout::linkonce_mapping_count.
1318 (Layout::linkonce_output_name): Remove.
1319 (Layout::output_section_name): Rewrite.
1320 * layout.h (class Layout): Rename Linkonce_mapping to
1321 Section_name_mapping, linkonce_mapping to section_name_mapping,
1322 linkonce_mapping_count to section_name_mapping_count. Don't
1323 declare linkonce_output_name.
1324
c121c671
DK
13252009-06-03 Doug Kwan <dougkwan@google.com>
1326
1327 * gold/arm.cc (namespace utils): New.
1328 (Target_arm::reloc_is_non_pic): Define new method.
1329 (class Arm_relocate_functions): New.
1330 (Target_arm::Relocate::relocate): Handle relocation types used by
1331 Android.
1332
07800fab
ILT
13332009-06-03 Ian Lance Taylor <iant@google.com>
1334
1335 * arm.cc (Target_arm::scan::global): Use || instead of |.
1336
c121c671
DK
13372009-06-02 Doug Kwan <dougkwan@google.com>
1338
1339 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
1340 issued_non_pic_error_.
1341 (class Target_arm::Scan): Declare new method check_non_pic.
1342 Define new method symbol_needs_plt_entry.
1343 Declare new data member issued_non_pic_error_.
1344 (class Target_arm::Relocate): Declare new method
1345 should_apply_static_reloc.
1346 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
1347 (Target_arm::Scan::check_non_pic): Define new method.
1348 (Target_arm::Scan::local): Handle a small subset of reloc types used
1349 by Android.
1350 (Target_arm::Scan::local): Same.
1351 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
1352
b19b0c6d
ILT
13532009-05-31 Mikolaj Zalewski <mikolajz@google.com>
1354
1355 * incremental.cc (Incremental_inputs::report_command_line): Filter
1356 out --incremental-* options.
1357
94cdfcff
DK
13582009-05-29 Doug Kwan <dougkwan@google.com>
1359
1360 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
1361 template class.
1362 (class Target_arm): Update comment.
1363 (Target_arm::Target_arm): Initialize new data members GOT_,
1364 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
1365 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
1366 and Target_arm::rel_dyn_section.
1367 Declare new_enum Target_arm::Got_type.
1368 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
1369 and DYNBSS_.
1370 Update commments for member do_dynsym_value.
1371 (Target_arm::got_size, Target_arm::plt_section,
1372 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
1373 new methods inside class defintion.
1374 (Target_arm::got_section): Define new method.
1375 (Target_arm::rel_dyn_section): Same.
1376 (Output_data_plt_arm): New template class.
1377 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
1378 (Output_data_plt_arm:do_adjust_output_section): Define new method.
1379 (Output_data_plt_arm::add_entry): Same.
1380 (Output_data_plt_arm::first_plt_entry): Define new
1381 static data member for PLT instruction template.
1382 (Output_data_plt_arm::plt_entry): Same.
1383 (Output_data_plt_arm::do_write): Define new method.
1384 (Target_arm::make_plt_entry): Same.
1385 (Target_arm::do_finalize_sections): Same.
1386 (Target_arm::do_dynsym_value): Same.
1387
4a657b0d
DK
13882009-05-28 Doug Kwan <dougkwan@google.com>
1389
1390 * Makefile.am (TARGETSOURCES): Add arm.cc.
1391 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
1392 * Makefile.in: Regenerate.
1393 * arm.cc: New file.
1394 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
1395
e7ae8c36
DK
13962009-05-26 Doug Kwan <dougkwan@google.com>
1397
1398 * options.cc (General_options::parse_exclude_libs). Fix a comment.
1399 (General_options::check_excluded_libs): Strip off directories in
1400 archive name before matching like GNU ld does.
1401 * testsuite/Makefile.am (MOSTLYCLEANFILES,
1402 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
1403 (exclude_libs_test_LDFLAGS): Add linker option
1404 -Wl,--exclude-libs,libexclude_libs_test_3
1405 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
1406 an explicit archive without using -l.
1407 (alt/libexclude_libs_test_3.a): New make rule.
1408 * testsuite/Makefile.in: Regenerate.
1409 * testsuite/exclude_libs_test.c : Declare lib3_default().
1410 (main): Call it.
1411 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
1412 * exclude_libs_test_3.c: New file.
1413
f12e7348
NC
14142009-05-26 Nick Clifton <nickc@redhat.com>
1415
1416 * po/id.po: New Indonesian translation.
1417 * po/gold.pot: Updated template file.
1418
4daadc0d
ST
14192009-05-22 Sriraman Tallam <tmsriram@google.com>
1420
1421 * testsuite/Makefile.am: Add -ffunction-sections to compile
1422 gc_comdat_test files. Add -Wl,--gc-sections to build
1423 gc_comdat_test.
1424 * testsuite/Makefile.in: Regenerate.
1425 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
1426
531813ad
ST
14272009-05-21 Sriraman Tallam <tmsriram@google.com>
1428
1429 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
1430 kept comdat section was garbage collected.
1431 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
1432 * testsuite/Makefile.in: Regenerate.
1433 * testsuite/gc_comdat_test.sh: New file.
1434 * testsuite/gc_comdat_test_1.cc: New file.
1435 * testsuite/gc_comdat_test_2.cc: New file.
1436
65514900
CC
14372009-05-19 Doug Kwan <dougkwan@google.com>
1438
1439 * archive.cc (Archive::Archive): Move constructor from archive.h
1440 to here. Initialize no_export_.
1441 (Archive::get_elf_object_for_member): Set no_export flag of object.
1442 * archive.h (Archive::Archive): Move constructor body to
1443 archive.cc.
1444 (Archive::no_export): New method.
1445 (Archive::no_export_): New field.
1446 * object.h (Object::Object): Initialize no_export_ to false.
1447 (Object::no_export, Object::set_no_export): New methods.
1448 (Object::no_export_): New field.
1449 * options.cc (General_options::parse_exclude_libs): New method.
1450 (General_options::check_excluded_libs) Same.
1451 * options.h (exclude_libs): New option.
1452 (General_options::check_excluded_libs): New method declaration.
1453 (General_options::excluded_libs_): New field.
1454 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
1455 default or protected visibility if an object has no-export flag set.
1456 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
1457 (check_SCRIPTS): Add exclude_libs_test.sh.
1458 (check_DATA): Add exclude_libs_test.syms.
1459 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
1460 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
1461 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
1462 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
1463 (exclude_libs_test.syms, libexclude_libs_test_1.a,
1464 libexclude_libs_test_2.a): New rules.
1465 * testsuite/Makefile.in: Regenerate.
1466 * testsuite/exclude_libs_test.c: New file.
1467 * testsuite/exclude_libs_test.sh: Ditto.
1468 * testsuite/exclude_libs_test_1.c: Ditto.
1469 * testsuite/exclude_libs_test_2.c: Ditto.
1470
1b77ea50
ILT
14712009-05-15 Ian Lance Taylor <iant@google.com>
1472
1473 * configure.ac: Check for declarations for cases where libiberty.h
1474 checks HAVE_DECL_xxx.
1475 * configure, config.in: Rebuild.
1476
072fe7ce
ILT
14772009-05-15 Mikolaj Zalewski <mikolajz@google.com>
1478
1479 * gold.h (Incremental_argument_list): Remove (invalid) forward
1480 declaration.
1481 * incremental.cc (Incremental_inputs::report_achive): New method.
1482 (Incremental_inputs::report_object): New method.
1483 (Incremental_inputs::report_script): New method.
1484 (Incremental_inputs::finalize_inputs): New method.
1485 (Incremental_inputs::finalize): Call finalize_inputs().
1486 (Incremental_inputs::sized_create_incremental_inputs_section_data):
1487 Create inputs entries.
1488 * incremental.h (Incremental_input_type): New enum.
1489 (Incremental_inputs::Incremental_input): Initialize new fields.
1490 (Incremental_inputs::report_inputs): New method.
1491 (Incremental_inputs::report_achive): New method.
1492 (Incremental_inputs::report_object): New method.
1493 (Incremental_inputs::report_script): New method.
1494 (Incremental_inputs::finalize_inputs): New method.
1495 (Incremental_inputs::Input_info): New struct.
1496 (Incremental_inputs::Input_info_map): New typedef.
1497 (Incremental_inputs::lock_): New field.
1498 (Incremental_inputs::Inputs_): New field.
1499 (Incremental_inputs::Inputs_map): New field.
1500 * main.cc (main): Call Incremental_input::report_inputs.
1501 * options.h (Input_argument_list): Typedef moved from
1502 Input_arguments.
1503 (Input_file_group::Files): Remove, use ::Input_argument_list.
1504 (Input_file_group::Input_argument_list): Remove, use
1505 ::Input_argument_list.
1506 * plugin.cc (Plugin_manager::add_input_file): Add error in
1507 incremental build.
1508 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
1509 functions.
1510 * script.cc (read_input_script): Call
1511 Incremental_input::report_script.
1512 * script.h (Script_info): New class.
1513
b0481b0b
ILT
15142009-04-27 Ian Lance Taylor <iant@google.com>
1515
1516 * x86_64.cc (do_adjust_output_section): Set entsize to
1517 plt_entry_size.
1518
b22a5a41 15192009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
1520
1521 * output.cc (Output_file::close): After short writes, continue
1522 writing from the correct offset in the buffer being written.
1523
40fde488
CD
15242009-04-23 Chris Demetriou <cgd@google.com>
1525
1526 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
1527 * configure: Regenerate.
1528 * config.in: Regenerate.
1529 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
1530 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
1531
3ce2c28e
ILT
15322009-04-21 Mikolaj Zalewski <mikolajz@google.com>
1533
1534 * incremental.cc (Incremental_inputs_header_data): Renamed from
1535 Incremental_input_header_data.
1536 (Incremental_inputs_header_data::data_size): New field.
1537 (Incremental_inputs_header_data::put_input_file_count): Renamed
1538 from input_file_count.
1539 (Incremental_inputs_header_data::put_command_line_offset): Renamed
1540 from command_line_offset.
1541 (Incremental_inputs_header_data::put_reserved): Renamed from
1542 put_reserved.
1543 (Incremental_inputs_entry_data): Renamed from
1544 Incremental_input_entry_data.
1545 (Incremental_inputs_entry_data::data_size): New field.
1546 (Incremental_inputs::report_command_line): New method.
1547 (Incremental_inputs::finalize): New method.
1548 (Incremental_inputs::create_incremental_inputs_data): New method.
1549 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
1550 * incremental.h: New file.
1551 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
1552 (Layout::finalize): Create incremental inputs section in
1553 incremental builds.
1554 (Layout::create_incremental_info_sections): New method.
1555 * layout.h (Layout::incremental_inputs): New method.
1556 (Layout::create_incremental_info_sections): New method.
1557 (Layout::incremental_inputs_): New field.
1558 * main.cc (main): Notify Incremental_input of the command line.
1559
e55bde5e
ILT
15602009-04-01 Ian Lance Taylor <iant@google.com>
1561 Mikolaj Zalewski <mikolajz@google.com>
1562
1563 * gold.h (reserve_unordered_map): Define, three versions, one for
1564 each version of Unordered_map.
1565 * layout.cc (Layout::Layout): Remove options parameter. Add
1566 number_of_input_files parameter. Don't initialize options_.
1567 Initialize number_of_input_files_ and resized_signatures_. Move
1568 sections_are_attached_.
1569 (Layout::layout_group): Reserve space for group_signatures_.
1570 (Layout::find_or_add_kept_section): Change name parameter to be a
1571 reference. Resize signatures_ map when it gets large enough.
1572 (Layout::layout_eh_frame): Use parameters->options() instead of
1573 this->options_.
1574 (Layout::make_output_section): Likewise.
1575 (Layout::attach_allocated_section_to_segment): Likewise.
1576 (Layout::finalize, Layout::create_executable_stack): Likewise.
1577 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
1578 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
1579 * layout.h (class Layout): Update declarations. Remove options_
1580 field. Add number_of_input_files_ and resized_signatures_
1581 fields. Move sections_are_attached_ field.
1582 * main.cc (main): Pass number of input files to Layout
1583 constructor. Don't pass options.
1584
154b857c
ILT
15852009-03-30 Ian Lance Taylor <iant@google.com>
1586
1587 * ffsll.c (ffsll): Correct implementation.
1588
2f35ab9b
ILT
15892009-03-27 Ian Lance Taylor <iant@google.com>
1590
fd03461a
ILT
1591 * ffsll.c: New file.
1592 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
1593 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
1594 * ftruncate.c (ftruncate): Declare before definition.
1595 * mremap.c (mremap): Likewise.
1596 * pread.c (pread): Likewise.
1597 * configure, Makefile.in, config.in: Rebuild.
1598
2f35ab9b
ILT
1599 * mremap.c: New file.
1600 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
1601 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
1602 (mremap): Declare if HAVE_MREMAP is not defined.
1603 * configure, Makefile.in, config.in: Rebuild.
1604
33aea2fd
CC
16052009-03-27 Cary Coutant <ccoutant@google.com>
1606
1607 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
1608 position independent.
1609 * sparc.cc (Target_sparc::check_non_pic): Likewise.
1610 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
1611
6d479619
CC
16122009-03-24 Cary Coutant <ccoutant@google.com>
1613
1614 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
1615 an executable.
1616 (needs_dynamic_reloc): Likewise.
1617
afc06bb8
ILT
16182009-03-24 Ian Lance Taylor <iant@google.com>
1619
1620 * yyscript.y (file_cmd): Recognize EXTERN.
1621 (extern_name_list, extern_name_list_body): New nonterminals.
1622 * script.cc (script_add_extern): Define.
1623 * script-c.h (script_add_extern): Declare.
1624
f6060a4d
ILT
16252009-03-24 Rafael Avila de Espindola <espindola@google.com>
1626
1627 * object.cc (is_elf_object): Define.
1628 * object.h (is_elf_object): Declare.
1629 * archive.cc (Archive::get_elf_object_for_member): Call
1630 is_elf_object.
33aea2fd 1631 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 1632
26736d8e
ILT
16332009-03-24 Elliott Hughes <enh@google.com>
1634
1635 * output.cc (Output_file::map_anonymous): Define.
1636 (Output_file::map): Use map_anonymous. If the regular mmap fails,
1637 try an anonymous one. Report the size if the mmap fails.
1638 * output.h (class Output_file): Declare map_anonymous.
1639
22fd9730
ILT
16402009-03-24 Ian Lance Taylor <iant@google.com>
1641
1642 * target-select.cc (instantiate_target): Don't acquire the lock if
1643 the instantiated_target_ field has already been set.
1644
cb010894
ILT
16452009-03-23 Ian Lance Taylor <iant@google.com>
1646
7f055c20
ILT
1647 * gold-threads.h (class Initialize_lock): Define.
1648 * gold-threads.cc (class Initialize_lock_once): Define.
1649 (initialize_lock_control): New static variable.
1650 (initialize_lock_pointer): New static variable.
1651 (initialize_lock_once): New static function.
1652 (Initialize_lock::Initialize_lock): Define.
1653 (Initialize_lock::initialize): Define.
1654 * target-select.h: Include "gold-threads.h".
1655 (class Target_selector): Add lock_ and initialize_lock_ fields.
1656 Don't define instantiate_target, just declare it.
1657 * target-select.cc (Target_selector::Target_selector): Initialize
1658 new fields.
1659 (Target_selector::instantiate_target): Define.
1660 * descriptors.h: Include "gold-threads.h".
1661 (class Descriptors): Add initialize_lock_ field.
1662 * descriptors.cc (Descriptors::Descriptors): Initialize new
1663 field.
1664 (Descriptors::open): Use initialize_lock_ field
1665 * errors.h (class Errors): Add initialize_lock_ field.
1666 * errors.cc (Errors::Errors): Initialize new field.
1667 (Errors::initialize_lock): Use initialize_lock_ field.
1668 * powerpc.cc (class Target_selector_powerpc): Remove
1669 instantiated_target_ field. In do_recognize call
1670 instantiate_target rather than do_instantiate_target. In
1671 do_instantiate_target just allocate a new target.
1672 * sparc.cc (class Target_selector_sparc): Likewise.
1673
36959681
ILT
1674 * freebsd.h: New file.
1675 * i386.cc: Include "freebsd.h".
1676 (Target_i386): Derive from Target_freebsd rather than
1677 Sized_target.
1678 (Target_selector_i386): Derive from Target_selector_freebsd rather
1679 than Target_selector.
1680 * x86_64.cc: Include "freebsd.h".
1681 (Target_x86_64): Derive from Target_freebsd rather than
1682 Sized_target.
1683 (Target_selector_x86_64): Derive from Target_selector_freebsd
1684 rather than Target_selector.
1685 * target.h (class Target): Add adjust_elf_header and
1686 do_adjust_elf_header.
1687 * output.cc (Output_file_header:: do_sized_write): Call target
1688 adjust_elf_header routine.
1689 * configure.tgt: Set targ_osabi.
1690 * configure.ac: Define GOLD_DEFAULT_OSABI.
1691 * parameters.cc (Parameters::default_target): Pass
1692 GOLD_DEFAULT_OSABI to select_target.
1693 * target-select.h (class Target_selector): Make instantiate_target
1694 protected rather than private.
1695 * Makefile.am (HFILES): Add freebsd.h.
1696 * configure, Makefile.in, config.in: Rebuild.
1697
cb010894
ILT
1698 * merge.cc (do_add_input_section): Correct pend value. Change
1699 message about last entry not being null terminated from error to
1700 warning.
1701
0e879927
ILT
17022009-03-20 Mikolaj Zalewski <mikolajz@google.com>
1703
1704 * incremental.cc: New file.
1705 * Makefile.am (CCFILES): Add incremental.cc.
1706 * Makefile.in: Rebuild.
1707
41105937
PP
17082009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
1709
1710 * layout.cc (Layout::output_section_name): Preserve names
1711 of '.note.' sections.
1712
60439920
ILT
17132009-03-19 Ian Lance Taylor <iant@google.com>
1714
1715 * descriptors.cc (Descriptors::open): Check that the options are
1716 valid before using them.
1717
0d371ad3
ILT
17182009-03-18 Ian Lance Taylor <iant@google.com>
1719
1720 * script-sections.h: Include <list>.
1721 (class Script_sections): Change Sections_elements from std::vector
1722 to std::list. Typedef public Elements_iterator. Add
1723 orphan_section_placement_, data_segment_align_start_, and
1724 saw_data_segment_align_ fields. Remove data_segment_align_index_
1725 field.
1726 * script-sections.cc (class Orphan_section_placement): New class.
1727 (class Sections_element): Add virtual functions is_relro and
1728 orphan_section_init. Remove virtual function place_orphan_here.
1729 (class Output_section_definition): Add is_relro and
1730 orphan_section_init. Remove place_orphan_here.
1731 (class Orphan_output_section): Likewise.
1732 (Script_sections::Script_sections): Update for field changes.
1733 (Script_sections::data_segment_align): Set saw_data_segment_align_
1734 and data_segment_align_start_, not data_segment_align_index.
1735 (Script_sections::data_segment_relro_end): Check
1736 saw_data_segment_align_. Use data_segment_align_start_ rather
1737 than data_segment_align_index_.
1738 (Script_sections::place_orphan): Rewrite to use
1739 Orphan_section_placement.
1740
9201d894
ILT
17412009-03-17 Ian Lance Taylor <iant@google.com>
1742
9c5b8369
ILT
1743 * archive.cc (Archive::add_symbols): Check for a version attached
1744 to the symbol name in the archive map.
1745 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
1746 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
1747 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
1748 (ver_test_11.a): New target.
1749 * testsuite/Makefile.in: Rebuild.
1750
9201d894
ILT
1751 * configure.ac: Check for chsize and posix_fallocate. Replace
1752 ftruncate.
1753 * ftruncate.c: New file, from gnulib.
1754 * output.cc (posix_fallocate): Define dummy version if not
1755 HAVE_POSIX_FALLOCATE.
1756 (Output_file::map): Call posix_fallocate rather than lseek and
1757 write.
1758 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
1759 * configure, Makefile.in, config.in: Rebuild.
1760
ef4ab7a8
PP
17612009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
1762
1763 * layout.h (Layout::create_note): Add section_name parameter.
1764 * layout.cc (Layout::create_note): Likewise.
1765 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
1766
8c500701
ILT
17672009-03-17 Ian Lance Taylor <iant@google.com>
1768
e85b18e1
ILT
1769 * descriptors.cc: Include "options.h".
1770 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
1771 (Descriptors::open): Always use O_CLOEXEC when opening a new
1772 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
1773 then set FD_CLOEXEC.
1774
9efe6174
ILT
1775 * sparc.cc (class Target_sparc): Add has_got_section.
1776 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
1777 make sure we have a GOT section.
1778
1779 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
1780 (Target_sparc::Scan::local): Likewise.
1781 (Target_sparc::Scan::global): Likewise.
1782 (Target_sparc::Relocate::relocate): Likewise.
1783 (Target_sparc::Relocate::relocate_tls): Likewise.
1784
8c500701
ILT
1785 * symtab.cc (Symbol_table::define_default_version): New function,
1786 broken out of add_from_object.
1787 (Symbol_table::add_from_object): Call define_default_version.
1788 (Symbol_table::define_special_symbol): Add resolve_oldsym
1789 parameter. Change all callers. If the version for a symbol comes
1790 from a version script, resolve it with the symbol with the same
1791 name with no version. Also add the symbol without a version if
1792 appropriate.
1793 (do_define_in_output_data): If resolving with oldsym, don't delete
1794 sym.
1795 (do_define_in_output_segment): Likewise.
1796 (do_define_as_constant): Likewise.
1797 * symtab.h (class Symbol_table): Update declarations.
1798
f1ed28fb
ILT
17992009-03-13 Ian Lance Taylor <iant@google.com>
1800
15f8229b
ILT
1801 * readsyms.cc (Read_symbols::incompatible_warning): New function.
1802 (Read_symbols::requeue): New function.
1803 (Read_symbols::do_read_symbols): If make_elf_object fails because
1804 the target type is not configured, and the file was searched for,
1805 issue a warning and retry with the next directory.
1806 (Add_symbols::run): If the file has an incompatible format, and
1807 it was searched for, requeue the Read_symbols task. On error,
1808 release the object.
1809 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
1810 dirindex parameter to constructor. Change all callers. Declare
1811 incompatible_warning and requeue.
1812 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
1813 input_argument_ and input_group_ fields. Add them to
1814 constructor. Change all callers.
1815 (class Read_script): Add dirindex_ field. Add it to constructor.
1816 Change all callers.
1817 * archive.cc (Archive::setup): Remove input_objects parameter.
1818 Change all callers.
1819 (Archive::get_file_and_offset): Likewise.
1820 (Archive::read_all_symbols): Likewise.
1821 (Archive::read_symbols): Likewise.
1822 (Archive::get_elf_object_for_member): Remove input_objects
1823 parameter. Add punconfigured parameter. Change all callers.
1824 (Archive::add_symbols): Change return type to bool. Check return
1825 value of include_member.
1826 (Archive::include_all_members): Likewise.
1827 (Archive::include_member): Change return type to bool. Return
1828 false if first included object has incompatible target. Set
1829 included_member_ field.
1830 (Add_archive_symbols::run): If add_symbols returns false, requeue
1831 Read_symbols task.
1832 * archive.h (class Archive): Add included_member_ field.
1833 Initialize it in constructor. Add input_file and searched_for
1834 methods. Update declarations.
1835 (class Add_archive_symbols): Add dirpath_, dirindex_, and
1836 input_argument_ fields. Add them to constructor. Change all
1837 callers.
1838 * script.cc: Include "target-select.h".
1839 (class Parser_closure): Add skip_on_incompatible_target_ and
1840 found_incompatible_target_ fields. Add
1841 skip_on_incompatible_target parameter to constructor. Change all
1842 callers. Add methods skip_on_incompatible_target,
1843 clear_skip_on_incompatible_target, found_incompatible_target, and
1844 set_found_incompatible_target.
1845 (read_input_script): Add dirindex parameter. Change all callers.
1846 If parser finds an incompatible target, requeue Read_symbols
1847 task.
1848 (script_set_symbol): Clear skip_on_incompatible_target in
1849 closure.
1850 (script_add_assertion, script_parse_option): Likewise.
1851 (script_start_sections, script_add_phdr): Likewise.
1852 (script_check_output_format): New function.
1853 * script.h (read_input_script): Update declaration.
1854 * script-c.h (script_check_output_format): Declare.
1855 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
1856 (ignore_cmd): Remove OUTPUT_FORMAT.
1857 * fileread.cc (Input_file::Input_file): Add explicit this.
1858 (Input_file::will_search_for): New function.
1859 (Input_file::open): Add pindex parameter. Change all callers.
1860 * fileread.h (class Input_file): Add input_file_argument method.
1861 Declare will_search_for. Update declarations.
1862 * object.cc (make_elf_object): Add punconfigured parameter.
1863 Change all callers.
1864 * object.h (class Object): Make input_file public. Add
1865 searched_for method.
1866 (make_elf_object): Update declaration.
1867 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
1868 restart search.
1869 * dirsearch.h (class Dirsearch): Update declaration.
1870 * options.h (class General_options): Add --warn-search-mismatch.
1871 * parameters.cc (Parameters::is_compatible_target): New function.
1872 * parameters.h (class Parameters): Declare is_compatible_target.
1873 * workqueue.cc (Workqueue::add_blocker): New function.
1874 * workqueue.h (class Workqueue): Declare add_blocker.
1875
f1ed28fb
ILT
1876 * fileread.cc (Input_file::open): Remove options parameter.
1877 Change all callers.
1878 (Input_file::open_binary): Likewise.
1879 * script.cc (read_input_script): Likewise.
1880 * readsyms.h (class Read_symbols): Remove options_ field. Remove
1881 options parameter from constructor. Change all callers.
1882 (class Read_script): Likewise.
1883 * fileread.h (class Input_file): Update declarations.
1884 * script.h (read_input_script): Update declaration.
1885
34dd024a
NC
18862009-03-10 Nick Clifton <nickc@redhat.com>
1887
1888 * po/es.po: New Spanish translation.
1889
6d71b17c
CC
18902009-03-06 Cary Coutant <ccoutant@google.com>
1891
1892 * options.cc (parse_short_option): Keep dash_z from registering itself.
1893
031cdbed
ILT
18942009-03-03 Ian Lance Taylor <iant@google.com>
1895
1896 PR 9918
1897 * target-reloc.h (relocate_section): Pass output_section to
1898 relocate.
1899 * i386.cc (Target_i386::should_apply_static_reloc): Add
1900 output_section parameter. Change all callers.
1901 (Target_i386::Relocate::relocate): Add output_section parameter.
1902 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1903 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1904 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1905 * testsuite/two_file_shared.sh: New script.
1906 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
1907 (check_DATA): Add two_file_shared.dbg.
1908 (two_file_shared.dbg): New target.
1909 * testsuite/Makefile.in: Rebuild.
1910
15d5fa16
ILT
19112009-03-01 Ian Lance Taylor <iant@google.com>
1912
1913 * configure.ac: Check for byteswap.h.
1914 * configure: Rebuild.
1915 * config.in: Rebuild.
1916
8a4c0b0d
ILT
19172009-03-01 Mikolaj Zalewski <mikolajz@google.com>
1918
1919 * layout.cc (Layout::find_or_add_kept_section): New function.
1920 (Layout::add_comdat): Removed.
1921 * layout.h (struct Kept_section): Move out of class Layout.
1922 Remove trailing underscores from field names. Add group_sections
1923 field. Rename group_ field to is_group. Change all uses.
1924 (class Layout): Declare find_or_add_kept_section, not add_comdat.
1925 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
1926 comdat_groups_ field.
1927 (Sized_relobj::include_section_group): Use
1928 find_or_add_kept_section and Kept_section::group_sections.
1929 (Sized_relobj::include_linkonce_section): Likewise.
1930 * object.cc (class Sized_relobj): Don't define Comdat_group or
1931 Comdat_group_table. Remove find_comdat_group and
1932 add_comdat_group. Remove comdat_groups_ field.
1933 * plugin.cc (include_comdat_group): Use
1934 Layout::find_or_add_kept_section.
1935
b4ecf66b
ILT
19362009-02-28 Ian Lance Taylor <iant@google.com>
1937
14359ca0
ILT
1938 * README: --gc-sections and map files are now supported. Document
1939 some build requirements.
1940
b4ecf66b
ILT
1941 PR 6992
1942 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
1943 relocatable link set the value of the section symbol to zero.
1944 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
1945 relocatable link don't include the section address in the local
1946 symbol value.
1947
0602e05a
ILT
19482009-02-27 Ian Lance Taylor <iant@google.com>
1949
fd9d194f
ILT
1950 PR 6811
1951 * options.h (class Search_directory): Add is_system_directory.
1952 (class General_options): Declare is_in_system_directory.
1953 * options.cc (get_relative_sysroot): Make static.
1954 (get_default_sysroot): Make static.
1955 (General_optoins::is_in_system_directory): New function.
1956 * fileread.cc (Input_file::is_in_system_directory): New function.
1957 * fileread.h (class Input_file): Declare is_in_system_directory.
1958 * object.h (class Object): Add is_in_system_directory.
1959 (class Input_objects): Remove system_library_directory_ field.
1960 * object.cc (Input_objects::add_object): Don't set
1961 system_library_directory_.
1962 (input_objects::found_in_system_library_directory): Remove.
1963 * symtab.cc (Symbol_table::write_globals): Remove input_objects
1964 parameter. Change all callers.
1965 (Symbol_table::sized_write_globals): Likewise.
1966 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
1967 Call Object::is_in_system_directory.
1968 * symtab.h (class Symbol_table): Update declarations.
1969
61edd21f
ILT
1970 PR 5990
1971 * descriptors.h (Open_descriptor): Add is_on_stack field.
1972 * descriptors.cc (Descriptors::open): If the descriptor is on the
1973 top of the stack, remove it. Initialize is_on_stack field.
1974 (Descriptors::release): Only add pod to stack if it is not on the
1975 stack already.
1976 (Descriptors::close_some_descriptor): Clear stack_next and
1977 is_on_stack fields.
1978
e29e076a
ILT
1979 PR 7091
1980 * output.cc (Output_section::find_starting_output_address): Rename
1981 from starting_output_address; add PADDR parameter; change return
1982 type.
1983 * output.h (class Output_section): Declare
1984 find_starting_output_address instead of starting_output_address.
1985 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
1986 section symbol for which we can't find a merge section.
1987
0602e05a
ILT
1988 PR 9836
1989 * symtab.cc (Symbol_table::add_from_object): If the visibility is
1990 hidden or internal, force the symbol to be local.
1991 * resolve.cc (Symbol::override_visibility): Define.
1992 (Symbol::override_base): Use override_visibility.
1993 (Symbol_table::resolve): Likewise.
1994 (Symbol::override_base_with_special): Likewise.
1995 (Symbol_table::override_with_special): If the visibility is hidden
1996 or internal, force the symbol to be local.
1997 * symtab.h (class Symbol): Add set_visibility and
1998 override_visibility.
1999 * testsuite/ver_test_1.sh: New file.
2000 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
2001 (check_DATA): Add ver_test_1.syms.
2002 (ver_test_1.syms): New target.
2003 * testsuite/Makefile.in: Rebuild.
2004
401a9a73
CC
20052009-02-25 Cary Coutant <ccoutant@google.com>
2006
2007 * layout.cc (Layout::choose_output_section): Don't rename sections
2008 when using a linker script that has a SECTIONS clause.
2009 * Makefile.in: Regenerate.
2010
2011 * testsuite/Makefile.am (script_test_5.sh): New test case.
2012 * testsuite/Makefile.in: Regenerate.
2013 * testsuite/script_test_5.cc: New file.
2014 * testsuite/script_test_5.sh: New file.
2015 * testsuite/script_test_5.t: New file.
2016
f488e4b0
CC
20172009-02-13 Rafael Avila de Espindola <espindola@google.com>
2018
2019 * archive.cc (Archive::include_member): Update calls to add_symbols.
2020 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
2021 the Layout argument.
2022 * dynobj.h (do_add_symbols): Add the Layout argument.
2023 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
2024 Layout argument.
2025 * object.h (Object::add_symbols): Add the Layout argument.
2026 (Object::do_add_symbols): Add the Layout argument.
2027 (Sized_relobj::do_add_symbols): Add the Layout argument.
2028 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
2029 Unify the two versions.
2030 (Add_plugin_symbols): Remove.
2031 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
2032 (Sized_pluginobj::do_add_symbols): Unify the two versions.
2033 (Add_plugin_symbols): Remove.
2034 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
2035 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
2036 (Add_symbols::run): Make it work with Pulginobj.
2037
89dd1680
ILT
20382009-02-06 Ian Lance Taylor <iant@google.com>
2039
2040 * object.cc (Sized_relobj::do_layout): Make info message start
2041 with lower case letter.
2042
266d0a74
ILT
20432009-02-06 Mikolaj Zalewski <mikolajz@google.com>
2044
602b464e
ILT
2045 * binary.cc: Fix file comment.
2046
266d0a74
ILT
2047 * options.h (enum Incremental_disposition): Define.
2048 (class General_options): Add new options: --incremental,
2049 --incremental_changed, --incremental_unchanged,
2050 --incremental_unknown. Add incremental_disposition_ and
2051 implicit_incremental_ fields.
2052 (General_options::incremental_disposition): New function.
2053 (class Position_dependent_options): Add incremental_disposition
2054 option.
2055 (Position_dependent_options::copy_from_options): Set incremental
2056 dispositions.
2057 * options.cc (General_options::parse_incremental_changed): New
2058 function.
2059 (General_options::parse_incremental_unchanged): New function.
2060 (General_options::parse_incremental_unknown): New function.
2061 (General_options::General_options): Initialize new fields
2062 incremental_disposition_ and implicit_incremental_.
2063 (General_options::finalize): Check for uasge of --incremental-*
2064 without --incremental.
2065
f073bbf7
CD
20662009-02-06 Chris Demetriou <cgd@google.com>
2067
2068 * gold.h (gold_undefined_symbol): Change to take only a Symbol
2069 pointer and to report location as the file name associated with
2070 the symbol.
2071 (gold_undefined_symbol_at_location): New function to replace the
2072 old gold_undefined_symbol functionality.
2073 * target-reloc.h (relocate_section): Update to use
2074 gold_undefined_symbol_at_location.
2075 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2076 Call gold_undefined_symbol function rather than gold_error.
2077 * errors.h (Errors::undefined_symbol): Take location as a
2078 string, rather than calculating it from a relocation.
2079 * errors.cc (Errors::fatal): Print "fatal error:" before the
2080 formatted message.
2081 (Errors::error, Errors::error_at_location): Print "error: "
2082 before the formatted message.
2083 (Errors::undefined_symbol): Take location as a string, rather
2084 than calculating it from a relocation.
2085 (gold_undefined_symbol_at_location): New function akin to
2086 old gold_undefined_symbol, calculates location from relocation.
2087 (gold_undefined_symbol): Change to take only a Symbol pointer
2088 and to report location as the file name associated with the symbol.
2089 * testsuite/debug_msg.sh: Update for changed error messages.
2090 * testsuite/undef_symbol.sh: Likewise.
2091
8e94a90c
ILT
20922009-02-04 Duncan Sands <baldrick@free.fr>
2093
2094 PR 9812
2095 * reduced_debug_output.h
2096 (Output_reduced_debug_abbrev_section::failed): Use format for
2097 gold_warning.
2098 (Output_reduced_debug_info_section::faild): Likewise.
2099
88a0e15b
ILT
21002009-01-31 Mikolaj Zalewski <mikolajz@google.com>
2101
2102 * script.cc (Lazy_demangler): New class.
2103 (Version_script_info::get_symbol_version_helper): Demangle a
2104 symbol only once.
2105
5efc7cd2
CC
21062009-01-29 Cary Coutant <ccoutant@google.com>
2107
2108 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
2109 to __tls_get_addr.
2110 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2111
e0ebcf42
ILT
21122009-01-28 Ian Lance Taylor <iant@google.com>
2113
5efc7cd2 2114 * version.cc (version_string): Bump to 1.9.
75fe7426 2115
e0ebcf42
ILT
2116 * gold.h: Include <cstring> and <stdint.h>.
2117 * version.cc: Include <cstdio>.
2118 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
2119 warning.
2120 * reduced_debug_output.cc (insert_into_vector): Rename from
2121 Insert_into_vector; change all callers. Use Swap_unaligned to
2122 avoid aliasing issue; remove union since it is unnecessary.
2123
8e2813be 21242009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
2125
2126 * Makefile.am (CCFILES): Add gc.cc.
2127 (HFILES): Add gc.h.
2128 * Makefile.in: Regenerate.
2129 * gold.cc (Gc_runner): New class.
2130 (queue_initial_tasks): Call garbage collection related tasks
2131 when corresponding options are invoked.
2132 (queue_middle_gc_tasks): New function.
2133 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
2134 processed early before laying out sections during garbage collection.
2135 * gold.h (queue_middle_gc_tasks): New function.
2136 (is_prefix_of): Move from "layout.cc".
2137 * i386.cc (Target_i386::gc_process_relocs): New function.
2138 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
2139 * main.cc (main): Create object of class "Garbage_collection".
2140 * object.cc (Relobj::copy_symbols_data): New function.
2141 (Relobj::is_section_name_included): New function.
2142 (Sized_relobj::do_layout): Allow this function to be called twice
2143 during garbage collection and defer layout of section during the
2144 first call.
2145 * object.h (Relobj::get_symbols_data): New function.
2146 (Relobj::is_section_name_included): New function.
2147 (Relobj::copy_symbols_data): New function.
2148 (Relobj::set_symbols_data): New function.
2149 (Relobj::get_relocs_data): New function.
2150 (Relobj::set_relocs_data): New function.
2151 (Relobj::is_output_section_offset_invalid): New pure virtual function.
2152 (Relobj::gc_process_relocs): New function.
2153 (Relobj::do_gc_process_relocs): New pure virtual function.
2154 (Relobj::sd_): New data member.
2155 (Sized_relobj::is_output_section_offset_invalid): New function.
2156 (Sized_relobj::do_gc_process_relocs): New function.
2157 * options.h (General_options::gc_sections): Modify to not be a no-op.
2158 (General_options::print_gc_sections): New option.
2159 * plugin.cc (Plugin_finish::run): Remove function call to
2160 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
2161 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
2162 * reloc.cc (Read_relocs::run): Add task to process relocs and
2163 determine unreferenced sections when doing garbage collection.
2164 (Gc_process_relocs): New class.
2165 (Sized_relobj::do_gc_process_relocs): New function.
2166 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
2167 sections that are garbage collected.
2168 * reloc.h (Gc_process_relocs): New class.
2169 * sparc.cc (Target_sparc::gc_process_relocs): New function.
2170 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
2171 symbols whose corresponding sections are garbage collected.
2172 (Symbol_table::Symbol_table): Add new parameter for the garbage
2173 collection object.
2174 (Symbol_table::gc_mark_undef_symbols): New function.
2175 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2176 (Symbol_table::gc_mark_dyn_syms): New function.
2177 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
2178 as garbage.
2179 (Symbol_table::add_from_object): Likewise.
2180 (Symbol_table::add_from_relobj): When building shared objects, do not
2181 treat externally visible symbols as garbage.
2182 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
2183 table information for static and relocatable links.
2184 * symtab.h (Symbol_table::set_gc): New function.
2185 (Symbol_table::gc): New function.
2186 (Symbol_table::gc_mark_undef_symbols): New function.
2187 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2188 (Symbol_table::gc_mark_dyn_syms): New function.
2189 (Symbol_table::gc_): New data member.
2190 * target.h (Sized_target::gc_process_relocs): New pure virtual
2191 function.
2192 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
2193 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
2194
3b293544
CF
21952009-01-20 Chris Faylor <me.sourceware@sourceware.org>
2196
2197 * options.h (General_options::gc_sections): Define as a no-op for now.
2198 (General_options::no_keep_memory): Ditto.
2199 (General_options::Bshareable): Define.
2200 * options.cc (General_options::finalize): Honor -Bshareable.
2201
83d22aa8
AS
22022009-01-20 Andreas Schwab <schwab@suse.de>
2203
2204 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
2205 read the value in the contents, since we don't use it. Use the
2206 template endianness when writing.
2207 (Relocate::relocate): Use it for R_PPC_REL16_HA.
2208
cd536b21
AS
22092009-01-19 Andreas Schwab <schwab@suse.de>
2210
2211 * configure.tgt (powerpc64-*): Fix targ_obj.
2212
99e9a495
ILT
22132009-01-15 Ian Lance Taylor <iant@google.com>
2214
2215 * object.cc (Sized_relobj::write_local_symbols): Don't write out
2216 local symbols when stripping all symbols.
2217
bbbfea06
CC
22182009-01-14 Cary Coutant <ccoutant@google.com>
2219
99e9a495 2220 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 2221
0f7c0701
CC
22222009-01-14 Cary Coutant <ccoutant@google.com>
2223
2224 * archive.cc (Archive::get_elf_object_for_member): Remove call
2225 to File_read::claim_for_plugin.
2226 * descriptors.cc (Descriptors::open): Remove reference to
2227 is_claimed.
2228 (Descriptors::claim_for_plugin): Remove.
2229 * descriptors.h (Descriptors::claim_for_plugin): Remove.
2230 (Descriptors::is_claimed): Remove.
2231 (claim_descriptor_for_plugin): Remove.
2232 * fileread.cc (File_read::claim_for_plugin): Remove.
2233 * fileread.h (File_read::claim_for_plugin): Remove.
2234 (File_read::descriptor): Reopen descriptor if necessary.
2235 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
2236 (Plugin_manager::all_symbols_read): Add task parameter. Change
2237 all callers.
2238 (Plugin_manager::get_input_file): New function.
2239 (Plugin_manager::release_input_file): New function.
2240 (Pluginobj::Pluginobj): Add filesize parameter and initialize
2241 corresponding data member.
2242 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
2243 and pass to base constructor. Change all callers.
2244 (get_input_file, release_input_file): New functions.
2245 (make_sized_plugin_object): Add filesize parameter. Change all callers.
2246 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
2247 (Plugin_manager::all_symbols_read): Add task parameter.
2248 (Plugin_manager::get_input_file): New function.
2249 (Plugin_manager::release_input_file): New function.
2250 (Plugin_manager::task_): New data member.
2251 (Pluginobj::Pluginobj): Add filesize parameter.
2252 (Pluginobj::filename): New function.
2253 (Pluginobj::descriptor): New function.
2254 (Pluginobj::filesize): New function.
2255 (Pluginobj::filesize_): New data member.
2256 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
2257 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
2258 File_read::claim_for_plugin; use Object::unlock to unlock the file.
2259
2260 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
2261 with archive libraries.
2262 * testsuite/Makefile.in: Regenerate.
2263 * testsuite/plugin_test.c (struct sym_info): New type.
2264 (get_input_file, release_input_file): New static variables.
2265 (onload): Capture new transfer vector entries.
2266 (claim_file_hook): Stop reading at end of file according to filesize.
2267 Factor out parsing of readelf output into separate function.
2268 (all_symbols_read_hook): Exercise get_input_file and release_input_file
2269 APIs and get the source file name from the symbol table. Convert
2270 source file name to corresponding object file name. Print info
2271 message when adding new input files.
2272 (parse_readelf_line): New function.
2273 * testsuite/plugin_test_1.sh: Add checks for new info messages.
2274 * testsuite/plugin_test_2.sh: Likewise.
2275 * testsuite/plugin_test_3.sh: Likewise.
2276 * testsuite/plugin_test_4.sh: New test case.
2277
62a6d109
ILT
22782009-01-07 Ian Lance Taylor <iant@google.com>
2279
2280 * version.cc (version_string): Bump to 1.8.
2281
483620e8
CC
22822008-12-23 Cary Coutant <ccoutant@google.com>
2283
2284 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
2285 * plugin.cc (Plugin_manager::finish): Rename as
2286 layout_deferred_objects. Move cleanup to separate function.
2287 (Plugin_manager::cleanup): New function.
2288 (Plugin_finish::run): Call layout_deferred_objects and cleanup
2289 separately.
2290 * plugin.h (Plugin_manager::finish): Rename as
2291 layout_deferred_objects.
2292 (Plugin_manager::cleanup): New function.
2293 (Plugin_manager::cleanup_done): New field.
2294
d66a9eb3
CC
22952008-12-23 Cary Coutant <ccoutant@google.com>
2296
2297 * plugin.cc (is_visible_from_outside): New function.
2298 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
2299 so we don't return "IR only" status for exported symbols or -r links.
2300
2301 * testsuite/Makefile.am (plugin_test_3): New test case.
2302 * testsuite/Makefile.in: Regenerate.
2303 * testsuite/plugin_test_3.sh: New file.
2304
5995b570
CC
23052008-12-22 Cary Coutant <ccoutant@google.com>
2306
2307 * object.cc (Sized_relobj::layout_section): New function.
2308 (Sized_relobj::do_layout): Defer layout of input sections until after
2309 plugin has provided replacement files.
2310 (Sized_relobj::do_layout_deferred_sections): New function.
2311 * object.h (Relobj::set_section_offset): Remove virtual keyword.
2312 (Relobj::layout_deferred_sections): New function.
2313 (Relobj::do_layout_deferred_sections): New function.
2314 (Sized_relobj::do_layout_deferred_sections): New function.
2315 (Sized_relobj::layout_section): New function.
2316 (Sized_relobj::Deferred_layout): New structure.
2317 (Sized_relobj::deferred_layout_): New field.
2318 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
2319 Change all callers. Layout deferred sections.
2320 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
2321 references.
2322 (Plugin_hook::run): Move code from do_plugin_hook inline.
2323 (Plugin_hook::do_plugin_hook): Remove.
2324 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
2325 (Plugin_manager::finish): Renamed, was cleanup.
2326 (Plugin_manager::should_defer_layout): New function.
2327 (Plugin_manager::add_deferred_layout_object): New function.
2328 (Plugin_manager::Deferred_layout_list): New type.
2329 (Plugin_manager::deferred_layout_objects_): New field.
2330 (Plugin_hook::do_plugin_hook): Remove.
2331
ee769c88
ILT
23322008-12-17 Ian Lance Taylor <iant@google.com>
2333
2334 * options.h (class General_options): Add --no case for
2335 --export-dynamic.
2336
abc8dcba
CC
23372008-12-16 Cary Coutant <ccoutant@google.com>
2338
2339 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
2340 vector.
2341 (Plugin_manager::claim_file): Create plugin object even if
2342 plugin did not call the add_symbols callback.
2343 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
2344 asking for more symbols than were added.
2345 * testsuite/Makefile.am (plugin_test_1): Add test case with
2346 no global symbols.
2347 (empty.syms): New target.
2348 * testsuite/Makefile.in: Regenerate.
2349 * testsuite/plugin_test.c (claim_file_hook): Add new debug
2350 message. Don't call add_symbols if no globals.
2351 (all_symbols_read_hook): Don't provide replacement for empty
2352 claimed file.
2353
b0074644
ILT
23542008-12-12 Ian Lance Taylor <iant@google.com>
2355
68943102
ILT
2356 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
2357 r_type == 0 for a local symbol with r_sym == 0.
2358 (scan_relocatable_relocs): Pass r_sym to
2359 local_non_section_strategy.
2360 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
2361 r_sym parameter.
2362
b0074644
ILT
2363 * configure.ac: Update test for TLS descriptors: they are
2364 supported as of glibc 2.9.
2365 * configure: Rebuild.
2366
c2508178
ILT
23672008-12-11 Ian Lance Taylor <iant@google.com>
2368
2369 PR 7091
2370 * target-reloc.h (Default_scan_relocatable_relocs): For each
2371 function, map r_type == 0 to RELOC_DISCARD.
2372
2756a258
CC
23732008-12-10 Cary Coutant <ccoutant@google.com>
2374
2375 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
2376 object to override a kept COMDAT group from a plugin object.
2377
bb6f53d3
ILT
23782008-12-09 Ian Lance Taylor <iant@google.com>
2379
fbc558e1
ILT
2380 PR 7088
2381 * yyscript.y (file_cmd): Handle INPUT.
2382
bb6f53d3
ILT
2383 * testsuite/initpri1.c: Change all declarations to be full
2384 prototypes by adding void, to avoid compiler warnings.
2385
4674ecfc
CC
23862008-12-05 Rafael Avila de Espindola <espindola@google.com>
2387
2388 * options.cc (General_options::parse_plugin_opt): New.
2389 (General_options::add_plugin): The argument now is just the filename.
2390 (General_options::add_plugin_option): New.
2391 * options.h (plugin_opt): New.
2392 (add_plugin): Change argument name.
2393 (add_plugin_option): New.
2394 * plugin.cc (Plugin::load): Don't parse the plugin option.
2395 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
2396 (Plugin::add_option): New.
2397 (Plugin::args_): Change type.
2398 (Plugin::filename_): New.
2399 (Plugin_manager::add_plugin_option): New.
2400 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
2401 * testsuite/Makefile.in: Regenerate.
2402
fd06b4aa
CC
24032008-12-05 Cary Coutant <ccoutant@google.com>
2404
2405 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
2406 Handle --strip-lto-sections option.
2407 * options.h (strip_lto_sections): New option.
2408
6c52134c
CC
24092008-12-01 Cary Coutant <ccoutant@google.com>
2410
2411 * plugin.cc (ld_plugin_message): Change format parameter to const.
2412 Fix mismatch between new[] and delete.
2413
a45248e0
CC
24142008-11-14 Cary Coutant <ccoutant@google.com>
2415
2416 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
2417 instead of -1U.
2418
c82fbeee
CS
24192008-11-05 Craig Silverstein <csilvers@google.com>
2420
2421 * options.cc (General_options::parse_dynamic_list): New function.
2422 * options.h (General_options): New flags dynamic_list,
2423 dynamic_list_data, dynamic_list_cpp_new, and
2424 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
2425 (General_options::in_dynamic_list): New function.
2426 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
2427 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
2428 (Lex::can_continue_name): Likewise.
2429 (yylex): Likewise.
2430 (read_script_file): New parameter script_options.
2431 (read_dynamic_list): New function.
2432 (Script_options::define_dynamic_list): New function.
2433 (dynamic_list_keyword_parsecodes): New variable.
2434 (dynamic_list_keywords): New variable.
2435 * script.h (Script_options::define_dynamic_list): New function
2436 prototype.
2437 (read_dynamic_list): New function prototype.
2438 * symtab.cc (strprefix): New macro.
2439 (Symbol::should_add_dynsym_entry): Support dynamic_list,
2440 dynamic_list_data, dynamic_list_cpp_new, and
2441 dynamic_list_cpp_typeinfo.
2442 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
2443 (dynamic_list_expr): New rule.
2444 (dynamic_list_nodes): Likewise.
2445 (dynamic_list_node): Likewise.
2446 * testsuite/Makefile.am (dynamic_list): New test.
2447 * testsuite/Makefile.in: Regenerated.
2448 * testsuite/dynamic_list.t: New file.
2449 * testsuite/dynamic_list.sh: New file.
2450
e0bb29a5
CS
24512008-11-05 Craig Silverstein <csilvers@google.com>
2452
2453 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
2454 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
2455 (t11_last): Likewise.
2456 * testsuite/ver_test_6.c (main): Likewise.
2457
4e1e25e0
CC
24582008-10-07 Cary Coutant <ccoutant@google.com>
2459
2460 * options.c (General_options::finalize): Add check for -static and
2461 -shared.
2462 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
2463 is not empty.
2464
92f03fcb
CC
24652008-10-02 Cary Coutant <ccoutant@google.com>
2466
2467 * plugin.cc (make_sized_plugin_object): Fix conditional
2468 compilation to work when not all targets are enabled.
2469
fbd8a257
CC
24702008-09-29 Cary Coutant <ccoutant@google.com>
2471
2472 * archive.cc (Archive::get_file_and_offset): Use filename instead
2473 of name to get library path.
2474 (Archive::include_member): Unlock external member of a thin archive.
2475
2476 * testsuite/Makefile.am (TEST_AR): New variable.
2477 (thin_archive_test_1): New test.
2478 (thin_archive_test_2): New test.
81636b3f
CC
2479 * testsuite/Makefile.in: Regenerate.
2480 * testsuite/thin_archive_main.cc: New file.
2481 * testsuite/thin_archive_test_1.cc: New file.
2482 * testsuite/thin_archive_test_2.cc: New file.
2483 * testsuite/thin_archive_test_3.cc: New file.
2484 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 2485
eff45813
CC
24862008-09-29 Cary Coutant <ccoutant@google.com>
2487
2488 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
2489 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
2490 instead of -1U.
2491 (Sized_relobj::do_finalize_local_symbols): Likewise.
2492 (Sized_relobj::map_to_kept_section): Likewise.
2493 * object.h (Sized_relobj::invalid_address): New constant.
2494 (Sized_relobj::do_output_section_offset): Check for invalid_address
2495 and return -1ULL.
2496 * output.cc (Output_reloc::local_section_offset): Use constant
2497 invalid_address instead of -1U.
2498 (Output_reloc::get_address): Likewise.
2499 (Output_section::output_address): Change -1U to -1ULL.
2500 * output.h (Output_reloc::invalid_address): New constant.
2501 * reloc.cc (Sized_relobj::write_sections): Use constant
2502 invalid_address instead of -1U.
2503 (Sized_relobj::relocate_sections): Likewise.
2504 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
2505 values for merge sections.
2506 * target-reloc.h (relocate_for_relocatable): Use constant
2507 invalid_address instead of -1U.
2508
89fc3421
CC
25092008-09-19 Cary Coutant <ccoutant@google.com>
2510
2511 Add plugin functionality for link-time optimization (LTO).
2512 * configure.ac (plugins): Add --enable-plugins option.
2513 * configure: Regenerate.
2514 * config.in: Regenerate.
2515 * Makefile.am (LIBDL): New variable.
2516 (CCFILES): Add plugin.cc.
2517 (HFILES): Add plugin.h.
2518 (ldadd_var): Add LIBDL.
2519 * Makefile.in: Regenerate.
2520
2521 * archive.cc: Include "plugin.h".
2522 (Archive::setup): Don't preread archive symbols when using a plugin.
2523 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
2524 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
2525 files.
2526 (Archive::include_member): Add symbols from plugin objects.
2527 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
2528 * descriptors.cc (Descriptors::open): Check for file descriptors
2529 abandoned by plugins.
2530 (Descriptors::claim_for_plugin): New function.
2531 * descriptors.h (Descriptors::claim_for_plugin): New function.
2532 (Open_descriptor::is_claimed): New field.
2533 (claim_descriptor_for_plugin): New function.
2534 * fileread.cc (File_read::claim_for_plugin): New function.
2535 * fileread.h (File_read::claim_for_plugin): New function.
2536 (File_read::descriptor): New function.
2537 * gold.cc: Include "plugin.h".
2538 (queue_initial_tasks): Add task to call plugin hooks for generating
2539 new object files.
2540 * main.cc: Include "plugin.h".
2541 (main): Load plugin libraries.
2542 * object.h (Pluginobj): Declare.
2543 (Object::pluginobj): New function.
2544 (Object::do_pluginobj): New function.
2545 (Object::set_target): New function.
2546 * options.cc: Include "plugin.h".
2547 (General_options::parse_plugin): New function.
2548 (General_options::General_options): Initialize plugins_ field.
2549 (General_options::add_plugin): New function.
2550 * options.h (Plugin_manager): Declare.
2551 (General_options): Add --plugin option.
2552 (General_options::has_plugins): New function.
2553 (General_options::plugins): New function.
2554 (General_options::add_plugin): New function.
2555 (General_options::plugins_): New field.
2556 * plugin.cc: New file.
2557 * plugin.h: New file.
2558 * readsyms.cc: Include "plugin.h".
2559 (Read_symbols::do_read_symbols): Check for archive before checking
2560 for ELF file. Call plugin hooks to claim files.
2561 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
2562 from a real object file; force override when processing replacement
2563 files.
2564 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
2565 (Symbol::init_base_object): Likewise.
2566 (Symbol::init_base_output_data): Likewise.
2567 (Symbol::init_base_output_segment): Likewise.
2568 (Symbol::init_base_constant): Likewise.
2569 (Symbol::init_base_undefined): Likewise.
2570 (Symbol::output_section): Assert that object is not a plugin.
2571 (Symbol_table::add_from_pluginobj): New function.
2572 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
2573 undefined.
2574 (Symbol_table::sized_write_globals): Likewise.
2575 (Symbol_table::add_from_pluginobj): Instantiate template.
2576 * symtab.h (Sized_pluginobj): Declare.
2577 (Symbol::in_real_elf): New function.
2578 (Symbol::set_in_real_elf): New function.
2579 (Symbol::in_real_elf_): New field.
2580 (Symbol_table::add_from_pluginobj): New function.
2581
2582 * testsuite/Makefile.am (AM_CFLAGS): New variable.
2583 (LIBDL): New variable.
2584 (LDADD): Add LIBDL.
2585 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
2586 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
2587 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
2588 (MOSTLYCLEANFILES): Likewise.
2589 * testsuite/Makefile.in: Regenerate.
2590 * testsuite/plugin_test.c: New file.
2591 * testsuite/plugin_test_1.sh: New file.
2592 * testsuite/plugin_test_2.sh: New file.
2593
de31bda5
ILT
25942008-09-16 Ian Lance Taylor <iant@google.com>
2595
9c2d0ef9
ILT
2596 * target-reloc.h (relocate_section): Check whether a symbol is
2597 defined by the ABI before reporting an undefined symbol error.
2598 * target.h (Target::is_defined_by_abi): Make parameter const.
2599 (Target::do_is_defined_by_abi): Likewise.
2600 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
2601 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
2602 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
2603 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
2604 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
2605 * testsuite/Makefile.in: Rebuild.
2606
de31bda5
ILT
2607 * fileread.cc (make_view): Add casts to avoid warning.
2608
9fa33bee
AO
26092008-09-16 Alexandre Oliva <aoliva@redhat.com>
2610
2611 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
2612 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2613
183fd0e3
AO
26142008-09-16 Alexandre Oliva <aoliva@redhat.com>
2615
2616 * options.h (General_options::output_is_executable): New.
2617 (General_options::output_is_pie): New.
2618 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
2619 for shared libraries.
2620 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2621
7be8330a
CD
26222008-09-11 Chris Demetriou <cgd@google.com>
2623
2624 * options.h (origin): New -z option.
2625 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
2626 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
2627 in DT_FLAGS_1.
2628
a9caad02
CC
26292008-09-05 Cary Coutant <ccoutant@google.com>
2630
2631 * fileread.cc (File_read::make_view): Add check for attempt to map
2632 beyond end of file.
2633
ae6dce4d
CC
26342008-09-05 Cary Coutant <ccoutant@google.com>
2635
2636 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
2637 explicit instantiations.
2638
d7ab2a47
KVH
26392008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
2640
2641 PR gold/6858
2642 * options.cc (General_options::finalize): Allow undefined symbols
2643 in shlibs if linking -shared.
2644
2645 PR gold/6859
2646 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
2647 symbols as not needing a dynsym entry.
2648
1e52a9c1
CS
26492008-08-20 Craig Silverstein <csilvers@google.com>
2650
2651 * fileread.cc (File_read::open): Do not lock the file unless it
2652 was successfully opened.
2653
d85c80a3
CC
26542008-08-14 Cary Coutant <ccoutant@google.com>
2655
2656 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
2657 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
2658 * testsuite/tls_test.cc (struct int128): 128-bit struct
2659 for testing TLS relocs with non-zero addend.
2660 (v12): New TLS variable.
2661 (t12): New test.
2662 (t_last): Add check for v12.
2663 * testsuite/tls_test.h (t12): New function.
2664 * testsuite/tls_test_main.cc (thread_routine): Call new test.
2665
2d924fd9
ILT
26662008-08-13 Ian Lance Taylor <iant@google.com>
2667
2668 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
2669 set tls_segment_ or relro_segment_.
2670 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
2671 when appropriate.
2672 * output.h (Output_section::clear_is_relro): New function.
2673 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
2674 sections specially even when output_data_ is empty.
2675 (Output_segment::maximum_alignment): When first section is relro,
2676 only force alignment for PT_LOAD segments.
2677 * script.cc (script_data_segment_align): New function.
2678 (script_data_segment_relro_end): New function.
2679 * script-c.h (script_data_segment_align): Declare.
2680 (script_data_segment_relro_end): Declare.
2681 * script-sections.h (class Script_sections): Declare
2682 data_segment_align and data_segment_relro_end. Add fields
2683 segment_align_index_ and saw_relro_end_.
2684 * script-sections.cc (class Sections_element): Add set_is_relro
2685 virtual function. Add new bool* parameter to place_orphan_here.
2686 Add get_output_section virtual function.
2687 (class Output_section_definition): Add set_is_relro. Add new
2688 bool* parameter to place_orphan_here. Add get_output_section.
2689 Add is_relro_ field.
2690 (Output_section_definition::Output_section_definition): Initialize
2691 evaluated_address_, evaluated_load_address, evaluated_addralign_,
2692 and is_relro_ fields.
2693 (Output_section_definition::place_orphan_here): Add is_relro
2694 parameter.
2695 (Output_section_definition::set_section_addresses): Set relro for
2696 output section.
2697 (Output_section_definition::alternate_constraint): Likewise.
2698 (class Orphan_output_section): Add new bool* parameter to
2699 place_orphan_here. Add get_output_section.
2700 (Orphan_output_section::place_orphan_here): Add is_relro
2701 parameter.
2702 (Script_sections::Script_sections): Initialize
2703 data_segment_align_index_ and saw_relro_end_.
2704 (Script_sections::data_segment_align): New function.
2705 (Script_sections::data_segment_relro_end): New function.
2706 (Script_sections::place_orphan): Set or clear is_relro.
2707 (Script_sections::set_section_addresses): Force alignment of first
2708 TLS section.
2709 * yyscript.y (exp): Call script_data_segment_align and
2710 script_data_segment_relro_end.
2711 * testsuite/relro_script_test.t: New file.
2712 * testsuite/relro_test.cc (using_script): Declare.
2713 (t1, t2): Test using_script.
2714 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
2715 (relro_script_test_SOURCES): Define.
2716 (relro_script_test_DEPENDENCIES): Define.
2717 (relro_script_test_LDFLAGS): Define.
2718 (relro_script_test_LDADD): Define.
2719 (relro_script_test.so): New target.
2720 * testsuite/Makefile.in: Rebuild.
2721
f827c9a9
CC
27222008-08-06 Cary Coutant <ccoutant@google.com>
2723
2724 * archive.cc (Archive::total_archives, Archive::total_members)
2725 (Archive::total_members_loaded): New variables.
2726 (Archive::setup): Add parameter. Add option to preread
2727 archive symbols.
2728 (Archive::read_armap): Add counter.
2729 (Archive::get_file_and_offset): New function.
2730 (Archive::get_elf_object_for_member): New function.
2731 (Archive::read_all_symbols): New function.
2732 (Archive::read_symbols): New function.
2733 (Archive::add_symbols): Add counters.
2734 (Archive::include_all_members): Use armap to find members if it's
2735 already built.
2736 (Archive::include_member): Skip reading symbols if already read.
2737 Factored code into Archive::get_file_and_offset and
2738 Archive::get_elf_object_for_member. Changed call to
2739 Mapfile::report_include_archive_member.
2740 (Archive::print_stats): New function.
2741 * archive.h: Declare Object and Read_symbols_data classes.
2742 (Archive::Archive): Add initializers for new members.
2743 (Archive::setup): Add parameter.
2744 (Archive::print_stats): New function.
2745 (Archive::total_archives, Archive::total_members)
2746 (Archive::total_members_loaded): New variables.
2747 (Archive::get_file_and_offset): New function.
2748 (Archive::get_elf_object_for_member): New function.
2749 (Archive::read_all_symbols): New function.
2750 (Archive::read_symbols): New function.
2751 (Archive::Archive_member): New class.
2752 (Archive::members_): New member.
2753 (Archive::num_members_): New member.
2754 * main.cc: Include archive.h.
2755 (main): Call Archive::print_stats.
2756 * mapfile.cc (Mapfile::report_include_archive_member): Delete
2757 archive parameter; member_name is now the fully-decorated name.
2758 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
2759 * options.h: (General_options): Add --preread-archive-symbols option.
2760 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
2761 Archive::setup.
2762
de4c45bd
ILT
27632008-08-04 Ian Lance Taylor <iant@google.com>
2764
2765 * symtab.h (Symbol::use_plt_offset): New function.
2766 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
2767 * powerpc.cc (Relocate::relocate): Likewise.
2768 * sparc.cc (Relocate::relocate): Likewise.
2769 * x86_64.cc (Relocate::relocate): Likewise.
2770 * testsuite/weak_plt.sh: New test.
2771 * testsuite/weak_plt_main.cc: New test.
2772 * testsuite/weak_plt_shared.cc: New test.
2773 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
2774 (check_PROGRAMS): Add weak_plt.
2775 (check_DATA): Add weak_plt_shared.so.
2776 (weak_plt_main_pic.o, weak_plt): New targets.
2777 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
2778 * testsuite/Makefile.in: Rebuild.
2779
2780 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
2781 gcctestdir/ld.
2782 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
2783 * testsuite/Makefile.in: Rebuild.
2784
323ee3f4
AM
27852008-08-04 Alan Modra <amodra@bigpond.net.au>
2786
2787 * Makefile.am (POTFILES.in): Set LC_ALL=C.
2788 * Makefile.in: Regenerate.
2789 * po/POTFILES.in: Regenerate.
2790
7c07ecec
ILT
27912008-07-29 Ian Lance Taylor <iant@google.com>
2792
2793 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
2794 symbols before other symbols.
2795 * testsuite/script_test_2.cc (test_addr): Declare.
2796 (test_addr_alias): Declare.
2797 (main): Check that test_addr and test_addr_alias have the right
cd536b21 2798 values.
7c07ecec
ILT
2799 * testsuite/script_test_2.t: Define test_addr_alias and
2800 test_addr.
2801
5778530e
ILT
28022008-07-24 Ian Lance Taylor <iant@google.com>
2803
2a00e4fb
ILT
2804 PR 5990
2805 * descriptors.cc: New file.
2806 * descriptors.h: New file.
2807 * gold-threads.h (class Hold_optional_lock): New class.
2808 * fileread.cc: Include "descriptors.h".
2809 (File_read::~File_read): Release descriptor rather than closing
2810 it.
2811 (File_read::open) [file]: Call open_descriptor rather than open.
2812 Set is_descriptor_opened_.
2813 (File_read::open) [memory]: Assert that descriptor is not open.
2814 (File_read::reopen_descriptor): New function.
2815 (File_read::release): Release descriptor.
2816 (File_read::do_read): Make non-const. Reopen descriptor.
2817 (File_read::read): Make non-const.
2818 (File_read::make_view): Reopen descriptor.
2819 (File_read::do_readv): Likewise.
2820 * fileread.h (class File_read): Add is_descriptor_opened_ field.
2821 Update declarations.
2822 * layout.cc: Include "descriptors.h".
2823 (Layout::create_build_id): Use open_descriptor rather than open.
2824 * output.cc: Include "descriptors.h".
2825 (Output_file::open): Use open_descriptor rather than open.
2826 * archive.cc (Archive::const_iterator): Change Archive to be
2827 non-const.
2828 (Archive::begin, Archive::end): Make non-const.
2829 (Archive::count_members): Likewise.
2830 * archive.h (class Archive): Update declarations.
2831 * object.h (Object::read): Make non-const.
2832 * Makefile.am (CCFILES): Add descriptors.cc.
2833 (HFILES): Add descriptors.h.
2834 * Makefile.in: Rebuild.
2835
801647d1
ILT
2836 PR 6716
2837 * gold.h: Always include <clocale>. Add Solaris workarounds
2838 following code in binutils/sysdep.h.
2839
5edd166e
ILT
2840 PR 6048
2841 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
2842 this->eh_frame_hdr_ is NULL before using it.
2843
c89ad728
ILT
2844 * dynobj.cc (Versions::Versions): Update comment.
2845
aa86f06b
ILT
2846 * dynobj.cc (Versions::Versions): If there is an soname, use it as
2847 the base version name.
2848
5778530e
ILT
2849 * stringpool.cc (Stringpool_template::add_with_length): Set key to
2850 array size plus one.
2851 (Stringpool_template::set_string_offsets): Subtract one from key
2852 before using it as an array index.
2853 (Stringpool_template::get_offset_with_length): Likewise.
2854 (Stringpool_template::write_to_buffer): Likewise.
2855 * stringpool.h (Stringpool_template::get_offset_from_key):
2856 Likewise.
2857
057ead22
ILT
28582008-07-23 Ian Lance Taylor <iant@google.com>
2859
7f649c59
ILT
2860 PR 6658
2861 * object.h (Merged_symbol_value::value): Do our best to handle a
2862 negative addend.
2863
057ead22
ILT
2864 PR 6647
2865 * script.cc (Version_script_info::get_versions): Don't add empty
2866 version tag to return value.
2867 (Version_script_info::get_symbol_version_helper): Change return
2868 type to bool. Add pversion parameter. Change all callers.
2869 (script_register_vers_node): Don't require a non-NULL tag.
2870 * script.h (class Version_script_info): Update declarations.
2871 (Version_script_info::get_symbol_version): Change return type to
2872 bool. Add version parameter. Change all callers.
2873 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
2874 handling. Handle an empty version from a version script.
2875 (Symbol_table::define_special_symbol): Likewise.
2876 * testsuite/ver_test_10.script: New file.
2877 * testsuite/ver_test_10.sh: New file.
2878 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
2879 (check_DATA): Add ver_test_10.syms.
2880 (ver_test_10.syms, ver_test_10.so): New target.
2881 * testsuite/Makefile.in: Rebuild.
2882
58e54ac2
CD
28832008-07-23 Simon Baldwin <simonb@google.com>
2884
2885 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
2886 to zero for undefined symbols from dynamic libraries.
2887
95d14cd3
ILT
28882008-07-23 Ian Lance Taylor <iant@google.com>
2889
2890 * symtab.cc (Symbol_table::resolve): Remove version parameter.
2891 Change all callers.
2892 * symtab.h (class Symbol_table): Update declaration.
2893 * testsuite/ver_test_9.cc: New file.
2894 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
2895 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
2896 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
2897 (ver_test_9.so, ver_test_9.o): New targets.
2898 * testsuite/Makefile.in: Rebuild.
2899
92de84a6
ILT
29002008-07-22 Ian Lance Taylor <iant@google.com>
2901
34810851
ILT
2902 * options.h (class General_options): Define --check-sections.
2903 * layout.cc (Layout::set_segment_offsets): Handle
2904 --check-sections.
2905
af6156ef
ILT
2906 * options.h (class General_options): Define -n/--nmagic and
2907 -N/--omagic.
2908 * options.cc (General_options::finalize): For -n/--nmagic or
2909 -N/--omagic, set -static.
2910 * layout.cc (Layout::attach_allocated_section_to_segment): If
2911 -N/--omagic, don't put read-only and read-write sections in
2912 different segments.
2913 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
2914 finding a read-only segment.
2915 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
2916 don't set the minimum segment alignment to the common page size,
2917 and don't set the file offset to the address modulo the page size.
2918 * script-sections.cc (Script_sections::create_segments): If
2919 -n/--omagic, don't put read-only and read-write sections in
2920 different segments.
2921
92de84a6
ILT
2922 * cref.cc: New file.
2923 * cref.h: New file.
2924 * options.h (class General_options): Add --print-symbol-counts.
2925 * main.cc (main): Issue defined symbol report if requested.
2926 * archive.cc (Archive::interpret_header): Make into a const member
2927 function.
2928 (Archive::add_symbols): Call Input_objects::archive_start and
2929 archive_stop.
2930 (Archive::const_iterator): Define new class.
2931 (Archive::begin, Archive::end): New functions.
2932 (Archive::include_all_members): Rewrite to use iterator.
2933 (Archive::count_members): New function.
2934 * archive.h (class Archive): Update declarations.
2935 (Archive::filename): New function.
2936 * object.cc: Include "cref.h".
2937 (Sized_relobj::Sized_relobj): Initialize defined_count_.
2938 (Sized_relobj::do_get_global_symbol_counts): New function.
2939 (Input_objects::add_object): Add object to cross-referencer.
2940 (Input_objects::archive_start): New function.
2941 (Input_objects::archive_stop): New function.
2942 (Input_objects::print_symbol_counts): New function.
2943 * object.h: Declare Cref and Archive.
2944 (Object::get_global_symbol_counts): New function.
2945 (Object::do_get_global_symbol_counts): New pure virtual function.
2946 (class Sized_relobj): Add defined_count_ field. Update
2947 declarations.
2948 (class Input_objects): Add cref_ field. Update constructor.
2949 Update declarations.
2950 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
2951 defined_count_.
2952 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
2953 symbol counts.
2954 (Sized_dynobj::do_get_global_symbol_counts): New function.
2955 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
2956 defined_count_. Update declarations. Define Symbols typedef.
2957 * symtab.cc (Symbol_table::add_from_relobj): Add defined
2958 parameter. Change all callers.
2959 (Symbol_table::add_from_dynobj): Add sympointers and defined
2960 parameters. Change all callers.
2961 * symtab.h (class Symbol_table): Update declarations.
2962 * Makefile.am (CCFILES): Add cref.cc.
2963 (HFILES): Add cref.h.
2964 * Makefile.in: Rebuild.
2965
3f7c5e1d
CD
29662008-07-22 Simon Baldwin <simonb@google.com>
2967
2968 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
2969 to zero when writing undefined symbols.
2970
e0b64032
ILT
29712008-07-22 Ian Lance Taylor <iant@google.com>
2972
2973 * output.cc (Output_section::add_input_section): Don't try to
2974 merge empty merge sections.
2975
096b02cf
CS
29762008-07-21 Craig Silverstein <csilvers@google.com>
2977
2978 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2979 Include symbol version in error message.
cd536b21 2980
1d1f116d
CD
29812008-07-20 Chris Demetriou <cgd@google.com>
2982
cd536b21 2983 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
2984 (RANDOM_SEED_CFLAGS): New substituted variable.
2985 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
2986 * configure: Rebuild.
2987 * Makefile.in: Likewise.
2988 * testsuite/Makefile.in: Likewise.
2989
a18f591e
ILT
29902008-07-18 Ian Lance Taylor <iant@google.com>
2991
2992 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
2993 where we see NAME/NULL and NAME/VERSION as separate symbols.
2994 * testsuite/ver_test_main.cc (main): Call t4.
2995 (t4, t4_2a): Define.
2996 * testsuite/ver_test_2.cc (t4_2): Define.
2997 * testsuite/ver_test_2.script: Put t4_2a in VER2.
2998 * testsuite/ver_test_4.cc (t4_2a): Define.
2999 * testsuite/ver_test_4.script: Put t4_2a in VER2.
3000 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
3001
c6e3f6ed
ILT
30022008-07-17 Ian Lance Taylor <iant@google.com>
3003
3004 * dynobj.cc (Versions::add_def): If we give an error about a
3005 missing version, go ahead and create the version anyhow.
3006
ef9beddf
ILT
30072008-07-10 Ian Lance Taylor <iant@google.com>
3008
3009 Handle output sections with more than 0x7fffffff bytes.
3010 * object.h (class Relobj): Change map_to_output_ to
3011 output_sections_, and just keep a section pointer. Change all
3012 uses. Move comdat group support to Sized_relobj.
3013 (Relobj::is_section_specially_mapped): Remove.
3014 (Relobj::output_section): Remove poff parameter. Change all
3015 callers.
3016 (Relobj::output_section_offset): New function.
3017 (Relobj::set_section_offset): Rewrite.
3018 (Relobj::map_to_output): Remove.
3019 (Relobj::output_sections): New function.
3020 (Relobj::do_output_section_offset): New pure virtual function.
3021 (Relobj::do_set_section_offset): Likewise.
3022 (class Sized_relobj): Add section_offsets_ field. Add comdat
3023 group support from Relobj. Update declarations.
3024 (Sized_relobj::get_output_section_offset): New function.
3025 (Sized_relobj::do_output_section_offset): New function.
3026 (Sized_relobj::do_set_section_offset): New function.
3027 * object.cc (Relobj::output_section_address): Remove.
3028 (Sized_relobj::Sized_relobj): Initialize new fields.
3029 (Sized_relobj::include_section_group): Cast find_kept_object to
3030 Sized_relobj.
3031 (Sized_relobj::include_linkonce_section): Likewise.
3032 (Sized_relobj::do_layout): Use separate arrays for output section
3033 and output offset.
3034 (Sized_relobj::do_count_local_symbols): Change map_to_output to
3035 output_sections.
3036 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
3037 output_sections and section_offsets.
3038 (Sized_relobj::write_local_symbols): Likewise.
3039 (map_to_kept_section): Compute output address directly.
3040 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
3041 output_sections and section_offsets.
3042 (Sized_relobj::write_sections): Likewise.
3043 (Sized_relobj::relocate_sections): Likewise.
3044 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
3045 * output.h (class Output_reloc): Update declarations. Change
3046 u2_.relobj to Sized_relobj*.
3047 (class Output_data_reloc): Change add functions to use
3048 Sized_relobj*.
3049 * output.cc (Output_reloc::Output_reloc): Change relobj to
3050 Sized_relobj*.
3051 (Output_reloc::local_section_offset): Change return type to
3052 Elf_Addr. Use get_output_section_offset.
3053 (Output_reloc::get_address): Likewise.
3054 (Output_section::is_input_address_mapped): Don't call
3055 is_section_specially_mapped.
3056 (Output_section::output_offset): Likewise.
3057 (Output_section::output_address): Likewise.
3058 (Output_section::starting_output_address): Likewise.
3059 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
3060 parameter to Sized_relobj*.
3061 (Copy_relocs::need_copy_reloc): Likewise.
3062 (Copy_relocs::save): Likewise.
3063 * copy-relocs.h (class Copy_relocs): Update declarations.
3064 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
3065 Sized_relobj*. Change relobj_ field to Sized_relobj*.
3066 * target-reloc.h (relocate_for_relocatable): Change
3067 offset_in_output_section type to Elf_Addr. Change code that uses
3068 it as well.
3069 * layout.cc (Layout::layout): Always set *off.
3070 * mapfile.cc (Mapfile::print_input_section): Use
3071 output_section_offset.
3072 * i386.cc (Target_i386::copy_reloc): Change object parameter to
3073 Sized_relobj*.
3074 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
3075 * sparc.cc (Target_sparc::copy_reloc): Likewise.
3076 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
3077
5cb66f97
ILT
30782008-07-03 Ian Lance Taylor <iant@google.com>
3079
3080 * layout.cc (Layout::include_section): Do not discard unrecognized
3081 SHT_STRTAB sections.
3082
afe47622
CS
30832008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
3084
3085 * script.cc (Lex::can_continue_name): Make '?' allowable in
3086 version-script names.
3087 * testsuite/version_script.map: Change glob pattern to use '?'
3088
5adf9721
ILT
30892008-06-30 Manish Singh <yosh@gimp.org>
3090
3091 PR 6585
3092 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
3093 Correct typo.
3094
e6fde208
ILT
30952008-06-30 Ian Lance Taylor <iant@google.com>
3096
3097 PR 6660
3098 PR 6682
3099 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
3100 versions]: Don't try to read the value in the contents, since we
3101 don't use it. Use the template endianness when writing.
3102
3f2e6a2d
CC
31032008-06-25 Cary Coutant <ccoutant@google.com>
3104
3105 * fileread.cc (File_read::make_view): Assert on zero-length view.
3106 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
3107 symbol table when there are no symbols to read.
3108
c43d3a48
CS
31092008-06-23 Craig Silverstein <csilvers@google.com>
3110
3111 * version.cc (version_string): Bump to 1.7
3112
5f494ea0
CS
31132008-06-18 Craig Silverstein <csilvers@google.com>
3114
3115 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
3116 constant 0xFFFF to type Valtype.
3117 (Powerpc_relocate_functions::rel16_ha): Likewise.
3118
c42e122e
ILT
31192008-06-17 Ian Lance Taylor <iant@google.com>
3120
f34787f8
ILT
3121 * output.h (Output_section::Input_section): Initialize p2align_ to
3122 zero for Output_section_data constructors.
3123 (Output_section::Input_section::addralign): If not an input
3124 section, return the alignment of the Output_section_data.
3125 * testsuite/copy_test.cc: New file.
3126 * testsuite/copy_test_1.cc: New file.
3127 * testsuite/copy_test_2.cc: New file.
3128 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
3129 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
3130 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
3131 (copy_test_1_pic.o, copy_test_1.so): New targets.
3132 (copy_test_2_pic.o, copy_test_2.so): New targets.
3133 * testsuite/Makefile.in: Rebuild.
3134
c42e122e
ILT
3135 * script-sections.cc (Script_sections::place_orphan): Initialize
3136 local variable exact.
3137
ce3ac18a
DE
31382008-06-13 David Edelsohn <edelsohn@gnu.org>
3139
3140 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
3141
42cacb20
DE
31422008-06-12 David Edelsohn <edelsohn@gnu.org>
3143 David S. Miller <davem@davemloft.net>
3144
3145 * powerpc.cc: New file.
3146 * Makefile.am (TARGETSOURCES): Add powerpc.cc
3147 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
3148 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
3149 * Makefile.in: Rebuild.
3150
7b308235
ILT
31512008-06-09 Ian Lance Taylor <iant@google.com>
3152
3153 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
3154 <exception>.
3155 (throwing, orig_terminate): New static variables.
3156 (terminate_handler): New static function.
3157 (t2): Set terminate handler.
3158
f0b886e3
ILT
31592008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
3160
3161 PR 6584
cd536b21 3162 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
3163 alignment.
3164
3e90f135
CC
31652008-05-30 Cary Coutant <ccoutant@google.com>
3166
3167 * archive.cc (Archive::include_all_members) Correct to step
3168 over symbol table and extended name table in thin archives.
3169
e09ad04a
ILT
31702008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
3171
3172 PR 6407
3173 * target-reloc.h (relocate_for_relocatable): Fix new_offset
3174 calculation.
3175
62b01cb5
ILT
31762008-05-28 Caleb Howe <cshowe@google.com>
3177
3178 * reduced_debug_output.cc: New file.
3179 * reduced_debug_output.h: New file.
92de84a6 3180 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
3181 * options.cc (General_options::finalize): Add strip_debug_non_line
3182 to the strip heirarchy.
3183 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
3184 fields.
3185 * layout.cc: Include "reduced_debug_output.h".
3186 (Layout::Layout): Initialize new fields.
3187 (line_only_debug_sections): New static array.
3188 (is_lines_only_debug_sections): New static inline function.
3189 (Layout::include_section): Handle --strip-debug-non-line.
3190 (Layout::make_output_section): If --strip-debug-non-line, build
3191 new output sections for .debug_abbrev and .debug_info.
3192 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
3193 gold. Warn about possible overflow.
3194 (read_signed_LEB_128): Likewise.
3195 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
3196 (read_signed_LEB_128): Declare.
3197 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
3198 (HFILES): Add reduced_debug_output.h.
3199 * Makefile.in: Rebuild.
3200
7d9e3d98
ILT
32012008-05-21 Ian Lance Taylor <iant@google.com>
3202
3203 * mapfile.cc: New file.
3204 * mapfile.h: New file.
3205 * options.h (class General_options): Add -M/--print-map and -Map.
3206 * options.cc (General_options::finalize): Make -M equivalent to
3207 -Map -.
3208 * main.cc: Include <cstdio> and "mapfile.h".
3209 (main): Open mapfile if requested.
3210 * gold.cc (class Middle_runner): Add mapfile_ field. Update
3211 constructor. Change caller.
3212 (queue_initial_tasks): Add mapfile parameter. Change caller.
3213 (queue_middle_tasks): Likewise.
3214 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
3215 declarations.
3216 * archive.cc: Include "mapfile.h".
3217 (Archive::add_symbols): Add mapfile parameter. Change all
3218 callers. Pass mapfile, symbol, and reason to include_member.
3219 (Archive::include_all_members): Add mapfile parameter. Change all
3220 callers.
3221 (Archive::include_member): Add mapfile, sym, and why parameters.
3222 Change all callers. Report inclusion to map file.
3223 * archive.h: Include "fileread.h".
3224 (class Archive): Update declarations.
3225 (Archive::file): New const method.
3226 (class Add_archive_symbols): Add mapfile_ field. Update
3227 constructor. Change all callers.
3228 * readsyms.h (class Read_symbols): Likewise.
3229 (class Finish_group): Likewise.
3230 (class Read_script): Likewise.
3231 * common.cc: Include "mapfile.h".
3232 (Symbol_table::allocate_commons): Add mapfile parameter. Change
3233 all callers.
3234 (Symbol_table::do_allocate_commons): Likewise.
3235 (Symbol_table::do_allocate_commons_list): Likewise. Report common
3236 symbol allocation to mapfile.
3237 * common.h (class Allocate_commons_task): Add mapfile_ field.
3238 Update constructor. Change all callers.
3239 * symtab.h (class Symbol_table): Update declarations.
3240 * layout.cc: Include "mapfile.h".
3241 (Layout_task_runner::run): Print information to mapfile.
3242 (Layout::create_gold_note): Change Output_data_fixed_space to
3243 Output_data_zero_fill.
3244 (Layout::create_build_id): Likewise.
3245 (Layout::print_to_mapfile): New function.
3246 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
3247 constructor. Change caller.
3248 (class Layout): Declare print_to_mapfile.
3249 * output.cc (Output_section::Input_section::print_to_mapfile): New
3250 function.
3251 (Output_section::add_input_section): If producing a map, always
3252 add to input_sections_ list.
3253 (Output_section::do_print_to_mapfile): New function.
3254 (Output_segment::print_sections_to_mapfile): New function.
3255 (Output_segment::print_section_list_to_mapfile): New function.
3256 * output.h: Include "mapfile.h".
3257 (Output_data::print_to_mapfile): New function.
3258 (Output_data::do_print_to_mapfile): New virtual function.
3259 (Output_segment_headers::do_print_to_mapfile): New function.
3260 (Output_file_header::do_print_to_mapfile): New function.
3261 (Output_data_const::do_print_to_mapfile): New function.
3262 (class Output_data_const_buffer): Add map_name_ field. Update
3263 constructor. Change all callers. Add do_print_to_mapfile
3264 function.
3265 (class Output_data_fixed_space): Likewise.
3266 (class Output_data_space): Likewise.
3267 (class Output_data_zero_fill): New class.
3268 (Output_data_strtab::do_print_to_mapfile): New function.
3269 (Output_data_reloc_base::do_print_to_mapfile): New function.
3270 (Output_relocatable_relocs::do_print_to_mapfile): New function.
3271 (Output_data_group::do_print_to_mapfile): New function.
3272 (Output_data_got::do_print_to_mapfile): New function.
3273 (Output_data_dynamic::do_print_to_mapfile): New function.
3274 (Output_symtab_xindex::do_print_to_mapfile): New function.
3275 (class Output_section): Declare do_print_to_mapflie. Declare
3276 print_to_mapfile in Input_section.
3277 (class Output_segment): Declare new functions.
3278 * object.h (Sized_relobj::symbol_count): New function.
3279 * script-sections.cc
3280 (Output_section_element_dot_assignment::set_section_addresses):
3281 Change Output_data_fixed_space to Output_data_zero_fill.
3282 (Output_data_expression::do_print_to_mapfile): New function.
3283 * script.cc (read_input_script): Add mapfile parameter. Change
3284 all callers.
3285 * script.h (read_input_script): Update declaration.
3286 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
3287 (Eh_frame::do_print_to_mapfile): New function.
3288 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
3289 (Output_merge_string::do_print_to_mapfile): New function.
3290 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
3291 function.
3292 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
3293 function.
3294 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
3295 function.
3296 * Makefile.am (CCFILES): Add mapfile.cc.
3297 (HFILES): Add mapfile.h.
3298 * Makefile.in: Rebuild.
3299
9f1d377b
ILT
33002008-05-19 Ian Lance Taylor <iant@google.com>
3301
3302 * options.h (class General_options): Add -z relro.
3303 * layout.cc (Layout::Layout): Initialize relro_segment_.
3304 (Layout::add_output_section_data): Return the output section.
3305 (Layout::make_output_section): Rcognize relro sections and mark
3306 them appropriately.
3307 (Layout::attach_allocated_section_to_segment): Put relro sections
3308 in a PT_GNU_RELRO segment.
3309 (Layout::create_initial_dynamic_sections): Mark the .dynamic
3310 section as relro.
3311 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
3312 PT_TLS segments.
3313 (Layout::linkonce_mapping): Map d.rel.ro.local to
3314 .data.rel.ro.local.
3315 (Layout::output_section_name): Us .data.rel.ro.local for any
3316 section which begins with that.
3317 * layout.h (class Layout): Update add_output_section_data
3318 declaration. Add relro_segment_ field.
3319 * output.cc (Output_section::Output_section): Initialize is_relro_
3320 and is_relro_local_ fields.
3321 (Output_segment::add_output_section): Group relro sections.
3322 (Output_segment::is_first_section_relro): New function.
3323 (Output_segment::maximum_alignment): If there is a relro section,
3324 align the segment to the common page size.
3325 (Output_segment::set_section_addresses): Track whether we are
3326 looking at relro sections. If the last section is a relro
3327 section, align to the common page size.
3328 (Output_segment::set_section_list_addresses): Add in_relro
3329 parameter. Change all callers. Align to the page size when
3330 moving from relro to non-relro section.
3331 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
3332 segment.
3333 * output.h (class Output_section): Add is_relro_ and
3334 is_relro_local_ fields.
3335 (Output_section::is_relro): New function.
3336 (Output_section::set_is_relro): New function.
3337 (Output_section::is_relro_local): New function.
3338 (Output_section::set_is_relro_local): New function.
3339 (class Output_segment): Update declarations.
3340 * i386.cc (Target_i386::got_section): Mark .got section as relro.
3341 * sparc.cc (Target_sparc::got_section): Likewise.
3342 * x86_64.cc (Target_x86_64::got_section): Likewise.
3343 * testsuite/relro_test_main.cc: New file.
3344 * testsuite/relro_test.cc: New file.
3345 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
3346 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
3347 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
3348 (relro_test.so, relro_test_pic.o): New targets.
3349 * testsuite/Makefile.in: Rebuild.
3350
a984ee1d
ILT
33512008-05-16 Ian Lance Taylor <iant@google.com>
3352
01676dcd
ILT
3353 * output.cc (Output_segment::add_output_section): Remove front
3354 parameter.
3355 * output.h (class Output_segment): Remove
3356 add_initial_output_section and overloaded add_output_section.
3357 Update declaration of remaining add_output_section.
3358 * layout.cc (Layout::create_interp): Call add_output_section
3359 rather than add_initial_output_section.
3360 (Layout::finish_dynamic_section): Likewise.
3361
497897f9
ILT
3362 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
3363 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
3364 know the dynamic type.
3365 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
3366 field. Initialize it in constructor.
3367 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
3368 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
3369 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
3370 reloc.
3371
a984ee1d
ILT
3372 * output.cc (Output_reloc::get_address): Change return type to
3373 Elf_Addr.
3374 * output.h (class Output_reloc): Update get_address declaration.
3375 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
3376 for section addresses.
3377
55ba0940
ILT
33782008-05-09 Ian Lance Taylor <iant@google.com>
3379
3380 PR 6493
3381 * gold.cc (gold_nomem): Use return value of write.
3382
75517b77
ILT
33832008-05-08 Ian Lance Taylor <iant@google.com>
3384
3385 * symtab.c (Symbol::init_base_output_data): Add version
3386 parameter. Change all callers.
3387 (Symbol::init_base_output_segment): Likewise.
3388 (Symbol::init_base_constant): Likewise.
3389 (Symbol::init_base_undefined): Likewise.
3390 (Sized_symbol::init_output_data): Likewise.
3391 (Sized_symbol::init_output_segment): Likewise.
3392 (Sized_symbol::init_constant): Likewise.
3393 (Sized_symbol::init_undefined): Likewise.
3394 (Symbol_table::do_define_in_output_data): If the new symbol has a
3395 version, mark it as the default.
3396 (Symbol_table::do_define_in_output_segment): Likewise.
3397 (Symbol_table::do_define_as_constant): Likewise.
3398 * symtab.h (class Symbol): Update declarations.
3399 (class Sized_symbol): Likewise.
3400 * resolve.cc (Symbol::override_version): New function.
c42e122e 3401 (Symbol::override_base): Call override_version.
75517b77
ILT
3402 (Symbol::override_base_with_special): Likewise.
3403 * testsuite/ver_script_8.script: New file.
3404 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
3405 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
3406 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
3407 (ver_test_8_1.so, ver_test_8_2.so): New targets.
3408
f1f70eae
ILT
34092008-05-06 Ian Lance Taylor <iant@google.com>
3410
f3e9c5c5
ILT
3411 PR 6049
3412 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
3413 functions.
3414 (class General_options): Remove existing --undefined, and add
3415 --no-undefined instead. Add new --undefined as synonym for -u.
3416 * archive.cc (Archive::add_symbols): Check whether symbol was
3417 named with -u.
3418 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
3419 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
3420 all uses. Add IS_UNDEFINED. Update declarations to split
3421 different versions of init_base. Declare init_base_undefined.
3422 (Symbol::is_defined): Handle IS_UNDEFINED.
3423 (Symbol::is_undefined): Likewise.
3424 (Symbol::is_weak_undefined): Call is_undefined.
3425 (Symbol::is_absolute): Handle IS_CONSTANT.
3426 (class Sized_symbol): Update declarations to split different
3427 versions of init. Declare init_undefined.
3428 (class Symbol_table): Declare new functions.
3429 * symtab.cc (Symbol::init_base_object): Rename from init_base.
3430 Change all callers.
3431 (Symbol::init_base_output_data): Likewise.
3432 (Symbol::init_base_output_segment): Likewise.
3433 (Symbol::init_base_constant): Likewise.
3434 (Symbol::init_base_undefined): New function.
3435 (Sized_symbol::init_object): Rename from init. Change all
3436 callers.
3437 (Sized_symbol::init_output_data): Likewise.
3438 (Sized_symbol::init_output_segment): Likewise.
3439 (Sized_symbol::init_constant): Likewise.
3440 (Sized_symbol::init_undefined): New function.
3441 (Symbol_table::add_undefined_symbols_from_command_line): New
3442 function.
3443 (Symbol_table::do_add_undefined_symbols_from_command_line): New
3444 function.
3445 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
3446 (Symbol::output_section): Likewise.
3447 (Symbol::set_output_section): Likewise.
3448 (Symbol_table::sized_finalize_symbol): Likewise.
3449 (Symbol_table::sized_write_globals): Likewise.
3450 * resolve.cc (Symbol_table::should_override): Likewise.
3451 (Symbol::override_base_with_special): Likewise.
3452
8bdcdf2c
ILT
3453 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
3454 symbol, change it to have default visibility.
3455 * testsuite/protected_1.cc: New file.
3456 * testsuite/protected_2.cc: New file.
3457 * testsuite/protected_3.cc: New file.
3458 * testsuite/protected_main_1.cc: New file.
3459 * testsuite/protected_main_2.cc: New file.
3460 * testsuite/protected_main_3.cc: New file.
3461 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
3462 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
3463 (protected_1_LDFLAGS, protected_1_LDADD): Define.
3464 (protected_1.so): New target.
3465 (protected_1_pic.o, protected_2_pic.o): New targets.
3466 (protected_3_pic.o): New target.
3467 (check_PROGRAMS): Add protected_2.
3468 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
3469 (protected_2_LDFLAGS, protected_2_LDADD): Define.
3470 * testsuite/Makefile.in: Rebuild.
3471
2b706932
ILT
3472 * options.h (DEFINE_var): Add set_user_set_##varname__.
3473 (DEFINE_bool_alias): New macro.
3474 (class General_options): Define -Bstatic using DEFINE_bool_alias
3475 rather than DEFINE_special. Add --undefined as an alias for -z
3476 defs.
3477 * options.cc (General_options::parse_Bstatic): Remove.
3478
d82a5bcc
ILT
3479 * options.h (class General_options): Add --fatal-warnings.
3480 * main.cc (main): Implement --fatal-warnings.
3481 * errors.h (Errors::warning_count): New function.
3482
f1f70eae
ILT
3483 * options.h (class General_options): Add -Bsymbolic-functions.
3484 * symtab.h (Symbol::is_preemptible): Check for
3485 -Bsymbolic-functions.
3486
8825ac63
ILT
34872008-05-05 Ian Lance Taylor <iant@google.com>
3488
d98bc257
ILT
3489 * options.h (DEFINE_bool): For DASH_Z, create the negative option
3490 as noVARNAME rather than no-VARNAME.
3491 (class General_options): Add option -z combreloc.
3492 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
3493 get_address.
3494 (Output_reloc::sort_before) [SHT_REL]: New function.
3495 (Output_reloc::sort_before) [SHT_RELA]: New function.
3496 (class Output_data_reloc_base): Add sort_relocs_ field. Define
3497 Sort_relocs_comparison.
3498 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
3499 parameter. Change all callers.
3500 (Output_data_reloc::Output_data_reloc) [both versions]: Add
3501 sort_relocs parameter. Change all callers.
3502 * output.cc (Output_reloc::get_address): New function, broken out
3503 of write_rel.
3504 (Output_reloc::write_rel): Call it.
3505 (Output_reloc::compare): New function.
3506 (Output_data_reloc_base::do_write): Optionally sort relocs.
3507
60b2b4e7
ILT
3508 * configure.ac: If targ_extra_obj is set, link it in.
3509 * configure.tgt: Initialize all variables.
3510 (x86_64*): Set targ_extra_obj and targ_extra_size.
3511 * configure: Rebuild.
3512
8825ac63
ILT
3513 * object.cc (Sized_relobj::include_section_group): Adjust section
3514 indexes read from group data. Build vector to pass to
3515 layout_group.
3516 * layout.cc (Layout::layout_group): Add flags and shndxes
3517 parameters. Remove contents parameter. Change caller. Update
3518 explicit instantiations.
3519 * layout.h (class Layout): Update layout_group declaration.
3520 * output.cc (Output_data_group::Output_data_group): Add flags and
3521 input_shndxes parameters. Remove contents parameter. Change
3522 caller.
3523 (Output_data_group::do_write): Change input_sections_ to
3524 input_shndxes_.
3525 * output.h (class Output_data_group): Update constructor
3526 declaration. Rename input_sections_ to input_shndxes_.
3527 * testsuite/many_sections_test.cc: Add template.
3528
e94cf127
CC
35292008-04-30 Cary Coutant <ccoutant@google.com>
3530
4418b2d5
CC
3531 * target-reloc.h (relocate_section): Fix dead-pointer bug.
3532
e94cf127
CC
3533 * layout.cc (Layout::include_section): Refactored check for debug
3534 info section.
3535 (Layout::add_comdat): Add new parameters. Change type
3536 of signature parameter. Add object and shndx to signatures table.
3537 (Layout::find_kept_object): New function.
3538 * layout.h: Include <cstring>.
3539 (Layout::is_debug_info_section): New function.
3540 (Layout::add_comdat): Add new parameters.
3541 (Layout::find_kept_object): New function.
3542 (Layout::Kept_section): New struct.
3543 (Layout::Signatures): Change type of map range.
3544 * object.cc (Relobj::output_section_address): New function.
3545 (Sized_relobj::include_section_group): Add new parameters. Change
3546 calls to Layout::add_comdat. Change to build table of kept comdat
3547 groups and table mapping discarded sections to kept sections.
3548 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
3549 (Sized_relobj::do_layout): Change calls to include_section_group and
3550 include_linkonce_section.
3551 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
3552 value to zero when section is discarded.
3553 (Sized_relobj::map_to_kept_section): New function.
3554 * object.h (Relobj::output_section_address): New function.
3555 (Relobj::Comdat_group): New type.
3556 (Relobj::find_comdat_group): New function.
3557 (Relobj::Comdat_group_table): New type.
3558 (Relobj::Kept_comdat_section): New type.
3559 (Relobj::Kept_comdat_section_table): New type.
3560 (Relobj::add_comdat_group): New function.
3561 (Relobj::set_kept_comdat_section): New function.
3562 (Relobj::get_kept_comdat_section): New function.
3563 (Relobj::comdat_groups_): New field.
3564 (Relobj::kept_comdat_sections_): New field.
3565 (Symbol_value::input_value): Update comment.
3566 (Sized_relobj::map_to_kept_section) New function.
3567 (Sized_relobj::include_linkonce_section): Add new parameter.
3568 * target-reloc.h (Comdat_behavior): New type.
3569 (get_comdat_behavior): New function.
3570 (relocate_section): Add code to map a discarded section to the
3571 corresponding kept section when applying a relocation.
3572
e4e5049b
CS
35732008-04-30 Craig Silverstein <csilvers@google.com>
3574
3575 * dwarf_reader.cc (next_generation_count): New static var.
3576 (Addr2line_cache_entry): New struct.
3577 (addr2line_cache): New static var.
3578 (Dwarf_line_info::one_addr2line): Added caching.
3579 (Dwarf_line_info::clear_addr2line_cache): New function.
3580 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
3581 cache-size parameter.
3582 (Dwarf_line_info::one_addr2line_cache): New function.
3583 * symtab.cc (Symbol_table::detect_odr_violations): Pass
3584 new cache-size argument to one_addr2line(), and clear cache.
3585
d09e9154
CC
35862008-04-28 Cary Coutant <ccoutant@google.com>
3587
3588 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
3589 R_386_PC8 relocations.
3590
7ef73768
ILT
35912008-04-23 Ian Lance Taylor <iant@google.com>
3592
55438702
ILT
3593 * object.cc (Sized_relobj::include_section_group): Check for
3594 invalid section group.
3595
c165fb93
ILT
3596 * object.cc (make_elf_object): Correct test for 64-bit ELF file
3597 header size.
3598
7ef73768
ILT
3599 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
3600 than read for file header.
3601 * archive.cc (Archive::include_member): Likewise.
3602
6194aaab
L
36032008-04-23 Paolo Bonzini <bonzini@gnu.org>
3604
3605 * aclocal.m4: Regenerate.
3606 * configure: Regenerate.
3607
d491d34e
ILT
36082008-04-19 Ian Lance Taylor <iant@google.com>
3609
5ea2bac6
ILT
3610 * version.cc (version_string): Bump to 1.6.
3611
7bc3e21a
ILT
3612 * testsuite/Makefile.am (many_sections_r_test): New target.
3613 (many_sections_r_test_SOURCES): Remove.
3614 (many_sections_r_test_DEPENDENCIES): Remove.
3615 (many_sections_r_test_LDFLAGS): Remove.
3616 (many_sections_r_test_LDADD): Remove.
3617
7fcd3aa9
ILT
3618 * object.cc (Sized_relobj::do_add_symbols): Always pass
3619 local_symbol_count_ to add_from_relobj.
3620
4c94d6ae
ILT
3621 * testsuite/Makefile.am (many_sections_check.h): Only check one in
3622 every thousand variables.
3623 * testsuite/Makefile.in: Rebuild.
3624
d491d34e
ILT
3625 * object.cc (Xindex::initialize_symtab_xindex): New function.
3626 (Xindex::read_symtab_xindex): New function.
3627 (Xindex::sym_xindex_to_shndx): New function.
3628 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
3629 available.
3630 (Sized_relobj::do_initialize_xindex): New function.
3631 (Sized_relobj::do_read_symbols): Adjust section links.
3632 (Sized_relobj::symbol_section_and_value): Add is_ordinary
3633 parameter. Change all callers.
3634 (Sized_relobj::include_section_group): Adjust section links and
3635 symbol section indexes.
3636 (Sized_relobj::do_layout): Adjust section links.
3637 (Sized_relobj::do_count_local_symbols): Adjust section links and
3638 symbol section indexes.
3639 (Sized_relobj::do_finalize_local_symbols): Distinguish between
3640 ordinary and special symbols.
3641 (Sized_relobj::write_local_symbols): Add symtab_xindex and
3642 dynsym_xindex parameters. Change all callers. Adjust section
3643 links. Use SHN_XINDEX when needed.
3644 (Sized_relobj::get_symbol_location_info): Adjust section links.
3645 Don't get fooled by special symbols.
3646 * object.h (class Xindex): Define.
3647 (class Object): Add xindex_ parameter. Declare virtual functoin
3648 do_initialize_xindex.
3649 (Object::adjust_sym_shndx): New function.
3650 (Object::set_xindex): New protected function.
3651 (class Symbol_value): Add is_ordinary_shndx_ field.
3652 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
3653 (Symbol_value::value): Assert ordinary section.
3654 (Symbol_value::initialize_input_to_output_map): Likewise.
3655 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
3656 Change all callers.
3657 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
3658 all callers.
3659 (class Sized_relobj): Update declarations.
3660 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
3661 parameter. Change all callers.
3662 (Sized_relobj::adjust_shndx): New function.
3663 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
3664 field.
3665 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
3666 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
3667 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
3668 (Sized_dynobj::read_dynsym_section): Adjust section links.
3669 (Sized_dynobj::read_dynamic): Likewise.
3670 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
3671 section links.
3672 (Sized_dynobj::do_initialize_xindex): New function.
3673 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
3674 do_initialize_xindex.
3675 (Sized_dynobj::adjust_shndx): New function.
3676 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
3677 dynsym_xindex_ fields.
3678 (Layout::finalize): Add a call to set_section_indexes before
3679 creating the symtab sections.
3680 (Layout::set_section_indexes): Don't do anything if the section
3681 already has a section index.
3682 (Layout::create_symtab_sections): Add shnum parameter. Change
3683 caller. Create .symtab_shndx section if needed.
3684 (Layout::create_shdrs): Add shstrtab_section parameter. Change
3685 caller.
3686 (Layout::allocated_output_section_count): New function.
3687 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
3688 needed.
3689 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
3690 fields. Update declarations.
3691 (Layout::symtab_xindex): New function.
3692 (Layout::dynsym_xindex): New function.
3693 (class Write_symbols_task): Add layout_ field.
3694 (Write_symbols_task::Write_symbols_task): Add layout parameter.
3695 Change caller.
3696 * output.cc (Output_section_headers::Output_section_headers): Add
3697 shstrtab_section parameter. Change all callers.
3698 (Output_section_headers::do_sized_write): Store overflow values
3699 for section count and section string table section index in
3700 section header zero.
3701 (Output_file_header::do_sized_write): Check for overflow of
3702 section count and section string table section index.
3703 (Output_symtab_xindex::do_write): New function.
3704 (Output_symtab_xindex::endian_do_write): New function.
3705 * output.h (class Output_section_headers): Add shstrtab_section_.
3706 Update declarations.
3707 (class Output_symtab_xindex): Define.
3708 (Output_section::has_out_shndx): New function.
3709 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
3710 field.
3711 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
3712 Change all callers.
3713 (Sized_symbol::init): Likewise.
3714 (Symbol::output_section): Check for ordinary symbol.
3715 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
3716 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
3717 callers.
3718 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
3719 Change all callers. Simplify handling of symbols from sections
3720 not included in the link.
3721 (Symbol_table::add_from_dynobj): Handle ordinary symbol
3722 distinction.
3723 (Weak_alias_sorter::operator()): Assert that symbols are
3724 ordinary.
3725 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
3726 distinction.
3727 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
3728 parameters. Change all callers.
3729 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
3730 symbol distinction. Use SHN_XINDEX when needed.
3731 (Symbol_table::write_section_symbol): Add symtab_xindex
3732 parameter. Change all callers.
3733 (Symbol_table::sized_write_section_symbol): Likewise. Use
3734 SHN_XINDEX when needed.
3735 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
3736 declarations.
3737 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
3738 (Symbol::is_defined): Check is_ordinary.
3739 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
3740 (Symbol::is_absolute, Symbol::is_common): Likewise.
3741 (class Sized_symbol): Update declarations.
3742 (class Symbol_table): Update declarations.
3743 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
3744 parameters. Change all callers.
3745 (Sized_symbol::override): Likewise.
3746 (Symbol_table::override): Likewise.
3747 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
3748 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
3749 is_ordinary, and orig_st_shndx parameters. Change all callers.
3750 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
3751 to be in an ordinary section.
3752 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
3753 object and is_ordinary parameters. Change all callers.
3754 (Sized_dwarf_line_info::read_relocs): Add object parameter.
3755 Change all callers. Don't add undefined or non-ordinary symbols
3756 to reloc_map_.
3757 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
3758 Change all callers.
3759 * dwarf_reader.h (class Sized_dwarf_line_info): Update
3760 declarations.
3761 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
3762 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
3763 (Sized_relobj::relocate_sections): Likewise.
3764 * target-reloc.h (scan_relocs): Adjust section symbol index.
3765 (scan_relocatable_relocs): Likewise.
3766 * i386.cc (Scan::local): Check for ordinary symbols.
3767 * sparc.cc (Scan::local): Likewise.
3768 * x86_64.cc (Scan::local): Likewise.
3769 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
3770 to symbol_section_and_value.
3771 * testsuite/many_sections_test.cc: New file.
3772 * testsuite/Makefile.am (BUILT_SOURCES): Define.
3773 (check_PROGRAMS): Add many_sections_test.
3774 (many_sections_test_SOURCES): Define.
3775 (many_sections_test_DEPENDENCIES): Define.
3776 (many_sections_test_LDFLAGS): Define.
3777 (BUILT_SOURCES): Add many_sections_define.h.
3778 (many_sections_define.h): New target.
3779 (BUILT_SOURCES): Add many_sections_check.h.
3780 (many_sections_check.h): New target.
3781 (check_PROGRAMS): Add many_sections_r_test.
3782 (many_sections_r_test_SOURCES): Define.
3783 (many_sections_r_test_DEPENDENCIES): Define.
3784 (many_sections_r_test_LDFLAGS): Define.
3785 (many_sections_r_test_LDADD): Define.
3786 (many_sections_r_test.o): New target.
3787 * testsuite/Makefile.in: Rebuild.
3788
c5818ff1
CC
37892008-04-17 Cary Coutant <ccoutant@google.com>
3790
3791 * errors.cc (Errors::info): New function.
3792 (gold_info): New function.
3793 * errors.h (Errors::info): New function.
3794 * gold.h (gold_info): New function.
3795 * object.cc (Input_objects::add_object): Print trace output.
3796 * options.cc (options::parse_set): New function.
3797 (General_options::parse_wrap): Deleted.
3798 (General_options::General_options): Deleted initializer.
3799 * options.h (options::String_set): New typedef.
3800 (options::parse_set): New function.
3801 (DEFINE_set): New macro.
3802 (General_options::wrap): Changed to use DEFINE_set. Changed
3803 callers of any_wrap_symbols and is_wrap_symbol.
3804 (General_options::trace, General_options::trace_symbol):
3805 New options.
3806 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
3807 (General_options::wrap_symbols_): Deleted.
3808 * symtab.cc (Symbol_table::add_from_object): Print trace output.
3809
b5be4a7c
DM
38102008-04-17 David S. Miller <davem@davemloft.net>
3811
3812 * options.cc (General_options::parse_V): New function.
3813 * options.h: Add entries for -V and -Qy.
3814
155a0dd7
ILT
38152008-04-17 Ian Lance Taylor <iant@google.com>
3816
3817 * common.cc (Symbol_table::allocate_commons): Remove options
3818 parameter. Change caller.
3819 (Symbol_table::do_allocate_commons): Remove options parameter.
3820 Change caller. Just call do_allocate_commons_list twice.
3821 (Symbol_table::do_allocate_commons_list): New function, broken out
3822 of do_allocate_commons.
3823 * common.h (class Allocate_commons_task): Remove options_ field.
3824 Update constructor.
3825 * symtab.cc (Symbol_table::Symbol_table): Initialize
3826 tls_commons_.
3827 (Symbol_table::add_from_object): Put TLS common symbols on
3828 tls_commons_ list.
3829 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
3830 which are IN_OUTPUT_DATA.
3831 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
3832 allocate_commons and do_allocate_commons declarations. Declare
3833 do_allocate_commons_list.
3834 * gold.cc (queue_middle_tasks): Update creation of
3835 Allocate_commons_task to not pass options.
3836 * testsuite/Makefile.am (INCLUDES): Add -I.. .
3837 (TLS_TEST_C_FLAGS): New variable.
3838 (tls_test_c_pic.o): New target.
3839 (tls_test_shared.so): Link in tls_test_c_pic.o.
3840 (tls_test_c_pic_ie.o): New target.
3841 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
3842 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
3843 (tls_test_c.o): New target.
3844 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
3845 (tls_pic_test_LDADD): Likewise.
3846 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
3847 (tls_shared_gd_to_ie_test_LDADD): Likewise.
3848 (tls_test_c_gnu2.o): New target.
3849 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
3850 tls_test_c_gnu2.o.
3851 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
3852 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
3853 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
3854 * testsuite/tls_test.cc: Include "config.h".
3855 (t_last): Call t11_last.
3856 * testsuite/tls_test.h (t11, t11_last): Declare.
3857 * testsuite/tls_test_c.c: New file.
3858 * testsuite/tls_test_main.cc (thread_routine): Call t11.
3859 * configure.ac: Check for OpenMP support.
3860 * configure, config.in, Makefile.in: Rebuild.
3861 * testsuite/Makefile.in: Rebuild.
3862
edfbb029
CC
38632008-04-16 Cary Coutant <ccoutant@google.com>
3864
3865 * i386.cc (Target_i386::define_tls_base_symbol): New function.
3866 (Target_i386::tls_base_symbol_defined_): New field.
3867 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
3868 (Target_i386::Scan::global): Likewise.
3869 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
3870 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
3871 (Target_x86_64::tls_base_symbol_defined_): New field.
3872 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
3873 (Target_x86_64::Scan::global): Likewise.
3874
f3c69fca
CC
38752008-04-16 Cary Coutant <ccoutant@google.com>
3876
3877 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
3878 (Symbol::needs_plt_entry): Allow weak undefined symbols.
3879 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
3880 building shared libraries.
3881 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
3882 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
3883 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
3884 * testsuite/Makefile.in: Rebuild.
3885 * testsuite/weak_undef.h: New file.
3886 * testsuite/weak_undef_file1.cc: Add extra test cases.
3887 * testsuite/weak_undef_file2.cc: Likewise.
3888 * testsuite/weak_undef_test.cc: Likewise.
3889
7c414435
DM
38902008-04-16 David S. Miller <davem@davemloft.net>
3891
32b769e1
DM
3892 * sparc.cc (Target_sparc::Scan): Change from struct to class.
3893 Add issued_non_pic_error_ field. Declare check_non_pic.
3894 (Target_sparc::Scan::check_non_pic): New function.
3895 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
3896 (Target_sparc::Scan::global): Likewise.
3897
11936fb1
DM
3898 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
3899 * configure: Rebuild.
3900
7c414435
DM
3901 * options.h (DEFINE_enable): New macro.
3902 (new_dtags): New enable option.
3903 (initfirst, interpose, loadfltr, nodefaultlib,
3904 nodelete, nodlopen, nodump): New -z options.
3905 * layout.cc (Layout:finish_dynamic_section): If new
3906 dtags enabled, emit DT_RUNPATH. Also, emit a
3907 DT_FLAGS_1 containing any specified -z flags.
3908
85c7bf8b
ILT
39092008-04-16 Ian Lance Taylor <iant@google.com>
3910
12c0daef
ILT
3911 * copy-relocs.cc: New file.
3912 * copy-relocs.h: New file.
3913 * reloc.cc: Remove Copy_relocs code.
3914 * reloc.h: Likewise.
3915 * reloc-types.h (struct Reloc_types) [both versions]: Add
3916 get_reloc_addend_noerror.
3917 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
3918 variants of add_global which take an addend which must be zero.
3919 * i386.cc: Include "copy-relocs.h".
3920 (class Target_i386): Change type of copy_relocs_ to variable,
3921 update initializer.
3922 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
3923 Change all callers.
3924 (Target_i386::do_finalize_sections): Change handling of
3925 copy_relocs_.
3926 * sparc.cc: Include "copy-relocs.h".
3927 (class Target_sparc): Change type of copy_relocs_ to variable,
3928 update initializer.
3929 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
3930 Change all callers.
3931 (Target_sparc::do_finalize_sections): Change handling of
3932 copy_relocs_.
3933 * x86_64.cc: Include "copy-relocs.h".
3934 (class Target_x86_64): Change type of copy_relocs_ to variable,
3935 update initializer.
3936 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
3937 class. Change all callers.
3938 (Target_x86_64::do_finalize_sections): Change handling of
3939 copy_relocs_.
3940 * Makefile.am (CCFILES): Add copy-relocs.cc.
3941 (HFILES): Add copy-relocs.h.
3942
4f4995b6
ILT
3943 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
3944
85c7bf8b
ILT
3945 * testsuite/script_test_4.sh: Permit leading zeroes.
3946
4f2a9edd
ILT
39472008-04-15 Ian Lance Taylor <iant@google.com>
3948
e6188289
ILT
3949 * script-sections.cc (Script_sections::create_segments): Use
3950 header_size_adjustment even when there is enough room for the
3951 headers.
3952 * testsuite/script_test_4.sh: New file.
3953 * testsuite/script_test_4.t: New file.
3954 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
3955 (check_DATA): Add script_test_4.stdout.
3956 (MOSTLYCLEANFILES): Likewise.
3957 (script_test_4): New target.
3958 (script_test_4.stdout): New target.
3959 * testsuite/Makefile.in: Rebuild.
3960
4f2a9edd
ILT
3961 * sparc.cc: Add definitions for Output_data_plt_sparc class
3962 constants.
3963
f5314dd5
DM
39642008-04-14 David S. Miller <davem@davemloft.net>
3965
3966 * sparc.cc: New file.
3967 * Makefile.am (TARGETSOURCES): Add sparc.cc
3968 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
3969 * configure.tgt: Document targ_extra_size and
3970 targ_extra_big_endian. Add entries for sparc-* and
3971 sparc64-*.
3972 * configure.ac: Handle targ_extra_size and
3973 targ_extra_big_endian.
3974 * Makefile.in: Rebuild.
3975 * configure: Likewise.
3976 * po/POTFILES.in: Likewise.
3977 * po/gold.pot: Likewise.
3978
154e0e9a
ILT
39792008-04-14 Ian Lance Taylor <iant@google.com>
3980
3981 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
3982 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
3983 in the name/type/flags to section mapping. Don't call
3984 allocate_output_section.
3985 (Layout::choose_output_section): Change parameter from adjust_name
3986 to is_input_section. Don't permit input sections after sections
3987 are attached to segments. Don't call allocate_output_section.
3988 (Layout::layout_eh_frame): Call update_flags_for_input_section,
3989 not write_enable_output_section.
3990 (Layout::make_output_section): Don't push to
3991 unattached_section_list_ nor call attach_to_segment. Call
3992 attach_section_to_segment if sections are attached.
3993 (Layout::attach_sections_to_segments): New function.
3994 (Layout::attach_section_to_segment): New function.
3995 (Layout::attach_allocated_section_to_segment): Rename from
3996 attach_to_segment. Remove flags parameter.
3997 (Layout::allocate_output_section): Remove function.
3998 (Layout::write_enable_output_section): Remove function.
3999 * layout.h (class Layout): Update for above changes. Add new
4000 field sections_are_attached_.
4001 * output.h (Output_section::update_flags_for_input_section): New
4002 function.
4003 * output.cc (Output_section::add_input_section): Call
4004 update_flags_for_input_section.
4005 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
4006
009a67a2
CC
40072008-04-11 Cary Coutant <ccoutant@google.com>
4008
4009 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
4010 thought unnecessary.
4011 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
4012
759b1a24
ILT
40132008-04-11 Ian Lance Taylor <iant@google.com>
4014
4015 * output.h (class Output_section_data): Remove inline definition
4016 of set_addralign.
4017 * output.cc (Output_section_data::set_addralign): New function.
4018
c2b45e22
CC
40192008-04-11 Cary Coutant <ccoutant@google.com>
4020
4021 Add support for TLS descriptors for i386 and x86_64.
4022 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
4023 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
4024 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
4025 GOT_TYPE_TLS_DESC.
4026 (Target_i386::got_mod_index_entry): Remove unnecessary code.
4027 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
4028 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
4029 relocations.
4030 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
4031 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
4032 Fix problem with initial-exec relocations.
4033 (Target_i386::Relocate::relocate_tls): Likewise.
4034 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
4035 relaxation.
4036 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
4037 support for section-plus-offset dynamic table entries.
4038 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
4039 (Output_data_dynamic::Dynamic_entry): Add support for
4040 section-plus-offset dynamic table entries.
4041 (Output_data_dynamic::Classification): Likewise.
4042 (Output_data_dynamic::classification_): Renamed offset_.
4043 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
4044 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
4045 (Target_x86_64::make_plt_section): New function.
4046 (Target_x86_64::reserve_tlsdesc_entries): New function.
4047 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
4048 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
4049 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
4050 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
4051 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
4052 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
4053 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
4054 add extra PLT entry for TLS descriptors.
4055 (Output_data_plt_x86_64::got_): New field.
4056 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
4057 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
4058 fields.
4059 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
4060 descriptors.
4061 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
4062 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
4063 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
4064 R_386_TLS_DESC_CALL relocations.
4065 (Target_x86_64::Scan::global): Likewise.
4066 (Target_x86_64::do_finalize_sections): Add dynamic table entries
4067 for TLS descriptors.
4068 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
4069 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
4070 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
4071 GD-to-IE relaxation.
4072 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
4073 and TLS_DESCRIPTORS.
4074 * Makefile.in: Rebuild.
4075 * configure: Rebuild.
4076 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
4077 (tls_test_shared2.so): New target.
4078 (tls_shared_gd_to_ie_test_SOURCES): New variable.
4079 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
4080 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
4081 (tls_shared_gd_to_ie_test_LDADD): New variable.
4082 (tls_shared_gnu2_gd_to_ie_test): New target.
4083 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
4084 New targets.
4085 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
4086 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
4087 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
4088 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
4089 (tls_shared_gnu2_test): New target.
4090 (tls_test_gnu2_shared.so): New target.
4091 (tls_shared_gnu2_test_SOURCES): New variable.
4092 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
4093 (tls_shared_gnu2_test_LDFLAGS): New variable.
4094 (tls_shared_gnu2_test_LDADD): New variable.
4095 * testsuite/Makefile.in: Rebuild.
4096 * testsuite/Makefile.
4097
83bfb6b7
ILT
40982008-04-11 Ian Lance Taylor <iant@google.com>
4099
4100 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
4101 justsyms.t.
4102 * testsuite/Makefile.in: Rebuild.
4103
4104 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
4105 long.
4106 * testsuite/script_test_2.cc (main): Adjust test.
4107
706e1f5e
ILT
41082008-04-11 David S. Miller <davem@davemloft.net>
4109 Ian Lance Taylor <iant@google.com>
4110
4111 * options.h (General_options): Add entries for '-Y' and
4112 '-relax'.
4113 * options.cc (General_options:finalize): If -Y was used, add those
4114 entries to the library path instead of the default "/lib" and
4115 "/usr/lib".
4116
7c98e6bb
DM
41172008-04-11 David S. Miller <davem@davemloft.net>
4118
4119 * testsuite/justsyms.t: Start at 0x100.
4120 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
4121 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
4122 long.
4123 * testsuite/script_test_2.cc: Adjust string and section length
4124 checks.
7c98e6bb 4125
99a37bfd
ILT
41262008-04-09 Ian Lance Taylor <iant@google.com>
4127
2cefc357
ILT
4128 PR gold/5996
4129 * script-sections.cc (Sections_element::allocate_to_segment): Add
4130 orphan parameter.
4131 (Output_section_definition::allocate_to_segment): Likewise.
4132 (Orphan_output_section::allocate_to_segment): Likewise.
4133 (Script_sections::attach_sections_using_phdrs_clause): Don't
4134 propagate non-PT_LOAD segments to orphan sections.
4135 * testsuite/Makefile.am (script_test_3.stdout): Generate using
4136 readelf rather than objdump.
4137 * testsuite/script_test_3.sh: Adjust accordingly. Test that
4138 .interp section and PT_INTERP segment are the same size.
4139 * testsuite/Makefile.in: Rebuild.
4140
99a37bfd
ILT
4141 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
4142 aliases for symbols defined in the same object.
4143 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
4144 (weak_alias_test_SOURCES): New variable.
4145 (weak_alias_test_DEPENDENCIES): New variable.
4146 (weak_alias_test_LDFLAGS): New variable.
4147 (weak_alias_test_LDADD): New variable.
4148 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
4149 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
4150 (weak_alias_test_3.o): New target.
4151 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
4152 * testsuite/weak_alias_test_main.cc: New file.
4153 * testsuite/weak_alias_test_1.cc: New file.
4154 * testsuite/weak_alias_test_2.cc: New file.
4155 * testsuite/weak_alias_test_3.cc: New file.
4156
780e49c5
ILT
41572008-04-08 Ian Lance Taylor <iant@google.com>
4158
cdb0b8f5
ILT
4159 * options.h (class General_options): Add --noinhibit-exec option.
4160 * main.cc (main): Check --noinhibit-exec.
4161
0864d551
ILT
4162 * options.h (class General_options): Define --wrap as a special
4163 option. Add wrap_symbols_ field.
4164 (General_options::any_wrap_symbols): New function.
4165 (General_options::is_wrap_symbol): New function.
4166 * options.cc (General_options::parse_wrap): New function.
4167 (General_options::General_options): Initialize wrap_symbols_.
4168 * symtab.cc (Symbol_table::wrap_symbol): New function.
4169 (Symbol_table::add_from_object): Handle --wrap.
4170 * symtab.h (class Symbol_table): Declare wrap_symbol.
4171 * target.h (Target::wrap_char): New function.
4172 (Target::Target_info): Add wrap_char field.
4173 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
4174 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4175 * testsuite/testfile.cc (Target_test::test_target_info):
4176 Likewise.
4177
789aa6de
ILT
4178 * errors.cc (Errors::undefined_symbol): Mention symbol version if
4179 there is one.
4180
2c38906f
ILT
4181 * layout.h (class Layout): Add added_eh_frame_data_ field.
4182 * layout.cc (Layout::Layout): Initialize new field.
4183 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
4184 output section until we find a section we merged successfully.
4185 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
4186 that the size be non-zero.
4187
780e49c5
ILT
4188 * merge.cc (Object_merge_map::get_output_offset): Remove inline
4189 qualifier.
4190
7fcd0256
ILT
41912008-04-08 Craig Silverstein <csilvers@google.com>
4192
4193 * configure.ac: Export new conditional variable HAVE_ZLIB.
4194 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
4195 on HAVE_ZLIB.
4196 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
4197 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4198
6835af53
ILT
41992008-04-07 Ian Lance Taylor <iant@google.com>
4200
e24f324c
ILT
4201 * version.cc (version_string): Set to "1.5".
4202
a036edd8
ILT
4203 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
4204 Add issued_non_pic_error_ field. Declare check_non_pic.
4205 (Target_x86_64::Scan::check_non_pic): New function.
4206 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
4207 (Target_x86_64::Scan::global): Likewise.
4208
624f8810
ILT
4209 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
4210 addend parameter. Change caller. Handle merge sections.
4211 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
4212 Address to Addend. Don't add in the result of
4213 local_section_offset, pass down the addend and use the returned
4214 value.
4215 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
4216 Update declarations of local_section_offset and symbol_value.
4217 * testsuite/two_file_test_1.cc (t18): New function.
4218 * testsuite/two_file_test_2.cc (f18): New function.
4219 * testsuite/two_file_test_main.cc (main): Call t18.
4220 * testsuite/two_file_test.h (t18, f18): Declare.
4221
6835af53
ILT
4222 * configure.ac: Don't test for objdump, c++filt, or readelf.
4223 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
4224 conditionals.
4225 (TEST_READELF): New variable.
4226 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
4227 (check_PROGRAMS): Add two_file_strip_test.
4228 (two_file_strip_test): New target.
4229 (check_PROGRAMS): Add two_file_same_shared_strip_test.
4230 (two_file_same_shared_strip_test_SOURCES): New variable.
4231 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
4232 (two_file_same_shared_strip_test_LDFLAGS): New variable.
4233 (two_file_same_shared_strip_test_LDADD): New variable.
4234 (two_file_shared_strip.so): New target.
4235 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
4236 (ver_test_5.syms, ver_test_7.syms): Likewise.
4237 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
4238 (strip_test_3.stdout): Use TEST_OBJDUMP.
4239 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4240
86925eef
CC
42412008-04-04 Cary Coutant <ccoutant@google.com>
4242
4243 * symtab.h (Symbol::is_weak_undefined): New function.
4244 (Symbol::is_strong_undefined): New function.
4245 (Symbol::is_absolute): New function.
4246 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
4247 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
4248 absolute symbols.
4249 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
4250 (weak_undef_test): New target.
4251 * testsuite/Makefile.in: Rebuild.
4252 * testsuite/weak_undef_file1.cc: New file.
4253 * testsuite/weak_undef_file2.cc: New file.
4254 * testsuite/weak_undef_test.cc: New file.
4255
126f3ece
ILT
42562008-04-03 Craig Silverstein <csilvers@google.com>
4257
4258 * compressed_output.h (class Output_compressed_section): Use
4259 unsigned buffer.
4260 * compressed_output.cc (zlib_compress): Use unsigned buffers,
4261 add zlib header.
4262 (zlib_compressed_suffix): Removed.
4263 (Output_compressed_section::set_final_data_size): Use unsigned
4264 buffers.
4265 * testsuite/Makefile.am (flagstest_compress_debug_sections):
4266 Fix linker invocation.
4267 (flagstest_o_specialfile_and_compress_debug_sections):
4268 Likewise.
4269 * testsuite/Makefile.in: Regenerated.
4270
deae2a14
DM
42712008-04-02 David S. Miller <davem@davemloft.net>
4272
4273 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
4274 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
4275
70752818
ILT
42762008-04-02 Craig Silverstein <csilvers@google.com>
4277
4278 * TODO: New file.
4279
39d0cb0e
ILT
42802008-04-02 Ian Lance Taylor <iant@google.com>
4281
4282 * fileread.cc (File_read::find_view): Add byteshift and vshifted
4283 parameters. Update for new key type to views_. Change all
4284 callers.
4285 (File_read::read): Adjust for byteshift in returned view.
4286 (File_read::add_view): New function, broken out of
4287 find_and_make_view.
4288 (File_read::make_view): New function, broken out of
4289 find_and_make_view.
4290 (File_read::find_or_make_view): Add offset and aligned
4291 parameters. Rewrite accordingly. Change all callers.
4292 (File_read::get_view): Add offset and aligned parameters. Adjust
4293 for byteshift in return value.
4294 (File_read::get_lasting_view): Likewise.
4295 * fileread.h (class File_read): Update declarations.
4296 (class File_read::View): Add byteshift_ field. Add byteshift to
4297 constructor. Add byteshift method.
4298 * archive.h (Archive::clear_uncached_views): New function.
4299 (Archive::get_view): Add aligned parameter. Change all callers.
4300 * object.h (Object::get_view): Add aligned parameter. Change all
4301 callers.
4302 (Object::get_lasting_view): Likewise.
4303
4304 * fileread.cc (File_read::release): Don't call clear_views if
4305 there are multiple objects.
4306 * fileread.h (File_read::clear_uncached_views): New function.
4307 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
4308 on the archive.
4309
a1207466
CC
43102008-03-31 Cary Coutant <ccoutant@google.com>
4311
4312 Add thin archive support.
4313 * archive.cc (Archive::armagt): New const.
4314 (Archive::setup): Remove task parameter and calls to unlock.
4315 (Archive::unlock_nested_archives): New function.
4316 (Archive::read_header): Add nested_off parameter. Change
4317 all callers.
4318 (Archive::interpret_header): Likewise.
4319 (Archive::include_all_members): Change to handle thin
4320 archives.
4321 (Archive::include_member): Likewise.
4322 * archive.h (Archive::Archive): Add new parameters and
4323 initializers.
4324 (Archive::armagt): New const.
4325 (Archive::setup): Remove task parameter.
4326 (Archive::unlock_nested_archives): New function.
4327 (Archive::read_header): Add nested_off parameter.
4328 (Archive::interpret_header): Likewise.
4329 (Archive::Nested_archive_table): New typedef.
4330 (Archive::is_thin_archive_): New field.
4331 (Archive::nested_archives_): New field.
4332 (Archive::options_): New field.
4333 (Archive::dirpath_): New field.
4334 (Archive::task_): New field.
4335 * readsyms.cc (Read_symbols::do_read_symbols): Add check
4336 for thin archives. Pass additional parameters to
4337 Archive::Archive. Unlock the archive file after calling
4338 Archive::setup.
cd536b21 4339
479f6503
ILT
43402008-03-29 Ian Lance Taylor <iant@google.com>
4341
686c8caf
ILT
4342 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
4343 version symbol to be local.
4344 * testsuite/ver_test_4.sh: New file.
4345 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
4346 (check_DATA): Add ver_test_4.syms.
4347 (ver_test_4.syms): New target.
4348 * testsuite/Makefile.in: Rebuild.
4349
ab794b6b
ILT
4350 * output.cc
4351 (Output_section::Input_section_sort_entry::has_priority): New
4352 function.
4353 (Output_section::Input_section_sort_entry::match_file_name): New
4354 function.
4355 (Output_section::Input_section_sort_entry::match_section_name):
4356 Remove.
4357 (Output_section::Input_section_sort_entry::match_section_name_prefix):
4358 Remove.
4359 (Output_section::Input_section_sort_entry::match_section_file):
4360 Remove.
4361 (Output_section::Input_section_sort_compare::operator()): Rewrite
4362 using new Input_section_sort_entry functions. Sort crtbegin and
4363 crtend first. Sort sections with no priority before sections with
4364 a priority.
4365 * testsuite/initpri1.c (d3): Check j != 4.
4366 (cd5): New constructor/destructor function.
4367 (main): Check j != 2.
4368
479f6503
ILT
4369 * symtab.cc (Symbol_table::add_from_object): If we don't use the
4370 new symbol when resolving, don't call set_is_default.
4371 * testsuite/ver_test_7.cc: New file.
4372 * testsuite/ver_test_7.sh: New file.
4373 * testsuite/Makefile.am (ver_test_7.so): New target.
4374 (ver_test_7.o): New target.
4375 (check_SCRIPTS): Add ver_test_7.sh.
4376 (check_DATA): Add ver_test_7.syms.
4377 (ver_test_7.syms): New target.
4378
2fd32231
ILT
43792008-03-28 Ian Lance Taylor <iant@google.com>
4380
4381 * layout.cc (Layout::layout): If we see an input section with a
4382 name that needs sorting, set the must_sort flag for the output
4383 section.
4384 (Layout::make_output_section): If the name of the output section
4385 indicates that it might require sorting, set the may_sort flag.
4386 * output.h (Output_section::may_sort_attached_input_sections): New
4387 function.
4388 (Output_section::set_may_sort_attached_input_sections): New
4389 function.
4390 (Output_section::must_sort_attached_input_sections): New
4391 function.
4392 (Output_section::set_must_sort_attached_input_sections): New
4393 function.
4394 (class Output_section): Declare Input_section_sort_entry. Define
4395 Input_section_sort_compare. Declare
4396 sort_attached_input_sections. Add new fields:
4397 may_sort_attached_input_sections_,
4398 must_sort_attached_input_sections_,
4399 attached_input_sections_are_sorted_.
4400 * output.cc (Output_section::Output_section): Initialize new
4401 fields.
4402 (Output_section::add_input_section): Add an entry to
4403 input_sections_ if may_sort or must_sort are true.
4404 (Output_section::set_final_data_size): Call
4405 sort_attached_input_sections if necessary.
4406 (Output_section::Input_section_sort_entry): Define new class.
4407 (Output_section::Input_section_sort_compare::operator()): New
4408 function.
4409 (Output_section::sort_attached_input_sections): New function.
4410 * configure.ac: Check whether the compiler supports constructor
4411 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
4412 * testsuite/initpri1.c: New file.
4413 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
4414 CONSTRUCTOR_PRIORITY.
4415 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
4416 (initpri1_LDFLAGS): New variable.
4417 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4418
18e6b24e
ILT
44192008-03-27 Ian Lance Taylor <iant@google.com>
4420
49bdd526
ILT
4421 * common.cc (Sort_commons::operator): Correct sorting algorithm.
4422 * testsuite/common_test_1.c: New file.
4423 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
4424 (common_test_1_SOURCES): New variable.
4425 (common_test_1_DEPENDENCIES): New variable.
4426 (common_test_1_LDFLAGS): New variable.
4427
18e6b24e
ILT
4428 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
4429 and commons_ correctly when NAME/VERSION does not override
4430 NAME/NULL.
4431 * testsuite/ver_test_6.c: New file.
4432 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
4433 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
4434 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
4435
04bf7072
ILT
44362008-03-26 Ian Lance Taylor <iant@google.com>
4437
5871526f
ILT
4438 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
4439 of an undefined symbol from a version script.
4440 * testsuite/Makefile.am (ver_test_5.so): New target.
4441 (ver_test_5.o): New target.
4442 (check_SCRIPTS): Add ver_test_5.sh.
4443 (check_DATA): Add ver_test_5.syms.
4444 (ver_test_5.syms): New target.
4445 * testsuite/ver_test_5.cc: New file.
4446 * testsuite/ver_test_5.script: New file.
4447 * testsuite/ver_test_5.sh: New file.
4448 * Makefile.in, testsuite/Makefile.in: Rebuild.
4449
04bf7072
ILT
4450 PR gold/5986
4451 Fix problems building gold with gcc 4.3.0.
4452 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
4453 (gold_error_at_location, gold_warning_at_location): Use it.
4454 * configure.ac: Check whether we can compile and use a template
4455 function with a printf attribute.
4456 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
4457 when jumping over bytes.
4458 * object.cc: Instantiate Object::read_section_data.
4459 * debug.h: Include <cstring>
4460 * dwarf_reader.cc: Include <algorithm>
4461 * main.cc: Include <cstring>.
4462 * options.cc: Include <cstring>.
4463 * output.cc: Include <cstring>.
4464 * script.cc: Include <cstring>.
4465 * script.h: Include <string>.
4466 * symtab.cc: Include <cstring> and <algorithm>.
4467 * target-select.cc: Include <cstring>.
4468 * version.cc: Include <string>.
4469 * testsuite/testmain.cc: Include <cstdlib>.
4470 * configure, config.in: Rebuild.
4471
874c5b28
ILT
44722008-03-25 Ian Lance Taylor <iant@google.com>
4473
819d6c3a
ILT
4474 * options.cc: Include "../bfd/bfdver.h".
4475 (options::help): Print bug reporting address.
4476
f4b2c6f5
ILT
4477 * version.cc (print_version): Adjust output for current value of
4478 BFD_VERSION_STRING.
4479
4480 * NEWS: New file.
4481
e96caa79
ILT
4482 * options.cc (options::help): Print list of supported targets.
4483 * target-select.h: Include <vector>.
4484 (class Target_selector): Make machine_, size_, and is_big_endian_
4485 fields const. Add bfd_name_ and instantiated_target_ fields.
4486 (Target_selector::Target_selector): Add bfd_name parameter.
4487 (Target_selector::recognize): Make non-virtual, call
4488 do_recognize.
4489 (Target_selector::recognize_by_name): Make non-virtual, call
4490 do_recognize_by_name.
4491 (Target_selector::supported_names): New function.
4492 (Target_selector::bfd_name): New function.
4493 (Target_selector::do_instantiate_target): New pure virtual
4494 function.
4495 (Target_selector::do_recognize): New virtual function.
4496 (Target_selector::do_recognize_by_name): New virtual function.
4497 (Target_selector::instantiate_target): New private function.
4498 (supported_target_names): Declare.
4499 * target-select.cc (Target_selector::Target_selector): Update for
4500 new parameter and fields.
4501 (select_target_by_name): Check that the name matches before
4502 calling recognize_by_name.
4503 (supported_target_names): New function.
4504 * i386.cc (class Target_selector_i386): Update Target_selector
4505 constructor call. Remove recognize and recognize_by_name. Add
4506 do_instantiate_target.
4507 * x86_64.cc (class Target_selector_x86_64): Likewise.
4508 * testsuite/testfile.cc (class Target_selector_test): Update for
4509 changes to Target_selector.
4510
874c5b28
ILT
4511 * README: Rewrite, with some notes on unsupported features.
4512
0a65a3a7
CC
45132008-03-24 Cary Coutant <ccoutant@google.com>
4514
4515 * i386.cc (Target_i386::Got_type): New enum declaration.
4516 (Target_i386::Scan::local): Updated callers of Output_data_got
4517 member functions.
4518 (Target_i386::Scan::global): Likewise.
4519 (Target_i386::Relocate::relocate): Likewise.
4520 (Target_i386::Relocate::relocate_tls): Likewise.
4521 * object.h (Got_offset_list): New class.
4522 (Sized_relobj::local_has_got_offset): Added got_type parameter.
4523 (Sized_relobj::local_got_offset): Likewise.
4524 (Sized_relobj::set_local_got_offset): Likewise.
4525 (Sized_relobj::local_has_tls_got_offset): Removed.
4526 (Sized_relobj::local_tls_got_offset): Removed.
4527 (Sized_relobj::set_local_tls_got_offset): Removed.
4528 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
4529 * output.cc (Output_data_got::add_global): Added got_type parameter.
4530 (Output_data_got::add_global_with_rel): Likewise.
4531 (Output_data_got::add_global_with_rela): Likewise.
4532 (Output_data_got::add_global_pair_with_rel): New function.
4533 (Output_data_got::add_global_pair_with_rela): New function.
4534 (Output_data_got::add_local): Added got_type parameter.
4535 (Output_data_got::add_local_with_rel): Likewise.
4536 (Output_data_got::add_local_with_rela): Likewise.
4537 (Output_data_got::add_local_pair_with_rel): New function.
4538 (Output_data_got::add_local_pair_with_rela): New function.
4539 (Output_data_got::add_global_tls): Removed.
4540 (Output_data_got::add_global_tls_with_rel): Removed.
4541 (Output_data_got::add_global_tls_with_rela): Removed.
4542 (Output_data_got::add_local_tls): Removed.
4543 (Output_data_got::add_local_tls_with_rel): Removed.
4544 (Output_data_got::add_local_tls_with_rela): Removed.
4545 * output.h (Output_data_got::add_global): Added got_type parameter.
4546 (Output_data_got::add_global_with_rel): Likewise.
4547 (Output_data_got::add_global_with_rela): Likewise.
4548 (Output_data_got::add_global_pair_with_rel): New function.
4549 (Output_data_got::add_global_pair_with_rela): New function.
4550 (Output_data_got::add_local): Added got_type parameter.
4551 (Output_data_got::add_local_with_rel): Likewise.
4552 (Output_data_got::add_local_with_rela): Likewise.
4553 (Output_data_got::add_local_pair_with_rel): New function.
4554 (Output_data_got::add_local_pair_with_rela): New function.
4555 (Output_data_got::add_global_tls): Removed.
4556 (Output_data_got::add_global_tls_with_rel): Removed.
4557 (Output_data_got::add_global_tls_with_rela): Removed.
4558 (Output_data_got::add_local_tls): Removed.
4559 (Output_data_got::add_local_tls_with_rel): Removed.
4560 (Output_data_got::add_local_tls_with_rela): Removed.
4561 * resolve.cc (Symbol::override_base_with_special): Removed
4562 reference to has_got_offset_ field.
4563 * symtab.cc (Symbol::init_fields): Replaced initialization
4564 of got_offset_ with got_offsets_. Removed initialization
4565 of has_got_offset_
53fcba31 4566 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
4567 (Symbol::got_offset): Likewise.
4568 (Symbol::set_got_offset): Likewise.
4569 (Symbol::has_tls_got_offset): Removed.
4570 (Symbol::tls_got_offset): Removed.
4571 (Symbol::set_tls_got_offset): Removed.
4572 (Symbol::got_offset_): Removed.
4573 (Symbol::tls_mod_got_offset_): Removed.
4574 (Symbol::tls_pair_got_offset_): Removed.
4575 (Symbol::got_offsets_): New field.
4576 (Symbol::has_got_offset): Removed.
4577 (Symbol::has_tls_mod_got_offset): Removed.
4578 (Symbol::has_tls_pair_got_offset): Removed.
4579 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
4580 (Target_x86_64::Scan::local): Updated callers of Output_data_got
4581 member functions.
4582 (Target_x86_64::Scan::global): Likewise.
4583 (Target_x86_64::Relocate::relocate): Likewise.
4584 (Target_x86_64::Relocate::relocate_tls): Likewise.
4585
bd52eafb
BE
45862008-03-25 Ben Elliston <bje@au.ibm.com>
4587
4588 * yyscript.y: Fix spelling error in comment.
4589
8b105e34
ILT
45902008-03-24 Ian Lance Taylor <iant@google.com>
4591
8ed814a9
ILT
4592 * options.h (class General_options): Define build_id option.
4593 * layout.h (class Layout): Declare write_build_id, create_note,
4594 create_build_id. Add build_id_note_ member.
4595 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
4596 "libiberty.h", "md5.h", "sha1.h".
4597 (Layout::Layout): Initialize eh_frame_data_,
4598 eh_frame_hdr_section_, and build_id_note_.
4599 (Layout::finalize): Call create_build_id.
4600 (Layout::create_note): New function, broken out of
4601 Layout::create_gold_note.
4602 (Layout::create_gold_note): Call create_note.
4603 (Layout::create_build_id): New function.
4604 (Layout::write_build_id): New function.
4605 (Close_task_runner::run): Call write_build_id.
4606
8b105e34
ILT
4607 * x86_64.cc: Correct license to GPLv3.
4608
086a1841
ILT
46092008-03-23 Ian Lance Taylor <iant@google.com>
4610
4611 * options.cc: Include "demangle.h".
4612 (parse_optional_string): New function.
4613 (parse_long_option): Handle takes_optional_argument.
4614 (parse_short_option): Update dash_z initializer. Handle
4615 takes_optional_argument.
4616 (General_options::General_options): Initialize do_demangle_.
4617 (General_options::finalize): Set do_demangle_. Handle demangling
4618 style.
4619 * options.h (parse_optional_string): Declare.
4620 (struct One_option): Add optional_arg field. Update constructor.
4621 Update call constructor calls. Add takes_optional_argument
4622 function.
4623 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
4624 (DEFINE_optional_string): Define.
4625 (General_options::demangle): Change from DEFINE_bool to
4626 DEFINE_optional_string.
4627 (General_options::no_demangle): New function.
4628 (General_options::do_demangle): New function.
4629 (General_options::set_do_demangle): New function.
4630 (General_options::execstack_status_): Move definition to end of
4631 class definition.
4632 (General_options::static_): Likewise.
4633 (General_options::do_demangle_): New field.
4634 * object.cc (big_endian>::get_symbol_location_info): Call
4635 Options::do_demangle, not Options::demangle.
4636 * symtab.cc (demangle): Likewise.
4637
cbb93e63
ILT
46382008-03-22 Ian Lance Taylor <iant@google.com>
4639
4640 * gold.h: Include <cstddef> and <sys/types.h>
4641 * options.h: Include <cstring>.
4642
ec531623
ILT
46432008-03-21 Ian Lance Taylor <iant@google.com>
4644
4645 * Added source code to GNU binutils.
This page took 0.293588 seconds and 4 git commands to generate.