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