2010-11-23 Phil Muldoon <pmuldoon@redhat.com>
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
0ad220c9
DK
12010-11-18 Doug Kwan <dougkwan@google.com>
2
3 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4 and right_alignment to be zero. Store result alignment only if it is
5 greater than existing alignment.
6
ab8056e0
CC
72010-11-16 Cary Coutant <ccoutant@google.com>
8
9 PR gold/12220
10 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11 Check for ".zdebug_line".
12
fd064a5b
CC
132010-11-16 Doug Kwan <dougkwan@google.com>
14 Cary Coutant <ccoutant@google.com>
15
16 * output.h (Output_segment::set_section_addresses): Pass increase_relro
17 by reference; adjust all callers.
18 * output.cc (Output_segment::set_section_addresses): Adjust references
19 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
20 list is empty.
21 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
22 end at page boundary.
23
6fc6ea19
CC
242010-11-16 Cary Coutant <ccoutant@google.com>
25
26 PR gold/12220
27 * layout.cc (Layout::choose_output_section): Transform names of
28 compressed sections even when using a script with a SECTIONS clause.
29 (Layout::output_section_name): Remove code to transform
30 compressed debug section names.
31 * output.cc (Output_section::add_input_section): Use uncompressed
32 section size when tracking input sections.
33
95a2c8d6
RS
342010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
35
36 * symtab.h (Symbol::NON_PIC_REF): Remove.
37 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
38 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
39 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
40 (Symbol::use_plt_offset): Take a flags argument and pass it
41 directly to needs_dynamic_reloc. Restrict check for undefined
42 weak symbols to function calls.
43 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
44 (Target_arm::Scan::global): Use it.
45 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
46 (Target_arm::Relocate::relocate): Likewise.
47 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
48 parameter with an r_type parameter. Use get_reference_flags
49 to get the flags.
50 (Target_arm::Relocate::relocate): Update accordingly.
51 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
52 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
53 (Target_i386::Scan::global): Likewise.
54 (Target_i386::Relocate::relocate): Likewise.
55 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
56 parameter with an r_type parameter. Use get_reference_flags
57 to get the flags.
58 (Target_i386::Relocate::relocate): Update accordingly.
59 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
60 (Target_powerpc::Scan::global): Use it.
61 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
62 (Target_powerpc::Relocate::relocate): Likewise.
63 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
64 (Target_sparc::Scan::global): Use it.
65 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
66 (Target_sparc::Relocate::relocate): Likewise.
67 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
68 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
69 (Target_x86_64::Scan::global): Likewise.
70 (Target_x86_64::Relocate::relocate): Likewise.
71
f625ae50
DK
722010-11-08 Doug Kwan <dougkwan@google.com>
73 Cary Coutant <ccoutant@google.com>
74
75 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
76 (Arm_exidx_merge_section::section_contents_): New data member.
77 (Arm_input_section::Arm_input_section): Initialize original_contents_.
78 (Arm_input_section::~Arm_input_section): De-allocate memory.
79 (Arm_input_section::original_contents_): New data member.
80 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
81 in parameters instead of calling Object::section_contents without
82 locking.
83 (Arm_output_section::group_section): New parameter TASK. Pass it
84 to callees that need locking objects.
85 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
86 to lock EXIDX input sections. Fix a formatting issue. Call
87 Arm_exidx_merged_section::build_contents to create merged section
88 contents.
89 (Arm_output_section::create_stub_group): New parameter TASK. Use it
90 to lock object of stub table owner.
91 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
92 TEXT_SIZE to initialize data member TEXT_SIZE_.
93 (Arm_exidx_input_section::addralign): Fix typo in comment.
94 (Arm_exidx_input_section::text_size): New method.
95 (Target_arm::do_relax): New parameter TASK. Pass it to callees
96 that require locking objects. Lock objects before scanning for stubs
97 and updating local symbols.
98 (Arm_input_section<big_endian>::init): Copy contents of original
99 input section.
100 (Arm_input_section<big_endian>::do_write): Use saved contents of
101 original input section instead of calling Object::section_contents
102 without locking.
103 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
104 size without calling Object::section_size().
105 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
106 for size. Allocate a buffer for merged EXIDX entries.
107 (Arm_exidx_merged_section::build_contents): New method.
108 (Arm_exidx_merged_section::do_write): Move merge section contents
109 building code to Arm_exidx_merged_section::build_contetns. Write
110 out contetns in buffer instead of building it on the fly.
111 (Arm_relobj::make_exidx_input_section): Also pass text section size
112 to Arm_exidx_input_section constructor.
113 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
114 (Arm_dynobj::do_read_symbols): Fix memory leak.
115 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
116 * target.h: (class Task): Add forward declaration.
117 (Target::relax): Add new parameter TASK and pass it to
118 Target::do_relax().
119 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
120
5f9bcf58
CC
1212010-11-05 Cary Coutant <ccoutant@google.com>
122
123 PR gold/10708
124 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
125 object when reading from the file.
126 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
127 second layout pass.
128 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
129 when reading section contents.
130 (get_section_contents): Likewise.
131 (icf::find_identical_sections): Likewise.
132 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
133 object when reading from the file.
134 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
135 the object when doing deferred section layout.
136
e597fa08
NC
1372010-11-03 Nick Clifton <nickc@redhat.com>
138
139 PR gold/12001
140 * script.h (class Symbol_assignment: name): New member. Returns
141 the name of the symbol.
142 * scrfipt.cc (Script_options::is_pending_assignment): New member.
143 Returns true if the given symbol name is on the list of
144 assignments wating to be processed.
145 * archive.cc (should_incldue_member): If the symbol is undefined,
146 check to see if it is on the list of symbols pending assignment.
147
3f9a3278
ILT
1482010-11-03 Ryan Mansfield <rmansfield@qnx.com>
149
150 * script-sections.cc (Script_sections::find_memory_region): Check
151 for a NULL output section pointer.
152
d06fb4d1
DK
1532010-10-29 Doug Kwan <dougkwan@google.com>
154
155 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
156 Output_section::add_relaxed_input_section.
157 * output.cc (Output_section::add_relaxed_input_section): Add new
158 arguments LAYOUT and NAME. Set section order index.
159 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
160 Copy section order index.
161 * output.h (Output_section::add_relaxed_input_section): Add new
162 arguments LAYOUT and NAME.
163
90e24de5
ILT
1642010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
165
166 * testsuite/Makefile.am: Move gcctestdir/ld rule to
167 NATIVE_OR_CROSS_LINKER.
168 * testsuite/Makefile.in: Regenerate.
169
c9484ea5
DK
1702010-10-20 Doug Kwan <dougkwan@google.com>
171
172 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
173 without SHF_LINK_ORDER flags.
174 * layout.cc (Layout::choose_output_section): Do not filter
175 SHF_LINK_ORDER flag in a relocatable link.
176
5bc2f5be
CC
1772010-10-17 Cary Coutant <ccoutant@google.com>
178
179 * output.h (Output_segment::set_section_addresses): Change function
180 signature. Update all callers.
181 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
182 sections.
183 (Output_segment::set_section_addresses): Align after last TLS
184 section. Add padding before last relro section instead of after.
185
0c91cf04
DK
1862010-10-17 Doug Kwan <dougkwan@google.com>
187
188 * gold/arm.cc (Target_arm::got_section): Use correct order and set
189 GOT output section to be writable.
190
8c21d9d3
CC
1912010-10-14 Cary Coutant <ccoutant@google.com>
192
193 * debug.h (DEBUG_INCREMENTAL): New flag.
194 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
195 * gold.cc (queue_initial_tasks): Check parameters for incremental link
196 mode.
197 * incremental.cc (report_command_line): Ignore all forms of
198 --incremental.
199 * layout.cc (Layout::Layout): Check parameters for incremental link
200 mode.
201 * options.cc (General_options::parse_incremental): New function.
202 (General_options::parse_no_incremental): New function.
203 (General_options::parse_incremental_full): New function.
204 (General_options::parse_incremental_update): New function.
205 (General_options::incremental_mode_): New data member.
206 (General_options::finalize): Check incremental_mode_.
207 * options.h (General_options): Update help text for --incremental.
208 Add --no-incremental, --incremental-full, --incremental-update.
209 (General_options::Incremental_mode): New enum type.
210 (General_options::incremental_mode): New function.
211 (General_options::incremental_mode_): New data member.
212 * parameters.cc (Parameters::incremental_mode_): New data member.
213 (Parameters::set_options): Set incremental_mode_.
214 (Parameters::set_incremental_full): New function.
215 (Parameters::incremental): New function.
216 (Parameters::incremental_update): New function.
217 (set_parameters_incremental_full): New function.
218 * parameters.h (Parameters::set_incremental_full): New function.
219 (Parameters::incremental): New function.
220 (Parameters::incremental_update): New function.
221 (Parameters::incremental_mode_): New data member.
222 (set_parameters_incremental_full): New function.
223 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
224 incremental link mode.
225 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
226 (Sized_relobj::do_relocate_sections): Likewise.
227 * testsuite/Makefile.am (incremental_test): Use --incremental-full
228 option.
229 * testsuite/Makefile.in: Regenerate.
230 * testsuite/incremental_test.sh: Filter all forms of --incremental.
231
bb32aa18 2322010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
233
234 * script-sections.h (class Script_sections): Make
235 Sections_elements typedef public.
236 * script-sections.cc (class Sort_output_sections): Add elements_
237 field. Add constructor which sets it; change all callers.
238 (Sort_output_sections::is_before): New function.
239 (Sort_output_sections::operator()): Call is_before.
240 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
241 conditional.
242 * testsuite/script_test_10.sh: New test. Test script section
243 order.
244 * testsuite/script_test_10.t: Likewise.
245 * testsuite/script_test_10.s: Likewise.
246 * testsuite/Makefile.am: Wrap the cross linker tests and the
247 common tests into NATIVE_OR_CROSS_LINKER.
248 (check_SCRIPTS): Add script_test_10.sh.
249 (check_DATA): Add script_test_10.stdout.
250 (script_test_10.o, script_test_10): New targets.
251 (script_test_10.stdout): New target.
252 * configure, testsuite/Makefile.in: Regenerate.
253
3cef7179
ILT
2542010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
255
256 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
257 error for the deprecated relocations.
258 (Target_arm::Scan::global): Likewise.
259 (Target_arm::Relocate::relocate): Likewise.
260
7411e9a8
RS
2612010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
262
263 * fileread.cc (Input_file::find_file): Initialize *found_name
264 and *namep when using the fallback search for case 4.
265
6a9da32a
CC
2662010-10-11 Cary Coutant <ccoutant@google.com>
267
268 * options.h (class General_options): Redefine -z lazy as an alias for
269 the negation of -z now.
270
ac897c20
ILT
2712010-10-11 Ian Lance Taylor <iant@google.com>
272
273 * resolve.cc (symbol_to_bits): Report the value of the unsupported
274 binding.
275
ea5cae92
NC
2762010-10-06 Nick Clifton <nickc@redhat.com>
277
278 * script-sections.cc(class Memory_region): Remove
279 current_lma_offset_ field. Rename current_vma_offset_ to
280 current_offset_. Add last_section_ field.
281 (Memory_region::get_current_vma_address): Rename to
282 get_current_address.
283 (Memory_region::get_current_lma_address): Delete.
284 (Memory_region::increment_vma_offset): Rename to
285 increment_offset.
286 (Memory_region::increment_lma_offset): Delete.
287 (Memory_region::attributes_compatible): New method. Returns
288 true if the provided section is compatible with the region.
289 (Memory_region::get_last_section): New method. Returns the last
290 section to use the region.
291 (Memory_region::set_last_section): New method. Stores the last
292 section to use the region.
293 (Script_sections::block_in_region): New method. Returns true if
294 a block of memory is contained within a region.
295 (Script_sections::find_memory_region): New method. Locates a
296 memory region to be used to set a VMA or LMA address.
297 (Output_section_definition::set_section_addresses): Add code to
298 check for addresses set by memory regions.
299 (Output_segment::set_section_addresses): Remove memory region
300 walking code.
301 (Script_sections::create_segment): Add a warning if a header
302 segment is created outside of any region.
303 * script-sections.h (class Script_sections): Add prototypes for
304 find_memory_region and block_in_region methods.
305 * testsuite/memory_test.s: Use .long instead of .word.
306 * testsuite/memory_test.t: Add some more output sections.
307 * testsuite/memory_test.sh: Update expected output.
308
a9bfd952
DK
3092010-10-02 Doug Kwan <dougkwan@google.com>
310
311 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
312 defintion to symtab.h
313 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
314 declaration to defintion.
315
bacff3ab
NC
3162010-10-01 Nick Clifton <nickc@redhat.com>
317
318 * expression.cc (eval): Replace dummy argument with NULL.
319 (eval_maybe_dot): Check for a NULL result section pointer.
320 (Symbol_expression::value): Likewise.
321 (Dot_expression::value): Likewise.
322 (BINARY_EXPRESSION): Likewise.
323 (Max_expression::value): Likewise.
324 (Min_expression::value): Likewise.
325 (Absolute_expression::value): Likewise.
326 (Addr_expression::value_from_output_section): Likewise.
327 (Loaddddr_expression::value_from_output_section): Likewise.
328 (Segment_start_expression::value): Likewise.
329 * script-sections.cc
330 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
331 argument with NULL.
332 (Sections_elememt_dot_assignment::set_section_addresses):
333 Likewise.
334 (Output_data_expression::do_write_to_buffer): Likewise.
335 (Output_section_definition::finalize_symbols): Likewise.
336 (Output_section_definition::set_section_addresses): Likewise.
337
f81bc8b5
DK
3382010-09-30 Doug Kwan <dougkwan@google.com>
339
340 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
341
c95e9f27
ST
3422010-09-28 Sriraman Tallam <tmsriram@google.com>
343
344 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 345 function.
c95e9f27
ST
346 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
347 virtual function.
348 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
349 virtual function.
350 * icf.cc (get_section_contents): Inline merge sections only when
351 target allows it.
352
3cac54d2
RW
3532010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
354
355 * configure: Regenerate.
356
2904037a
ILT
3572010-09-17 Ian Lance Taylor <iant@google.com>
358
359 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
360 * testsuite/Makefile.am (memory_test.o): New target.
361 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
362 memory_test.t.
363 * testsuite/Makefile.in: Rebuild.
2904037a 364
bca7fb63
DK
3652010-09-17 Doug Kwan <dougkwan@google.com>
366
367 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
368 defintion if relocation uses GOT entries of the symbol.
369 * testsuite/icf_safe_test.sh: Fix test.
370 * testsuite/icf_safe_so_test.sh: Fix test.
371
4ef28648
CC
3722010-09-16 Cary Coutant <ccoutant@google.com>
373
374 * script_sections.cc (class Memory_region): Remove "NULL" from
375 vector initializations.
376
793990de
CC
3772010-09-15 Cary Coutant <ccoutant@google.com>
378
379 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
380 Resolve forwarding symbols.
381
81e015e2
DK
3822010-09-15 Doug Kwan <dougkwan@google.com>
383
384 * gold/testsuite/script_test_3.t: Add ARM special sections.
385 * gold/testsuite/script_test_4.t: Same.
386 * gold/testsuite/script_test_5.t: Same.
387 * gold/testsuite/script_test_6.t: Same.
388 * gold/testsuite/script_test_7.t: Same.
389 * gold/testsuite/script_test_7.t: Same.
390 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
391
36171d64
CC
3922010-09-14 Cary Coutant <ccoutant@google.com>
393
394 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
395 (Target_x86_64::Relocate::relocate_tls): Replace check for
396 saw_tls_block_reloc_ with test for executable section.
397
d89051bd
CC
3982010-09-12 Cary Coutant <ccoutant@google.com>
399
400 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
401 position-independent executables to shared libraries need dynamic
402 relocations.
403 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
404 position-independent executables.
405 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
406 * testsuite/Makefile.in: Regenerate.
407
fca41f0f
NC
4082010-09-10 Nick Clifton <nickc@redhat.com>
409
410 PR gold/11997
411 * testsuite/memory_test.t: Discard any sections that are not
412 needed.
413
6695e4b3
L
4142010-09-09 H.J. Lu <hongjiu.lu@intel.com>
415
416 PR gold/11996
417 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
418 "This::" to work around a bug in gcc 4.2.
419
420 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
421
0f72bf6f
RÁE
4222010-09-09 Rafael Espindola <espindola@google.com>
423
424 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
425 sections with different PF_X flags in the same segment.
426 (Layout::find_first_load_seg): Search all segments to find the first
427 one.
428 * options.h (rosegment): New.
429
4302010-09-08 Rafael Espindola <espindola@google.com>
a6577478 431
05a79166 432 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 433
aa98ff75
DK
4342010-09-08 Doug Kwan <dougkwan@google.com>
435
436 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
437 (Arm_relobj::do_relocate_sections): Add new parameter for output
438 file to match the parent.
439 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
440 of local symbols instead of input values. Update code to track
441 changes in gold::relocate_section.
442 * object.cc (Sized_relobj::compute_final_local_value): New methods.
443 (Sized_relobj::compute_final_local_value_internal): New methods.
444 (Sized_relobj::do_finalize_local_symbols): Move code from loop
445 body into private version of Sized_relobj::compute_final_local_value.
446 Call the inline method.
447 * object.h (Symbol_value::Symbol_value): Define destructor. Free
448 merged symbol value if there is one.
449 (Symbol_value::has_output_value): New method defintiion.
450 (Sized_relobj::Compute_final_local_value_status): New enum type.
451 (Sized_relobj::compute_final_local_value): New methods.
452 (Sized_relobj::compute_final_local_value_internal): New methods.
453 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
454 and arm_cortex_a8.sh.
455 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
456 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
457 New tests.
458 * Makefile.in: Regenerate.
459 * testsuite/arm_bl_out_of_range.s: Update test.
460 * testsuite/thumb_bl_out_of_range.s: Ditto.
461 * testsuite/thumb_blx_out_of_range.s: Ditto.
462 * testsuite/arm_branch_out_of_range.sh: New file.
463 * testsuite/arm_cortex_a8.sh: Ditto.
464 * testsuite/arm_cortex_a8_b.s: Ditto.
465 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
466 * testsuite/arm_cortex_a8_b_local.s: Ditto.
467 * testsuite/arm_cortex_a8_bl.s: Ditto.
468 * testsuite/arm_cortex_a8_blx.s: Ditto.
469 * testsuite/arm_cortex_a8_local.s: Ditto.
470 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
471 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
472
05a79166
L
4732010-09-08 Rafael Espindola <espindola@google.com>
474
475 * Makefile.am (memory_test.stdout): Run readelf with -W.
476 * Makefile.in: Regenerate.
477 * testsuite/memory_test.sh: Make the regexps accept both 32 and
478 64 bit output.
479
33dbc701
RÁE
4802010-09-08 Rafael Espindola <espindola@google.com>
481
482 * script-sections.cc (Script_sections::add_memory_region): Convert
483 field precision to int.
484 * script.cc (script_set_section_region, script_set_section_region):
485 Convert field precision to int.
486
731ca54a
RÁE
4872010-09-08 Rafael Espindola <espindola@google.com>
488
489 * arm.cc (do_finalize_sections): Create the __exidx_start and
490 __exdix_end symbols even when the section is missing.
491
7f8cd844
NC
4922010-09-08 Nick Clifton <nickc@redhat.com>
493
494 * README: Remove claim that MEMORY is not supported.
495 * expression.cc (script_exp_function_origin)
496 (script_exp_function_length): Move from here to ...
497 * script.cc: ... here.
498 (script_set_section_region, script_add_memory)
499 (script_parse_memory_attr, script_include_directive): New
500 functions.
501 * script-sections.cc
502 (class Memory_region): New class.
503 (class Output_section_definition): Add set_memory_region,
504 set_section_vma, set_section_lma and get_section_name methods.
505 (class Script_Sections): Add add_memory_region,
506 find_memory_region, find_memory_region_origin,
507 find_memory_region_length and set_memory_region methods.
508 Have set_section_addresses method walk the list of set memory
509 regions.
510 Extend the print methos to display memory regions.
511 * script-sections.h: Add prototypes for new methods.
512 Add enum for MEMORY region attributes.
513 * yyscript.y: Add support for parsing MEMORY regions.
514 * script-c.h: Add prototypes for new functions.
515 * testsuite/Makefile.am: Add test of MEMORY region functionality.
516 * testsuite/Makefile.in: Regenerate.
517 * testsuite/memory_test.sh: New script.
518 * testsuite/memory_test.s: New assembler source file.
519 * testsuite/memory_test.t: New linker script.
520
a4649286
DK
5212010-08-27 Doug Kwan <dougkwan@google.com>
522
523 * gold/resolve.cc (Symbol_table::should_override): Let a weak
524 reference override an existing dynamic weak reference.
525 * testsuite/Makefile.am: Add new test dyn_weak_ref.
526 * testsuite/Makefile.in: Regenerate.
527 * testsuite/dyn_weak_ref.sh: New file.
528 * testsuite/dyn_weak_ref_1.c: Ditto.
529 * testsuite/dyn_weak_ref_2.c: Ditto.
530
b56648ad
ILT
5312010-08-27 Ian Lance Taylor <iant@google.com>
532
533 * incremental.h (class Incremental_input_entry): Add virtual
534 destructor.
535
809313cb
ILT
5362010-08-27 Ian Lance Taylor <iant@google.com>
537
538 * testsuite/start_lib_test_3.c: Mark t3 as used.
539
11e32464
NC
5402010-08-27 Nick Clifton <nickc@redhat.com>
541
542 * options.cc (version_script): Fix small typo in previous
543 whitespace tidyup.
544
ca09d69a
NC
5452010-08-25 Nick Clifton <nickc@redhat.com>
546
547 * archive.cc: Formatting fixes: Remove whitespace between
548 typename and following asterisk. Remove whitespace between
549 function name and opening parenthesis.
550 * archive.h: Likewise.
551 * arm.cc: Likewise.
552 * attributes.cc: Likewise.
553 * attributes.h: Likewise.
554 * common.cc: Likewise.
555 * copy-relocs.cc: Likewise.
556 * dirsearch.h: Likewise.
557 * dynobj.cc: Likewise.
558 * ehframe.cc: Likewise.
559 * ehframe.h: Likewise.
560 * expression.cc: Likewise.
561 * fileread.cc: Likewise.
562 * fileread.h: Likewise.
563 * gc.h: Likewise.
564 * gold-threads.cc: Likewise.
565 * gold.cc: Likewise.
566 * i386.cc: Likewise.
567 * icf.h: Likewise.
568 * incremental-dump.cc: Likewise.
569 * incremental.cc: Likewise.
570 * layout.cc: Likewise.
571 * layout.h: Likewise.
572 * main.cc: Likewise.
573 * merge.cc: Likewise.
574 * merge.h: Likewise.
575 * object.cc: Likewise.
576 * object.h: Likewise.
577 * options.cc: Likewise.
578 * options.h: Likewise.
579 * output.cc: Likewise.
580 * output.h: Likewise.
581 * plugin.cc: Likewise.
582 * plugin.h: Likewise.
583 * powerpc.cc: Likewise.
584 * reloc.cc: Likewise.
585 * script-c.h: Likewise.
586 * script-sections.cc: Likewise.
587 * script.cc: Likewise.
588 * stringpool.cc: Likewise.
589 * symtab.cc: Likewise.
590 * symtab.h: Likewise.
591 * target.cc: Likewise.
592 * timer.cc: Likewise.
593 * timer.h: Likewise.
594 * version.cc: Likewise.
595 * x86_64.cc: Likewise.
596
b8fa8750
NC
5972010-08-24 Nick Clifton <nickc@redhat.com>
598
599 PR 11899
600 * layout.cc (segment_precedes): Sort segments by their physical
601 addresses, if they have been set.
602
9919d93b
CC
6032010-08-23 Cary Coutant <ccoutant@google.com>
604
605 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
606 symbols data.
607 (Lib_group::include_member): Unlock object after deleting its
608 symbols data.
609 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
610 the bug fixed here.
611
97b4be1c
CC
6122010-08-19 Neil Vachharajani <nvachhar@google.com>
613 Cary Coutant <ccoutant@google.com>
614
615 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
616 constructor, and set_blocker.
617 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
618 readsyms_blocker_.
619 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
620 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
621 * testsuite/Makefile.am (start_lib_test): New test case.
622 * testsuite/Makefile.in: Regenerate.
623 * testsuite/start_lib_test_main.c: New file.
624 * testsuite/start_lib_test_1.c: New file.
625 * testsuite/start_lib_test_2.c: New file.
626 * testsuite/start_lib_test_3.c: New file.
627
dd0b1884
ILT
6282010-08-19 Ian Lance Taylor <iant@google.com>
629
630 * Makefile.in: Rebuild with automake 1.11.1.
631 * aclocal.m4: Likewise.
632 * testsuite/Makefile.in: Likewise.
633
7223e9ca
ILT
6342010-08-19 Ian Lance Taylor <iant@google.com>
635
636 PR 10893
637 * i386.cc (class Output_data_plt_i386): Update declarations.
638 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
639 local_ifuncs_ fields.
640 (Target_i386::do_plt_section_for_global): New function.
641 (Target_i386::do_plt_section_for_local): New function.
642 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
643 parameter; change all callers. Initialize global_ifuncs_ and
644 local_ifuncs_. If doing a static link define __rel_iplt_start and
645 __rel_iplt_end.
646 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
647 (Output_data_plt_i386::add_local_ifunc_entry): New function.
648 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
649 symbols.
650 (Target_i386::make_plt_section): New function, broken out of
651 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
652 (Target_i386::make_plt_entry): Call make_plt_section.
653 (Target_i386::make_local_ifunc_plt_entry): New function.
654 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
655 (Target_i386::Scan::local): Handle IFUNC symbols. Add
656 R_386_IRELATIVE to switch.
657 (Target_i386::Scan::global): Likewise.
658 (Target_i386::Relocate::relocate): Likewise.
659 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
660 switch.
661 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
662 (Target_x86_64::do_plt_section_for_global): New function.
663 (Target_x86_64::do_plt_section_for_local): New function.
664 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
665 parameter; change all callers. If doing a static link define
666 __rela_iplt_start and __rela_iplt_end.
667 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
668 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
669 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
670 to point to .plt.
671 (Target_x86_64::make_local_ifunc_plt_entry): New function.
672 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
673 switch.
674 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
675 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
676 R_X86_64_IRELATIVE to switch.
677 (Target_x86_64::Scan::global): Likewise.
678 (Target_x86_64::Relocate::relocate): Likewise.
679 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
680 switch.
681 * target.h (class Target): Add plt_section_for_global and
682 plt_section_for_local functions. Add do_plt_section_for_global
683 and do_plt_section_for_local virtual functions.
684 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
685 clarifying comments.
686 (Symbol::use_plt_offset): Handle IFUNC symbol.
687 * object.cc (Sized_relobj::Sized_relobj): Initialize
688 local_plt_offsets_.
689 (Sized_relobj::local_has_plt_offset): New function.
690 (Sized_relobj::local_plt_offset): New function.
691 (Sized_relobj::set_local_plt_offset): New function.
692 (Sized_relobj::do_count): Handle IFUNC symbol.
693 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
694 a bit away from input_shndx_ field. Add set_is_func_symbol and
695 is_ifunc_symbol functions.
696 (class Sized_relobj): Update declarations. Remove Tls_got_entry
697 and Local_tls_got_offsets. Define Local_plt_offsets. Add
698 local_plt_offsets_ field.
699 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
700 * output.h (class Output_section_data): Add non-const
701 output_section function.
702 (class Output_data_got): Update declarations.
703 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
704 Add use_plt_offset parameter to global and local constructors.
705 Change all callers. Change local_sym_index_ field to 31 bits.
706 Change GSYM_CODE and CONSTANT_CODE accordingly.
707 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
708 doing a static link don't set sh_link field.
709 (Output_data_got::Got_entry::write): Use PLT offset if
710 appropriate.
711 (Output_data_got::add_global_plt): New function.
712 (Output_data_got::add_local_plt): New function.
713 * target-reloc.h (relocate_section): Handle IFUNC symbol.
714 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
715 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
716 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
717 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
718 IFUNC conditional.
719 * testsuite/ifunc-sel.h: New file.
720 * testsuite/ifuncmain1.c: New file.
721 * testsuite/ifuncmain1vis.c: New file.
722 * testsuite/ifuncmod1.c: New file.
723 * testsuite/ifuncdep2.c: New file.
724 * testsuite/ifuncmain2.c: New file.
725 * testsuite/ifuncmain3.c: New file.
726 * testsuite/ifuncmod3.c: New file.
727 * testsuite/ifuncmain4.c: New file.
728 * testsuite/ifuncmain5.c: New file.
729 * testsuite/ifuncmod5.c: New file.
730 * testsuite/ifuncmain6pie.c: New file.
731 * testsuite/ifuncmod6.c: New file.
732 * testsuite/ifuncmain7.c: New file.
733 * configure, testsuite/Makefile.in: Rebuild.
734
56f75c03
ILT
7352010-08-18 Ian Lance Taylor <iant@google.com>
736
737 * incremental.cc
738 (Output_section_incremental_inputs::write_input_files): Add cast
739 to avoid signed/unsigned comparison warning.
740 (Output_section_incremental_inputs::write_info_blocks): Likewise.
741
55455f89
CC
7422010-08-12 Cary Coutant <ccoutant@google.com>
743
744 * common.cc (Sort_commons::operator()): Remove unnecessary code.
745
e2054bcb
ILT
7462010-08-13 Ian Lance Taylor <iant@google.com>
747
748 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
749
74f67560
DK
7502010-08-12 Cary Coutant <ccoutant@google.com>
751 Doug Kwan <dougkwan@google.com>
752
753 * resolve.cc (Symbol_table::should_override): When a weak dynamic
754 defintion overrides non-weak undef, remember that the original undef
755 is not weak.
756 * symtab.cc (Symbol_table::sized_write_global): For undef without
757 an original weak binding, set binding to global in output.
758 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
759 * testsuite/Makefile.in: Regenerate.
760 * testsuite/strong_ref_weak_def.sh: New file.
761 * testsuite/strong_ref_weak_def_1.c: Ditto.
762 * testsuite/strong_ref_weak_def_2.c: Ditto.
763
d1238d12
CC
7642010-08-12 Cary Coutant <ccoutant@google.com>
765
766 * testsuite/incremental_test.sh: Rewrite.
767 * testsuite/incremental_test_1.c: Rewrite.
768 * testsuite/incremental_test_2.c: Rewrite.
769
0e70b911
CC
7702010-08-12 Cary Coutant <ccoutant@google.com>
771
772 * arm.cc (Target_arm::got_size): Add const.
773 (Target_arm::got_entry_count): New function.
774 (Target_arm::plt_entry_count): New function.
775 (Target_arm::first_plt_entry_offset): New function.
776 (Target_arm::plt_entry_size): New function.
777 (Output_data_plt_arm::entry_count): New function.
778 (Output_data_plt_arm::first_plt_entry_offset): New function.
779 (Output_data_plt_arm::get_plt_entry_size): New function.
780 * i386.cc (Target_i386::got_size): Add const.
781 (Target_i386::got_entry_count): New function.
782 (Target_i386::plt_entry_count): New function.
783 (Target_i386::first_plt_entry_offset): New function.
784 (Target_i386::plt_entry_size): New function.
785 (Output_data_plt_i386::entry_count): New function.
786 (Output_data_plt_i386::first_plt_entry_offset): New function.
787 (Output_data_plt_i386::get_plt_entry_size): New function.
788 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
789 find_incremental_inputs_sections. Dump incremental_got_plt section.
790 * incremental.cc: Include target.h.
791 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
792 parameter. Adjust all callers. Find incremental_got_plt section.
793 (Incremental_inputs::create_data_sections): Create incremental_got_plt
794 section.
795 (Output_section_incremental_inputs::set_final_data_size): Calculate
796 size of incremental_got_plt section.
797 (Output_section_incremental_inputs::do_write): Write the
798 incremental_got_plt section.
799 (Got_plt_view_info): New struct.
800 (Local_got_offset_visitor): New class.
801 (Global_got_offset_visitor): New class.
802 (Global_symbol_visitor_got_plt): New class.
803 (Output_section_incremental_inputs::write_got_plt): New function.
804 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
805 Add parameter. Adjust all callers.
806 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
807 (Incremental_inputs::got_plt_section): New function.
808 (Incremental_inputs::got_plt_section_): New data member.
809 (Incremental_got_plt_reader): New class.
810 * layout.cc (Layout::create_incremental_info_sections): Add the
811 incremental_got_plt section.
812 * object.h (Got_offset_list::get_list): New function.
813 (Got offset_list::for_all_got_offsets): New function.
814 (Sized_relobj::local_got_offset_list): New function.
815 * powerpc.cc (Target_powerpc::got_size): Add const.
816 (Target_powerpc::got_entry_count): New function.
817 (Target_powerpc::plt_entry_count): New function.
818 (Target_powerpc::first_plt_entry_offset): New function.
819 (Target_powerpc::plt_entry_size): New function.
820 (Output_data_plt_powerpc::entry_count): New function.
821 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
822 (Output_data_plt_powerpc::get_plt_entry_size): New function.
823 * sparc.cc (Target_sparc::got_size): Add const.
824 (Target_sparc::got_entry_count): New function.
825 (Target_sparc::plt_entry_count): New function.
826 (Target_sparc::first_plt_entry_offset): New function.
827 (Target_sparc::plt_entry_size): New function.
828 (Output_data_plt_sparc::entry_count): New function.
829 (Output_data_plt_sparc::first_plt_entry_offset): New function.
830 (Output_data_plt_sparc::get_plt_entry_size): New function.
831 * symtab.h (Symbol::got_offset_list): New function.
832 (Symbol_table::for_all_symbols): New function.
833 * target.h (Sized_target::got_entry_count): New function.
834 (Sized_target::plt_entry_count): New function.
835 (Sized_target::plt_entry_size): New function.
836 * x86_64.cc (Target_x86_64::got_size): Add const.
837 (Target_x86_64::got_entry_count): New function.
838 (Target_x86_64::plt_entry_count): New function.
839 (Target_x86_64::first_plt_entry_offset): New function.
840 (Target_x86_64::plt_entry_size): New function.
841 (Output_data_plt_x86_64::entry_count): New function.
842 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
843 (Output_data_plt_x86_64::get_plt_entry_size): New function.
844
09ec0418
CC
8452010-08-12 Cary Coutant <ccoutant@google.com>
846
847 * archive.cc: Include incremental.h.
848 (Archive::Archive): Initialize incremental_info_.
849 (Archive::include_member): Record archive members in incremental info.
850 (Add_archive_symbols::run): Record begin and end of an archive in
851 incremental info.
852 (Lib_group::include_member): Record objects in incremental info.
853 * archive.h (Incremental_archive_entry): Forward declaration.
854 (Archive::set_incremental_info): New member function.
855 (Archive::incremental_info): New member function.
856 (Archive::Unused_symbol_iterator): New class.
857 (Archive::unused_symbols_begin): New member function.
858 (Archive::unused_symbols_end): New member function.
859 (Archive::incremental_info_): New data member.
860 * incremental-dump.cc (find_input_containing_global): New function.
861 (dump_incremental_inputs): Dump new incremental info sections.
862 * incremental.cc: Include symtab.h.
863 (Output_section_incremental_inputs): New class.
864 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
865 new incremental info sections.
866 (Sized_incremental_binary::do_check_inputs): Likewise.
867 (Incremental_inputs::report_archive): Remove.
868 (Incremental_inputs::report_archive_begin): New function.
869 (Incremental_inputs::report_archive_end): New function.
870 (Incremental_inputs::report_object): New function.
871 (Incremental_inputs::finalize_inputs): Remove.
872 (Incremental_inputs::report_input_section): New function.
873 (Incremental_inputs::report_script): Rewrite.
874 (Incremental_inputs::finalize): Do nothing but finalize string table.
875 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
876 (Incremental_inputs::sized_create_inputs_section_data): Remove.
877 (Incremental_inputs::create_data_sections): New function.
878 (Incremental_inputs::relocs_entsize): New function.
879 (Output_section_incremental_inputs::set_final_data_size): New function.
880 (Output_section_incremental_inputs::do_write): New function.
881 (Output_section_incremental_inputs::write_header): New function.
882 (Output_section_incremental_inputs::write_input_files): New function.
883 (Output_section_incremental_inputs::write_info_blocks): New function.
884 (Output_section_incremental_inputs::write_symtab): New function.
885 * incremental.h (Incremental_script_entry): Forward declaration.
886 (Incremental_object_entry): Forward declaration.
887 (Incremental_archive_entry): Forward declaration.
888 (Incremental_inputs): Forward declaration.
889 (Incremental_inputs_header_data): Remove.
890 (Incremental_inputs_header): Remove.
891 (Incremental_inputs_header_write): Remove.
892 (Incremental_inputs_entry_data): Remove.
893 (Incremental_inputs_entry): Remove.
894 (Incremental_inputs_entry_write): Remove.
895 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
896 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
897 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
898 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
899 Likewise.
900 (Incremental_input_entry): New class.
901 (Incremental_script_entry): New class.
902 (Incremental_object_entry): New class.
903 (Incremental_archive_entry): New class.
904 (Incremental_inputs::Incremental_inputs): Initialize new data members.
905 (Incremental_inputs::report_inputs): Remove.
906 (Incremental_inputs::report_archive): Remove.
907 (Incremental_inputs::report_archive_begin): New function.
908 (Incremental_inputs::report_archive_end): New function.
909 (Incremental_inputs::report_object): Change prototype.
910 (Incremental_inputs::report_input_section): New function.
911 (Incremental_inputs::report_script): Change prototype.
912 (Incremental_inputs::get_reloc_count): New function.
913 (Incremental_inputs::set_reloc_count): New function.
914 (Incremental_inputs::create_data_sections): New function.
915 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
916 (Incremental_inputs::inputs_section): New function.
917 (Incremental_inputs::symtab_section): New function.
918 (Incremental_inputs::relocs_section): New function.
919 (Incremental_inputs::get_stringpool): Add const.
920 (Incremental_inputs::command_line): Add const.
921 (Incremental_inputs::inputs): Remove.
922 (Incremental_inputs::command_line_key): New function.
923 (Incremental_inputs::input_file_count): New function.
924 (Incremental_inputs::input_files): New function.
925 (Incremental_inputs::relocs_entsize): New function.
926 (Incremental_inputs::sized_create_inputs_section_data): Remove.
927 (Incremental_inputs::finalize_inputs): Remove.
928 (Incremental_inputs::Input_info): Remove.
929 (Incremental_inputs::lock_): Remove.
930 (Incremental_inputs::inputs_): Change type.
931 (Incremental_inputs::inputs_map_): Remove.
932 (Incremental_inputs::current_object_entry_): New data member.
933 (Incremental_inputs::inputs_section_): New data member.
934 (Incremental_inputs::symtab_section_): New data member.
935 (Incremental_inputs::relocs_section_): New data member.
936 (Incremental_inputs::reloc_count_): New data member.
937 (Incremental_inputs_reader): New class.
938 (Incremental_symtab_reader): New class.
939 (Incremental_relocs_reader): New class.
940 * layout.cc (Layout::finalize): Move finalization of incremental info
941 and creation of incremental info sections to follow finalization of
942 symbol table. Set offsets for postprocessing sections.
943 (Layout::create_incremental_info_sections): Call
944 Incremental_inputs::create_data_sections. Add incremental symtab
945 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
946 sections to layout after input sections.
947 * layout.h (struct Timespec): Forward declaration.
948 (Layout::incremental_inputs): Add const.
949 (Layout::create_incremental_info_sections): Add parameter.
950 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
951 * object.cc: Include incremental.h.
952 (Relobj::finalize_incremental_relocs): New function.
953 (Sized_relobj::do_layout): Record input sections in incremental info.
954 * object.h (Object::output_section): New function.
955 (Object::output_section_offset): Moved from Relobj.
956 (Object::get_incremental_reloc_base): New function.
957 (Object::get_incremental_reloc_count): New function.
958 (Object::do_output_section): New function.
959 (Object::do_output_section_offset): Moved from Relobj.
960 (Object::do_get_incremental_reloc_base): New function.
961 (Object::do_get_incremental_reloc_count): New function.
962 (Object::Object): Initialize new data members.
963 (Relobj::output_section): Renamed do_output_section and moved to
964 protected.
965 (Relobj::output_section_offset): Moved to Object.
966 (Relobj::do_get_incremental_reloc_base): New function.
967 (Relobj::do_get_incremental_reloc_count): New function.
968 (Relobj::allocate_incremental_reloc_counts): New function.
969 (Relobj::count_incremental_reloc): New function.
970 (Relobj::finalize_incremental_relocs): New function.
971 (Relobj::next_incremental_reloc_index): New function.
972 (Relobj::reloc_counts_): New data member.
973 (Relobj::reloc_bases_): New data member.
974 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
975 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
976 (Sized_relobj::incremental_relocs_scan): New function.
977 (Sized_relobj::incremental_relocs_scan_reltype): New function.
978 (Sized_relobj::incremental_relocs_write): New function.
979 (Sized_relobj::incremental_relocs_write_reltype): New function.
980 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
981 incremental link.
982 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
983 archives and object files elsewhere.
984 (Add_symbols::run): Report object files here.
985 (Finish_group::run): Report end of archive at end of group.
986 * reloc.cc: Include layout.h, incremental.h.
987 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
988 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
989 (Sized_relobj::incremental_relocs_scan): New function.
990 (Sized_relobj::incremental_relocs_scan_reltype): New function.
991 (Sized_relobj::do_relocate_sections): Write incremental relocations.
992 (Sized_relobj::incremental_relocs_write): New function.
993 (Sized_relobj::incremental_relocs_write_reltype): New function.
994 * script.cc (read_input_script): Rewrite test for incremental link.
995 Change call to Incremental_inputs::report_script.
996 * symtab.h (Symbol_table::first_global_index): New function.
997 (Symbol_table::output_count): New function.
998
ce0d1972
DK
9992010-08-12 Doug Kwan <dougkwan@google.com>
1000
1001 * arm.cc (Target_arm::merge_object_attributes): Check command line
1002 options --no-wchar-size-warning and --no-enum-size-warning.
1003 * options.h (General_options): Add ld-compatible options
1004 --no-enum-size-warning and --no-wchar-size-warning.
1005
6e5710ce
ILT
10062010-08-04 Ian Lance Taylor <iant@google.com>
1007
1008 * x86_64.cc (Target_x86_64::Scan::local): Use
1009 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1010 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1011 (Target_x86_64::Scan::global): Likewise.
1012 (Target_x86_64::Relocate::relocate): Likewise.
1013 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1014 Likewise.
1015
fef830db
CC
10162010-08-03 Cary Coutant <ccoutant@google.com>
1017
1018 * merge.cc (Output_merge_string::do_add_input_section): Count strings
1019 to reserve space in merged_strings vector. Keep total input size
1020 for stats.
1021 (Output_merge_string::do_print_merge_stats): Print total input size.
1022 * merge.h (Output_merge_string): Add input_size_ field.
1023 * stringpool.cc (Stringpool_template::string_length): Move
1024 implementations out of Stringpool_template class and place in
1025 stringpool.h.
1026 * stringpool.h (string_length): Move out of Stringpool_template.
1027
1e3811b0
ILT
10282010-08-03 Ian Lance Taylor <iant@google.com>
1029
1030 PR 11712
1031 * layout.cc (relaxation_loop_body): If address of load segment is
1032 set, adjust address to include headers if possible.
1033
7af0c620
ILT
10342010-08-03 Ian Lance Taylor <iant@google.com>
1035
1036 * version.cc (version_string): Bump to 1.10.
1037
22f0da72
ILT
10382010-08-03 Ian Lance Taylor <iant@google.com>
1039
1040 PR 11805
1041 * layout.h (enum Output_section_order): Define.
1042 (class Layout): Update declarations.
1043 * layout.cc (Layout::get_output_section): Add order parameter.
1044 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1045 is_first_non_relro parameters. Change all callers.
1046 (Layout::choose_output_section): Likewise.
1047 (Layout::add_output_section_data): Likewise.
1048 (Layout::make_output_section): Likewise. Set order.
1049 (Layout::default_section_order): New function.
1050 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1051 * output.cc (Output_section::Output_section): Initialize order_.
1052 Don't initialize deleted fields.
1053 (Output_segment::Output_segment): Don't initialize deleted
1054 fields.
1055 (Output_segment::add_output_section_to_load): New function
1056 replacing add_output_section. Change all callers to call this or
1057 add_output_section_to_nonload.
1058 (Output_segment::add_output_section_to_nonload): New function.
1059 (Output_segment::remove_output_section): Rewrite.
1060 (Output_segment::add_initial_output_data): Likewise.
1061 (Output_segment::has_any_data_sections): Likewise.
1062 (Output_segment::is_first_section_relro): Likewise.
1063 (Output_segment::maximum_alignment): Likewise.
1064 (Output_segment::has_dynamic_reloc): New function replacing
1065 dynamic_reloc_count. Change all callers.
1066 (Output_segment::has_dynamic_reloc_list): New function replacing
1067 dynamic_reloc_count_list. Change all callers.
1068 (Output_segment::set_section_addresses): Rewrite.
1069 (Output_segment::set_offset): Rewrite.
1070 (Output_segment::find_first_and_last_list): Remove.
1071 (Output_segment::set_tls_offsets): Rewrite.
1072 (Output_segment::first_section_load_address): Likewise.
1073 (Output_segment::output_section_count): Likewise.
1074 (Output_segment::section_with_lowest_load_address): Likewise.
1075 (Output_segment::write_section_headers): Likewise.
1076 (Output_segment::print_sections_to_map): Likewise.
1077 * output.h (class Output_data): Remove dynamic_reloc_count_
1078 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
1079 (Output_data::add_dynamic_reloc): Rewrite.
1080 (Output_data::has_dynamic_reloc): New function.
1081 (Output_data::dynamic_reloc_count): Remove.
1082 (class Output_section): Add order_ field. Remvoe is_relro_local_,
1083 is_last_relro_, is_first_non_relro_, is_interp_,
1084 is_dynamic_linker_section_ fields. Add order and set_order
1085 functions. Remove is_relro_local, set_is_relro_local,
1086 is_last_relro, set_is_last_relro, is_first_non_relro,
1087 set_is_first_non_relro functions, is_interp, set_is_interp,
1088 is_dynamic_linker_section, and set_is_dynamic_linker_section
1089 functions.
1090 (class Output_segment): Change Output_data_list from std::list to
1091 std:;vector. Add output_lists_ field. Remove output_data_ and
1092 output_bss_ fields. Update declarations.
1093
3ff2ccb0
ILT
10942010-08-02 Ian Lance Taylor <iant@google.com>
1095
1096 * arm.cc (Target_arm::gc_process_relocs): Use typename.
1097 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
1098 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
1099
88a4108b
ILT
11002010-08-02 Ian Lance Taylor <iant@google.com>
1101
1102 PR 11855
1103 * script.cc (Script_options::Script_options): Initialize
1104 symbol_definitions_ and symbol_references_.
1105 (Script_options::add_symbol_assignment): Update
1106 symbol_definitions_ and symbol_references_.
1107 (Script_options::add_symbol_reference): New function.
1108 (script_symbol): New function.
1109 * script.h (class Script_options): Add symbol_definitions_ and
1110 symbol_references_ fields.
1111 (Script_options::referenced_const_iterator): New type.
1112 (Script_options::referenced_begin): New function.
1113 (Script_options::referenced_end): New function.
1114 (Script_options::is_referenced): New function.
1115 (Script_options::any_unreferenced): New function.
1116 * script-c.h (script_symbol): Declare.
1117 * yyscript.y (exp): Call script_symbol.
1118 * symtab.cc: Include "script.h".
1119 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
1120 Change all callers. Check symbols referenced by scripts.
1121 (Symbol_table::add_undefined_symbols_from_command_line): Add
1122 layout parameter. Change all callers.
1123 (Symbol_table::do_add_undefined_symbols_from_command_line):
1124 Likewise. Break out loop body. Check symbols referenced by
1125 scripts.
1126 (Symbol_table::add_undefined_symbol_from_command_line): New
1127 function broken out of
1128 do_add_undefined_symbols_from_command_line.
1129 * symtab.h (class Symbol_table): Update declarations.
1130 * archive.cc: Include "layout.h".
1131 (Archive::should_include_member): Add layout parameter. Change
1132 all callers. Check for symbol mentioned in expression.
1133 * archive.h (class Archive): Update declaration.
1134 * object.cc (Sized_relobj::do_should_include_member): Add layout
1135 parameter.
1136 * object.h (Object::should_include_member): Add layout parameter.
1137 Change all callers.
1138 (Object::do_should_include_member): Add layout parameter.
1139 (class Sized_relobj): Update declaration.
1140 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
1141 parameter.
1142 * dynobj.h (class Sized_dynobj): Update declaration.
1143 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
1144 layout parameter.
1145 * plugin.h (class Sized_pluginobj): Update declaration.
1146
5f1ab67a
ILT
11472010-08-02 Ian Lance Taylor <iant@google.com>
1148
1149 PR 11866
1150 * output.cc (Output_segment::set_offset): Search for the first and
1151 last sections rather than assuming that the list is in order.
1152 (Output_segment::find_first_and_last_list): New function.
1153 * output.h (class Output_segment): Update declarations.
1154 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
1155 (relro_strip_test_SOURCES): New variable.
1156 (relro_strip_test_DEPENDENCIES): New variable.
1157 (relro_strip_test_LDFLAGS): New variable.
1158 (relro_strip_test_LDADD): New variable.
1159 (relro_strip_test.so): New target.
1160
a8df5856
ILT
11612010-08-02 Ian Lance Taylor <iant@google.com>
1162
1163 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
1164 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
1165 (Target_i386::got_tlsdesc_section): New function.
1166 (Target_i386::got_section): Create space for GOT entries for
1167 TLSDESC relocations.
1168 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
1169 R_386_TLS_GOTDESC.
1170 (Target_i386::Scan::global): Likewise.
1171 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
1172 using TLSDESC GOT.
1173 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
1174 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
1175 (Target_x86_64::got_tlsdesc_section): New function.
1176 (Target_x86_64::got_section): Create space for GOT entries for
1177 TLSDESC relocations.
1178 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
1179 R_386_TLS_GOTDESC.
1180 (Target_x86_64::Scan::global): Likewise.
1181 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
1182 using TLSDESC GOT.
1183
0c10a0a6
ILT
11842010-08-02 Ian Lance Taylor <iant@google.com>
1185
1186 * testsuite/final_layout.sh: Use dc to convert from hex to
1187 decimal.
1188
41cbeecc
ST
11892010-07-29 Sriraman Tallam <tmsriram@google.com>
1190
1191 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
1192 paramter to the call to gold::gc_process_relocs.
1193 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
1194 paramter to the call to gold::gc_process_relocs.
1195 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
1196 parameter to the call to gold::gc_process_relocs.
1197 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
1198 template parameter to the call to gold::gc_process_relocs.
1199 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
1200 paramter to the call to gold::gc_process_relocs.
1201 * gc.h (get_embedded_addend_size): New function.
1202 (gc_process_relocs): Save the size of the reloc for use by ICF.
1203 * icf.cc (get_section_contents): Get the addend from the text section
1204 for SHT_REL relocation sections.
1205 * icf.h (Icf::Reloc_addend_size_info): New typedef.
1206 (Icf::Reloc_info): Add new member reloc_addend_size_info.
1207 * int_encoding.h (read_from_pointer): New overloaded function.
1208 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
1209 * testsuite/icf_sht_rel_addend_test.sh: New file.
1210 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
1211 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
1212
6ea55b82
RW
12132010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1214
1215 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
1216 * Makefile.in: Regenerate.
1217 * testsuite/Makefile.in: Regenerate.
1218
9691462b
ILT
12192010-07-27 Jeffrey Yasskin <jyasskin@google.com>
1220
1221 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
1222 * gold/testsuite/debug_msg.cc: Likewise.
1223 * gold/testsuite/odr_violation1.cc
1224 * gold/testsuite/odr_violation2.cc
1225
76897331
CC
12262010-07-21 Cary Coutant <ccoutant@google.com>
1227
1228 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
1229 string, and length fields.
1230 (Output_merge_string::Merged_strings_list): New type.
1231 (Output_merge_string::Merged_strings_lists): New typedef.
1232 (Output_merge_string): Replace merged_strings_ with
1233 merged_strings_lists_.
1234 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
1235 Merged_strings_list per input object and section. Don't store pointer
1236 to the string. Don't store length with each merged string entry.
1237 (Output_merge_string::finalize_merged_data): Loop over list of merged
1238 strings lists. Recompute length of each merged string.
1239
78384e8f
CC
12402010-07-15 Cary Coutant <ccoutant@google.com>
1241
1242 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
1243 here.
1244
783659f9
ILT
12452010-07-14 Ian Lance Taylor <iant@google.com>
1246
1247 * descriptors.cc (Descriptors::open): Report correct name in error
1248 message.
1249
131687b4
DK
12502010-07-13 Doug Kwan <dougkwan@google.com>
1251
1252 * arm.cc (Arm_input_section::Arm_input_section): For a
1253 SHT_ARM_EXIDX section, always keeps the input sections.
1254 (Arm_input_section::set_exidx_section_link): New method.
1255 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
1256 has_errors_ to false.
1257 (Arm_exidx_input_section::has_errors,
1258 Arm_exidx_input_section::set_has_errors): New methods.
1259 (Arm_exidx_input_section::has_errors_): New data member.
1260 (Arm_relobj::get_exidx_shndx_list): New method.
1261 (Arm_output_section::append_text_sections_to_list): Do not skip
1262 section without SHF_EXECINSTR.
1263 (Arm_output_section::fix_exidx_coverage): Skip input sections with
1264 errors.
1265 (Arm_relobj::make_exidx_input_section): Add new parameter for text
1266 section header. Make error messages more verbose. Check for
1267 a non-executable section linked to an EXIDX section.
1268 (Arm_relobj::do_read_symbols): Remove error checking, which has been
1269 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
1270 check that there is no deferred EXIDX section if we exit early.
1271 Instead of not making an EXIDX section in case of an error, make one
1272 and set the has_errors flag of it.
1273 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
1274 in a relocatable link.
1275 (Target_arm::do_relax): Look for the EXIDX output section instead of
1276 assuming that it is called .ARM.exidx.
1277 (Target_arm::fix_exidx_coverage): Add a new parameter for input
1278 section list. Do not check for SHF_EXECINSTR section flags but
1279 skip any input section with errors.
1280 * output.cc (Output_section::Output_section): Initialize
1281 always_keeps_input_sections_ to false.
1282 (Output_section::add_input_section): Check for
1283 always_keeps_input_sections_.
1284 * output.h (Output_section::always_keeps_input_sections,
1285 Output_section::set_always_keeps_input_sections): New methods.
1286 (Output_section::always_keeps_input_sections): New data member.
1287
69517287
RÁE
12882010-07-13 Rafael Espindola <espindola@google.com>
1289
1290 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
1291 * fileread.h (Input_file): Add try_extra_search_path and find_file.
1292
82742395
ILT
12932010-07-13 Philip Herron <herron.philip@googlemail.com>
1294 Ian Lance Taylor <iant@google.com>
1295
1296 * output.h (Output_section_lookup_maps::add_merge_section):
1297 Correct check of whether value was inserted.
1298 (Output_section_lookup_maps::add_merge_input_section): Likewise.
1299 (Output_section_lookup_maps::add_relaxed_input_section):
1300 Likewise.
1301 * arm.cc (Target_arm::got_section): Remove used local os.
1302 * i386.cc (Target_i386::got_section): Likewise.
1303 * x86_64.cc (Target_x86_64::got_section): Likewise.
1304 * sparc.cc (Target_sparc::got_section): Likewise.
1305 (Target_sparc::relocate): Remove unused local have_got_offset.
1306 * powerpc.cc (Target_powerpc::relocate): Likewise.
1307
f2d707b5
ILT
13082010-07-13 Ian Lance Taylor <iant@google.com>
1309
241531d6
ILT
1310 * compressed_output.cc (zlib_decompress): Fix signature in
1311 !HAVE_ZLIB_H case.
1312
f2d707b5
ILT
1313 * archive.cc (Archive::include_member): Unlock an external member
1314 of a thin archive. Don't bother to delete an object we know is
1315 NULL.
1316
a2e47362
CC
13172010-07-12 Cary Coutant <ccoutant@google.com>
1318
1319 * compressed_output.cc (zlib_decompress): New function.
1320 (get_uncompressed_size): New function.
1321 (decompress_input_section): New function.
1322 * compressed_output.h (get_uncompressed_size): New function.
1323 (decompress_input_section): New function.
1324 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
1325 Handle compressed debug sections.
1326 * layout.cc (is_compressed_debug_section): New function.
1327 (Layout::output_section_name): Map compressed section names to
1328 canonical names.
1329 * layout.h (is_compressed_debug_section): New function.
1330 (is_debug_info_section): Recognize compressed debug sections.
1331 * merge.cc: Include compressed_output.h.
1332 (Output_merge_data::do_add_input_section): Handle compressed
1333 debug sections.
1334 (Output_merge_string::do_add_input_section): Handle compressed
1335 debug sections.
1336 * object.cc: Include compressed_output.h.
1337 (Sized_relobj::Sized_relobj): Initialize new data members.
1338 (build_compressed_section_map): New function.
1339 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
1340 * object.h (Object::section_is_compressed): New method.
1341 (Object::do_section_is_compressed): New method.
1342 (Sized_relobj::Compressed_section_map): New type.
1343 (Sized_relobj::do_section_is_compressed): New method.
1344 (Sized_relobj::compressed_sections_): New data member.
1345 * output.cc (Output_section::add_input_section): Handle compressed
1346 debug sections.
1347 * reloc.cc: Include compressed_output.h.
1348 (Sized_relobj::write_sections): Handle compressed debug sections.
1349
ce279a62
CC
13502010-07-08 Cary Coutant <ccoutant@google.com>
1351
1352 * resolve.cc (Symbol_table::resolve): Remember whether undef was
1353 weak when resolving to a dynamic def.
1354 (Symbol_table::should_override): Add adjust_dyndef flag; set it
1355 for weak undef/dynamic def cases. Adjust callers.
1356 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
1357 undef_binding_weak_.
1358 (Symbol_table::sized_write_globals): Adjust symbol binding.
1359 (Symbol_table::sized_write_symbol): Add binding parameter.
1360 * symtab.h (Symbol::set_undef_binding): New method.
1361 (Symbol::is_undef_binding_weak): New method.
1362 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
1363 (Symbol_table::should_override): Add new parameter.
1364 (Symbol_table::sized_write_symbol): Add new parameter.
1365
1366 * testsuite/weak_undef_file1.cc: Add new test case.
1367 * testsuite/weak_undef_file2.cc: Fix header comment.
1368 * testsuite/weak_undef_test.cc: Add new test case.
1369
b2286c10
DK
13702010-06-29 Doug Kwan <dougkwan@google.com>
1371
1372 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
1373 Initialize USE_SYMBOL_.
1374 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
1375 definition.
1376 (Arm_reloc_property::uses_symbol_): New data member declaration.
1377 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
1378 uses symbol value and symbol is undefined but not weakly undefined.
1379
4802450a
RÁE
13802010-06-28 Rafael Espindola <espindola@google.com>
1381
1382 * plugin.cc (Plugin::load): Use dlerror.
1383
e5ca47ba
ILT
13842010-06-26 Jeffrey Yaskin <jyasskin@google.com>
1385
1386 * symtab.cc (detect_odr_violations): When reporting an ODR
1387 violation, report an object where the symbol is defined.
1388
8a75a161
DK
13892010-06-25 Doug Kwan <dougkwan@google.com>
1390
1391 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
1392 (Target_arm::section_may_have_icf_unsafe_pointers): New method
1393 definition.
1394 (Target_arm::Scan::local_reloc_may_be_function_pointer,
1395 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
1396 target hook to detect function points.
1397 (Target_arm::Scan::possible_function_pointer_reloc): New method.
1398 * icf.h (Icf::check_section_for_function_pointers): Change type of
1399 parameter SECTION_NAME to const reference to std::string. Use
1400 target hook to determine if section may have unsafe pointers.
1401 * target.h (Target::section_may_have_icf_unsafe_pointers): New
1402 method definition.
1403
42218b9f
RÁE
14042010-06-21 Rafael Espindola <espindola@google.com>
1405
1406 * fileread.cc (Input_file::find_fie): New
1407 (Input_file::open): Use Input_file::find_fie.
1408 * fileread.h (Input_file::find_fie): New
1409 * plugin.cc (set_extra_library_path): New.
1410 (Plugin::load): Add set_extra_library_path to the transfer vector.
1411 (Plugin_manager::set_extra_library_path): New.
1412 (Plugin_manager::add_input_file): Use the extra search path if set.
1413 (set_extra_library_path(): New.
1414 * plugin.h (Plugin_manager): Add set_extra_library_path and
1415 extra_search_path_.
1416
a0506cca
CC
14172010-06-19 Cary Coutant <ccoutant@google.com>
1418
1419 * layout.cc (gdb_sections): Add .debug_types.
1420 (lines_only_debug_sections): Likewise.
1421
6508b958
RÁE
14222010-06-18 Rafael Espindola <espindola@google.com>
1423
1424 * plugin.cc (add_input_file,add_input_library)
1425 (Plugin_manager::add_input_file): Make filename arguments const.
1426 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
1427 const.
1428
3e235302
DK
14292010-06-16 Doug Kwan <dougkwan@google.com>
1430
1431 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
1432 .ARM.attributes section if we have not merged any input
1433 attributes sections.
1434
106e8a6c
DK
14352010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1436
1437 * arm.cc: Allow combining objects with no EABI version
1438 information.
1439
91ff43fe
RÁE
14402010-06-15 Rafael Espindola <espindola@google.com>
1441
1442 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
1443
68ed838c
ILT
14442010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1445
1446 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
1447 (struct iovec): Correct !HAVE_READV definition.
1448
f3a2388f
CC
14492010-06-10 Cary Coutant <ccoutant@google.com>
1450
1451 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
1452 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
1453 reloc sections.
1454 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
1455
1456 PR 11683
1457 * symtab.h (Symbol::is_placeholder): New member function.
1458 * target-reloc.h (relocate_section): Check for placeholder symbols.
1459
1460 * testsuite/Makefile.am (plugin_test_8): New test.
1461 (plugin_test_9): New test.
1462 * testsuite/Makefile.in: Regenerate.
1463
e1df38aa
NC
14642010-06-09 Nick Clifton <nickc@redhat.com>
1465
1466 * yyscript.y (input_list_element): Allow strings prefixed with
1467 the '-' character. Treat these as libraries.
1468 * script.cc (script_add_library): New function. Adds a library
1469 specified by "-l<name>" found in an input script.
1470 * script-c.h: Add prototype for script_add_library.
1471
25bbe950
DK
14722010-06-07 Doug Kwan <dougkwan@google.com>
1473
1474 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
1475 Restrict stub-group size to be within long conditional branch
1476 range when working around cortex-A8 erratum.
1477
0f32ea4c
ILT
14782010-06-07 Damien Diederen <dd@crosstwine.com>
1479
1480 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
1481 #ifdef typo.
1482
8fe2a369
ST
14832010-06-03 Sriraman Tallam <tmsriram@google.com>
1484
1485 PR gold/11658
1486 * output.cc
1487 (Output_section::Input_section_sort_entry::compare_section_ordering):
1488 Change to return non-zero correctly.
1489 (Output_section::Input_section_sort_section_order_index_compare
1490 ::operator()): Change to fix ambiguity in comparisons.
1491
6e9ba2ca
ST
14922010-06-01 Sriraman Tallam <tmsriram@google.com>
1493
1494 * gold.h (is_wildcard_string): New function.
1495 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
1496 (Layout::layout_eh_frame): Ditto.
1497 (Layout::find_section_order_index): New method.
1498 (Layout::read_layout_from_file): New method.
1499 * layout.h (Layout::find_section_order_index): New method.
1500 (Layout::read_layout_from_file): New method.
1501 (Layout::input_section_position_): New private member.
1502 (Layout::input_section_glob_): New private member.
1503 * main.cc (main): Call read_layout_from_file here.
1504 * options.h (--section-ordering-file): New option.
1505 * output.cc (Output_section::input_section_order_specified_): New
1506 member.
1507 (Output_section::Output_section): Initialize new member.
1508 (Output_section::add_input_section): Add new parameter.
1509 Keep input sections when --section-ordering-file is used.
1510 (Output_section::set_final_data_size): Sort input sections when
1511 section ordering file is specified.
1512 (Output_section::Input_section_sort_entry): Add new parameter.
1513 Check sorting type.
1514 (Output_section::Input_section_sort_entry::compare_section_ordering):
1515 New method.
1516 (Output_section::Input_section_sort_compare::operator()): Change to
1517 consider section_order_index.
1518 (Output_section::Input_section_sort_init_fini_compare::operator()):
1519 Change to consider section_order_index.
1520 (Output_section::Input_section_sort_section_order_index_compare
1521 ::operator()): New method.
1522 (Output_section::sort_attached_input_sections): Change to sort
1523 according to section order when specified.
e1df38aa
NC
1524 (Output_section::add_input_section<32, true>): Add new parameter.
1525 (Output_section::add_input_section<64, true>): Add new parameter.
1526 (Output_section::add_input_section<32, false>): Add new parameter.
1527 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
1528 * output.h (Output_section::add_input_section): Add new parameter.
1529 (Output_section::input_section_order_specified): New
1530 method.
1531 (Output_section::set_input_section_order_specified): New method.
1532 (Input_section::Input_section): Initialize section_order_index_.
1533 (Input_section::section_order_index): New method.
1534 (Input_section::set_section_order_index): New method.
1535 (Input_section::section_order_index_): New member.
1536 (Input_section::Input_section_sort_section_order_index_compare): New
1537 struct.
1538 (Output_section::input_section_order_specified_): New member.
1539 * script-sections.cc (is_wildcard_string): Delete and move modified
1540 method to gold.h.
1541 (Output_section_element_input::Output_section_element_input): Modify
1542 call to is_wildcard_string.
1543 (Output_section_element_input::Input_section_pattern
1544 ::Input_section_pattern): Ditto.
1545 (Output_section_element_input::Output_section_element_input): Ditto.
1546 * testsuite/Makefile.am (final_layout): New test case.
1547 * testsuite/Makefile.in: Regenerate.
1548 * testsuite/final_layout.cc: New file.
1549 * testsuite/final_layout.sh: New file.
1550
3537c84b
RÁE
15512010-06-01 Rafael Espindola <espindola@google.com>
1552
1553 * plugin.cc (Plugin::load): Pass the output name to the plugin.
1554
105b6afd
RÁE
15552010-06-01 Rafael Espindola <espindola@google.com>
1556
1557 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
1558 visibility of symbols.
1559
29e11421
DK
15602010-05-27 Doug Kwan <dougkwan@google.com>
1561
1562 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
1563 from start of output section instead of address for a local symbol
1564 in a merged or relaxed section when doing a relocatable link.
1565
5e0f337e
RÁE
15662010-05-26 Rafael Espindola <espindola@google.com>
1567
1568 PR 11604
1569 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
1570 adding sections the garbage collector removed.
1571 * gold/testsuite/Makefile.am: Add test.
1572 * gold/testsuite/Makefile.in: Regenerate.
1573 * gold/testsuite/plugin_test_7.sh: New.
1574 * gold/testsuite/plugin_test_7_1.c: New.
1575 * gold/testsuite/plugin_test_7_2.c: New.
1576
f4187277
RÁE
15772010-05-26 Rafael Espindola <espindola@google.com>
1578
1579 * script-sections.cc (Output_section_definition::set_section_addresses):
1580 Check for --section-start.
1581
5c388529
DK
15822010-05-26 Doug Kwan <dougkwan@google.com>
1583
1584 * arm.cc (Arm_scan_relocatable_relocs): New class.
1585 (Target_arm::relocate_special_relocatable): New method.
1586 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
1587 (Arm_relocate_functions::thumb_branch_common): Same.
1588 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
1589 instead of Default_scan_relocatable_relocs.
1590 * target-reloc.h (relocate_for_relocatable): Let target handle
1591 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
1592 * target.h (Sized_target::relocate_special_relocatable): New method.
1593
bca1c3ae
ILT
15942010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1595
1596 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
1597
0439c796
DK
15982010-05-23 Doug Kwan <dougkwan@google.com>
1599
1600 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
1601 instead of a cast.
1602 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
1603 with a direct branch, not a conditional branch, to a stub.
1604 * merge.cc (Output_merge_base::record_input_section): New method
1605 defintion.
1606 (Output_merge_data::do_add_input_section): Record input section if
1607 keeps-input-sections flag is set.
1608 (Output_merge_string::do_add_input_section): Ditto.
1609 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
1610 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
1611 INPUT_SECTIONS_.
1612 (Output_merge_base::keeps_input_sections,
1613 Output_merge_base::set_keeps_input_sections,
1614 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
1615 method definitions.
1616 (Output_merge_base::Input_sections): New type declaration.
1617 (Output_merge_base::input_sections_begin,
1618 Output_merge_base::input_sections_end,
1619 Output_merge_base::do_set_keeps_input_sections): New method definitions.
1620 (Output_merge_base::bool keeps_input_sections_,
1621 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
1622 Output_merge_base::input_sections_): New data members.
1623 (Output_merge_data::do_set_keeps_input_sections): New method
1624 defintion.
1625 (Output_merge_string::do_set_keeps_input_sections): Ditto.
1626 * output.cc (Output_section::Input_section::relobj): Move method
1627 defintion from class declaration to here and handle merge sections.
1628 (Output_section::Input_section::shndx): Ditto.
1629 (Output_section::Output_section): Remove initializations of removed
1630 data members and initialize new data member LOOKUP_MAPS_.
1631 (Output_section::add_input_section): Set keeps-input-sections flag
1632 for a newly created merge output section as appropriate. Adjust code
1633 to use Output_section_lookup_maps class.
1634 (Output_section::add_relaxed_input_section): Adjst code for lookup
1635 maps code refactoring.
1636 (Output_section::add_merge_input_section): Add a new parameter
1637 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
1638 class. If adding input section to a newly created merge output
1639 section fails, remove the new merge section.
1640 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 1641 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
1642 (Output_section::find_merge_section): Ditto.
1643 (Output_section::build_lookup_maps): New method defintion.
1644 (Output_section::find_relaxed_input_section): Adjust code to use
1645 Output_section_lookup_maps class.
1646 (Output_section::get_input_sections): Export merge sections. Adjust
1647 code to use Output_section_lookup_maps class.
1648 (Output_section:::add_script_input_section): Adjust code to use
1649 Output_section_lookup_maps class. Update lookup maps for merge
1650 sections also.
1651 (Output_section::discard_states): Use Output_section_lookup_maps.
1652 (Output_section::restore_states): Same.
1653 * output.h (Merge_section_properties): Move class defintion out of
1654 Output_section.
1655 (Output_section_lookup_maps): New class.
1656 (Output_section::Input_section::is_merge_section): New method
1657 defintion.
1658 (Output_section::Input_section::relobj): Move defintion out of class
1659 defintion. Declare method only.
1660 (Output_section::Input_section::shndx): Ditto.
1661 (Output_section::Input_section::output_merge_base): New method defintion.
1662 (Output_section::Input_section::u2_.pomb): New union field.
1663 (Output_section::Merge_section_by_properties_map,
1664 Output_section::Output_section_data_by_input_section_map,
1665 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
1666 Remove types.
1667 (Output_section::add_merge_input_section): Add new parameter
1668 KEEPS_INPUT_SECTIONS.
1669 (Output_section::build_lookup_maps): New method declaration.
1670 (Output_section::merge_section_map_,
1671 Output_section::merge_section_by_properties_map_,
1672 Output_section::relaxed_input_section_map_,
1673 Output_section::is_relaxed_input_section_map_valid_): Remove data
1674 members.
1675 (Output_section::lookup_maps_): New data member.
1676
76295588
L
16772010-05-21 Doug Kwan <dougkwan@google.com>
1678
1679 PR gold/11619
1680 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
1681 avoid a compilation error.
1682
d103a984
RÁE
16832010-05-19 Rafael Espindola <espindola@google.com>
1684
1685 * script-sections.cc (Output_section_definition::allocate_to_segment):
1686 Update the phdrs_list even when the output section is NULL.
1687 * testsuite/Makefile.am: Add test.
1688 * testsuite/Makefile.in: Regenerate.
1689 * testsuite/script_test_9.cc: New.
1690 * testsuite/script_test_9.sh: New.
1691 * testsuite/script_test_9.t: New.
1692
6625d24e
DK
16932010-05-19 Doug Kwan <dougkwan@google.com>
1694
1695 * arm.cc (Arm_input_section::original_size): New method.
1696 (Arm_input_section::do_addralign): Add a cast.
1697 (Arm_input_section::do_output_offset): Remove static cast.
1698 (Arm_input_section::original_addralign,
1699 Arm_input_section::original_size_): Change type to uint32_t.
1700 (Arm_input_section::init): Add safe casts for section alignment
1701 and size.
1702 (Arm_input_section::set_final_data_size): Do not set address and
1703 offset of stub table.
1704 (Arm_output_section::fix_exidx_coverage): Change use of of
1705 Output_section::Simple_input_section to that of
1706 Output_section::Input_section.
1707 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
1708 except for the first pass.
1709 * output.cc (Output_section::get_input_sections): Change type of
1710 input_sections to std::list<Input_section>.
1711 (Output_section::add_script_input_section): Rename from
1712 Output_section::add_simple_input_section. Change type of SIS
1713 parameter from Simple_input_section to Input_section.
1714 * output.h (Output_section::Simple_input_section): Remove class.
1715 (Output_section::Input_section): Change class visibility to public.
1716 (Output_section::Input_section::addralign): Use stored alignments
1717 for special input sections if set.
1718 (Output_section::Input_section::set_addralign): New method.
1719 (Output_section::get_input_sections): Change parameter type from
1720 list of Simple_input_section to list of Input_section.
1721 (Output_section::add_script_input_section): Rename from
1722 Output_section::add_simple_input_section. Change first parameter's
1723 type from Simple_input_section to Input_section and remove the
1724 second and third parameters.
1725 * script-sections.cc (Input_section::Input_section_list): Change
1726 type to list of Output_section::Input_section/
1727 (Input_section_info::Input_section_info): Change parameter type of
1728 INPUT_SECTION to Output_section::Input_section.
1729 (Input_section_info::input_section): Change return type.
1730 (Input_section_info::input_section_): Change type to
1731 Output_section::Input_section.
1732 (Output_section_element_input::set_section_addresses): Adjust code
1733 to use Output_section::Input_section instead of
1734 Output_section::Simple_input_section. Adjust code for renaming
1735 of Output_section::add_simple_input_section.
1736 (Orphan_output_section::set_section_addresses): Ditto.
1737
e1e82ea4
RW
17382010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1739
1740 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
1741 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
1742
91e75c8a
RÁE
17432010-05-18 Rafael Espindola <espindola@google.com>
1744
1745 * options.cc (General_options::finalize): Handle -nostdlib.
1746 * options.h (nostdlib): New option.
1747 * script.cc (script_add_search_dir): Handle -nostdlib.
1748
da59ad79
DK
17492010-05-12 Doug Kwan <dougkwan@google.com>
1750
1751 * arm.cc (Target_arm::do_finalize_sections): Create an empty
1752 attributes section only if there no attributes section after merging.
1753 (Target_arm::merge_object_attributes): Move value of
e1df38aa 1754 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
1755 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
1756 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
1757 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
1758 and arm_attr_merge_7.stdout.
1759 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
1760 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
1761 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
1762 arm_attr_merge_7b.o): New rules.
1763 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
1764 arm_attr_merge_7
1765 * testsuite/Makefile.in: Regenerate.
1766 * testsuite/arm_attr_merge.sh: New file.
1767 * testsuite/arm_attr_merge_[67][ab].s: Same.
1768
3e01a7fd
NC
17692010-05-05 Nick Clifton <nickc@redhat.com>
1770
1771 * po/es.po: Updated Spanish translation.
1772
7ad2014a
L
17732010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1774
1775 * Makefile.am (install-exec-local): Properly install gold as
1776 default cross linker.
1777 * Makefile.in: Regenerated.
1778
4fda8867
NC
17792010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1780 Nick Clifton <nickc@redhat.com>
1781
1782 * configure.ac (install_as_default): Define and set to false
1783 unless --enable-gold or --enable-gold=both/gold has been
1784 specified.
1785 * configure: Regenerate.
1786
1787 * Makefile.am (install-exec-local): Install the executable as
1788 'ld.gold'. If install_as_default is true then also install it as
1789 'ld'.
1790 * Makefile.in: Regenerated.
1791
bd288ea2
ILT
17922010-04-24 Ian Lance Taylor <iant@google.com>
1793
1794 * layout.cc (Layout::layout_reloc): In relocatable link don't
1795 combine reloc sections for grouped sections.
1796
ef38fd8a
ST
17972010-04-23 Sriraman Tallam <tmsriram@google.com>
1798
1799 * gc.h (gc_process_relocs): Pass information on relocs pointing to
1800 sections that are not ordinary to icf.
1801 * icf.cc (get_section_contents): Handle relocation pointing to section
1802 with no object or shndx information.
1803 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
1804 * testsuite/Makefile.in: Regenerate.
1805 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
1806 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
1807
f6973bdc
ILT
18082010-04-22 Ian Lance Taylor <iant@google.com>
1809
1810 * expression.cc (Expression::Expression_eval_info): Add
1811 result_alignment_pointer field.
1812 (Expression::eval_with_dot): Add result_alignment_pointer
1813 parameter. Change all callers.
1814 (Expression::eval_maybe_dot): Likewise.
1815 (class Binary_expression): Add alignment_pointer parameter to
1816 left_value and right_value. Change all callers.
1817 (BINARY_EXPRESSION): Set result alignment.
1818 (class Trinary_expression): Add alignment_pointer parameter to
1819 arg2_value and arg3_value. Change all callers.
1820 (Trinary_cond::value): Set result alignment.
1821 (Max_expression::value, Min_expression::value): Likewise.
1822 (Align_expression::value): Likewise.
1823 * script-sections.cc (class Sections_element): Add dot_alignment
1824 parameter to set_section_addresses virtual function. Update
1825 instantiations.
1826 (class Output_section_element): Likewise.
1827 (Script_sections::create_segments): Add dot_alignment parameter.
1828 Change all callers.
1829 (Script_sections::create_segments_from_phdrs_clause): Likewise.
1830 (Script_sections::set_phdrs_clause_addresses): Likewise.
1831 * script-sections.h: Update declarations.
1832 * script.h: Update declarations.
1833 * output.h (Output_segment::set_minimum_p_align): Don't decrease
1834 min_p_align.
1835 * testsuite/script_test_3.t: Set large alignment.
1836 * testsuite/script_test_3.sh: Make sure that at least one LOAD
1837 segment has expected alignment.
1838
9c9c98a5
NC
18392010-04-22 Nick Clifton <nickc@redhat.com>
1840
1841 * po/gold.pot: Updated by the Translation project.
1842 * po/vi.po: Updated Vietnamese translation.
1843
2253bfba
L
18442010-04-22 H.J. Lu <hongjiu.lu@intel.com>
1845
1846 * testsuite/Makefile.am (check_PROGRAMS): Add
1847 icf_virtual_function_folding_test.
1848 * testsuite/Makefile.in: Regenerated.
1849
85fdf906
AH
18502010-04-15 Andrew Haley <aph@redhat.com>
1851
1852 * options.h (merge_exidx_entries): New option.
1853 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
1854 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
1855 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
1856 (Target_arm::merge_exidx_entries): New function.
1857 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
1858 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
1859 to Arm_exidx_fixup constructor.
1860 Add new arg, merge_exidx_entries.
1861 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
1862 Arm_output_section::fix_exidx_coverage.
1863
ce97fa81
ST
18642010-04-18 Sriraman Tallam <tmsriram@google.com>
1865
1866 * icf.cc (get_section_contents): Check for preemptible functions.
1867 Ignore addend when appropriate.
1868 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
1869 section folded.
1870 (add_from_relobj): Check for section folded.
1871 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
1872 * symtab.h (should_add_dynsym_entry): Add new parameter.
1873 * target-reloc.h (scan_relocs): Check for section folded.
1874 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
1875 Check reloc types for function pointers in shared objects.
1876 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
1877 case.
1878 (icf_preemptible_functions_test): New test case.
1879 (icf_string_merge_test): New test case.
1880 * testsuite.Makefile.in: Regenerate.
1881 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
1882 bar_glob. Refactor code.
1883 * testsuite/icf_preemptible_functions_test.cc: New file.
1884 * testsuite/icf_preemptible_functions_test.sh: New file.
1885 * testsuite/icf_string_merge_test.cc: New file.
1886 * testsuite/icf_string_merge_test.sh: New file.
1887 * testsuite/icf_virtual_function_folding_test.cc: New file.
1888 * testsuite/icf_virtual_function_folding_test.sh: New file.
1889
04ceb17c
DK
18902010-04-14 Doug Kwan <dougkwan@google.com>
1891
1892 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
1893 for local symbol recounting if we remove a section due to ICF.
1894 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
1895 there are no regular objects in input.
1896
153e7da4
DK
18972010-04-13 Doug Kwan <dougkwan@google.com>
1898
1899 * arm.cc (Arm_input_section::set_final_data_size): Compute
1900 accurate final data size instead of using current data size.
1901
4dbd9faf
DK
19022010-04-09 Doug Kwan <dougkwan@google.com>
1903
1904 * layout.cc (Layout::choose_output_section): Handle script section
1905 types.
1906 (Layout::make_output_section_for_script): Add section type parameter.
1907 Handle script section types.
1908 * layout.h (Layout::make_output_section_for_script): Add section
1909 type parameter.
1910 * output.cc (Output_section::Output_section): Initialize data member
1911 is_noload_.
1912 (Output_section::do_reset_address_and_file_offset): Do not set address
1913 to 0 if section is a NOLOAD section.
1914 * output.h (Output_section::is_noload): New method.
1915 (Output_section::set_is_noload): Ditto.
1916 (Output_section::is_noload_): New data member.
1917 * script-c.h (Script_section_type): New enum type.
1918 (struct Parser_output_section_header): Add new file section_type.
1919 * script-sections.cc (Sections_element::output_section_name): Add
1920 parameter for returning script section type.
1921 (Output_section_definition::output_section_name): Ditto.
1922 (Output_section_definition::section_type)P; New method.
1923 (Output_section_definiton::script_section_type_name): Ditto.
1924 (Output_section_definition::script_section_type_): New data member.
1925 (Output_section_definition::Output_section_definition): Initialize
1926 data member Output_section_definition::script_section_type_.
1927 (Output_section_definition::create_sections): Pass script section type
1928 to Layout::make_output_section_for_script.
1929 (Output_section_definition::output_section_name): Return script
1930 section type to caller.
1931 (Output_section_definition::set_section_address): Do not advance
1932 dot value and load address if section type is NOLOAD. Set address
1933 of NOLOAD sections regardless of section flags.
1934 (Output_section_definition::print): Print section type if it is
1935 not SCRIPT_SECTION_TYPE_NONE.
1936 (Output_section_definition::section_type): New method.
1937 (Output_section_definition::script_section_type_name): Ditto.
1938 (Script_sections::output_section_name): Add new parameter
1939 PSECTION_TYPE for returning script section type. Pass it to
1940 section elements. Handle discard sections.
1941 (Sort_output_sections::operator()): Handle NOLOAD sections.
1942 * script-sections.h (Script_sections::Section_type): New enum type.
1943 (Script_sections::output_section_name): Add a new parameter for
1944 returning script section type.
1945 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
1946 INFO and NOLOAD.
1947 * yyscript.y (union): Add new field SECTION_TYPE.
1948 (COPY, DSECT, INFO, NOLOAD): New tokens.
1949 (opt_address_and_section_type): Change type to output_section_header.
1950 (section_type): New non-terminal
1951 (section_header): Handle section type.
2253bfba 1952 (opt_address_and_section_type): Return section type value.
4dbd9faf 1953
721ea635
L
19542010-04-09 H.J. Lu <hongjiu.lu@intel.com>
1955
1956 * testsuite/plugin_common_test_1.c (foo): Add prototype.
1957 * testsuite/plugin_common_test_2.c (foo): Likewise.
1958
6bf924b0
DK
19592010-04-08 Doug Kwan <dougkwan@google.com>
1960
1961 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
1962 Output_merge_data.
1963 * output.cc (Output_section::add_merge_input_section): Simplify
1964 code and return status of Output_merge_base::add_input_section.
e1df38aa 1965 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
1966 returns true.
1967
24af6f92
DK
19682010-04-07 Doug Kwan <dougkwan@google.com>
1969
1970 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
1971 if section is marked as containing instructions but has no mapping
1972 symbols.
1973 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
1974 correct section index.
1975 (Arm_relobj::find_linked_text_section): Ditto.
1976
00698fc5
CC
19772010-04-07 Cary Coutant <ccoutant@google.com>
1978
1979 * archive.cc (include_member): Destroy Read_symbols_data object before
1980 releasing file.
1981 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
1982 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
1983 (Read_symbols_data::~Read_symbols_data) New destructor.
1984 (Section_relocs::Section_relocs) New constructor.
1985 (Section_relocs::~Section_relocs) New destructor.
1986 (Read_relocs_data::Read_relocs_data) New constructor.
1987 (Read_relocs_data::~Read_relocs_data) New destructor.
1988 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
1989 pointers to NULL after deleting.
1990
7296d933
DK
19912010-04-07 Doug Kwan <dougkwan@google.com>
1992
1993 * arm.cc: Replace "endianity" with "endianness" in comments.
1994 (Arm_exidx_cantunwind): Ditto.
1995 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
1996 (Arm_relobj::merge_flags_and_attributes): New method.
1997 (Arm_relobj::merge_flags_and_attributes_): New data member.
1998 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
1999 (Arm_relobj::scan_sections_for_stubs): Ditto.
2000 (Arm_relobj::do_read_symbols): Check to see if we really want to
2001 merge processor-specific flags and attributes. Exit early if
2002 an object is empty except for section names and the undefined symbol.
2003 (Target_arm::do_finalize_sections): Move check for ELF format to
2004 Arm_relobj::do_read_symbols. Merge processor specific flags and
2005 attributes from a regular object only when we have determined that
2006 it is aapropriate. Do not create an .ARM.attributes section in
2007 output if there is no regular input object.
2008 (Target_arm::merge_processor_specific_flags): Check
2009 --warn-mismatch before printing any error.
2010 (Target_arm::merge_object_attributes): Ditto.
2011 * gold.cc (queue_middle_tasks): Handle the case in which there is
2012 no regular object in input.
2013 * options.cc (General_options::parse_EB): New method.
2014 (General_options::parse_EL): Same.
2015 (General_options::General_options): Initialize endianness_.
2016 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2017 New options.
2018 (General_options::Endianness): New enum.
2019 (General_options::endianness): New method.
2020 (General_options::endianness_): New data member.
2021 * parameters.cc (Parameters::set_options): Check target endianness.
2022 (Parameters::set_target_once): Ditto.
2023 (Parameters::check_target_endianness): New method.
2024 (parameters_force_valid_target): If either -EL or -EB is specified,
2025 use it to define endianness of default target.
2026 * parameters.h (Parameters::check_target_endianness): New method
2027 declaration.
2028 * target.h (class Target): Change "endianity" to "endianness"
2029 in comments.
2030
efc8d4f2
RW
20312010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2032
2033 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2034 * configure: Regenerate.
2035 * Makefile.in: Regenerate.
2036 * testsuite/Makefile.in: Regenerate.
2037
be234d88
CC
20382010-04-06 Cary Coutant <ccoutant@google.com>
2039
2040 gcc PR lto/42757
2041 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2042 prevailing definitions of common symbols.
2043 * testsuite/plugin_test_6.sh: New test case.
2044 * testsuite/plugin_common_test_1.c: New test case.
2045 * testsuite/plugin_common_test_2.c: New test case.
2046 * testsuite/Makefile.am (plugin_test_6): New test case.
2047 * testsuite/Makefile.in: Regenerate.
2048
bd32c6bd
NC
20492010-04-06 Nick Clifton <nickc@redhat.com>
2050
2051 * po/vi.po: New Vietnamese translation.
2052
323c532f
DK
20532010-03-30 Doug Kwan <dougkwan@google.com>
2054
2055 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
2056
4fcd97eb
DK
20572010-03-25 Doug Kwan <dougkwan@google.com>
2058
2059 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
2060 to avoid a conversion warning on a 32-bit host.
2061
4ebf39db
ILT
20622010-03-24 Ian Lance Taylor <iant@google.com>
2063
2064 * testsuite/script_test_3.t: Add a TLS segment.
2065 * testsuite/Makefile.am (check_PROGRAMS): Add
2066 tls_phdrs_script_test.
2067 (tls_phdrs_script_test_SOURCES): Define.
2068 (tls_phdrs_script_test_DEPENDENCIES): Define.
2069 (tls_phdrs_script_test_LDFLAGS): Define.
2070 (tls_phdrs_script_test_LDADD): Define.
2071 * testsuite/Makefile.in: Rebuild.
2072
4a599bdd
CC
20732010-03-23 Cary Coutant <ccoutant@google.com>
2074
2075 * fileread.cc (find_or_make_view): Fix comment.
2076
6c93b22c
ILT
20772010-03-23 Ian Lance Taylor <iant@google.com>
2078
2079 * script-sections.cc (class Orphan_section_placement): Define
2080 PLACE_TLS and PLACE_TLS_BSS.
2081 (Orphan_section_placement::Orphan_section_placement): Initialize
2082 new places.
2083 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
2084 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
2085 (tls_script_test_SOURCES): Define.
2086 (tls_script_test_DEPENDENCIES): Define.
2087 (tls_script_test_LDFLAGS): Define.
2088 (tls_script_test_LDADD): Define.
2089 * testsuite/Makefile.in: Rebuild.
2090
a2c7281b
DK
20912010-03-22 Doug Kwan <dougkwan@google.com>
2092
2093 * arm.cc (Arm_relocate_functions::abs8,
2094 Arm_relocate_functions::abs16): Use correct check for overflow
2095 specified in the ARM ELF specs.
2096 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
2097 target of a BLX instruction specially.
2098 (Reloc_stub::stub_type_for_reloc): Ditto.
2099 (Relocate::relocate): Use symbolic names instead of numeric relocation
2100 codes to report error.
2101 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
2102 workaround.
2103 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
2104 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
2105 thumb2_blx_out_of_range.stdout
2106 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
2107 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
2108 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
2109 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
2110 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
2111 thumb2_blx_in_range, thumb2_blx_in_range.o,
2112 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
2113 thumb2_blx_out_of_range.o): New rules.
2114 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
2115 thumb2_blx_in_range and thumb2_blx_out_of_range.
2116 * testsuite/Makefile.in: Regenerate.
2117 * arm_branch_in_range.sh: Add tests for THUMB BLX.
2118 * testsuite/thumb_blx_in_range.s: New file.
2119 * testsuite/thumb_blx_out_of_range.s: New file.
2120
b0193076
RÁE
21212010-03-22 Rafael Espindola <espindola@google.com>
2122
2123 * archive.cc (Should_include): Move to archive.h.
2124 (should_include_member): Make it a member of Archive.
2125 (Lib_group): New.
2126 (Add_lib_group_symbols): New.
2127 * archive.h: Include options.h.
2128 (Archive_member): Moved from Archive.
2129 (Should_include): Moved from archive.cc.
2130 (Lib_group): New.
2131 (Add_lib_group_symbols): New.
2132 * dynobj.cc (do_should_include_member): New.
2133 * dynobj.h (do_should_include_member): New.
2134 * gold.cc (queue_initial_tasks): Update call to queue.
2135 * main.cc (main): Print lib group stats.
2136 * object.cc (do_should_include_member): New.
2137 * object.h: Include archive.h.
2138 (Object::should_include_member): New.
2139 (Object::do_should_include_member): New.
2140 (Sized_relobj::do_should_include_member): New.
2141 * options.cc (General_options::parse_start_lib): New.
2142 (General_options::parse_end_lib): New.
2143 (Input_arguments::add_file): Handle lib groups.
2144 (Input_arguments::start_group): Check we are not in a lib.
2145 (Input_arguments::start_lib): New.
2146 (Input_arguments::end_lib): New.
2147 * options.h (General_options): Add start_lib and end_lib.
2148 (Input_argument::lib_): New.
2149 (Input_argument::lib): New.
2150 (Input_argument::is_lib): New.
2151 (Input_file_lib): New.
2152 (Input_arguments::in_lib_): New.
2153 (Input_arguments::in_lib): New.
2154 (Input_arguments::start_lib): New.
2155 (Input_arguments::end_lib_): New.
2156 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
2157 in unused members as preempted.
2158 (Sized_pluginobj::do_should_include_member): New.
2159 * plugin.h (Sized_pluginobj::do_should_include_member): New.
2160 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
2161 return the blocker.
2162 (Read_symbols::do_whole_lib_group): New.
2163 (Read_symbols::do_lib_group): New.
2164 (Read_symbols::do_read_symbols): Handle lib groups.
2165 (Read_symbols::get_name): Handle lib groups.
2166 * readsyms.h (Read_symbols): Add an archive member pointer.
2167 (Read_symbols::do_whole_lib_group): New.
2168 (Read_symbols::do_lib_group): New.
2169 (Read_symbols::member_): New.
2170 * script.cc (read_input_script): Update call to queue_soon.
2171
d099120c
DK
21722010-03-19 Doug Kwan <dougkwan@google.com>
2173
2174 * arm.cc (Stub_table::Stub_table): Initialize new data members
2175 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2176 (Stub_table::add_reloc_stub): Assign stub offset and update
2177 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2178 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
2179 New data members.
2180 (Stub_table::update_data_size_and_addralign): Use
2181 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
2182 instead of going over all reloc stubs.
2183 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
2184 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2185 Stringpool_template::offset_ to size of Stringpool_char.
2186 (Stringpool_template::new_key_offset): Remove code to initialize
2187 Stringpool_template::offset_.
2188 * stringpool.h (Stringpool_template::set_no_zero_null): Set
2189 Stringpool_template::offset_ to zero.
2190
1aa37384
DK
21912010-03-15 Doug Kwan <dougkwan@google.com>
2192
2193 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2194 offset_.
2195 (Stringpool_template::new_key_offset): New method.
2196 (Stringpool_template::add_string): Assign offsets when adding new
2197 strings.
2198 (Stringpool_template::set_string_offsets): Do not set string offsets
2199 when not optimizing.
2200 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
2201 member size_.
2202 (Chunked_vector::clear): Clear size_.
2203 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
2204 (Chunked_vector::size): Return size_.
2205 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 2206 (Chunked_vector::size_): New data member.
1aa37384
DK
2207 (Stringpool_template::set_no_zero_null): Assert string set is empty.
2208 (Stringpool_template::new_key_offset): New method declaration.
2209 (Stringpool_template::offset_): New data member.
2210
b672b057
RÁE
22112010-03-15 Rafael Espindola <espindola@google.com>
2212
2213 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
2214 Add_symbols' constructor.
2215 * readsyms.h (Add_symbols): Remove the input_group member.
2216
b6848d3c
ILT
22172010-03-10 Ian Lance Taylor <iant@google.com>
2218
2219 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
2220 target to ask whether a reference to a symbol requires a stack
2221 split.
2222 * target.h (Target::is_call_to_non_split): New function.
2223 (Target::do_is_call_to_non_split): Declare virtual function.
2224 * target.cc: Include "symtab.h".
2225 (Target::do_is_call_to_non_split): New function.
2226 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
2227
a2a5469e
CC
22282010-03-10 Cary Coutant <ccoutant@google.com>
2229
2230 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
2231 (File_read::open[1]): Remove initial mapping of whole_file_view_.
2232 (File_read::open[2]): Add whole_file_view_ to list of views.
2233 (File_read::make_view): Remove test of whole_file_view_.
2234 (File_read::find_or_make_view): Create whole_file_view_ if
2235 necessary.
2236 (File_read::clear_views): Replace bool parameter with enum;
2237 adjust all callers. Don't delete views with permanent data;
2238 do delete cached views and views from archives if
2239 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
2240 if clearing the corresponding view.
2241 * fileread.h (File_read::Clear_views_mode): New enum.
2242 (File_read::View::is_permanent_view): New method.
2243 (File_read::clear_views): Replace bool parameter
2244 with enum; adjust all callers.
2245 * options.h (General_options): Change keep_files_mapped option;
2246 add map_whole_files.
2247 * readsyms.cc (Add_symbols::run): Delete sd_ object before
2248 releasing the file.
2249 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
2250 the file.
2251
8861f32b
DM
22522010-03-10 David S. Miller <davem@davemloft.net>
2253
2254 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
2255
d62d0f5f
ST
22562010-03-09 Sriraman Tallam <tmsriram@google.com>
2257
2258 * icf.cc (get_section_contents): Add '@' marker after processing the
2259 merge reloc.
2260
9177756d
DK
22612010-03-08 Doug Kwan <dougkwan@google.com>
2262
2263 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
2264 due to a conversion warning.
2265 (Arm_relobj::update_output_local_symbol_count): Check for local
2266 symbol with unset output index.
2267
9e9e071b
ILT
22682010-03-05 Ian Lance Taylor <iant@google.com>
2269
2270 * options.h (class General_options): Add --spare-dynamic-tags.
2271 * output.cc (Output_data_dynamic::set_final_data_size): Implement
2272 --spare-dynamic-tags.
2273
a81ee015
ILT
22742010-03-05 Ian Lance Taylor <iant@google.com>
2275
2276 * incremental.cc: Include "libiberty.h".
2277
44ec90b9
RO
22782010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
2279
2280 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
2281 function, is_info_ member.
2282 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
2283 (Versions::Versions): Update caller.
2284 (Versions::define_base_version): Likewise.
2285 (Versions::add_def): Likewise.
2286
0897ed3b
ST
22872010-03-03 Sriraman Tallam <tmsriram@google.com>
2288
2289 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
2290 (Scan::possible_function_pointer_reloc): New function.
2291 (Scan::local_reloc_may_be_function_pointer): Change to call
2292 possible_function_pointer_reloc.
2293 (Scan::global_reloc_may_be_function_pointer): Ditto.
2294 * icf.h (Icf::check_section_for_function_pointers): Change to reject
2295 relocations in ".data.rel.ro._ZTV" section.
2296 * testsuite/icf_safe_so_test.sh: Change to pass i386.
2297 * testsuite/icf_safe_so_test.cc: Ditto.
2298 * testsuite/icf_safe_test.cc: Ditto.
2299 * testsuite/icf_safe_test.sh: Ditto.
2300
d3bbad62
ILT
23012010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2302 Ian Lance Taylor <iant@google.com>
2303
2304 * target-reloc.h (relocate_section): Check the symbol table index
2305 for -1U before setting the local symbol index.
2306 (scan_relocatable_relocs): If copying the relocation, record that
2307 the local symbol is required.
2308 * object.h (Symbol_value::is_output_symtab_index_set): New
2309 function.
2310 (Symbol_value::may_be_discarded_from_output_symtab): New
2311 function.
2312 (Symbol_value::has_output_symtab_entry): New function.
2313 (Symbol_value::needs_output_symtab_entry): Remove.
2314 (Symbol_value::output_symtab_index): Make sure the symbol index is
2315 set.
2316 (Symbol_value::set_output_symtab_index): Make sure the symbol
2317 index is not set. Make sure the new index is valid.
2318 (Symbol_value::set_must_have_output_symtab_entry): New function.
2319 (Symbol_value::has_output_dynsym_entry): New function.
2320 (Symbol_value::set_output_dynsym_index): Make sure the new index
2321 is valid.
2322 (Sized_relobj::set_must_have_output_symtab_entry): New function.
2323 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
2324 local symbol if permitted.
2325 (Sized_relobj::do_finalize_local_symbols): Call
2326 is_output_symtab_index_set rather than needs_output_symtab_entry.
2327 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
2328 rather than needs_output_symtab_entry. Call
2329 has_output_dynsym_entry rather than needs_output_dynsym_entry.
2330 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
2331 is_output_symtab_index_set rather than needs_output_symtab_entry.
2332 * testsuite/discard_locals_relocatable_test.c: New file.
2333 * testsuite/discard_locals_test.sh: Test -r.
2334 * testsuite/Makefile.am (check_DATA): Add
2335 discard_locals_relocatable_test1.syms,
2336 discard_local_relocatable_test2.syms.
2337 (MOSTLYCLEANFILES): Likewise. Also add
2338 discard_locals_relocatable_test1.lout and
2339 discard_locals_relocatable_test2.out.
2340 (discard_locals_relocatable_test1.syms): New target.
2341 (discard_locals_relocatable_test.o): New target.
2342 (discard_locals_relocatable_test1.out): New target.
2343 (discard_locals_relocatable_test2.syms): New target.
2344 (discard_locals_relocatable_test2.out): New target.
2345 (various): Add missing ../ld-new dependencies.
2346 * testsuite/Makefile.in: Rebuild.
2347
7e8ccf26
NC
23482010-03-03 Nick Clifton <nickc@redhat.com>
2349
2350 * po/fi.po: New Finnish translation.
2351
2a0ff005
DK
23522010-03-01 Doug Kwan <dougkwan@google.com>
2353
2354 * layout.cc (Layout::Layout): Force section types of .init_array*,
2355 .preinit_array* and .fini_array* sections.
2356 * output.cc (Output_section::Input_section_sort_entry::has_priority):
2357 Fix check of return value of std::string::find.().
2358 (Output_section::Input_section_sort_compare::operator()): Remove
2359 comment about .init_array.
2360 (Output_section::Input_section_sort_init_fini_compare::operator()):
2361 New method.
2362 (Output_section::sort_attached_input_sections): Handle .init_array
2363 and .fini_array specially.
2364 * output.h (Output_section::Inut_section_sort_compare): Update
2365 comment.
2366 (Output_section::Input_section_sort_init_fini_compare): New struct.
2367
c3e4ae29
DK
23682010-02-26 Doug Kwan <dougkwan@google.com>
2369
2370 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
2371 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
2372 * testsuite/debug_msg.sh: Avoid matching source line number for
2373 use of global variable undef_int.
2374
2fd9ae7a
DK
23752010-02-26 Doug Kwan <dougkwan@google.com>
2376
2377 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
2378 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
2379 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
2380 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
2381 * options.cc (General_options::General_options): Initialize member
2382 fix_v4bx_.
2383 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
2384 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
2385 and rm_no_fix_v4bx.stdout
2386 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
2387 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
2388 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
2389 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
2390 and arm_no_fix_v4bx.
2391 * Makefile.in: Regenerate.
2392 * testsuite/arm_fix_v4bx.s: New file.
2393 * testsuite/arm_fix_v4bx.sh: Ditto.
2394
67ec7d0b
DK
23952010-02-24 Doug Kwan <dougkwan@google.com>
2396
2397 * arm.cc (Target_arm::got_section): Make the .got section the first
2398 non RELRO section in the data segment.
2399 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
2400 suffixes of section names.
2401
10165461
DK
24022010-02-24 Doug Kwan <dougkwan@google.com>
2403
2404 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
2405 flags and attributes merging if an input file is a binary file.
2406 * fileread.cc (Input_file::open): Record format of original file.
2407 * fileread.h (Input_file::Format): New enum type.
2408 (Input_file::Input_file): Initialize data member format_.
2409 (Input_file::format): New method definition.
2410 (Input_file::format_):: New data member.
2411
4a54abbb
DK
24122010-02-24 Doug Kwan <dougkwan@google.com>
2413
2414 * arm.cc (Arm_output_data_got): New class.
2415 (ARM_TCB_SIZE): New constant
2416 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
2417 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
2418 If user uses a script with a SECTIONS clause, issue only a warning
2419 for a misplaced EXIDX input section. Otherwise, issue an error.
2420 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
2421 garbage collection.
2422 (Target_arm::got_mode_index_entry): Handle static linking.
2423 (Target_arm::Scan::local): Ditto.
2424 (Target_arm::Scan::global): Ditto.
2425 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
2426 all incorrectly implemented relocations.
e1df38aa 2427 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
2428 Arm_output_section::fix_exidx_coverage.
2429 * layout.cc (Layout::section_name_mapping): Remove trailing dots
2430 from ".ARM.exidx." and ".ARM.extab.".
2431
ca419a6f
ILT
24322010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2433
2434 * arm.cc (Target_arm::do_finalize_sections): Create attribute
2435 section if it does not already exist.
2436 * attributes.cc (Attributes_section_data::Attributes_section_data):
2437 Don't crash if size is zero.
2438
135b9c78
ILT
24392010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2440 Ian Lance Taylor <iant@google.com>
2441
2442 * gold.cc (queue_middle_tasks): If no input files were opened,
2443 exit.
2444 * workqueue.h (Task_function::Task_function): Assert that there is
2445 a blocker.
2446
bb0bfe4f
DK
24472010-02-22 Doug Kwan <dougkwan@google.com>
2448
2449 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
2450 * icf.cc (get_section_contents): Cast snprintf arguments to long long
2451 types to avoid warnings due to different uint64_t implementations
2452 on different hosts.
2453
2a2b6d42
DK
24542010-02-21 Doug Kwan <dougkwan@google.com>
2455
2456 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
2457 handling of the maximum backward branch offset.
2458 (Arm_relocate_functions::thumb_branch_common): Ditto.
2459 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
2460 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 2461 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
2462 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
2463 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
2464 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
2465 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
2466 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
2467 thumb_bl_out_of_range thumb_bl_out_of_range.o,
2468 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
2469 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
2470 thumb2_bl_out_of_range.o): New rules.
2471 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
2472 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
2473 thumb2_bl_out_of_range
2474 * testsuite/Makefile.in: Regenerate.
2475 * testsuite/arm_bl_in_range.s: New file.
2476 * testsuite/arm_bl_out_of_range.s: Ditto.
2477 * testsuite/arm_branch_in_range.sh: Ditto.
2478 * testsuite/arm_branch_range.t: Ditto.
2479 * testsuite/thumb2_branch_range.t: Ditto.
2480 * testsuite/thumb_bl_in_range.s: Ditto.
2481 * testsuite/thumb_bl_out_of_range.s: Ditto.
2482 * testsuite/thumb_branch_range.t: Ditto.
2483
b487ad64
ST
24842010-02-20 Sriraman Tallam <tmsriram@google.com>
2485
2486 * gc.h (gc_process_relocs): Change vectors to point to the new list.
2487 Add reloc offset information.
2488 * icf.cc (get_section_contents): Change iterators to point to the new
2489 vectors. Add reloc offset information to the contents.
2490 * icf.h (Icf::Sections_reachable_info): New typedef.
2491 (Icf::Sections_reachable_list): New typedef.
2492 (Icf::Offset_info): New typedef.
2493 (Icf::Reloc_info): New struct typedef.
2494 (Icf::Reloc_info_list): New typedef.
2495 (Icf::symbol_reloc_list): Delete method.
2496 (Icf::addend_reloc_list): Delete method.
2497 (Icf::section_reloc_list): Delete method.
2498 (Icf::reloc_info_list): New method.
2499 (Icf::reloc_info_list_): New member.
2500
f96accdf
DK
25012010-02-19 Doug Kwan <dougkwan@google.com>
2502
2503 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
2504 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
2505 * arm.cc (Arm_relocation_functions): New forward declaration.
2506 (Target_arm::Target_arm): Initialize new data members
2507 got_mod_index_offset_ and tls_base_symbol_defined_.
2508 (Target_arm::Relocate::relocate_tls): New method.
2509 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
2510 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
2511 New methods.
2512 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
2513 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
2514 (Target_arm::got_mod_index_offset_,
2515 Target_arm::tls_base_symbol_defined_): New data members.
2516 (Target_arm::Scan::local, Target::Scan::global,
2517 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
2518 relocations.
2519
c8761b9a
DK
25202010-02-18 Doug Kwan <dougkwan@google.com>
2521
2522 * arm.cc (Arm_relobj::find_linked_text_section): New method.
2523 (Arm_relobj::make_exidx_input_section): Pass section index of linked
2524 text section as a parameter becuase some broken tools may not set
2525 the link in section header.
2526 (Target_arm::has_got_section): New method.
2527 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
2528 without any mapping symbol as data only. Remove warning.
2529 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
2530 link in its section header, try to discover the link by inspecting the
2531 REL31 relocation at the beginning of the section.
2532 (Target_arm::Scan::check_non_pic): Report name of offending relocation
2533 in error message.
2534 (Target_arm::Scan::global): Treat any reference to the symbol
2535 _GLOBAL_OFFSET_TABLE_ as a GOT access.
2536
21bb3914
ST
25372010-02-12 Sriraman Tallam <tmsriram@google.com>
2538
2539 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
2540 (Scan::global_reloc_may_be_function_pointer): New function.
2541 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2542 (Scan::global_reloc_may_be_function_pointer): New function.
2543 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2544 (Scan::global_reloc_may_be_function_pointer): New function.
2545 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
2546 (Scan::global_reloc_may_be_function_pointer): New function.
2547 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
2548 (Scan::global_reloc_may_be_function_pointer): New function.
2549 (Scan::possible_function_pointer_reloc): New function.
2550 (Target_x86_64::can_check_for_function_pointers): New function.
2551 * gc.h (gc_process_relocs): Scan relocation types to determine if
2552 function pointers were taken for targets that support it.
2553 * icf.cc (Icf::find_identical_sections): Include functions for
2554 folding in safe ICF whose pointer is not taken.
2555 * icf.h (Secn_fptr_taken_set): New typedef.
2556 (fptr_section_id_): New member.
2557 (section_has_function_pointers): New function.
2558 (set_section_has_function_pointers): New function.
2559 (check_section_for_function_pointers): New function.
2560 * options.h: Fix comment for safe ICF option.
2561 * target.h (can_check_for_function_pointers): New function.
2562 * testsuite/Makefile.am: Add icf_safe_so_test test case.
2563 Modify icf_safe_test for X86-64.
2564 * testsuite/Makefile.in: Regenerate.
2565 * testsuite/icf_safe_so_test.cc: New file.
2566 * testsuite/icf_safe_so_test.sh: New file.
2567 * testsuite/icf_safe_test.cc (kept_func_3): New function.
2568 (main): Change to take pointer to function kept_func_3.
2569 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
2570 folding is done correctly for X86-64.
2571
0da6fa6c
DM
25722010-02-12 David S. Miller <davem@davemloft.net>
2573
2574 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
2575 is_symbolless parameter.
2576 (Output_reloc<SHT_REL>::is_symbolless): New.
2577 (Output_reloc<SHT_REL>::is_symbolless_): New.
2578 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
2579 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
2580 (Output_reloc<SHT_RELA>::is_symbolless): New.
2581 (Output_data_reloc::add_global): Handle is_symbolless.
2582 (Output_data_reloc::add_global_relative): Likewise.
2583 (Output_data_reloc::add_local): Likewise.
2584 (Output_data_reloc::add_local_relative): Likewise.
2585 (Output_data_reloc::add_symbolless_global_addend): New.
2586 (Output_data_reloc::add_symbolless_local_addend): New.
2587 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
2588 is_symbolless.
2589 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
2590 instead of ->is_relative_
2591 (Output_reloc::write): Likewise.
2592 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
2593 (Output_reloc::write_rel): Simplify.
2594
2595 * sparc.cc (Target_sparc::Scan::local): Use
2596 ->add_symbolless_local_addend as needed.
2597 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
2598 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
2599 based upon relocation offset.
2600
e4782e83
DK
26012010-02-11 Doug Kwan <dougkwan@google.com>
2602
2603 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
2604 (Target_arm::Scan::global): Ditto. Also remove a comment before the
2605 beginning of function.
2606 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
2607 and MOVT_ABS relocations. Those are non issued in scanning. Fix
2608 parameter is_32bit in calls to should_apply_static_reloc.
2609 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
2610 (check_DATA): Add arm_abs_global.stdout.
2611 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
2612 arm_abs_global.stdout): New rules.
2613 (MOSTLLYCLEANFILES): Add arm_abs_global
2614 * Makefile.in: Regenerate.
2615 * testsuite/arm_abs_global.s: New file.
2616 * testsuite/arm_abs_global.sh: Ditto.
2617 * testsuite/arm_abs_lib.s: Ditto.
2618
93ceb764
ILT
26192010-02-11 Ian Lance Taylor <iant@google.com>
2620
2621 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
2622 Read_relocs task.
2623 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
2624 Allocate_commons_task first.
2625 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
2626 task, rather than symtab_lock_.
2627 (Gc_process_relocs::~Gc_process_relocs): New function.
2628 (Gc_process_relocs::is_runnable): Check this_blocker_.
2629 (Gc_process_relocs::locks): Use next_blocker_ rather than
2630 blocker_.
2631 (Scan_relocs::~Scan_relocs): New function.
2632 (Scan_relocs::is_runnable): Check this_blocker_ rather than
2633 symtab_lock_.
2634 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
2635 next_blocker_.
2636 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
2637 fields. Add this_blocker_ and next_blocker_ fields. Adjust
2638 constructor accordingly.
2639 (class Gc_process_relocs): Likewise.
2640 (class Scan_relocs): Likewise.
2641 * common.h (class Allocate_commons_task): Remove symtab_lock_
2642 field, and corresponding constructor parameter.
2643 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
2644 symtab_lock_.
2645 (Allocate_commons_task::locks): Likewise.
2646
114dfbe1
ILT
26472010-02-11 Ian Lance Taylor <iant@google.com>
2648
2649 * gold-threads.h (class Once): Define.
2650 (class Initialize_lock): Rewrite as child of Once.
2651 * gold-threads.cc (class Once_initialize): Define.
2652 (once_pointer_control): New static variable.
2653 (once_pointer, once_arg): New static variables.
2654 (c_run_once): New static function.
2655 (Once::Once, Once::run_once, Once::internal_run): New functions.
2656 (class Initialize_lock_once): Remove.
2657 (initialize_lock_control): Remove.
2658 (initialize_lock_pointer): Remove.
2659 (initialize_lock_once): Remove.
2660 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
2661 (Initialize_lock::initialize): Rewrite.
2662 (Initialize_lock::do_run_once): New function.
2663 * archive.cc (Archive::interpret_header): Only clear name if it is
2664 not already empty.
2665 * fileread.cc: Include "gold-threads.h"
2666 (file_counts_lock): New static variable.
2667 (file_counts_initialize_lock): Likewise.
2668 (File_read::release): Only increment counts when using --stats.
2669 Use a lock around the increment.
2670 * parameters.cc (class Set_parameters_target_once): Define.
2671 (set_parameters_target_once): New static variable.
2672 (Parameters::Parameters): Move here from parameters.h.
2673 (Parameters::set_target): Rewrite.
2674 (Parameters::set_target_once): New function.
2675 (Parameters::clear_target): Move here and rewrite.
2676 * parameters.h (class Parameters): Update declarations. Add
2677 set_parameters_target_once_ field.
2678 (Parameters::Parameters): Move to parameters.cc.
2679 (Parameters::clear_target): Likewise.
2680 * readsyms.cc (Read_symbols::do_group): Create a Start_group
2681 task.
2682 (Start_group::~Start_group): New function.
2683 (Start_group::is_runnable): New function.
2684 (Start_group::locks, Start_group::run): New functions.
2685 (Finish_group::run): Change saw_undefined to size_t.
2686 * readsyms.h (class Start_group): Define.
2687 (class Finish_group): Change saw_undefined_ field to size_t.
2688 (Finish_group::Finish_group): Remove saw_undefined and
2689 this_blocker parameters. Change all callers.
2690 (Finish_group::set_saw_undefined): New function.
2691 (Finish_group::set_blocker): New function.
2692 * symtab.h (class Symbol_table): Change saw_undefined to return
2693 size_t. Change saw_undefined_ field to size_t.
2694 * target-select.cc (Set_target_once::do_run_once): New function.
2695 (Target_selector::Target_selector): Initialize set_target_once_
2696 field. Don't initialize lock_ and initialize_lock_ fields.
2697 (Target_selector::instantiate_target): Rewrite.
2698 (Target_selector::set_target): New function.
2699 * target-select.h (class Set_target_once): Define.
2700 (class Target_selector): Update declarations. Make
2701 Set_target_once a friend. Remove lock_ and initialize_lock_
2702 fields. Add set_target_once_ field.
2703
fa17a3f4
ILT
27042010-02-10 Ian Lance Taylor <iant@google.com>
2705
2706 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
2707 queueing any tasks.
2708 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
2709 (queue_middle_tasks): Add all blockers before queueing any tasks.
2710 (queue_final_tasks): Likewise.
2711 * token.h (Task_token::add_blockers): New function.
2712 * object.h (Input_objects::number_of_relobjs): New function.
2713
c7177d31
ILT
27142010-02-10 Ian Lance Taylor <iant@google.com>
2715
5de0e392
ILT
2716 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
2717 shared, not if not position independent.
2718 * x86_64.cc (Relocate::relocate_tls): Likewise.
2719 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
2720 (tls_pie_pic_test): New target.
2721 * testsuite/Makefile.in: Rebuild.
2722
c7177d31
ILT
2723 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
2724 (tls_test_main_pie.o, tls_test_pie.o): New targets.
2725 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
2726 * testsuite/Makefile.in: Rebuild.
2727
684b268a
DM
27282010-02-09 David S. Miller <davem@davemloft.net>
2729
2730 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
2731 R_SPARC_RELATIVE using ->add_local_relative().
2732 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
2733
612a8d3d
DM
2734 * output.h (Output_data_dynamic::add_section_size): New method
2735 that takes two Output_data objects.
2736 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
2737 entry param. Handle it in initializers.
2738 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
2739 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
2740 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
2741 arg.
2742 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
2743 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
2744 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
2745 for dynrel_includes_plt.
2746 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2747 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2748 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
2749 before .rela.plt
2750 (Target_sparc::do_finalize_sections): Update to pass true for
2751 dynrel_includes_plt.
2752 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
2753 output before .rela.plt
2754 (Target_powerpc::do_finalize_sections): Update to pass true for
2755 dynrel_includes_plt when 32-bit.
2756
cb1be87e
DK
27572010-02-08 Doug Kwan <dougkwan@google.com>
2758
2759 * arm.cc (Arm_relobj::simple_input_section_output_address): New
2760 method.
2761 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
2762 Arm_relobj::scan_section_for_cortex_a8_stubs,
2763 Arm_relobj::do_relocation_section): Instead of calling
2764 Output_section::output_address, use faster
2765 Arm_relobj::simple_input_section_output_address.
2766
705b5121
DM
27672010-02-08 David S. Miller <davem@davemloft.net>
2768
2769 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
2770 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
2771 relocation helper function.
2772
024c4466
DM
2773 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
2774 just like R_SPARC_GOT{10,13,22}.
2775 (Target_sparc::Scan::local): Likewise.
2776 (Target_sparc::Relocate:relocate): Likewise.
2777
9109c078
ILT
27782010-02-06 Ian Lance Taylor <iant@google.com>
2779
2780 * configure.ac: Rewrite targetobjs duplicate removal code to use
2781 only shell constructs.
2782 * configure: Rebuild.
2783
cf846138
DK
27842010-02-05 Doug Kwan <dougkwan@google.com>
2785
2786 PR 11247
2787 * arm.cc (Arm_relobj::section_is_scannable): New method.
2788 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
2789 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
2790
6cfaf60b
DK
27912010-02-04 Doug Kwan <dougkwan@google.com>
2792
2793 PR 11247
2794 * arm-reloc-property.cc (cstdio): Include.
2795 * configure.ac (targetobjs): Remove duplicates.
2796 * configure: Regenerate.
2797 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
2798 big and little endian version for a given address size.
2799
5c57f1be
DK
28002010-02-03 Doug Kwan <dougkwan@google.com>
2801
2802 * arm-reloc-property.cc
2803 (Arm_reloc_property_table::reloc_name_in_error_message): New method
2804 definition.
2805 * arm-reloc-property.h
2806 (Arm_reloc_property_table::get_implemented_static_reloc_property):
2807 New method definition.
2808 (Arm_reloc_property_table::reloc_name_in_error_message): New method
2809 declaration.
2810 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
2811 overflow to N.
2812 (GOT_PREL): Change implemented to Y.
2813 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
2814 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
2815 (Arm_relocate_functions::movw_abs_nc): Remove method.
2816 (Arm_relocate_functions::movt_abs): Ditto.
2817 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
2818 (Arm_relocate_functions::thm_movt_abs): Ditto.
2819 (Arm_relocate_functions::movw_rel_nc): Ditto.
2820 (Arm_relocate_functions::movw_rel): Ditto.
2821 (Arm_relocate_functions::movt_rel): Ditto.
2822 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
2823 (Arm_relocate_functions:thm_movw_rel): Ditto.
2824 (Arm_relocate_functions:thm_movt_rel): Ditto.
2825 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
2826 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
2827 New method definitions.
2828 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
2829 (Arm_relocation_functions::arm_grp_ldr): Ditto.
2830 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
2831 (Arm_relocation_functions::arm_grp_ldc): Ditto.
2832 (Target_arm::Relocate::relocate): Check for non-static or
2833 unimplemented relocation code and exit early. Change calls to
2834 Target_arm::reloc_uses_thumb_bit and
2835 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
2836 instead. Refactor code to handle similar relocations to increase
2837 code sharing. Remove check for unsupported relocation code in switch
2838 statement.
2839 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
2840 relocation property table to find out size. Change error message to
2841 print out the name of a relocation code instead of the numeric value.
2842 (Target_arm::scan_reloc_for_stub): Use relocation property table
2843 instead of calling Target_arm::reloc_uses_thumb_bit().
2844
218c5831
DK
28452010-02-02 Doug Kwan <dougkwan@google.com>
2846
2847 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
2848 types of relaxed input section.
2849
0d31c79d
DK
28502010-02-02 Doug Kwan <dougkwan@google.com>
2851
2852 * Makefile.am (HFILES): Add arm-reloc-property.h.
2853 (DEFFILES): New.
2854 (TARGETSOURCES): Add arm-reloc-property.cc
2855 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
2856 (libgold_a_SOURCES): $(DEFFILES)
2857 * Makefile.in: Regenerate.
2858 * arm-reloc-property.cc: New file.
2859 * arm-reloc-property.h: New file.
2860 * arm-reloc.def: New file.
2861 * arm.cc: Update comments.
2862 (arm-reloc-property.h): New included header.
2863 (arm_reloc_property_table): New global variable.
2864 (Target_arm::do_select_as_default_target): New method definition.
2865 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
2866 arm-reloc-property to targ_extra_obj.
2867 * parameters.cc (set_parameters_target): Call
2868 Target::select_as_default_target().
2869 * target.h (Target::select_as_default_target): New method definition.
2870 (Target::do_select_as_default_target): Same.
2871
546c7457
DK
28722010-02-01 Doug Kwan <dougkwan@google.com>
2873
2874 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
2875 first_output_text_section_.
2876 (Arm_exidx_fixup::first_output_text_section): New method definition.
2877 (Arm_exidx_fixup::first_output_text_section_): New data member.
2878 (Arm_exidx_fixup::process_exidx_section): Record the first text
2879 output section seen.
2880 (Arm_output_section::fix_exidx_coverage): Set correct linked section
2881 and entsize in output section header.
2882
11b861d5
DK
28832010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2884
2885 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
2886 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
2887 (Arm_relocate_functions::thm_alu11): New Method.
2888 (Arm_relocate_functions::thm_pc8): New Method.
2889 (Arm_relocate_functions::thm_pc12): New Method.
2890 (Target_arm::Scan::local): Handle the relocations.
2891 (Target_arm::Scan::global): Likewise.
2892 (Target_arm::Relocate::relocate): Likewise.
2893 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2894
c9a2c125
DK
28952010-01-29 Doug Kwan <dougkwan@google.com>
2896
2897 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
2898 of relocation types as ld.
2899
1521477a
DK
29002010-01-29 Doug Kwan <dougkwan@google.com>
2901
2902 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
2903 to public.
2904 (Arm_relocate_functions::thumb_branch_common): Ditto.
2905 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
2906 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
2907 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
2908 Arm_relocate_functions::jump24): Remove.
2909 (Target_arm::Relocate::relocate): Adjust code to call
2910 Arm_relocation_functions::arm_branch_common and
2911 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 2912 wrappers. Merge switch-cases together to reduce source code size.
1521477a 2913
e7eca48c
DK
29142010-01-29 Doug Kwan <dougkwan@google.com>
2915
2916 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
2917 output_local_symbol_count_needs_update_.
2918 (Arm_relobj::output_local_symbol_count_needs_update,
2919 Arm_relobj::set_output_local_symbol_count_needs_update,
2920 Arm_relobj::update_output_local_symbol_count): New methods.
2921 (Arm_relobj::output_local_symbol_count_needs_update_): New data
2922 member.
2923 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
2924 of pointed function as in a R_ARM_PREL31 relocation.
2925 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
2926 for output local symbol count updating.
2927 (Target_arm::do_relax): Update output local symbol counts in objects
2928 if necessary.
2929 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
2930
02961d7e
ILT
29312010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2932
2933 * arm.cc: Added support for the ARM relocations:
2934 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
2935 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
2936 (Arm_relocate_functions::movw_rel_nc): Renamed (was
2937 movw_prel_nc).
2938 (Arm_relocate_functions::movw_rel): New method.
2939 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
2940 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
2941 thm_movw_prel_nc).
2942 (Arm_relocate_functions::thm_movw_rel): New method.
2943 (Arm_relocate_functions::thm_movt_rel): Renamed (was
2944 thm_movt_prel).
2945 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
2946 relocations.
2947 (Target_arm::Scan::global): Likewise.
2948 (Target_arm::Relocate::relocate): Likewise.
2949 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2950 Likewise.
2951
b10d2873
ILT
29522010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2953
2954 * arm.cc: Added support for ARM group relocations.
2955 (Target_arm::reloc_needs_sym_origin): New method.
2956 (Arm_relocate_functions::calc_grp_kn): New method.
2957 (Arm_relocate_functions::calc_grp_residual): New method.
2958 (Arm_relocate_functions::calc_grp_gn): New method.
2959 (Arm_relocate_functions::arm_grp_alu): New Method.
2960 (Arm_relocate_functions::arm_grp_ldr): New Method.
2961 (Arm_relocate_functions::arm_grp_ldrs): New Method.
2962 (Arm_relocate_functions::arm_grp_ldc): New Method.
2963 (Target_arm::Scan::local): Handle the ARM group relocations.
2964 (Target_arm::Scan::global): Likewise.
2965 (Target_arm::Relocate::relocate): Likewise.
2966 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2967 Likewise.
2968
2b328d4e
DK
29692010-01-26 Doug Kwan <dougkwan@google.com>
2970
2971 * arm.cc (set): Include.
2972 (class Arm_exidx_fixup): Change type of last_input_section_ to const
2973 pointer type.
2974 (Arm_output_section::Text_section_list): New type.
2975 (Arm_output_section::append_text_sections_to_list): New method.
2976 (Arm_output_section::fix_exidx_coverage): Ditto.
2977 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2978 (Arm_relobj::convert_input_section_to_relaxed_section): Use
2979 Relobj::set_section_offset() instead of
2980 Sized_relobj::invalidate_section_offset().
2981 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2982 parameter for section headers. Ignore relocation sections for
2983 unallocated sections and EXIDX sections.
2984 (Target_arm::fix_exidx_coverage): New method.
2985 (Target_arm::output_section_address_less_than): New type.
2986 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
2987 linked text section instead of the EXIDX section.
2988 (Arm_output_section::create_stub_group): Add an assertion to check
2989 that this is not an EXIDX output section.
2990 (Arm_output_section::append_text_sections_to_list): New method.
2991 (Arm_output_section::fix_exidx_coverage): Ditto.
2992 (Arm_relobj::scan_sections_for_stubs): Adjust call to
2993 Arm_relobj::section_needs_reloc_stub_scanning.
2994 (Target_arm::do_relax): Fix EXIDX output section coverage in the
2995 first pass.
2996 (Target_arm::fix_exidx_coverage): New method.
2997 * object.h (Relobj::set_output_section): New method.
2998 (Sized_relobj::invalidate_section_offset): Remove method.
2999 (Sized_relobj::do_invalidate_section_offset): Remove method.
3000 (Sized_relobj::do_set_section_offset): Handle offset value -1.
3001
c7f3c371
DK
30022010-01-25 Doug Kwan <dougkwan@google.com>
3003
3004 * arm.cc (Arm_exidx_merged_section::do_output_offset):
3005 Fix warning due to signed and unsigned comparison on a 32-bit host.
3006
8923b24c
DK
30072010-01-22 Doug Kwan <dougkwan@google.com>
3008
3009 * arm.cc (Target_arm::do_relax): Record an output section for section
3010 offset adjustment it contains any stub table that has changed.
3011 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3012 offsets in an output section if necessary.
3013 * output.cc (Output_section::Output_section): Initialize
3014 section_offsets_need_adjustments_.
3015 (Output_section::add_input_section_for_script): Renamed to
3016 Output_section::add_simple_input_section.
3017 (Output_section::save_states): Add a comment.
3018 (Output_section::discard_states): New method defintion.
3019 (Output_section::adjust_section_offsets): Same.
3020 * output.h (Output_section::add_input_section_for_script): Renamed to
3021 Output_section::add_simple_input_section.
3022 (Output_section::discard_states): New method declaration.
3023 (Output_section::adjust_section_offsets): Same.
3024 (Output_section::section_offsets_need_adjustment,
3025 Output_section::set_section_offsets_need_adjustment): New method
3026 definitions.
3027 (Output_section::section_offsets_need_adjustment_): New data member.
3028 * script-sections.cc
3029 (Output_section_element_input::set_section_address): Adjust code for
3030 renaming of Output_section::add_input_section_for_script.
3031 (Orphan_output_section::set_section_address): Same.
3032
9b2fd367
DK
30332010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3034
3035 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3036 Fix_v4bx enum values .
3037 * gold/options.h (General_options): New option definitions.
3038 (General_options::fix_v4bx): New method.
3039 (General_options::Fix_v4bx): New enum.
3040 * gold/options.cc (General_options::parse_fix_v4bx): New method.
3041 (General_options::parse_fix_v4bx_interworking): New method.
3042
80d0d023
DK
30432010-01-22 Doug Kwan <dougkwan@google.com>
3044
3045 * arm.cc (Arm_exidx_fixup): New class.
3046
af2cdeae
DK
30472010-01-21 Doug Kwan <dougkwan@google.com>
3048
3049 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3050 classes.
3051 (Arm_exidx_section_offset_map): New type.
3052
993d07c1
DK
30532010-01-21 Doug Kwan <dougkwan@google.com>
3054
3055 * arm.cc (Arm_exidx_input_section): New class.
3056 (Arm_relobj::exidx_input_section_by_link,
3057 Arm_relobj::exidx_input_section_by_shndx,
3058 Arm_relobj::make_exidx_input_section): New methods.
3059 (read_arm_attributes_section): Remove.
3060 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
3061 information about them.
3062 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
3063 to here.
3064
5ac169d4
DK
30652010-01-20 Doug Kwan <dougkwan@google.com>
3066
3067 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
3068 Input_section_specifier to Section_id.
3069 (Target_arm::new_arm_input_section: Adjust code for change of key
3070 type.
3071 (Target_arm::find_arm_input_section): Ditto.
3072 * gc.h (object.h): Include for Section_id nand Section_id_hash.
3073 (Section_id): Remove.
3074 (Garbage_collection::Section_id_hash): Remove.
3075 * icf.h (object.h): Include for Section_id nand Section_id_hash.
3076 (Section_id): Remove.
3077 (Icf::Section_id_hash): Remove.
3078 * object.h (Section_id, Const_section_id, Section_id_hash,
3079 Const_section_id_hash): New type definitions.
3080 * output.cc (Output_section::add_relaxed_input_section): Change to
3081 use Const_section_id instead of Input_section_specifier as key type.
3082 (Output_section::add_merge_input_section): Ditto.
3083 (Output_section::build_relaxation_map): Change to use Section_id
3084 instead of Input_section_specifier as key type.
3085 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3086 Ditto.
3087 (Output_section::convert_input_sections_to_relaxed_sections): Change
3088 to use Const_section_id instead of Input_section_specifier as key type.
3089 (Output_section::find_merge_section): Ditto.
3090 (Output_section::find_relaxed_input_section): Ditto.
3091 * output.h (Input_section_specifier): Remove class.
3092 (Output_section::Output_section_data_by_input_section_map): Change
3093 key type to Const_section_id.
3094 (Output_section::Output_relaxed_input_section_by_input_section_map):
3095 Ditto.
3096 (Output_section::Relaxation_map): Change key type to Section_id.
3097
a2162063
ILT
30982010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3099
3100 * gold/arm.cc: Added support for R_ARM_V4BX relocation
3101 (class Arm_v4bx_stub): New class.
3102 (DEF_STUBS): Updated definition to support v4_veneer_bx.
3103 (Stub_factory::make_arm_v4bx_stub): New method.
3104 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
3105 (Stub_table::empty): Handle v4bx stubs.
3106 (Stub_table::add_arm_v4bx_stub): New method.
3107 (Stub_table::find_arm_v4bx_stub): New method.
3108 (Arm_relocate_functions::v4bx): New method.
3109 (Target_arm::fix_v4bx): New method.
3110 (Target_arm::Target_arm): Handle R_ARM_V4BX.
3111 (Stub_table::relocate_stubs): Likewise.
3112 (Stub_table::do_write): Likewise.
3113 (Stub_table::update_data_size_and_addralign): Likewise.
3114 (Stub_table::finalize_stubs): Likewise.
3115 (Target_arm::Scan::local): Likewise.
3116 (Target_arm::Scan::global): Likewise.
3117 (Target_arm::do_finalize_sections): Likewise.
3118 (Target_arm::Relocate::relocate): Likewise.
3119 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3120 Likewise.
3121 (Target_arm::scan_reloc_for_stub): Likewise.
3122 (Target_arm::scan_reloc_section_for_stubs): Likewise.
3123
5696ab0b
ILT
31242010-01-19 Ian Lance Taylor <iant@google.com>
3125
3126 * output.cc (Output_section_headers::do_sized_write): Write large
3127 segment count to sh_info field.
3128 (Output_file_header::do_sized_write): For large segment count,
3129 write PN_XNUM to e_phnum field.
3130
800d0f56
ILT
31312010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3132
3133 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
3134 (Arm_relocate_functions::thm_jump8): New function.
3135 (Arm_relocate_functions::thm_jump11): New function.
3136 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
3137 R_ARM_THM_JUMP11.
3138 (Target_arm::Scan::global): Likewise.
3139 (Target_arm::Relocate::relocate): Likewise.
3140 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3141 Likewise.
3142
41263c05
DK
31432010-01-14 Doug Kwan <dougkwan@google.com>
3144
3145 * arm.cc (map, utility): Include headers.
3146 (Target_arm::apply_cortex_a8_workaround): New method.
3147 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
3148 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
3149 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
3150 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
3151 the --[no-]fix-cortex-a8 command line options.
3152 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
3153 (Target_arm::relocate_stub): Use addend in instruction template.
3154 * options.h (DEFINE_bool): Set the user-set flag.
3155 (General_options): Add --[no-]-fix-cortex options.
3156 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 3157 : Update fast look-up map after conversion.
41263c05 3158
459e9b03
ST
31592010-01-14 Sriraman Tallam <tmsriram@google.com>
3160
3161 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
3162 in the first pass of do_layout.
3163
b521dfe4
DK
31642010-01-13 Doug Kwan <dougkwan@google.com>
3165
3166 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3167 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
3168 apparent compiler problem of not folding static constant integral
3169 data members of elfcpp::Elf_sizes<32>.
3170
44272192
DK
31712010-01-13 Doug Kwan <dougkwan@google.com>
3172
3173 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3174 Arm_relobj::section_needs_cortex_a8_stub_scanning,
3175 Arm_relobj::scan_section_for_cortex_a8_erratum,
3176 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
3177 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
3178 sections to scan for relocation stubs into a new method
3179 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
3180 relocation and Cortex-A8 stub scanning.
3181 (Target_arm::do_relax): Force stubs to be after stubbed sections
3182 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 3183 the beginning of a new relaxation pass. Update a comment.
44272192
DK
3184 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
3185
44b71ece
ILT
31862010-01-12 Ian Lance Taylor <iant@google.com>
3187
3188 * target-reloc.h (visibility_error): New inline function.
3189 (relocate_section): Call visibility_error.
3190 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
3191 (MOSTLYCLEANFILES): Likewise.
3192 (protected_4_pic.o, protected_3.err): New targets.
3193 * testsuite/protected_4.cc: New file.
3194
a120bc7f
DK
31952010-01-12 Doug Kwan <dougkwan@google.com>
3196
3197 * arm.cc (Cortex_a8_reloc): New class.
3198 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
3199 and cortex_a8_relocs_info_.
3200 (Target_arm::fix_cortex_a8): New method definition.
3201 (Target_arm::Cortex_a8_relocs_info): New type.
3202 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
3203 New data member declarations.
3204 (Target_arm::scan_reloc_for_stub): Record information about
3205 relocations for THUMB branches that might be exempted from the
3206 Cortex-A8 workaround.
3207 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
3208 at the beginning of a relaxation pass.
3209
20138696
DK
32102010-01-12 Doug Kwan <dougkwan@google.com>
3211
3212 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
3213 (Arm_relobj::Mapping_symbol_position,
3214 Arm_reloj::Mapping_symbol_position_less,
3215 Arm_relobj::Mapping_symbols_info): New types.
3216 (Target_arm::is_mapping_symbol_name): New method definition.
3217 (Arm_relobj::do_count_local_symbols): Save information about mapping
3218 symbols.
3219
089d69dc
DK
32202010-01-11 Doug Kwan <dougkwan@google.com>
3221
3222 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
3223 Arm_relocate_functions::thumb32_branch_upper,
3224 Arm_relocate_functions::thumb32_branch_lower,
3225 Arm_relocate_functions::thumb32_cond_branch_offset,
3226 Arm_relocate_functions::thumb32_cond_branch_upper,
3227 Arm_relocate_functions::thumb32_cond_branch_lower,
3228 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
3229 branch offset encoding.
3230 (Arm_relocate_functions::thumb_branch_common): Use new branch
3231 offset encoding methods to avoid code duplication.
3232 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
3233 (Stub_addend_reader::operator()): Use new branch encoding method
3234 to avoid code duplication.
3235
99e5bff2
DK
32362010-01-11 Doug Kwan <dougkwan@google.com>
3237
3238 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
3239 (Target_arm::do_finalize_sections): Define special EXIDX section
3240 symbols only if referenced.
3241 * gc.h (Garbage_collection::add_reference): New method.
3242 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
3243 code duplication.
3244
98e090bd
ILT
32452010-01-11 Ian Lance Taylor <iant@google.com>
3246
d0a91bd8
ILT
3247 * script.cc (Version_script_info::build_expression_list_lookup):
3248 Change complaing about duplicate wildcard match from error to
3249 warning.
3250
98e090bd
ILT
3251 * script.cc (class Lazy_demangler): Recreate--revert part of patch
3252 of 2009-12-30.
3253 (Version_script_info::Version_script_info): Initialize globs_,
3254 default_version_, default_is_global_, and exact_. Don't
3255 initialize globals_ or locals_.
3256 (Version_script_info::build_lookup_tables): Build local symbols
3257 first.
3258 (Version_script_info::unquote): New function.
3259 (Version_script_info::add_exact_match): New function.
3260 (Version_script_info::build_expression_list_lookup): Remove lookup
3261 parameter. Add is_global parameter. Change all callers. Handle
3262 wildcard pattern specially. Unquote pattern. Call
3263 add_exact_match.
3264 (Version_script_info::get_name_to_match): New function.
3265 (Version_script_info::get_symbol_version): New function.
3266 (Version_script_info::get_symbol_version_helper): Remove.
3267 (Version_script_info::check_unmatched_names): Call unquote.
3268 * script.h (class Version_script_info): Change get_symbol_version
3269 to be non-inline and add is_global parameter; change all callers.
3270 Rewrite symbol_is_local. Update declarations. Define struct
3271 Version_tree_match, Exact, Globs. Don't define struct Lookup.
3272 Remove globals_ and locals_ members. Add exact_, globs_,
3273 default_version_, is_global_.
3274 (Version_script_info::Glob): Remove pattern, add expression and
3275 is_global. Update constructor. Change all callers.
3276 * dynobj.cc (Versions::finalize): Mark the version symbol as the
3277 default version.
3278 (Versions::symbol_section_contents): If a symbol is undefined, or
3279 defined in a dynamic object, set the version index to
3280 VER_NDX_LOCAL.
3281 * symtab.cc (Symbol_table::add_from_relobj): Don't call
3282 symbol_is_local.
3283 (Symbol_table::add_from_pluginobj): Likewise.
3284 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
3285
d56962d3
DK
32862010-01-11 Doug Kwan <dougkwan@google.com>
3287
3288 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
3289 (incremental_dump_LDADD): Add linking option for libintl.
3290 * Makefile.in: Regenerate.
3291
94e6ee91
L
32922010-01-11 H.J. Lu <hongjiu.lu@intel.com>
3293
3294 PR gold/11144
3295 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
3296 instead of -Ds.
3297 * testsuite/Makefile.in: Regenerated.
3298
e96c574b
DK
32992010-01-10 Doug Kwan <dougkwan@google.com>
3300
3301 * options.h (DEFINE_var): Use parentheses around argument varname__
3302 in macro body to avoid any unintended subsequent substitutions.
3303
7198066b
ILT
33042010-01-10 Ian Lance Taylor <iant@google.com>
3305
ba4d53bf
ILT
3306 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
3307 candidates before doing symbol resolution.
3308
7198066b
ILT
3309 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
3310 ODR candidates if only one is weak.
3311
a2beed37
ILT
33122010-01-08 Ian Lance Taylor <iant@google.com>
3313
3314 * script.cc (Version_script_info::build_expression_list_lookup):
3315 Don't warn about ambiguous version, just record the ambiguity.
3316 (Version_script_info::get_symbol_version_helper): Give error if
3317 version is ambiguous.
3318
2fb7225c
DK
33192010-01-08 Doug Kwan <dougkwan@google.com>
3320
3321 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
3322 prev_data_size_ and prev_addralign_. Remove initializer for
3323 deleted data member has_been_changed_.
3324 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
3325 to determine if the table is empty.
3326 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
3327 Remove.
3328 (Stub_table::add_reloc_stub): Define method in class definition
3329 instead of just declaring it there.
3330 (Stub_table::add_cortex_a8_stub): New method definition.
3331 (Stub_table::update_data_size_and_addralign): Ditto.
3332 (Stub_table::finalize_stubs): Ditto.
3333 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
3334 (Stub_table::do_addralign_): Return address alignment in the
3335 (Stub_table::do_reset_address_and_file_offset): Define method in
3336 class definition instead of declaring it there. Set current data
3337 size to be the data size of the previous pass.
3338 (Stub_table::set_final_data_size): Use current data size as the
3339 final data size.
3340 (Stub_table::relocate_stub): Change parameter type of stub from
3341 Reloc_stub pointer to Stub pointer.
3342 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
3343 (Stub_table::Cortex_a8_stub_list): New typedef.
3344 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
3345 Stub_table::prev_addralign_): New data member.
3346 (Arm_relobj::Arm_relobj): Initialize data member
3347 section_has_cortex_a8_workaround_.
3348 (Arm_relobj::section_has_cortex_a8_workaround,
3349 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
3350 definitions.
3351 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
3352 declarations.
3353 (Target_arm::relocate_stub): Change parameter type of stub from
3354 Reloc_stub pointer to Stub pointer.
3355 (Insn_template::size, Insn_template::alignment): Handle
3356 THUMB16_SPECIAL_TYPE.
3357 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
3358 Stub_table::update_data_size_and_addralign,
3359 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
3360 definitions.
3361 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
3362 (Stub_table::do_write): Ditto.
3363 (Target_arm::do_relax): Adjust code for changes in Stub_table.
3364
880cd20d
ILT
33652010-01-08 Ian Lance Taylor <iant@google.com>
3366
3367 PR 11108
3368 * symtab.h (class Symbol): Remove fields is_target_special_ and
3369 has_plt_offset_. Add field is_defined_in_discarded_section_.
3370 (Symbol::is_defined_in_discarded_section): New function.
3371 (Symbol::set_is_defined_in_discarded_section): New function.
3372 (Symbol::has_plt_offset): Rewrite.
3373 (Symbol::set_plt_offset): Verify that new offset is not -1U.
3374 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
3375 Don't initialize is_target_special_ or has_plt_offset_.
3376 Initialize is_defined_in_discarded_section_.
3377 (Symbol_table::add_from_relobj): If appropriate, set
3378 is_defined_in_discarded_section.
3379 * resolve.cc (Symbol::override_base_with_special): Don't test
3380 is_target_special_. Change has_plt_offset_ to has_plt_offset().
3381 * target-reloc.h (relocate_section): Do special handling for
3382 symbols defined in discarded sections for global symbols as well
3383 as local symbols.
3384
2703e3eb
ILT
33852010-01-08 Ian Lance Taylor <iant@google.com>
3386
3387 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
3388 the SHT_SYMTAB case.
3389
339d40a3
ILT
33902010-01-08 Ian Lance Taylor <iant@google.com>
3391
3392 * object.cc (Sized_relobj::do_layout): Don't get confused if
3393 layout_eh_frame returns NULL.
3394
abecea76
ILT
33952010-01-08 Ian Lance Taylor <iant@google.com>
3396
3397 PR 11084
3398 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
3399 dynamic symbol table, use the normal symbol table.
3400 (Sized_dynobj::do_read_symbols): Remove assertion about type of
3401 symbol table.
3402
6b7dd3f3
ILT
34032010-01-08 Ian Lance Taylor <iant@google.com>
3404
3405 PR 11072
3406 * layout.cc (Layout::include_section): Remove .gnu_debuglink
3407 sections.
3408
36c50e63
L
34092010-01-08 H.J. Lu <hongjiu.lu@intel.com>
3410
3411 * version.cc (print_version): Change to "Copyright 2010".
3412
e291e7b9
ILT
34132010-01-08 Ian Lance Taylor <iant@google.com>
3414
3415 PR 10287
3416 PR 11063
3417 * i386.cc (class Target_i386): Change return type of plt_section
3418 to be non-const.
3419 (class Output_data_plt_i386): Add tls_desc_rel_ field.
3420 (Output_data_plt_i386::Output_data_plt_i386): Initialize
3421 tls_desc_rel_ field.
3422 (Output_data_plt_i386::rel_tls_desc): New function.
3423 (Target_i386::rel_tls_desc_section): New function.
3424 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
3425 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
3426 R_386_TLS_DESC reloc in rel_tls_desc_section.
3427 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
3428 Define struct Tlsdesc_info.
3429 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
3430 (Target_x86_64::do_reloc_symbol_index): New function.
3431 (Target_x86_64::add_tlsdesc_info): New function.
3432 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
3433 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
3434 tlsdesc_rel_ field.
3435 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
3436 all callers.
3437 (Output_data_plt_x86_64::rela_tlsdesc): New function.
3438 (Target_x86_64::rela_tlsdesc_section): New function.
3439 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
3440 handling.
3441 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
3442 (Target_x86_64::do_reloc_addend): New function.
3443 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
3444 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
3445 declarations. Define TARGET_CODE. Add arg field to u1_ union.
3446 (Output_reloc::type): New function.
3447 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
3448 (Output_reloc::is_target_specific): New function.
3449 (Output_reloc::target_arg): New function.
3450 (class Output_reloc) [SHT_RELA]: Add four new constructors for
3451 absolute relocs and target specific relocs.
3452 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
3453 add_target_specific.
3454 (class Output_data_reloc) [SHT_RELA]: Likewise.
3455 * output.cc (Output_reloc::Output_reloc): Add four new versions
3456 for absolute relocs and target specific relocs.
3457 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
3458 (Output_reloc::get_symbol_index): Likewise.
3459 (Output_reloc::local_section_offset): Check that local_sym_index_
3460 is not TARGET_CODE or 0.
3461 (Output_reloc::symbol_value): Likewise.
3462 (Output_reloc::write) [SHT_RELA]: Call target for target specific
3463 reloc.
3464 * target.h (class Target): Add reloc_symbol_index and reloc_addend
3465 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
3466 functions.
3467 * layout.cc (add_target_dynamic_tags): Use output section for
3468 DT_PLTRELSZ and DT_JMPREL.
3469
3a44184e
ILT
34702010-01-07 Ian Lance Taylor <iant@google.com>
3471
3472 PR 11061
3473 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
3474 function.
3475 (class Output_data_reloc_generic): Define.
3476 (class Output_data_reloc_base): Change base class to
3477 Output_data_reloc_generic. Change add() method to call
3478 bump_relative_reloc_count for a relative reloc. Remove
3479 sort_relocs_ field.
3480 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
3481 to sort_relocs().
3482 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
3483 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
3484 appropriate.
3485 * layout.h (class Layout): Update declaration.
3486
ea715a34
ILT
34872010-01-07 Ian Lance Taylor <iant@google.com>
3488
3489 * output.h (class Output_data): Add const version of
3490 output_section and do_output_section.
3491 (class Output_section_data): Add const version of
3492 do_output_section.
3493 (class Output_section): Likewise.
3494 * layout.cc (Layout::add_target_dynamic_tags): New function.
3495 * layout.h (class Layout): Update declarations.
3496 * arm.cc (Target_arm::do_finalize_sections): Use
3497 add_target_dynamic_tags.
3498 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3499 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3500 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3501 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3502
659948a4
ILT
35032010-01-07 Ian Lance Taylor <iant@google.com>
3504
3505 PR 11042
3506 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
3507 object as needed.
3508
9d3b86f6
ILT
35092010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
3510 Ian Lance Taylor <iant@google.com>
3511
3512 PR 11019
3513 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
3514 Xindex::read_symtab_xindex.
3515
bb0d3eb0
DK
35162010-01-07 Doug Kwan <dougkwan@google.com>
3517
3518 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
3519 (Insn_template::thumb16_bcond_insn): New method declaration.
3520 (Insn_template): Fix spelling.
3521 (Stub::thumb16_special): New method declaration.
3522 (Stub::do_write): Define virtual method which was previously pure
3523 virtual.
3524 (Stub::do_thumb16_special): New method declaration.
3525 (Stub::do_fixed_endian_write): New template member.
3526 (Reloc_stub::do_write): Remove.
3527 (Reloc_stub::do_fixed_endian_write): Remove.
3528 (Cortex_a8_stub): New class definition.
3529 (Stub_factory::make_cortex_a8_stub): New method definition.
3530 (Stub_factory::Stub_factory): Add missing static storage class
3531 qualifier for elf32_arm_stub_a8_veneer_blx.
3532
ffeef7df
ILT
35332010-01-07 Ian Lance Taylor <iant@google.com>
3534
dc3f80fe
ILT
3535 PR 10980
3536 * options.h (class General_options): Add --warn-unresolved-symbols
3537 and --error-unresolved-symbols.
3538 * errors.cc (Errors::undefined_symbol): Implement
3539 --warn-unresolved-symbols.
3540
ffeef7df
ILT
3541 * options.h (class General_options): Add -z text and -z textoff.
3542 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
3543
f1ec9ded
ST
35442010-01-06 Sriraman Tallam <tmsriram@google.com>
3545
3546 * gc.h (Garbage_collection::Cident_section_map): New typedef.
3547 (Garbage_collection::cident_sections): New function.
3548 (Garbage_collection::add_cident_section): New function.
3549 (Garbage_collection::cident_sections_): New member.
3550 (gc_process_relocs): Add references to sections whose names are C
3551 identifiers.
3552 * gold.h (cident_section_start_prefix): New constant.
3553 (cident_section_stop_prefix): New constant.
3554 (is_cident): New function.
3555 * layout.cc (Layout::define_section_symbols): Replace string constants
3556 with the newly defined constants.
3557 * object.cc (Sized_relobj::do_layout): Track sections whose names are
3558 C identifiers.
3559 * testsuite/Makefile.am: Add gc_orphan_section_test.
3560 * testsuite/Makefile.in: Regenerate.
3561 * testsuite/gc_orphan_section_test.cc: New file.
3562 * testsuite/gc_orphan_section_test.sh: New file.
3563
6eda8c29
ILT
35642010-01-06 Ian Lance Taylor <iant@google.com>
3565
b9674e17
ILT
3566 PR 10980
3567 * options.h (class General_options): Add --warn-shared-textrel.
3568 * layout.cc (Layout::finish_dynamic_section): Implement
3569 --warn-shared-textrel.
3570
6eda8c29
ILT
3571 PR 10980
3572 * options.h (class General_options): Add --warn-multiple-gp.
3573
32dcd44e
ILT
35742010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3575
3576 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
3577 $(THREADSLIB) and $(LIBDL).
3578 * Makefile.in: Rebuild.
3579
a192ba05
ILT
35802010-01-06 Ian Lance Taylor <iant@google.com>
3581
3582 PR 10980
3583 * options.cc (General_options::parse_section_start): New function.
3584 (General_options::section_start): New function.
3585 (General_options::General_options): Initialize all members.
3586 * options.h: Include <map>
3587 (class General_options): Add --section-start. Add section_starts_
3588 member.
3589 * layout.cc (Layout::attach_allocated_section_to_segment): If
3590 --section-start was used, set the address of the segment. Remove
3591 local sort_sections.
3592 (Layout::relaxation_loop_body): If the address of the load segment
3593 has been set by --section-start, don't use it.
3594 * output.h (Output_segment::update_flags_for_output_section): New
3595 function.
3596 * output.cc (Output_segment::add_output_section): Call
3597 update_flags_for_output_section.
3598
dde3f402
ILT
35992010-01-05 Ian Lance Taylor <iant@google.com>
3600
62dfdd4d
ILT
3601 PR 10980
3602 * options.h (class General_options): Add --undefined-version.
3603 * script.cc (struct Version_expression): Add was_matched_by_symbol
3604 field.
3605 (Version_script_info::matched_symbol): New function.
3606 (Version_script_info::get_symbol_version_helper): Call
3607 matched_symbol.
3608 (Version_script_info::check_unmatched_names): New function.
3609 * script.h (class Version_script_info): Update declarations.
3610 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
3611
9c4ae156
ILT
3612 * options.h (class General_options): Use DEFINE_bool_alias for
3613 allow_multiple_definition.
3614 * resolve.cc (Symbol_table::should_override): Don't test
3615 allow_multiple_definition.
3616
dde3f402
ILT
3617 PR 10980
3618 * options.h (class General_options): Add --cref.
3619 * main.cc (main): Print cref table if --cref. Don't close mapfile
3620 until after printing cref table.
3621 * cref.cc: Include "symtab.h".
3622 (class Cref_inputs): Define Cref_table_compare and Cref_table.
3623 (Cref_table_compare::operator()): New function.
3624 (Cref_inputs::gather_cref): New function.
3625 (filecol): New static const.
3626 (Cref_inputs::print_cref): New function.
3627 (Cref::print_cref): New function.
3628 * cref.h: Include <cstdio>.
3629 (class Cref): Update declarations.
3630 * mapfile.h (Mapfile::file): New function.
3631 * object.h (class Object): Define Symbols. Declare virtual
3632 do_get_global_symbols.
3633 (Object::get_global_symbols): New function.
3634 * object.cc (Input_objects::add_object): Pass object to cref_ if
3635 --cref.
3636 (Input_objects::archive_start): Likewise.
3637 (Input_objects::archive_stop): Likewise.
3638 (Input_objects::print_cref): New function.
3639 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
3640 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
3641 --cref.
3642 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
3643 function.
3644 * plugin.h (class Sized_pluginobj): Update declarations.
3645
8781f709
ILT
36462010-01-05 Ian Lance Taylor <iant@google.com>
3647
3648 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
3649 to is_default_version. Rename insdef to insdefault.
3650 (Symbol_table::add_from_relobj): Rename def to is_default_version
3651 and local to is_forced_local.
3652 (Symbol_table::add_from_pluginobj): Likewise.
3653 (Symbol_table::add_from_dynobj): Likewise.
3654 (Symbol_table::define_special_symbol): Rename insdef to
3655 insdefault.
3656
fe35d28d
ILT
36572010-01-04 Ian Lance Taylor <iant@google.com>
3658
30bc8c46
ILT
3659 PR 10980
3660 * options.h (class General_options): Add
3661 --allow-multiple-definition and -z muldefs.
3662 * resolve.cc (Symbol_table::should_override): Don't warn about a
3663 multiple symbol definition if --allow-multiple-definition or -z
3664 muldefs.
3665
7eaea549
ILT
3666 PR 10980
3667 * options.h (class General_options): Add --add-needed and
3668 --copy-dt-needed-entries. Tweak --as-needed help entry.
3669 * object.cc (Input_objects::check_dynamic_dependencies): Give an
3670 error if --copy-dt-needed-entries aka --add-needed is used and
3671 would cause a change in behaviour.
3672
fe35d28d
ILT
3673 PR 10980
3674 * options.h (class General_options): Add -G as a short version of
3675 --shared. Add no-op options -assert, -g, and -i.
3676
55a2bb35
ST
36772010-01-04 Sriraman Tallam <tmsriram@google.com>
3678
3679 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
3680 check for .text or .gnu.linkonce.t sections.
3681 * icf.cc (Icf::find_identical_sections): Ditto.
3682 Change the detection for mangled function name within the section
3683 name.
3684 * icf.h (is_section_foldable_candidate): New function.
3685
719328e1
ILT
36862009-12-30 Ian Lance Taylor <iant@google.com>
3687
3688 PR 10980
3689 * options.h (class General_options): Permit two dashes with
3690 --retain-symbols-file.
3691
d7bb5745
ILT
36922009-12-30 Ian Lance Taylor <iant@google.com>
3693
403a15dd
ILT
3694 PR 10979
3695 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
3696 don't put the file header and segment headers in the text
3697 segment.
3698
eda294df
ILT
3699 PR 10979
3700 * common.cc (Sort_commons::operator()): Stabilize sort when both
3701 entries are NULL.
3702 (Symbol_table::do_allocate_commons_list): When allocating common
3703 symbols, skip a symbol which is no longer common.
3704 * symtab.h (Symbol::is_common): Test whether the symbol comes from
3705 an object before checking its type.
3706 * testsuite/common_test_2.c: New file.
3707 * testsuite/common_test_3.c: New file.
3708 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
3709 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
3710 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
3711 (common_test_2_pic.o, common_test_2.so): New targets.
3712 (common_test_3_pic.o, common_test_3.so): New targets.
3713 * testsuite/Makefile.in: Rebuild.
3714
d7bb5745
ILT
3715 PR 10979
3716 * script.cc (read_input_script): If we see a new SECTIONS clause,
3717 and we have added an input section, give an error.
3718 * layout.h (class Layout): Add have_added_input_section function.
3719 Add have_added_input_section_ field.
3720 * layout.cc (Layout::Layout): Initialize
3721 have_added_input_section_.
3722 (Layout::layout): Set have_added_input_section_.
3723 (Layout::layout_eh_frame): Likewise.
3724
fc59c572
ILT
37252009-12-30 Ian Lance Taylor <iant@google.com>
3726
3727 PR 10931
3728 * options.h (class General_options): Add --sort-common option.
3729 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
3730 * common.cc (Sort_common): Add sort_order parameter to
3731 constructor. Add sort_order_ field.
3732 (Sort_commons::operator): Check sort_order_.
3733 (Symbol_table::allocate_commons): Determine the sort order.
3734 (Symbol_table::do_allocate_commons): Add sort_order parameter.
3735 Change all callers.
3736 (Symbol_table::do_allocate_commons_list): Likewise.
3737
1c74fab0
ILT
37382009-12-30 Ian Lance Taylor <iant@google.com>
3739
3740 PR 10916
3741 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
3742 symbols from this object, don't change the visibility of an
3743 undefined symbol.
3744 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
3745
6affe781
ILT
37462009-12-30 Ian Lance Taylor <iant@google.com>
3747
3748 PR 10861
3749 * script.h (class Version_script_info): Define Language enum.
3750 Update declarations. Define Glob, Exact, and Lookup types. Add
3751 new fields globals_, locals_, and is_finalized_.
3752 * script.cc: Various formatting fixes.
3753 (class Parser_closure): Change language_stack_ from a vector of
3754 std::string to one of Version_script_info::Language. Adjust all
3755 uses accordingly.
3756 (class Lazy_demangler): Remove.
3757 (struct Version_expression): Change language from std::string to
3758 Version_script_info::Language.
3759 (Version_script_info::Version_script_info): New function.
3760 (Version_script_info::~Version_script_info): Don't call clear.
3761 (Version_script_info::finalize): New function.
3762 (Version_script_info::build_lookup_tables): New function.
3763 (Version_script_info::build_expression_list_lookup): New
3764 function.
3765 (Version_script_info::get_symbol_version_helper): Rewrite to use
3766 lookup tables.
3767 (Version_script_info::print_expression_list): Adjust to use
3768 Version_script_info::Language.
3769 (script_push_lex_into_version_mode): Check that the version script
3770 has not been finalized.
3771 (version_script_push_lang): Change language string to
3772 Version_script_info::Language.
3773 * options.cc (Command_line::version_script): New function.
3774 * options.h (class General_options): Add finalize_dynamic_list
3775 function. Change version_script from declaration to definition.
3776 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
3777 * testsuite/version_script.map: Remove duplicate def of foo.
3778 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
3779 version_script.map.
3780 * testsuite/Makefile.in: Rebuild.
3781
818bf354
ILT
37822009-12-30 Ian Lance Taylor <iant@google.com>
3783
3784 PR 10843
3785 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
3786 if the input symbol index is 0, make the output symbol index 0.
3787
ebcc8304
ILT
37882009-12-30 Ian Lance Taylor <iant@google.com>
3789
3790 PR 10670
3791 * options.h (class General_options): Add -x/--discard-all.
3792 * object.cc (Sized_relobj::do_count_local_symbols): Handle
3793 --discard-all. If the local symbol needs a dynamic entry, check
3794 that before handling --discard-locals.
3795
176fe33f
ILT
37962009-12-30 Ian Lance Taylor <iant@google.com>
3797
bb321bb1
ILT
3798 PR 10450
3799 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
3800 flags to PF_R.
3801 (Output_segment::add_output_section): Don't change the flags if
3802 the type is PT_TLS.
3803
176fe33f
ILT
3804 PR 10450
3805 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
3806 GNU hash table if they need a dynamic value. Otherwise, don't add
3807 them if they are defined in a dynamic object or are forced local.
3808
e8cd95c7
ILT
38092009-12-29 Ian Lance Taylor <iant@google.com>
3810
1b81fb71
ILT
3811 PR 10450
3812 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
3813 .gnu.hash table for a 32-bit target.
3814
8d6d383d
ILT
3815 PR 10450
3816 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
3817 regular and a dynamic object only needs a dynamic symbol table
3818 entry if it is externally visible.
3819
e785ec03
ILT
3820 PR 10450
3821 * i386.cc (class Target_i386): Initialize global_offset_table_ in
3822 constructor. Add global_offset_table_ field.
3823 (Target_i386::got_section): Set global_offset_table_.
3824 (Target_i386::do_finalize_sections): Set global_offset_table_
3825 size.
3826 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
3827 in constructor. Add global_offset_table_ field.
3828 (Target_x86_64::got_section): Set global_offset_table_.
3829 (Target_x86_64::do_finalize_sections): Set global_offset_table_
3830 size.
3831
1a2dff53
ILT
3832 * layout.cc (Layout::Layout): Initialize increase_relro_.
3833 (Layout::get_output_section): Add is_relro, is_last_relro, and
3834 is_first_non_relro parameters. Change all callers.
3835 (Layout::choose_output_section): Likewise.
3836 (Layout::add_output_section_data): Likewise.
3837 (Layout::make_output_section): Likewise.
3838 (Layout::set_segment_offsets): Clear increase_relro when using a
3839 linker script.
3840 * layout.h (class Layout): Add increase_relro method. Add
3841 increase_relro_ field. Update declarations.
3842 * output.cc (Output_section::Output_section): Initialize
3843 is_last_relro_ and is_first_non_relro_.
3844 (Output_segment::add_output_section): Group relro sections is
3845 do_sort is true. Handle is_last_relro and is_first_non_relro.
3846 (Output_segment::maximum_alignment): Remove relro handling.
3847 (Output_segment::set_section_addresses): Add increase_relro
3848 parameter. Change all callers. Add initial alignment to align
3849 relro sections on separate page. Remove old relro handling.
3850 (Output_segment::set_section_list_addresses): Remove in_relro
3851 parameter. Change all callers.
3852 (Output_segment::set_offset): Add increase parameter. Change all
3853 callers. Remove old relro handling.
3854 * output.h (class Output_section): Add new methods: is_last_relro,
3855 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
3856 Add is_last_relro_ and is_first_non_relro_ fields.
3857 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
3858 Create separate .got.plt section. Call increase_relro.
3859 * x86_64.cc (Target_x86_64::got_section): Likewise.
3860 * testsuite/relro_script_test.t: Add .got.plt.
3861
f0ba79e2
ILT
3862 PR 10450
3863 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
3864 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
3865 (Layout::finalize): Call set_dynamic_symbol_size.
3866 (Layout::set_dynamic_symbol_size): New function.
3867 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
3868 set_dynamic_symbol_size.
3869
e8cd95c7
ILT
3870 PR 10450
3871 * output.h (class Output_section): Add is_entsize_zero_ field.
3872 * output.cc (Output_section::Output_section): Initialize
3873 is_entsize_zero_.
3874 (Output_section::set_entsize): If two different entsizes are
3875 requested, force it to zero.
3876 (Output_section::add_input_section): Set flags for .debug_str
3877 before updating section flags. Set entsize.
3878 (Output_section::update_flags_for_input_section): Set SHF_MERGE
3879 and SHF_STRING if all input sections have those flags.
3880
3e1b9a8a
RÁE
38812009-12-29 Rafael Espindola <espindola@google.com>
3882
3883 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
3884 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
3885 reporting.
3e1b9a8a 3886
3dcad376
ST
38872009-12-29 Sriraman Tallam <tmsriram@google.com>
3888
3889 * options.cc (General_options::parse_version): Allow -v to exit
3890 without an error if there is nothing to link.
3891
084e2665
ILT
38922009-12-29 Ian Lance Taylor <iant@google.com>
3893
3894 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
3895 using a version of gcc before 4.1.
3896 * configure: Rebuild.
3897
250acde3
CD
38982009-12-28 Chris Demetriou <cgd@google.com>
3899
3900 * attributes.cc (Output_attributes_section_data::do_write): Use
3901 std::vector::front rather than std::vector::data.
3902
99fff23b
ILT
39032009-12-28 Ian Lance Taylor <iant@google.com>
3904
3905 * symtab.h (class Symbol_table): Add enum Defined.
3906 * resolve.cc (Symbol_table::should_override): Add defined
3907 parameter. Change all callers. Test whether object is NULL
3908 before calling a method on it.
3909 (Symbol_table::report_resolve_problem): Add defined parameter.
3910 Change all callers.
3911 (Symbol_table::should_override_with_special): Likewise.
3912 * symtab.cc (Symbol_table::define_in_output_data): Add defined
3913 parameter. Change all callers.
3914 (Symbol_table::do_define_in_output_data): Likewise.
3915 (Symbol_table::define_in_output_segment): Likewise.
3916 (Symbol_table::do_define_in_output_segment): Likewise.
3917 (Symbol_table::define_as_constant): Likewise.
3918 (Symbol_table::do_define_as_constant): Likewise.
3919 * script.h (class Symbol_assignment): Add is_defsym parameter to
3920 constructor; change all callers.
3921 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
3922 parameter. Change all callers. Add is_defsym_ field.
3923 (class Parser_closure): Add parsing_defsym parameter to
3924 constructor; change all callers. Add parsing_defsym accessor
3925 function. Add parsing_defsym_ field.
3926
556bd683
ILT
39272009-12-28 Ian Lance Taylor <iant@google.com>
3928
3929 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 3930 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 3931
1782c879
ILT
39322009-12-23 Ian Lance Taylor <iant@google.com>
3933
3934 * i386.cc (Target_i386::do_calls_non_split): Recognize
3935 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
3936 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
3937 -fsplit-stack prologue when using %r11.
1782c879 3938
329ca2b1
ST
39392009-12-21 Sriraman Tallam <tmsriram@google.com>
3940
3941 * options.cc (General_options::parse_version): Make -v continue and do
3942 the link like GNU ld does.
3943
d675ff46
RÁE
39442009-12-17 Rafael Avila de Espindola <espindola@google.com>
3945
3946 * Makefile.am (CCFILES): Add timer.cc.
3947 (HFILES): Add timer.h.
3948 * configure.ac: Check for sysconf and times.
3949 * main.cc: include timer.h.
3950 (main): Use Timer instead of get_run_time.
3951 * timer.cc: New.
3952 * timer.h: New.
3953 * workqueue.cc: include timer.h.
3954 (Workqueue::find_and_run_task):
3955 Report user, sys and wall time.
3956 * Makefile.in: Regenerate.
3957 * config.in: Regenerate.
3958 * configure: Regenerate.
3959
d6344fb5
DK
39602009-12-16 Doug Kwan <dougkwan@google.com>
3961
3962 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
3963 sections.
3964 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
3965 relaxed input sections.
3966 * output.cc (Output_section::find_relaxed_input_section): Change
3967 return type to Output_relaxed_input_section pointer. Adjust code
3968 for new type of relaxed_input_section_map_.
3969 * output.h (Output_section::find_relaxed_input_section): Change
3970 return type to Output_relaxed_input_section pointer.
3971 (Output_section::Output_relaxed_input_section_by_input_section_map):
3972 New type.
3973 (Output_section::relaxed_input_section_map_): Change type to
3974 Output_section::Output_relaxed_input_section_by_input_section_map.
3975 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
3976 input section.
3977
0e0d5469
ILT
39782009-12-15 Ian Lance Taylor <iant@google.com>
3979
3980 * layout.cc (Layout::create_shstrtab): Only write out after input
3981 sections if we are compressing debug sections.
3982
0649a889
ILT
39832009-12-15 Ian Lance Taylor <iant@google.com>
3984
3985 * archive.cc (Archive::add_symbols): Only look up a symbol without
3986 a version if there is, in fact, a version.
3987
2ea97941
ILT
39882009-12-14 Ian Lance Taylor <iant@google.com>
3989
3990 Revert -Wshadow changes, all changes from:
3991 2009-12-11 Doug Kwan <dougkwan@google.com>
3992 2009-12-11 Nick Clifton <nickc@redhat.com>
3993 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
3994
b0eec2cc
DK
39952009-12-11 Doug Kwan <dougkwan@google.com>
3996
3997 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
3998 due to -Wshadow.
3999 * attributes.cc (Object_attribute::size): Ditto.
4000 (Attributes_section_data::size): Ditto.
4001 (Attributes_section_data::Attributes_section_data): Ditto.
4002 (Output_attributes_section_data::do_write): Ditto.
4003 * attributes.h (Object_attribute::set_type): Ditto.
4004 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4005
91d6fa6a
NC
40062009-12-11 Nick Clifton <nickc@redhat.com>
4007
4008 * archive.cc: Fix shadowed variable warnings.
4009 * arm.cc: Likewise.
4010 * compressed_output.cc: Likewise.
4011 * compressed_output.h: Likewise.
4012 * configure: Likewise.
4013 * dwarf_reader.cc: Likewise.
4014 * dynobj.cc: Likewise.
4015 * dynobj.h: Likewise.
4016 * ehframe.cc: Likewise.
4017 * ehframe.h: Likewise.
4018 * errors.cc: Likewise.
4019 * expression.cc: Likewise.
4020 * fileread.cc: Likewise.
4021 * fileread.h: Likewise.
4022 * freebsd.h: Likewise.
4023 * i386.cc: Likewise.
4024 * icf.cc: Likewise.
4025 * incremental.h: Likewise.
4026 * layout.cc: Likewise.
4027 * layout.h: Likewise.
4028 * mapfile.cc: Likewise.
4029 * merge.cc: Likewise.
4030 * merge.h: Likewise.
4031 * object.cc: Likewise.
4032 * object.h: Likewise.
4033 * options.h: Likewise.
4034 * output.cc: Likewise.
4035 * output.h: Likewise.
4036 * parameters.cc: Likewise.
4037 * plugin.cc: Likewise.
4038 * powerpc.cc: Likewise.
4039 * reduced_debug_output.cc: Likewise.
4040 * reduced_debug_output.h: Likewise.
4041 * reloc.cc: Likewise.
4042 * reloc.h: Likewise.
4043 * resolve.cc: Likewise.
4044 * script-sections.cc: Likewise.
4045 * script.cc: Likewise.
4046 * script.h: Likewise.
4047 * sparc.cc: Likewise.
4048 * symtab.cc: Likewise.
4049 * symtab.h: Likewise.
4050 * target-select.cc: Likewise.
4051 * target-select.h: Likewise.
4052 * token.h: Likewise.
4053 * workqueue.cc: Likewise.
4054 * workqueue.h: Likewise.
4055 * x86_64.cc: Likewise.
4056
a0351a69
DK
40572009-12-10 Doug Kwan <dougkwan@google.com>
4058
4059 * arm.cc (attributes.h): New include.
4060 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
4061 (Arm_relobj::~Arm_relobj): Delete object pointed by
4062 attributes_section_data_.
4063 (Arm_relobj::attributes_section_data): New method definition.
4064 (Arm_relobj::attributes_section_data_): New data member declaration.
4065 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
4066 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
4067 attributes_section_data_.
4068 (Arm_dynobj::attributes_section_data): New method definition.
4069 (Arm_dynobj::attributes_section_data_): New data member declaration.
4070 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
4071 initialization value of may_use_blx_ to false.
4072 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
4073 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
4074 object attributes to compute results instead of hard-coding.
4075 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
4076 Target_arm::get_secondary_compatible_arch,
4077 Target_arm::set_secondary_compatible_arch
4078 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4079 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
4080 New method declarations.
4081 (Target_arm::get_aeabi_object_attribute): New method definition.
4082 (Target_arm::attributes_section_data_): New data member declaration.
4083 (read_arm_attributes_section): New template definition.
4084 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
4085 (Arm_dynobj::do_read_symbols): Ditto.
4086 (Target_arm::do_finalize_sections): Merge attributes sections from
4087 input. Check for BLX use after attributes section merging.
4088 Fix __exidx_start and __exidx_end visibility. Create an
4089 .ARM.attributes section if necessary.
4090 (Target_arm::get_secondary_compatible_arch,
4091 Target_arm::set_secondary_compatible_arch,
4092 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4093 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 4094 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
4095 New method definitions.
4096
b59befec
ILT
40972009-12-09 Ian Lance Taylor <iant@google.com>
4098
4099 * plugin.cc (Plugin::load): Don't cast from void* to a function
4100 pointer.
4101
1276bc89
ILT
41022009-12-09 Ian Lance Taylor <iant@google.com>
4103
4104 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
4105 information fields.
4106
2f2de248
L
41072009-12-09 H.J. Lu <hongjiu.lu@intel.com>
4108
4109 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
4110 Replace two_file_shared_1.so with two_file_shared_2.so.
4111 * testsuite/Makefile.in: Regenerated.
4112
4f787271
DK
41132009-12-08 Doug Kwan <dougkwan@google.com>
4114
4115 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
4116 (HFILES): Add attributes.h and int_encoding.h.
4117 * Makefile.in: Regenerate.
4118 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
4119 function definitions to int_encoding.cc
4120 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
4121 prototypes to int_encoding.h
4122 * reduced_debug_output.cc (int_encoding.h): New include.
4123 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
4124 function definitions to int_encoding.cc
4125 (insert_into_vector, read_from_pointer): Move template definitions to
4126 int_encoding.h
4127 * attributes.cc: New file.
4128 * attributes.h: New file.
4129 * int_encoding.cc: New file.
4130 * int_encoding.h: New file.
4131
20b52f1a
RÁE
41322009-12-07 Rafael Avila de Espindola <espindola@google.com>
4133
4134 PR gold/11055
4135 * incremental-dump.cc (dump_incremental_inputs): New.
4136 (main): Use dump_incremental_inputs.
4137
53d7974c
L
41382009-12-07 H.J. Lu <hongjiu.lu@intel.com>
4139
4140 PR gold/10893
4141 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
4142 checking elfcpp::STT_FUNC.
4143 (Target_i386::Relocate::relocate): Likewise.
4144 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4145
4146 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
4147 symbols from shared libraries into normal FUNC symbols.
4148
4149 * symtab.h (Symbol): Add is_func and use it.
4150
05a352e6
DK
41512009-12-05 Doug Kwan <dougkwan@google.com>
4152
4153 * arm.cc (Target_arm::arm_info): Initialize new fields
4154 attributes_section and attributes_vendor.
4155 * i386.cc (Target_i386::i386_info): Same.
4156 * object.cc (Sized_relobj::do_layout): Skip attribute section.
4157 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
4158 fields attributes_section and attributes_vendor.
53d7974c 4159 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
4160 * target.h (Target::attributes_section, Target::attributes_vendor,
4161 Target::is_attributes_section, Target::attribute_arg_type,
4162 Target::attributes_order): New method definitions.
4163 (Target::Target_info::attributes_section,
4164 Target::Target_info::attributes_vendor): New fields.
4165 (Target::do_attribute_arg_type, Target::do_attributes_order): New
4166 virtual method definitions.
4167 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
4168 attributes_section and attributes_vendor.
4169 * testsuite/testfile.cc (Target_test::test_target_info): Same.
4170
f4e5969c
DK
41712009-12-05 Doug Kwan <dougkwan@google.com>
4172
4173 * arm.cc: Update comments about interworking and stub generation.
4174 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
4175 considered as non-PIC.
4176 (Arm_relocate_functions::base_abs): Fix formatting.
4177 (Arm_relocate_functions::got_prel): Fix comment. Change interface
4178 of function to use GOT entry address instead of offset.
4179 (Target_arm::Scan::global): Issue an error if a symbol would need a
4180 PLT does not get one because it is untyped. Remove code to create
4181 dynamic symbols for relative branches.
4182 (Target_arm::Relocate::relocate: Use 0 instead of false since function
4183 takes unsigned integer instead of boolean.
4184
1abce4a6
L
41852009-12-05 H.J. Lu <hongjiu.lu@intel.com>
4186
4187 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
4188 (two_file_test_LDADD): Likewise.
4189 (common_test_1_LDADD): Likewise.
4190 (exception_test_LDADD) Likewise.
4191 (weak_test_LDADD): Likewise.
4192 (many_sections_test_LDADD): Likewise.
4193 (initpri1_LDADD): Likewise.
4194 (script_test_1_LDADD): Likewise.
4195 (script_test_2_LDADD): Likewise.
4196 (justsyms_LDADD): Likewise.
4197 (binary_test_LDADD): Likewise.
4198 (large_LDADD): Likewise.
4199 * testsuite/Makefile.in: Regenerated.
4200
adcf2816 42012009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 4202
adcf2816
L
4203 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
4204 (Symbol_table::override_with_special): Likewise.
4205 (Symbol_table::add_from_object): Likewise.
4206
28e67f5d
RÁE
42072009-12-04 Rafael Avila de Espindola <espindola@google.com>
4208
4209 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4210 Don't set the data_offset twice.
4211
ae10a101
RÁE
42122009-12-04 Rafael Avila de Espindola <espindola@google.com>
4213
4214 * testsuite/Makefile.in: Regenerate.
4215
f59f41f3
DK
42162009-12-03 Doug Kwan <dougkwan@google.com>
4217
4218 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
4219 (Target_arm::do_finalize_sections): Add parameter for symbol table
4220 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
4221 * i386.cc (Target_i386::do_finalize_sections): Add an additional
4222 parameter for symbol table pointer.
4223 * layout.cc (Layout::finalize): Call Target::finalize_sections with
4224 an additional parameter for a pointer to symbol table.
4225 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
4226 parameter for a symbol table pointer.
4227 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
4228 * target.h (Target::finalize_sections, Target::do_finalize_sections):
4229 Ditto.
4230 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
4231 parameter for a symbol table pointer.
4232
ca55d848
RÁE
42332009-12-03 Rafael Avila de Espindola <espindola@google.com>
4234
4235 * incremental.cc (Incremental_inputs_header)
4236 (Incremental_inputs_header_write, Incremental_inputs_entry)
4237 (Incremental_inputs_entry_write): Move ...
4238 * incremental.h (Incremental_inputs_header)
4239 (Incremental_inputs_header_write, Incremental_inputs_entry)
4240 (Incremental_inputs_entry_write): here.
4241
3aec4f9c
RÁE
42422009-12-02 Rafael Avila de Espindola <espindola@google.com>
4243
4244 * incremental.cc (make_sized_incremental_binary): Set the target.
4245 Error if it is incompatible.
4246 * output.h (Output_file): Add filename method.
4247
9c0ae74d
RÁE
42482009-12-02 Rafael Avila de Espindola <espindola@google.com>
4249
4250 * incremental.cc (Incremental_inputs_entry): Remove unused argument
4251 from the get_* methods.
4252
a45500ae
RÁE
42532009-12-02 Rafael Avila de Espindola <espindola@google.com>
4254
4255 * incremental-dump.cc (main): Check that the offeset of a script is 0.
4256 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4257 Write 0 for the data_offset of scripts.
4258
325e6408
RÁE
42592009-12-02 Rafael Avila de Espindola <espindola@google.com>
4260
4261 * testsuite/Makefile.am: Add the incremental_test.sh test.
4262 * testsuite/incremental_test.sh: New.
4263 * testsuite/incremental_test_1.c: New.
4264 * testsuite/incremental_test_2.c: New.
4265
954c3e2e
RÁE
42662009-12-01 Rafael Avila de Espindola <espindola@google.com>
4267
4268 * incremental-dump.cc (main): Fix typos.
4269
f8086623
RÁE
42702009-11-27 Rafael Avila de Espindola <espindola@google.com>
4271
4272 PR gold/11025
4273 * incremental-dump.cc (main): Use llu to print 64 bit values.
4274
3b0dd6ac
L
42752009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
4276 H.J. Lu <hongjiu.lu@intel.com>
4277
4278 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
4279 $(LIBDL).
4280 (incremental_dump_LDADD): Likewise.
4281 * Makefile.in: Regenerated.
4282
a6d1ef57 42832009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 4284
a6d1ef57
DK
4285 Revert:
4286
4287 2009-11-25 Doug Kwan <dougkwan@google.com>
4288
4289 * arm.cc (Target_arm::Target_arm): Move method definition
4290 outside of class definition. Add code to handle
4291 --target1-rel, --target1-abs and --target2= options.
4292 (Target_arm::get_reloc_reloc_type): Change method to be
4293 non-static and const.
4294 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
4295 New data member declaration.
4296 (Target_arm::Scan::local, Target_arm::Scan::global,
4297 Target_arm::Relocate::relocate,
4298 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4299 Adjust call to Target_arm::get_real_reloc_type.
4300 (Target_arm::get_real_reloc_type): Use command line options
4301 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4302 * options.h (--target1-rel, --target1-abs, --target2): New
4303 ARM-only options.
4304
50aeb7d4
DK
43052009-11-25 Doug Kwan <dougkwan@google.com>
4306
4307 * arm.cc (Target_arm::Target_arm): Move method definition outside of
4308 class definition. Add code to handle --target1-rel, --target1-abs
4309 and --target2= options.
4310 (Target_arm::get_reloc_reloc_type): Change method to be non-static
4311 and const.
4312 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
4313 member declaration.
4314 (Target_arm::Scan::local, Target_arm::Scan::global,
4315 Target_arm::Relocate::relocate,
4316 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
4317 call to Target_arm::get_real_reloc_type.
4318 (Target_arm::get_real_reloc_type): Use command line options to
4319 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4320 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
4321 options.
4322
51938283
DK
43232009-11-25 Doug Kwan <dougkwan@google.com>
4324
4325 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
4326 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
4327 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
4328 formatting.
4329 (Arm_relocate_functions::thm_call): Replace body with a call to
4330 Arm_relocate_functions::thumb_branch_common.
4331 (Arm_relocate_functions::thm_jump24,
4332 Arm_relocate_functions::thm_xpc22): New method definitions.
4333 (Arm_relocate_functions::thumb_branch_common): New method definition.
4334 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
4335 operator.
4336 (Target_arm::Relocate::relocate): Adjust call to thm_call.
4337 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
4338
e2b8f3c4
RÁE
43392009-11-24 Rafael Avila de Espindola <espindola@google.com>
4340
4341 * Makefile.am: Build incremental-dump
4342 * Makefile.in: Regenerate.
4343 * incremental-dump.cc: New.
4344 * incremental.cc (Incremental_inputs_header_data,
4345 Incremental_inputs_entry_data): Move to incremental.h
4346 * incremental.h: (Incremental_inputs_header_data,
4347 Incremental_inputs_entry_data): Move from incremental.cc
4348
bcba9aec
RÁE
43492009-11-24 Rafael Avila de Espindola <espindola@google.com>
4350
4351 * incremental.cc (Incremental_inputs_header,
4352 Incremental_inputs_header_write, Incremental_inputs_entry,
4353 Incremental_inputs_entry_write): Add a typedef with the data type.
4354
7c3afe08
RÁE
43552009-11-24 Rafael Avila de Espindola <espindola@google.com>
4356
4357 * incremental.cc (Incremental_inputs_header,
4358 Incremental_inputs_header_write, Incremental_inputs_entry,
4359 Incremental_inputs_entry_write): Update comment about which
4360 type has the filed descriptions.
4361
d204b6e9
DK
43622009-11-15 Doug Kwan <dougkwan@google.com>
4363
4364 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
4365 (Arm_relocate_functions::arm_branch_common): Change method defintion
4366 in class definition to a method declaration and update list of formal
4367 parameters.
4368 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
4369 Arm_relocation_functions::jump24): Adjust call to
4370 Arm_relocate_functions::arm_branch_common. Update list of formal
4371 parameters.
4372 (Arm_relocate_functions::xpc25): New method definition.
4373 (Arm_relocate_functions::arm_branch_common): Move method defintion
4374 out from class definition. Use stubs for mode-switching and extending
4375 branch ranges.
4376 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
4377 specially. Change code to enable use of stubs in ARM branches.
4378
43d12afe
DK
43792009-11-10 Doug Kwan <dougkwan@google.com>
4380
4381 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
4382 in method declaration.
4383 (Target_arm::relocate_stub): New method declaration.
4384 (Target_arm::default_target): Change to return a pointer instead of
4385 a const reference.
4386 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
4387 Target_arm::default_target.
4388 (Arm_Relobj::do_relocate_sections): Remove options paramater in
4389 method definition.
4390 (Target_arm::relocate_section): Adjust view.
4391 (Target_arm::relocate_stub): New method definition.
4392
ac33a407
DK
43932009-11-10 Doug Kwan <dougkwan@google.com>
4394
4395 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
4396 a format warning.
4397 * incremental.cc (open_incremental_binary): Initialized local
4398 variables to avoid warnings.
4399 * object.cc (make_elf_object): Ditto.
4400 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
4401 a format warning.
e1df38aa 4402
88ee28e9
L
4403009-11-09 H.J. Lu <hongjiu.lu@intel.com>
4404
4405 PR gold/10930
4406 * testsuite/plugin_test.c: Include "config.h".
4407
2daedcd6
DK
44082009-11-09 Doug Kwan <dougkwan@google.com>
4409
4410 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
4411 (arm_symbol_value): Remove.
4412 (Arm_relocate_functions::arm_branch_common,
4413 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
4414 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
4415 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
4416 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
4417 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
4418 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
4419 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
4420 Arm_relocate_functions::thm_mobw_abs_nc,
4421 Arm_relocate_functions::thm_mov_abs,
4422 Arm_relocate_functions::movw_prel_nc,
4423 Arm_relocate_functions::thm_movt_abs,
4424 Arm_relocate_functions::movt_prel,
4425 Arm_relocate_functions::thm_movw_prel_nc,
4426 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
4427 (Target_arm::Relocate::relocate): Only decompose address into two
4428 parts if relocation type uses the thumb-bit and pass the actual
4429 bit instead of a flag indicating that the thumb-bit is used. Adjust
4430 calls to methods in Arm_relocate_functions for this change.
4431
1276bc89 44322009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
4433
4434 PR 10925
4435 * reloc.cc: Instantiate
4436 Sized_relobj::initialize_input_to_output_maps and
4437 Sized_relobj:free_input_to_output_maps.
4438
e53ad1b5
ILT
44392009-11-06 Ian Lance Taylor <iant@google.com>
4440
4441 PR 10876
4442 * defstd.cc (in_segment): Set only_if_ref true for "end".
4443
eb44217c
DK
44442009-11-06 Doug Kwan <dougkwan@google.com>
4445
4446 * arm.cc (class Reloc_stub): Correct a comment.
4447 (Target_arm::Target_arm): Initialize arm_input_section_map_.
4448 (Target_arm::scan_section_for_stubs): New method declaration.
4449 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
4450 Change methods from private to protected.
4451 (Target_arm::do_may_relax): New method definition.
4452 (Target_arm::do_relax, Target_arm::group_sections,
4453 Target_arm::scan_reloc_for_stub,
4454 Target_arm::scan_reloc_section_for_stubs): New method declarations.
4455 (Target_arm::arm_input_section_map_): New data member declaration.
4456 (Target_arm::scan_reloc_for_stub,
4457 Target_arm::scan_reloc_section_for_stubs,
4458 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
4459 Target_arm::do_relax): New method definitions.
4460
5d329b7d
ILT
44612009-11-06 Mikolaj Zalewski <mikolaj@google.com>
4462
4463 * configure.ac: Check for (struct stat)::st_mtim
4464 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
4465 * config.in: Regenerate.
4466 * configure: Regenerate.
4467
96a0d71b
ILT
44682009-11-05 Ian Lance Taylor <iant@google.com>
4469
4470 PR 10910
4471 * output.cc (Output_segment::add_output_section): Add missing
4472 return statement.
4473
594c8e5e
ILT
44742009-11-04 Ian Lance Taylor <iant@google.com>
4475
4476 PR 10880
4477 * object.h (class Object): Add is_needed and set_is_needed
4478 methods. Add is_needed_ field. Make bool fields into bitfields.
4479 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
4480 defined in a dynamic object and referenced by a regular object,
4481 set is_needed for the dynamic object.
4482 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
4483 if the file is marked with as_needed and it is not needed.
4484
22b127cc
ILT
44852009-11-04 Ian Lance Taylor <iant@google.com>
4486
4487 PR 10887
4488 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
4489 tags if data is discarded by linker script.
4490 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4491 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4492 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4493 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4494
f5c870d2
ILT
44952009-11-04 Ian Lance Taylor <iant@google.com>
4496
4497 * layout.cc (Layout::get_output_section): Add is_interp and
4498 is_dynamic_linker_section parameters. Change all callers.
4499 (Layout::choose_output_section): Likewise.
4500 (Layout::make_output_section): Likewise.
4501 (Layout::add_output_section_data): Add is_dynamic_linker_section
4502 parameter. Change all callers.
4503 * layout.h (class Layout): Update declarations.
4504 * output.h (class Output_section): Add is_interp, set_is_interp,
4505 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
4506 Add is_interp_, is_dynamic_linker_section_ fields. Change
4507 generate_code_fills_at_write_ to a bitfield.
4508 * output.cc (Output_section::Output_sections): Initialize new
4509 fields.
4510 (Output_segment::add_output_section): Add do_sort parameter.
4511 Change all callers.
4512
1ae4d23b
ILT
45132009-11-03 Ian Lance Taylor <iant@google.com>
4514
4515 PR 10860
4516 * options.h (class General_options): Add --warn-common.
4517 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
4518 merging two common symbols.
4519 (Symbol_table::should_override): Handle --warn-common when merging
4520 a common symbol with a defined symbol. Use report_resolve_problem
4521 for multiple definitions.
4522 (Symbol_table::report_resolve_problem): New function.
4523 * symtab.h (class Symbol_table): Declare report_resolve_problem.
4524
55da9579
DK
45252009-11-03 Doug Kwan <dougkwan@google.com>
4526
4527 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
4528 stub_factory_.
4529 (Target_arm::stub_factory): New method definition.
4530 (Target_arm::new_arm_input_section,
4531 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
4532 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 4533 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
4534 New type definitions.
4535 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
4536 member declarations.
4537 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
4538 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
4539 New method definitions.
4540
37a9ac43
ILT
45412009-11-03 Ian Lance Taylor <iant@google.com>
4542
4543 * options.h (class General_options): Add --warn_constructors.
4544
b3d6a3d4
ILT
45452009-11-03 Ian Lance Taylor <iant@google.com>
4546
4547 PR 10893
4548 * defstd.cc (in_section): Add entries for __rel_iplt_start,
4549 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
4550
934b01dd
ILT
45512009-11-03 Ian Lance Taylor <iant@google.com>
4552
4553 PR 10895
4554 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
4555 --msgid-bugs-address.
4556 (install-pdf): New target.
4557 (install-data_yes): Look up one directory to find mkinstalldirs.
4558
03c1939b
L
45592009-11-03 H.J. Lu <hongjiu.lu@intel.com>
4560
4561 * po/Make-in (.po.gmo): Don't generate .gmo files in source
4562 tree.
4563
ebd95253
DK
45642009-10-30 Doug Kwan <dougkwan@google.com>
4565
4566 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
4567
e9bbb538
DK
45682009-10-30 Doug Kwan <dougkwan@google.com>
4569
4570 * arm.cc (Stub_addend_reader): New struct template definition
4571 and partial specializations.
4572 (Stub_addend_reader::operator()): New method definition for a
4573 partially specialized template.
4574
d5b40221
DK
45752009-10-30 Doug Kwan <dougkwan@google.com>
4576
4577 * arm.cc (Arm_relobj::processor_specific_flags): New method
4578 definition.
4579 (Arm_relobj::do_read_symbols): New method declaration.
4580 (Arm_relobj::processor_specific_flags_): New data member declaration.
4581 (Arm_dynobj): New class definition.
4582 (Target_arm::do_finalize_sections): Add input_objects parameter.
4583 (Target_arm::do_adjust_elf_header): New method declaration.
4584 (Target_arm::are_eabi_versions_compatible,
4585 (Target_arm::merge_processor_specific_flags): New method declaration.
4586 (Target_arm::do_make_elf_object): New overloaded method definitions
4587 and declaration.
4588 (Arm_relobj::do_read_symbols): New method definition.
4589 (Arm_dynobj::do_read_symbols): Ditto.
4590 (Target_arm::do_finalize_sections): Add input_objects parameters.
4591 Merge processor-specific flags from all input objects.
4592 (Target_arm::are_eabi_versions_compatible,
4593 Target_arm::merge_processor_specific_flags,
4594 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
4595 New method definitions.
4596 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
4597 Input_objects pointer type parameter.
4598 * layout.cc (Layout::finalize): Pass input objects to target's.
4599 finalize_sections function.
4600 * output.cc (Output_file_header::do_sized_write): Set ELF file
4601 header's processor-specific flags.
4602 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
4603 Input_objects pointer type parameter.
4604 * sparc.cc (Target_sparc::do_finalize_sections): Same.
4605 * target.h (Input_objects): New forward class declaration.
4606 (Target::processor_specific_flags,
4607 Target::are_processor_specific_flags_sect): New method definitions.
4608 (Target::finalize_sections): Add input_objects parameter.
4609 (Target::Target): Initialize processor_specific_flags_ and
4610 are_processor_specific_flags_set_.
4611 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
4612 parameter.
4613 (Target::set_processor_specific_flags): New method definition.
4614 (Target::processor_specific_flags_,
4615 Target::are_processor_specific_flags_set_): New data member
4616 declarations.
4617 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
4618 Input_objects pointer type parameter.
4619
ebabffbd
DK
46202009-10-30 Doug Kwan <dougkwan@google.com>
4621
4622 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
4623
ad0f2072
ILT
46242009-10-28 Ian Lance Taylor <iant@google.com>
4625
4626 * object.h (class Relobj): Drop options parameter from
4627 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
4628 do_scan_relocs, do_relocate. Change all callers.
4629 (class Sized_relobj): Drop options parameters from
4630 do_gc_process_relocs, do_scan_relocs, do_relocate,
4631 do_relocate_sections, relocate_sections, emit_relocs_scan,
4632 emit_relocs_scan_reltype. Change all callers.
4633 (struct Relocate_info): Remove options field and all references to
4634 it.
4635 * reloc.h (class Read_relocs): Remove options constructor
4636 parameter and options_ field. Change all callers.
4637 (class Gc_process_relocs, class Scan_relocs): Likewise.
4638 (class Relocate_task): Likewise.
4639 * target-reloc.h (scan_relocs): Remove options parameter. Change
4640 all callers.
4641 (scan_relocatable_relocs): Likewise.
4642 * target.h (class Sized_target): Remove options parameter from
4643 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
4644 all callers.
4645 * gc.h (gc_process_relocs): Remove options parameter. Change all
4646 callers.
4647 * arm.cc: Update functions to remove options parameters.
4648 * i386.cc: Likewise.
4649 * powerpc.cc: Likewise.
4650 * sparc.cc: Likewise.
4651 * x86_64.cc: Likewise.
4652 * testsuite/testfile.cc: Likewise.
4653
8ffa3667
DK
46542009-10-28 Doug Kwan <dougkwan@google.com>
4655
4656 * arm.cc (Arm_relobj): New class definition.
e1df38aa 4657 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
4658 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
4659 New method definitions.
4660
40f36857
CC
46612009-10-28 Cary Coutant <ccoutant@google.com>
4662
4663 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
4664 (Plugin::cleanup_done_): New member.
4665 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
4666 (Plugin_manager::cleanup_done_): Remove.
4667 (Plugin_manager::add_input_file): Edit error message.
4668 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
4669 (Plugin_manager::cleanup): Remove use of cleanup_done_.
4670
2c849493
ILT
46712009-10-27 Mikolaj Zalewski <mikolajz@google.com>
4672
4673 * fileread.cc: (File_read::View::~View): Use the new
4674 data_ownership_ filed.
4675 (File_read::~File_read): Dispose the new whole_file_view_.
4676 (File_read::open): Mmap the whole file if needed.
4677 (File_read::open): Use whole_file_view_ instead of contents_.
4678 (File_read::find_view): Use whole_file_view_ if applicable.
4679 (File_read::do_read): Use whole_file_view_ instead of contents_.
4680 (File_read::make_view): Use whole_file_view_ instead of contents_,
4681 update File_read::View::View call.
4682 (File_read::find_or_make_view): Update File_read::View::View
4683 call.
4684 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
4685 remove contents_
4686 (File_read::View::Data_ownership): New enum.
4687 (File_read::View::View): Replace bool mapped_ with Data_ownership
4688 argument.
4689 (File_read::View::mapped_): Remove (replaced by data_ownership_).
4690 (File_read::View::data_ownership_): New field.
4691 (File_read::contents_): Remove (replaced by whole_file_view_).
4692 (File_read::whole_file_view_): New field.
4693 * options.h (class General_options): Add --keep-files-mapped.
4694
24998053
CC
46952009-10-27 Cary Coutant <ccoutant@google.com>
4696
4697 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
4698 * testsuite/Makefile.am (plugin_test_5): New test case.
4699 * testsuite/Makefile.in: Regenerate.
4700
72adc4fa
DK
47012009-10-25 Doug Kwan <dougkwan@google.com>
4702
4703 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
4704 from private to protected to allow access by child class.
4705 (Sized_relobj::do_relocate_sections): New method declaration.
4706 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 4707 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
4708 Sized_relobj::relocate_sections. Instantiate template explicitly
4709 for different target sizes and endianity.
4710
07f508a2
DK
47112009-10-24 Doug Kwan <dougkwan@google.com>
4712
4713 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
4714 (Arm_input_section::as_arm_input_section): New method.
4715 (Arm_output_section): New class definition.
4716 (Arm_output_section::create_stub_group,
4717 Arm_output_section::group_sections): New method definitions.
4718
10ad9fe5
DK
47192009-10-22 Doug Kwan <dougkwan@google.com>
4720
4721 * arm.cc (Arm_input_section): New class definition.
4722 (Arm_input_section::init, Arm_input_section:do_write,
4723 Arm_input_section::set_final_data_size,
4724 Arm_input_section::do_reset_address_and_file_offset): New method
4725 definitions.
4726
56ee5e00
DK
47272009-10-21 Doug Kwan <dougkwan@google.com>
4728
4729 * arm.cc (Stub_table, Arm_input_section): New forward class
4730 declarations.
4731 (Stub_table): New class defintion.
4732 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
4733 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
4734 New method definition.
4735
b569affa
DK
47362009-10-21 Doug Kwan <dougkwan@google.com>
4737
4738 * arm.cc: Update copyright comments.
4739 (Target_arm): New forward class template declaration.
4740 (Arm_address): New type.
4741 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
4742 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
4743 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
4744 constants.
4745 (Insn_template): Same.
4746 (DEF_STUBS): New macro.
4747 (Stub_type): New enum type.
4748 (Stub_template): New class definition.
4749 (Stub): Same.
4750 (Reloc_stub): Same.
4751 (Stub_factory): Same.
4752 (Target_arm::Target_arm): Initialize may_use_blx_ and
4753 should_force_pic_veneer_.
4754 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
4755 Target_arm::should_force_pic_veneer,
4756 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
4757 Target_arm::using_thumb_only, Target_arm:;default_target): New
4758 method defintions.
4759 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
4760 New data member declarations.
4761 (Insn_template::size, Insn_template::alignment): New method defintions.
4762 (Stub_template::Stub_template): New method definition.
4763 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
4764 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
4765 (Stub_factory::Stub_factory): New method definition.
4766 * gold.h (string_hash): New template.
4767 * output.h (Input_section_specifier::hash_value): Use
4768 gold::string_hash.
4769 (Input_section_specifier::string_hash): Remove.
4770 * stringpool.cc (Stringpool_template::string_hash): Use
4771 gold::string_hash.
4772
6c172549
DK
47732009-10-20 Doug Kwan <dougkwan@google.com>
4774
4775 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
4776 symbols of relaxed input sections.
4777 * output.h (Output_section::find_relaxed_input_section): Make
4778 method public.
4779
c5617f2f
DK
47802009-10-16 Doug Kwan <dougkwan@google.com>
4781
4782 * dynobj.cc (Versions::Versions): Initialize version_script_.
4783 Only insert base version symbol definition for a shared object
4784 if version script defines any version versions.
4785 (Versions::define_base_version): New method definition.
4786 (Versions::add_def): Check that base version is not needed.
4787 (Versions::add_need): Define base version lazily.
4788 * dynobj.h (Versions::define_base_version): New method declaration.
4789 (Versions::needs_base_version_): New data member declaration.
4790 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
4791 (check_DATA): Add no_version_test.stdout.
4792 (libno_version_test.so, no_version_test.o no_version_test.stdout):
4793 New make rules.
4794 * testsuite/Makefile.in: Regenerate.
4795 * testsuite/no_version_test.c: New file.
4796 * testsuite/no_version_test.sh: Ditto.
4797
3c12dcdb
DK
47982009-10-16 Doug Kwan <dougkwan@google.com>
4799
4800 * expression.cc (class Segment_start_expression): New class definition.
4801 (Segment_start_expression::value): New method definition.
4802 (script_exp_function_segment_start): Return a new
4803 Segment_start_expression.
4804 * gold/script-c.h (script_saw_segment_start_expression): New function
4805 prototype.
4806 * script-sections.cc (Script_sections::Script_sections): Initialize
4807 SAW_SEGMENT_START_EXPRESSION_ to false.
4808 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
4809 and -Tbbs options to specify section addresses if given in
4810 command line and no SEGMENT_START expression is seen in a script.
4811 * script-sections.h (Script_sections::saw_segment_start_expression,
4812 Script_sections::set_saw_segment_start_expression): New method
4813 definition.
4814 (Script_sections::saw_segment_start_expression_): New data member
4815 declaration.
4816 * script.cc (script_saw_segment_start_expression): New function.
4817 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
4818 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
4819 script_test_7.sh and script_test_8.sh.
4820 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
4821 script_test_8.stdout.
4822 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
4823 (script_test_6, script_test_6.stdout, script_test_7,
4824 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
4825 * Makefile.in: Regenerate.
4826 * testsuite/script_test_6.sh: New file.
4827 * testsuite/script_test_6.t: Same.
4828 * testsuite/script_test_7.sh: Same.
4829 * testsuite/script_test_7.t: Same.
4830 * testsuite/script_test_8.sh: Same.
4831
64b1ae37
DK
48322009-10-16 Doug Kwan <dougkwan@google.com>
4833
4834 * output.cc (Output_segment::set_section_list_address): Cast
4835 expressions to unsigned long long type to avoid format warnings.
4836
661be1e2
ILT
48372009-10-15 Ian Lance Taylor <iant@google.com>
4838
12edd763 4839 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 4840 dot assignment to script_sections_.
12edd763
ILT
4841 * script-sections.cc (Script_sections::add_dot_assignment):
4842 Initialize if necessary.
4843
68b6574b
ILT
4844 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
4845 program headers with no load segment if there is a linker script.
4846
661be1e2
ILT
4847 * layout.cc (Layout::set_segment_offsets): Align the file offset
4848 to the segment aligment for -N or -n with no load segment.
4849 * output.cc (Output_segment::add_output_section): Don't crash if
4850 the first section is a TLS section.
4851 (Output_segment::set_section_list_addresses): Print an error
4852 message if the address moves backward in a linker script.
4853 * script-sections.cc
4854 (Output_section_element_input::set_section_addresses): Don't
4855 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
4856 (Orphan_output_section::set_section_addresses): Likewise.
4857
f15f61a7
DK
48582009-10-15 Doug Kwan <dougkwan@google.com>
4859
4860 * layout.cc (Layout::finish_dynamic_section): Generate tags
4861 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
4862 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
4863 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
4864
82bb573a
ILT
48652009-10-14 Ian Lance Taylor <iant@google.com>
4866
4867 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
4868 fields.
4869 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
4870 data_shdr fields of relinfo.
4871 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
4872 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
4873 R_386_TLS_LDO_32, adjust based on section flags.
4874 (Target_i386::Relocate::fix_up_ldo): Remove.
4875
374ad285
ILT
48762009-10-13 Ian Lance Taylor <iant@google.com>
4877
4878 Add support for -pie.
4879 * options.h (class General_options): Add -pie and
4880 --pic-executable.
4881 (General_options::output_is_position_independent): Test -pie.
4882 (General_options::output_is_executable): Return true if not shared
4883 and not relocatable.
4884 (General_options::output_is_pie): Remove.
4885 * options.cc (General_options::finalize): Reject incompatible uses
4886 of -pie.
4887 * gold.cc (queue_middle_tasks): A -pie link is not static.
4888 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
4889 * symtab.cc (Symbol::final_value_is_known): Return false if
4890 output_is_position_independent.
4891 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
4892 output_is_position_independent.
4893 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
4894 output_is_position_independent.
4895 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
4896 output_is_position_independent.
4897 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
4898 two_file_pie_test.
4899 (basic_pie_test.o, basic_pie_test): New targets.
4900 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
4901 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
4902 (two_file_pie_test): New target.
4903 * testsuite/Makefile.in: Rebuild.
4904 * README: Remove note saying that -pie is not supported.
4905
c6585162
ILT
49062009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
4907
4908 * options.h (class General_options): Add -init and -fini.
4909 * layout.cc (Layout::finish_dynamic_section): Emit
4910 given init and fini functions.
4911
032ce4e9
ST
49122009-10-13 Sriraman Tallam <tmsriram@google.com>
4913
4914 * gc.h (gc_process_relocs): Check if icf is enabled using new
4915 function.
4916 * gold.cc (queue_initial_tasks): Likewise.
4917 (queue_middle_tasks): Likewise.
4918 * object.cc (do_layout): Likewise.
4919 * symtab.cc (is_section_folded): Likewise.
4920 * main.cc (main): Likewise.
4921 * reloc.cc (Read_relocs::run): Likewise.
4922 (Sized_relobj::do_scan_relocs): Likewise.
4923 * icf.cc (is_function_ctor_or_dtor): New function.
4924 (Icf::find_identical_sections): Check if function is ctor or dtor when
4925 safe icf is chosen.
4926 * options.h (General_options::icf): Change option to be an enum.
4927 (Icf_status): New enum.
4928 (icf_enabled): New method.
4929 (icf_safe_folding): New method.
4930 (set_icf_status): New method.
4931 (icf_status_): New variable.
4932 * (options.cc) (General_options::finalize): Set icf_status_.
4933 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
4934 icf_test and icf_keep_unique_test to use the --icf enum flag.
4935 * testsuite/icf_safe_test.sh: New file.
e1df38aa 4936 * testsuite/icf_safe_test.cc: New file.
032ce4e9 4937
f345227a
ST
49382009-10-12 Sriraman Tallam <tmsriram@google.com>
4939
4940 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
4941 includes to gc.h and icf.h.
4942 * arm.cc: Include gc.h.
4943 * gold.cc: Likewise.
4944 * i386.cc: Likewise.
4945 * powerpc.cc: Likewise.
4946 * sparc.cc: Likewise.
4947 * x86_64.cc: Likewise.
4948 * gc.h: Include icf.h.
4949
1c7814ed
ILT
49502009-10-11 Ian Lance Taylor <iant@google.com>
4951
4952 * plugin.cc: Include "gold.h" before other header files.
4953
ae3b5189
CD
49542009-10-10 Chris Demetriou <cgd@google.com>
4955
4956 * options.h (Input_file_argument::Input_file_type): New enum.
4957 (Input_file_argument::is_lib_): Replace with...
4958 (Input_file_argument::type_): New member.
4959 (Input_file_argument::Input_file_argument): Take Input_file_type
4960 'type' rather than boolean 'is_lib' as second argument.
4961 (Input_file_argument::is_lib): Use type_.
4962 (Input_file_argument::is_searched_file): New function.
4963 (Input_file_argument::may_need_search): Handle is_searched_file.
4964 * options.cc (General_options::parse_library): Support -l:filename.
4965 (General_options::parse_just_symbols): Update for Input_file_argument
4966 changes.
4967 (Command_line::process): Likewise.
4968 * archive.cc (Archive::get_file_and_offset): Likewise.
4969 * plugin.cc (Plugin_manager::release_input_file): Likewise.
4970 * script.cc (read_script_file, script_add_file): Likewise.
4971 * fileread.cc (Input_file::Input_file): Likewise.
4972 (Input_file::will_search_for): Handle is_searched_file.
4973 (Input_file::open): Likewise.
4974 * readsyms.cc (Read_symbols::get_name): Likewise.
4975 * testsuite/Makefile.am (searched_file_test): New test.
4976 * testsuite/Makefile.in: Regenerate.
4977 * testsuite/searched_file_test.cc: New file.
4978 * testsuite/searched_file_test_lib.cc: New file.
4979
f3048a1d
ILT
49802009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4981 Ian Lance Taylor <iant@google.com>
4982
4983 * descriptor.cc: Include <cstdio> and "binary-io.h".
4984 (Descriptors::open): Open the files in binary mode always.
4985 * script.cc (Lex::get_token): Treat \r as whitespace.
4986
d4780e57
ILT
49872009-10-09 Ian Lance Taylor <iant@google.com>
4988
4989 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
4990
d9a893b8
ILT
49912009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4992 Ian Lance Taylor <iant@google.com>
4993
4994 * configure.ac: Check for readv function also.
4995 * fileread.cc (readv): Define if not HAVE_READV.
4996 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
4997 does not exist.
4998 * config.in: Regenerate.
4999 * configure: Regenerate.
5000
c0a62865
DK
50012009-10-09 Doug Kwan <dougkwan@google.com>
5002
5003 * layout.cc (Layout::make_output_section): Call target hook to make
5004 ordinary output section.
5005 (Layout::finalize): Adjust parameter list of call the
5006 Target::may_relax().
5007 * layout.h (class Layout::section_list): New method.
5008 * merge.h (Output_merge_base::entsize): Change visibility to public.
5009 (Output_merge_base::is_string, Output_merge_base::do_is_string):
5010 New methods.
5011 (Output_merge_string::do_is_string): New method.
5012 * object.cc (Sized_relobj::do_setup): renamed from
5013 Sized_relobj::set_up.
5014 * object.h (Sized_relobj::adjust_shndx,
5015 Sized_relobj::initializ_input_to_output_maps,
5016 Sized_relobj::free_input_to_output_maps): Change visibilities to
5017 protected.
5018 (Sized_relobj::setup): Virtualize.
5019 (Sized_relobj::do_setup): New method declaration.
5020 (Sized_relobj::invalidate_section_offset,
5021 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5022 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5023 * options.cc (parse_int): New function.
5024 * options.h (parse_int): New declaration.
5025 (DEFINE_int): New macro.
5026 (stub_group_size): New option.
5027 * output.cc (Output_section::Output_section): Initialize memebers
5028 merge_section_map_, merge_section_by_properties_map_,
5029 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5030 (Output_section::add_input_section): Handled deferred code-fill
5031 generation and remove an old comment.
5032 (Output_section::add_relaxed_input_section): New method definition.
5033 (Output_section::add_merge_input_section): Use merge section by
5034 properties map to speed to search. Update merge section maps
5035 as appropriate.
5036 (Output_section::build_relaxation_map): New method definition.
5037 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5038 Same.
5039 (Output_section::relax_input_section): Renamed to
5040 Output_section::convert_input_sections_to_relaxed_sections and change
5041 interface to take a vector of pointers to relaxed sections.
5042 (Output_section::find_merge_section,
5043 Output_section::find_relaxed_input_section): New method definitions.
5044 (Output_section::is_input_address_mapped,
5045 Output_section::output_offset, Output_section::output_address):
5046 Use output section data maps to speed up searching.
5047 (Output_section::find_starting_output_address): Add comments.
5048 (Output_section::do_write,
5049 Output_section::write_to_postprocessing_buffer): Do code-fill
5050 generation as appropriate.
5051 (Output_section::get_input_sections): Invalidate relaxed input section
5052 map.
5053 (Output_section::restore_states): Adjust type of checkpoint .
5054 Invalidate relaxed input section map.
5055 * output.h (Output_merge_base): New class declaration.
5056 (Input_section_specifier): New class defintion.
5057 (class Output_relaxed_input_section) Change base class to
5058 Output_section_data_build.
5059 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
5060 base class initializer.
5061 (Output_section::add_relaxed_input_section): New method declaration.
5062 (Output_section::Input_section): Change visibility to protected.
5063 (Output_section::Input_section::relobj,
5064 Output_section::Input_section::shndx): Handle relaxed input sections.
5065 Output_section::input_sections) Change visibility to protected. Also
5066 define overload to return a non-const pointer.
5067 (Output_section::Merge_section_properties): New class defintion.
5068 (Output_section::Merge_section_by_properties_map,
5069 Output_section::Output_section_data_by_input_section_map,
5070 Output_section::Relaxation_map): New types.
5071 (Output_section::relax_input_section): Rename method to
5072 Output_section::convert_input_sections_to_relaxed_sections and change
5073 interface to take a vector of relaxed section pointers.
5074 (Output_section::find_merge_section,
5075 Output_section::find_relaxed_input_section,
5076 Output_section::build_relaxation_map,
5077 Output_section::convert_input_sections_in_list_to_relaxed_sections):
5078 New method declarations.
5079 (Output_section::merge_section_map_
5080 Output_section::merge_section_by_properties_map_,
5081 Output_section::relaxed_input_section_map_,
5082 Output_section::is_relaxed_input_section_map_valid_,
5083 Output_section::generate_code_fills_at_write_): New data members.
5084 * script-sections.cc
5085 (Output_section_element_input::set_section_addresses): Call
5086 current_data_size and addralign methods of relaxed input sections.
5087 (Orphan_output_section::set_section_addresses): Call current_data_size
5088 and addralign methods of relaxed input sections.
5089 * symtab.cc (Symbol_table::compute_final_value): Extract template
5090 from the body of Symbol_table::sized_finalize_symbol.
5091 (Symbol_table::sized_finalized_symbol): Call
5092 Symbol_table::compute_final_value.
5093 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
5094 (Symbol_table::compute_final_value): New templated method declaration.
5095 * target.cc (Target::do_make_output_section): New method defintion.
5096 * target.h (Target::make_output_section): New method declaration.
5097 (Target::relax): Add more parameters for input objects, symbol table
5098 and layout. Adjust call to do_relax.
5099 (Target::do_make_output_section): New method declaration.
5100 (Target::do_relax): Add parameters for input objects, symbol table
5101 and layout.
5102
d446d6c4
ILT
51032009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5104
5105 * pread.c: Include stdio.h.
5106
bc06c745
ILT
51072009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5108
5109 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
5110 defined.
5111
75aea3d0
ILT
51122009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5113
5114 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5115 Change read_shndx type to unsigned int.
5116 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5117 int.
5118 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5119 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
5120 Change read_shndx type to unsigned int.
5121 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5122 int.
5123 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5124 * layout.cc (Layout::create_symtab_sections): Cast the result of
5125 local_symcount * symsize to off_t in the gold_assert.
5126
be8fcb75
ILT
51272009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5128
5129 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
5130 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
5131 R_ARM_BASE_ABS.
5132 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
5133 (Arm_relocate_functions::thm_abs5): New function.
5134 (Arm_relocate_functions::abs12): New function.
5135 (Arm_relocate_functions::abs16): New function.
5136 (Arm_relocate_functions::base_abs): New function.
5137 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
5138 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
5139 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
5140 R_ARM_BASE_ABS.
5141 (Scan::global): Likewise.
5142 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
5143 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
5144 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
5145 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
5146 R_ARM_BASE_ABS.
5147
c2a122b6
ILT
51482009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5149
5150 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
5151 (Arm_relocate_functions::movt_prel): New function.
5152 (Arm_relocate_functions::thm_movw_prel_nc): New function.
5153 (Arm_relocate_functions::thm_movt_prel): New function.
5154 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
5155 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
5156 (Scan::global, Relocate::relocate): Likewise.
5157 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5158
c4aa1e2d
ILT
51592009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5160
5161 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
5162 Incremental_checker.
5163 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
5164 unsigned int.
5165 (class Incremental_inputs_header): New class.
5166 (Incremental_inputs_header_writer): Edit comment.
5167 (Incremental_inputs_entry): New class.
5168 (Incremental_inputs_entry_writer): Edit comment.
5169 (Sized_incremental_binary::do_find_incremental_inputs_section):
5170 Add *strtab_shndx parameter, fill it.
5171 (Sized_incremental_binary::do_check_inputs): New method.
5172 (Incremental_checker::can_incrementally_link_output_file): Use
5173 Sized_incremental_binary::check_inputs.
5174 (Incremental_inputs::report_command_line): Save command line in
5175 command_line_.
5176 * incremental.h:
5177 (Incremental_binary::find_incremental_inputs_section): New
5178 method.
5179 (Incremental_binary::do_find_incremental_inputs_section): Add
5180 strtab_shndx parameter.
5181 (Incremental_binary::do_check_inputs): New pure virtual method.
5182 (Sized_incremental_binary::do_check_inputs): Declare.
5183 (Incremental_checker::Incremental_checker): Add incremental_inputs
5184 parameter, use it to initialize incremental_inputs_.
5185 (Incremental_checker::incremental_inputs_): New field.
5186 (Incremental_checker::command_line): New method.
5187 (Incremental_checker::inputs): New method.
5188 (Incremental_checker::command_line_): New field.
5189
c549a694
ILT
51902009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5191
5192 * incremental.cc: Include <cstdarg> and "target-select.h".
5193 (vexplain_no_incremental): New function.
5194 (explain_no_incremental): New function.
5195 (Incremental_binary::error): New method.
5196 (Sized_incremental_binary::do_find_incremental_inputs_section): New
5197 method.
5198 (make_sized_incremental_binary): New function.
5199 (open_incremental_binary): New function.
5200 (can_incrementally_link_file): Add checks if output is ELF and has
5201 inputs section.
5202 * incremental.h: Include "elfcpp_file.h" and "output.h".
5203 (Incremental_binary): New class.
5204 (Sized_incremental_binary): New class.
5205 (open_incremental_binary): Declare.
5206 * object.cc (is_elf_object): Use
5207 elfcpp::Elf_recognizer::is_elf_file.
5208 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
5209 * output.h (Output_file::filesize): New method.
5210
fd3c5f0b
ILT
52112009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5212
5213 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
5214 New function.
5215 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
5216 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
5217 function.
5218 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
5219 function.
5220 (Arm_relocate_functions::movw_abs_nc): New function.
5221 (Arm_relocate_functions::movt_abs): New function.
5222 (Arm_relocate_functions::thm_movw_abs_nc): New function.
5223 (Arm_relocate_functions::thm_movt_abs): New function.
5224 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
5225 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
5226 (Scan::global): Likewise.
5227 (Relocate::relocate): Likewise.
5228 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5229
7f5309a5
ILT
52302009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5231
5232 * arm.cc (Arm_relocate_functions::got_prel) New function.
5233 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
5234 (Relocate::relocate): Likewise.
5235 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5236
364c7fa5
ILT
52372009-10-06 Ian Lance Taylor <iant@google.com>
5238
5239 * options.h (class General_options): Define
5240 split_stack_adjust_size parameter.
5241 * object.h (class Object): Add uses_split_stack_ and
5242 has_no_split_stack_ fields. Add uses_split_stack and
5243 has_no_split_stack accessor functions. Declare
5244 handle_split_stack_section.
5245 (class Reloc_symbol_changes): Define.
5246 (class Sized_relobj): Define Function_offsets. Declare
5247 split_stack_adjust, split_stack_adjust_reltype, and
5248 find_functions.
5249 * object.cc (Object::handle_split_stack_section): New function.
5250 (Sized_relobj::do_layout): Call handle_split_stack_section.
5251 * dynobj.cc (Sized_dynobj::do_layout): Call
5252 handle_split_stack_section.
5253 * reloc.cc (Sized_relobj::relocate_sections): Call
5254 split_stack_adjust for executable sections in split_stack
5255 objects. Pass reloc_map to relocate_section.
5256 (Sized_relobj::split_stack_adjust): New function.
5257 (Sized_relobj::split_stack_adjust_reltype): New function.
5258 (Sized_relobj::find_functions): New function.
5259 * target-reloc.h: Include "object.h".
5260 (relocate_section): Add reloc_symbol_changes parameter. Change
5261 all callers.
5262 * target.h (class Target): Add calls_non_split method. Declare
5263 do_calls_non_split virtual method. Declare match_view and
5264 set_view_to_nop.
5265 * target.cc: Include "elfcpp.h".
5266 (Target::do_calls_non_split): New function.
5267 (Target::match_view): New function.
5268 (Target::set_view_to_nop): New function.
5269 * gold.cc (queue_middle_tasks): Give an error if mixing
5270 split-stack and non-split-stack objects with -r.
5271 * i386.cc (Target_i386::relocate_section): Add
5272 reloc_symbol_changes parameter.
5273 (Target_i386::do_calls_non_split): New function.
5274 * x86_64.cc (Target_x86_64::relocate_section): Add
5275 reloc_symbol_changes parameter.
5276 (Target_x86_64::do_calls_non_split): New function.
5277 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
5278 parameter.
5279 * powerpc.cc (Target_powerpc::relocate_section): Add
5280 reloc_symbol_changes parameter.
5281 * sparc.cc (Target_sparc::relocate_section): Add
5282 reloc_symbol_changes parameter.
5283 * configure.ac: Call AM_CONDITIONAL for the default target.
5284 * configure: Rebuild.
5285 * testsuite/Makefile.am (TEST_AS): New variable.
5286 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
5287 (check_DATA): Add split_i386 and split_x86_64 files.
5288 (SPLIT_DEFSYMS): Define.
5289 (split_i386_[1234n].o): New targets.
5290 (split_i386_[124]): New targets.
5291 (split_i386_[1234r].stdout): New targets.
5292 (split_x86_64_[1234n].o): New targets.
5293 (split_x86_64_[124]): New targets.
5294 (split_x86_64_[1234r].stdout): New targets.
5295 (MOSTLYCLEANFILES): Add new executables.
5296 * testsuite/split_i386.sh: New file.
5297 * testsuite/split_x86_64.sh: New file.
5298 * testsuite/split_i386_1.s: New file.
5299 * testsuite/split_i386_2.s: New file.
5300 * testsuite/split_i386_3.s: New file.
5301 * testsuite/split_i386_4.s: New file.
5302 * testsuite/split_i386_n.s: New file.
5303 * testsuite/split_x86_64_1.s: New file.
5304 * testsuite/split_x86_64_2.s: New file.
5305 * testsuite/split_x86_64_3.s: New file.
5306 * testsuite/split_x86_64_4.s: New file.
5307 * testsuite/split_x86_64_n.s: New file.
5308 * testsuite/testfile.cc (Target_test): Update relocation_section
5309 function.
5310 * testsuite/Makefile.in: Rebuild.
5311
e8a9fcda
ILT
53122009-10-06 Ian Lance Taylor <iant@google.com>
5313
5314 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
5315 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
5316 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
5317 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
5318 the address on ldo_addrs_.
5319 (Target_i386::Relocate::fix_up_ldo): New function.
5320
e99daf92
ILT
53212009-10-06 Rafael Espindola <espindola@google.com>
5322
5323 * plugin.cc (add_input_library): New.
5324 (Plugin::load): Add add_input_library to tv.
5325 (Plugin_manager::add_input_file): Add the is_lib argument.
5326 (add_input_file): Update call to Plugin_manager::add_input_file.
5327 (add_input_library): New.
5328 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
5329
966d4097
DK
53302009-09-30 Doug Kwan <dougkwan@google.com>
5331
5332 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
5333 symbol and call Symbol::may_need_copy_reloc to determine if
5334 a copy reloc is needed.
5335 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
5336 nocopyreloc is given in command line.
5337 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
5338 given in command line.
5339 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
5340 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
5341 of the removed Target_i386::may_need_copy_reloc.
5342 * options.h (copyreloc): New option with default value false.
5343 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5344 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
5345 instead of the removed Target_powerpc::may_need_copy_reloc.
5346 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5347 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
5348 instead of the removed Target_sparc::may_need_copy_reloc.
5349 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
5350 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
5351 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
5352 instead of the removed Target_x86_64::may_need_copy_reloc.
5353
029ba973
ILT
53542009-09-30 Ian Lance Taylor <iant@google.com>
5355
5356 * object.h (class Object): Remove target_ field, and target,
5357 sized_target, and set_target methods.
5358 (Object::sized_target): Remove.
5359 (class Sized_relobj): Update declarations. Remove sized_target.
5360 * object.cc (Sized_relobj::setup): Remove target parameter.
5361 Change all callers.
5362 (Input_objects::add_object): Don't do anything with the target.
5363 (make_elf_sized_object): Add punconfigured parameter. Change all
5364 callers. Set or test parameter target.
5365 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
5366 Change all callers.
5367 * parameters.cc (Parameters::set_target): Change parameter type to
5368 be non-const.
5369 (Parameters::default_target): Remove.
5370 (set_parameters_target): Change parameter type to be non-const.
5371 (parameters_force_valid_target): New function.
5372 (parameters_clear_target): New function.
5373 * parameters.h (class Parameters): Update declarations. Remove
5374 default_target method. Add sized_target and clear_target
5375 methods. Change target_ to be non-const.
5376 (set_parameters_target): Update declaration.
5377 (parameters_force_valid_target): Declare.
5378 (parameters_clear_target): Declare.
5379 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
5380 as NULL if we aren't searching.
5381 (Add_symbols::run): Don't check for compatible target.
5382 * fileread.cc (Input_file::open_binary): Call
5383 parameters_force_valid_target.
5384 * gold.cc (queue_middle_tasks): Likewise.
5385 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
5386 set_target on object.
5387 * dynobj.h (class Sized_dynobj): Update declarations.
5388 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
5389 make_elf_object returns NULL.
5390 (Archive::include_member): Don't check whether object target is
5391 compatible.
5392 * output.cc (Output_section::add_input_section): Get target from
5393 parameters.
5394 (Output_section::relax_input_section): Likewise.
5395 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
5396 parameters.
5397 (Sized_relobj::do_scan_relocs): Likewise.
5398 (Sized_relobj::relocate_sections): Likewise.
5399 * resolve.cc (Symbol_table::resolve): Likewise.
5400 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
5401 parameter. Change all callers.
5402 (Symbol_table::add_from_object): Get target from parameters.
5403 (Symbol_table::add_from_relobj): Don't check object target.
5404 (Symbol_table::add_from_dynobj): Likewise.
5405 (Symbol_table::define_special_symbol): Get target from
5406 parameters.
5407 * symtab.h (class Symbol_table): Update declaration.
5408 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
5409 parameter. Change all callers. Clear parameter target.
5410 (Binary_test): Test target here.
5411 * testsuite/object_unittest.cc (gold_testsuite): Remove
5412 target_test_pointer parameter. Change all callers.
5413 (Object_test): Test target here.
5414
a6a22b83
ILT
54152009-09-26 Ian Lance Taylor <iant@google.com>
5416
5417 * testsuite/initpri1.c: Don't try to use constructor priorities if
5418 compiling with gcc before 4.3.
5419
6a8f49fe
ILT
54202009-09-22 Mikolaj Zalewski <mikolajz@google.com>
5421
5422 * testsuite/retain_symbols_file_test.sh (check_present): Change
5423 output file name to retain_symbols_file_test.stdout.
5424 (check_absent): Likewise.
5425
8c604651
CS
54262009-09-18 Craig Silverstein <csilvers@google.com>
5427
5428 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
5429 * options.cc: Include <cerrno> and <fstream>.
5430 (General_options::finalize): Parse -retain-symbols-file tag.
5431 * options.h: New flag.
5432 (General_options): New method should_retain_symbol, new
5433 variable symbols_to_retain.
5434 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
5435 should_retain_symbol map.
5436 * testsuite/Makefile.am (retain_symbols_file_test): New test.
5437 * testsuite/Makefile.in: Regenerate.
5438 * testsuite/retain_symbols_file_test.sh: New file.
5439
ca58b19f
NC
54402009-09-18 Nick Clifton <nickc@redhat.com>
5441
5442 * po/es.po: Updated Spanish translation.
5443
20e6d0d6
DK
54442009-09-17 Doug Kwan <dougkwan@google.com>
5445
5446 * debug.h (DEBUG_RELAXATION): New constant.
5447 (DEBUG_ALL): Add DEBUG_RELAXATION.
5448 (debug_string_to_enum): Add relaxation debug option.
5449 * layout.cc
5450 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
5451 Layout::Relaxation_debug_check::read_sections,
5452 Layout::Relaxation_debug_check::read_sections): New method definitions.
5453 (Layout::Layout): Initialize data members
5454 record_output_section_data_from_scrips_,
5455 script_output_section_data_list_ and relaxation_debug_check_.
5456 (Layout::save_segments, Layout::restore_segments,
5457 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5458 Layout::relaxation_loop_body): New method definitions.
5459 (Layout::finalize): Support relaxation. Move section layout code to
5460 Layout::relaxation_loop_body.
5461 (Layout::set_asection_address_from_script): Move code for orphan
5462 section placement out.
5463 (Layout::place_orphan_sections_in_script): New method definition.
5464 * layout.h (Output_segment_headers, Output_file_header):
5465 New forward class declarations.
5466 (Layout::~Layout): Define.
5467 (Layout::new_output_section_data_from_script): New method definition.
5468 (Layout::place_orphan_sections_in_script): New method declaration.
5469 (Layout::Segment_states): New type declaration.
5470 (Layout::save_segments, Layout::restore_segments,
5471 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5472 Layout::relaxation_loop_body): New method declarations.
5473 (Layout::Output_section_data_list): New type declaration.
5474 (Layout::Relaxation_debug_check): New class definition.
5475 (Layout::record_output_section_data_from_script_,
5476 Layout::script_output_section_data_list_, Layout::segment_states_,
5477 Layout::relaxation_debug_check_): New data members.
5478 * output.cc: (Output_section_headers::do_size): New method definition.
5479 (Output_section_headers::Output_section_headers): Move size
5480 computation to Output_section_headers::do_size.
5481 (Output_segment_headers::do_size): New method definition.
e1df38aa 5482 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
5483 Output_file_header::do_size and call it.
5484 (Output_file_header::do_size): New method definition.
5485 (Output_data_group::Output_data_group): Adjust call to
5486 Output_section_data.
5487 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
5488 (Output_symtab_xindex::do_write): Add array bound check.
5489 (Output_section::Input_section::print_to_mapfile): Handle
5490 RELAXED_INPUT_SECTION_CODE.
5491 (Output_section::Output_section): Initialize data member checkpoint_.
5492 (Output_section::~Output_section): Delete checkpoint object pointed
5493 by checkpoint_.
5494 (Output_section::add_input_section): Always add an Input_section if
5495 relaxing.
5496 (Output_section::add_merge_input_section): Add assert.
5497 (Output_section::relax_input_section): New method definition.
5498 (Output_section::set_final_data_size): Set load address to zero for
5499 an unallocated section.
5500 (Output_section::do_address_and_file_offset_have_reset_values):
5501 New method definition.
5502 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
5503 Handle relaxed input section.
5504 (Output_section::sort_attached_input_sections): Checkpoint input
5505 section list lazily.
5506 (Output_section::get_input_sections): Change type of input_sections to
5507 list of Simple_input_section pointers. Checkpoint input section list
5508 lazily. Also handle relaxed input sections.
5509 (Output_section::add_input_section_for_script): Take a reference to
5510 a Simple_input_section object instead of Relobj pointer and section
5511 index as parameter. Handle relaxed input sections.
5512 (Output_section::save_states, Output_section::restore_states): New
5513 method definitions.
5514 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
5515 (Output_data::is_data_size_fixed): New method definition.
5516 (Output_data::reset_addresss_and_file_offset): Do not reset data size
5517 if it is fixed.
5518 (Output_data::address_and_file_offset_have_reset_values): New method
5519 definition.
5520 (Output_data::do_address_and_file_offset_have_reset_values): New method
5521 definition.
5522 (Output_data::set_data_size): Check that data size is not fixed.
5523 (Output_data::fix_data_size): New method definition.
5524 (Output_data::is_data_size_fixed_): New data member.
5525 (Output_section_headers::set_final_data_size): New method definition.
5526 (Output_section_headers::do_size): New method declaration.
5527 (Output_segment_headers::set_final_data_size): New method definition.
5528 (Output_segment_headers::do_size): New method declaration.
5529 (Output_file_header::set_final_data_size)::New method definition.
5530 (Output_file_header::do_size)::New method declaration.
5531 (Output_section_data::Output_section_data): Add new parameter
5532 is_data_size_fixed and use it to fix data size.
5533 (Output_data_const::Output_data_const): Adjust call to base class
5534 constructor and fix data size.
5535 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
5536 base class constructor and fix data size.
5537 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
5538 base class constructor and fix data size.
5539 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
5540 class constructor and fix data size.
5541 (Output_data_group::set_final_data_size): New method definition.
5542 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
5543 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
5544 class constructor and fix data size.
5545 (Output_relaxed_input_section): New class definition.
5546 (Output_section::Simple_input_section): New class definition.
5547 (Output_section::get_input_sections): Adjust parameter list.
5548 (Output_section::add_input_section_for_script): Same.
5549 (Output_section::save_states, Output_section::restore_states,
5550 Output_section::do_address_and_file_offset_have_reset_values,
5551 (Output_section::Input_section::Input_section): Handle
5552 RELAXED_INPUT_SECTION_CODE. Add new overload for
5553 Output_relaxed_input_section.
5554 (Output_section::Input_section::is_input_section,
5555 Output_section::Input_section::set_output_section): Handle relaxed
5556 input section.
5557 (Output_section::Input_section::is_relaxed_input_section,
5558 Output_section::Input_section::output_section_data,
5559 Output_section::Input_section::relaxed_input_section): New method
5560 definitions.
5561 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
5562 value.
5563 (Output_section::Input_section::u1_): Update comments.
5564 (Output_section::Input_section::u2_): Add new union member poris.
5565 (Output_section::Checkpoint_output_section): New classs definition.
5566 (Output_section::relax_input_section): New method declaration.
5567 (Output_section::checkpoint_): New data member.
5568 (Output_segment): Update comments.
5569 (Output_segment::Output_segment): Un-privatize copy constructor.
5570 (Output_segment::operator=): Un-privatize.
5571 * script-sections.cc (Output_section_element::Input_section_list):
5572 Change element type to Output_section::Simple_input_section.
5573 (Output_section_element_dot_assignment::set_section_addresses):
5574 Register output section data for relaxation clean up.
5575 (Output_data_exression::Output_data_expression): Adjust call to base
5576 constructor to fix data size.
5577 (Output_section_element_data::set_section_addresses): Register
5578 Output_data_expression object for relaxation clean up.
5579 (struct Input_section_info): Replace Relobj pointer and section index
5580 pair with Output_section::Simple_input_section and Convert struct to a
5581 class.
5582 (Input_section_sorter::operator()): Adjust access to
e1df38aa 5583 Input_section_info data member to use accessors.
20e6d0d6
DK
5584 (Output_section_element_input::set_section_addresses): Use layout
5585 parameter. Adjust code to use Output_section::Simple_input_section
5586 and Input_secction_info classes. Register filler for relaxation
5587 clean up.
5588 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
5589 and section index pair with Output_section::Simple_input_section
5590 class. Adjust code accordingly.
5591 (Phdrs_element::release_segment): New method definition.
5592 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
5593 segment list.
5594 (Script_sections::release_segments): New method definition.
5595 * gold/script-sections.h (Script_sections::release_segments): New
5596 method declaration.
5597 * gold/target.h (Target::may_relax, Target::relax,
5598 Target::do_may_relax, Target::do_relax): New method definitions.
5599
5e445df6
ILT
56002009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5601
5602 * arm.cc (has_signed_unsigned_overflow): New function.
5603 (Arm_relocate_functions::abs8): New function.
5604 (Target_arm::Scan::local): Handle R_ARM_ABS8.
5605 (Target_arm::Scan::global): Likewise.
5606 (Target_arm::relocate::relocate): Likewise.
5607 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5608 Likewise.
5609
8c604651 56102009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
5611
5612 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
5613 * testsuite/Makefile.in: Regenerate.
5614
1e9cc1c2
NC
56152009-09-11 Nick Clifton <nickc@redhat.com>
5616
5617 * po/gold.pot: Updated by the Translation project.
5618
6a89f575
CC
56192009-09-08 Cary Coutant <ccoutant@google.com>
5620
5621 * output.cc (Output_file::open): Add execute permission to empty file.
5622 * testsuite/Makefile.am (permission_test): New test.
5623 * testsuite/Makefile.in: Regenerate.
5624
fdcac5af
ILT
56252009-09-02 Ian Lance Taylor <iant@google.com>
5626
5627 * output.cc (Output_file::resize): Call map_no_anonymous rather
5628 than map.
5629
44453f85
ILT
56302009-09-01 Mikolaj Zalewski <mikolajz@google.com>
5631
5632 * gold.cc: Include "incremental.h".
5633 (queue_initial_tasks): Call Incremental_checker methods.
5634 * incremental.cc: Include "output.h".
5635 (Incremental_checker::can_incrementally_link_output_file): New
5636 method.
5637 * incremental.h (Incremental_checker): New class.
5638
5639 * output.cc (Output_file::open_for_modification): New method.
5640 (Output_file::map_anonymous): Changed return type to bool. Record
5641 map in base_ field.
5642 (Output_file::map_no_anonymous): New method, broken out of map.
5643 (Output_file::map): Use map_no_anonymous and map_anonymous.
5644 * output.h (class Output_file): Update declarations.
5645
293c1386
CC
56462009-08-24 Cary Coutant <ccoutant@google.com>
5647
5648 * options.h (Command_line::Pre_options): New class.
5649 (Command_line::pre_options): New member.
5650 * options.cc (gold::options::ready_to_register): New variable.
5651 (One_option::register_option): Do nothing if not registering options.
5652 Assert if same short option registered twice.
5653 (General_options::General_options): Turn off option registration when
5654 done constructing.
5655 (Command_line::Pre_options::Pre_options): New constructor.
5656
f773f3d2
CC
56572009-08-24 Cary Coutant <ccoutant@google.com>
5658
06a73cfe
CC
5659 * options.h (General_options::no_keep_memory): Remove incorrect
5660 short option.
f773f3d2 5661
a15af8e2
RW
56622009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5663
5664 * Makefile.am (am__skiplex, am__skipyacc): New.
5665 * Makefile.in: Regenerate.
5666
c462b41b
RW
56672009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5668
14ec8efd
RW
5669 * Makefile.am (AM_CPPFLAGS): Renamed from ...
5670 (INCLUDES): ... this.
5671 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
5672 (AM_CPPFLAGS): Renamed from ...
5673 (INCLUDE): ... this.
5674 * Makefile.in, testsuite/Makefile.in: Regenerate.
5675
81ecdfbb
RW
5676 * Makefile.in: Regenerate.
5677 * aclocal.m4: Likewise.
5678 * config.in: Likewise.
5679 * configure: Likewise.
5680 * testsuite/Makefile.in: Likewise.
5681
c462b41b
RW
5682 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5683 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5684 * Makefile.in: Regenerate.
5685 * testsuite/Makefile.in: Regenerate.
5686
2da73f13
CC
56872009-08-19 Cary Coutant <ccoutant@google.com>
5688
5689 * resolve.cc (Symbol_table::resolve): Don't complain about defined
5690 symbols in shared libraries overridden by hidden or internal symbols
5691 in the main program.
5692
2db70501
CD
56932009-08-19 Chris Demetriou <cgd@google.com>
5694
5695 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
5696 checking source file names in error messages.
5697
f733487b
DK
56982009-08-18 Doug Kwan <dougkwan@google.com>
5699
5700 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
5701 an elcpp::Ehdr as parameter. Adjust call to set_target.
5702 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
5703 an elfcpp::Ehdr as parameter.
5704 * object.cc (Object::set_target): Remove the version that looks up
5705 a target and sets it.
5706 (Sized_relobj::setup): Take a Target object instead of
5707 an elfcpp::Ehdr as parameter. Adjust call to set_target.
5708 (make_elf_sized_object): Find target and ask target to
5709 make an ELF object.
5710 * object.h: (Object::set_target): Remove the version that looks up
5711 a target and sets it.
5712 (Sized_relobj::setup): Take a Target object instead of
5713 an elfcpp:Ehdr as parameter.
5714 * target.cc: Include dynobj.h.
5715 (Target::do_make_elf_object_implementation): New.
5716 (Target::do_make_elf_object): New.
5717 * target.h (Target::make_elf_object): New template declaration.
5718 (Target::do_make_elf_object): New method declarations.
5719 (Target::do_make_elf_object_implementation): New template declaration.
5720
cc70f101
ILT
57212009-08-14 Ian Lance Taylor <iant@google.com>
5722
5723 * gold.h (FUNCTION_NAME): Define.
5724 (gold_unreachable): Use FUNCTION_NAME.
5725
ef5e0cb1
ST
57262009-08-12 Sriraman Tallam <tmsriram@google.com>
5727
5728 * icf.cc (Icf::find_identical_sections): Issue a warning when a
5729 symbol in the --keep-unique list is not found.
5730
48c187ce
ST
57312009-08-12 Sriraman Tallam <tmsriram@google.com>
5732
5733 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
5734 been maked as --keep-unique.
5735 (Icf::unfold_section): New function.
5736 * icf.h (Icf::unfold_section): New function.
5737 * options.h (General_options::keep_unique): New option.
5738 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
5739 * testsuite/Makefile.in: Regenerate.
5740 * testsuite/icf_keep_unique_test.sh: New file.
5741 * testsuite/icf_keep_unique_test.cc: New file.
5742
645afe0c
CC
57432009-08-12 Cary Coutant <ccoutant@google.com>
5744
5745 PR 10471
5746 * resolve.cc (Symbol_table::resolve): Check for references from
5747 dynamic objects to hidden and internal symbols.
5748 * testsuite/Makefile.am (hidden_test.sh): New test.
5749 * testsuite/Makefile.in: Regenerate.
5750 * testsuite/hidden_test.sh: New script.
5751 * testsuite/hidden_test_1.c: New test source.
5752 * testsuite/hidden_test_main.c: New test source.
5753
11af873f
DK
57542009-08-11 Doug Kwan <dougkwan@google.com>
5755
5756 * arm.cc: Update comments.
5757 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
5758 segment to locate the .ARM.exidx section if present.
5759
b9f7d72d
DK
57602009-08-09 Doug Kwan <dougkwan@google.com>
5761
5762 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
5763 patch.
5764
ddd3c53c
ST
57652009-08-07 Sriraman Tallam <tmsriram@google.com>
5766 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
5767 compiler warnings.
5768
27721062
ST
57692009-08-06 Sriraman Tallam <tmsriram@google.com>
5770
5771 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
5772 valid tls_segment only for non-debug-section relocations.
5773 * testsuite/Makefile.am: Add gc_tls_test.
5774 * testsuite/Makefile.in: Regenerate.
5775 * testsuite/gc_tls_test.cc: New file.
5776 * testsuite/gc_tls_test.sh: New file.
5777
ef15dade 57782009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 5779
ef15dade
ST
5780 * icf.cc: New file.
5781 * icf.h: New file.
5782 * Makefile.am (CCFILES): Add icf.cc.
5783 (HFILES): Add icf.h
5784 * Makefile.in: Regenerate.
5785 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
5786 * gc.h (gc_process_relocs): Populate lists used by icf to contain
5787 section, symbol and addend information for the relocs.
5788 * gold.cc (queue_middle_tasks): Call identical code folding.
5789 * gold.h: Add defines for multimap.
5790 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
5791 to the call of finalize_local_symbols.
5792 * main.cc (main): Create object of class Icf.
5793 * object.cc (Sized_relobj::do_layout): Allow this function to be
5794 called twice during icf.
5795 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
5796 to sections marked as identical by icf.
5797 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
5798 when available.
5799 (Sized_relobj::do_section_entsize): New function.
5800 * object.h (Object::section_entsize): New function.
5801 (Object::do_section_entsize): New pure virtual function.
5802 (Relobj::finalize_local_symbols): Add new parameter.
5803 (Relobj::do_section_entsize): New function.
5804 * options.h (General_options::icf): New option.
5805 (General_options::icf_iterations): New option.
5806 (General_options::print_icf_sections): New option.
5807 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
5808 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
5809 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
5810 icf.
5811 * symtab.cc (Symbol_table::is_section_folded): New function.
5812 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
5813 to sections marked as identical by icf.
5814 * symtab.h (Symbol_table::set_icf): New function.
5815 (Symbol_table::icf): New function.
5816 (Symbol_table::is_section_folded): New function.
5817 (Symbol_table::icf_): New data member.
5818 * target-reloc.h (relocate_section): Ignore sections folded by icf.
5819 * testsuite/Makefile.am: Add commands to build icf_test.
5820 * testsuite/Makefile.in: Regenerate.
5821 * testsuite/icf_test.sh: New file.
5822 * testsuite/icf_test.cc: New file.
5823
c3b65ac4
CD
58242009-07-24 Chris Demetriou <cgd@google.com>
5825
5826 * layout.cc (is_compressible_debug_section): Fix incorrect
5827 comment about compressed section names.
5828
1caf2c51
ILT
58292009-07-20 Ian Lance Taylor <ian@airs.com>
5830
5831 PR 10419
5832 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
5833
1ef4d87f
ILT
58342009-07-16 Ian Lance Taylor <iant@google.com>
5835
5836 PR 10400
5837 * layout.h: #include <map>.
5838 (class Kept_section): Change from struct to class. Add accessors
5839 and setters. Add section size to Comdat_group mapping. Change
5840 Comdat_group to std::map. Add is_comdat_ field. Add
5841 linkonce_size field in union.
5842 (class Layout): Update declaration of find_or_add_kept_section.
5843 Don't declare find_kept_object.
5844 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
5845 parameter. Add object, shndx, is_comdat, and is_group_name
5846 parameters. Change all callers. Adjust for new Kept_section.
5847 (Layout::find_kept_object): Remove.
5848 * object.cc (Sized_relobj::include_section_group): Update use of
5849 Kept_section. Rename secnum to shndx. Only record
5850 Kept_comdat_section if sections are the same size.
5851 (Sized_relobj::include_linkonce_section): Update use of
5852 Kept_section. Only record Kept_comdat_section if sections are the
5853 same size. Set size of linkonce section.
5854 (Sized_relobj::map_to_kept_section): Update call to
5855 get_kept_comdat_section.
5856 * object.h (class Sized_relobj): Rename fields in
5857 Kept_comdat_section to drop trailing underscores; change object
5858 field to Relobj*. Change Kept_comdat_section_table to store
5859 struct rather than pointer.
5860 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
5861 Add kept_object and kept_shndx parameters. Change all callers.
5862 (Sized_relobj::get_kept_comdat_section): Change return type to
5863 bool. Add kept_object and kept_shndx parameters. Change all
5864 callers.
5865 * plugin.cc (Pluginobj::include_comdat_group): Update call to
5866 Layout::find_or_add_kept_section.
5867
37c3b7b0
ILT
58682009-07-09 Ian Lance Taylor <iant@google.com>
5869
5870 * merge.cc (Object_merge_map::initialize_input_to_output_map):
5871 Reserve space in the hash table.
5872
98fa85cb
ILT
58732009-07-06 Mikolaj Zalewski <mikolajz@google.com>
5874
5875 * fileread.cc (File_read::get_mtime): New method.
5876 * fileread.h (Timespec): New structure.
5877 (File_read::get_mtime): New method.
5878 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
5879 Renamed from timestamp_nsec.
5880 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
5881 Elf_Xword.
e1df38aa 5882 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 5883 timestamp_nsec.
e1df38aa 5884 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
5885 (Incremental_inputs::report_obejct): Save mtime; style fix.
5886 (Incremental_inputs::report_script): Save mtime; style fix.
5887 (Incremental_inputs::finalize_inputs): Style fix.
5888 (Incremental_inputs::finalize): Style fix.
5889 (Incremental_inputs::create_input_section_data): Store inputs
5890 mtime.
5891 * incremental.h (Incremental_inputs::report_script): Add mtime
5892 argument.
5893 (Incremental_inputs::Input_info::Input_info): Intialize only one
5894 union member.
5895 (Incremental_inputs::Input_info::archive): Move to nameless
5896 union.
5897 (Incremental_inputs::Input_info::obejct): Move to nameless union.
5898 (Incremental_inputs::Input_info::script): Move to nameless union.
5899 (Incremental_inputs::mtime): New field.
5900 * script.cc (read_input_script): Pass file mtime to
5901 Incremental_input.
5902 * script.h (Script_info::inputs): Style fix.
5903
c9d70757
ILT
59042009-07-01 Ian Lance Taylor <ian@airs.com>
5905
5906 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
5907 instead of 32.
5908
9c547ec3
ILT
59092009-06-24 Ian Lance Taylor <iant@google.com>
5910
5911 PR 10156
5912 * layout.cc (Layout::choose_output_section): If we find an
5913 existing section, update the flags.
5914 (Layout::create_notes): New function, broken out of
5915 Layout::finalize.
5916 (Layout::finalize): Don't create note sections.
5917 (Layout::create_note): Don't crash if linker script discards
5918 section.
5919 (Layout::create_gold_note): Likewise.
5920 (Layout::create_build_id): Likewise. Don't set
5921 after_input_sections on the section.
5922 (Layout::create_executable_stack_info): Remove target parameter.
5923 Change caller.
5924 * layout.h (class Layout): Declare create_notes. Update
5925 declaration of create_executable_stack_info.
5926 * gold.cc (queue_middle_tasks): Call create_notes.
5927 * output.cc (Output_section::update_flags_for_input_section): Move
5928 here from output.h. If SHF_ALLOC flag is newly set, mark address
5929 invalid.
5930 * output.h (Output_data::mark_address_invalid): New function.
5931 (class Output_section): Only declare, not define,
5932 update_flags_for_input_section. Remove set_flags.
5933
55458500
ILT
59342009-06-24 Ian Lance Taylor <iant@google.com>
5935
5936 * script-sections.cc (Output_section_definition::
5937 set_section_addresses): Rename shadowing local load_address to
5938 laddr.
5939
1307d6cd
ILT
59402009-06-24 Ian Lance Taylor <iant@google.com>
5941
5942 PR 10244
5943 * reloc.cc (relocate_sections): Skip empty relocation sections.
5944
ec3f783e
ILT
59452009-06-23 Ian Lance Taylor <iant@google.com>
5946
5947 PR 10156
5948 * layout.cc (Layout::create_note): Use choose_output_section
5949 rather than make_output_section.
5950
459c9f1c
ILT
59512009-06-23 Ian Lance Taylor <iant@google.com>
5952
5953 PR 10237
5954 * options.cc (General_options::parse_V): Set printed_version_.
5955 (General_options::General_options): Initialize printed_version_.
5956 * options.h (class General_options): Add printed_version_ field.
5957 * gold.cc (queue_initial_tasks): If there are no input files,
5958 don't give a fatal error if we printed the version information.
5959 (queue_middle_tasks): If using -r with a shared object, give a
5960 fatal error rather than an ordinary error.
5961
1518dc8f
ILT
59622009-06-23 Ian Lance Taylor <iant@google.com>
5963
5964 PR 10219
5965 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
5966 (Layout::make_output_section): Set have_stabstr_section_ if we see
5967 a .stab*str section.
5968 (Layout::finalize): Call link_stabs_sections.
5969 (Layout::link_stabs_sections): New file.
5970 * layout.h (class Layout): Add have_stabstr_section_ field.
5971 Declare link_stabs_sections.
5972
3d857b98
DK
59732009-06-23 Doug Kwan <dougkwan@google.com>
5974
5975 * Makefile.am (libgold_a_LIBADD): New.
5976 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
5977 * Makefile.in: Regenerate.
5978 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
5979 * configure: Regenerate.
5980 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
5981 * fileread.cc: Include sys/state.h
5982 * gold.h: Declare memmem and strndup if found missing.
5983 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
5984
0639a6f6
ILT
59852009-06-23 Ian Lance Taylor <iant@google.com>
5986
5987 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
5988 * configure: Rebuild.
5989
8d63875c
ILT
59902009-06-23 Ian Lance Taylor <iant@google.com>
5991
5992 PR 10147
5993 * object.cc (Object::section_contents): Don't try to get a view if
5994 the section has length zero.
5995 (Object::handle_gnu_warning_section): If the section is empty, use
5996 the name of the section as the warning.
5997
f7c8a183
ILT
59982009-06-23 Ian Lance Taylor <iant@google.com>
5999
6000 PR 10133
6001 * stringpool.h (class Stringpool_template): Add optimize_ field.
6002 (Stringpool_template::set_optimize): New function.
6003 * stringpool.cc (Stringpool_template::Stringpool_template):
6004 Initialize optimize_ field.
6005 (Stringpool_template::set_string_offsets): Test local optimize
6006 fild rather than parameter.
6007 * layout.cc (Layout::Layout): Call set_optimize on the section
6008 name stringpool.
6009
e6a307ba
ILT
60102009-06-22 Ian Lance Taylor <iant@google.com>
6011
6012 PR 10030
6013 * yyscript.y: Parse TARGET.
6014 * script.cc (script_set_target): New function.
6015 * script-c.h (script_set_target): Declare.
6016 * options.cc (General_options::string_to_object_format): Rename
6017 from string_to_object_format in anonymous namespace. Change
6018 callers.
6019 * options.h (class General_options): Declare
6020 string_to_object_format.
6021
3ee173de
ILT
60222009-06-22 Ian Lance Taylor <iant@google.com>
6023
6024 * script-sections.cc (Script_sections::create_segments): Don't put
6025 program headers in a PT_LOAD segment if -n or -N.
6026
60272009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
6028
6029 PR 10141
6030 * options.h (class General_options): Add -z lazy and -z now. Sort
6031 -z options into alphabetical order.
6032 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6033
cd6739a1 60342009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
6035
6036 * layout.cc (Layout::make_output_section): Call
6037 Target::new_output_section.
6038 (Layout::attach_allocated_section_to_segment): Put large section
6039 sections in a separate load segment with the large segment flag
6040 set.
6041 (Layout::segment_precedes): Sort large data segments after other
6042 load segments.
6043 (align_file_offset): New static function.
6044 (Layout::set_segment_offsets): Use align_file_offset.
6045 * output.h (class Output_section): Add is_small_section_ and
6046 is_large_section_ fields.
6047 (Output_section::is_small_section): New function.
6048 (Output_section::set_is_small_section): New function.
6049 (Output_section::is_large_section): New function.
6050 (Output_section::set_is_large_section): New function.
6051 (Output_section::is_large_data_section): New function.
6052 (class Output_segment): Add is_large_data_segment_ field.
6053 (Output_segment::is_large_data_segment): New function.
6054 (Output_segment::set_is_large_data_segment): New function.
6055 * output.cc (Output_section::Output_section): Initialize new
6056 fields.
6057 (Output_segment::Output_segment): Likewise.
6058 (Output_segment::add_output_section): Add assertion that large
6059 data sections always go in large data segments. Force small data
6060 sections to the end of the list of data sections. Force small BSS
6061 sections to the start of the list of BSS sections. For large BSS
6062 sections to the end of the list of BSS sections.
6063 * symtab.h (class Symbol): Declare is_common_shndx.
6064 (Symbol::is_defined): Check Symbol::is_common_shndx.
6065 (Symbol::is_common): Likewise.
6066 (class Symbol_table): Define enum Commons_section_type. Update
6067 declarations. Add small_commons_ and large_commons_ fields.
6068 * symtab.cc (Symbol::is_common_shndx): New function.
6069 (Symbol_table::Symbol_table): Initialize new fields.
6070 (Symbol_table::add_from_object): Put small and large common
6071 symbols in the right list.
6072 (Symbol_table::sized_finalized_symbol): Check
6073 Symbol::is_common_shndx.
6074 (Symbol_table::sized_write_globals): Likewise.
6075 * common.cc (Symbol_table::do_allocate_commons): Allocate new
6076 common symbol lists. Don't call do_allocate_commons_list if the
6077 list is empty.
6078 (Symbol_table::do_allocate_commons_list): Remove is_tls
6079 parameter. Add comons_section_type parameter. Change all
6080 callers. Handle small and large common symbols.
6081 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
6082 Symbol::is_common_shndx.
6083 * resolve.cc (symbol_to_bits): Likewise.
6084 * target.h (Target::small_common_shndx): New function.
6085 (Target::small_common_section_flags): New function.
6086 (Target::large_common_shndx): New function.
6087 (Target::large_common_section_flags): New function.
6088 (Target::new_output_section): New function.
6089 (Target::Target_info): Add small_common_shndx, large_common_shndx,
6090 small_common_section_flags, and large_common_section_flags
6091 fields.
6092 (Target::do_new_output_section): New virtual function.
6093 * arm.cc (Target_arm::arm_info): Initialize new fields.
6094 * i386.cc (Target_i386::i386_info): Likewise.
6095 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6096 Likewise.
6097 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
6098 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6099 (Target_x86_64::do_new_output_section): New function.
6100 * configure.ac: Define conditional MCMODEL_MEDIUM.
6101 * testsuite/Makefile.am (check_PROGRAMS): Add large.
6102 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
6103 (large_LDFLAGS): Define.
6104 * testsuite/large.c: New file.
6105 * testsuite/testfile.cc (Target_test::test_target_info):
6106 Initialize new fields.
6107 * configure, testsuite/Makefile.in: Rebuild.
6108
bb04269c
DK
61092009-06-05 Doug Kwan <dougkwan@google.com>
6110
6111 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 6112 * Makefile.in: Regenerate.
bb04269c
DK
6113 * i386.cc (class Target_i386): Define new virtual method to
6114 override do_is_local_label_name in parent.
6115 * object.cc (Sized_relobj::do_count_local_symbols): Discard
6116 local symbols if --discard-locals or -X is given.
6117 * options.h (class General_options): Declare new options
6118 '--discard-locals' and '-X' for discarding locals.
6119 * target.h (class Target): Define new methods is_local_label_name.
6120 Declare new virtual method do_is_local_label_name.
6121 * target.cc: New file.
6122 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
6123 (check_SCRIPTS): Add discard_locals_test.sh.
6124 (check_DATA): Add discard_local_tests.syms.
6125 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
6126 (discard_local_tests.syms, discard_locals_test.o): New make rules.
6127 * testsuite/Makefile.in: Regenerate.
6128 * testsuite/discard_locals_test.c: New file.
6129 * testsuite/discard_locals_test.sh: Same.
6130
805bb01c
DK
61312009-06-05 Doug Kwan <dougkwan@google.com>
6132
6133 * object.cc (Sized_relobj::Sized_relobj): Initialize
6134 discarded_eh_frame_shndx_ to -1U.
6135 (Sized_relobj::do_layout): Record index of a discard .eh_frame
6136 section.
6137 (Sized_relobj::do_count_local_symbols): Skip local symbols in
6138 a discarded .eh_frame section.
6139 (Sized_relobj::do_finalize_local_symbols): Ditto.
6140 * object.h (class Sized_relobj): Declare new member
6141 discarded_eh_frame_shndx_.
6142 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
6143 (local_labels_test.o, local_labels_test): New rules.
6144 * testsuite/Makefile.in: Regenerate.
6145
1dcd334d
DK
61462009-06-04 Doug Kwan <dougkwan@google.com>
6147
6148 * layout.cc (Layout::section_name_mapping): Add mapping for
6149 special ARM sections.
6150
96d49306
DK
61512009-06-03 Doug Kwan <dougkwan@google.com>
6152
6153 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
6154 (utils::has_overflow): Same.
6155
dff16297
ILT
61562009-06-03 Ian Lance Taylor <iant@google.com>
6157
6158 * layout.cc (Layout::section_name_mapping): New array, replacing
6159 Layout::linkonce_mapping.
6160 (Layout::section_name_mapping_count): New variable, replacing
6161 Layout::linkonce_mapping_count.
6162 (Layout::linkonce_output_name): Remove.
6163 (Layout::output_section_name): Rewrite.
6164 * layout.h (class Layout): Rename Linkonce_mapping to
6165 Section_name_mapping, linkonce_mapping to section_name_mapping,
6166 linkonce_mapping_count to section_name_mapping_count. Don't
6167 declare linkonce_output_name.
6168
c121c671
DK
61692009-06-03 Doug Kwan <dougkwan@google.com>
6170
6171 * gold/arm.cc (namespace utils): New.
6172 (Target_arm::reloc_is_non_pic): Define new method.
6173 (class Arm_relocate_functions): New.
6174 (Target_arm::Relocate::relocate): Handle relocation types used by
6175 Android.
6176
07800fab
ILT
61772009-06-03 Ian Lance Taylor <iant@google.com>
6178
6179 * arm.cc (Target_arm::scan::global): Use || instead of |.
6180
c121c671
DK
61812009-06-02 Doug Kwan <dougkwan@google.com>
6182
6183 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
6184 issued_non_pic_error_.
6185 (class Target_arm::Scan): Declare new method check_non_pic.
6186 Define new method symbol_needs_plt_entry.
6187 Declare new data member issued_non_pic_error_.
6188 (class Target_arm::Relocate): Declare new method
6189 should_apply_static_reloc.
6190 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
6191 (Target_arm::Scan::check_non_pic): Define new method.
6192 (Target_arm::Scan::local): Handle a small subset of reloc types used
6193 by Android.
6194 (Target_arm::Scan::local): Same.
6195 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
6196
b19b0c6d
ILT
61972009-05-31 Mikolaj Zalewski <mikolajz@google.com>
6198
6199 * incremental.cc (Incremental_inputs::report_command_line): Filter
6200 out --incremental-* options.
6201
94cdfcff
DK
62022009-05-29 Doug Kwan <dougkwan@google.com>
6203
6204 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
6205 template class.
6206 (class Target_arm): Update comment.
6207 (Target_arm::Target_arm): Initialize new data members GOT_,
6208 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
6209 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
6210 and Target_arm::rel_dyn_section.
6211 Declare new_enum Target_arm::Got_type.
6212 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
6213 and DYNBSS_.
6214 Update commments for member do_dynsym_value.
6215 (Target_arm::got_size, Target_arm::plt_section,
6216 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
6217 new methods inside class defintion.
6218 (Target_arm::got_section): Define new method.
6219 (Target_arm::rel_dyn_section): Same.
6220 (Output_data_plt_arm): New template class.
6221 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
6222 (Output_data_plt_arm:do_adjust_output_section): Define new method.
6223 (Output_data_plt_arm::add_entry): Same.
6224 (Output_data_plt_arm::first_plt_entry): Define new
6225 static data member for PLT instruction template.
6226 (Output_data_plt_arm::plt_entry): Same.
6227 (Output_data_plt_arm::do_write): Define new method.
6228 (Target_arm::make_plt_entry): Same.
6229 (Target_arm::do_finalize_sections): Same.
6230 (Target_arm::do_dynsym_value): Same.
6231
4a657b0d
DK
62322009-05-28 Doug Kwan <dougkwan@google.com>
6233
6234 * Makefile.am (TARGETSOURCES): Add arm.cc.
6235 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
6236 * Makefile.in: Regenerate.
6237 * arm.cc: New file.
6238 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
6239
e7ae8c36
DK
62402009-05-26 Doug Kwan <dougkwan@google.com>
6241
6242 * options.cc (General_options::parse_exclude_libs). Fix a comment.
6243 (General_options::check_excluded_libs): Strip off directories in
6244 archive name before matching like GNU ld does.
6245 * testsuite/Makefile.am (MOSTLYCLEANFILES,
6246 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
6247 (exclude_libs_test_LDFLAGS): Add linker option
6248 -Wl,--exclude-libs,libexclude_libs_test_3
6249 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
6250 an explicit archive without using -l.
6251 (alt/libexclude_libs_test_3.a): New make rule.
6252 * testsuite/Makefile.in: Regenerate.
6253 * testsuite/exclude_libs_test.c : Declare lib3_default().
6254 (main): Call it.
6255 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
6256 * exclude_libs_test_3.c: New file.
6257
f12e7348
NC
62582009-05-26 Nick Clifton <nickc@redhat.com>
6259
6260 * po/id.po: New Indonesian translation.
6261 * po/gold.pot: Updated template file.
6262
4daadc0d
ST
62632009-05-22 Sriraman Tallam <tmsriram@google.com>
6264
e1df38aa 6265 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
6266 gc_comdat_test files. Add -Wl,--gc-sections to build
6267 gc_comdat_test.
6268 * testsuite/Makefile.in: Regenerate.
6269 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
6270
531813ad
ST
62712009-05-21 Sriraman Tallam <tmsriram@google.com>
6272
6273 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
6274 kept comdat section was garbage collected.
6275 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
6276 * testsuite/Makefile.in: Regenerate.
6277 * testsuite/gc_comdat_test.sh: New file.
6278 * testsuite/gc_comdat_test_1.cc: New file.
6279 * testsuite/gc_comdat_test_2.cc: New file.
6280
65514900
CC
62812009-05-19 Doug Kwan <dougkwan@google.com>
6282
6283 * archive.cc (Archive::Archive): Move constructor from archive.h
6284 to here. Initialize no_export_.
6285 (Archive::get_elf_object_for_member): Set no_export flag of object.
6286 * archive.h (Archive::Archive): Move constructor body to
6287 archive.cc.
6288 (Archive::no_export): New method.
6289 (Archive::no_export_): New field.
6290 * object.h (Object::Object): Initialize no_export_ to false.
6291 (Object::no_export, Object::set_no_export): New methods.
6292 (Object::no_export_): New field.
6293 * options.cc (General_options::parse_exclude_libs): New method.
6294 (General_options::check_excluded_libs) Same.
6295 * options.h (exclude_libs): New option.
6296 (General_options::check_excluded_libs): New method declaration.
6297 (General_options::excluded_libs_): New field.
6298 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
6299 default or protected visibility if an object has no-export flag set.
6300 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
6301 (check_SCRIPTS): Add exclude_libs_test.sh.
6302 (check_DATA): Add exclude_libs_test.syms.
6303 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
6304 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
6305 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
6306 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
6307 (exclude_libs_test.syms, libexclude_libs_test_1.a,
6308 libexclude_libs_test_2.a): New rules.
6309 * testsuite/Makefile.in: Regenerate.
6310 * testsuite/exclude_libs_test.c: New file.
6311 * testsuite/exclude_libs_test.sh: Ditto.
6312 * testsuite/exclude_libs_test_1.c: Ditto.
6313 * testsuite/exclude_libs_test_2.c: Ditto.
6314
1b77ea50
ILT
63152009-05-15 Ian Lance Taylor <iant@google.com>
6316
6317 * configure.ac: Check for declarations for cases where libiberty.h
6318 checks HAVE_DECL_xxx.
6319 * configure, config.in: Rebuild.
6320
072fe7ce
ILT
63212009-05-15 Mikolaj Zalewski <mikolajz@google.com>
6322
6323 * gold.h (Incremental_argument_list): Remove (invalid) forward
6324 declaration.
6325 * incremental.cc (Incremental_inputs::report_achive): New method.
6326 (Incremental_inputs::report_object): New method.
6327 (Incremental_inputs::report_script): New method.
6328 (Incremental_inputs::finalize_inputs): New method.
6329 (Incremental_inputs::finalize): Call finalize_inputs().
6330 (Incremental_inputs::sized_create_incremental_inputs_section_data):
6331 Create inputs entries.
6332 * incremental.h (Incremental_input_type): New enum.
6333 (Incremental_inputs::Incremental_input): Initialize new fields.
6334 (Incremental_inputs::report_inputs): New method.
6335 (Incremental_inputs::report_achive): New method.
6336 (Incremental_inputs::report_object): New method.
6337 (Incremental_inputs::report_script): New method.
6338 (Incremental_inputs::finalize_inputs): New method.
6339 (Incremental_inputs::Input_info): New struct.
6340 (Incremental_inputs::Input_info_map): New typedef.
6341 (Incremental_inputs::lock_): New field.
6342 (Incremental_inputs::Inputs_): New field.
6343 (Incremental_inputs::Inputs_map): New field.
6344 * main.cc (main): Call Incremental_input::report_inputs.
6345 * options.h (Input_argument_list): Typedef moved from
6346 Input_arguments.
6347 (Input_file_group::Files): Remove, use ::Input_argument_list.
6348 (Input_file_group::Input_argument_list): Remove, use
6349 ::Input_argument_list.
6350 * plugin.cc (Plugin_manager::add_input_file): Add error in
6351 incremental build.
6352 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
6353 functions.
6354 * script.cc (read_input_script): Call
6355 Incremental_input::report_script.
6356 * script.h (Script_info): New class.
6357
b0481b0b
ILT
63582009-04-27 Ian Lance Taylor <iant@google.com>
6359
6360 * x86_64.cc (do_adjust_output_section): Set entsize to
6361 plt_entry_size.
6362
b22a5a41 63632009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
6364
6365 * output.cc (Output_file::close): After short writes, continue
6366 writing from the correct offset in the buffer being written.
6367
40fde488
CD
63682009-04-23 Chris Demetriou <cgd@google.com>
6369
6370 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
6371 * configure: Regenerate.
6372 * config.in: Regenerate.
6373 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
6374 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
6375
3ce2c28e
ILT
63762009-04-21 Mikolaj Zalewski <mikolajz@google.com>
6377
6378 * incremental.cc (Incremental_inputs_header_data): Renamed from
6379 Incremental_input_header_data.
6380 (Incremental_inputs_header_data::data_size): New field.
6381 (Incremental_inputs_header_data::put_input_file_count): Renamed
6382 from input_file_count.
6383 (Incremental_inputs_header_data::put_command_line_offset): Renamed
6384 from command_line_offset.
6385 (Incremental_inputs_header_data::put_reserved): Renamed from
6386 put_reserved.
6387 (Incremental_inputs_entry_data): Renamed from
6388 Incremental_input_entry_data.
6389 (Incremental_inputs_entry_data::data_size): New field.
6390 (Incremental_inputs::report_command_line): New method.
6391 (Incremental_inputs::finalize): New method.
6392 (Incremental_inputs::create_incremental_inputs_data): New method.
6393 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
6394 * incremental.h: New file.
6395 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
6396 (Layout::finalize): Create incremental inputs section in
6397 incremental builds.
6398 (Layout::create_incremental_info_sections): New method.
6399 * layout.h (Layout::incremental_inputs): New method.
6400 (Layout::create_incremental_info_sections): New method.
6401 (Layout::incremental_inputs_): New field.
6402 * main.cc (main): Notify Incremental_input of the command line.
6403
e55bde5e
ILT
64042009-04-01 Ian Lance Taylor <iant@google.com>
6405 Mikolaj Zalewski <mikolajz@google.com>
6406
6407 * gold.h (reserve_unordered_map): Define, three versions, one for
6408 each version of Unordered_map.
6409 * layout.cc (Layout::Layout): Remove options parameter. Add
6410 number_of_input_files parameter. Don't initialize options_.
6411 Initialize number_of_input_files_ and resized_signatures_. Move
6412 sections_are_attached_.
6413 (Layout::layout_group): Reserve space for group_signatures_.
6414 (Layout::find_or_add_kept_section): Change name parameter to be a
6415 reference. Resize signatures_ map when it gets large enough.
6416 (Layout::layout_eh_frame): Use parameters->options() instead of
6417 this->options_.
6418 (Layout::make_output_section): Likewise.
6419 (Layout::attach_allocated_section_to_segment): Likewise.
6420 (Layout::finalize, Layout::create_executable_stack): Likewise.
6421 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
6422 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
6423 * layout.h (class Layout): Update declarations. Remove options_
6424 field. Add number_of_input_files_ and resized_signatures_
6425 fields. Move sections_are_attached_ field.
6426 * main.cc (main): Pass number of input files to Layout
6427 constructor. Don't pass options.
6428
154b857c
ILT
64292009-03-30 Ian Lance Taylor <iant@google.com>
6430
6431 * ffsll.c (ffsll): Correct implementation.
6432
2f35ab9b
ILT
64332009-03-27 Ian Lance Taylor <iant@google.com>
6434
fd03461a
ILT
6435 * ffsll.c: New file.
6436 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
6437 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
6438 * ftruncate.c (ftruncate): Declare before definition.
6439 * mremap.c (mremap): Likewise.
6440 * pread.c (pread): Likewise.
6441 * configure, Makefile.in, config.in: Rebuild.
6442
2f35ab9b
ILT
6443 * mremap.c: New file.
6444 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
6445 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
6446 (mremap): Declare if HAVE_MREMAP is not defined.
6447 * configure, Makefile.in, config.in: Rebuild.
6448
33aea2fd
CC
64492009-03-27 Cary Coutant <ccoutant@google.com>
6450
6451 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
6452 position independent.
6453 * sparc.cc (Target_sparc::check_non_pic): Likewise.
6454 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
6455
6d479619
CC
64562009-03-24 Cary Coutant <ccoutant@google.com>
6457
6458 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
6459 an executable.
6460 (needs_dynamic_reloc): Likewise.
6461
afc06bb8
ILT
64622009-03-24 Ian Lance Taylor <iant@google.com>
6463
6464 * yyscript.y (file_cmd): Recognize EXTERN.
6465 (extern_name_list, extern_name_list_body): New nonterminals.
6466 * script.cc (script_add_extern): Define.
6467 * script-c.h (script_add_extern): Declare.
6468
f6060a4d
ILT
64692009-03-24 Rafael Avila de Espindola <espindola@google.com>
6470
6471 * object.cc (is_elf_object): Define.
6472 * object.h (is_elf_object): Declare.
6473 * archive.cc (Archive::get_elf_object_for_member): Call
6474 is_elf_object.
33aea2fd 6475 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 6476
26736d8e
ILT
64772009-03-24 Elliott Hughes <enh@google.com>
6478
6479 * output.cc (Output_file::map_anonymous): Define.
6480 (Output_file::map): Use map_anonymous. If the regular mmap fails,
6481 try an anonymous one. Report the size if the mmap fails.
6482 * output.h (class Output_file): Declare map_anonymous.
6483
22fd9730
ILT
64842009-03-24 Ian Lance Taylor <iant@google.com>
6485
6486 * target-select.cc (instantiate_target): Don't acquire the lock if
6487 the instantiated_target_ field has already been set.
6488
cb010894
ILT
64892009-03-23 Ian Lance Taylor <iant@google.com>
6490
7f055c20
ILT
6491 * gold-threads.h (class Initialize_lock): Define.
6492 * gold-threads.cc (class Initialize_lock_once): Define.
6493 (initialize_lock_control): New static variable.
6494 (initialize_lock_pointer): New static variable.
6495 (initialize_lock_once): New static function.
6496 (Initialize_lock::Initialize_lock): Define.
6497 (Initialize_lock::initialize): Define.
6498 * target-select.h: Include "gold-threads.h".
6499 (class Target_selector): Add lock_ and initialize_lock_ fields.
6500 Don't define instantiate_target, just declare it.
6501 * target-select.cc (Target_selector::Target_selector): Initialize
6502 new fields.
6503 (Target_selector::instantiate_target): Define.
6504 * descriptors.h: Include "gold-threads.h".
6505 (class Descriptors): Add initialize_lock_ field.
6506 * descriptors.cc (Descriptors::Descriptors): Initialize new
6507 field.
6508 (Descriptors::open): Use initialize_lock_ field
6509 * errors.h (class Errors): Add initialize_lock_ field.
6510 * errors.cc (Errors::Errors): Initialize new field.
6511 (Errors::initialize_lock): Use initialize_lock_ field.
6512 * powerpc.cc (class Target_selector_powerpc): Remove
6513 instantiated_target_ field. In do_recognize call
6514 instantiate_target rather than do_instantiate_target. In
6515 do_instantiate_target just allocate a new target.
6516 * sparc.cc (class Target_selector_sparc): Likewise.
6517
36959681
ILT
6518 * freebsd.h: New file.
6519 * i386.cc: Include "freebsd.h".
6520 (Target_i386): Derive from Target_freebsd rather than
6521 Sized_target.
6522 (Target_selector_i386): Derive from Target_selector_freebsd rather
6523 than Target_selector.
6524 * x86_64.cc: Include "freebsd.h".
6525 (Target_x86_64): Derive from Target_freebsd rather than
6526 Sized_target.
6527 (Target_selector_x86_64): Derive from Target_selector_freebsd
6528 rather than Target_selector.
6529 * target.h (class Target): Add adjust_elf_header and
6530 do_adjust_elf_header.
6531 * output.cc (Output_file_header:: do_sized_write): Call target
6532 adjust_elf_header routine.
6533 * configure.tgt: Set targ_osabi.
6534 * configure.ac: Define GOLD_DEFAULT_OSABI.
6535 * parameters.cc (Parameters::default_target): Pass
6536 GOLD_DEFAULT_OSABI to select_target.
6537 * target-select.h (class Target_selector): Make instantiate_target
6538 protected rather than private.
6539 * Makefile.am (HFILES): Add freebsd.h.
6540 * configure, Makefile.in, config.in: Rebuild.
6541
cb010894
ILT
6542 * merge.cc (do_add_input_section): Correct pend value. Change
6543 message about last entry not being null terminated from error to
6544 warning.
6545
0e879927
ILT
65462009-03-20 Mikolaj Zalewski <mikolajz@google.com>
6547
6548 * incremental.cc: New file.
6549 * Makefile.am (CCFILES): Add incremental.cc.
6550 * Makefile.in: Rebuild.
6551
41105937
PP
65522009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
6553
6554 * layout.cc (Layout::output_section_name): Preserve names
6555 of '.note.' sections.
e1df38aa 6556
60439920
ILT
65572009-03-19 Ian Lance Taylor <iant@google.com>
6558
6559 * descriptors.cc (Descriptors::open): Check that the options are
6560 valid before using them.
6561
0d371ad3
ILT
65622009-03-18 Ian Lance Taylor <iant@google.com>
6563
6564 * script-sections.h: Include <list>.
6565 (class Script_sections): Change Sections_elements from std::vector
6566 to std::list. Typedef public Elements_iterator. Add
6567 orphan_section_placement_, data_segment_align_start_, and
6568 saw_data_segment_align_ fields. Remove data_segment_align_index_
6569 field.
6570 * script-sections.cc (class Orphan_section_placement): New class.
6571 (class Sections_element): Add virtual functions is_relro and
6572 orphan_section_init. Remove virtual function place_orphan_here.
6573 (class Output_section_definition): Add is_relro and
6574 orphan_section_init. Remove place_orphan_here.
6575 (class Orphan_output_section): Likewise.
6576 (Script_sections::Script_sections): Update for field changes.
6577 (Script_sections::data_segment_align): Set saw_data_segment_align_
6578 and data_segment_align_start_, not data_segment_align_index.
6579 (Script_sections::data_segment_relro_end): Check
6580 saw_data_segment_align_. Use data_segment_align_start_ rather
6581 than data_segment_align_index_.
6582 (Script_sections::place_orphan): Rewrite to use
6583 Orphan_section_placement.
6584
9201d894
ILT
65852009-03-17 Ian Lance Taylor <iant@google.com>
6586
9c5b8369
ILT
6587 * archive.cc (Archive::add_symbols): Check for a version attached
6588 to the symbol name in the archive map.
6589 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
6590 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
6591 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
6592 (ver_test_11.a): New target.
6593 * testsuite/Makefile.in: Rebuild.
6594
9201d894
ILT
6595 * configure.ac: Check for chsize and posix_fallocate. Replace
6596 ftruncate.
6597 * ftruncate.c: New file, from gnulib.
6598 * output.cc (posix_fallocate): Define dummy version if not
6599 HAVE_POSIX_FALLOCATE.
6600 (Output_file::map): Call posix_fallocate rather than lseek and
6601 write.
6602 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
6603 * configure, Makefile.in, config.in: Rebuild.
6604
ef4ab7a8 66052009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 6606
ef4ab7a8
PP
6607 * layout.h (Layout::create_note): Add section_name parameter.
6608 * layout.cc (Layout::create_note): Likewise.
6609 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 6610
8c500701
ILT
66112009-03-17 Ian Lance Taylor <iant@google.com>
6612
e85b18e1
ILT
6613 * descriptors.cc: Include "options.h".
6614 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
6615 (Descriptors::open): Always use O_CLOEXEC when opening a new
6616 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
6617 then set FD_CLOEXEC.
6618
9efe6174
ILT
6619 * sparc.cc (class Target_sparc): Add has_got_section.
6620 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
6621 make sure we have a GOT section.
6622
6623 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
6624 (Target_sparc::Scan::local): Likewise.
6625 (Target_sparc::Scan::global): Likewise.
6626 (Target_sparc::Relocate::relocate): Likewise.
6627 (Target_sparc::Relocate::relocate_tls): Likewise.
6628
8c500701
ILT
6629 * symtab.cc (Symbol_table::define_default_version): New function,
6630 broken out of add_from_object.
6631 (Symbol_table::add_from_object): Call define_default_version.
6632 (Symbol_table::define_special_symbol): Add resolve_oldsym
6633 parameter. Change all callers. If the version for a symbol comes
6634 from a version script, resolve it with the symbol with the same
6635 name with no version. Also add the symbol without a version if
6636 appropriate.
6637 (do_define_in_output_data): If resolving with oldsym, don't delete
6638 sym.
6639 (do_define_in_output_segment): Likewise.
6640 (do_define_as_constant): Likewise.
6641 * symtab.h (class Symbol_table): Update declarations.
6642
f1ed28fb
ILT
66432009-03-13 Ian Lance Taylor <iant@google.com>
6644
15f8229b
ILT
6645 * readsyms.cc (Read_symbols::incompatible_warning): New function.
6646 (Read_symbols::requeue): New function.
6647 (Read_symbols::do_read_symbols): If make_elf_object fails because
6648 the target type is not configured, and the file was searched for,
6649 issue a warning and retry with the next directory.
6650 (Add_symbols::run): If the file has an incompatible format, and
6651 it was searched for, requeue the Read_symbols task. On error,
6652 release the object.
6653 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
6654 dirindex parameter to constructor. Change all callers. Declare
6655 incompatible_warning and requeue.
6656 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
6657 input_argument_ and input_group_ fields. Add them to
6658 constructor. Change all callers.
6659 (class Read_script): Add dirindex_ field. Add it to constructor.
6660 Change all callers.
6661 * archive.cc (Archive::setup): Remove input_objects parameter.
6662 Change all callers.
6663 (Archive::get_file_and_offset): Likewise.
6664 (Archive::read_all_symbols): Likewise.
6665 (Archive::read_symbols): Likewise.
6666 (Archive::get_elf_object_for_member): Remove input_objects
6667 parameter. Add punconfigured parameter. Change all callers.
6668 (Archive::add_symbols): Change return type to bool. Check return
6669 value of include_member.
6670 (Archive::include_all_members): Likewise.
6671 (Archive::include_member): Change return type to bool. Return
6672 false if first included object has incompatible target. Set
6673 included_member_ field.
6674 (Add_archive_symbols::run): If add_symbols returns false, requeue
6675 Read_symbols task.
6676 * archive.h (class Archive): Add included_member_ field.
6677 Initialize it in constructor. Add input_file and searched_for
6678 methods. Update declarations.
6679 (class Add_archive_symbols): Add dirpath_, dirindex_, and
6680 input_argument_ fields. Add them to constructor. Change all
6681 callers.
6682 * script.cc: Include "target-select.h".
6683 (class Parser_closure): Add skip_on_incompatible_target_ and
6684 found_incompatible_target_ fields. Add
6685 skip_on_incompatible_target parameter to constructor. Change all
6686 callers. Add methods skip_on_incompatible_target,
6687 clear_skip_on_incompatible_target, found_incompatible_target, and
6688 set_found_incompatible_target.
6689 (read_input_script): Add dirindex parameter. Change all callers.
6690 If parser finds an incompatible target, requeue Read_symbols
6691 task.
6692 (script_set_symbol): Clear skip_on_incompatible_target in
6693 closure.
6694 (script_add_assertion, script_parse_option): Likewise.
6695 (script_start_sections, script_add_phdr): Likewise.
6696 (script_check_output_format): New function.
6697 * script.h (read_input_script): Update declaration.
6698 * script-c.h (script_check_output_format): Declare.
6699 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
6700 (ignore_cmd): Remove OUTPUT_FORMAT.
6701 * fileread.cc (Input_file::Input_file): Add explicit this.
6702 (Input_file::will_search_for): New function.
6703 (Input_file::open): Add pindex parameter. Change all callers.
6704 * fileread.h (class Input_file): Add input_file_argument method.
6705 Declare will_search_for. Update declarations.
6706 * object.cc (make_elf_object): Add punconfigured parameter.
6707 Change all callers.
6708 * object.h (class Object): Make input_file public. Add
6709 searched_for method.
6710 (make_elf_object): Update declaration.
6711 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
6712 restart search.
6713 * dirsearch.h (class Dirsearch): Update declaration.
6714 * options.h (class General_options): Add --warn-search-mismatch.
6715 * parameters.cc (Parameters::is_compatible_target): New function.
6716 * parameters.h (class Parameters): Declare is_compatible_target.
6717 * workqueue.cc (Workqueue::add_blocker): New function.
6718 * workqueue.h (class Workqueue): Declare add_blocker.
6719
f1ed28fb
ILT
6720 * fileread.cc (Input_file::open): Remove options parameter.
6721 Change all callers.
6722 (Input_file::open_binary): Likewise.
6723 * script.cc (read_input_script): Likewise.
6724 * readsyms.h (class Read_symbols): Remove options_ field. Remove
6725 options parameter from constructor. Change all callers.
6726 (class Read_script): Likewise.
6727 * fileread.h (class Input_file): Update declarations.
6728 * script.h (read_input_script): Update declaration.
6729
34dd024a
NC
67302009-03-10 Nick Clifton <nickc@redhat.com>
6731
6732 * po/es.po: New Spanish translation.
6733
6d71b17c
CC
67342009-03-06 Cary Coutant <ccoutant@google.com>
6735
6736 * options.cc (parse_short_option): Keep dash_z from registering itself.
6737
031cdbed
ILT
67382009-03-03 Ian Lance Taylor <iant@google.com>
6739
6740 PR 9918
6741 * target-reloc.h (relocate_section): Pass output_section to
6742 relocate.
6743 * i386.cc (Target_i386::should_apply_static_reloc): Add
6744 output_section parameter. Change all callers.
6745 (Target_i386::Relocate::relocate): Add output_section parameter.
6746 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6747 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
6748 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
6749 * testsuite/two_file_shared.sh: New script.
6750 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
6751 (check_DATA): Add two_file_shared.dbg.
6752 (two_file_shared.dbg): New target.
6753 * testsuite/Makefile.in: Rebuild.
6754
15d5fa16
ILT
67552009-03-01 Ian Lance Taylor <iant@google.com>
6756
6757 * configure.ac: Check for byteswap.h.
6758 * configure: Rebuild.
6759 * config.in: Rebuild.
6760
8a4c0b0d
ILT
67612009-03-01 Mikolaj Zalewski <mikolajz@google.com>
6762
6763 * layout.cc (Layout::find_or_add_kept_section): New function.
6764 (Layout::add_comdat): Removed.
6765 * layout.h (struct Kept_section): Move out of class Layout.
6766 Remove trailing underscores from field names. Add group_sections
6767 field. Rename group_ field to is_group. Change all uses.
6768 (class Layout): Declare find_or_add_kept_section, not add_comdat.
6769 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
6770 comdat_groups_ field.
6771 (Sized_relobj::include_section_group): Use
6772 find_or_add_kept_section and Kept_section::group_sections.
6773 (Sized_relobj::include_linkonce_section): Likewise.
6774 * object.cc (class Sized_relobj): Don't define Comdat_group or
6775 Comdat_group_table. Remove find_comdat_group and
6776 add_comdat_group. Remove comdat_groups_ field.
6777 * plugin.cc (include_comdat_group): Use
6778 Layout::find_or_add_kept_section.
6779
b4ecf66b
ILT
67802009-02-28 Ian Lance Taylor <iant@google.com>
6781
14359ca0
ILT
6782 * README: --gc-sections and map files are now supported. Document
6783 some build requirements.
6784
b4ecf66b
ILT
6785 PR 6992
6786 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
6787 relocatable link set the value of the section symbol to zero.
6788 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
6789 relocatable link don't include the section address in the local
6790 symbol value.
6791
0602e05a
ILT
67922009-02-27 Ian Lance Taylor <iant@google.com>
6793
fd9d194f
ILT
6794 PR 6811
6795 * options.h (class Search_directory): Add is_system_directory.
6796 (class General_options): Declare is_in_system_directory.
6797 * options.cc (get_relative_sysroot): Make static.
6798 (get_default_sysroot): Make static.
6799 (General_optoins::is_in_system_directory): New function.
6800 * fileread.cc (Input_file::is_in_system_directory): New function.
6801 * fileread.h (class Input_file): Declare is_in_system_directory.
6802 * object.h (class Object): Add is_in_system_directory.
6803 (class Input_objects): Remove system_library_directory_ field.
6804 * object.cc (Input_objects::add_object): Don't set
6805 system_library_directory_.
6806 (input_objects::found_in_system_library_directory): Remove.
6807 * symtab.cc (Symbol_table::write_globals): Remove input_objects
6808 parameter. Change all callers.
6809 (Symbol_table::sized_write_globals): Likewise.
6810 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
6811 Call Object::is_in_system_directory.
6812 * symtab.h (class Symbol_table): Update declarations.
6813
61edd21f
ILT
6814 PR 5990
6815 * descriptors.h (Open_descriptor): Add is_on_stack field.
6816 * descriptors.cc (Descriptors::open): If the descriptor is on the
6817 top of the stack, remove it. Initialize is_on_stack field.
6818 (Descriptors::release): Only add pod to stack if it is not on the
6819 stack already.
6820 (Descriptors::close_some_descriptor): Clear stack_next and
6821 is_on_stack fields.
6822
e29e076a
ILT
6823 PR 7091
6824 * output.cc (Output_section::find_starting_output_address): Rename
6825 from starting_output_address; add PADDR parameter; change return
6826 type.
6827 * output.h (class Output_section): Declare
6828 find_starting_output_address instead of starting_output_address.
6829 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
6830 section symbol for which we can't find a merge section.
6831
0602e05a
ILT
6832 PR 9836
6833 * symtab.cc (Symbol_table::add_from_object): If the visibility is
6834 hidden or internal, force the symbol to be local.
6835 * resolve.cc (Symbol::override_visibility): Define.
6836 (Symbol::override_base): Use override_visibility.
6837 (Symbol_table::resolve): Likewise.
6838 (Symbol::override_base_with_special): Likewise.
6839 (Symbol_table::override_with_special): If the visibility is hidden
6840 or internal, force the symbol to be local.
6841 * symtab.h (class Symbol): Add set_visibility and
6842 override_visibility.
6843 * testsuite/ver_test_1.sh: New file.
6844 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
6845 (check_DATA): Add ver_test_1.syms.
6846 (ver_test_1.syms): New target.
6847 * testsuite/Makefile.in: Rebuild.
6848
401a9a73
CC
68492009-02-25 Cary Coutant <ccoutant@google.com>
6850
6851 * layout.cc (Layout::choose_output_section): Don't rename sections
6852 when using a linker script that has a SECTIONS clause.
6853 * Makefile.in: Regenerate.
6854
6855 * testsuite/Makefile.am (script_test_5.sh): New test case.
6856 * testsuite/Makefile.in: Regenerate.
6857 * testsuite/script_test_5.cc: New file.
6858 * testsuite/script_test_5.sh: New file.
6859 * testsuite/script_test_5.t: New file.
6860
f488e4b0
CC
68612009-02-13 Rafael Avila de Espindola <espindola@google.com>
6862
6863 * archive.cc (Archive::include_member): Update calls to add_symbols.
6864 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
6865 the Layout argument.
6866 * dynobj.h (do_add_symbols): Add the Layout argument.
6867 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
6868 Layout argument.
6869 * object.h (Object::add_symbols): Add the Layout argument.
6870 (Object::do_add_symbols): Add the Layout argument.
6871 (Sized_relobj::do_add_symbols): Add the Layout argument.
6872 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
6873 Unify the two versions.
6874 (Add_plugin_symbols): Remove.
6875 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
6876 (Sized_pluginobj::do_add_symbols): Unify the two versions.
6877 (Add_plugin_symbols): Remove.
6878 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
6879 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
6880 (Add_symbols::run): Make it work with Pulginobj.
6881
89dd1680
ILT
68822009-02-06 Ian Lance Taylor <iant@google.com>
6883
6884 * object.cc (Sized_relobj::do_layout): Make info message start
6885 with lower case letter.
6886
266d0a74
ILT
68872009-02-06 Mikolaj Zalewski <mikolajz@google.com>
6888
602b464e
ILT
6889 * binary.cc: Fix file comment.
6890
266d0a74
ILT
6891 * options.h (enum Incremental_disposition): Define.
6892 (class General_options): Add new options: --incremental,
6893 --incremental_changed, --incremental_unchanged,
6894 --incremental_unknown. Add incremental_disposition_ and
6895 implicit_incremental_ fields.
6896 (General_options::incremental_disposition): New function.
6897 (class Position_dependent_options): Add incremental_disposition
6898 option.
6899 (Position_dependent_options::copy_from_options): Set incremental
6900 dispositions.
6901 * options.cc (General_options::parse_incremental_changed): New
6902 function.
6903 (General_options::parse_incremental_unchanged): New function.
6904 (General_options::parse_incremental_unknown): New function.
6905 (General_options::General_options): Initialize new fields
6906 incremental_disposition_ and implicit_incremental_.
6907 (General_options::finalize): Check for uasge of --incremental-*
6908 without --incremental.
6909
f073bbf7
CD
69102009-02-06 Chris Demetriou <cgd@google.com>
6911
6912 * gold.h (gold_undefined_symbol): Change to take only a Symbol
6913 pointer and to report location as the file name associated with
6914 the symbol.
6915 (gold_undefined_symbol_at_location): New function to replace the
6916 old gold_undefined_symbol functionality.
6917 * target-reloc.h (relocate_section): Update to use
6918 gold_undefined_symbol_at_location.
6919 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
6920 Call gold_undefined_symbol function rather than gold_error.
6921 * errors.h (Errors::undefined_symbol): Take location as a
6922 string, rather than calculating it from a relocation.
6923 * errors.cc (Errors::fatal): Print "fatal error:" before the
6924 formatted message.
6925 (Errors::error, Errors::error_at_location): Print "error: "
6926 before the formatted message.
6927 (Errors::undefined_symbol): Take location as a string, rather
6928 than calculating it from a relocation.
6929 (gold_undefined_symbol_at_location): New function akin to
6930 old gold_undefined_symbol, calculates location from relocation.
6931 (gold_undefined_symbol): Change to take only a Symbol pointer
6932 and to report location as the file name associated with the symbol.
6933 * testsuite/debug_msg.sh: Update for changed error messages.
6934 * testsuite/undef_symbol.sh: Likewise.
6935
8e94a90c
ILT
69362009-02-04 Duncan Sands <baldrick@free.fr>
6937
6938 PR 9812
6939 * reduced_debug_output.h
6940 (Output_reduced_debug_abbrev_section::failed): Use format for
6941 gold_warning.
6942 (Output_reduced_debug_info_section::faild): Likewise.
6943
88a0e15b
ILT
69442009-01-31 Mikolaj Zalewski <mikolajz@google.com>
6945
6946 * script.cc (Lazy_demangler): New class.
6947 (Version_script_info::get_symbol_version_helper): Demangle a
6948 symbol only once.
6949
5efc7cd2
CC
69502009-01-29 Cary Coutant <ccoutant@google.com>
6951
6952 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
6953 to __tls_get_addr.
6954 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6955
e0ebcf42
ILT
69562009-01-28 Ian Lance Taylor <iant@google.com>
6957
5efc7cd2 6958 * version.cc (version_string): Bump to 1.9.
75fe7426 6959
e0ebcf42
ILT
6960 * gold.h: Include <cstring> and <stdint.h>.
6961 * version.cc: Include <cstdio>.
6962 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
6963 warning.
6964 * reduced_debug_output.cc (insert_into_vector): Rename from
6965 Insert_into_vector; change all callers. Use Swap_unaligned to
6966 avoid aliasing issue; remove union since it is unnecessary.
6967
8e2813be 69682009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
6969
6970 * Makefile.am (CCFILES): Add gc.cc.
6971 (HFILES): Add gc.h.
6972 * Makefile.in: Regenerate.
6973 * gold.cc (Gc_runner): New class.
6974 (queue_initial_tasks): Call garbage collection related tasks
6975 when corresponding options are invoked.
6976 (queue_middle_gc_tasks): New function.
6977 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
6978 processed early before laying out sections during garbage collection.
6979 * gold.h (queue_middle_gc_tasks): New function.
6980 (is_prefix_of): Move from "layout.cc".
6981 * i386.cc (Target_i386::gc_process_relocs): New function.
6982 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
6983 * main.cc (main): Create object of class "Garbage_collection".
6984 * object.cc (Relobj::copy_symbols_data): New function.
6985 (Relobj::is_section_name_included): New function.
e1df38aa
NC
6986 (Sized_relobj::do_layout): Allow this function to be called twice
6987 during garbage collection and defer layout of section during the
6d03d481
ST
6988 first call.
6989 * object.h (Relobj::get_symbols_data): New function.
6990 (Relobj::is_section_name_included): New function.
6991 (Relobj::copy_symbols_data): New function.
6992 (Relobj::set_symbols_data): New function.
6993 (Relobj::get_relocs_data): New function.
6994 (Relobj::set_relocs_data): New function.
6995 (Relobj::is_output_section_offset_invalid): New pure virtual function.
6996 (Relobj::gc_process_relocs): New function.
6997 (Relobj::do_gc_process_relocs): New pure virtual function.
6998 (Relobj::sd_): New data member.
6999 (Sized_relobj::is_output_section_offset_invalid): New function.
7000 (Sized_relobj::do_gc_process_relocs): New function.
7001 * options.h (General_options::gc_sections): Modify to not be a no-op.
7002 (General_options::print_gc_sections): New option.
7003 * plugin.cc (Plugin_finish::run): Remove function call to
7004 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
7005 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7006 * reloc.cc (Read_relocs::run): Add task to process relocs and
7007 determine unreferenced sections when doing garbage collection.
7008 (Gc_process_relocs): New class.
7009 (Sized_relobj::do_gc_process_relocs): New function.
7010 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7011 sections that are garbage collected.
7012 * reloc.h (Gc_process_relocs): New class.
7013 * sparc.cc (Target_sparc::gc_process_relocs): New function.
7014 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7015 symbols whose corresponding sections are garbage collected.
7016 (Symbol_table::Symbol_table): Add new parameter for the garbage
7017 collection object.
7018 (Symbol_table::gc_mark_undef_symbols): New function.
7019 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7020 (Symbol_table::gc_mark_dyn_syms): New function.
7021 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7022 as garbage.
7023 (Symbol_table::add_from_object): Likewise.
7024 (Symbol_table::add_from_relobj): When building shared objects, do not
7025 treat externally visible symbols as garbage.
7026 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7027 table information for static and relocatable links.
7028 * symtab.h (Symbol_table::set_gc): New function.
7029 (Symbol_table::gc): New function.
7030 (Symbol_table::gc_mark_undef_symbols): New function.
7031 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7032 (Symbol_table::gc_mark_dyn_syms): New function.
7033 (Symbol_table::gc_): New data member.
e1df38aa 7034 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
7035 function.
7036 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7037 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7038
3b293544
CF
70392009-01-20 Chris Faylor <me.sourceware@sourceware.org>
7040
7041 * options.h (General_options::gc_sections): Define as a no-op for now.
7042 (General_options::no_keep_memory): Ditto.
7043 (General_options::Bshareable): Define.
7044 * options.cc (General_options::finalize): Honor -Bshareable.
7045
83d22aa8
AS
70462009-01-20 Andreas Schwab <schwab@suse.de>
7047
7048 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7049 read the value in the contents, since we don't use it. Use the
7050 template endianness when writing.
7051 (Relocate::relocate): Use it for R_PPC_REL16_HA.
7052
cd536b21
AS
70532009-01-19 Andreas Schwab <schwab@suse.de>
7054
7055 * configure.tgt (powerpc64-*): Fix targ_obj.
7056
99e9a495
ILT
70572009-01-15 Ian Lance Taylor <iant@google.com>
7058
7059 * object.cc (Sized_relobj::write_local_symbols): Don't write out
7060 local symbols when stripping all symbols.
7061
bbbfea06
CC
70622009-01-14 Cary Coutant <ccoutant@google.com>
7063
99e9a495 7064 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 7065
0f7c0701
CC
70662009-01-14 Cary Coutant <ccoutant@google.com>
7067
7068 * archive.cc (Archive::get_elf_object_for_member): Remove call
7069 to File_read::claim_for_plugin.
7070 * descriptors.cc (Descriptors::open): Remove reference to
7071 is_claimed.
7072 (Descriptors::claim_for_plugin): Remove.
7073 * descriptors.h (Descriptors::claim_for_plugin): Remove.
7074 (Descriptors::is_claimed): Remove.
7075 (claim_descriptor_for_plugin): Remove.
7076 * fileread.cc (File_read::claim_for_plugin): Remove.
7077 * fileread.h (File_read::claim_for_plugin): Remove.
7078 (File_read::descriptor): Reopen descriptor if necessary.
7079 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
7080 (Plugin_manager::all_symbols_read): Add task parameter. Change
7081 all callers.
7082 (Plugin_manager::get_input_file): New function.
7083 (Plugin_manager::release_input_file): New function.
7084 (Pluginobj::Pluginobj): Add filesize parameter and initialize
7085 corresponding data member.
7086 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
7087 and pass to base constructor. Change all callers.
7088 (get_input_file, release_input_file): New functions.
7089 (make_sized_plugin_object): Add filesize parameter. Change all callers.
7090 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
7091 (Plugin_manager::all_symbols_read): Add task parameter.
7092 (Plugin_manager::get_input_file): New function.
7093 (Plugin_manager::release_input_file): New function.
7094 (Plugin_manager::task_): New data member.
7095 (Pluginobj::Pluginobj): Add filesize parameter.
7096 (Pluginobj::filename): New function.
7097 (Pluginobj::descriptor): New function.
7098 (Pluginobj::filesize): New function.
7099 (Pluginobj::filesize_): New data member.
7100 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
7101 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
7102 File_read::claim_for_plugin; use Object::unlock to unlock the file.
7103
7104 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
7105 with archive libraries.
7106 * testsuite/Makefile.in: Regenerate.
7107 * testsuite/plugin_test.c (struct sym_info): New type.
7108 (get_input_file, release_input_file): New static variables.
7109 (onload): Capture new transfer vector entries.
7110 (claim_file_hook): Stop reading at end of file according to filesize.
7111 Factor out parsing of readelf output into separate function.
7112 (all_symbols_read_hook): Exercise get_input_file and release_input_file
7113 APIs and get the source file name from the symbol table. Convert
7114 source file name to corresponding object file name. Print info
7115 message when adding new input files.
7116 (parse_readelf_line): New function.
7117 * testsuite/plugin_test_1.sh: Add checks for new info messages.
7118 * testsuite/plugin_test_2.sh: Likewise.
7119 * testsuite/plugin_test_3.sh: Likewise.
7120 * testsuite/plugin_test_4.sh: New test case.
7121
62a6d109
ILT
71222009-01-07 Ian Lance Taylor <iant@google.com>
7123
7124 * version.cc (version_string): Bump to 1.8.
7125
483620e8
CC
71262008-12-23 Cary Coutant <ccoutant@google.com>
7127
7128 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
7129 * plugin.cc (Plugin_manager::finish): Rename as
7130 layout_deferred_objects. Move cleanup to separate function.
7131 (Plugin_manager::cleanup): New function.
7132 (Plugin_finish::run): Call layout_deferred_objects and cleanup
7133 separately.
7134 * plugin.h (Plugin_manager::finish): Rename as
7135 layout_deferred_objects.
7136 (Plugin_manager::cleanup): New function.
7137 (Plugin_manager::cleanup_done): New field.
7138
d66a9eb3
CC
71392008-12-23 Cary Coutant <ccoutant@google.com>
7140
7141 * plugin.cc (is_visible_from_outside): New function.
7142 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
7143 so we don't return "IR only" status for exported symbols or -r links.
7144
7145 * testsuite/Makefile.am (plugin_test_3): New test case.
7146 * testsuite/Makefile.in: Regenerate.
7147 * testsuite/plugin_test_3.sh: New file.
7148
5995b570
CC
71492008-12-22 Cary Coutant <ccoutant@google.com>
7150
7151 * object.cc (Sized_relobj::layout_section): New function.
7152 (Sized_relobj::do_layout): Defer layout of input sections until after
7153 plugin has provided replacement files.
7154 (Sized_relobj::do_layout_deferred_sections): New function.
7155 * object.h (Relobj::set_section_offset): Remove virtual keyword.
7156 (Relobj::layout_deferred_sections): New function.
7157 (Relobj::do_layout_deferred_sections): New function.
7158 (Sized_relobj::do_layout_deferred_sections): New function.
7159 (Sized_relobj::layout_section): New function.
7160 (Sized_relobj::Deferred_layout): New structure.
7161 (Sized_relobj::deferred_layout_): New field.
7162 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
7163 Change all callers. Layout deferred sections.
7164 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
7165 references.
7166 (Plugin_hook::run): Move code from do_plugin_hook inline.
7167 (Plugin_hook::do_plugin_hook): Remove.
7168 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
7169 (Plugin_manager::finish): Renamed, was cleanup.
7170 (Plugin_manager::should_defer_layout): New function.
7171 (Plugin_manager::add_deferred_layout_object): New function.
7172 (Plugin_manager::Deferred_layout_list): New type.
7173 (Plugin_manager::deferred_layout_objects_): New field.
7174 (Plugin_hook::do_plugin_hook): Remove.
7175
ee769c88
ILT
71762008-12-17 Ian Lance Taylor <iant@google.com>
7177
7178 * options.h (class General_options): Add --no case for
7179 --export-dynamic.
7180
abc8dcba
CC
71812008-12-16 Cary Coutant <ccoutant@google.com>
7182
7183 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
7184 vector.
7185 (Plugin_manager::claim_file): Create plugin object even if
7186 plugin did not call the add_symbols callback.
7187 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
7188 asking for more symbols than were added.
7189 * testsuite/Makefile.am (plugin_test_1): Add test case with
7190 no global symbols.
7191 (empty.syms): New target.
7192 * testsuite/Makefile.in: Regenerate.
7193 * testsuite/plugin_test.c (claim_file_hook): Add new debug
7194 message. Don't call add_symbols if no globals.
7195 (all_symbols_read_hook): Don't provide replacement for empty
7196 claimed file.
7197
b0074644
ILT
71982008-12-12 Ian Lance Taylor <iant@google.com>
7199
68943102
ILT
7200 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
7201 r_type == 0 for a local symbol with r_sym == 0.
7202 (scan_relocatable_relocs): Pass r_sym to
7203 local_non_section_strategy.
7204 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
7205 r_sym parameter.
7206
b0074644
ILT
7207 * configure.ac: Update test for TLS descriptors: they are
7208 supported as of glibc 2.9.
7209 * configure: Rebuild.
7210
c2508178
ILT
72112008-12-11 Ian Lance Taylor <iant@google.com>
7212
7213 PR 7091
7214 * target-reloc.h (Default_scan_relocatable_relocs): For each
7215 function, map r_type == 0 to RELOC_DISCARD.
7216
2756a258
CC
72172008-12-10 Cary Coutant <ccoutant@google.com>
7218
7219 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
7220 object to override a kept COMDAT group from a plugin object.
7221
bb6f53d3
ILT
72222008-12-09 Ian Lance Taylor <iant@google.com>
7223
fbc558e1
ILT
7224 PR 7088
7225 * yyscript.y (file_cmd): Handle INPUT.
7226
bb6f53d3
ILT
7227 * testsuite/initpri1.c: Change all declarations to be full
7228 prototypes by adding void, to avoid compiler warnings.
7229
4674ecfc
CC
72302008-12-05 Rafael Avila de Espindola <espindola@google.com>
7231
7232 * options.cc (General_options::parse_plugin_opt): New.
7233 (General_options::add_plugin): The argument now is just the filename.
7234 (General_options::add_plugin_option): New.
7235 * options.h (plugin_opt): New.
7236 (add_plugin): Change argument name.
7237 (add_plugin_option): New.
7238 * plugin.cc (Plugin::load): Don't parse the plugin option.
7239 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
7240 (Plugin::add_option): New.
7241 (Plugin::args_): Change type.
7242 (Plugin::filename_): New.
7243 (Plugin_manager::add_plugin_option): New.
7244 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
7245 * testsuite/Makefile.in: Regenerate.
7246
fd06b4aa
CC
72472008-12-05 Cary Coutant <ccoutant@google.com>
7248
7249 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
7250 Handle --strip-lto-sections option.
7251 * options.h (strip_lto_sections): New option.
7252
6c52134c
CC
72532008-12-01 Cary Coutant <ccoutant@google.com>
7254
7255 * plugin.cc (ld_plugin_message): Change format parameter to const.
7256 Fix mismatch between new[] and delete.
7257
a45248e0
CC
72582008-11-14 Cary Coutant <ccoutant@google.com>
7259
7260 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
7261 instead of -1U.
7262
c82fbeee
CS
72632008-11-05 Craig Silverstein <csilvers@google.com>
7264
7265 * options.cc (General_options::parse_dynamic_list): New function.
7266 * options.h (General_options): New flags dynamic_list,
7267 dynamic_list_data, dynamic_list_cpp_new, and
7268 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
7269 (General_options::in_dynamic_list): New function.
7270 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
7271 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
7272 (Lex::can_continue_name): Likewise.
7273 (yylex): Likewise.
7274 (read_script_file): New parameter script_options.
7275 (read_dynamic_list): New function.
7276 (Script_options::define_dynamic_list): New function.
7277 (dynamic_list_keyword_parsecodes): New variable.
7278 (dynamic_list_keywords): New variable.
7279 * script.h (Script_options::define_dynamic_list): New function
7280 prototype.
7281 (read_dynamic_list): New function prototype.
7282 * symtab.cc (strprefix): New macro.
7283 (Symbol::should_add_dynsym_entry): Support dynamic_list,
7284 dynamic_list_data, dynamic_list_cpp_new, and
7285 dynamic_list_cpp_typeinfo.
7286 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
7287 (dynamic_list_expr): New rule.
7288 (dynamic_list_nodes): Likewise.
7289 (dynamic_list_node): Likewise.
7290 * testsuite/Makefile.am (dynamic_list): New test.
7291 * testsuite/Makefile.in: Regenerated.
7292 * testsuite/dynamic_list.t: New file.
7293 * testsuite/dynamic_list.sh: New file.
7294
e0bb29a5
CS
72952008-11-05 Craig Silverstein <csilvers@google.com>
7296
7297 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
7298 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
7299 (t11_last): Likewise.
7300 * testsuite/ver_test_6.c (main): Likewise.
7301
4e1e25e0
CC
73022008-10-07 Cary Coutant <ccoutant@google.com>
7303
7304 * options.c (General_options::finalize): Add check for -static and
7305 -shared.
7306 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
7307 is not empty.
7308
92f03fcb
CC
73092008-10-02 Cary Coutant <ccoutant@google.com>
7310
7311 * plugin.cc (make_sized_plugin_object): Fix conditional
7312 compilation to work when not all targets are enabled.
7313
fbd8a257
CC
73142008-09-29 Cary Coutant <ccoutant@google.com>
7315
7316 * archive.cc (Archive::get_file_and_offset): Use filename instead
7317 of name to get library path.
7318 (Archive::include_member): Unlock external member of a thin archive.
7319
7320 * testsuite/Makefile.am (TEST_AR): New variable.
7321 (thin_archive_test_1): New test.
7322 (thin_archive_test_2): New test.
81636b3f
CC
7323 * testsuite/Makefile.in: Regenerate.
7324 * testsuite/thin_archive_main.cc: New file.
7325 * testsuite/thin_archive_test_1.cc: New file.
7326 * testsuite/thin_archive_test_2.cc: New file.
7327 * testsuite/thin_archive_test_3.cc: New file.
7328 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 7329
eff45813
CC
73302008-09-29 Cary Coutant <ccoutant@google.com>
7331
7332 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
7333 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
7334 instead of -1U.
7335 (Sized_relobj::do_finalize_local_symbols): Likewise.
7336 (Sized_relobj::map_to_kept_section): Likewise.
7337 * object.h (Sized_relobj::invalid_address): New constant.
7338 (Sized_relobj::do_output_section_offset): Check for invalid_address
7339 and return -1ULL.
7340 * output.cc (Output_reloc::local_section_offset): Use constant
7341 invalid_address instead of -1U.
7342 (Output_reloc::get_address): Likewise.
7343 (Output_section::output_address): Change -1U to -1ULL.
7344 * output.h (Output_reloc::invalid_address): New constant.
7345 * reloc.cc (Sized_relobj::write_sections): Use constant
7346 invalid_address instead of -1U.
7347 (Sized_relobj::relocate_sections): Likewise.
7348 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
7349 values for merge sections.
7350 * target-reloc.h (relocate_for_relocatable): Use constant
7351 invalid_address instead of -1U.
7352
89fc3421
CC
73532008-09-19 Cary Coutant <ccoutant@google.com>
7354
7355 Add plugin functionality for link-time optimization (LTO).
7356 * configure.ac (plugins): Add --enable-plugins option.
7357 * configure: Regenerate.
7358 * config.in: Regenerate.
7359 * Makefile.am (LIBDL): New variable.
7360 (CCFILES): Add plugin.cc.
7361 (HFILES): Add plugin.h.
7362 (ldadd_var): Add LIBDL.
7363 * Makefile.in: Regenerate.
7364
7365 * archive.cc: Include "plugin.h".
7366 (Archive::setup): Don't preread archive symbols when using a plugin.
7367 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
7368 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
7369 files.
7370 (Archive::include_member): Add symbols from plugin objects.
7371 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
7372 * descriptors.cc (Descriptors::open): Check for file descriptors
7373 abandoned by plugins.
7374 (Descriptors::claim_for_plugin): New function.
7375 * descriptors.h (Descriptors::claim_for_plugin): New function.
7376 (Open_descriptor::is_claimed): New field.
7377 (claim_descriptor_for_plugin): New function.
7378 * fileread.cc (File_read::claim_for_plugin): New function.
7379 * fileread.h (File_read::claim_for_plugin): New function.
7380 (File_read::descriptor): New function.
7381 * gold.cc: Include "plugin.h".
7382 (queue_initial_tasks): Add task to call plugin hooks for generating
7383 new object files.
7384 * main.cc: Include "plugin.h".
7385 (main): Load plugin libraries.
7386 * object.h (Pluginobj): Declare.
7387 (Object::pluginobj): New function.
7388 (Object::do_pluginobj): New function.
7389 (Object::set_target): New function.
7390 * options.cc: Include "plugin.h".
7391 (General_options::parse_plugin): New function.
7392 (General_options::General_options): Initialize plugins_ field.
7393 (General_options::add_plugin): New function.
7394 * options.h (Plugin_manager): Declare.
7395 (General_options): Add --plugin option.
7396 (General_options::has_plugins): New function.
7397 (General_options::plugins): New function.
7398 (General_options::add_plugin): New function.
7399 (General_options::plugins_): New field.
7400 * plugin.cc: New file.
7401 * plugin.h: New file.
7402 * readsyms.cc: Include "plugin.h".
7403 (Read_symbols::do_read_symbols): Check for archive before checking
7404 for ELF file. Call plugin hooks to claim files.
7405 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
7406 from a real object file; force override when processing replacement
7407 files.
7408 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
7409 (Symbol::init_base_object): Likewise.
7410 (Symbol::init_base_output_data): Likewise.
7411 (Symbol::init_base_output_segment): Likewise.
7412 (Symbol::init_base_constant): Likewise.
7413 (Symbol::init_base_undefined): Likewise.
7414 (Symbol::output_section): Assert that object is not a plugin.
7415 (Symbol_table::add_from_pluginobj): New function.
7416 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
7417 undefined.
7418 (Symbol_table::sized_write_globals): Likewise.
7419 (Symbol_table::add_from_pluginobj): Instantiate template.
7420 * symtab.h (Sized_pluginobj): Declare.
7421 (Symbol::in_real_elf): New function.
7422 (Symbol::set_in_real_elf): New function.
7423 (Symbol::in_real_elf_): New field.
7424 (Symbol_table::add_from_pluginobj): New function.
7425
7426 * testsuite/Makefile.am (AM_CFLAGS): New variable.
7427 (LIBDL): New variable.
7428 (LDADD): Add LIBDL.
7429 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
7430 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
7431 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
7432 (MOSTLYCLEANFILES): Likewise.
7433 * testsuite/Makefile.in: Regenerate.
7434 * testsuite/plugin_test.c: New file.
7435 * testsuite/plugin_test_1.sh: New file.
7436 * testsuite/plugin_test_2.sh: New file.
7437
de31bda5
ILT
74382008-09-16 Ian Lance Taylor <iant@google.com>
7439
9c2d0ef9
ILT
7440 * target-reloc.h (relocate_section): Check whether a symbol is
7441 defined by the ABI before reporting an undefined symbol error.
7442 * target.h (Target::is_defined_by_abi): Make parameter const.
7443 (Target::do_is_defined_by_abi): Likewise.
7444 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
7445 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
7446 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
7447 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
7448 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
7449 * testsuite/Makefile.in: Rebuild.
7450
de31bda5
ILT
7451 * fileread.cc (make_view): Add casts to avoid warning.
7452
9fa33bee
AO
74532008-09-16 Alexandre Oliva <aoliva@redhat.com>
7454
7455 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
7456 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7457
183fd0e3
AO
74582008-09-16 Alexandre Oliva <aoliva@redhat.com>
7459
7460 * options.h (General_options::output_is_executable): New.
7461 (General_options::output_is_pie): New.
7462 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
7463 for shared libraries.
7464 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7465
7be8330a
CD
74662008-09-11 Chris Demetriou <cgd@google.com>
7467
7468 * options.h (origin): New -z option.
7469 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
7470 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
7471 in DT_FLAGS_1.
7472
a9caad02
CC
74732008-09-05 Cary Coutant <ccoutant@google.com>
7474
7475 * fileread.cc (File_read::make_view): Add check for attempt to map
7476 beyond end of file.
7477
ae6dce4d
CC
74782008-09-05 Cary Coutant <ccoutant@google.com>
7479
7480 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
7481 explicit instantiations.
7482
d7ab2a47
KVH
74832008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
7484
7485 PR gold/6858
7486 * options.cc (General_options::finalize): Allow undefined symbols
7487 in shlibs if linking -shared.
7488
7489 PR gold/6859
7490 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
7491 symbols as not needing a dynsym entry.
7492
1e52a9c1
CS
74932008-08-20 Craig Silverstein <csilvers@google.com>
7494
7495 * fileread.cc (File_read::open): Do not lock the file unless it
7496 was successfully opened.
7497
d85c80a3
CC
74982008-08-14 Cary Coutant <ccoutant@google.com>
7499
7500 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
7501 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
7502 * testsuite/tls_test.cc (struct int128): 128-bit struct
7503 for testing TLS relocs with non-zero addend.
7504 (v12): New TLS variable.
7505 (t12): New test.
7506 (t_last): Add check for v12.
7507 * testsuite/tls_test.h (t12): New function.
7508 * testsuite/tls_test_main.cc (thread_routine): Call new test.
7509
2d924fd9
ILT
75102008-08-13 Ian Lance Taylor <iant@google.com>
7511
7512 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
7513 set tls_segment_ or relro_segment_.
7514 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
7515 when appropriate.
7516 * output.h (Output_section::clear_is_relro): New function.
7517 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
7518 sections specially even when output_data_ is empty.
7519 (Output_segment::maximum_alignment): When first section is relro,
7520 only force alignment for PT_LOAD segments.
7521 * script.cc (script_data_segment_align): New function.
7522 (script_data_segment_relro_end): New function.
7523 * script-c.h (script_data_segment_align): Declare.
7524 (script_data_segment_relro_end): Declare.
7525 * script-sections.h (class Script_sections): Declare
7526 data_segment_align and data_segment_relro_end. Add fields
7527 segment_align_index_ and saw_relro_end_.
7528 * script-sections.cc (class Sections_element): Add set_is_relro
7529 virtual function. Add new bool* parameter to place_orphan_here.
7530 Add get_output_section virtual function.
7531 (class Output_section_definition): Add set_is_relro. Add new
7532 bool* parameter to place_orphan_here. Add get_output_section.
7533 Add is_relro_ field.
7534 (Output_section_definition::Output_section_definition): Initialize
7535 evaluated_address_, evaluated_load_address, evaluated_addralign_,
7536 and is_relro_ fields.
7537 (Output_section_definition::place_orphan_here): Add is_relro
7538 parameter.
7539 (Output_section_definition::set_section_addresses): Set relro for
7540 output section.
7541 (Output_section_definition::alternate_constraint): Likewise.
7542 (class Orphan_output_section): Add new bool* parameter to
7543 place_orphan_here. Add get_output_section.
7544 (Orphan_output_section::place_orphan_here): Add is_relro
7545 parameter.
7546 (Script_sections::Script_sections): Initialize
7547 data_segment_align_index_ and saw_relro_end_.
7548 (Script_sections::data_segment_align): New function.
7549 (Script_sections::data_segment_relro_end): New function.
7550 (Script_sections::place_orphan): Set or clear is_relro.
7551 (Script_sections::set_section_addresses): Force alignment of first
7552 TLS section.
7553 * yyscript.y (exp): Call script_data_segment_align and
7554 script_data_segment_relro_end.
7555 * testsuite/relro_script_test.t: New file.
7556 * testsuite/relro_test.cc (using_script): Declare.
7557 (t1, t2): Test using_script.
7558 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
7559 (relro_script_test_SOURCES): Define.
7560 (relro_script_test_DEPENDENCIES): Define.
7561 (relro_script_test_LDFLAGS): Define.
7562 (relro_script_test_LDADD): Define.
7563 (relro_script_test.so): New target.
7564 * testsuite/Makefile.in: Rebuild.
7565
f827c9a9
CC
75662008-08-06 Cary Coutant <ccoutant@google.com>
7567
7568 * archive.cc (Archive::total_archives, Archive::total_members)
7569 (Archive::total_members_loaded): New variables.
7570 (Archive::setup): Add parameter. Add option to preread
7571 archive symbols.
7572 (Archive::read_armap): Add counter.
7573 (Archive::get_file_and_offset): New function.
7574 (Archive::get_elf_object_for_member): New function.
7575 (Archive::read_all_symbols): New function.
7576 (Archive::read_symbols): New function.
7577 (Archive::add_symbols): Add counters.
7578 (Archive::include_all_members): Use armap to find members if it's
7579 already built.
7580 (Archive::include_member): Skip reading symbols if already read.
7581 Factored code into Archive::get_file_and_offset and
7582 Archive::get_elf_object_for_member. Changed call to
7583 Mapfile::report_include_archive_member.
7584 (Archive::print_stats): New function.
7585 * archive.h: Declare Object and Read_symbols_data classes.
7586 (Archive::Archive): Add initializers for new members.
7587 (Archive::setup): Add parameter.
7588 (Archive::print_stats): New function.
7589 (Archive::total_archives, Archive::total_members)
7590 (Archive::total_members_loaded): New variables.
7591 (Archive::get_file_and_offset): New function.
7592 (Archive::get_elf_object_for_member): New function.
7593 (Archive::read_all_symbols): New function.
7594 (Archive::read_symbols): New function.
7595 (Archive::Archive_member): New class.
7596 (Archive::members_): New member.
7597 (Archive::num_members_): New member.
7598 * main.cc: Include archive.h.
7599 (main): Call Archive::print_stats.
7600 * mapfile.cc (Mapfile::report_include_archive_member): Delete
7601 archive parameter; member_name is now the fully-decorated name.
7602 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
7603 * options.h: (General_options): Add --preread-archive-symbols option.
7604 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
7605 Archive::setup.
7606
de4c45bd
ILT
76072008-08-04 Ian Lance Taylor <iant@google.com>
7608
7609 * symtab.h (Symbol::use_plt_offset): New function.
7610 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
7611 * powerpc.cc (Relocate::relocate): Likewise.
7612 * sparc.cc (Relocate::relocate): Likewise.
7613 * x86_64.cc (Relocate::relocate): Likewise.
7614 * testsuite/weak_plt.sh: New test.
7615 * testsuite/weak_plt_main.cc: New test.
7616 * testsuite/weak_plt_shared.cc: New test.
7617 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
7618 (check_PROGRAMS): Add weak_plt.
7619 (check_DATA): Add weak_plt_shared.so.
7620 (weak_plt_main_pic.o, weak_plt): New targets.
7621 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
7622 * testsuite/Makefile.in: Rebuild.
7623
7624 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
7625 gcctestdir/ld.
7626 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
7627 * testsuite/Makefile.in: Rebuild.
7628
323ee3f4
AM
76292008-08-04 Alan Modra <amodra@bigpond.net.au>
7630
7631 * Makefile.am (POTFILES.in): Set LC_ALL=C.
7632 * Makefile.in: Regenerate.
7633 * po/POTFILES.in: Regenerate.
7634
7c07ecec
ILT
76352008-07-29 Ian Lance Taylor <iant@google.com>
7636
7637 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
7638 symbols before other symbols.
7639 * testsuite/script_test_2.cc (test_addr): Declare.
7640 (test_addr_alias): Declare.
7641 (main): Check that test_addr and test_addr_alias have the right
cd536b21 7642 values.
7c07ecec
ILT
7643 * testsuite/script_test_2.t: Define test_addr_alias and
7644 test_addr.
7645
5778530e
ILT
76462008-07-24 Ian Lance Taylor <iant@google.com>
7647
2a00e4fb
ILT
7648 PR 5990
7649 * descriptors.cc: New file.
7650 * descriptors.h: New file.
7651 * gold-threads.h (class Hold_optional_lock): New class.
7652 * fileread.cc: Include "descriptors.h".
7653 (File_read::~File_read): Release descriptor rather than closing
7654 it.
7655 (File_read::open) [file]: Call open_descriptor rather than open.
7656 Set is_descriptor_opened_.
7657 (File_read::open) [memory]: Assert that descriptor is not open.
7658 (File_read::reopen_descriptor): New function.
7659 (File_read::release): Release descriptor.
7660 (File_read::do_read): Make non-const. Reopen descriptor.
7661 (File_read::read): Make non-const.
7662 (File_read::make_view): Reopen descriptor.
7663 (File_read::do_readv): Likewise.
7664 * fileread.h (class File_read): Add is_descriptor_opened_ field.
7665 Update declarations.
7666 * layout.cc: Include "descriptors.h".
7667 (Layout::create_build_id): Use open_descriptor rather than open.
7668 * output.cc: Include "descriptors.h".
7669 (Output_file::open): Use open_descriptor rather than open.
7670 * archive.cc (Archive::const_iterator): Change Archive to be
7671 non-const.
7672 (Archive::begin, Archive::end): Make non-const.
7673 (Archive::count_members): Likewise.
7674 * archive.h (class Archive): Update declarations.
7675 * object.h (Object::read): Make non-const.
7676 * Makefile.am (CCFILES): Add descriptors.cc.
7677 (HFILES): Add descriptors.h.
7678 * Makefile.in: Rebuild.
7679
801647d1
ILT
7680 PR 6716
7681 * gold.h: Always include <clocale>. Add Solaris workarounds
7682 following code in binutils/sysdep.h.
7683
5edd166e
ILT
7684 PR 6048
7685 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
7686 this->eh_frame_hdr_ is NULL before using it.
7687
c89ad728
ILT
7688 * dynobj.cc (Versions::Versions): Update comment.
7689
aa86f06b
ILT
7690 * dynobj.cc (Versions::Versions): If there is an soname, use it as
7691 the base version name.
7692
5778530e
ILT
7693 * stringpool.cc (Stringpool_template::add_with_length): Set key to
7694 array size plus one.
7695 (Stringpool_template::set_string_offsets): Subtract one from key
7696 before using it as an array index.
7697 (Stringpool_template::get_offset_with_length): Likewise.
7698 (Stringpool_template::write_to_buffer): Likewise.
7699 * stringpool.h (Stringpool_template::get_offset_from_key):
7700 Likewise.
7701
057ead22
ILT
77022008-07-23 Ian Lance Taylor <iant@google.com>
7703
7f649c59
ILT
7704 PR 6658
7705 * object.h (Merged_symbol_value::value): Do our best to handle a
7706 negative addend.
7707
057ead22
ILT
7708 PR 6647
7709 * script.cc (Version_script_info::get_versions): Don't add empty
7710 version tag to return value.
7711 (Version_script_info::get_symbol_version_helper): Change return
7712 type to bool. Add pversion parameter. Change all callers.
7713 (script_register_vers_node): Don't require a non-NULL tag.
7714 * script.h (class Version_script_info): Update declarations.
7715 (Version_script_info::get_symbol_version): Change return type to
7716 bool. Add version parameter. Change all callers.
7717 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
7718 handling. Handle an empty version from a version script.
7719 (Symbol_table::define_special_symbol): Likewise.
7720 * testsuite/ver_test_10.script: New file.
7721 * testsuite/ver_test_10.sh: New file.
7722 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
7723 (check_DATA): Add ver_test_10.syms.
7724 (ver_test_10.syms, ver_test_10.so): New target.
7725 * testsuite/Makefile.in: Rebuild.
7726
58e54ac2
CD
77272008-07-23 Simon Baldwin <simonb@google.com>
7728
7729 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
7730 to zero for undefined symbols from dynamic libraries.
7731
95d14cd3
ILT
77322008-07-23 Ian Lance Taylor <iant@google.com>
7733
7734 * symtab.cc (Symbol_table::resolve): Remove version parameter.
7735 Change all callers.
7736 * symtab.h (class Symbol_table): Update declaration.
7737 * testsuite/ver_test_9.cc: New file.
7738 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
7739 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
7740 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
7741 (ver_test_9.so, ver_test_9.o): New targets.
7742 * testsuite/Makefile.in: Rebuild.
7743
92de84a6
ILT
77442008-07-22 Ian Lance Taylor <iant@google.com>
7745
34810851
ILT
7746 * options.h (class General_options): Define --check-sections.
7747 * layout.cc (Layout::set_segment_offsets): Handle
7748 --check-sections.
7749
af6156ef
ILT
7750 * options.h (class General_options): Define -n/--nmagic and
7751 -N/--omagic.
7752 * options.cc (General_options::finalize): For -n/--nmagic or
7753 -N/--omagic, set -static.
7754 * layout.cc (Layout::attach_allocated_section_to_segment): If
7755 -N/--omagic, don't put read-only and read-write sections in
7756 different segments.
7757 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
7758 finding a read-only segment.
7759 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
7760 don't set the minimum segment alignment to the common page size,
7761 and don't set the file offset to the address modulo the page size.
7762 * script-sections.cc (Script_sections::create_segments): If
7763 -n/--omagic, don't put read-only and read-write sections in
7764 different segments.
7765
92de84a6
ILT
7766 * cref.cc: New file.
7767 * cref.h: New file.
7768 * options.h (class General_options): Add --print-symbol-counts.
7769 * main.cc (main): Issue defined symbol report if requested.
7770 * archive.cc (Archive::interpret_header): Make into a const member
7771 function.
7772 (Archive::add_symbols): Call Input_objects::archive_start and
7773 archive_stop.
7774 (Archive::const_iterator): Define new class.
7775 (Archive::begin, Archive::end): New functions.
7776 (Archive::include_all_members): Rewrite to use iterator.
7777 (Archive::count_members): New function.
7778 * archive.h (class Archive): Update declarations.
7779 (Archive::filename): New function.
7780 * object.cc: Include "cref.h".
7781 (Sized_relobj::Sized_relobj): Initialize defined_count_.
7782 (Sized_relobj::do_get_global_symbol_counts): New function.
7783 (Input_objects::add_object): Add object to cross-referencer.
7784 (Input_objects::archive_start): New function.
7785 (Input_objects::archive_stop): New function.
7786 (Input_objects::print_symbol_counts): New function.
7787 * object.h: Declare Cref and Archive.
7788 (Object::get_global_symbol_counts): New function.
7789 (Object::do_get_global_symbol_counts): New pure virtual function.
7790 (class Sized_relobj): Add defined_count_ field. Update
7791 declarations.
7792 (class Input_objects): Add cref_ field. Update constructor.
7793 Update declarations.
7794 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
7795 defined_count_.
7796 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
7797 symbol counts.
7798 (Sized_dynobj::do_get_global_symbol_counts): New function.
7799 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
7800 defined_count_. Update declarations. Define Symbols typedef.
7801 * symtab.cc (Symbol_table::add_from_relobj): Add defined
7802 parameter. Change all callers.
7803 (Symbol_table::add_from_dynobj): Add sympointers and defined
7804 parameters. Change all callers.
7805 * symtab.h (class Symbol_table): Update declarations.
7806 * Makefile.am (CCFILES): Add cref.cc.
7807 (HFILES): Add cref.h.
7808 * Makefile.in: Rebuild.
7809
3f7c5e1d
CD
78102008-07-22 Simon Baldwin <simonb@google.com>
7811
7812 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
7813 to zero when writing undefined symbols.
7814
e0b64032
ILT
78152008-07-22 Ian Lance Taylor <iant@google.com>
7816
7817 * output.cc (Output_section::add_input_section): Don't try to
7818 merge empty merge sections.
7819
096b02cf
CS
78202008-07-21 Craig Silverstein <csilvers@google.com>
7821
7822 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7823 Include symbol version in error message.
cd536b21 7824
1d1f116d
CD
78252008-07-20 Chris Demetriou <cgd@google.com>
7826
cd536b21 7827 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
7828 (RANDOM_SEED_CFLAGS): New substituted variable.
7829 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
7830 * configure: Rebuild.
7831 * Makefile.in: Likewise.
7832 * testsuite/Makefile.in: Likewise.
7833
a18f591e
ILT
78342008-07-18 Ian Lance Taylor <iant@google.com>
7835
7836 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
7837 where we see NAME/NULL and NAME/VERSION as separate symbols.
7838 * testsuite/ver_test_main.cc (main): Call t4.
7839 (t4, t4_2a): Define.
7840 * testsuite/ver_test_2.cc (t4_2): Define.
7841 * testsuite/ver_test_2.script: Put t4_2a in VER2.
7842 * testsuite/ver_test_4.cc (t4_2a): Define.
7843 * testsuite/ver_test_4.script: Put t4_2a in VER2.
7844 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
7845
c6e3f6ed
ILT
78462008-07-17 Ian Lance Taylor <iant@google.com>
7847
7848 * dynobj.cc (Versions::add_def): If we give an error about a
7849 missing version, go ahead and create the version anyhow.
7850
ef9beddf
ILT
78512008-07-10 Ian Lance Taylor <iant@google.com>
7852
7853 Handle output sections with more than 0x7fffffff bytes.
7854 * object.h (class Relobj): Change map_to_output_ to
7855 output_sections_, and just keep a section pointer. Change all
7856 uses. Move comdat group support to Sized_relobj.
7857 (Relobj::is_section_specially_mapped): Remove.
7858 (Relobj::output_section): Remove poff parameter. Change all
7859 callers.
7860 (Relobj::output_section_offset): New function.
7861 (Relobj::set_section_offset): Rewrite.
7862 (Relobj::map_to_output): Remove.
7863 (Relobj::output_sections): New function.
7864 (Relobj::do_output_section_offset): New pure virtual function.
7865 (Relobj::do_set_section_offset): Likewise.
7866 (class Sized_relobj): Add section_offsets_ field. Add comdat
7867 group support from Relobj. Update declarations.
7868 (Sized_relobj::get_output_section_offset): New function.
7869 (Sized_relobj::do_output_section_offset): New function.
7870 (Sized_relobj::do_set_section_offset): New function.
7871 * object.cc (Relobj::output_section_address): Remove.
7872 (Sized_relobj::Sized_relobj): Initialize new fields.
7873 (Sized_relobj::include_section_group): Cast find_kept_object to
7874 Sized_relobj.
7875 (Sized_relobj::include_linkonce_section): Likewise.
7876 (Sized_relobj::do_layout): Use separate arrays for output section
7877 and output offset.
7878 (Sized_relobj::do_count_local_symbols): Change map_to_output to
7879 output_sections.
7880 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
7881 output_sections and section_offsets.
7882 (Sized_relobj::write_local_symbols): Likewise.
7883 (map_to_kept_section): Compute output address directly.
7884 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
7885 output_sections and section_offsets.
7886 (Sized_relobj::write_sections): Likewise.
7887 (Sized_relobj::relocate_sections): Likewise.
7888 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
7889 * output.h (class Output_reloc): Update declarations. Change
7890 u2_.relobj to Sized_relobj*.
7891 (class Output_data_reloc): Change add functions to use
7892 Sized_relobj*.
7893 * output.cc (Output_reloc::Output_reloc): Change relobj to
7894 Sized_relobj*.
7895 (Output_reloc::local_section_offset): Change return type to
7896 Elf_Addr. Use get_output_section_offset.
7897 (Output_reloc::get_address): Likewise.
7898 (Output_section::is_input_address_mapped): Don't call
7899 is_section_specially_mapped.
7900 (Output_section::output_offset): Likewise.
7901 (Output_section::output_address): Likewise.
7902 (Output_section::starting_output_address): Likewise.
7903 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
7904 parameter to Sized_relobj*.
7905 (Copy_relocs::need_copy_reloc): Likewise.
7906 (Copy_relocs::save): Likewise.
7907 * copy-relocs.h (class Copy_relocs): Update declarations.
7908 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
7909 Sized_relobj*. Change relobj_ field to Sized_relobj*.
7910 * target-reloc.h (relocate_for_relocatable): Change
7911 offset_in_output_section type to Elf_Addr. Change code that uses
7912 it as well.
7913 * layout.cc (Layout::layout): Always set *off.
7914 * mapfile.cc (Mapfile::print_input_section): Use
7915 output_section_offset.
7916 * i386.cc (Target_i386::copy_reloc): Change object parameter to
7917 Sized_relobj*.
7918 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
7919 * sparc.cc (Target_sparc::copy_reloc): Likewise.
7920 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
7921
5cb66f97
ILT
79222008-07-03 Ian Lance Taylor <iant@google.com>
7923
7924 * layout.cc (Layout::include_section): Do not discard unrecognized
7925 SHT_STRTAB sections.
7926
afe47622
CS
79272008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
7928
7929 * script.cc (Lex::can_continue_name): Make '?' allowable in
7930 version-script names.
7931 * testsuite/version_script.map: Change glob pattern to use '?'
7932
5adf9721
ILT
79332008-06-30 Manish Singh <yosh@gimp.org>
7934
7935 PR 6585
7936 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
7937 Correct typo.
7938
e6fde208
ILT
79392008-06-30 Ian Lance Taylor <iant@google.com>
7940
7941 PR 6660
7942 PR 6682
7943 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
7944 versions]: Don't try to read the value in the contents, since we
7945 don't use it. Use the template endianness when writing.
7946
3f2e6a2d
CC
79472008-06-25 Cary Coutant <ccoutant@google.com>
7948
7949 * fileread.cc (File_read::make_view): Assert on zero-length view.
7950 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
7951 symbol table when there are no symbols to read.
7952
c43d3a48
CS
79532008-06-23 Craig Silverstein <csilvers@google.com>
7954
7955 * version.cc (version_string): Bump to 1.7
7956
5f494ea0
CS
79572008-06-18 Craig Silverstein <csilvers@google.com>
7958
7959 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
7960 constant 0xFFFF to type Valtype.
7961 (Powerpc_relocate_functions::rel16_ha): Likewise.
7962
c42e122e
ILT
79632008-06-17 Ian Lance Taylor <iant@google.com>
7964
f34787f8
ILT
7965 * output.h (Output_section::Input_section): Initialize p2align_ to
7966 zero for Output_section_data constructors.
7967 (Output_section::Input_section::addralign): If not an input
7968 section, return the alignment of the Output_section_data.
7969 * testsuite/copy_test.cc: New file.
7970 * testsuite/copy_test_1.cc: New file.
7971 * testsuite/copy_test_2.cc: New file.
7972 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
7973 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
7974 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
7975 (copy_test_1_pic.o, copy_test_1.so): New targets.
7976 (copy_test_2_pic.o, copy_test_2.so): New targets.
7977 * testsuite/Makefile.in: Rebuild.
7978
c42e122e
ILT
7979 * script-sections.cc (Script_sections::place_orphan): Initialize
7980 local variable exact.
7981
ce3ac18a
DE
79822008-06-13 David Edelsohn <edelsohn@gnu.org>
7983
7984 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
7985
42cacb20
DE
79862008-06-12 David Edelsohn <edelsohn@gnu.org>
7987 David S. Miller <davem@davemloft.net>
7988
7989 * powerpc.cc: New file.
7990 * Makefile.am (TARGETSOURCES): Add powerpc.cc
7991 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
7992 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
7993 * Makefile.in: Rebuild.
7994
7b308235
ILT
79952008-06-09 Ian Lance Taylor <iant@google.com>
7996
7997 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
7998 <exception>.
7999 (throwing, orig_terminate): New static variables.
8000 (terminate_handler): New static function.
8001 (t2): Set terminate handler.
8002
f0b886e3
ILT
80032008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
8004
8005 PR 6584
cd536b21 8006 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
8007 alignment.
8008
3e90f135
CC
80092008-05-30 Cary Coutant <ccoutant@google.com>
8010
8011 * archive.cc (Archive::include_all_members) Correct to step
8012 over symbol table and extended name table in thin archives.
8013
e09ad04a
ILT
80142008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
8015
8016 PR 6407
8017 * target-reloc.h (relocate_for_relocatable): Fix new_offset
8018 calculation.
8019
62b01cb5
ILT
80202008-05-28 Caleb Howe <cshowe@google.com>
8021
8022 * reduced_debug_output.cc: New file.
8023 * reduced_debug_output.h: New file.
92de84a6 8024 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
8025 * options.cc (General_options::finalize): Add strip_debug_non_line
8026 to the strip heirarchy.
8027 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8028 fields.
8029 * layout.cc: Include "reduced_debug_output.h".
8030 (Layout::Layout): Initialize new fields.
8031 (line_only_debug_sections): New static array.
8032 (is_lines_only_debug_sections): New static inline function.
8033 (Layout::include_section): Handle --strip-debug-non-line.
8034 (Layout::make_output_section): If --strip-debug-non-line, build
8035 new output sections for .debug_abbrev and .debug_info.
8036 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8037 gold. Warn about possible overflow.
8038 (read_signed_LEB_128): Likewise.
8039 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8040 (read_signed_LEB_128): Declare.
8041 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8042 (HFILES): Add reduced_debug_output.h.
8043 * Makefile.in: Rebuild.
8044
7d9e3d98
ILT
80452008-05-21 Ian Lance Taylor <iant@google.com>
8046
8047 * mapfile.cc: New file.
8048 * mapfile.h: New file.
8049 * options.h (class General_options): Add -M/--print-map and -Map.
8050 * options.cc (General_options::finalize): Make -M equivalent to
8051 -Map -.
8052 * main.cc: Include <cstdio> and "mapfile.h".
8053 (main): Open mapfile if requested.
8054 * gold.cc (class Middle_runner): Add mapfile_ field. Update
8055 constructor. Change caller.
8056 (queue_initial_tasks): Add mapfile parameter. Change caller.
8057 (queue_middle_tasks): Likewise.
8058 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
8059 declarations.
8060 * archive.cc: Include "mapfile.h".
8061 (Archive::add_symbols): Add mapfile parameter. Change all
8062 callers. Pass mapfile, symbol, and reason to include_member.
8063 (Archive::include_all_members): Add mapfile parameter. Change all
8064 callers.
8065 (Archive::include_member): Add mapfile, sym, and why parameters.
8066 Change all callers. Report inclusion to map file.
8067 * archive.h: Include "fileread.h".
8068 (class Archive): Update declarations.
8069 (Archive::file): New const method.
8070 (class Add_archive_symbols): Add mapfile_ field. Update
8071 constructor. Change all callers.
8072 * readsyms.h (class Read_symbols): Likewise.
8073 (class Finish_group): Likewise.
8074 (class Read_script): Likewise.
8075 * common.cc: Include "mapfile.h".
8076 (Symbol_table::allocate_commons): Add mapfile parameter. Change
8077 all callers.
8078 (Symbol_table::do_allocate_commons): Likewise.
8079 (Symbol_table::do_allocate_commons_list): Likewise. Report common
8080 symbol allocation to mapfile.
8081 * common.h (class Allocate_commons_task): Add mapfile_ field.
8082 Update constructor. Change all callers.
8083 * symtab.h (class Symbol_table): Update declarations.
8084 * layout.cc: Include "mapfile.h".
8085 (Layout_task_runner::run): Print information to mapfile.
8086 (Layout::create_gold_note): Change Output_data_fixed_space to
8087 Output_data_zero_fill.
8088 (Layout::create_build_id): Likewise.
8089 (Layout::print_to_mapfile): New function.
8090 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
8091 constructor. Change caller.
8092 (class Layout): Declare print_to_mapfile.
8093 * output.cc (Output_section::Input_section::print_to_mapfile): New
8094 function.
8095 (Output_section::add_input_section): If producing a map, always
8096 add to input_sections_ list.
8097 (Output_section::do_print_to_mapfile): New function.
8098 (Output_segment::print_sections_to_mapfile): New function.
8099 (Output_segment::print_section_list_to_mapfile): New function.
8100 * output.h: Include "mapfile.h".
8101 (Output_data::print_to_mapfile): New function.
8102 (Output_data::do_print_to_mapfile): New virtual function.
8103 (Output_segment_headers::do_print_to_mapfile): New function.
8104 (Output_file_header::do_print_to_mapfile): New function.
8105 (Output_data_const::do_print_to_mapfile): New function.
8106 (class Output_data_const_buffer): Add map_name_ field. Update
8107 constructor. Change all callers. Add do_print_to_mapfile
8108 function.
8109 (class Output_data_fixed_space): Likewise.
8110 (class Output_data_space): Likewise.
8111 (class Output_data_zero_fill): New class.
8112 (Output_data_strtab::do_print_to_mapfile): New function.
8113 (Output_data_reloc_base::do_print_to_mapfile): New function.
8114 (Output_relocatable_relocs::do_print_to_mapfile): New function.
8115 (Output_data_group::do_print_to_mapfile): New function.
8116 (Output_data_got::do_print_to_mapfile): New function.
8117 (Output_data_dynamic::do_print_to_mapfile): New function.
8118 (Output_symtab_xindex::do_print_to_mapfile): New function.
8119 (class Output_section): Declare do_print_to_mapflie. Declare
8120 print_to_mapfile in Input_section.
8121 (class Output_segment): Declare new functions.
8122 * object.h (Sized_relobj::symbol_count): New function.
8123 * script-sections.cc
8124 (Output_section_element_dot_assignment::set_section_addresses):
8125 Change Output_data_fixed_space to Output_data_zero_fill.
8126 (Output_data_expression::do_print_to_mapfile): New function.
8127 * script.cc (read_input_script): Add mapfile parameter. Change
8128 all callers.
8129 * script.h (read_input_script): Update declaration.
8130 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
8131 (Eh_frame::do_print_to_mapfile): New function.
8132 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
8133 (Output_merge_string::do_print_to_mapfile): New function.
8134 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
8135 function.
8136 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
8137 function.
8138 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
8139 function.
8140 * Makefile.am (CCFILES): Add mapfile.cc.
8141 (HFILES): Add mapfile.h.
8142 * Makefile.in: Rebuild.
8143
9f1d377b
ILT
81442008-05-19 Ian Lance Taylor <iant@google.com>
8145
8146 * options.h (class General_options): Add -z relro.
8147 * layout.cc (Layout::Layout): Initialize relro_segment_.
8148 (Layout::add_output_section_data): Return the output section.
8149 (Layout::make_output_section): Rcognize relro sections and mark
8150 them appropriately.
8151 (Layout::attach_allocated_section_to_segment): Put relro sections
8152 in a PT_GNU_RELRO segment.
8153 (Layout::create_initial_dynamic_sections): Mark the .dynamic
8154 section as relro.
8155 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
8156 PT_TLS segments.
8157 (Layout::linkonce_mapping): Map d.rel.ro.local to
8158 .data.rel.ro.local.
8159 (Layout::output_section_name): Us .data.rel.ro.local for any
8160 section which begins with that.
8161 * layout.h (class Layout): Update add_output_section_data
8162 declaration. Add relro_segment_ field.
8163 * output.cc (Output_section::Output_section): Initialize is_relro_
8164 and is_relro_local_ fields.
8165 (Output_segment::add_output_section): Group relro sections.
8166 (Output_segment::is_first_section_relro): New function.
8167 (Output_segment::maximum_alignment): If there is a relro section,
8168 align the segment to the common page size.
8169 (Output_segment::set_section_addresses): Track whether we are
8170 looking at relro sections. If the last section is a relro
8171 section, align to the common page size.
8172 (Output_segment::set_section_list_addresses): Add in_relro
8173 parameter. Change all callers. Align to the page size when
8174 moving from relro to non-relro section.
8175 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
8176 segment.
8177 * output.h (class Output_section): Add is_relro_ and
8178 is_relro_local_ fields.
8179 (Output_section::is_relro): New function.
8180 (Output_section::set_is_relro): New function.
8181 (Output_section::is_relro_local): New function.
8182 (Output_section::set_is_relro_local): New function.
8183 (class Output_segment): Update declarations.
8184 * i386.cc (Target_i386::got_section): Mark .got section as relro.
8185 * sparc.cc (Target_sparc::got_section): Likewise.
8186 * x86_64.cc (Target_x86_64::got_section): Likewise.
8187 * testsuite/relro_test_main.cc: New file.
8188 * testsuite/relro_test.cc: New file.
8189 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
8190 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
8191 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
8192 (relro_test.so, relro_test_pic.o): New targets.
8193 * testsuite/Makefile.in: Rebuild.
8194
a984ee1d
ILT
81952008-05-16 Ian Lance Taylor <iant@google.com>
8196
01676dcd
ILT
8197 * output.cc (Output_segment::add_output_section): Remove front
8198 parameter.
8199 * output.h (class Output_segment): Remove
8200 add_initial_output_section and overloaded add_output_section.
8201 Update declaration of remaining add_output_section.
8202 * layout.cc (Layout::create_interp): Call add_output_section
8203 rather than add_initial_output_section.
8204 (Layout::finish_dynamic_section): Likewise.
8205
497897f9
ILT
8206 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
8207 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
8208 know the dynamic type.
8209 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
8210 field. Initialize it in constructor.
8211 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
8212 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
8213 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
8214 reloc.
8215
a984ee1d
ILT
8216 * output.cc (Output_reloc::get_address): Change return type to
8217 Elf_Addr.
8218 * output.h (class Output_reloc): Update get_address declaration.
8219 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
8220 for section addresses.
8221
55ba0940
ILT
82222008-05-09 Ian Lance Taylor <iant@google.com>
8223
8224 PR 6493
8225 * gold.cc (gold_nomem): Use return value of write.
8226
75517b77
ILT
82272008-05-08 Ian Lance Taylor <iant@google.com>
8228
8229 * symtab.c (Symbol::init_base_output_data): Add version
8230 parameter. Change all callers.
8231 (Symbol::init_base_output_segment): Likewise.
8232 (Symbol::init_base_constant): Likewise.
8233 (Symbol::init_base_undefined): Likewise.
8234 (Sized_symbol::init_output_data): Likewise.
8235 (Sized_symbol::init_output_segment): Likewise.
8236 (Sized_symbol::init_constant): Likewise.
8237 (Sized_symbol::init_undefined): Likewise.
8238 (Symbol_table::do_define_in_output_data): If the new symbol has a
8239 version, mark it as the default.
8240 (Symbol_table::do_define_in_output_segment): Likewise.
8241 (Symbol_table::do_define_as_constant): Likewise.
8242 * symtab.h (class Symbol): Update declarations.
8243 (class Sized_symbol): Likewise.
8244 * resolve.cc (Symbol::override_version): New function.
c42e122e 8245 (Symbol::override_base): Call override_version.
75517b77
ILT
8246 (Symbol::override_base_with_special): Likewise.
8247 * testsuite/ver_script_8.script: New file.
8248 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
8249 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
8250 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
8251 (ver_test_8_1.so, ver_test_8_2.so): New targets.
8252
f1f70eae
ILT
82532008-05-06 Ian Lance Taylor <iant@google.com>
8254
f3e9c5c5
ILT
8255 PR 6049
8256 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
8257 functions.
8258 (class General_options): Remove existing --undefined, and add
8259 --no-undefined instead. Add new --undefined as synonym for -u.
8260 * archive.cc (Archive::add_symbols): Check whether symbol was
8261 named with -u.
8262 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
8263 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
8264 all uses. Add IS_UNDEFINED. Update declarations to split
8265 different versions of init_base. Declare init_base_undefined.
8266 (Symbol::is_defined): Handle IS_UNDEFINED.
8267 (Symbol::is_undefined): Likewise.
8268 (Symbol::is_weak_undefined): Call is_undefined.
8269 (Symbol::is_absolute): Handle IS_CONSTANT.
8270 (class Sized_symbol): Update declarations to split different
8271 versions of init. Declare init_undefined.
8272 (class Symbol_table): Declare new functions.
8273 * symtab.cc (Symbol::init_base_object): Rename from init_base.
8274 Change all callers.
8275 (Symbol::init_base_output_data): Likewise.
8276 (Symbol::init_base_output_segment): Likewise.
8277 (Symbol::init_base_constant): Likewise.
8278 (Symbol::init_base_undefined): New function.
8279 (Sized_symbol::init_object): Rename from init. Change all
8280 callers.
8281 (Sized_symbol::init_output_data): Likewise.
8282 (Sized_symbol::init_output_segment): Likewise.
8283 (Sized_symbol::init_constant): Likewise.
8284 (Sized_symbol::init_undefined): New function.
8285 (Symbol_table::add_undefined_symbols_from_command_line): New
8286 function.
8287 (Symbol_table::do_add_undefined_symbols_from_command_line): New
8288 function.
8289 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
8290 (Symbol::output_section): Likewise.
8291 (Symbol::set_output_section): Likewise.
8292 (Symbol_table::sized_finalize_symbol): Likewise.
8293 (Symbol_table::sized_write_globals): Likewise.
8294 * resolve.cc (Symbol_table::should_override): Likewise.
8295 (Symbol::override_base_with_special): Likewise.
8296
8bdcdf2c
ILT
8297 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
8298 symbol, change it to have default visibility.
8299 * testsuite/protected_1.cc: New file.
8300 * testsuite/protected_2.cc: New file.
8301 * testsuite/protected_3.cc: New file.
8302 * testsuite/protected_main_1.cc: New file.
8303 * testsuite/protected_main_2.cc: New file.
8304 * testsuite/protected_main_3.cc: New file.
8305 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
8306 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
8307 (protected_1_LDFLAGS, protected_1_LDADD): Define.
8308 (protected_1.so): New target.
8309 (protected_1_pic.o, protected_2_pic.o): New targets.
8310 (protected_3_pic.o): New target.
8311 (check_PROGRAMS): Add protected_2.
8312 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
8313 (protected_2_LDFLAGS, protected_2_LDADD): Define.
8314 * testsuite/Makefile.in: Rebuild.
8315
2b706932
ILT
8316 * options.h (DEFINE_var): Add set_user_set_##varname__.
8317 (DEFINE_bool_alias): New macro.
8318 (class General_options): Define -Bstatic using DEFINE_bool_alias
8319 rather than DEFINE_special. Add --undefined as an alias for -z
8320 defs.
8321 * options.cc (General_options::parse_Bstatic): Remove.
8322
d82a5bcc
ILT
8323 * options.h (class General_options): Add --fatal-warnings.
8324 * main.cc (main): Implement --fatal-warnings.
8325 * errors.h (Errors::warning_count): New function.
8326
f1f70eae
ILT
8327 * options.h (class General_options): Add -Bsymbolic-functions.
8328 * symtab.h (Symbol::is_preemptible): Check for
8329 -Bsymbolic-functions.
8330
8825ac63
ILT
83312008-05-05 Ian Lance Taylor <iant@google.com>
8332
d98bc257
ILT
8333 * options.h (DEFINE_bool): For DASH_Z, create the negative option
8334 as noVARNAME rather than no-VARNAME.
8335 (class General_options): Add option -z combreloc.
8336 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
8337 get_address.
8338 (Output_reloc::sort_before) [SHT_REL]: New function.
8339 (Output_reloc::sort_before) [SHT_RELA]: New function.
8340 (class Output_data_reloc_base): Add sort_relocs_ field. Define
8341 Sort_relocs_comparison.
8342 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
8343 parameter. Change all callers.
8344 (Output_data_reloc::Output_data_reloc) [both versions]: Add
8345 sort_relocs parameter. Change all callers.
8346 * output.cc (Output_reloc::get_address): New function, broken out
8347 of write_rel.
8348 (Output_reloc::write_rel): Call it.
8349 (Output_reloc::compare): New function.
8350 (Output_data_reloc_base::do_write): Optionally sort relocs.
8351
60b2b4e7
ILT
8352 * configure.ac: If targ_extra_obj is set, link it in.
8353 * configure.tgt: Initialize all variables.
8354 (x86_64*): Set targ_extra_obj and targ_extra_size.
8355 * configure: Rebuild.
8356
8825ac63
ILT
8357 * object.cc (Sized_relobj::include_section_group): Adjust section
8358 indexes read from group data. Build vector to pass to
8359 layout_group.
8360 * layout.cc (Layout::layout_group): Add flags and shndxes
8361 parameters. Remove contents parameter. Change caller. Update
8362 explicit instantiations.
8363 * layout.h (class Layout): Update layout_group declaration.
8364 * output.cc (Output_data_group::Output_data_group): Add flags and
8365 input_shndxes parameters. Remove contents parameter. Change
8366 caller.
8367 (Output_data_group::do_write): Change input_sections_ to
8368 input_shndxes_.
8369 * output.h (class Output_data_group): Update constructor
8370 declaration. Rename input_sections_ to input_shndxes_.
8371 * testsuite/many_sections_test.cc: Add template.
8372
e94cf127
CC
83732008-04-30 Cary Coutant <ccoutant@google.com>
8374
4418b2d5
CC
8375 * target-reloc.h (relocate_section): Fix dead-pointer bug.
8376
e94cf127
CC
8377 * layout.cc (Layout::include_section): Refactored check for debug
8378 info section.
8379 (Layout::add_comdat): Add new parameters. Change type
8380 of signature parameter. Add object and shndx to signatures table.
8381 (Layout::find_kept_object): New function.
8382 * layout.h: Include <cstring>.
8383 (Layout::is_debug_info_section): New function.
8384 (Layout::add_comdat): Add new parameters.
8385 (Layout::find_kept_object): New function.
8386 (Layout::Kept_section): New struct.
8387 (Layout::Signatures): Change type of map range.
8388 * object.cc (Relobj::output_section_address): New function.
8389 (Sized_relobj::include_section_group): Add new parameters. Change
8390 calls to Layout::add_comdat. Change to build table of kept comdat
8391 groups and table mapping discarded sections to kept sections.
8392 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
8393 (Sized_relobj::do_layout): Change calls to include_section_group and
8394 include_linkonce_section.
8395 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
8396 value to zero when section is discarded.
8397 (Sized_relobj::map_to_kept_section): New function.
8398 * object.h (Relobj::output_section_address): New function.
8399 (Relobj::Comdat_group): New type.
8400 (Relobj::find_comdat_group): New function.
8401 (Relobj::Comdat_group_table): New type.
8402 (Relobj::Kept_comdat_section): New type.
8403 (Relobj::Kept_comdat_section_table): New type.
8404 (Relobj::add_comdat_group): New function.
8405 (Relobj::set_kept_comdat_section): New function.
8406 (Relobj::get_kept_comdat_section): New function.
8407 (Relobj::comdat_groups_): New field.
8408 (Relobj::kept_comdat_sections_): New field.
8409 (Symbol_value::input_value): Update comment.
8410 (Sized_relobj::map_to_kept_section) New function.
8411 (Sized_relobj::include_linkonce_section): Add new parameter.
8412 * target-reloc.h (Comdat_behavior): New type.
8413 (get_comdat_behavior): New function.
8414 (relocate_section): Add code to map a discarded section to the
8415 corresponding kept section when applying a relocation.
8416
e4e5049b
CS
84172008-04-30 Craig Silverstein <csilvers@google.com>
8418
8419 * dwarf_reader.cc (next_generation_count): New static var.
8420 (Addr2line_cache_entry): New struct.
8421 (addr2line_cache): New static var.
8422 (Dwarf_line_info::one_addr2line): Added caching.
8423 (Dwarf_line_info::clear_addr2line_cache): New function.
8424 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
8425 cache-size parameter.
8426 (Dwarf_line_info::one_addr2line_cache): New function.
8427 * symtab.cc (Symbol_table::detect_odr_violations): Pass
8428 new cache-size argument to one_addr2line(), and clear cache.
8429
d09e9154
CC
84302008-04-28 Cary Coutant <ccoutant@google.com>
8431
8432 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
8433 R_386_PC8 relocations.
8434
7ef73768
ILT
84352008-04-23 Ian Lance Taylor <iant@google.com>
8436
55438702
ILT
8437 * object.cc (Sized_relobj::include_section_group): Check for
8438 invalid section group.
8439
c165fb93
ILT
8440 * object.cc (make_elf_object): Correct test for 64-bit ELF file
8441 header size.
8442
7ef73768
ILT
8443 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
8444 than read for file header.
8445 * archive.cc (Archive::include_member): Likewise.
8446
6194aaab
L
84472008-04-23 Paolo Bonzini <bonzini@gnu.org>
8448
8449 * aclocal.m4: Regenerate.
8450 * configure: Regenerate.
8451
d491d34e
ILT
84522008-04-19 Ian Lance Taylor <iant@google.com>
8453
5ea2bac6
ILT
8454 * version.cc (version_string): Bump to 1.6.
8455
7bc3e21a
ILT
8456 * testsuite/Makefile.am (many_sections_r_test): New target.
8457 (many_sections_r_test_SOURCES): Remove.
8458 (many_sections_r_test_DEPENDENCIES): Remove.
8459 (many_sections_r_test_LDFLAGS): Remove.
8460 (many_sections_r_test_LDADD): Remove.
8461
7fcd3aa9
ILT
8462 * object.cc (Sized_relobj::do_add_symbols): Always pass
8463 local_symbol_count_ to add_from_relobj.
8464
4c94d6ae
ILT
8465 * testsuite/Makefile.am (many_sections_check.h): Only check one in
8466 every thousand variables.
8467 * testsuite/Makefile.in: Rebuild.
8468
d491d34e
ILT
8469 * object.cc (Xindex::initialize_symtab_xindex): New function.
8470 (Xindex::read_symtab_xindex): New function.
8471 (Xindex::sym_xindex_to_shndx): New function.
8472 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
8473 available.
8474 (Sized_relobj::do_initialize_xindex): New function.
8475 (Sized_relobj::do_read_symbols): Adjust section links.
8476 (Sized_relobj::symbol_section_and_value): Add is_ordinary
8477 parameter. Change all callers.
8478 (Sized_relobj::include_section_group): Adjust section links and
8479 symbol section indexes.
8480 (Sized_relobj::do_layout): Adjust section links.
8481 (Sized_relobj::do_count_local_symbols): Adjust section links and
8482 symbol section indexes.
8483 (Sized_relobj::do_finalize_local_symbols): Distinguish between
8484 ordinary and special symbols.
8485 (Sized_relobj::write_local_symbols): Add symtab_xindex and
8486 dynsym_xindex parameters. Change all callers. Adjust section
8487 links. Use SHN_XINDEX when needed.
8488 (Sized_relobj::get_symbol_location_info): Adjust section links.
8489 Don't get fooled by special symbols.
8490 * object.h (class Xindex): Define.
8491 (class Object): Add xindex_ parameter. Declare virtual functoin
8492 do_initialize_xindex.
8493 (Object::adjust_sym_shndx): New function.
8494 (Object::set_xindex): New protected function.
8495 (class Symbol_value): Add is_ordinary_shndx_ field.
8496 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
8497 (Symbol_value::value): Assert ordinary section.
8498 (Symbol_value::initialize_input_to_output_map): Likewise.
8499 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
8500 Change all callers.
8501 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
8502 all callers.
8503 (class Sized_relobj): Update declarations.
8504 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
8505 parameter. Change all callers.
8506 (Sized_relobj::adjust_shndx): New function.
8507 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
8508 field.
8509 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
8510 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
8511 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
8512 (Sized_dynobj::read_dynsym_section): Adjust section links.
8513 (Sized_dynobj::read_dynamic): Likewise.
8514 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
8515 section links.
8516 (Sized_dynobj::do_initialize_xindex): New function.
8517 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
8518 do_initialize_xindex.
8519 (Sized_dynobj::adjust_shndx): New function.
8520 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
8521 dynsym_xindex_ fields.
8522 (Layout::finalize): Add a call to set_section_indexes before
8523 creating the symtab sections.
8524 (Layout::set_section_indexes): Don't do anything if the section
8525 already has a section index.
8526 (Layout::create_symtab_sections): Add shnum parameter. Change
8527 caller. Create .symtab_shndx section if needed.
8528 (Layout::create_shdrs): Add shstrtab_section parameter. Change
8529 caller.
8530 (Layout::allocated_output_section_count): New function.
8531 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
8532 needed.
8533 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
8534 fields. Update declarations.
8535 (Layout::symtab_xindex): New function.
8536 (Layout::dynsym_xindex): New function.
8537 (class Write_symbols_task): Add layout_ field.
8538 (Write_symbols_task::Write_symbols_task): Add layout parameter.
8539 Change caller.
8540 * output.cc (Output_section_headers::Output_section_headers): Add
8541 shstrtab_section parameter. Change all callers.
8542 (Output_section_headers::do_sized_write): Store overflow values
8543 for section count and section string table section index in
8544 section header zero.
8545 (Output_file_header::do_sized_write): Check for overflow of
8546 section count and section string table section index.
8547 (Output_symtab_xindex::do_write): New function.
8548 (Output_symtab_xindex::endian_do_write): New function.
8549 * output.h (class Output_section_headers): Add shstrtab_section_.
8550 Update declarations.
8551 (class Output_symtab_xindex): Define.
8552 (Output_section::has_out_shndx): New function.
8553 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
8554 field.
8555 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
8556 Change all callers.
8557 (Sized_symbol::init): Likewise.
8558 (Symbol::output_section): Check for ordinary symbol.
8559 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
8560 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
8561 callers.
8562 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
8563 Change all callers. Simplify handling of symbols from sections
8564 not included in the link.
8565 (Symbol_table::add_from_dynobj): Handle ordinary symbol
8566 distinction.
8567 (Weak_alias_sorter::operator()): Assert that symbols are
8568 ordinary.
8569 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
8570 distinction.
8571 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
8572 parameters. Change all callers.
8573 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
8574 symbol distinction. Use SHN_XINDEX when needed.
8575 (Symbol_table::write_section_symbol): Add symtab_xindex
8576 parameter. Change all callers.
8577 (Symbol_table::sized_write_section_symbol): Likewise. Use
8578 SHN_XINDEX when needed.
8579 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
8580 declarations.
8581 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
8582 (Symbol::is_defined): Check is_ordinary.
8583 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
8584 (Symbol::is_absolute, Symbol::is_common): Likewise.
8585 (class Sized_symbol): Update declarations.
8586 (class Symbol_table): Update declarations.
8587 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
8588 parameters. Change all callers.
8589 (Sized_symbol::override): Likewise.
8590 (Symbol_table::override): Likewise.
8591 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
8592 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
8593 is_ordinary, and orig_st_shndx parameters. Change all callers.
8594 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
8595 to be in an ordinary section.
8596 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
8597 object and is_ordinary parameters. Change all callers.
8598 (Sized_dwarf_line_info::read_relocs): Add object parameter.
8599 Change all callers. Don't add undefined or non-ordinary symbols
8600 to reloc_map_.
8601 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
8602 Change all callers.
8603 * dwarf_reader.h (class Sized_dwarf_line_info): Update
8604 declarations.
8605 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
8606 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
8607 (Sized_relobj::relocate_sections): Likewise.
8608 * target-reloc.h (scan_relocs): Adjust section symbol index.
8609 (scan_relocatable_relocs): Likewise.
8610 * i386.cc (Scan::local): Check for ordinary symbols.
8611 * sparc.cc (Scan::local): Likewise.
8612 * x86_64.cc (Scan::local): Likewise.
8613 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
8614 to symbol_section_and_value.
8615 * testsuite/many_sections_test.cc: New file.
8616 * testsuite/Makefile.am (BUILT_SOURCES): Define.
8617 (check_PROGRAMS): Add many_sections_test.
8618 (many_sections_test_SOURCES): Define.
8619 (many_sections_test_DEPENDENCIES): Define.
8620 (many_sections_test_LDFLAGS): Define.
8621 (BUILT_SOURCES): Add many_sections_define.h.
8622 (many_sections_define.h): New target.
8623 (BUILT_SOURCES): Add many_sections_check.h.
8624 (many_sections_check.h): New target.
8625 (check_PROGRAMS): Add many_sections_r_test.
8626 (many_sections_r_test_SOURCES): Define.
8627 (many_sections_r_test_DEPENDENCIES): Define.
8628 (many_sections_r_test_LDFLAGS): Define.
8629 (many_sections_r_test_LDADD): Define.
8630 (many_sections_r_test.o): New target.
8631 * testsuite/Makefile.in: Rebuild.
8632
c5818ff1
CC
86332008-04-17 Cary Coutant <ccoutant@google.com>
8634
8635 * errors.cc (Errors::info): New function.
8636 (gold_info): New function.
8637 * errors.h (Errors::info): New function.
8638 * gold.h (gold_info): New function.
8639 * object.cc (Input_objects::add_object): Print trace output.
8640 * options.cc (options::parse_set): New function.
8641 (General_options::parse_wrap): Deleted.
8642 (General_options::General_options): Deleted initializer.
8643 * options.h (options::String_set): New typedef.
8644 (options::parse_set): New function.
8645 (DEFINE_set): New macro.
8646 (General_options::wrap): Changed to use DEFINE_set. Changed
8647 callers of any_wrap_symbols and is_wrap_symbol.
8648 (General_options::trace, General_options::trace_symbol):
8649 New options.
8650 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
8651 (General_options::wrap_symbols_): Deleted.
8652 * symtab.cc (Symbol_table::add_from_object): Print trace output.
8653
b5be4a7c
DM
86542008-04-17 David S. Miller <davem@davemloft.net>
8655
8656 * options.cc (General_options::parse_V): New function.
8657 * options.h: Add entries for -V and -Qy.
8658
155a0dd7
ILT
86592008-04-17 Ian Lance Taylor <iant@google.com>
8660
8661 * common.cc (Symbol_table::allocate_commons): Remove options
8662 parameter. Change caller.
8663 (Symbol_table::do_allocate_commons): Remove options parameter.
8664 Change caller. Just call do_allocate_commons_list twice.
8665 (Symbol_table::do_allocate_commons_list): New function, broken out
8666 of do_allocate_commons.
8667 * common.h (class Allocate_commons_task): Remove options_ field.
8668 Update constructor.
8669 * symtab.cc (Symbol_table::Symbol_table): Initialize
8670 tls_commons_.
8671 (Symbol_table::add_from_object): Put TLS common symbols on
8672 tls_commons_ list.
8673 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
8674 which are IN_OUTPUT_DATA.
8675 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
8676 allocate_commons and do_allocate_commons declarations. Declare
8677 do_allocate_commons_list.
8678 * gold.cc (queue_middle_tasks): Update creation of
8679 Allocate_commons_task to not pass options.
8680 * testsuite/Makefile.am (INCLUDES): Add -I.. .
8681 (TLS_TEST_C_FLAGS): New variable.
8682 (tls_test_c_pic.o): New target.
8683 (tls_test_shared.so): Link in tls_test_c_pic.o.
8684 (tls_test_c_pic_ie.o): New target.
8685 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
8686 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
8687 (tls_test_c.o): New target.
8688 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
8689 (tls_pic_test_LDADD): Likewise.
8690 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
8691 (tls_shared_gd_to_ie_test_LDADD): Likewise.
8692 (tls_test_c_gnu2.o): New target.
8693 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
8694 tls_test_c_gnu2.o.
8695 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
8696 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
8697 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
8698 * testsuite/tls_test.cc: Include "config.h".
8699 (t_last): Call t11_last.
8700 * testsuite/tls_test.h (t11, t11_last): Declare.
8701 * testsuite/tls_test_c.c: New file.
8702 * testsuite/tls_test_main.cc (thread_routine): Call t11.
8703 * configure.ac: Check for OpenMP support.
8704 * configure, config.in, Makefile.in: Rebuild.
8705 * testsuite/Makefile.in: Rebuild.
8706
edfbb029
CC
87072008-04-16 Cary Coutant <ccoutant@google.com>
8708
8709 * i386.cc (Target_i386::define_tls_base_symbol): New function.
8710 (Target_i386::tls_base_symbol_defined_): New field.
8711 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8712 (Target_i386::Scan::global): Likewise.
8713 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
8714 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
8715 (Target_x86_64::tls_base_symbol_defined_): New field.
8716 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8717 (Target_x86_64::Scan::global): Likewise.
8718
f3c69fca
CC
87192008-04-16 Cary Coutant <ccoutant@google.com>
8720
8721 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
8722 (Symbol::needs_plt_entry): Allow weak undefined symbols.
8723 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
8724 building shared libraries.
8725 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
8726 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
8727 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
8728 * testsuite/Makefile.in: Rebuild.
8729 * testsuite/weak_undef.h: New file.
8730 * testsuite/weak_undef_file1.cc: Add extra test cases.
8731 * testsuite/weak_undef_file2.cc: Likewise.
8732 * testsuite/weak_undef_test.cc: Likewise.
8733
7c414435
DM
87342008-04-16 David S. Miller <davem@davemloft.net>
8735
32b769e1
DM
8736 * sparc.cc (Target_sparc::Scan): Change from struct to class.
8737 Add issued_non_pic_error_ field. Declare check_non_pic.
8738 (Target_sparc::Scan::check_non_pic): New function.
8739 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
8740 (Target_sparc::Scan::global): Likewise.
8741
11936fb1
DM
8742 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
8743 * configure: Rebuild.
8744
7c414435
DM
8745 * options.h (DEFINE_enable): New macro.
8746 (new_dtags): New enable option.
8747 (initfirst, interpose, loadfltr, nodefaultlib,
8748 nodelete, nodlopen, nodump): New -z options.
8749 * layout.cc (Layout:finish_dynamic_section): If new
8750 dtags enabled, emit DT_RUNPATH. Also, emit a
8751 DT_FLAGS_1 containing any specified -z flags.
8752
85c7bf8b
ILT
87532008-04-16 Ian Lance Taylor <iant@google.com>
8754
12c0daef
ILT
8755 * copy-relocs.cc: New file.
8756 * copy-relocs.h: New file.
8757 * reloc.cc: Remove Copy_relocs code.
8758 * reloc.h: Likewise.
8759 * reloc-types.h (struct Reloc_types) [both versions]: Add
8760 get_reloc_addend_noerror.
8761 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
8762 variants of add_global which take an addend which must be zero.
8763 * i386.cc: Include "copy-relocs.h".
8764 (class Target_i386): Change type of copy_relocs_ to variable,
8765 update initializer.
8766 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
8767 Change all callers.
8768 (Target_i386::do_finalize_sections): Change handling of
8769 copy_relocs_.
8770 * sparc.cc: Include "copy-relocs.h".
8771 (class Target_sparc): Change type of copy_relocs_ to variable,
8772 update initializer.
8773 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
8774 Change all callers.
8775 (Target_sparc::do_finalize_sections): Change handling of
8776 copy_relocs_.
8777 * x86_64.cc: Include "copy-relocs.h".
8778 (class Target_x86_64): Change type of copy_relocs_ to variable,
8779 update initializer.
8780 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
8781 class. Change all callers.
8782 (Target_x86_64::do_finalize_sections): Change handling of
8783 copy_relocs_.
8784 * Makefile.am (CCFILES): Add copy-relocs.cc.
8785 (HFILES): Add copy-relocs.h.
8786
4f4995b6
ILT
8787 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
8788
85c7bf8b
ILT
8789 * testsuite/script_test_4.sh: Permit leading zeroes.
8790
4f2a9edd
ILT
87912008-04-15 Ian Lance Taylor <iant@google.com>
8792
e6188289
ILT
8793 * script-sections.cc (Script_sections::create_segments): Use
8794 header_size_adjustment even when there is enough room for the
8795 headers.
8796 * testsuite/script_test_4.sh: New file.
8797 * testsuite/script_test_4.t: New file.
8798 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
8799 (check_DATA): Add script_test_4.stdout.
8800 (MOSTLYCLEANFILES): Likewise.
8801 (script_test_4): New target.
8802 (script_test_4.stdout): New target.
8803 * testsuite/Makefile.in: Rebuild.
8804
4f2a9edd
ILT
8805 * sparc.cc: Add definitions for Output_data_plt_sparc class
8806 constants.
8807
f5314dd5
DM
88082008-04-14 David S. Miller <davem@davemloft.net>
8809
8810 * sparc.cc: New file.
8811 * Makefile.am (TARGETSOURCES): Add sparc.cc
8812 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
8813 * configure.tgt: Document targ_extra_size and
8814 targ_extra_big_endian. Add entries for sparc-* and
8815 sparc64-*.
8816 * configure.ac: Handle targ_extra_size and
8817 targ_extra_big_endian.
8818 * Makefile.in: Rebuild.
8819 * configure: Likewise.
8820 * po/POTFILES.in: Likewise.
8821 * po/gold.pot: Likewise.
8822
154e0e9a
ILT
88232008-04-14 Ian Lance Taylor <iant@google.com>
8824
8825 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
8826 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
8827 in the name/type/flags to section mapping. Don't call
8828 allocate_output_section.
8829 (Layout::choose_output_section): Change parameter from adjust_name
8830 to is_input_section. Don't permit input sections after sections
8831 are attached to segments. Don't call allocate_output_section.
8832 (Layout::layout_eh_frame): Call update_flags_for_input_section,
8833 not write_enable_output_section.
8834 (Layout::make_output_section): Don't push to
8835 unattached_section_list_ nor call attach_to_segment. Call
8836 attach_section_to_segment if sections are attached.
8837 (Layout::attach_sections_to_segments): New function.
8838 (Layout::attach_section_to_segment): New function.
8839 (Layout::attach_allocated_section_to_segment): Rename from
8840 attach_to_segment. Remove flags parameter.
8841 (Layout::allocate_output_section): Remove function.
8842 (Layout::write_enable_output_section): Remove function.
8843 * layout.h (class Layout): Update for above changes. Add new
8844 field sections_are_attached_.
8845 * output.h (Output_section::update_flags_for_input_section): New
8846 function.
8847 * output.cc (Output_section::add_input_section): Call
8848 update_flags_for_input_section.
8849 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
8850
009a67a2
CC
88512008-04-11 Cary Coutant <ccoutant@google.com>
8852
8853 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
8854 thought unnecessary.
8855 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
8856
759b1a24
ILT
88572008-04-11 Ian Lance Taylor <iant@google.com>
8858
8859 * output.h (class Output_section_data): Remove inline definition
8860 of set_addralign.
8861 * output.cc (Output_section_data::set_addralign): New function.
8862
c2b45e22
CC
88632008-04-11 Cary Coutant <ccoutant@google.com>
8864
8865 Add support for TLS descriptors for i386 and x86_64.
8866 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
8867 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
8868 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
8869 GOT_TYPE_TLS_DESC.
8870 (Target_i386::got_mod_index_entry): Remove unnecessary code.
8871 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
8872 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
8873 relocations.
8874 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
8875 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
8876 Fix problem with initial-exec relocations.
8877 (Target_i386::Relocate::relocate_tls): Likewise.
8878 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
8879 relaxation.
8880 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
8881 support for section-plus-offset dynamic table entries.
8882 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
8883 (Output_data_dynamic::Dynamic_entry): Add support for
8884 section-plus-offset dynamic table entries.
8885 (Output_data_dynamic::Classification): Likewise.
8886 (Output_data_dynamic::classification_): Renamed offset_.
8887 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
8888 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
8889 (Target_x86_64::make_plt_section): New function.
8890 (Target_x86_64::reserve_tlsdesc_entries): New function.
8891 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
8892 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
8893 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
8894 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
8895 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
8896 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
8897 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
8898 add extra PLT entry for TLS descriptors.
8899 (Output_data_plt_x86_64::got_): New field.
8900 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
8901 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
8902 fields.
8903 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
8904 descriptors.
8905 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
8906 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
8907 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
8908 R_386_TLS_DESC_CALL relocations.
8909 (Target_x86_64::Scan::global): Likewise.
8910 (Target_x86_64::do_finalize_sections): Add dynamic table entries
8911 for TLS descriptors.
8912 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
8913 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
8914 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
8915 GD-to-IE relaxation.
8916 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
8917 and TLS_DESCRIPTORS.
8918 * Makefile.in: Rebuild.
8919 * configure: Rebuild.
8920 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
8921 (tls_test_shared2.so): New target.
8922 (tls_shared_gd_to_ie_test_SOURCES): New variable.
8923 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
8924 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
8925 (tls_shared_gd_to_ie_test_LDADD): New variable.
8926 (tls_shared_gnu2_gd_to_ie_test): New target.
8927 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
8928 New targets.
8929 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
8930 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
8931 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
8932 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
8933 (tls_shared_gnu2_test): New target.
8934 (tls_test_gnu2_shared.so): New target.
8935 (tls_shared_gnu2_test_SOURCES): New variable.
8936 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
8937 (tls_shared_gnu2_test_LDFLAGS): New variable.
8938 (tls_shared_gnu2_test_LDADD): New variable.
8939 * testsuite/Makefile.in: Rebuild.
8940 * testsuite/Makefile.
8941
83bfb6b7
ILT
89422008-04-11 Ian Lance Taylor <iant@google.com>
8943
8944 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
8945 justsyms.t.
8946 * testsuite/Makefile.in: Rebuild.
8947
8948 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
8949 long.
8950 * testsuite/script_test_2.cc (main): Adjust test.
8951
706e1f5e
ILT
89522008-04-11 David S. Miller <davem@davemloft.net>
8953 Ian Lance Taylor <iant@google.com>
8954
8955 * options.h (General_options): Add entries for '-Y' and
8956 '-relax'.
8957 * options.cc (General_options:finalize): If -Y was used, add those
8958 entries to the library path instead of the default "/lib" and
8959 "/usr/lib".
8960
7c98e6bb
DM
89612008-04-11 David S. Miller <davem@davemloft.net>
8962
8963 * testsuite/justsyms.t: Start at 0x100.
8964 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
8965 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
8966 long.
8967 * testsuite/script_test_2.cc: Adjust string and section length
8968 checks.
7c98e6bb 8969
99a37bfd
ILT
89702008-04-09 Ian Lance Taylor <iant@google.com>
8971
2cefc357
ILT
8972 PR gold/5996
8973 * script-sections.cc (Sections_element::allocate_to_segment): Add
8974 orphan parameter.
8975 (Output_section_definition::allocate_to_segment): Likewise.
8976 (Orphan_output_section::allocate_to_segment): Likewise.
8977 (Script_sections::attach_sections_using_phdrs_clause): Don't
8978 propagate non-PT_LOAD segments to orphan sections.
8979 * testsuite/Makefile.am (script_test_3.stdout): Generate using
8980 readelf rather than objdump.
8981 * testsuite/script_test_3.sh: Adjust accordingly. Test that
8982 .interp section and PT_INTERP segment are the same size.
8983 * testsuite/Makefile.in: Rebuild.
8984
99a37bfd
ILT
8985 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
8986 aliases for symbols defined in the same object.
8987 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
8988 (weak_alias_test_SOURCES): New variable.
8989 (weak_alias_test_DEPENDENCIES): New variable.
8990 (weak_alias_test_LDFLAGS): New variable.
8991 (weak_alias_test_LDADD): New variable.
8992 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
8993 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
8994 (weak_alias_test_3.o): New target.
8995 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
8996 * testsuite/weak_alias_test_main.cc: New file.
8997 * testsuite/weak_alias_test_1.cc: New file.
8998 * testsuite/weak_alias_test_2.cc: New file.
8999 * testsuite/weak_alias_test_3.cc: New file.
9000
780e49c5
ILT
90012008-04-08 Ian Lance Taylor <iant@google.com>
9002
cdb0b8f5
ILT
9003 * options.h (class General_options): Add --noinhibit-exec option.
9004 * main.cc (main): Check --noinhibit-exec.
9005
0864d551
ILT
9006 * options.h (class General_options): Define --wrap as a special
9007 option. Add wrap_symbols_ field.
9008 (General_options::any_wrap_symbols): New function.
9009 (General_options::is_wrap_symbol): New function.
9010 * options.cc (General_options::parse_wrap): New function.
9011 (General_options::General_options): Initialize wrap_symbols_.
9012 * symtab.cc (Symbol_table::wrap_symbol): New function.
9013 (Symbol_table::add_from_object): Handle --wrap.
9014 * symtab.h (class Symbol_table): Declare wrap_symbol.
9015 * target.h (Target::wrap_char): New function.
9016 (Target::Target_info): Add wrap_char field.
9017 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9018 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9019 * testsuite/testfile.cc (Target_test::test_target_info):
9020 Likewise.
9021
789aa6de
ILT
9022 * errors.cc (Errors::undefined_symbol): Mention symbol version if
9023 there is one.
9024
2c38906f
ILT
9025 * layout.h (class Layout): Add added_eh_frame_data_ field.
9026 * layout.cc (Layout::Layout): Initialize new field.
9027 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9028 output section until we find a section we merged successfully.
9029 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9030 that the size be non-zero.
9031
780e49c5
ILT
9032 * merge.cc (Object_merge_map::get_output_offset): Remove inline
9033 qualifier.
9034
7fcd0256
ILT
90352008-04-08 Craig Silverstein <csilvers@google.com>
9036
9037 * configure.ac: Export new conditional variable HAVE_ZLIB.
9038 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9039 on HAVE_ZLIB.
9040 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9041 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9042
6835af53
ILT
90432008-04-07 Ian Lance Taylor <iant@google.com>
9044
e24f324c
ILT
9045 * version.cc (version_string): Set to "1.5".
9046
a036edd8
ILT
9047 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9048 Add issued_non_pic_error_ field. Declare check_non_pic.
9049 (Target_x86_64::Scan::check_non_pic): New function.
9050 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9051 (Target_x86_64::Scan::global): Likewise.
9052
624f8810
ILT
9053 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9054 addend parameter. Change caller. Handle merge sections.
9055 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9056 Address to Addend. Don't add in the result of
9057 local_section_offset, pass down the addend and use the returned
9058 value.
9059 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
9060 Update declarations of local_section_offset and symbol_value.
9061 * testsuite/two_file_test_1.cc (t18): New function.
9062 * testsuite/two_file_test_2.cc (f18): New function.
9063 * testsuite/two_file_test_main.cc (main): Call t18.
9064 * testsuite/two_file_test.h (t18, f18): Declare.
9065
6835af53
ILT
9066 * configure.ac: Don't test for objdump, c++filt, or readelf.
9067 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
9068 conditionals.
9069 (TEST_READELF): New variable.
9070 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
9071 (check_PROGRAMS): Add two_file_strip_test.
9072 (two_file_strip_test): New target.
9073 (check_PROGRAMS): Add two_file_same_shared_strip_test.
9074 (two_file_same_shared_strip_test_SOURCES): New variable.
9075 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
9076 (two_file_same_shared_strip_test_LDFLAGS): New variable.
9077 (two_file_same_shared_strip_test_LDADD): New variable.
9078 (two_file_shared_strip.so): New target.
9079 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
9080 (ver_test_5.syms, ver_test_7.syms): Likewise.
9081 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
9082 (strip_test_3.stdout): Use TEST_OBJDUMP.
9083 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9084
86925eef
CC
90852008-04-04 Cary Coutant <ccoutant@google.com>
9086
9087 * symtab.h (Symbol::is_weak_undefined): New function.
9088 (Symbol::is_strong_undefined): New function.
9089 (Symbol::is_absolute): New function.
9090 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
9091 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
9092 absolute symbols.
9093 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
9094 (weak_undef_test): New target.
9095 * testsuite/Makefile.in: Rebuild.
9096 * testsuite/weak_undef_file1.cc: New file.
9097 * testsuite/weak_undef_file2.cc: New file.
9098 * testsuite/weak_undef_test.cc: New file.
9099
126f3ece
ILT
91002008-04-03 Craig Silverstein <csilvers@google.com>
9101
9102 * compressed_output.h (class Output_compressed_section): Use
9103 unsigned buffer.
9104 * compressed_output.cc (zlib_compress): Use unsigned buffers,
9105 add zlib header.
9106 (zlib_compressed_suffix): Removed.
9107 (Output_compressed_section::set_final_data_size): Use unsigned
9108 buffers.
9109 * testsuite/Makefile.am (flagstest_compress_debug_sections):
9110 Fix linker invocation.
9111 (flagstest_o_specialfile_and_compress_debug_sections):
9112 Likewise.
9113 * testsuite/Makefile.in: Regenerated.
9114
deae2a14
DM
91152008-04-02 David S. Miller <davem@davemloft.net>
9116
9117 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
9118 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
9119
70752818
ILT
91202008-04-02 Craig Silverstein <csilvers@google.com>
9121
9122 * TODO: New file.
9123
39d0cb0e
ILT
91242008-04-02 Ian Lance Taylor <iant@google.com>
9125
9126 * fileread.cc (File_read::find_view): Add byteshift and vshifted
9127 parameters. Update for new key type to views_. Change all
9128 callers.
9129 (File_read::read): Adjust for byteshift in returned view.
9130 (File_read::add_view): New function, broken out of
9131 find_and_make_view.
9132 (File_read::make_view): New function, broken out of
9133 find_and_make_view.
9134 (File_read::find_or_make_view): Add offset and aligned
9135 parameters. Rewrite accordingly. Change all callers.
9136 (File_read::get_view): Add offset and aligned parameters. Adjust
9137 for byteshift in return value.
9138 (File_read::get_lasting_view): Likewise.
9139 * fileread.h (class File_read): Update declarations.
9140 (class File_read::View): Add byteshift_ field. Add byteshift to
9141 constructor. Add byteshift method.
9142 * archive.h (Archive::clear_uncached_views): New function.
9143 (Archive::get_view): Add aligned parameter. Change all callers.
9144 * object.h (Object::get_view): Add aligned parameter. Change all
9145 callers.
9146 (Object::get_lasting_view): Likewise.
9147
9148 * fileread.cc (File_read::release): Don't call clear_views if
9149 there are multiple objects.
9150 * fileread.h (File_read::clear_uncached_views): New function.
9151 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
9152 on the archive.
9153
a1207466
CC
91542008-03-31 Cary Coutant <ccoutant@google.com>
9155
9156 Add thin archive support.
9157 * archive.cc (Archive::armagt): New const.
9158 (Archive::setup): Remove task parameter and calls to unlock.
9159 (Archive::unlock_nested_archives): New function.
9160 (Archive::read_header): Add nested_off parameter. Change
9161 all callers.
9162 (Archive::interpret_header): Likewise.
9163 (Archive::include_all_members): Change to handle thin
9164 archives.
9165 (Archive::include_member): Likewise.
9166 * archive.h (Archive::Archive): Add new parameters and
9167 initializers.
9168 (Archive::armagt): New const.
9169 (Archive::setup): Remove task parameter.
9170 (Archive::unlock_nested_archives): New function.
9171 (Archive::read_header): Add nested_off parameter.
9172 (Archive::interpret_header): Likewise.
9173 (Archive::Nested_archive_table): New typedef.
9174 (Archive::is_thin_archive_): New field.
9175 (Archive::nested_archives_): New field.
9176 (Archive::options_): New field.
9177 (Archive::dirpath_): New field.
9178 (Archive::task_): New field.
9179 * readsyms.cc (Read_symbols::do_read_symbols): Add check
9180 for thin archives. Pass additional parameters to
9181 Archive::Archive. Unlock the archive file after calling
9182 Archive::setup.
cd536b21 9183
479f6503
ILT
91842008-03-29 Ian Lance Taylor <iant@google.com>
9185
686c8caf
ILT
9186 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
9187 version symbol to be local.
9188 * testsuite/ver_test_4.sh: New file.
9189 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
9190 (check_DATA): Add ver_test_4.syms.
9191 (ver_test_4.syms): New target.
9192 * testsuite/Makefile.in: Rebuild.
9193
ab794b6b
ILT
9194 * output.cc
9195 (Output_section::Input_section_sort_entry::has_priority): New
9196 function.
9197 (Output_section::Input_section_sort_entry::match_file_name): New
9198 function.
9199 (Output_section::Input_section_sort_entry::match_section_name):
9200 Remove.
9201 (Output_section::Input_section_sort_entry::match_section_name_prefix):
9202 Remove.
9203 (Output_section::Input_section_sort_entry::match_section_file):
9204 Remove.
9205 (Output_section::Input_section_sort_compare::operator()): Rewrite
9206 using new Input_section_sort_entry functions. Sort crtbegin and
9207 crtend first. Sort sections with no priority before sections with
9208 a priority.
9209 * testsuite/initpri1.c (d3): Check j != 4.
9210 (cd5): New constructor/destructor function.
9211 (main): Check j != 2.
9212
479f6503
ILT
9213 * symtab.cc (Symbol_table::add_from_object): If we don't use the
9214 new symbol when resolving, don't call set_is_default.
9215 * testsuite/ver_test_7.cc: New file.
9216 * testsuite/ver_test_7.sh: New file.
9217 * testsuite/Makefile.am (ver_test_7.so): New target.
9218 (ver_test_7.o): New target.
9219 (check_SCRIPTS): Add ver_test_7.sh.
9220 (check_DATA): Add ver_test_7.syms.
9221 (ver_test_7.syms): New target.
9222
2fd32231
ILT
92232008-03-28 Ian Lance Taylor <iant@google.com>
9224
9225 * layout.cc (Layout::layout): If we see an input section with a
9226 name that needs sorting, set the must_sort flag for the output
9227 section.
9228 (Layout::make_output_section): If the name of the output section
9229 indicates that it might require sorting, set the may_sort flag.
9230 * output.h (Output_section::may_sort_attached_input_sections): New
9231 function.
9232 (Output_section::set_may_sort_attached_input_sections): New
9233 function.
9234 (Output_section::must_sort_attached_input_sections): New
9235 function.
9236 (Output_section::set_must_sort_attached_input_sections): New
9237 function.
9238 (class Output_section): Declare Input_section_sort_entry. Define
9239 Input_section_sort_compare. Declare
9240 sort_attached_input_sections. Add new fields:
9241 may_sort_attached_input_sections_,
9242 must_sort_attached_input_sections_,
9243 attached_input_sections_are_sorted_.
9244 * output.cc (Output_section::Output_section): Initialize new
9245 fields.
9246 (Output_section::add_input_section): Add an entry to
9247 input_sections_ if may_sort or must_sort are true.
9248 (Output_section::set_final_data_size): Call
9249 sort_attached_input_sections if necessary.
9250 (Output_section::Input_section_sort_entry): Define new class.
9251 (Output_section::Input_section_sort_compare::operator()): New
9252 function.
9253 (Output_section::sort_attached_input_sections): New function.
9254 * configure.ac: Check whether the compiler supports constructor
9255 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
9256 * testsuite/initpri1.c: New file.
9257 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
9258 CONSTRUCTOR_PRIORITY.
9259 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
9260 (initpri1_LDFLAGS): New variable.
9261 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9262
18e6b24e
ILT
92632008-03-27 Ian Lance Taylor <iant@google.com>
9264
49bdd526
ILT
9265 * common.cc (Sort_commons::operator): Correct sorting algorithm.
9266 * testsuite/common_test_1.c: New file.
9267 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
9268 (common_test_1_SOURCES): New variable.
9269 (common_test_1_DEPENDENCIES): New variable.
9270 (common_test_1_LDFLAGS): New variable.
9271
18e6b24e
ILT
9272 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
9273 and commons_ correctly when NAME/VERSION does not override
9274 NAME/NULL.
9275 * testsuite/ver_test_6.c: New file.
9276 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
9277 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
9278 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
9279
04bf7072
ILT
92802008-03-26 Ian Lance Taylor <iant@google.com>
9281
5871526f
ILT
9282 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
9283 of an undefined symbol from a version script.
9284 * testsuite/Makefile.am (ver_test_5.so): New target.
9285 (ver_test_5.o): New target.
9286 (check_SCRIPTS): Add ver_test_5.sh.
9287 (check_DATA): Add ver_test_5.syms.
9288 (ver_test_5.syms): New target.
9289 * testsuite/ver_test_5.cc: New file.
9290 * testsuite/ver_test_5.script: New file.
9291 * testsuite/ver_test_5.sh: New file.
9292 * Makefile.in, testsuite/Makefile.in: Rebuild.
9293
04bf7072
ILT
9294 PR gold/5986
9295 Fix problems building gold with gcc 4.3.0.
9296 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
9297 (gold_error_at_location, gold_warning_at_location): Use it.
9298 * configure.ac: Check whether we can compile and use a template
9299 function with a printf attribute.
9300 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
9301 when jumping over bytes.
9302 * object.cc: Instantiate Object::read_section_data.
9303 * debug.h: Include <cstring>
9304 * dwarf_reader.cc: Include <algorithm>
9305 * main.cc: Include <cstring>.
9306 * options.cc: Include <cstring>.
9307 * output.cc: Include <cstring>.
9308 * script.cc: Include <cstring>.
9309 * script.h: Include <string>.
9310 * symtab.cc: Include <cstring> and <algorithm>.
9311 * target-select.cc: Include <cstring>.
9312 * version.cc: Include <string>.
9313 * testsuite/testmain.cc: Include <cstdlib>.
9314 * configure, config.in: Rebuild.
9315
874c5b28
ILT
93162008-03-25 Ian Lance Taylor <iant@google.com>
9317
819d6c3a
ILT
9318 * options.cc: Include "../bfd/bfdver.h".
9319 (options::help): Print bug reporting address.
9320
f4b2c6f5
ILT
9321 * version.cc (print_version): Adjust output for current value of
9322 BFD_VERSION_STRING.
9323
9324 * NEWS: New file.
9325
e96caa79
ILT
9326 * options.cc (options::help): Print list of supported targets.
9327 * target-select.h: Include <vector>.
9328 (class Target_selector): Make machine_, size_, and is_big_endian_
9329 fields const. Add bfd_name_ and instantiated_target_ fields.
9330 (Target_selector::Target_selector): Add bfd_name parameter.
9331 (Target_selector::recognize): Make non-virtual, call
9332 do_recognize.
9333 (Target_selector::recognize_by_name): Make non-virtual, call
9334 do_recognize_by_name.
9335 (Target_selector::supported_names): New function.
9336 (Target_selector::bfd_name): New function.
9337 (Target_selector::do_instantiate_target): New pure virtual
9338 function.
9339 (Target_selector::do_recognize): New virtual function.
9340 (Target_selector::do_recognize_by_name): New virtual function.
9341 (Target_selector::instantiate_target): New private function.
9342 (supported_target_names): Declare.
9343 * target-select.cc (Target_selector::Target_selector): Update for
9344 new parameter and fields.
9345 (select_target_by_name): Check that the name matches before
9346 calling recognize_by_name.
9347 (supported_target_names): New function.
9348 * i386.cc (class Target_selector_i386): Update Target_selector
9349 constructor call. Remove recognize and recognize_by_name. Add
9350 do_instantiate_target.
9351 * x86_64.cc (class Target_selector_x86_64): Likewise.
9352 * testsuite/testfile.cc (class Target_selector_test): Update for
9353 changes to Target_selector.
9354
874c5b28
ILT
9355 * README: Rewrite, with some notes on unsupported features.
9356
0a65a3a7
CC
93572008-03-24 Cary Coutant <ccoutant@google.com>
9358
9359 * i386.cc (Target_i386::Got_type): New enum declaration.
9360 (Target_i386::Scan::local): Updated callers of Output_data_got
9361 member functions.
9362 (Target_i386::Scan::global): Likewise.
9363 (Target_i386::Relocate::relocate): Likewise.
9364 (Target_i386::Relocate::relocate_tls): Likewise.
9365 * object.h (Got_offset_list): New class.
9366 (Sized_relobj::local_has_got_offset): Added got_type parameter.
9367 (Sized_relobj::local_got_offset): Likewise.
9368 (Sized_relobj::set_local_got_offset): Likewise.
9369 (Sized_relobj::local_has_tls_got_offset): Removed.
9370 (Sized_relobj::local_tls_got_offset): Removed.
9371 (Sized_relobj::set_local_tls_got_offset): Removed.
9372 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
9373 * output.cc (Output_data_got::add_global): Added got_type parameter.
9374 (Output_data_got::add_global_with_rel): Likewise.
9375 (Output_data_got::add_global_with_rela): Likewise.
9376 (Output_data_got::add_global_pair_with_rel): New function.
9377 (Output_data_got::add_global_pair_with_rela): New function.
9378 (Output_data_got::add_local): Added got_type parameter.
9379 (Output_data_got::add_local_with_rel): Likewise.
9380 (Output_data_got::add_local_with_rela): Likewise.
9381 (Output_data_got::add_local_pair_with_rel): New function.
9382 (Output_data_got::add_local_pair_with_rela): New function.
9383 (Output_data_got::add_global_tls): Removed.
9384 (Output_data_got::add_global_tls_with_rel): Removed.
9385 (Output_data_got::add_global_tls_with_rela): Removed.
9386 (Output_data_got::add_local_tls): Removed.
9387 (Output_data_got::add_local_tls_with_rel): Removed.
9388 (Output_data_got::add_local_tls_with_rela): Removed.
9389 * output.h (Output_data_got::add_global): Added got_type parameter.
9390 (Output_data_got::add_global_with_rel): Likewise.
9391 (Output_data_got::add_global_with_rela): Likewise.
9392 (Output_data_got::add_global_pair_with_rel): New function.
9393 (Output_data_got::add_global_pair_with_rela): New function.
9394 (Output_data_got::add_local): Added got_type parameter.
9395 (Output_data_got::add_local_with_rel): Likewise.
9396 (Output_data_got::add_local_with_rela): Likewise.
9397 (Output_data_got::add_local_pair_with_rel): New function.
9398 (Output_data_got::add_local_pair_with_rela): New function.
9399 (Output_data_got::add_global_tls): Removed.
9400 (Output_data_got::add_global_tls_with_rel): Removed.
9401 (Output_data_got::add_global_tls_with_rela): Removed.
9402 (Output_data_got::add_local_tls): Removed.
9403 (Output_data_got::add_local_tls_with_rel): Removed.
9404 (Output_data_got::add_local_tls_with_rela): Removed.
9405 * resolve.cc (Symbol::override_base_with_special): Removed
9406 reference to has_got_offset_ field.
9407 * symtab.cc (Symbol::init_fields): Replaced initialization
9408 of got_offset_ with got_offsets_. Removed initialization
9409 of has_got_offset_
53fcba31 9410 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
9411 (Symbol::got_offset): Likewise.
9412 (Symbol::set_got_offset): Likewise.
9413 (Symbol::has_tls_got_offset): Removed.
9414 (Symbol::tls_got_offset): Removed.
9415 (Symbol::set_tls_got_offset): Removed.
9416 (Symbol::got_offset_): Removed.
9417 (Symbol::tls_mod_got_offset_): Removed.
9418 (Symbol::tls_pair_got_offset_): Removed.
9419 (Symbol::got_offsets_): New field.
9420 (Symbol::has_got_offset): Removed.
9421 (Symbol::has_tls_mod_got_offset): Removed.
9422 (Symbol::has_tls_pair_got_offset): Removed.
9423 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
9424 (Target_x86_64::Scan::local): Updated callers of Output_data_got
9425 member functions.
9426 (Target_x86_64::Scan::global): Likewise.
9427 (Target_x86_64::Relocate::relocate): Likewise.
9428 (Target_x86_64::Relocate::relocate_tls): Likewise.
9429
bd52eafb
BE
94302008-03-25 Ben Elliston <bje@au.ibm.com>
9431
9432 * yyscript.y: Fix spelling error in comment.
9433
8b105e34
ILT
94342008-03-24 Ian Lance Taylor <iant@google.com>
9435
8ed814a9
ILT
9436 * options.h (class General_options): Define build_id option.
9437 * layout.h (class Layout): Declare write_build_id, create_note,
9438 create_build_id. Add build_id_note_ member.
9439 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
9440 "libiberty.h", "md5.h", "sha1.h".
9441 (Layout::Layout): Initialize eh_frame_data_,
9442 eh_frame_hdr_section_, and build_id_note_.
9443 (Layout::finalize): Call create_build_id.
9444 (Layout::create_note): New function, broken out of
9445 Layout::create_gold_note.
9446 (Layout::create_gold_note): Call create_note.
9447 (Layout::create_build_id): New function.
9448 (Layout::write_build_id): New function.
9449 (Close_task_runner::run): Call write_build_id.
9450
8b105e34
ILT
9451 * x86_64.cc: Correct license to GPLv3.
9452
086a1841
ILT
94532008-03-23 Ian Lance Taylor <iant@google.com>
9454
9455 * options.cc: Include "demangle.h".
9456 (parse_optional_string): New function.
9457 (parse_long_option): Handle takes_optional_argument.
9458 (parse_short_option): Update dash_z initializer. Handle
9459 takes_optional_argument.
9460 (General_options::General_options): Initialize do_demangle_.
9461 (General_options::finalize): Set do_demangle_. Handle demangling
9462 style.
9463 * options.h (parse_optional_string): Declare.
9464 (struct One_option): Add optional_arg field. Update constructor.
9465 Update call constructor calls. Add takes_optional_argument
9466 function.
9467 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
9468 (DEFINE_optional_string): Define.
9469 (General_options::demangle): Change from DEFINE_bool to
9470 DEFINE_optional_string.
9471 (General_options::no_demangle): New function.
9472 (General_options::do_demangle): New function.
9473 (General_options::set_do_demangle): New function.
9474 (General_options::execstack_status_): Move definition to end of
9475 class definition.
9476 (General_options::static_): Likewise.
9477 (General_options::do_demangle_): New field.
9478 * object.cc (big_endian>::get_symbol_location_info): Call
9479 Options::do_demangle, not Options::demangle.
9480 * symtab.cc (demangle): Likewise.
9481
cbb93e63
ILT
94822008-03-22 Ian Lance Taylor <iant@google.com>
9483
9484 * gold.h: Include <cstddef> and <sys/types.h>
9485 * options.h: Include <cstring>.
9486
ec531623
ILT
94872008-03-21 Ian Lance Taylor <iant@google.com>
9488
9489 * Added source code to GNU binutils.
This page took 0.568106 seconds and 4 git commands to generate.