* linux-low.c (linux_supports_tracefork_flag): Document.
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
0da6fa6c
DM
12010-02-12 David S. Miller <davem@davemloft.net>
2
3 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4 is_symbolless parameter.
5 (Output_reloc<SHT_REL>::is_symbolless): New.
6 (Output_reloc<SHT_REL>::is_symbolless_): New.
7 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9 (Output_reloc<SHT_RELA>::is_symbolless): New.
10 (Output_data_reloc::add_global): Handle is_symbolless.
11 (Output_data_reloc::add_global_relative): Likewise.
12 (Output_data_reloc::add_local): Likewise.
13 (Output_data_reloc::add_local_relative): Likewise.
14 (Output_data_reloc::add_symbolless_global_addend): New.
15 (Output_data_reloc::add_symbolless_local_addend): New.
16 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
17 is_symbolless.
18 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
19 instead of ->is_relative_
20 (Output_reloc::write): Likewise.
21 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
22 (Output_reloc::write_rel): Simplify.
23
24 * sparc.cc (Target_sparc::Scan::local): Use
25 ->add_symbolless_local_addend as needed.
26 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
27 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
28 based upon relocation offset.
29
e4782e83
DK
302010-02-11 Doug Kwan <dougkwan@google.com>
31
32 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
33 (Target_arm::Scan::global): Ditto. Also remove a comment before the
34 beginning of function.
35 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
36 and MOVT_ABS relocations. Those are non issued in scanning. Fix
37 parameter is_32bit in calls to should_apply_static_reloc.
38 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
39 (check_DATA): Add arm_abs_global.stdout.
40 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
41 arm_abs_global.stdout): New rules.
42 (MOSTLLYCLEANFILES): Add arm_abs_global
43 * Makefile.in: Regenerate.
44 * testsuite/arm_abs_global.s: New file.
45 * testsuite/arm_abs_global.sh: Ditto.
46 * testsuite/arm_abs_lib.s: Ditto.
47
93ceb764
ILT
482010-02-11 Ian Lance Taylor <iant@google.com>
49
50 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
51 Read_relocs task.
52 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
53 Allocate_commons_task first.
54 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
55 task, rather than symtab_lock_.
56 (Gc_process_relocs::~Gc_process_relocs): New function.
57 (Gc_process_relocs::is_runnable): Check this_blocker_.
58 (Gc_process_relocs::locks): Use next_blocker_ rather than
59 blocker_.
60 (Scan_relocs::~Scan_relocs): New function.
61 (Scan_relocs::is_runnable): Check this_blocker_ rather than
62 symtab_lock_.
63 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
64 next_blocker_.
65 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
66 fields. Add this_blocker_ and next_blocker_ fields. Adjust
67 constructor accordingly.
68 (class Gc_process_relocs): Likewise.
69 (class Scan_relocs): Likewise.
70 * common.h (class Allocate_commons_task): Remove symtab_lock_
71 field, and corresponding constructor parameter.
72 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
73 symtab_lock_.
74 (Allocate_commons_task::locks): Likewise.
75
114dfbe1
ILT
762010-02-11 Ian Lance Taylor <iant@google.com>
77
78 * gold-threads.h (class Once): Define.
79 (class Initialize_lock): Rewrite as child of Once.
80 * gold-threads.cc (class Once_initialize): Define.
81 (once_pointer_control): New static variable.
82 (once_pointer, once_arg): New static variables.
83 (c_run_once): New static function.
84 (Once::Once, Once::run_once, Once::internal_run): New functions.
85 (class Initialize_lock_once): Remove.
86 (initialize_lock_control): Remove.
87 (initialize_lock_pointer): Remove.
88 (initialize_lock_once): Remove.
89 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
90 (Initialize_lock::initialize): Rewrite.
91 (Initialize_lock::do_run_once): New function.
92 * archive.cc (Archive::interpret_header): Only clear name if it is
93 not already empty.
94 * fileread.cc: Include "gold-threads.h"
95 (file_counts_lock): New static variable.
96 (file_counts_initialize_lock): Likewise.
97 (File_read::release): Only increment counts when using --stats.
98 Use a lock around the increment.
99 * parameters.cc (class Set_parameters_target_once): Define.
100 (set_parameters_target_once): New static variable.
101 (Parameters::Parameters): Move here from parameters.h.
102 (Parameters::set_target): Rewrite.
103 (Parameters::set_target_once): New function.
104 (Parameters::clear_target): Move here and rewrite.
105 * parameters.h (class Parameters): Update declarations. Add
106 set_parameters_target_once_ field.
107 (Parameters::Parameters): Move to parameters.cc.
108 (Parameters::clear_target): Likewise.
109 * readsyms.cc (Read_symbols::do_group): Create a Start_group
110 task.
111 (Start_group::~Start_group): New function.
112 (Start_group::is_runnable): New function.
113 (Start_group::locks, Start_group::run): New functions.
114 (Finish_group::run): Change saw_undefined to size_t.
115 * readsyms.h (class Start_group): Define.
116 (class Finish_group): Change saw_undefined_ field to size_t.
117 (Finish_group::Finish_group): Remove saw_undefined and
118 this_blocker parameters. Change all callers.
119 (Finish_group::set_saw_undefined): New function.
120 (Finish_group::set_blocker): New function.
121 * symtab.h (class Symbol_table): Change saw_undefined to return
122 size_t. Change saw_undefined_ field to size_t.
123 * target-select.cc (Set_target_once::do_run_once): New function.
124 (Target_selector::Target_selector): Initialize set_target_once_
125 field. Don't initialize lock_ and initialize_lock_ fields.
126 (Target_selector::instantiate_target): Rewrite.
127 (Target_selector::set_target): New function.
128 * target-select.h (class Set_target_once): Define.
129 (class Target_selector): Update declarations. Make
130 Set_target_once a friend. Remove lock_ and initialize_lock_
131 fields. Add set_target_once_ field.
132
fa17a3f4
ILT
1332010-02-10 Ian Lance Taylor <iant@google.com>
134
135 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
136 queueing any tasks.
137 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
138 (queue_middle_tasks): Add all blockers before queueing any tasks.
139 (queue_final_tasks): Likewise.
140 * token.h (Task_token::add_blockers): New function.
141 * object.h (Input_objects::number_of_relobjs): New function.
142
c7177d31
ILT
1432010-02-10 Ian Lance Taylor <iant@google.com>
144
5de0e392
ILT
145 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
146 shared, not if not position independent.
147 * x86_64.cc (Relocate::relocate_tls): Likewise.
148 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
149 (tls_pie_pic_test): New target.
150 * testsuite/Makefile.in: Rebuild.
151
c7177d31
ILT
152 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
153 (tls_test_main_pie.o, tls_test_pie.o): New targets.
154 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
155 * testsuite/Makefile.in: Rebuild.
156
684b268a
DM
1572010-02-09 David S. Miller <davem@davemloft.net>
158
159 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
160 R_SPARC_RELATIVE using ->add_local_relative().
161 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
162
612a8d3d
DM
163 * output.h (Output_data_dynamic::add_section_size): New method
164 that takes two Output_data objects.
165 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
166 entry param. Handle it in initializers.
167 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
168 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
169 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
170 arg.
171 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
172 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
173 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
174 for dynrel_includes_plt.
175 * i386.cc (Target_i386::do_finalize_sections): Likewise.
176 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
177 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
178 before .rela.plt
179 (Target_sparc::do_finalize_sections): Update to pass true for
180 dynrel_includes_plt.
181 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
182 output before .rela.plt
183 (Target_powerpc::do_finalize_sections): Update to pass true for
184 dynrel_includes_plt when 32-bit.
185
cb1be87e
DK
1862010-02-08 Doug Kwan <dougkwan@google.com>
187
188 * arm.cc (Arm_relobj::simple_input_section_output_address): New
189 method.
190 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
191 Arm_relobj::scan_section_for_cortex_a8_stubs,
192 Arm_relobj::do_relocation_section): Instead of calling
193 Output_section::output_address, use faster
194 Arm_relobj::simple_input_section_output_address.
195
705b5121
DM
1962010-02-08 David S. Miller <davem@davemloft.net>
197
198 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
199 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
200 relocation helper function.
201
024c4466
DM
202 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
203 just like R_SPARC_GOT{10,13,22}.
204 (Target_sparc::Scan::local): Likewise.
205 (Target_sparc::Relocate:relocate): Likewise.
206
9109c078
ILT
2072010-02-06 Ian Lance Taylor <iant@google.com>
208
209 * configure.ac: Rewrite targetobjs duplicate removal code to use
210 only shell constructs.
211 * configure: Rebuild.
212
cf846138
DK
2132010-02-05 Doug Kwan <dougkwan@google.com>
214
215 PR 11247
216 * arm.cc (Arm_relobj::section_is_scannable): New method.
217 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
218 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
219
6cfaf60b
DK
2202010-02-04 Doug Kwan <dougkwan@google.com>
221
222 PR 11247
223 * arm-reloc-property.cc (cstdio): Include.
224 * configure.ac (targetobjs): Remove duplicates.
225 * configure: Regenerate.
226 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
227 big and little endian version for a given address size.
228
5c57f1be
DK
2292010-02-03 Doug Kwan <dougkwan@google.com>
230
231 * arm-reloc-property.cc
232 (Arm_reloc_property_table::reloc_name_in_error_message): New method
233 definition.
234 * arm-reloc-property.h
235 (Arm_reloc_property_table::get_implemented_static_reloc_property):
236 New method definition.
237 (Arm_reloc_property_table::reloc_name_in_error_message): New method
238 declaration.
239 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
240 overflow to N.
241 (GOT_PREL): Change implemented to Y.
242 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
243 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
244 (Arm_relocate_functions::movw_abs_nc): Remove method.
245 (Arm_relocate_functions::movt_abs): Ditto.
246 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
247 (Arm_relocate_functions::thm_movt_abs): Ditto.
248 (Arm_relocate_functions::movw_rel_nc): Ditto.
249 (Arm_relocate_functions::movw_rel): Ditto.
250 (Arm_relocate_functions::movt_rel): Ditto.
251 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
252 (Arm_relocate_functions:thm_movw_rel): Ditto.
253 (Arm_relocate_functions:thm_movt_rel): Ditto.
254 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
255 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
256 New method definitions.
257 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
258 (Arm_relocation_functions::arm_grp_ldr): Ditto.
259 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
260 (Arm_relocation_functions::arm_grp_ldc): Ditto.
261 (Target_arm::Relocate::relocate): Check for non-static or
262 unimplemented relocation code and exit early. Change calls to
263 Target_arm::reloc_uses_thumb_bit and
264 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
265 instead. Refactor code to handle similar relocations to increase
266 code sharing. Remove check for unsupported relocation code in switch
267 statement.
268 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
269 relocation property table to find out size. Change error message to
270 print out the name of a relocation code instead of the numeric value.
271 (Target_arm::scan_reloc_for_stub): Use relocation property table
272 instead of calling Target_arm::reloc_uses_thumb_bit().
273
218c5831
DK
2742010-02-02 Doug Kwan <dougkwan@google.com>
275
276 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
277 types of relaxed input section.
278
0d31c79d
DK
2792010-02-02 Doug Kwan <dougkwan@google.com>
280
281 * Makefile.am (HFILES): Add arm-reloc-property.h.
282 (DEFFILES): New.
283 (TARGETSOURCES): Add arm-reloc-property.cc
284 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
285 (libgold_a_SOURCES): $(DEFFILES)
286 * Makefile.in: Regenerate.
287 * arm-reloc-property.cc: New file.
288 * arm-reloc-property.h: New file.
289 * arm-reloc.def: New file.
290 * arm.cc: Update comments.
291 (arm-reloc-property.h): New included header.
292 (arm_reloc_property_table): New global variable.
293 (Target_arm::do_select_as_default_target): New method definition.
294 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
295 arm-reloc-property to targ_extra_obj.
296 * parameters.cc (set_parameters_target): Call
297 Target::select_as_default_target().
298 * target.h (Target::select_as_default_target): New method definition.
299 (Target::do_select_as_default_target): Same.
300
546c7457
DK
3012010-02-01 Doug Kwan <dougkwan@google.com>
302
303 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
304 first_output_text_section_.
305 (Arm_exidx_fixup::first_output_text_section): New method definition.
306 (Arm_exidx_fixup::first_output_text_section_): New data member.
307 (Arm_exidx_fixup::process_exidx_section): Record the first text
308 output section seen.
309 (Arm_output_section::fix_exidx_coverage): Set correct linked section
310 and entsize in output section header.
311
11b861d5
DK
3122010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
313
314 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
315 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
316 (Arm_relocate_functions::thm_alu11): New Method.
317 (Arm_relocate_functions::thm_pc8): New Method.
318 (Arm_relocate_functions::thm_pc12): New Method.
319 (Target_arm::Scan::local): Handle the relocations.
320 (Target_arm::Scan::global): Likewise.
321 (Target_arm::Relocate::relocate): Likewise.
322 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
323
c9a2c125
DK
3242010-01-29 Doug Kwan <dougkwan@google.com>
325
326 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
327 of relocation types as ld.
328
1521477a
DK
3292010-01-29 Doug Kwan <dougkwan@google.com>
330
331 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
332 to public.
333 (Arm_relocate_functions::thumb_branch_common): Ditto.
334 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
335 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
336 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
337 Arm_relocate_functions::jump24): Remove.
338 (Target_arm::Relocate::relocate): Adjust code to call
339 Arm_relocation_functions::arm_branch_common and
340 Arm_relocation_functions::thumb_branch_common instead of their removed
341 wrappers. Merge switch-cases together to reduce source code size.
342
e7eca48c
DK
3432010-01-29 Doug Kwan <dougkwan@google.com>
344
345 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
346 output_local_symbol_count_needs_update_.
347 (Arm_relobj::output_local_symbol_count_needs_update,
348 Arm_relobj::set_output_local_symbol_count_needs_update,
349 Arm_relobj::update_output_local_symbol_count): New methods.
350 (Arm_relobj::output_local_symbol_count_needs_update_): New data
351 member.
352 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
353 of pointed function as in a R_ARM_PREL31 relocation.
354 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
355 for output local symbol count updating.
356 (Target_arm::do_relax): Update output local symbol counts in objects
357 if necessary.
358 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
359
02961d7e
ILT
3602010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
361
362 * arm.cc: Added support for the ARM relocations:
363 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
364 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
365 (Arm_relocate_functions::movw_rel_nc): Renamed (was
366 movw_prel_nc).
367 (Arm_relocate_functions::movw_rel): New method.
368 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
369 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
370 thm_movw_prel_nc).
371 (Arm_relocate_functions::thm_movw_rel): New method.
372 (Arm_relocate_functions::thm_movt_rel): Renamed (was
373 thm_movt_prel).
374 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
375 relocations.
376 (Target_arm::Scan::global): Likewise.
377 (Target_arm::Relocate::relocate): Likewise.
378 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
379 Likewise.
380
b10d2873
ILT
3812010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
382
383 * arm.cc: Added support for ARM group relocations.
384 (Target_arm::reloc_needs_sym_origin): New method.
385 (Arm_relocate_functions::calc_grp_kn): New method.
386 (Arm_relocate_functions::calc_grp_residual): New method.
387 (Arm_relocate_functions::calc_grp_gn): New method.
388 (Arm_relocate_functions::arm_grp_alu): New Method.
389 (Arm_relocate_functions::arm_grp_ldr): New Method.
390 (Arm_relocate_functions::arm_grp_ldrs): New Method.
391 (Arm_relocate_functions::arm_grp_ldc): New Method.
392 (Target_arm::Scan::local): Handle the ARM group relocations.
393 (Target_arm::Scan::global): Likewise.
394 (Target_arm::Relocate::relocate): Likewise.
395 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
396 Likewise.
397
2b328d4e
DK
3982010-01-26 Doug Kwan <dougkwan@google.com>
399
400 * arm.cc (set): Include.
401 (class Arm_exidx_fixup): Change type of last_input_section_ to const
402 pointer type.
403 (Arm_output_section::Text_section_list): New type.
404 (Arm_output_section::append_text_sections_to_list): New method.
405 (Arm_output_section::fix_exidx_coverage): Ditto.
406 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
407 (Arm_relobj::convert_input_section_to_relaxed_section): Use
408 Relobj::set_section_offset() instead of
409 Sized_relobj::invalidate_section_offset().
410 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
411 parameter for section headers. Ignore relocation sections for
412 unallocated sections and EXIDX sections.
413 (Target_arm::fix_exidx_coverage): New method.
414 (Target_arm::output_section_address_less_than): New type.
415 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
416 linked text section instead of the EXIDX section.
417 (Arm_output_section::create_stub_group): Add an assertion to check
418 that this is not an EXIDX output section.
419 (Arm_output_section::append_text_sections_to_list): New method.
420 (Arm_output_section::fix_exidx_coverage): Ditto.
421 (Arm_relobj::scan_sections_for_stubs): Adjust call to
422 Arm_relobj::section_needs_reloc_stub_scanning.
423 (Target_arm::do_relax): Fix EXIDX output section coverage in the
424 first pass.
425 (Target_arm::fix_exidx_coverage): New method.
426 * object.h (Relobj::set_output_section): New method.
427 (Sized_relobj::invalidate_section_offset): Remove method.
428 (Sized_relobj::do_invalidate_section_offset): Remove method.
429 (Sized_relobj::do_set_section_offset): Handle offset value -1.
430
c7f3c371
DK
4312010-01-25 Doug Kwan <dougkwan@google.com>
432
433 * arm.cc (Arm_exidx_merged_section::do_output_offset):
434 Fix warning due to signed and unsigned comparison on a 32-bit host.
435
8923b24c
DK
4362010-01-22 Doug Kwan <dougkwan@google.com>
437
438 * arm.cc (Target_arm::do_relax): Record an output section for section
439 offset adjustment it contains any stub table that has changed.
440 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
441 offsets in an output section if necessary.
442 * output.cc (Output_section::Output_section): Initialize
443 section_offsets_need_adjustments_.
444 (Output_section::add_input_section_for_script): Renamed to
445 Output_section::add_simple_input_section.
446 (Output_section::save_states): Add a comment.
447 (Output_section::discard_states): New method defintion.
448 (Output_section::adjust_section_offsets): Same.
449 * output.h (Output_section::add_input_section_for_script): Renamed to
450 Output_section::add_simple_input_section.
451 (Output_section::discard_states): New method declaration.
452 (Output_section::adjust_section_offsets): Same.
453 (Output_section::section_offsets_need_adjustment,
454 Output_section::set_section_offsets_need_adjustment): New method
455 definitions.
456 (Output_section::section_offsets_need_adjustment_): New data member.
457 * script-sections.cc
458 (Output_section_element_input::set_section_address): Adjust code for
459 renaming of Output_section::add_input_section_for_script.
460 (Orphan_output_section::set_section_address): Same.
461
9b2fd367
DK
4622010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
463
464 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
465 Fix_v4bx enum values .
466 * gold/options.h (General_options): New option definitions.
467 (General_options::fix_v4bx): New method.
468 (General_options::Fix_v4bx): New enum.
469 * gold/options.cc (General_options::parse_fix_v4bx): New method.
470 (General_options::parse_fix_v4bx_interworking): New method.
471
80d0d023
DK
4722010-01-22 Doug Kwan <dougkwan@google.com>
473
474 * arm.cc (Arm_exidx_fixup): New class.
475
af2cdeae
DK
4762010-01-21 Doug Kwan <dougkwan@google.com>
477
478 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
479 classes.
480 (Arm_exidx_section_offset_map): New type.
481
993d07c1
DK
4822010-01-21 Doug Kwan <dougkwan@google.com>
483
484 * arm.cc (Arm_exidx_input_section): New class.
485 (Arm_relobj::exidx_input_section_by_link,
486 Arm_relobj::exidx_input_section_by_shndx,
487 Arm_relobj::make_exidx_input_section): New methods.
488 (read_arm_attributes_section): Remove.
489 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
490 information about them.
491 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
492 to here.
493
5ac169d4
DK
4942010-01-20 Doug Kwan <dougkwan@google.com>
495
496 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
497 Input_section_specifier to Section_id.
498 (Target_arm::new_arm_input_section: Adjust code for change of key
499 type.
500 (Target_arm::find_arm_input_section): Ditto.
501 * gc.h (object.h): Include for Section_id nand Section_id_hash.
502 (Section_id): Remove.
503 (Garbage_collection::Section_id_hash): Remove.
504 * icf.h (object.h): Include for Section_id nand Section_id_hash.
505 (Section_id): Remove.
506 (Icf::Section_id_hash): Remove.
507 * object.h (Section_id, Const_section_id, Section_id_hash,
508 Const_section_id_hash): New type definitions.
509 * output.cc (Output_section::add_relaxed_input_section): Change to
510 use Const_section_id instead of Input_section_specifier as key type.
511 (Output_section::add_merge_input_section): Ditto.
512 (Output_section::build_relaxation_map): Change to use Section_id
513 instead of Input_section_specifier as key type.
514 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
515 Ditto.
516 (Output_section::convert_input_sections_to_relaxed_sections): Change
517 to use Const_section_id instead of Input_section_specifier as key type.
518 (Output_section::find_merge_section): Ditto.
519 (Output_section::find_relaxed_input_section): Ditto.
520 * output.h (Input_section_specifier): Remove class.
521 (Output_section::Output_section_data_by_input_section_map): Change
522 key type to Const_section_id.
523 (Output_section::Output_relaxed_input_section_by_input_section_map):
524 Ditto.
525 (Output_section::Relaxation_map): Change key type to Section_id.
526
a2162063
ILT
5272010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
528
529 * gold/arm.cc: Added support for R_ARM_V4BX relocation
530 (class Arm_v4bx_stub): New class.
531 (DEF_STUBS): Updated definition to support v4_veneer_bx.
532 (Stub_factory::make_arm_v4bx_stub): New method.
533 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
534 (Stub_table::empty): Handle v4bx stubs.
535 (Stub_table::add_arm_v4bx_stub): New method.
536 (Stub_table::find_arm_v4bx_stub): New method.
537 (Arm_relocate_functions::v4bx): New method.
538 (Target_arm::fix_v4bx): New method.
539 (Target_arm::Target_arm): Handle R_ARM_V4BX.
540 (Stub_table::relocate_stubs): Likewise.
541 (Stub_table::do_write): Likewise.
542 (Stub_table::update_data_size_and_addralign): Likewise.
543 (Stub_table::finalize_stubs): Likewise.
544 (Target_arm::Scan::local): Likewise.
545 (Target_arm::Scan::global): Likewise.
546 (Target_arm::do_finalize_sections): Likewise.
547 (Target_arm::Relocate::relocate): Likewise.
548 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
549 Likewise.
550 (Target_arm::scan_reloc_for_stub): Likewise.
551 (Target_arm::scan_reloc_section_for_stubs): Likewise.
552
5696ab0b
ILT
5532010-01-19 Ian Lance Taylor <iant@google.com>
554
555 * output.cc (Output_section_headers::do_sized_write): Write large
556 segment count to sh_info field.
557 (Output_file_header::do_sized_write): For large segment count,
558 write PN_XNUM to e_phnum field.
559
800d0f56
ILT
5602010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
561
562 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
563 (Arm_relocate_functions::thm_jump8): New function.
564 (Arm_relocate_functions::thm_jump11): New function.
565 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
566 R_ARM_THM_JUMP11.
567 (Target_arm::Scan::global): Likewise.
568 (Target_arm::Relocate::relocate): Likewise.
569 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
570 Likewise.
571
41263c05
DK
5722010-01-14 Doug Kwan <dougkwan@google.com>
573
574 * arm.cc (map, utility): Include headers.
575 (Target_arm::apply_cortex_a8_workaround): New method.
576 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
577 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
578 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
579 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
580 the --[no-]fix-cortex-a8 command line options.
581 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
582 (Target_arm::relocate_stub): Use addend in instruction template.
583 * options.h (DEFINE_bool): Set the user-set flag.
584 (General_options): Add --[no-]-fix-cortex options.
585 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
586 : Update fast look-up map after conversion.
587
459e9b03
ST
5882010-01-14 Sriraman Tallam <tmsriram@google.com>
589
590 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
591 in the first pass of do_layout.
592
b521dfe4
DK
5932010-01-13 Doug Kwan <dougkwan@google.com>
594
595 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
596 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
597 apparent compiler problem of not folding static constant integral
598 data members of elfcpp::Elf_sizes<32>.
599
44272192
DK
6002010-01-13 Doug Kwan <dougkwan@google.com>
601
602 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
603 Arm_relobj::section_needs_cortex_a8_stub_scanning,
604 Arm_relobj::scan_section_for_cortex_a8_erratum,
605 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
606 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
607 sections to scan for relocation stubs into a new method
608 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
609 relocation and Cortex-A8 stub scanning.
610 (Target_arm::do_relax): Force stubs to be after stubbed sections
611 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
612 the beginning of a new relaxation pass. Update a comment.
613 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
614
44b71ece
ILT
6152010-01-12 Ian Lance Taylor <iant@google.com>
616
617 * target-reloc.h (visibility_error): New inline function.
618 (relocate_section): Call visibility_error.
619 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
620 (MOSTLYCLEANFILES): Likewise.
621 (protected_4_pic.o, protected_3.err): New targets.
622 * testsuite/protected_4.cc: New file.
623
a120bc7f
DK
6242010-01-12 Doug Kwan <dougkwan@google.com>
625
626 * arm.cc (Cortex_a8_reloc): New class.
627 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
628 and cortex_a8_relocs_info_.
629 (Target_arm::fix_cortex_a8): New method definition.
630 (Target_arm::Cortex_a8_relocs_info): New type.
631 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
632 New data member declarations.
633 (Target_arm::scan_reloc_for_stub): Record information about
634 relocations for THUMB branches that might be exempted from the
635 Cortex-A8 workaround.
636 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
637 at the beginning of a relaxation pass.
638
20138696
DK
6392010-01-12 Doug Kwan <dougkwan@google.com>
640
641 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
642 (Arm_relobj::Mapping_symbol_position,
643 Arm_reloj::Mapping_symbol_position_less,
644 Arm_relobj::Mapping_symbols_info): New types.
645 (Target_arm::is_mapping_symbol_name): New method definition.
646 (Arm_relobj::do_count_local_symbols): Save information about mapping
647 symbols.
648
089d69dc
DK
6492010-01-11 Doug Kwan <dougkwan@google.com>
650
651 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
652 Arm_relocate_functions::thumb32_branch_upper,
653 Arm_relocate_functions::thumb32_branch_lower,
654 Arm_relocate_functions::thumb32_cond_branch_offset,
655 Arm_relocate_functions::thumb32_cond_branch_upper,
656 Arm_relocate_functions::thumb32_cond_branch_lower,
657 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
658 branch offset encoding.
659 (Arm_relocate_functions::thumb_branch_common): Use new branch
660 offset encoding methods to avoid code duplication.
661 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
662 (Stub_addend_reader::operator()): Use new branch encoding method
663 to avoid code duplication.
664
99e5bff2
DK
6652010-01-11 Doug Kwan <dougkwan@google.com>
666
667 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
668 (Target_arm::do_finalize_sections): Define special EXIDX section
669 symbols only if referenced.
670 * gc.h (Garbage_collection::add_reference): New method.
671 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
672 code duplication.
673
98e090bd
ILT
6742010-01-11 Ian Lance Taylor <iant@google.com>
675
d0a91bd8
ILT
676 * script.cc (Version_script_info::build_expression_list_lookup):
677 Change complaing about duplicate wildcard match from error to
678 warning.
679
98e090bd
ILT
680 * script.cc (class Lazy_demangler): Recreate--revert part of patch
681 of 2009-12-30.
682 (Version_script_info::Version_script_info): Initialize globs_,
683 default_version_, default_is_global_, and exact_. Don't
684 initialize globals_ or locals_.
685 (Version_script_info::build_lookup_tables): Build local symbols
686 first.
687 (Version_script_info::unquote): New function.
688 (Version_script_info::add_exact_match): New function.
689 (Version_script_info::build_expression_list_lookup): Remove lookup
690 parameter. Add is_global parameter. Change all callers. Handle
691 wildcard pattern specially. Unquote pattern. Call
692 add_exact_match.
693 (Version_script_info::get_name_to_match): New function.
694 (Version_script_info::get_symbol_version): New function.
695 (Version_script_info::get_symbol_version_helper): Remove.
696 (Version_script_info::check_unmatched_names): Call unquote.
697 * script.h (class Version_script_info): Change get_symbol_version
698 to be non-inline and add is_global parameter; change all callers.
699 Rewrite symbol_is_local. Update declarations. Define struct
700 Version_tree_match, Exact, Globs. Don't define struct Lookup.
701 Remove globals_ and locals_ members. Add exact_, globs_,
702 default_version_, is_global_.
703 (Version_script_info::Glob): Remove pattern, add expression and
704 is_global. Update constructor. Change all callers.
705 * dynobj.cc (Versions::finalize): Mark the version symbol as the
706 default version.
707 (Versions::symbol_section_contents): If a symbol is undefined, or
708 defined in a dynamic object, set the version index to
709 VER_NDX_LOCAL.
710 * symtab.cc (Symbol_table::add_from_relobj): Don't call
711 symbol_is_local.
712 (Symbol_table::add_from_pluginobj): Likewise.
713 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
714
d56962d3
DK
7152010-01-11 Doug Kwan <dougkwan@google.com>
716
717 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
718 (incremental_dump_LDADD): Add linking option for libintl.
719 * Makefile.in: Regenerate.
720
94e6ee91
L
7212010-01-11 H.J. Lu <hongjiu.lu@intel.com>
722
723 PR gold/11144
724 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
725 instead of -Ds.
726 * testsuite/Makefile.in: Regenerated.
727
e96c574b
DK
7282010-01-10 Doug Kwan <dougkwan@google.com>
729
730 * options.h (DEFINE_var): Use parentheses around argument varname__
731 in macro body to avoid any unintended subsequent substitutions.
732
7198066b
ILT
7332010-01-10 Ian Lance Taylor <iant@google.com>
734
ba4d53bf
ILT
735 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
736 candidates before doing symbol resolution.
737
7198066b
ILT
738 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
739 ODR candidates if only one is weak.
740
a2beed37
ILT
7412010-01-08 Ian Lance Taylor <iant@google.com>
742
743 * script.cc (Version_script_info::build_expression_list_lookup):
744 Don't warn about ambiguous version, just record the ambiguity.
745 (Version_script_info::get_symbol_version_helper): Give error if
746 version is ambiguous.
747
2fb7225c
DK
7482010-01-08 Doug Kwan <dougkwan@google.com>
749
750 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
751 prev_data_size_ and prev_addralign_. Remove initializer for
752 deleted data member has_been_changed_.
753 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
754 to determine if the table is empty.
755 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
756 Remove.
757 (Stub_table::add_reloc_stub): Define method in class definition
758 instead of just declaring it there.
759 (Stub_table::add_cortex_a8_stub): New method definition.
760 (Stub_table::update_data_size_and_addralign): Ditto.
761 (Stub_table::finalize_stubs): Ditto.
762 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
763 (Stub_table::do_addralign_): Return address alignment in the
764 (Stub_table::do_reset_address_and_file_offset): Define method in
765 class definition instead of declaring it there. Set current data
766 size to be the data size of the previous pass.
767 (Stub_table::set_final_data_size): Use current data size as the
768 final data size.
769 (Stub_table::relocate_stub): Change parameter type of stub from
770 Reloc_stub pointer to Stub pointer.
771 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
772 (Stub_table::Cortex_a8_stub_list): New typedef.
773 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
774 Stub_table::prev_addralign_): New data member.
775 (Arm_relobj::Arm_relobj): Initialize data member
776 section_has_cortex_a8_workaround_.
777 (Arm_relobj::section_has_cortex_a8_workaround,
778 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
779 definitions.
780 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
781 declarations.
782 (Target_arm::relocate_stub): Change parameter type of stub from
783 Reloc_stub pointer to Stub pointer.
784 (Insn_template::size, Insn_template::alignment): Handle
785 THUMB16_SPECIAL_TYPE.
786 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
787 Stub_table::update_data_size_and_addralign,
788 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
789 definitions.
790 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
791 (Stub_table::do_write): Ditto.
792 (Target_arm::do_relax): Adjust code for changes in Stub_table.
793
880cd20d
ILT
7942010-01-08 Ian Lance Taylor <iant@google.com>
795
796 PR 11108
797 * symtab.h (class Symbol): Remove fields is_target_special_ and
798 has_plt_offset_. Add field is_defined_in_discarded_section_.
799 (Symbol::is_defined_in_discarded_section): New function.
800 (Symbol::set_is_defined_in_discarded_section): New function.
801 (Symbol::has_plt_offset): Rewrite.
802 (Symbol::set_plt_offset): Verify that new offset is not -1U.
803 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
804 Don't initialize is_target_special_ or has_plt_offset_.
805 Initialize is_defined_in_discarded_section_.
806 (Symbol_table::add_from_relobj): If appropriate, set
807 is_defined_in_discarded_section.
808 * resolve.cc (Symbol::override_base_with_special): Don't test
809 is_target_special_. Change has_plt_offset_ to has_plt_offset().
810 * target-reloc.h (relocate_section): Do special handling for
811 symbols defined in discarded sections for global symbols as well
812 as local symbols.
813
2703e3eb
ILT
8142010-01-08 Ian Lance Taylor <iant@google.com>
815
816 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
817 the SHT_SYMTAB case.
818
339d40a3
ILT
8192010-01-08 Ian Lance Taylor <iant@google.com>
820
821 * object.cc (Sized_relobj::do_layout): Don't get confused if
822 layout_eh_frame returns NULL.
823
abecea76
ILT
8242010-01-08 Ian Lance Taylor <iant@google.com>
825
826 PR 11084
827 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
828 dynamic symbol table, use the normal symbol table.
829 (Sized_dynobj::do_read_symbols): Remove assertion about type of
830 symbol table.
831
6b7dd3f3
ILT
8322010-01-08 Ian Lance Taylor <iant@google.com>
833
834 PR 11072
835 * layout.cc (Layout::include_section): Remove .gnu_debuglink
836 sections.
837
36c50e63
L
8382010-01-08 H.J. Lu <hongjiu.lu@intel.com>
839
840 * version.cc (print_version): Change to "Copyright 2010".
841
e291e7b9
ILT
8422010-01-08 Ian Lance Taylor <iant@google.com>
843
844 PR 10287
845 PR 11063
846 * i386.cc (class Target_i386): Change return type of plt_section
847 to be non-const.
848 (class Output_data_plt_i386): Add tls_desc_rel_ field.
849 (Output_data_plt_i386::Output_data_plt_i386): Initialize
850 tls_desc_rel_ field.
851 (Output_data_plt_i386::rel_tls_desc): New function.
852 (Target_i386::rel_tls_desc_section): New function.
853 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
854 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
855 R_386_TLS_DESC reloc in rel_tls_desc_section.
856 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
857 Define struct Tlsdesc_info.
858 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
859 (Target_x86_64::do_reloc_symbol_index): New function.
860 (Target_x86_64::add_tlsdesc_info): New function.
861 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
862 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
863 tlsdesc_rel_ field.
864 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
865 all callers.
866 (Output_data_plt_x86_64::rela_tlsdesc): New function.
867 (Target_x86_64::rela_tlsdesc_section): New function.
868 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
869 handling.
870 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
871 (Target_x86_64::do_reloc_addend): New function.
872 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
873 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
874 declarations. Define TARGET_CODE. Add arg field to u1_ union.
875 (Output_reloc::type): New function.
876 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
877 (Output_reloc::is_target_specific): New function.
878 (Output_reloc::target_arg): New function.
879 (class Output_reloc) [SHT_RELA]: Add four new constructors for
880 absolute relocs and target specific relocs.
881 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
882 add_target_specific.
883 (class Output_data_reloc) [SHT_RELA]: Likewise.
884 * output.cc (Output_reloc::Output_reloc): Add four new versions
885 for absolute relocs and target specific relocs.
886 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
887 (Output_reloc::get_symbol_index): Likewise.
888 (Output_reloc::local_section_offset): Check that local_sym_index_
889 is not TARGET_CODE or 0.
890 (Output_reloc::symbol_value): Likewise.
891 (Output_reloc::write) [SHT_RELA]: Call target for target specific
892 reloc.
893 * target.h (class Target): Add reloc_symbol_index and reloc_addend
894 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
895 functions.
896 * layout.cc (add_target_dynamic_tags): Use output section for
897 DT_PLTRELSZ and DT_JMPREL.
898
3a44184e
ILT
8992010-01-07 Ian Lance Taylor <iant@google.com>
900
901 PR 11061
902 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
903 function.
904 (class Output_data_reloc_generic): Define.
905 (class Output_data_reloc_base): Change base class to
906 Output_data_reloc_generic. Change add() method to call
907 bump_relative_reloc_count for a relative reloc. Remove
908 sort_relocs_ field.
909 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
910 to sort_relocs().
911 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
912 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
913 appropriate.
914 * layout.h (class Layout): Update declaration.
915
ea715a34
ILT
9162010-01-07 Ian Lance Taylor <iant@google.com>
917
918 * output.h (class Output_data): Add const version of
919 output_section and do_output_section.
920 (class Output_section_data): Add const version of
921 do_output_section.
922 (class Output_section): Likewise.
923 * layout.cc (Layout::add_target_dynamic_tags): New function.
924 * layout.h (class Layout): Update declarations.
925 * arm.cc (Target_arm::do_finalize_sections): Use
926 add_target_dynamic_tags.
927 * i386.cc (Target_i386::do_finalize_sections): Likewise.
928 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
929 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
930 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
931
659948a4
ILT
9322010-01-07 Ian Lance Taylor <iant@google.com>
933
934 PR 11042
935 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
936 object as needed.
937
9d3b86f6
ILT
9382010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
939 Ian Lance Taylor <iant@google.com>
940
941 PR 11019
942 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
943 Xindex::read_symtab_xindex.
944
bb0d3eb0
DK
9452010-01-07 Doug Kwan <dougkwan@google.com>
946
947 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
948 (Insn_template::thumb16_bcond_insn): New method declaration.
949 (Insn_template): Fix spelling.
950 (Stub::thumb16_special): New method declaration.
951 (Stub::do_write): Define virtual method which was previously pure
952 virtual.
953 (Stub::do_thumb16_special): New method declaration.
954 (Stub::do_fixed_endian_write): New template member.
955 (Reloc_stub::do_write): Remove.
956 (Reloc_stub::do_fixed_endian_write): Remove.
957 (Cortex_a8_stub): New class definition.
958 (Stub_factory::make_cortex_a8_stub): New method definition.
959 (Stub_factory::Stub_factory): Add missing static storage class
960 qualifier for elf32_arm_stub_a8_veneer_blx.
961
ffeef7df
ILT
9622010-01-07 Ian Lance Taylor <iant@google.com>
963
dc3f80fe
ILT
964 PR 10980
965 * options.h (class General_options): Add --warn-unresolved-symbols
966 and --error-unresolved-symbols.
967 * errors.cc (Errors::undefined_symbol): Implement
968 --warn-unresolved-symbols.
969
ffeef7df
ILT
970 * options.h (class General_options): Add -z text and -z textoff.
971 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
972
f1ec9ded
ST
9732010-01-06 Sriraman Tallam <tmsriram@google.com>
974
975 * gc.h (Garbage_collection::Cident_section_map): New typedef.
976 (Garbage_collection::cident_sections): New function.
977 (Garbage_collection::add_cident_section): New function.
978 (Garbage_collection::cident_sections_): New member.
979 (gc_process_relocs): Add references to sections whose names are C
980 identifiers.
981 * gold.h (cident_section_start_prefix): New constant.
982 (cident_section_stop_prefix): New constant.
983 (is_cident): New function.
984 * layout.cc (Layout::define_section_symbols): Replace string constants
985 with the newly defined constants.
986 * object.cc (Sized_relobj::do_layout): Track sections whose names are
987 C identifiers.
988 * testsuite/Makefile.am: Add gc_orphan_section_test.
989 * testsuite/Makefile.in: Regenerate.
990 * testsuite/gc_orphan_section_test.cc: New file.
991 * testsuite/gc_orphan_section_test.sh: New file.
992
6eda8c29
ILT
9932010-01-06 Ian Lance Taylor <iant@google.com>
994
b9674e17
ILT
995 PR 10980
996 * options.h (class General_options): Add --warn-shared-textrel.
997 * layout.cc (Layout::finish_dynamic_section): Implement
998 --warn-shared-textrel.
999
6eda8c29
ILT
1000 PR 10980
1001 * options.h (class General_options): Add --warn-multiple-gp.
1002
32dcd44e
ILT
10032010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1004
1005 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
1006 $(THREADSLIB) and $(LIBDL).
1007 * Makefile.in: Rebuild.
1008
a192ba05
ILT
10092010-01-06 Ian Lance Taylor <iant@google.com>
1010
1011 PR 10980
1012 * options.cc (General_options::parse_section_start): New function.
1013 (General_options::section_start): New function.
1014 (General_options::General_options): Initialize all members.
1015 * options.h: Include <map>
1016 (class General_options): Add --section-start. Add section_starts_
1017 member.
1018 * layout.cc (Layout::attach_allocated_section_to_segment): If
1019 --section-start was used, set the address of the segment. Remove
1020 local sort_sections.
1021 (Layout::relaxation_loop_body): If the address of the load segment
1022 has been set by --section-start, don't use it.
1023 * output.h (Output_segment::update_flags_for_output_section): New
1024 function.
1025 * output.cc (Output_segment::add_output_section): Call
1026 update_flags_for_output_section.
1027
dde3f402
ILT
10282010-01-05 Ian Lance Taylor <iant@google.com>
1029
62dfdd4d
ILT
1030 PR 10980
1031 * options.h (class General_options): Add --undefined-version.
1032 * script.cc (struct Version_expression): Add was_matched_by_symbol
1033 field.
1034 (Version_script_info::matched_symbol): New function.
1035 (Version_script_info::get_symbol_version_helper): Call
1036 matched_symbol.
1037 (Version_script_info::check_unmatched_names): New function.
1038 * script.h (class Version_script_info): Update declarations.
1039 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
1040
9c4ae156
ILT
1041 * options.h (class General_options): Use DEFINE_bool_alias for
1042 allow_multiple_definition.
1043 * resolve.cc (Symbol_table::should_override): Don't test
1044 allow_multiple_definition.
1045
dde3f402
ILT
1046 PR 10980
1047 * options.h (class General_options): Add --cref.
1048 * main.cc (main): Print cref table if --cref. Don't close mapfile
1049 until after printing cref table.
1050 * cref.cc: Include "symtab.h".
1051 (class Cref_inputs): Define Cref_table_compare and Cref_table.
1052 (Cref_table_compare::operator()): New function.
1053 (Cref_inputs::gather_cref): New function.
1054 (filecol): New static const.
1055 (Cref_inputs::print_cref): New function.
1056 (Cref::print_cref): New function.
1057 * cref.h: Include <cstdio>.
1058 (class Cref): Update declarations.
1059 * mapfile.h (Mapfile::file): New function.
1060 * object.h (class Object): Define Symbols. Declare virtual
1061 do_get_global_symbols.
1062 (Object::get_global_symbols): New function.
1063 * object.cc (Input_objects::add_object): Pass object to cref_ if
1064 --cref.
1065 (Input_objects::archive_start): Likewise.
1066 (Input_objects::archive_stop): Likewise.
1067 (Input_objects::print_cref): New function.
1068 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
1069 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
1070 --cref.
1071 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
1072 function.
1073 * plugin.h (class Sized_pluginobj): Update declarations.
1074
8781f709
ILT
10752010-01-05 Ian Lance Taylor <iant@google.com>
1076
1077 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
1078 to is_default_version. Rename insdef to insdefault.
1079 (Symbol_table::add_from_relobj): Rename def to is_default_version
1080 and local to is_forced_local.
1081 (Symbol_table::add_from_pluginobj): Likewise.
1082 (Symbol_table::add_from_dynobj): Likewise.
1083 (Symbol_table::define_special_symbol): Rename insdef to
1084 insdefault.
1085
fe35d28d
ILT
10862010-01-04 Ian Lance Taylor <iant@google.com>
1087
30bc8c46
ILT
1088 PR 10980
1089 * options.h (class General_options): Add
1090 --allow-multiple-definition and -z muldefs.
1091 * resolve.cc (Symbol_table::should_override): Don't warn about a
1092 multiple symbol definition if --allow-multiple-definition or -z
1093 muldefs.
1094
7eaea549
ILT
1095 PR 10980
1096 * options.h (class General_options): Add --add-needed and
1097 --copy-dt-needed-entries. Tweak --as-needed help entry.
1098 * object.cc (Input_objects::check_dynamic_dependencies): Give an
1099 error if --copy-dt-needed-entries aka --add-needed is used and
1100 would cause a change in behaviour.
1101
fe35d28d
ILT
1102 PR 10980
1103 * options.h (class General_options): Add -G as a short version of
1104 --shared. Add no-op options -assert, -g, and -i.
1105
55a2bb35
ST
11062010-01-04 Sriraman Tallam <tmsriram@google.com>
1107
1108 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
1109 check for .text or .gnu.linkonce.t sections.
1110 * icf.cc (Icf::find_identical_sections): Ditto.
1111 Change the detection for mangled function name within the section
1112 name.
1113 * icf.h (is_section_foldable_candidate): New function.
1114
719328e1
ILT
11152009-12-30 Ian Lance Taylor <iant@google.com>
1116
1117 PR 10980
1118 * options.h (class General_options): Permit two dashes with
1119 --retain-symbols-file.
1120
d7bb5745
ILT
11212009-12-30 Ian Lance Taylor <iant@google.com>
1122
403a15dd
ILT
1123 PR 10979
1124 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
1125 don't put the file header and segment headers in the text
1126 segment.
1127
eda294df
ILT
1128 PR 10979
1129 * common.cc (Sort_commons::operator()): Stabilize sort when both
1130 entries are NULL.
1131 (Symbol_table::do_allocate_commons_list): When allocating common
1132 symbols, skip a symbol which is no longer common.
1133 * symtab.h (Symbol::is_common): Test whether the symbol comes from
1134 an object before checking its type.
1135 * testsuite/common_test_2.c: New file.
1136 * testsuite/common_test_3.c: New file.
1137 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
1138 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
1139 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
1140 (common_test_2_pic.o, common_test_2.so): New targets.
1141 (common_test_3_pic.o, common_test_3.so): New targets.
1142 * testsuite/Makefile.in: Rebuild.
1143
d7bb5745
ILT
1144 PR 10979
1145 * script.cc (read_input_script): If we see a new SECTIONS clause,
1146 and we have added an input section, give an error.
1147 * layout.h (class Layout): Add have_added_input_section function.
1148 Add have_added_input_section_ field.
1149 * layout.cc (Layout::Layout): Initialize
1150 have_added_input_section_.
1151 (Layout::layout): Set have_added_input_section_.
1152 (Layout::layout_eh_frame): Likewise.
1153
fc59c572
ILT
11542009-12-30 Ian Lance Taylor <iant@google.com>
1155
1156 PR 10931
1157 * options.h (class General_options): Add --sort-common option.
1158 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
1159 * common.cc (Sort_common): Add sort_order parameter to
1160 constructor. Add sort_order_ field.
1161 (Sort_commons::operator): Check sort_order_.
1162 (Symbol_table::allocate_commons): Determine the sort order.
1163 (Symbol_table::do_allocate_commons): Add sort_order parameter.
1164 Change all callers.
1165 (Symbol_table::do_allocate_commons_list): Likewise.
1166
1c74fab0
ILT
11672009-12-30 Ian Lance Taylor <iant@google.com>
1168
1169 PR 10916
1170 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
1171 symbols from this object, don't change the visibility of an
1172 undefined symbol.
1173 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
1174
6affe781
ILT
11752009-12-30 Ian Lance Taylor <iant@google.com>
1176
1177 PR 10861
1178 * script.h (class Version_script_info): Define Language enum.
1179 Update declarations. Define Glob, Exact, and Lookup types. Add
1180 new fields globals_, locals_, and is_finalized_.
1181 * script.cc: Various formatting fixes.
1182 (class Parser_closure): Change language_stack_ from a vector of
1183 std::string to one of Version_script_info::Language. Adjust all
1184 uses accordingly.
1185 (class Lazy_demangler): Remove.
1186 (struct Version_expression): Change language from std::string to
1187 Version_script_info::Language.
1188 (Version_script_info::Version_script_info): New function.
1189 (Version_script_info::~Version_script_info): Don't call clear.
1190 (Version_script_info::finalize): New function.
1191 (Version_script_info::build_lookup_tables): New function.
1192 (Version_script_info::build_expression_list_lookup): New
1193 function.
1194 (Version_script_info::get_symbol_version_helper): Rewrite to use
1195 lookup tables.
1196 (Version_script_info::print_expression_list): Adjust to use
1197 Version_script_info::Language.
1198 (script_push_lex_into_version_mode): Check that the version script
1199 has not been finalized.
1200 (version_script_push_lang): Change language string to
1201 Version_script_info::Language.
1202 * options.cc (Command_line::version_script): New function.
1203 * options.h (class General_options): Add finalize_dynamic_list
1204 function. Change version_script from declaration to definition.
1205 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
1206 * testsuite/version_script.map: Remove duplicate def of foo.
1207 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
1208 version_script.map.
1209 * testsuite/Makefile.in: Rebuild.
1210
818bf354
ILT
12112009-12-30 Ian Lance Taylor <iant@google.com>
1212
1213 PR 10843
1214 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
1215 if the input symbol index is 0, make the output symbol index 0.
1216
ebcc8304
ILT
12172009-12-30 Ian Lance Taylor <iant@google.com>
1218
1219 PR 10670
1220 * options.h (class General_options): Add -x/--discard-all.
1221 * object.cc (Sized_relobj::do_count_local_symbols): Handle
1222 --discard-all. If the local symbol needs a dynamic entry, check
1223 that before handling --discard-locals.
1224
176fe33f
ILT
12252009-12-30 Ian Lance Taylor <iant@google.com>
1226
bb321bb1
ILT
1227 PR 10450
1228 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
1229 flags to PF_R.
1230 (Output_segment::add_output_section): Don't change the flags if
1231 the type is PT_TLS.
1232
176fe33f
ILT
1233 PR 10450
1234 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
1235 GNU hash table if they need a dynamic value. Otherwise, don't add
1236 them if they are defined in a dynamic object or are forced local.
1237
e8cd95c7
ILT
12382009-12-29 Ian Lance Taylor <iant@google.com>
1239
1b81fb71
ILT
1240 PR 10450
1241 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
1242 .gnu.hash table for a 32-bit target.
1243
8d6d383d
ILT
1244 PR 10450
1245 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
1246 regular and a dynamic object only needs a dynamic symbol table
1247 entry if it is externally visible.
1248
e785ec03
ILT
1249 PR 10450
1250 * i386.cc (class Target_i386): Initialize global_offset_table_ in
1251 constructor. Add global_offset_table_ field.
1252 (Target_i386::got_section): Set global_offset_table_.
1253 (Target_i386::do_finalize_sections): Set global_offset_table_
1254 size.
1255 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
1256 in constructor. Add global_offset_table_ field.
1257 (Target_x86_64::got_section): Set global_offset_table_.
1258 (Target_x86_64::do_finalize_sections): Set global_offset_table_
1259 size.
1260
1a2dff53
ILT
1261 * layout.cc (Layout::Layout): Initialize increase_relro_.
1262 (Layout::get_output_section): Add is_relro, is_last_relro, and
1263 is_first_non_relro parameters. Change all callers.
1264 (Layout::choose_output_section): Likewise.
1265 (Layout::add_output_section_data): Likewise.
1266 (Layout::make_output_section): Likewise.
1267 (Layout::set_segment_offsets): Clear increase_relro when using a
1268 linker script.
1269 * layout.h (class Layout): Add increase_relro method. Add
1270 increase_relro_ field. Update declarations.
1271 * output.cc (Output_section::Output_section): Initialize
1272 is_last_relro_ and is_first_non_relro_.
1273 (Output_segment::add_output_section): Group relro sections is
1274 do_sort is true. Handle is_last_relro and is_first_non_relro.
1275 (Output_segment::maximum_alignment): Remove relro handling.
1276 (Output_segment::set_section_addresses): Add increase_relro
1277 parameter. Change all callers. Add initial alignment to align
1278 relro sections on separate page. Remove old relro handling.
1279 (Output_segment::set_section_list_addresses): Remove in_relro
1280 parameter. Change all callers.
1281 (Output_segment::set_offset): Add increase parameter. Change all
1282 callers. Remove old relro handling.
1283 * output.h (class Output_section): Add new methods: is_last_relro,
1284 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
1285 Add is_last_relro_ and is_first_non_relro_ fields.
1286 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
1287 Create separate .got.plt section. Call increase_relro.
1288 * x86_64.cc (Target_x86_64::got_section): Likewise.
1289 * testsuite/relro_script_test.t: Add .got.plt.
1290
f0ba79e2
ILT
1291 PR 10450
1292 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
1293 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
1294 (Layout::finalize): Call set_dynamic_symbol_size.
1295 (Layout::set_dynamic_symbol_size): New function.
1296 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
1297 set_dynamic_symbol_size.
1298
e8cd95c7
ILT
1299 PR 10450
1300 * output.h (class Output_section): Add is_entsize_zero_ field.
1301 * output.cc (Output_section::Output_section): Initialize
1302 is_entsize_zero_.
1303 (Output_section::set_entsize): If two different entsizes are
1304 requested, force it to zero.
1305 (Output_section::add_input_section): Set flags for .debug_str
1306 before updating section flags. Set entsize.
1307 (Output_section::update_flags_for_input_section): Set SHF_MERGE
1308 and SHF_STRING if all input sections have those flags.
1309
3e1b9a8a
RÁE
13102009-12-29 Rafael Espindola <espindola@google.com>
1311
1312 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
1313 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
1314 reporting.
3e1b9a8a 1315
3dcad376
ST
13162009-12-29 Sriraman Tallam <tmsriram@google.com>
1317
1318 * options.cc (General_options::parse_version): Allow -v to exit
1319 without an error if there is nothing to link.
1320
084e2665
ILT
13212009-12-29 Ian Lance Taylor <iant@google.com>
1322
1323 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
1324 using a version of gcc before 4.1.
1325 * configure: Rebuild.
1326
250acde3
CD
13272009-12-28 Chris Demetriou <cgd@google.com>
1328
1329 * attributes.cc (Output_attributes_section_data::do_write): Use
1330 std::vector::front rather than std::vector::data.
1331
99fff23b
ILT
13322009-12-28 Ian Lance Taylor <iant@google.com>
1333
1334 * symtab.h (class Symbol_table): Add enum Defined.
1335 * resolve.cc (Symbol_table::should_override): Add defined
1336 parameter. Change all callers. Test whether object is NULL
1337 before calling a method on it.
1338 (Symbol_table::report_resolve_problem): Add defined parameter.
1339 Change all callers.
1340 (Symbol_table::should_override_with_special): Likewise.
1341 * symtab.cc (Symbol_table::define_in_output_data): Add defined
1342 parameter. Change all callers.
1343 (Symbol_table::do_define_in_output_data): Likewise.
1344 (Symbol_table::define_in_output_segment): Likewise.
1345 (Symbol_table::do_define_in_output_segment): Likewise.
1346 (Symbol_table::define_as_constant): Likewise.
1347 (Symbol_table::do_define_as_constant): Likewise.
1348 * script.h (class Symbol_assignment): Add is_defsym parameter to
1349 constructor; change all callers.
1350 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
1351 parameter. Change all callers. Add is_defsym_ field.
1352 (class Parser_closure): Add parsing_defsym parameter to
1353 constructor; change all callers. Add parsing_defsym accessor
1354 function. Add parsing_defsym_ field.
1355
556bd683
ILT
13562009-12-28 Ian Lance Taylor <iant@google.com>
1357
1358 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 1359 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 1360
1782c879
ILT
13612009-12-23 Ian Lance Taylor <iant@google.com>
1362
1363 * i386.cc (Target_i386::do_calls_non_split): Recognize
1364 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
1365 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
1366 -fsplit-stack prologue when using %r11.
1782c879 1367
329ca2b1
ST
13682009-12-21 Sriraman Tallam <tmsriram@google.com>
1369
1370 * options.cc (General_options::parse_version): Make -v continue and do
1371 the link like GNU ld does.
1372
d675ff46
RÁE
13732009-12-17 Rafael Avila de Espindola <espindola@google.com>
1374
1375 * Makefile.am (CCFILES): Add timer.cc.
1376 (HFILES): Add timer.h.
1377 * configure.ac: Check for sysconf and times.
1378 * main.cc: include timer.h.
1379 (main): Use Timer instead of get_run_time.
1380 * timer.cc: New.
1381 * timer.h: New.
1382 * workqueue.cc: include timer.h.
1383 (Workqueue::find_and_run_task):
1384 Report user, sys and wall time.
1385 * Makefile.in: Regenerate.
1386 * config.in: Regenerate.
1387 * configure: Regenerate.
1388
d6344fb5
DK
13892009-12-16 Doug Kwan <dougkwan@google.com>
1390
1391 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
1392 sections.
1393 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
1394 relaxed input sections.
1395 * output.cc (Output_section::find_relaxed_input_section): Change
1396 return type to Output_relaxed_input_section pointer. Adjust code
1397 for new type of relaxed_input_section_map_.
1398 * output.h (Output_section::find_relaxed_input_section): Change
1399 return type to Output_relaxed_input_section pointer.
1400 (Output_section::Output_relaxed_input_section_by_input_section_map):
1401 New type.
1402 (Output_section::relaxed_input_section_map_): Change type to
1403 Output_section::Output_relaxed_input_section_by_input_section_map.
1404 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
1405 input section.
1406
0e0d5469
ILT
14072009-12-15 Ian Lance Taylor <iant@google.com>
1408
1409 * layout.cc (Layout::create_shstrtab): Only write out after input
1410 sections if we are compressing debug sections.
1411
0649a889
ILT
14122009-12-15 Ian Lance Taylor <iant@google.com>
1413
1414 * archive.cc (Archive::add_symbols): Only look up a symbol without
1415 a version if there is, in fact, a version.
1416
2ea97941
ILT
14172009-12-14 Ian Lance Taylor <iant@google.com>
1418
1419 Revert -Wshadow changes, all changes from:
1420 2009-12-11 Doug Kwan <dougkwan@google.com>
1421 2009-12-11 Nick Clifton <nickc@redhat.com>
1422 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
1423
b0eec2cc
DK
14242009-12-11 Doug Kwan <dougkwan@google.com>
1425
1426 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
1427 due to -Wshadow.
1428 * attributes.cc (Object_attribute::size): Ditto.
1429 (Attributes_section_data::size): Ditto.
1430 (Attributes_section_data::Attributes_section_data): Ditto.
1431 (Output_attributes_section_data::do_write): Ditto.
1432 * attributes.h (Object_attribute::set_type): Ditto.
1433 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
1434
91d6fa6a
NC
14352009-12-11 Nick Clifton <nickc@redhat.com>
1436
1437 * archive.cc: Fix shadowed variable warnings.
1438 * arm.cc: Likewise.
1439 * compressed_output.cc: Likewise.
1440 * compressed_output.h: Likewise.
1441 * configure: Likewise.
1442 * dwarf_reader.cc: Likewise.
1443 * dynobj.cc: Likewise.
1444 * dynobj.h: Likewise.
1445 * ehframe.cc: Likewise.
1446 * ehframe.h: Likewise.
1447 * errors.cc: Likewise.
1448 * expression.cc: Likewise.
1449 * fileread.cc: Likewise.
1450 * fileread.h: Likewise.
1451 * freebsd.h: Likewise.
1452 * i386.cc: Likewise.
1453 * icf.cc: Likewise.
1454 * incremental.h: Likewise.
1455 * layout.cc: Likewise.
1456 * layout.h: Likewise.
1457 * mapfile.cc: Likewise.
1458 * merge.cc: Likewise.
1459 * merge.h: Likewise.
1460 * object.cc: Likewise.
1461 * object.h: Likewise.
1462 * options.h: Likewise.
1463 * output.cc: Likewise.
1464 * output.h: Likewise.
1465 * parameters.cc: Likewise.
1466 * plugin.cc: Likewise.
1467 * powerpc.cc: Likewise.
1468 * reduced_debug_output.cc: Likewise.
1469 * reduced_debug_output.h: Likewise.
1470 * reloc.cc: Likewise.
1471 * reloc.h: Likewise.
1472 * resolve.cc: Likewise.
1473 * script-sections.cc: Likewise.
1474 * script.cc: Likewise.
1475 * script.h: Likewise.
1476 * sparc.cc: Likewise.
1477 * symtab.cc: Likewise.
1478 * symtab.h: Likewise.
1479 * target-select.cc: Likewise.
1480 * target-select.h: Likewise.
1481 * token.h: Likewise.
1482 * workqueue.cc: Likewise.
1483 * workqueue.h: Likewise.
1484 * x86_64.cc: Likewise.
1485
a0351a69
DK
14862009-12-10 Doug Kwan <dougkwan@google.com>
1487
1488 * arm.cc (attributes.h): New include.
1489 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
1490 (Arm_relobj::~Arm_relobj): Delete object pointed by
1491 attributes_section_data_.
1492 (Arm_relobj::attributes_section_data): New method definition.
1493 (Arm_relobj::attributes_section_data_): New data member declaration.
1494 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
1495 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
1496 attributes_section_data_.
1497 (Arm_dynobj::attributes_section_data): New method definition.
1498 (Arm_dynobj::attributes_section_data_): New data member declaration.
1499 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
1500 initialization value of may_use_blx_ to false.
1501 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
1502 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
1503 object attributes to compute results instead of hard-coding.
1504 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
1505 Target_arm::get_secondary_compatible_arch,
1506 Target_arm::set_secondary_compatible_arch
1507 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1508 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
1509 New method declarations.
1510 (Target_arm::get_aeabi_object_attribute): New method definition.
1511 (Target_arm::attributes_section_data_): New data member declaration.
1512 (read_arm_attributes_section): New template definition.
1513 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
1514 (Arm_dynobj::do_read_symbols): Ditto.
1515 (Target_arm::do_finalize_sections): Merge attributes sections from
1516 input. Check for BLX use after attributes section merging.
1517 Fix __exidx_start and __exidx_end visibility. Create an
1518 .ARM.attributes section if necessary.
1519 (Target_arm::get_secondary_compatible_arch,
1520 Target_arm::set_secondary_compatible_arch,
1521 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1522 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
1523 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
1524 New method definitions.
1525
b59befec
ILT
15262009-12-09 Ian Lance Taylor <iant@google.com>
1527
1528 * plugin.cc (Plugin::load): Don't cast from void* to a function
1529 pointer.
1530
1276bc89
ILT
15312009-12-09 Ian Lance Taylor <iant@google.com>
1532
1533 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
1534 information fields.
1535
2f2de248
L
15362009-12-09 H.J. Lu <hongjiu.lu@intel.com>
1537
1538 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
1539 Replace two_file_shared_1.so with two_file_shared_2.so.
1540 * testsuite/Makefile.in: Regenerated.
1541
4f787271
DK
15422009-12-08 Doug Kwan <dougkwan@google.com>
1543
1544 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
1545 (HFILES): Add attributes.h and int_encoding.h.
1546 * Makefile.in: Regenerate.
1547 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
1548 function definitions to int_encoding.cc
1549 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
1550 prototypes to int_encoding.h
1551 * reduced_debug_output.cc (int_encoding.h): New include.
1552 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
1553 function definitions to int_encoding.cc
1554 (insert_into_vector, read_from_pointer): Move template definitions to
1555 int_encoding.h
1556 * attributes.cc: New file.
1557 * attributes.h: New file.
1558 * int_encoding.cc: New file.
1559 * int_encoding.h: New file.
1560
20b52f1a
RÁE
15612009-12-07 Rafael Avila de Espindola <espindola@google.com>
1562
1563 PR gold/11055
1564 * incremental-dump.cc (dump_incremental_inputs): New.
1565 (main): Use dump_incremental_inputs.
1566
53d7974c
L
15672009-12-07 H.J. Lu <hongjiu.lu@intel.com>
1568
1569 PR gold/10893
1570 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
1571 checking elfcpp::STT_FUNC.
1572 (Target_i386::Relocate::relocate): Likewise.
1573 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1574
1575 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
1576 symbols from shared libraries into normal FUNC symbols.
1577
1578 * symtab.h (Symbol): Add is_func and use it.
1579
05a352e6
DK
15802009-12-05 Doug Kwan <dougkwan@google.com>
1581
1582 * arm.cc (Target_arm::arm_info): Initialize new fields
1583 attributes_section and attributes_vendor.
1584 * i386.cc (Target_i386::i386_info): Same.
1585 * object.cc (Sized_relobj::do_layout): Skip attribute section.
1586 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
1587 fields attributes_section and attributes_vendor.
53d7974c 1588 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
1589 * target.h (Target::attributes_section, Target::attributes_vendor,
1590 Target::is_attributes_section, Target::attribute_arg_type,
1591 Target::attributes_order): New method definitions.
1592 (Target::Target_info::attributes_section,
1593 Target::Target_info::attributes_vendor): New fields.
1594 (Target::do_attribute_arg_type, Target::do_attributes_order): New
1595 virtual method definitions.
1596 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
1597 attributes_section and attributes_vendor.
1598 * testsuite/testfile.cc (Target_test::test_target_info): Same.
1599
f4e5969c
DK
16002009-12-05 Doug Kwan <dougkwan@google.com>
1601
1602 * arm.cc: Update comments about interworking and stub generation.
1603 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
1604 considered as non-PIC.
1605 (Arm_relocate_functions::base_abs): Fix formatting.
1606 (Arm_relocate_functions::got_prel): Fix comment. Change interface
1607 of function to use GOT entry address instead of offset.
1608 (Target_arm::Scan::global): Issue an error if a symbol would need a
1609 PLT does not get one because it is untyped. Remove code to create
1610 dynamic symbols for relative branches.
1611 (Target_arm::Relocate::relocate: Use 0 instead of false since function
1612 takes unsigned integer instead of boolean.
1613
1abce4a6
L
16142009-12-05 H.J. Lu <hongjiu.lu@intel.com>
1615
1616 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1617 (two_file_test_LDADD): Likewise.
1618 (common_test_1_LDADD): Likewise.
1619 (exception_test_LDADD) Likewise.
1620 (weak_test_LDADD): Likewise.
1621 (many_sections_test_LDADD): Likewise.
1622 (initpri1_LDADD): Likewise.
1623 (script_test_1_LDADD): Likewise.
1624 (script_test_2_LDADD): Likewise.
1625 (justsyms_LDADD): Likewise.
1626 (binary_test_LDADD): Likewise.
1627 (large_LDADD): Likewise.
1628 * testsuite/Makefile.in: Regenerated.
1629
adcf2816 16302009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 1631
adcf2816
L
1632 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1633 (Symbol_table::override_with_special): Likewise.
1634 (Symbol_table::add_from_object): Likewise.
1635
28e67f5d
RÁE
16362009-12-04 Rafael Avila de Espindola <espindola@google.com>
1637
1638 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1639 Don't set the data_offset twice.
1640
ae10a101
RÁE
16412009-12-04 Rafael Avila de Espindola <espindola@google.com>
1642
1643 * testsuite/Makefile.in: Regenerate.
1644
f59f41f3
DK
16452009-12-03 Doug Kwan <dougkwan@google.com>
1646
1647 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1648 (Target_arm::do_finalize_sections): Add parameter for symbol table
1649 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
1650 * i386.cc (Target_i386::do_finalize_sections): Add an additional
1651 parameter for symbol table pointer.
1652 * layout.cc (Layout::finalize): Call Target::finalize_sections with
1653 an additional parameter for a pointer to symbol table.
1654 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1655 parameter for a symbol table pointer.
1656 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
1657 * target.h (Target::finalize_sections, Target::do_finalize_sections):
1658 Ditto.
1659 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
1660 parameter for a symbol table pointer.
1661
ca55d848
RÁE
16622009-12-03 Rafael Avila de Espindola <espindola@google.com>
1663
1664 * incremental.cc (Incremental_inputs_header)
1665 (Incremental_inputs_header_write, Incremental_inputs_entry)
1666 (Incremental_inputs_entry_write): Move ...
1667 * incremental.h (Incremental_inputs_header)
1668 (Incremental_inputs_header_write, Incremental_inputs_entry)
1669 (Incremental_inputs_entry_write): here.
1670
3aec4f9c
RÁE
16712009-12-02 Rafael Avila de Espindola <espindola@google.com>
1672
1673 * incremental.cc (make_sized_incremental_binary): Set the target.
1674 Error if it is incompatible.
1675 * output.h (Output_file): Add filename method.
1676
9c0ae74d
RÁE
16772009-12-02 Rafael Avila de Espindola <espindola@google.com>
1678
1679 * incremental.cc (Incremental_inputs_entry): Remove unused argument
1680 from the get_* methods.
1681
a45500ae
RÁE
16822009-12-02 Rafael Avila de Espindola <espindola@google.com>
1683
1684 * incremental-dump.cc (main): Check that the offeset of a script is 0.
1685 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1686 Write 0 for the data_offset of scripts.
1687
325e6408
RÁE
16882009-12-02 Rafael Avila de Espindola <espindola@google.com>
1689
1690 * testsuite/Makefile.am: Add the incremental_test.sh test.
1691 * testsuite/incremental_test.sh: New.
1692 * testsuite/incremental_test_1.c: New.
1693 * testsuite/incremental_test_2.c: New.
1694
954c3e2e
RÁE
16952009-12-01 Rafael Avila de Espindola <espindola@google.com>
1696
1697 * incremental-dump.cc (main): Fix typos.
1698
f8086623
RÁE
16992009-11-27 Rafael Avila de Espindola <espindola@google.com>
1700
1701 PR gold/11025
1702 * incremental-dump.cc (main): Use llu to print 64 bit values.
1703
3b0dd6ac
L
17042009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
1705 H.J. Lu <hongjiu.lu@intel.com>
1706
1707 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
1708 $(LIBDL).
1709 (incremental_dump_LDADD): Likewise.
1710 * Makefile.in: Regenerated.
1711
a6d1ef57
DK
17122009-11-25 Doug Kwan <dougkwan@google.com>
1713
1714 Revert:
1715
1716 2009-11-25 Doug Kwan <dougkwan@google.com>
1717
1718 * arm.cc (Target_arm::Target_arm): Move method definition
1719 outside of class definition. Add code to handle
1720 --target1-rel, --target1-abs and --target2= options.
1721 (Target_arm::get_reloc_reloc_type): Change method to be
1722 non-static and const.
1723 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
1724 New data member declaration.
1725 (Target_arm::Scan::local, Target_arm::Scan::global,
1726 Target_arm::Relocate::relocate,
1727 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1728 Adjust call to Target_arm::get_real_reloc_type.
1729 (Target_arm::get_real_reloc_type): Use command line options
1730 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1731 * options.h (--target1-rel, --target1-abs, --target2): New
1732 ARM-only options.
1733
50aeb7d4
DK
17342009-11-25 Doug Kwan <dougkwan@google.com>
1735
1736 * arm.cc (Target_arm::Target_arm): Move method definition outside of
1737 class definition. Add code to handle --target1-rel, --target1-abs
1738 and --target2= options.
1739 (Target_arm::get_reloc_reloc_type): Change method to be non-static
1740 and const.
1741 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
1742 member declaration.
1743 (Target_arm::Scan::local, Target_arm::Scan::global,
1744 Target_arm::Relocate::relocate,
1745 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
1746 call to Target_arm::get_real_reloc_type.
1747 (Target_arm::get_real_reloc_type): Use command line options to
1748 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1749 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
1750 options.
1751
51938283
DK
17522009-11-25 Doug Kwan <dougkwan@google.com>
1753
1754 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
1755 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
1756 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
1757 formatting.
1758 (Arm_relocate_functions::thm_call): Replace body with a call to
1759 Arm_relocate_functions::thumb_branch_common.
1760 (Arm_relocate_functions::thm_jump24,
1761 Arm_relocate_functions::thm_xpc22): New method definitions.
1762 (Arm_relocate_functions::thumb_branch_common): New method definition.
1763 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
1764 operator.
1765 (Target_arm::Relocate::relocate): Adjust call to thm_call.
1766 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
1767
e2b8f3c4
RÁE
17682009-11-24 Rafael Avila de Espindola <espindola@google.com>
1769
1770 * Makefile.am: Build incremental-dump
1771 * Makefile.in: Regenerate.
1772 * incremental-dump.cc: New.
1773 * incremental.cc (Incremental_inputs_header_data,
1774 Incremental_inputs_entry_data): Move to incremental.h
1775 * incremental.h: (Incremental_inputs_header_data,
1776 Incremental_inputs_entry_data): Move from incremental.cc
1777
bcba9aec
RÁE
17782009-11-24 Rafael Avila de Espindola <espindola@google.com>
1779
1780 * incremental.cc (Incremental_inputs_header,
1781 Incremental_inputs_header_write, Incremental_inputs_entry,
1782 Incremental_inputs_entry_write): Add a typedef with the data type.
1783
7c3afe08
RÁE
17842009-11-24 Rafael Avila de Espindola <espindola@google.com>
1785
1786 * incremental.cc (Incremental_inputs_header,
1787 Incremental_inputs_header_write, Incremental_inputs_entry,
1788 Incremental_inputs_entry_write): Update comment about which
1789 type has the filed descriptions.
1790
d204b6e9
DK
17912009-11-15 Doug Kwan <dougkwan@google.com>
1792
1793 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
1794 (Arm_relocate_functions::arm_branch_common): Change method defintion
1795 in class definition to a method declaration and update list of formal
1796 parameters.
1797 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
1798 Arm_relocation_functions::jump24): Adjust call to
1799 Arm_relocate_functions::arm_branch_common. Update list of formal
1800 parameters.
1801 (Arm_relocate_functions::xpc25): New method definition.
1802 (Arm_relocate_functions::arm_branch_common): Move method defintion
1803 out from class definition. Use stubs for mode-switching and extending
1804 branch ranges.
1805 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
1806 specially. Change code to enable use of stubs in ARM branches.
1807
43d12afe
DK
18082009-11-10 Doug Kwan <dougkwan@google.com>
1809
1810 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
1811 in method declaration.
1812 (Target_arm::relocate_stub): New method declaration.
1813 (Target_arm::default_target): Change to return a pointer instead of
1814 a const reference.
1815 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
1816 Target_arm::default_target.
1817 (Arm_Relobj::do_relocate_sections): Remove options paramater in
1818 method definition.
1819 (Target_arm::relocate_section): Adjust view.
1820 (Target_arm::relocate_stub): New method definition.
1821
ac33a407
DK
18222009-11-10 Doug Kwan <dougkwan@google.com>
1823
1824 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1825 a format warning.
1826 * incremental.cc (open_incremental_binary): Initialized local
1827 variables to avoid warnings.
1828 * object.cc (make_elf_object): Ditto.
1829 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1830 a format warning.
1831
88ee28e9
L
1832009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1833
1834 PR gold/10930
1835 * testsuite/plugin_test.c: Include "config.h".
1836
2daedcd6
DK
18372009-11-09 Doug Kwan <dougkwan@google.com>
1838
1839 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1840 (arm_symbol_value): Remove.
1841 (Arm_relocate_functions::arm_branch_common,
1842 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1843 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1844 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1845 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1846 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1847 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1848 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1849 Arm_relocate_functions::thm_mobw_abs_nc,
1850 Arm_relocate_functions::thm_mov_abs,
1851 Arm_relocate_functions::movw_prel_nc,
1852 Arm_relocate_functions::thm_movt_abs,
1853 Arm_relocate_functions::movt_prel,
1854 Arm_relocate_functions::thm_movw_prel_nc,
1855 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1856 (Target_arm::Relocate::relocate): Only decompose address into two
1857 parts if relocation type uses the thumb-bit and pass the actual
1858 bit instead of a flag indicating that the thumb-bit is used. Adjust
1859 calls to methods in Arm_relocate_functions for this change.
1860
1276bc89 18612009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
1862
1863 PR 10925
1864 * reloc.cc: Instantiate
1865 Sized_relobj::initialize_input_to_output_maps and
1866 Sized_relobj:free_input_to_output_maps.
1867
e53ad1b5
ILT
18682009-11-06 Ian Lance Taylor <iant@google.com>
1869
1870 PR 10876
1871 * defstd.cc (in_segment): Set only_if_ref true for "end".
1872
eb44217c
DK
18732009-11-06 Doug Kwan <dougkwan@google.com>
1874
1875 * arm.cc (class Reloc_stub): Correct a comment.
1876 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1877 (Target_arm::scan_section_for_stubs): New method declaration.
1878 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1879 Change methods from private to protected.
1880 (Target_arm::do_may_relax): New method definition.
1881 (Target_arm::do_relax, Target_arm::group_sections,
1882 Target_arm::scan_reloc_for_stub,
1883 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1884 (Target_arm::arm_input_section_map_): New data member declaration.
1885 (Target_arm::scan_reloc_for_stub,
1886 Target_arm::scan_reloc_section_for_stubs,
1887 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1888 Target_arm::do_relax): New method definitions.
1889
5d329b7d
ILT
18902009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1891
1892 * configure.ac: Check for (struct stat)::st_mtim
1893 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1894 * config.in: Regenerate.
1895 * configure: Regenerate.
1896
96a0d71b
ILT
18972009-11-05 Ian Lance Taylor <iant@google.com>
1898
1899 PR 10910
1900 * output.cc (Output_segment::add_output_section): Add missing
1901 return statement.
1902
594c8e5e
ILT
19032009-11-04 Ian Lance Taylor <iant@google.com>
1904
1905 PR 10880
1906 * object.h (class Object): Add is_needed and set_is_needed
1907 methods. Add is_needed_ field. Make bool fields into bitfields.
1908 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1909 defined in a dynamic object and referenced by a regular object,
1910 set is_needed for the dynamic object.
1911 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1912 if the file is marked with as_needed and it is not needed.
1913
22b127cc
ILT
19142009-11-04 Ian Lance Taylor <iant@google.com>
1915
1916 PR 10887
1917 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1918 tags if data is discarded by linker script.
1919 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1920 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1921 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1922 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1923
f5c870d2
ILT
19242009-11-04 Ian Lance Taylor <iant@google.com>
1925
1926 * layout.cc (Layout::get_output_section): Add is_interp and
1927 is_dynamic_linker_section parameters. Change all callers.
1928 (Layout::choose_output_section): Likewise.
1929 (Layout::make_output_section): Likewise.
1930 (Layout::add_output_section_data): Add is_dynamic_linker_section
1931 parameter. Change all callers.
1932 * layout.h (class Layout): Update declarations.
1933 * output.h (class Output_section): Add is_interp, set_is_interp,
1934 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1935 Add is_interp_, is_dynamic_linker_section_ fields. Change
1936 generate_code_fills_at_write_ to a bitfield.
1937 * output.cc (Output_section::Output_sections): Initialize new
1938 fields.
1939 (Output_segment::add_output_section): Add do_sort parameter.
1940 Change all callers.
1941
1ae4d23b
ILT
19422009-11-03 Ian Lance Taylor <iant@google.com>
1943
1944 PR 10860
1945 * options.h (class General_options): Add --warn-common.
1946 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1947 merging two common symbols.
1948 (Symbol_table::should_override): Handle --warn-common when merging
1949 a common symbol with a defined symbol. Use report_resolve_problem
1950 for multiple definitions.
1951 (Symbol_table::report_resolve_problem): New function.
1952 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1953
55da9579
DK
19542009-11-03 Doug Kwan <dougkwan@google.com>
1955
1956 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1957 stub_factory_.
1958 (Target_arm::stub_factory): New method definition.
1959 (Target_arm::new_arm_input_section,
1960 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1961 Target_arm::reloc_uses_thumb_bit): New method declarations.
1962 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1963 New type definitions.
1964 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1965 member declarations.
1966 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1967 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1968 New method definitions.
1969
37a9ac43
ILT
19702009-11-03 Ian Lance Taylor <iant@google.com>
1971
1972 * options.h (class General_options): Add --warn_constructors.
1973
b3d6a3d4
ILT
19742009-11-03 Ian Lance Taylor <iant@google.com>
1975
1976 PR 10893
1977 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1978 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1979
934b01dd
ILT
19802009-11-03 Ian Lance Taylor <iant@google.com>
1981
1982 PR 10895
1983 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1984 --msgid-bugs-address.
1985 (install-pdf): New target.
1986 (install-data_yes): Look up one directory to find mkinstalldirs.
1987
03c1939b
L
19882009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1989
1990 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1991 tree.
1992
ebd95253
DK
19932009-10-30 Doug Kwan <dougkwan@google.com>
1994
1995 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1996
e9bbb538
DK
19972009-10-30 Doug Kwan <dougkwan@google.com>
1998
1999 * arm.cc (Stub_addend_reader): New struct template definition
2000 and partial specializations.
2001 (Stub_addend_reader::operator()): New method definition for a
2002 partially specialized template.
2003
d5b40221
DK
20042009-10-30 Doug Kwan <dougkwan@google.com>
2005
2006 * arm.cc (Arm_relobj::processor_specific_flags): New method
2007 definition.
2008 (Arm_relobj::do_read_symbols): New method declaration.
2009 (Arm_relobj::processor_specific_flags_): New data member declaration.
2010 (Arm_dynobj): New class definition.
2011 (Target_arm::do_finalize_sections): Add input_objects parameter.
2012 (Target_arm::do_adjust_elf_header): New method declaration.
2013 (Target_arm::are_eabi_versions_compatible,
2014 (Target_arm::merge_processor_specific_flags): New method declaration.
2015 (Target_arm::do_make_elf_object): New overloaded method definitions
2016 and declaration.
2017 (Arm_relobj::do_read_symbols): New method definition.
2018 (Arm_dynobj::do_read_symbols): Ditto.
2019 (Target_arm::do_finalize_sections): Add input_objects parameters.
2020 Merge processor-specific flags from all input objects.
2021 (Target_arm::are_eabi_versions_compatible,
2022 Target_arm::merge_processor_specific_flags,
2023 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
2024 New method definitions.
2025 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
2026 Input_objects pointer type parameter.
2027 * layout.cc (Layout::finalize): Pass input objects to target's.
2028 finalize_sections function.
2029 * output.cc (Output_file_header::do_sized_write): Set ELF file
2030 header's processor-specific flags.
2031 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
2032 Input_objects pointer type parameter.
2033 * sparc.cc (Target_sparc::do_finalize_sections): Same.
2034 * target.h (Input_objects): New forward class declaration.
2035 (Target::processor_specific_flags,
2036 Target::are_processor_specific_flags_sect): New method definitions.
2037 (Target::finalize_sections): Add input_objects parameter.
2038 (Target::Target): Initialize processor_specific_flags_ and
2039 are_processor_specific_flags_set_.
2040 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
2041 parameter.
2042 (Target::set_processor_specific_flags): New method definition.
2043 (Target::processor_specific_flags_,
2044 Target::are_processor_specific_flags_set_): New data member
2045 declarations.
2046 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
2047 Input_objects pointer type parameter.
2048
ebabffbd
DK
20492009-10-30 Doug Kwan <dougkwan@google.com>
2050
2051 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
2052
ad0f2072
ILT
20532009-10-28 Ian Lance Taylor <iant@google.com>
2054
2055 * object.h (class Relobj): Drop options parameter from
2056 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
2057 do_scan_relocs, do_relocate. Change all callers.
2058 (class Sized_relobj): Drop options parameters from
2059 do_gc_process_relocs, do_scan_relocs, do_relocate,
2060 do_relocate_sections, relocate_sections, emit_relocs_scan,
2061 emit_relocs_scan_reltype. Change all callers.
2062 (struct Relocate_info): Remove options field and all references to
2063 it.
2064 * reloc.h (class Read_relocs): Remove options constructor
2065 parameter and options_ field. Change all callers.
2066 (class Gc_process_relocs, class Scan_relocs): Likewise.
2067 (class Relocate_task): Likewise.
2068 * target-reloc.h (scan_relocs): Remove options parameter. Change
2069 all callers.
2070 (scan_relocatable_relocs): Likewise.
2071 * target.h (class Sized_target): Remove options parameter from
2072 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
2073 all callers.
2074 * gc.h (gc_process_relocs): Remove options parameter. Change all
2075 callers.
2076 * arm.cc: Update functions to remove options parameters.
2077 * i386.cc: Likewise.
2078 * powerpc.cc: Likewise.
2079 * sparc.cc: Likewise.
2080 * x86_64.cc: Likewise.
2081 * testsuite/testfile.cc: Likewise.
2082
8ffa3667
DK
20832009-10-28 Doug Kwan <dougkwan@google.com>
2084
2085 * arm.cc (Arm_relobj): New class definition.
2086 (Arm_relobj::scan_sections_for_stubs,
2087 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
2088 New method definitions.
2089
40f36857
CC
20902009-10-28 Cary Coutant <ccoutant@google.com>
2091
2092 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
2093 (Plugin::cleanup_done_): New member.
2094 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
2095 (Plugin_manager::cleanup_done_): Remove.
2096 (Plugin_manager::add_input_file): Edit error message.
2097 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
2098 (Plugin_manager::cleanup): Remove use of cleanup_done_.
2099
2c849493
ILT
21002009-10-27 Mikolaj Zalewski <mikolajz@google.com>
2101
2102 * fileread.cc: (File_read::View::~View): Use the new
2103 data_ownership_ filed.
2104 (File_read::~File_read): Dispose the new whole_file_view_.
2105 (File_read::open): Mmap the whole file if needed.
2106 (File_read::open): Use whole_file_view_ instead of contents_.
2107 (File_read::find_view): Use whole_file_view_ if applicable.
2108 (File_read::do_read): Use whole_file_view_ instead of contents_.
2109 (File_read::make_view): Use whole_file_view_ instead of contents_,
2110 update File_read::View::View call.
2111 (File_read::find_or_make_view): Update File_read::View::View
2112 call.
2113 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
2114 remove contents_
2115 (File_read::View::Data_ownership): New enum.
2116 (File_read::View::View): Replace bool mapped_ with Data_ownership
2117 argument.
2118 (File_read::View::mapped_): Remove (replaced by data_ownership_).
2119 (File_read::View::data_ownership_): New field.
2120 (File_read::contents_): Remove (replaced by whole_file_view_).
2121 (File_read::whole_file_view_): New field.
2122 * options.h (class General_options): Add --keep-files-mapped.
2123
24998053
CC
21242009-10-27 Cary Coutant <ccoutant@google.com>
2125
2126 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
2127 * testsuite/Makefile.am (plugin_test_5): New test case.
2128 * testsuite/Makefile.in: Regenerate.
2129
72adc4fa
DK
21302009-10-25 Doug Kwan <dougkwan@google.com>
2131
2132 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
2133 from private to protected to allow access by child class.
2134 (Sized_relobj::do_relocate_sections): New method declaration.
2135 (Sized_relobj::relocate_sections): Virtualize.
2136 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
2137 Sized_relobj::relocate_sections. Instantiate template explicitly
2138 for different target sizes and endianity.
2139
07f508a2
DK
21402009-10-24 Doug Kwan <dougkwan@google.com>
2141
2142 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
2143 (Arm_input_section::as_arm_input_section): New method.
2144 (Arm_output_section): New class definition.
2145 (Arm_output_section::create_stub_group,
2146 Arm_output_section::group_sections): New method definitions.
2147
10ad9fe5
DK
21482009-10-22 Doug Kwan <dougkwan@google.com>
2149
2150 * arm.cc (Arm_input_section): New class definition.
2151 (Arm_input_section::init, Arm_input_section:do_write,
2152 Arm_input_section::set_final_data_size,
2153 Arm_input_section::do_reset_address_and_file_offset): New method
2154 definitions.
2155
56ee5e00
DK
21562009-10-21 Doug Kwan <dougkwan@google.com>
2157
2158 * arm.cc (Stub_table, Arm_input_section): New forward class
2159 declarations.
2160 (Stub_table): New class defintion.
2161 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
2162 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
2163 New method definition.
2164
b569affa
DK
21652009-10-21 Doug Kwan <dougkwan@google.com>
2166
2167 * arm.cc: Update copyright comments.
2168 (Target_arm): New forward class template declaration.
2169 (Arm_address): New type.
2170 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
2171 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
2172 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
2173 constants.
2174 (Insn_template): Same.
2175 (DEF_STUBS): New macro.
2176 (Stub_type): New enum type.
2177 (Stub_template): New class definition.
2178 (Stub): Same.
2179 (Reloc_stub): Same.
2180 (Stub_factory): Same.
2181 (Target_arm::Target_arm): Initialize may_use_blx_ and
2182 should_force_pic_veneer_.
2183 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
2184 Target_arm::should_force_pic_veneer,
2185 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
2186 Target_arm::using_thumb_only, Target_arm:;default_target): New
2187 method defintions.
2188 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
2189 New data member declarations.
2190 (Insn_template::size, Insn_template::alignment): New method defintions.
2191 (Stub_template::Stub_template): New method definition.
2192 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
2193 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
2194 (Stub_factory::Stub_factory): New method definition.
2195 * gold.h (string_hash): New template.
2196 * output.h (Input_section_specifier::hash_value): Use
2197 gold::string_hash.
2198 (Input_section_specifier::string_hash): Remove.
2199 * stringpool.cc (Stringpool_template::string_hash): Use
2200 gold::string_hash.
2201
6c172549
DK
22022009-10-20 Doug Kwan <dougkwan@google.com>
2203
2204 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
2205 symbols of relaxed input sections.
2206 * output.h (Output_section::find_relaxed_input_section): Make
2207 method public.
2208
c5617f2f
DK
22092009-10-16 Doug Kwan <dougkwan@google.com>
2210
2211 * dynobj.cc (Versions::Versions): Initialize version_script_.
2212 Only insert base version symbol definition for a shared object
2213 if version script defines any version versions.
2214 (Versions::define_base_version): New method definition.
2215 (Versions::add_def): Check that base version is not needed.
2216 (Versions::add_need): Define base version lazily.
2217 * dynobj.h (Versions::define_base_version): New method declaration.
2218 (Versions::needs_base_version_): New data member declaration.
2219 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
2220 (check_DATA): Add no_version_test.stdout.
2221 (libno_version_test.so, no_version_test.o no_version_test.stdout):
2222 New make rules.
2223 * testsuite/Makefile.in: Regenerate.
2224 * testsuite/no_version_test.c: New file.
2225 * testsuite/no_version_test.sh: Ditto.
2226
3c12dcdb
DK
22272009-10-16 Doug Kwan <dougkwan@google.com>
2228
2229 * expression.cc (class Segment_start_expression): New class definition.
2230 (Segment_start_expression::value): New method definition.
2231 (script_exp_function_segment_start): Return a new
2232 Segment_start_expression.
2233 * gold/script-c.h (script_saw_segment_start_expression): New function
2234 prototype.
2235 * script-sections.cc (Script_sections::Script_sections): Initialize
2236 SAW_SEGMENT_START_EXPRESSION_ to false.
2237 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
2238 and -Tbbs options to specify section addresses if given in
2239 command line and no SEGMENT_START expression is seen in a script.
2240 * script-sections.h (Script_sections::saw_segment_start_expression,
2241 Script_sections::set_saw_segment_start_expression): New method
2242 definition.
2243 (Script_sections::saw_segment_start_expression_): New data member
2244 declaration.
2245 * script.cc (script_saw_segment_start_expression): New function.
2246 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
2247 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
2248 script_test_7.sh and script_test_8.sh.
2249 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
2250 script_test_8.stdout.
2251 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
2252 (script_test_6, script_test_6.stdout, script_test_7,
2253 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
2254 * Makefile.in: Regenerate.
2255 * testsuite/script_test_6.sh: New file.
2256 * testsuite/script_test_6.t: Same.
2257 * testsuite/script_test_7.sh: Same.
2258 * testsuite/script_test_7.t: Same.
2259 * testsuite/script_test_8.sh: Same.
2260
64b1ae37
DK
22612009-10-16 Doug Kwan <dougkwan@google.com>
2262
2263 * output.cc (Output_segment::set_section_list_address): Cast
2264 expressions to unsigned long long type to avoid format warnings.
2265
661be1e2
ILT
22662009-10-15 Ian Lance Taylor <iant@google.com>
2267
12edd763 2268 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 2269 dot assignment to script_sections_.
12edd763
ILT
2270 * script-sections.cc (Script_sections::add_dot_assignment):
2271 Initialize if necessary.
2272
68b6574b
ILT
2273 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
2274 program headers with no load segment if there is a linker script.
2275
661be1e2
ILT
2276 * layout.cc (Layout::set_segment_offsets): Align the file offset
2277 to the segment aligment for -N or -n with no load segment.
2278 * output.cc (Output_segment::add_output_section): Don't crash if
2279 the first section is a TLS section.
2280 (Output_segment::set_section_list_addresses): Print an error
2281 message if the address moves backward in a linker script.
2282 * script-sections.cc
2283 (Output_section_element_input::set_section_addresses): Don't
2284 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
2285 (Orphan_output_section::set_section_addresses): Likewise.
2286
f15f61a7
DK
22872009-10-15 Doug Kwan <dougkwan@google.com>
2288
2289 * layout.cc (Layout::finish_dynamic_section): Generate tags
2290 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
2291 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
2292 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
2293
82bb573a
ILT
22942009-10-14 Ian Lance Taylor <iant@google.com>
2295
2296 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
2297 fields.
2298 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
2299 data_shdr fields of relinfo.
2300 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
2301 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
2302 R_386_TLS_LDO_32, adjust based on section flags.
2303 (Target_i386::Relocate::fix_up_ldo): Remove.
2304
374ad285
ILT
23052009-10-13 Ian Lance Taylor <iant@google.com>
2306
2307 Add support for -pie.
2308 * options.h (class General_options): Add -pie and
2309 --pic-executable.
2310 (General_options::output_is_position_independent): Test -pie.
2311 (General_options::output_is_executable): Return true if not shared
2312 and not relocatable.
2313 (General_options::output_is_pie): Remove.
2314 * options.cc (General_options::finalize): Reject incompatible uses
2315 of -pie.
2316 * gold.cc (queue_middle_tasks): A -pie link is not static.
2317 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
2318 * symtab.cc (Symbol::final_value_is_known): Return false if
2319 output_is_position_independent.
2320 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
2321 output_is_position_independent.
2322 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
2323 output_is_position_independent.
2324 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
2325 output_is_position_independent.
2326 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
2327 two_file_pie_test.
2328 (basic_pie_test.o, basic_pie_test): New targets.
2329 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
2330 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
2331 (two_file_pie_test): New target.
2332 * testsuite/Makefile.in: Rebuild.
2333 * README: Remove note saying that -pie is not supported.
2334
c6585162
ILT
23352009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2336
2337 * options.h (class General_options): Add -init and -fini.
2338 * layout.cc (Layout::finish_dynamic_section): Emit
2339 given init and fini functions.
2340
032ce4e9
ST
23412009-10-13 Sriraman Tallam <tmsriram@google.com>
2342
2343 * gc.h (gc_process_relocs): Check if icf is enabled using new
2344 function.
2345 * gold.cc (queue_initial_tasks): Likewise.
2346 (queue_middle_tasks): Likewise.
2347 * object.cc (do_layout): Likewise.
2348 * symtab.cc (is_section_folded): Likewise.
2349 * main.cc (main): Likewise.
2350 * reloc.cc (Read_relocs::run): Likewise.
2351 (Sized_relobj::do_scan_relocs): Likewise.
2352 * icf.cc (is_function_ctor_or_dtor): New function.
2353 (Icf::find_identical_sections): Check if function is ctor or dtor when
2354 safe icf is chosen.
2355 * options.h (General_options::icf): Change option to be an enum.
2356 (Icf_status): New enum.
2357 (icf_enabled): New method.
2358 (icf_safe_folding): New method.
2359 (set_icf_status): New method.
2360 (icf_status_): New variable.
2361 * (options.cc) (General_options::finalize): Set icf_status_.
2362 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
2363 icf_test and icf_keep_unique_test to use the --icf enum flag.
2364 * testsuite/icf_safe_test.sh: New file.
2365 * testsuite/icf_safe_test.cc: New file.
2366
f345227a
ST
23672009-10-12 Sriraman Tallam <tmsriram@google.com>
2368
2369 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
2370 includes to gc.h and icf.h.
2371 * arm.cc: Include gc.h.
2372 * gold.cc: Likewise.
2373 * i386.cc: Likewise.
2374 * powerpc.cc: Likewise.
2375 * sparc.cc: Likewise.
2376 * x86_64.cc: Likewise.
2377 * gc.h: Include icf.h.
2378
1c7814ed
ILT
23792009-10-11 Ian Lance Taylor <iant@google.com>
2380
2381 * plugin.cc: Include "gold.h" before other header files.
2382
ae3b5189
CD
23832009-10-10 Chris Demetriou <cgd@google.com>
2384
2385 * options.h (Input_file_argument::Input_file_type): New enum.
2386 (Input_file_argument::is_lib_): Replace with...
2387 (Input_file_argument::type_): New member.
2388 (Input_file_argument::Input_file_argument): Take Input_file_type
2389 'type' rather than boolean 'is_lib' as second argument.
2390 (Input_file_argument::is_lib): Use type_.
2391 (Input_file_argument::is_searched_file): New function.
2392 (Input_file_argument::may_need_search): Handle is_searched_file.
2393 * options.cc (General_options::parse_library): Support -l:filename.
2394 (General_options::parse_just_symbols): Update for Input_file_argument
2395 changes.
2396 (Command_line::process): Likewise.
2397 * archive.cc (Archive::get_file_and_offset): Likewise.
2398 * plugin.cc (Plugin_manager::release_input_file): Likewise.
2399 * script.cc (read_script_file, script_add_file): Likewise.
2400 * fileread.cc (Input_file::Input_file): Likewise.
2401 (Input_file::will_search_for): Handle is_searched_file.
2402 (Input_file::open): Likewise.
2403 * readsyms.cc (Read_symbols::get_name): Likewise.
2404 * testsuite/Makefile.am (searched_file_test): New test.
2405 * testsuite/Makefile.in: Regenerate.
2406 * testsuite/searched_file_test.cc: New file.
2407 * testsuite/searched_file_test_lib.cc: New file.
2408
f3048a1d
ILT
24092009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2410 Ian Lance Taylor <iant@google.com>
2411
2412 * descriptor.cc: Include <cstdio> and "binary-io.h".
2413 (Descriptors::open): Open the files in binary mode always.
2414 * script.cc (Lex::get_token): Treat \r as whitespace.
2415
d4780e57
ILT
24162009-10-09 Ian Lance Taylor <iant@google.com>
2417
2418 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
2419
d9a893b8
ILT
24202009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2421 Ian Lance Taylor <iant@google.com>
2422
2423 * configure.ac: Check for readv function also.
2424 * fileread.cc (readv): Define if not HAVE_READV.
2425 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
2426 does not exist.
2427 * config.in: Regenerate.
2428 * configure: Regenerate.
2429
c0a62865
DK
24302009-10-09 Doug Kwan <dougkwan@google.com>
2431
2432 * layout.cc (Layout::make_output_section): Call target hook to make
2433 ordinary output section.
2434 (Layout::finalize): Adjust parameter list of call the
2435 Target::may_relax().
2436 * layout.h (class Layout::section_list): New method.
2437 * merge.h (Output_merge_base::entsize): Change visibility to public.
2438 (Output_merge_base::is_string, Output_merge_base::do_is_string):
2439 New methods.
2440 (Output_merge_string::do_is_string): New method.
2441 * object.cc (Sized_relobj::do_setup): renamed from
2442 Sized_relobj::set_up.
2443 * object.h (Sized_relobj::adjust_shndx,
2444 Sized_relobj::initializ_input_to_output_maps,
2445 Sized_relobj::free_input_to_output_maps): Change visibilities to
2446 protected.
2447 (Sized_relobj::setup): Virtualize.
2448 (Sized_relobj::do_setup): New method declaration.
2449 (Sized_relobj::invalidate_section_offset,
2450 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
2451 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
2452 * options.cc (parse_int): New function.
2453 * options.h (parse_int): New declaration.
2454 (DEFINE_int): New macro.
2455 (stub_group_size): New option.
2456 * output.cc (Output_section::Output_section): Initialize memebers
2457 merge_section_map_, merge_section_by_properties_map_,
2458 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
2459 (Output_section::add_input_section): Handled deferred code-fill
2460 generation and remove an old comment.
2461 (Output_section::add_relaxed_input_section): New method definition.
2462 (Output_section::add_merge_input_section): Use merge section by
2463 properties map to speed to search. Update merge section maps
2464 as appropriate.
2465 (Output_section::build_relaxation_map): New method definition.
2466 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2467 Same.
2468 (Output_section::relax_input_section): Renamed to
2469 Output_section::convert_input_sections_to_relaxed_sections and change
2470 interface to take a vector of pointers to relaxed sections.
2471 (Output_section::find_merge_section,
2472 Output_section::find_relaxed_input_section): New method definitions.
2473 (Output_section::is_input_address_mapped,
2474 Output_section::output_offset, Output_section::output_address):
2475 Use output section data maps to speed up searching.
2476 (Output_section::find_starting_output_address): Add comments.
2477 (Output_section::do_write,
2478 Output_section::write_to_postprocessing_buffer): Do code-fill
2479 generation as appropriate.
2480 (Output_section::get_input_sections): Invalidate relaxed input section
2481 map.
2482 (Output_section::restore_states): Adjust type of checkpoint .
2483 Invalidate relaxed input section map.
2484 * output.h (Output_merge_base): New class declaration.
2485 (Input_section_specifier): New class defintion.
2486 (class Output_relaxed_input_section) Change base class to
2487 Output_section_data_build.
2488 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
2489 base class initializer.
2490 (Output_section::add_relaxed_input_section): New method declaration.
2491 (Output_section::Input_section): Change visibility to protected.
2492 (Output_section::Input_section::relobj,
2493 Output_section::Input_section::shndx): Handle relaxed input sections.
2494 Output_section::input_sections) Change visibility to protected. Also
2495 define overload to return a non-const pointer.
2496 (Output_section::Merge_section_properties): New class defintion.
2497 (Output_section::Merge_section_by_properties_map,
2498 Output_section::Output_section_data_by_input_section_map,
2499 Output_section::Relaxation_map): New types.
2500 (Output_section::relax_input_section): Rename method to
2501 Output_section::convert_input_sections_to_relaxed_sections and change
2502 interface to take a vector of relaxed section pointers.
2503 (Output_section::find_merge_section,
2504 Output_section::find_relaxed_input_section,
2505 Output_section::build_relaxation_map,
2506 Output_section::convert_input_sections_in_list_to_relaxed_sections):
2507 New method declarations.
2508 (Output_section::merge_section_map_
2509 Output_section::merge_section_by_properties_map_,
2510 Output_section::relaxed_input_section_map_,
2511 Output_section::is_relaxed_input_section_map_valid_,
2512 Output_section::generate_code_fills_at_write_): New data members.
2513 * script-sections.cc
2514 (Output_section_element_input::set_section_addresses): Call
2515 current_data_size and addralign methods of relaxed input sections.
2516 (Orphan_output_section::set_section_addresses): Call current_data_size
2517 and addralign methods of relaxed input sections.
2518 * symtab.cc (Symbol_table::compute_final_value): Extract template
2519 from the body of Symbol_table::sized_finalize_symbol.
2520 (Symbol_table::sized_finalized_symbol): Call
2521 Symbol_table::compute_final_value.
2522 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
2523 (Symbol_table::compute_final_value): New templated method declaration.
2524 * target.cc (Target::do_make_output_section): New method defintion.
2525 * target.h (Target::make_output_section): New method declaration.
2526 (Target::relax): Add more parameters for input objects, symbol table
2527 and layout. Adjust call to do_relax.
2528 (Target::do_make_output_section): New method declaration.
2529 (Target::do_relax): Add parameters for input objects, symbol table
2530 and layout.
2531
d446d6c4
ILT
25322009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2533
2534 * pread.c: Include stdio.h.
2535
bc06c745
ILT
25362009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2537
2538 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
2539 defined.
2540
75aea3d0
ILT
25412009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2542
2543 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2544 Change read_shndx type to unsigned int.
2545 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2546 int.
2547 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2548 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
2549 Change read_shndx type to unsigned int.
2550 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2551 int.
2552 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2553 * layout.cc (Layout::create_symtab_sections): Cast the result of
2554 local_symcount * symsize to off_t in the gold_assert.
2555
be8fcb75
ILT
25562009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2557
2558 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
2559 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
2560 R_ARM_BASE_ABS.
2561 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
2562 (Arm_relocate_functions::thm_abs5): New function.
2563 (Arm_relocate_functions::abs12): New function.
2564 (Arm_relocate_functions::abs16): New function.
2565 (Arm_relocate_functions::base_abs): New function.
2566 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
2567 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
2568 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
2569 R_ARM_BASE_ABS.
2570 (Scan::global): Likewise.
2571 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
2572 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
2573 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
2574 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
2575 R_ARM_BASE_ABS.
2576
c2a122b6
ILT
25772009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2578
2579 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
2580 (Arm_relocate_functions::movt_prel): New function.
2581 (Arm_relocate_functions::thm_movw_prel_nc): New function.
2582 (Arm_relocate_functions::thm_movt_prel): New function.
2583 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
2584 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
2585 (Scan::global, Relocate::relocate): Likewise.
2586 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2587
c4aa1e2d
ILT
25882009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2589
2590 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
2591 Incremental_checker.
2592 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
2593 unsigned int.
2594 (class Incremental_inputs_header): New class.
2595 (Incremental_inputs_header_writer): Edit comment.
2596 (Incremental_inputs_entry): New class.
2597 (Incremental_inputs_entry_writer): Edit comment.
2598 (Sized_incremental_binary::do_find_incremental_inputs_section):
2599 Add *strtab_shndx parameter, fill it.
2600 (Sized_incremental_binary::do_check_inputs): New method.
2601 (Incremental_checker::can_incrementally_link_output_file): Use
2602 Sized_incremental_binary::check_inputs.
2603 (Incremental_inputs::report_command_line): Save command line in
2604 command_line_.
2605 * incremental.h:
2606 (Incremental_binary::find_incremental_inputs_section): New
2607 method.
2608 (Incremental_binary::do_find_incremental_inputs_section): Add
2609 strtab_shndx parameter.
2610 (Incremental_binary::do_check_inputs): New pure virtual method.
2611 (Sized_incremental_binary::do_check_inputs): Declare.
2612 (Incremental_checker::Incremental_checker): Add incremental_inputs
2613 parameter, use it to initialize incremental_inputs_.
2614 (Incremental_checker::incremental_inputs_): New field.
2615 (Incremental_checker::command_line): New method.
2616 (Incremental_checker::inputs): New method.
2617 (Incremental_checker::command_line_): New field.
2618
c549a694
ILT
26192009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2620
2621 * incremental.cc: Include <cstdarg> and "target-select.h".
2622 (vexplain_no_incremental): New function.
2623 (explain_no_incremental): New function.
2624 (Incremental_binary::error): New method.
2625 (Sized_incremental_binary::do_find_incremental_inputs_section): New
2626 method.
2627 (make_sized_incremental_binary): New function.
2628 (open_incremental_binary): New function.
2629 (can_incrementally_link_file): Add checks if output is ELF and has
2630 inputs section.
2631 * incremental.h: Include "elfcpp_file.h" and "output.h".
2632 (Incremental_binary): New class.
2633 (Sized_incremental_binary): New class.
2634 (open_incremental_binary): Declare.
2635 * object.cc (is_elf_object): Use
2636 elfcpp::Elf_recognizer::is_elf_file.
2637 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2638 * output.h (Output_file::filesize): New method.
2639
fd3c5f0b
ILT
26402009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2641
2642 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2643 New function.
2644 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2645 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2646 function.
2647 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2648 function.
2649 (Arm_relocate_functions::movw_abs_nc): New function.
2650 (Arm_relocate_functions::movt_abs): New function.
2651 (Arm_relocate_functions::thm_movw_abs_nc): New function.
2652 (Arm_relocate_functions::thm_movt_abs): New function.
2653 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2654 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2655 (Scan::global): Likewise.
2656 (Relocate::relocate): Likewise.
2657 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2658
7f5309a5
ILT
26592009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2660
2661 * arm.cc (Arm_relocate_functions::got_prel) New function.
2662 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
2663 (Relocate::relocate): Likewise.
2664 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2665
364c7fa5
ILT
26662009-10-06 Ian Lance Taylor <iant@google.com>
2667
2668 * options.h (class General_options): Define
2669 split_stack_adjust_size parameter.
2670 * object.h (class Object): Add uses_split_stack_ and
2671 has_no_split_stack_ fields. Add uses_split_stack and
2672 has_no_split_stack accessor functions. Declare
2673 handle_split_stack_section.
2674 (class Reloc_symbol_changes): Define.
2675 (class Sized_relobj): Define Function_offsets. Declare
2676 split_stack_adjust, split_stack_adjust_reltype, and
2677 find_functions.
2678 * object.cc (Object::handle_split_stack_section): New function.
2679 (Sized_relobj::do_layout): Call handle_split_stack_section.
2680 * dynobj.cc (Sized_dynobj::do_layout): Call
2681 handle_split_stack_section.
2682 * reloc.cc (Sized_relobj::relocate_sections): Call
2683 split_stack_adjust for executable sections in split_stack
2684 objects. Pass reloc_map to relocate_section.
2685 (Sized_relobj::split_stack_adjust): New function.
2686 (Sized_relobj::split_stack_adjust_reltype): New function.
2687 (Sized_relobj::find_functions): New function.
2688 * target-reloc.h: Include "object.h".
2689 (relocate_section): Add reloc_symbol_changes parameter. Change
2690 all callers.
2691 * target.h (class Target): Add calls_non_split method. Declare
2692 do_calls_non_split virtual method. Declare match_view and
2693 set_view_to_nop.
2694 * target.cc: Include "elfcpp.h".
2695 (Target::do_calls_non_split): New function.
2696 (Target::match_view): New function.
2697 (Target::set_view_to_nop): New function.
2698 * gold.cc (queue_middle_tasks): Give an error if mixing
2699 split-stack and non-split-stack objects with -r.
2700 * i386.cc (Target_i386::relocate_section): Add
2701 reloc_symbol_changes parameter.
2702 (Target_i386::do_calls_non_split): New function.
2703 * x86_64.cc (Target_x86_64::relocate_section): Add
2704 reloc_symbol_changes parameter.
2705 (Target_x86_64::do_calls_non_split): New function.
2706 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
2707 parameter.
2708 * powerpc.cc (Target_powerpc::relocate_section): Add
2709 reloc_symbol_changes parameter.
2710 * sparc.cc (Target_sparc::relocate_section): Add
2711 reloc_symbol_changes parameter.
2712 * configure.ac: Call AM_CONDITIONAL for the default target.
2713 * configure: Rebuild.
2714 * testsuite/Makefile.am (TEST_AS): New variable.
2715 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
2716 (check_DATA): Add split_i386 and split_x86_64 files.
2717 (SPLIT_DEFSYMS): Define.
2718 (split_i386_[1234n].o): New targets.
2719 (split_i386_[124]): New targets.
2720 (split_i386_[1234r].stdout): New targets.
2721 (split_x86_64_[1234n].o): New targets.
2722 (split_x86_64_[124]): New targets.
2723 (split_x86_64_[1234r].stdout): New targets.
2724 (MOSTLYCLEANFILES): Add new executables.
2725 * testsuite/split_i386.sh: New file.
2726 * testsuite/split_x86_64.sh: New file.
2727 * testsuite/split_i386_1.s: New file.
2728 * testsuite/split_i386_2.s: New file.
2729 * testsuite/split_i386_3.s: New file.
2730 * testsuite/split_i386_4.s: New file.
2731 * testsuite/split_i386_n.s: New file.
2732 * testsuite/split_x86_64_1.s: New file.
2733 * testsuite/split_x86_64_2.s: New file.
2734 * testsuite/split_x86_64_3.s: New file.
2735 * testsuite/split_x86_64_4.s: New file.
2736 * testsuite/split_x86_64_n.s: New file.
2737 * testsuite/testfile.cc (Target_test): Update relocation_section
2738 function.
2739 * testsuite/Makefile.in: Rebuild.
2740
e8a9fcda
ILT
27412009-10-06 Ian Lance Taylor <iant@google.com>
2742
2743 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
2744 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
2745 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
2746 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
2747 the address on ldo_addrs_.
2748 (Target_i386::Relocate::fix_up_ldo): New function.
2749
e99daf92
ILT
27502009-10-06 Rafael Espindola <espindola@google.com>
2751
2752 * plugin.cc (add_input_library): New.
2753 (Plugin::load): Add add_input_library to tv.
2754 (Plugin_manager::add_input_file): Add the is_lib argument.
2755 (add_input_file): Update call to Plugin_manager::add_input_file.
2756 (add_input_library): New.
2757 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2758
966d4097
DK
27592009-09-30 Doug Kwan <dougkwan@google.com>
2760
2761 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
2762 symbol and call Symbol::may_need_copy_reloc to determine if
2763 a copy reloc is needed.
2764 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
2765 nocopyreloc is given in command line.
2766 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
2767 given in command line.
2768 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
2769 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
2770 of the removed Target_i386::may_need_copy_reloc.
2771 * options.h (copyreloc): New option with default value false.
2772 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2773 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
2774 instead of the removed Target_powerpc::may_need_copy_reloc.
2775 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2776 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
2777 instead of the removed Target_sparc::may_need_copy_reloc.
2778 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
2779 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
2780 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
2781 instead of the removed Target_x86_64::may_need_copy_reloc.
2782
029ba973
ILT
27832009-09-30 Ian Lance Taylor <iant@google.com>
2784
2785 * object.h (class Object): Remove target_ field, and target,
2786 sized_target, and set_target methods.
2787 (Object::sized_target): Remove.
2788 (class Sized_relobj): Update declarations. Remove sized_target.
2789 * object.cc (Sized_relobj::setup): Remove target parameter.
2790 Change all callers.
2791 (Input_objects::add_object): Don't do anything with the target.
2792 (make_elf_sized_object): Add punconfigured parameter. Change all
2793 callers. Set or test parameter target.
2794 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
2795 Change all callers.
2796 * parameters.cc (Parameters::set_target): Change parameter type to
2797 be non-const.
2798 (Parameters::default_target): Remove.
2799 (set_parameters_target): Change parameter type to be non-const.
2800 (parameters_force_valid_target): New function.
2801 (parameters_clear_target): New function.
2802 * parameters.h (class Parameters): Update declarations. Remove
2803 default_target method. Add sized_target and clear_target
2804 methods. Change target_ to be non-const.
2805 (set_parameters_target): Update declaration.
2806 (parameters_force_valid_target): Declare.
2807 (parameters_clear_target): Declare.
2808 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
2809 as NULL if we aren't searching.
2810 (Add_symbols::run): Don't check for compatible target.
2811 * fileread.cc (Input_file::open_binary): Call
2812 parameters_force_valid_target.
2813 * gold.cc (queue_middle_tasks): Likewise.
2814 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
2815 set_target on object.
2816 * dynobj.h (class Sized_dynobj): Update declarations.
2817 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
2818 make_elf_object returns NULL.
2819 (Archive::include_member): Don't check whether object target is
2820 compatible.
2821 * output.cc (Output_section::add_input_section): Get target from
2822 parameters.
2823 (Output_section::relax_input_section): Likewise.
2824 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2825 parameters.
2826 (Sized_relobj::do_scan_relocs): Likewise.
2827 (Sized_relobj::relocate_sections): Likewise.
2828 * resolve.cc (Symbol_table::resolve): Likewise.
2829 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
2830 parameter. Change all callers.
2831 (Symbol_table::add_from_object): Get target from parameters.
2832 (Symbol_table::add_from_relobj): Don't check object target.
2833 (Symbol_table::add_from_dynobj): Likewise.
2834 (Symbol_table::define_special_symbol): Get target from
2835 parameters.
2836 * symtab.h (class Symbol_table): Update declaration.
2837 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2838 parameter. Change all callers. Clear parameter target.
2839 (Binary_test): Test target here.
2840 * testsuite/object_unittest.cc (gold_testsuite): Remove
2841 target_test_pointer parameter. Change all callers.
2842 (Object_test): Test target here.
2843
a6a22b83
ILT
28442009-09-26 Ian Lance Taylor <iant@google.com>
2845
2846 * testsuite/initpri1.c: Don't try to use constructor priorities if
2847 compiling with gcc before 4.3.
2848
6a8f49fe
ILT
28492009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2850
2851 * testsuite/retain_symbols_file_test.sh (check_present): Change
2852 output file name to retain_symbols_file_test.stdout.
2853 (check_absent): Likewise.
2854
8c604651
CS
28552009-09-18 Craig Silverstein <csilvers@google.com>
2856
2857 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2858 * options.cc: Include <cerrno> and <fstream>.
2859 (General_options::finalize): Parse -retain-symbols-file tag.
2860 * options.h: New flag.
2861 (General_options): New method should_retain_symbol, new
2862 variable symbols_to_retain.
2863 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2864 should_retain_symbol map.
2865 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2866 * testsuite/Makefile.in: Regenerate.
2867 * testsuite/retain_symbols_file_test.sh: New file.
2868
ca58b19f
NC
28692009-09-18 Nick Clifton <nickc@redhat.com>
2870
2871 * po/es.po: Updated Spanish translation.
2872
20e6d0d6
DK
28732009-09-17 Doug Kwan <dougkwan@google.com>
2874
2875 * debug.h (DEBUG_RELAXATION): New constant.
2876 (DEBUG_ALL): Add DEBUG_RELAXATION.
2877 (debug_string_to_enum): Add relaxation debug option.
2878 * layout.cc
2879 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2880 Layout::Relaxation_debug_check::read_sections,
2881 Layout::Relaxation_debug_check::read_sections): New method definitions.
2882 (Layout::Layout): Initialize data members
2883 record_output_section_data_from_scrips_,
2884 script_output_section_data_list_ and relaxation_debug_check_.
2885 (Layout::save_segments, Layout::restore_segments,
2886 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2887 Layout::relaxation_loop_body): New method definitions.
2888 (Layout::finalize): Support relaxation. Move section layout code to
2889 Layout::relaxation_loop_body.
2890 (Layout::set_asection_address_from_script): Move code for orphan
2891 section placement out.
2892 (Layout::place_orphan_sections_in_script): New method definition.
2893 * layout.h (Output_segment_headers, Output_file_header):
2894 New forward class declarations.
2895 (Layout::~Layout): Define.
2896 (Layout::new_output_section_data_from_script): New method definition.
2897 (Layout::place_orphan_sections_in_script): New method declaration.
2898 (Layout::Segment_states): New type declaration.
2899 (Layout::save_segments, Layout::restore_segments,
2900 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2901 Layout::relaxation_loop_body): New method declarations.
2902 (Layout::Output_section_data_list): New type declaration.
2903 (Layout::Relaxation_debug_check): New class definition.
2904 (Layout::record_output_section_data_from_script_,
2905 Layout::script_output_section_data_list_, Layout::segment_states_,
2906 Layout::relaxation_debug_check_): New data members.
2907 * output.cc: (Output_section_headers::do_size): New method definition.
2908 (Output_section_headers::Output_section_headers): Move size
2909 computation to Output_section_headers::do_size.
2910 (Output_segment_headers::do_size): New method definition.
2911 (Output_file_header::Output_file_header): Move size computation to
2912 Output_file_header::do_size and call it.
2913 (Output_file_header::do_size): New method definition.
2914 (Output_data_group::Output_data_group): Adjust call to
2915 Output_section_data.
2916 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2917 (Output_symtab_xindex::do_write): Add array bound check.
2918 (Output_section::Input_section::print_to_mapfile): Handle
2919 RELAXED_INPUT_SECTION_CODE.
2920 (Output_section::Output_section): Initialize data member checkpoint_.
2921 (Output_section::~Output_section): Delete checkpoint object pointed
2922 by checkpoint_.
2923 (Output_section::add_input_section): Always add an Input_section if
2924 relaxing.
2925 (Output_section::add_merge_input_section): Add assert.
2926 (Output_section::relax_input_section): New method definition.
2927 (Output_section::set_final_data_size): Set load address to zero for
2928 an unallocated section.
2929 (Output_section::do_address_and_file_offset_have_reset_values):
2930 New method definition.
2931 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2932 Handle relaxed input section.
2933 (Output_section::sort_attached_input_sections): Checkpoint input
2934 section list lazily.
2935 (Output_section::get_input_sections): Change type of input_sections to
2936 list of Simple_input_section pointers. Checkpoint input section list
2937 lazily. Also handle relaxed input sections.
2938 (Output_section::add_input_section_for_script): Take a reference to
2939 a Simple_input_section object instead of Relobj pointer and section
2940 index as parameter. Handle relaxed input sections.
2941 (Output_section::save_states, Output_section::restore_states): New
2942 method definitions.
2943 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2944 (Output_data::is_data_size_fixed): New method definition.
2945 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2946 if it is fixed.
2947 (Output_data::address_and_file_offset_have_reset_values): New method
2948 definition.
2949 (Output_data::do_address_and_file_offset_have_reset_values): New method
2950 definition.
2951 (Output_data::set_data_size): Check that data size is not fixed.
2952 (Output_data::fix_data_size): New method definition.
2953 (Output_data::is_data_size_fixed_): New data member.
2954 (Output_section_headers::set_final_data_size): New method definition.
2955 (Output_section_headers::do_size): New method declaration.
2956 (Output_segment_headers::set_final_data_size): New method definition.
2957 (Output_segment_headers::do_size): New method declaration.
2958 (Output_file_header::set_final_data_size)::New method definition.
2959 (Output_file_header::do_size)::New method declaration.
2960 (Output_section_data::Output_section_data): Add new parameter
2961 is_data_size_fixed and use it to fix data size.
2962 (Output_data_const::Output_data_const): Adjust call to base class
2963 constructor and fix data size.
2964 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2965 base class constructor and fix data size.
2966 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2967 base class constructor and fix data size.
2968 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2969 class constructor and fix data size.
2970 (Output_data_group::set_final_data_size): New method definition.
2971 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2972 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2973 class constructor and fix data size.
2974 (Output_relaxed_input_section): New class definition.
2975 (Output_section::Simple_input_section): New class definition.
2976 (Output_section::get_input_sections): Adjust parameter list.
2977 (Output_section::add_input_section_for_script): Same.
2978 (Output_section::save_states, Output_section::restore_states,
2979 Output_section::do_address_and_file_offset_have_reset_values,
2980 (Output_section::Input_section::Input_section): Handle
2981 RELAXED_INPUT_SECTION_CODE. Add new overload for
2982 Output_relaxed_input_section.
2983 (Output_section::Input_section::is_input_section,
2984 Output_section::Input_section::set_output_section): Handle relaxed
2985 input section.
2986 (Output_section::Input_section::is_relaxed_input_section,
2987 Output_section::Input_section::output_section_data,
2988 Output_section::Input_section::relaxed_input_section): New method
2989 definitions.
2990 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2991 value.
2992 (Output_section::Input_section::u1_): Update comments.
2993 (Output_section::Input_section::u2_): Add new union member poris.
2994 (Output_section::Checkpoint_output_section): New classs definition.
2995 (Output_section::relax_input_section): New method declaration.
2996 (Output_section::checkpoint_): New data member.
2997 (Output_segment): Update comments.
2998 (Output_segment::Output_segment): Un-privatize copy constructor.
2999 (Output_segment::operator=): Un-privatize.
3000 * script-sections.cc (Output_section_element::Input_section_list):
3001 Change element type to Output_section::Simple_input_section.
3002 (Output_section_element_dot_assignment::set_section_addresses):
3003 Register output section data for relaxation clean up.
3004 (Output_data_exression::Output_data_expression): Adjust call to base
3005 constructor to fix data size.
3006 (Output_section_element_data::set_section_addresses): Register
3007 Output_data_expression object for relaxation clean up.
3008 (struct Input_section_info): Replace Relobj pointer and section index
3009 pair with Output_section::Simple_input_section and Convert struct to a
3010 class.
3011 (Input_section_sorter::operator()): Adjust access to
3012 Input_section_info data member to use accessors.
3013 (Output_section_element_input::set_section_addresses): Use layout
3014 parameter. Adjust code to use Output_section::Simple_input_section
3015 and Input_secction_info classes. Register filler for relaxation
3016 clean up.
3017 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
3018 and section index pair with Output_section::Simple_input_section
3019 class. Adjust code accordingly.
3020 (Phdrs_element::release_segment): New method definition.
3021 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
3022 segment list.
3023 (Script_sections::release_segments): New method definition.
3024 * gold/script-sections.h (Script_sections::release_segments): New
3025 method declaration.
3026 * gold/target.h (Target::may_relax, Target::relax,
3027 Target::do_may_relax, Target::do_relax): New method definitions.
3028
5e445df6
ILT
30292009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3030
3031 * arm.cc (has_signed_unsigned_overflow): New function.
3032 (Arm_relocate_functions::abs8): New function.
3033 (Target_arm::Scan::local): Handle R_ARM_ABS8.
3034 (Target_arm::Scan::global): Likewise.
3035 (Target_arm::relocate::relocate): Likewise.
3036 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3037 Likewise.
3038
8c604651 30392009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
3040
3041 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
3042 * testsuite/Makefile.in: Regenerate.
3043
1e9cc1c2
NC
30442009-09-11 Nick Clifton <nickc@redhat.com>
3045
3046 * po/gold.pot: Updated by the Translation project.
3047
6a89f575
CC
30482009-09-08 Cary Coutant <ccoutant@google.com>
3049
3050 * output.cc (Output_file::open): Add execute permission to empty file.
3051 * testsuite/Makefile.am (permission_test): New test.
3052 * testsuite/Makefile.in: Regenerate.
3053
fdcac5af
ILT
30542009-09-02 Ian Lance Taylor <iant@google.com>
3055
3056 * output.cc (Output_file::resize): Call map_no_anonymous rather
3057 than map.
3058
44453f85
ILT
30592009-09-01 Mikolaj Zalewski <mikolajz@google.com>
3060
3061 * gold.cc: Include "incremental.h".
3062 (queue_initial_tasks): Call Incremental_checker methods.
3063 * incremental.cc: Include "output.h".
3064 (Incremental_checker::can_incrementally_link_output_file): New
3065 method.
3066 * incremental.h (Incremental_checker): New class.
3067
3068 * output.cc (Output_file::open_for_modification): New method.
3069 (Output_file::map_anonymous): Changed return type to bool. Record
3070 map in base_ field.
3071 (Output_file::map_no_anonymous): New method, broken out of map.
3072 (Output_file::map): Use map_no_anonymous and map_anonymous.
3073 * output.h (class Output_file): Update declarations.
3074
293c1386
CC
30752009-08-24 Cary Coutant <ccoutant@google.com>
3076
3077 * options.h (Command_line::Pre_options): New class.
3078 (Command_line::pre_options): New member.
3079 * options.cc (gold::options::ready_to_register): New variable.
3080 (One_option::register_option): Do nothing if not registering options.
3081 Assert if same short option registered twice.
3082 (General_options::General_options): Turn off option registration when
3083 done constructing.
3084 (Command_line::Pre_options::Pre_options): New constructor.
3085
f773f3d2
CC
30862009-08-24 Cary Coutant <ccoutant@google.com>
3087
06a73cfe
CC
3088 * options.h (General_options::no_keep_memory): Remove incorrect
3089 short option.
f773f3d2 3090
a15af8e2
RW
30912009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3092
3093 * Makefile.am (am__skiplex, am__skipyacc): New.
3094 * Makefile.in: Regenerate.
3095
c462b41b
RW
30962009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3097
14ec8efd
RW
3098 * Makefile.am (AM_CPPFLAGS): Renamed from ...
3099 (INCLUDES): ... this.
3100 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
3101 (AM_CPPFLAGS): Renamed from ...
3102 (INCLUDE): ... this.
3103 * Makefile.in, testsuite/Makefile.in: Regenerate.
3104
81ecdfbb
RW
3105 * Makefile.in: Regenerate.
3106 * aclocal.m4: Likewise.
3107 * config.in: Likewise.
3108 * configure: Likewise.
3109 * testsuite/Makefile.in: Likewise.
3110
c462b41b
RW
3111 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
3112 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
3113 * Makefile.in: Regenerate.
3114 * testsuite/Makefile.in: Regenerate.
3115
2da73f13
CC
31162009-08-19 Cary Coutant <ccoutant@google.com>
3117
3118 * resolve.cc (Symbol_table::resolve): Don't complain about defined
3119 symbols in shared libraries overridden by hidden or internal symbols
3120 in the main program.
3121
2db70501
CD
31222009-08-19 Chris Demetriou <cgd@google.com>
3123
3124 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
3125 checking source file names in error messages.
3126
f733487b
DK
31272009-08-18 Doug Kwan <dougkwan@google.com>
3128
3129 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
3130 an elcpp::Ehdr as parameter. Adjust call to set_target.
3131 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
3132 an elfcpp::Ehdr as parameter.
3133 * object.cc (Object::set_target): Remove the version that looks up
3134 a target and sets it.
3135 (Sized_relobj::setup): Take a Target object instead of
3136 an elfcpp::Ehdr as parameter. Adjust call to set_target.
3137 (make_elf_sized_object): Find target and ask target to
3138 make an ELF object.
3139 * object.h: (Object::set_target): Remove the version that looks up
3140 a target and sets it.
3141 (Sized_relobj::setup): Take a Target object instead of
3142 an elfcpp:Ehdr as parameter.
3143 * target.cc: Include dynobj.h.
3144 (Target::do_make_elf_object_implementation): New.
3145 (Target::do_make_elf_object): New.
3146 * target.h (Target::make_elf_object): New template declaration.
3147 (Target::do_make_elf_object): New method declarations.
3148 (Target::do_make_elf_object_implementation): New template declaration.
3149
cc70f101
ILT
31502009-08-14 Ian Lance Taylor <iant@google.com>
3151
3152 * gold.h (FUNCTION_NAME): Define.
3153 (gold_unreachable): Use FUNCTION_NAME.
3154
ef5e0cb1
ST
31552009-08-12 Sriraman Tallam <tmsriram@google.com>
3156
3157 * icf.cc (Icf::find_identical_sections): Issue a warning when a
3158 symbol in the --keep-unique list is not found.
3159
48c187ce
ST
31602009-08-12 Sriraman Tallam <tmsriram@google.com>
3161
3162 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
3163 been maked as --keep-unique.
3164 (Icf::unfold_section): New function.
3165 * icf.h (Icf::unfold_section): New function.
3166 * options.h (General_options::keep_unique): New option.
3167 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
3168 * testsuite/Makefile.in: Regenerate.
3169 * testsuite/icf_keep_unique_test.sh: New file.
3170 * testsuite/icf_keep_unique_test.cc: New file.
3171
645afe0c
CC
31722009-08-12 Cary Coutant <ccoutant@google.com>
3173
3174 PR 10471
3175 * resolve.cc (Symbol_table::resolve): Check for references from
3176 dynamic objects to hidden and internal symbols.
3177 * testsuite/Makefile.am (hidden_test.sh): New test.
3178 * testsuite/Makefile.in: Regenerate.
3179 * testsuite/hidden_test.sh: New script.
3180 * testsuite/hidden_test_1.c: New test source.
3181 * testsuite/hidden_test_main.c: New test source.
3182
11af873f
DK
31832009-08-11 Doug Kwan <dougkwan@google.com>
3184
3185 * arm.cc: Update comments.
3186 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
3187 segment to locate the .ARM.exidx section if present.
3188
b9f7d72d
DK
31892009-08-09 Doug Kwan <dougkwan@google.com>
3190
3191 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
3192 patch.
3193
ddd3c53c
ST
31942009-08-07 Sriraman Tallam <tmsriram@google.com>
3195 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
3196 compiler warnings.
3197
27721062
ST
31982009-08-06 Sriraman Tallam <tmsriram@google.com>
3199
3200 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
3201 valid tls_segment only for non-debug-section relocations.
3202 * testsuite/Makefile.am: Add gc_tls_test.
3203 * testsuite/Makefile.in: Regenerate.
3204 * testsuite/gc_tls_test.cc: New file.
3205 * testsuite/gc_tls_test.sh: New file.
3206
ef15dade
ST
32072009-08-05 Sriraman Tallam <tmsriram@google.com>
3208
3209 * icf.cc: New file.
3210 * icf.h: New file.
3211 * Makefile.am (CCFILES): Add icf.cc.
3212 (HFILES): Add icf.h
3213 * Makefile.in: Regenerate.
3214 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
3215 * gc.h (gc_process_relocs): Populate lists used by icf to contain
3216 section, symbol and addend information for the relocs.
3217 * gold.cc (queue_middle_tasks): Call identical code folding.
3218 * gold.h: Add defines for multimap.
3219 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
3220 to the call of finalize_local_symbols.
3221 * main.cc (main): Create object of class Icf.
3222 * object.cc (Sized_relobj::do_layout): Allow this function to be
3223 called twice during icf.
3224 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
3225 to sections marked as identical by icf.
3226 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
3227 when available.
3228 (Sized_relobj::do_section_entsize): New function.
3229 * object.h (Object::section_entsize): New function.
3230 (Object::do_section_entsize): New pure virtual function.
3231 (Relobj::finalize_local_symbols): Add new parameter.
3232 (Relobj::do_section_entsize): New function.
3233 * options.h (General_options::icf): New option.
3234 (General_options::icf_iterations): New option.
3235 (General_options::print_icf_sections): New option.
3236 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
3237 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
3238 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
3239 icf.
3240 * symtab.cc (Symbol_table::is_section_folded): New function.
3241 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
3242 to sections marked as identical by icf.
3243 * symtab.h (Symbol_table::set_icf): New function.
3244 (Symbol_table::icf): New function.
3245 (Symbol_table::is_section_folded): New function.
3246 (Symbol_table::icf_): New data member.
3247 * target-reloc.h (relocate_section): Ignore sections folded by icf.
3248 * testsuite/Makefile.am: Add commands to build icf_test.
3249 * testsuite/Makefile.in: Regenerate.
3250 * testsuite/icf_test.sh: New file.
3251 * testsuite/icf_test.cc: New file.
3252
c3b65ac4
CD
32532009-07-24 Chris Demetriou <cgd@google.com>
3254
3255 * layout.cc (is_compressible_debug_section): Fix incorrect
3256 comment about compressed section names.
3257
1caf2c51
ILT
32582009-07-20 Ian Lance Taylor <ian@airs.com>
3259
3260 PR 10419
3261 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
3262
1ef4d87f
ILT
32632009-07-16 Ian Lance Taylor <iant@google.com>
3264
3265 PR 10400
3266 * layout.h: #include <map>.
3267 (class Kept_section): Change from struct to class. Add accessors
3268 and setters. Add section size to Comdat_group mapping. Change
3269 Comdat_group to std::map. Add is_comdat_ field. Add
3270 linkonce_size field in union.
3271 (class Layout): Update declaration of find_or_add_kept_section.
3272 Don't declare find_kept_object.
3273 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
3274 parameter. Add object, shndx, is_comdat, and is_group_name
3275 parameters. Change all callers. Adjust for new Kept_section.
3276 (Layout::find_kept_object): Remove.
3277 * object.cc (Sized_relobj::include_section_group): Update use of
3278 Kept_section. Rename secnum to shndx. Only record
3279 Kept_comdat_section if sections are the same size.
3280 (Sized_relobj::include_linkonce_section): Update use of
3281 Kept_section. Only record Kept_comdat_section if sections are the
3282 same size. Set size of linkonce section.
3283 (Sized_relobj::map_to_kept_section): Update call to
3284 get_kept_comdat_section.
3285 * object.h (class Sized_relobj): Rename fields in
3286 Kept_comdat_section to drop trailing underscores; change object
3287 field to Relobj*. Change Kept_comdat_section_table to store
3288 struct rather than pointer.
3289 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
3290 Add kept_object and kept_shndx parameters. Change all callers.
3291 (Sized_relobj::get_kept_comdat_section): Change return type to
3292 bool. Add kept_object and kept_shndx parameters. Change all
3293 callers.
3294 * plugin.cc (Pluginobj::include_comdat_group): Update call to
3295 Layout::find_or_add_kept_section.
3296
37c3b7b0
ILT
32972009-07-09 Ian Lance Taylor <iant@google.com>
3298
3299 * merge.cc (Object_merge_map::initialize_input_to_output_map):
3300 Reserve space in the hash table.
3301
98fa85cb
ILT
33022009-07-06 Mikolaj Zalewski <mikolajz@google.com>
3303
3304 * fileread.cc (File_read::get_mtime): New method.
3305 * fileread.h (Timespec): New structure.
3306 (File_read::get_mtime): New method.
3307 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
3308 Renamed from timestamp_nsec.
3309 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
3310 Elf_Xword.
3311 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
3312 timestamp_nsec.
3313 (Incremental_inputs::report_archive): Save mtime; style fix.
3314 (Incremental_inputs::report_obejct): Save mtime; style fix.
3315 (Incremental_inputs::report_script): Save mtime; style fix.
3316 (Incremental_inputs::finalize_inputs): Style fix.
3317 (Incremental_inputs::finalize): Style fix.
3318 (Incremental_inputs::create_input_section_data): Store inputs
3319 mtime.
3320 * incremental.h (Incremental_inputs::report_script): Add mtime
3321 argument.
3322 (Incremental_inputs::Input_info::Input_info): Intialize only one
3323 union member.
3324 (Incremental_inputs::Input_info::archive): Move to nameless
3325 union.
3326 (Incremental_inputs::Input_info::obejct): Move to nameless union.
3327 (Incremental_inputs::Input_info::script): Move to nameless union.
3328 (Incremental_inputs::mtime): New field.
3329 * script.cc (read_input_script): Pass file mtime to
3330 Incremental_input.
3331 * script.h (Script_info::inputs): Style fix.
3332
c9d70757
ILT
33332009-07-01 Ian Lance Taylor <ian@airs.com>
3334
3335 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
3336 instead of 32.
3337
9c547ec3
ILT
33382009-06-24 Ian Lance Taylor <iant@google.com>
3339
3340 PR 10156
3341 * layout.cc (Layout::choose_output_section): If we find an
3342 existing section, update the flags.
3343 (Layout::create_notes): New function, broken out of
3344 Layout::finalize.
3345 (Layout::finalize): Don't create note sections.
3346 (Layout::create_note): Don't crash if linker script discards
3347 section.
3348 (Layout::create_gold_note): Likewise.
3349 (Layout::create_build_id): Likewise. Don't set
3350 after_input_sections on the section.
3351 (Layout::create_executable_stack_info): Remove target parameter.
3352 Change caller.
3353 * layout.h (class Layout): Declare create_notes. Update
3354 declaration of create_executable_stack_info.
3355 * gold.cc (queue_middle_tasks): Call create_notes.
3356 * output.cc (Output_section::update_flags_for_input_section): Move
3357 here from output.h. If SHF_ALLOC flag is newly set, mark address
3358 invalid.
3359 * output.h (Output_data::mark_address_invalid): New function.
3360 (class Output_section): Only declare, not define,
3361 update_flags_for_input_section. Remove set_flags.
3362
55458500
ILT
33632009-06-24 Ian Lance Taylor <iant@google.com>
3364
3365 * script-sections.cc (Output_section_definition::
3366 set_section_addresses): Rename shadowing local load_address to
3367 laddr.
3368
1307d6cd
ILT
33692009-06-24 Ian Lance Taylor <iant@google.com>
3370
3371 PR 10244
3372 * reloc.cc (relocate_sections): Skip empty relocation sections.
3373
ec3f783e
ILT
33742009-06-23 Ian Lance Taylor <iant@google.com>
3375
3376 PR 10156
3377 * layout.cc (Layout::create_note): Use choose_output_section
3378 rather than make_output_section.
3379
459c9f1c
ILT
33802009-06-23 Ian Lance Taylor <iant@google.com>
3381
3382 PR 10237
3383 * options.cc (General_options::parse_V): Set printed_version_.
3384 (General_options::General_options): Initialize printed_version_.
3385 * options.h (class General_options): Add printed_version_ field.
3386 * gold.cc (queue_initial_tasks): If there are no input files,
3387 don't give a fatal error if we printed the version information.
3388 (queue_middle_tasks): If using -r with a shared object, give a
3389 fatal error rather than an ordinary error.
3390
1518dc8f
ILT
33912009-06-23 Ian Lance Taylor <iant@google.com>
3392
3393 PR 10219
3394 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
3395 (Layout::make_output_section): Set have_stabstr_section_ if we see
3396 a .stab*str section.
3397 (Layout::finalize): Call link_stabs_sections.
3398 (Layout::link_stabs_sections): New file.
3399 * layout.h (class Layout): Add have_stabstr_section_ field.
3400 Declare link_stabs_sections.
3401
3d857b98
DK
34022009-06-23 Doug Kwan <dougkwan@google.com>
3403
3404 * Makefile.am (libgold_a_LIBADD): New.
3405 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
3406 * Makefile.in: Regenerate.
3407 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
3408 * configure: Regenerate.
3409 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
3410 * fileread.cc: Include sys/state.h
3411 * gold.h: Declare memmem and strndup if found missing.
3412 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
3413
0639a6f6
ILT
34142009-06-23 Ian Lance Taylor <iant@google.com>
3415
3416 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
3417 * configure: Rebuild.
3418
8d63875c
ILT
34192009-06-23 Ian Lance Taylor <iant@google.com>
3420
3421 PR 10147
3422 * object.cc (Object::section_contents): Don't try to get a view if
3423 the section has length zero.
3424 (Object::handle_gnu_warning_section): If the section is empty, use
3425 the name of the section as the warning.
3426
f7c8a183
ILT
34272009-06-23 Ian Lance Taylor <iant@google.com>
3428
3429 PR 10133
3430 * stringpool.h (class Stringpool_template): Add optimize_ field.
3431 (Stringpool_template::set_optimize): New function.
3432 * stringpool.cc (Stringpool_template::Stringpool_template):
3433 Initialize optimize_ field.
3434 (Stringpool_template::set_string_offsets): Test local optimize
3435 fild rather than parameter.
3436 * layout.cc (Layout::Layout): Call set_optimize on the section
3437 name stringpool.
3438
e6a307ba
ILT
34392009-06-22 Ian Lance Taylor <iant@google.com>
3440
3441 PR 10030
3442 * yyscript.y: Parse TARGET.
3443 * script.cc (script_set_target): New function.
3444 * script-c.h (script_set_target): Declare.
3445 * options.cc (General_options::string_to_object_format): Rename
3446 from string_to_object_format in anonymous namespace. Change
3447 callers.
3448 * options.h (class General_options): Declare
3449 string_to_object_format.
3450
3ee173de
ILT
34512009-06-22 Ian Lance Taylor <iant@google.com>
3452
3453 * script-sections.cc (Script_sections::create_segments): Don't put
3454 program headers in a PT_LOAD segment if -n or -N.
3455
34562009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
3457
3458 PR 10141
3459 * options.h (class General_options): Add -z lazy and -z now. Sort
3460 -z options into alphabetical order.
3461 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
3462
cd6739a1 34632009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
3464
3465 * layout.cc (Layout::make_output_section): Call
3466 Target::new_output_section.
3467 (Layout::attach_allocated_section_to_segment): Put large section
3468 sections in a separate load segment with the large segment flag
3469 set.
3470 (Layout::segment_precedes): Sort large data segments after other
3471 load segments.
3472 (align_file_offset): New static function.
3473 (Layout::set_segment_offsets): Use align_file_offset.
3474 * output.h (class Output_section): Add is_small_section_ and
3475 is_large_section_ fields.
3476 (Output_section::is_small_section): New function.
3477 (Output_section::set_is_small_section): New function.
3478 (Output_section::is_large_section): New function.
3479 (Output_section::set_is_large_section): New function.
3480 (Output_section::is_large_data_section): New function.
3481 (class Output_segment): Add is_large_data_segment_ field.
3482 (Output_segment::is_large_data_segment): New function.
3483 (Output_segment::set_is_large_data_segment): New function.
3484 * output.cc (Output_section::Output_section): Initialize new
3485 fields.
3486 (Output_segment::Output_segment): Likewise.
3487 (Output_segment::add_output_section): Add assertion that large
3488 data sections always go in large data segments. Force small data
3489 sections to the end of the list of data sections. Force small BSS
3490 sections to the start of the list of BSS sections. For large BSS
3491 sections to the end of the list of BSS sections.
3492 * symtab.h (class Symbol): Declare is_common_shndx.
3493 (Symbol::is_defined): Check Symbol::is_common_shndx.
3494 (Symbol::is_common): Likewise.
3495 (class Symbol_table): Define enum Commons_section_type. Update
3496 declarations. Add small_commons_ and large_commons_ fields.
3497 * symtab.cc (Symbol::is_common_shndx): New function.
3498 (Symbol_table::Symbol_table): Initialize new fields.
3499 (Symbol_table::add_from_object): Put small and large common
3500 symbols in the right list.
3501 (Symbol_table::sized_finalized_symbol): Check
3502 Symbol::is_common_shndx.
3503 (Symbol_table::sized_write_globals): Likewise.
3504 * common.cc (Symbol_table::do_allocate_commons): Allocate new
3505 common symbol lists. Don't call do_allocate_commons_list if the
3506 list is empty.
3507 (Symbol_table::do_allocate_commons_list): Remove is_tls
3508 parameter. Add comons_section_type parameter. Change all
3509 callers. Handle small and large common symbols.
3510 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
3511 Symbol::is_common_shndx.
3512 * resolve.cc (symbol_to_bits): Likewise.
3513 * target.h (Target::small_common_shndx): New function.
3514 (Target::small_common_section_flags): New function.
3515 (Target::large_common_shndx): New function.
3516 (Target::large_common_section_flags): New function.
3517 (Target::new_output_section): New function.
3518 (Target::Target_info): Add small_common_shndx, large_common_shndx,
3519 small_common_section_flags, and large_common_section_flags
3520 fields.
3521 (Target::do_new_output_section): New virtual function.
3522 * arm.cc (Target_arm::arm_info): Initialize new fields.
3523 * i386.cc (Target_i386::i386_info): Likewise.
3524 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3525 Likewise.
3526 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
3527 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3528 (Target_x86_64::do_new_output_section): New function.
3529 * configure.ac: Define conditional MCMODEL_MEDIUM.
3530 * testsuite/Makefile.am (check_PROGRAMS): Add large.
3531 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
3532 (large_LDFLAGS): Define.
3533 * testsuite/large.c: New file.
3534 * testsuite/testfile.cc (Target_test::test_target_info):
3535 Initialize new fields.
3536 * configure, testsuite/Makefile.in: Rebuild.
3537
bb04269c
DK
35382009-06-05 Doug Kwan <dougkwan@google.com>
3539
3540 * Makefile.am (CCFILES): Add target.cc.
3541 * Makefile.in: Regenerate.
3542 * i386.cc (class Target_i386): Define new virtual method to
3543 override do_is_local_label_name in parent.
3544 * object.cc (Sized_relobj::do_count_local_symbols): Discard
3545 local symbols if --discard-locals or -X is given.
3546 * options.h (class General_options): Declare new options
3547 '--discard-locals' and '-X' for discarding locals.
3548 * target.h (class Target): Define new methods is_local_label_name.
3549 Declare new virtual method do_is_local_label_name.
3550 * target.cc: New file.
3551 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
3552 (check_SCRIPTS): Add discard_locals_test.sh.
3553 (check_DATA): Add discard_local_tests.syms.
3554 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
3555 (discard_local_tests.syms, discard_locals_test.o): New make rules.
3556 * testsuite/Makefile.in: Regenerate.
3557 * testsuite/discard_locals_test.c: New file.
3558 * testsuite/discard_locals_test.sh: Same.
3559
805bb01c
DK
35602009-06-05 Doug Kwan <dougkwan@google.com>
3561
3562 * object.cc (Sized_relobj::Sized_relobj): Initialize
3563 discarded_eh_frame_shndx_ to -1U.
3564 (Sized_relobj::do_layout): Record index of a discard .eh_frame
3565 section.
3566 (Sized_relobj::do_count_local_symbols): Skip local symbols in
3567 a discarded .eh_frame section.
3568 (Sized_relobj::do_finalize_local_symbols): Ditto.
3569 * object.h (class Sized_relobj): Declare new member
3570 discarded_eh_frame_shndx_.
3571 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
3572 (local_labels_test.o, local_labels_test): New rules.
3573 * testsuite/Makefile.in: Regenerate.
3574
1dcd334d
DK
35752009-06-04 Doug Kwan <dougkwan@google.com>
3576
3577 * layout.cc (Layout::section_name_mapping): Add mapping for
3578 special ARM sections.
3579
96d49306
DK
35802009-06-03 Doug Kwan <dougkwan@google.com>
3581
3582 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
3583 (utils::has_overflow): Same.
3584
dff16297
ILT
35852009-06-03 Ian Lance Taylor <iant@google.com>
3586
3587 * layout.cc (Layout::section_name_mapping): New array, replacing
3588 Layout::linkonce_mapping.
3589 (Layout::section_name_mapping_count): New variable, replacing
3590 Layout::linkonce_mapping_count.
3591 (Layout::linkonce_output_name): Remove.
3592 (Layout::output_section_name): Rewrite.
3593 * layout.h (class Layout): Rename Linkonce_mapping to
3594 Section_name_mapping, linkonce_mapping to section_name_mapping,
3595 linkonce_mapping_count to section_name_mapping_count. Don't
3596 declare linkonce_output_name.
3597
c121c671
DK
35982009-06-03 Doug Kwan <dougkwan@google.com>
3599
3600 * gold/arm.cc (namespace utils): New.
3601 (Target_arm::reloc_is_non_pic): Define new method.
3602 (class Arm_relocate_functions): New.
3603 (Target_arm::Relocate::relocate): Handle relocation types used by
3604 Android.
3605
07800fab
ILT
36062009-06-03 Ian Lance Taylor <iant@google.com>
3607
3608 * arm.cc (Target_arm::scan::global): Use || instead of |.
3609
c121c671
DK
36102009-06-02 Doug Kwan <dougkwan@google.com>
3611
3612 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
3613 issued_non_pic_error_.
3614 (class Target_arm::Scan): Declare new method check_non_pic.
3615 Define new method symbol_needs_plt_entry.
3616 Declare new data member issued_non_pic_error_.
3617 (class Target_arm::Relocate): Declare new method
3618 should_apply_static_reloc.
3619 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3620 (Target_arm::Scan::check_non_pic): Define new method.
3621 (Target_arm::Scan::local): Handle a small subset of reloc types used
3622 by Android.
3623 (Target_arm::Scan::local): Same.
3624 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3625
b19b0c6d
ILT
36262009-05-31 Mikolaj Zalewski <mikolajz@google.com>
3627
3628 * incremental.cc (Incremental_inputs::report_command_line): Filter
3629 out --incremental-* options.
3630
94cdfcff
DK
36312009-05-29 Doug Kwan <dougkwan@google.com>
3632
3633 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3634 template class.
3635 (class Target_arm): Update comment.
3636 (Target_arm::Target_arm): Initialize new data members GOT_,
3637 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3638 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3639 and Target_arm::rel_dyn_section.
3640 Declare new_enum Target_arm::Got_type.
3641 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3642 and DYNBSS_.
3643 Update commments for member do_dynsym_value.
3644 (Target_arm::got_size, Target_arm::plt_section,
3645 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3646 new methods inside class defintion.
3647 (Target_arm::got_section): Define new method.
3648 (Target_arm::rel_dyn_section): Same.
3649 (Output_data_plt_arm): New template class.
3650 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3651 (Output_data_plt_arm:do_adjust_output_section): Define new method.
3652 (Output_data_plt_arm::add_entry): Same.
3653 (Output_data_plt_arm::first_plt_entry): Define new
3654 static data member for PLT instruction template.
3655 (Output_data_plt_arm::plt_entry): Same.
3656 (Output_data_plt_arm::do_write): Define new method.
3657 (Target_arm::make_plt_entry): Same.
3658 (Target_arm::do_finalize_sections): Same.
3659 (Target_arm::do_dynsym_value): Same.
3660
4a657b0d
DK
36612009-05-28 Doug Kwan <dougkwan@google.com>
3662
3663 * Makefile.am (TARGETSOURCES): Add arm.cc.
3664 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
3665 * Makefile.in: Regenerate.
3666 * arm.cc: New file.
3667 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
3668
e7ae8c36
DK
36692009-05-26 Doug Kwan <dougkwan@google.com>
3670
3671 * options.cc (General_options::parse_exclude_libs). Fix a comment.
3672 (General_options::check_excluded_libs): Strip off directories in
3673 archive name before matching like GNU ld does.
3674 * testsuite/Makefile.am (MOSTLYCLEANFILES,
3675 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
3676 (exclude_libs_test_LDFLAGS): Add linker option
3677 -Wl,--exclude-libs,libexclude_libs_test_3
3678 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
3679 an explicit archive without using -l.
3680 (alt/libexclude_libs_test_3.a): New make rule.
3681 * testsuite/Makefile.in: Regenerate.
3682 * testsuite/exclude_libs_test.c : Declare lib3_default().
3683 (main): Call it.
3684 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
3685 * exclude_libs_test_3.c: New file.
3686
f12e7348
NC
36872009-05-26 Nick Clifton <nickc@redhat.com>
3688
3689 * po/id.po: New Indonesian translation.
3690 * po/gold.pot: Updated template file.
3691
4daadc0d
ST
36922009-05-22 Sriraman Tallam <tmsriram@google.com>
3693
3694 * testsuite/Makefile.am: Add -ffunction-sections to compile
3695 gc_comdat_test files. Add -Wl,--gc-sections to build
3696 gc_comdat_test.
3697 * testsuite/Makefile.in: Regenerate.
3698 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
3699
531813ad
ST
37002009-05-21 Sriraman Tallam <tmsriram@google.com>
3701
3702 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
3703 kept comdat section was garbage collected.
3704 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
3705 * testsuite/Makefile.in: Regenerate.
3706 * testsuite/gc_comdat_test.sh: New file.
3707 * testsuite/gc_comdat_test_1.cc: New file.
3708 * testsuite/gc_comdat_test_2.cc: New file.
3709
65514900
CC
37102009-05-19 Doug Kwan <dougkwan@google.com>
3711
3712 * archive.cc (Archive::Archive): Move constructor from archive.h
3713 to here. Initialize no_export_.
3714 (Archive::get_elf_object_for_member): Set no_export flag of object.
3715 * archive.h (Archive::Archive): Move constructor body to
3716 archive.cc.
3717 (Archive::no_export): New method.
3718 (Archive::no_export_): New field.
3719 * object.h (Object::Object): Initialize no_export_ to false.
3720 (Object::no_export, Object::set_no_export): New methods.
3721 (Object::no_export_): New field.
3722 * options.cc (General_options::parse_exclude_libs): New method.
3723 (General_options::check_excluded_libs) Same.
3724 * options.h (exclude_libs): New option.
3725 (General_options::check_excluded_libs): New method declaration.
3726 (General_options::excluded_libs_): New field.
3727 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
3728 default or protected visibility if an object has no-export flag set.
3729 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
3730 (check_SCRIPTS): Add exclude_libs_test.sh.
3731 (check_DATA): Add exclude_libs_test.syms.
3732 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
3733 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
3734 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
3735 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
3736 (exclude_libs_test.syms, libexclude_libs_test_1.a,
3737 libexclude_libs_test_2.a): New rules.
3738 * testsuite/Makefile.in: Regenerate.
3739 * testsuite/exclude_libs_test.c: New file.
3740 * testsuite/exclude_libs_test.sh: Ditto.
3741 * testsuite/exclude_libs_test_1.c: Ditto.
3742 * testsuite/exclude_libs_test_2.c: Ditto.
3743
1b77ea50
ILT
37442009-05-15 Ian Lance Taylor <iant@google.com>
3745
3746 * configure.ac: Check for declarations for cases where libiberty.h
3747 checks HAVE_DECL_xxx.
3748 * configure, config.in: Rebuild.
3749
072fe7ce
ILT
37502009-05-15 Mikolaj Zalewski <mikolajz@google.com>
3751
3752 * gold.h (Incremental_argument_list): Remove (invalid) forward
3753 declaration.
3754 * incremental.cc (Incremental_inputs::report_achive): New method.
3755 (Incremental_inputs::report_object): New method.
3756 (Incremental_inputs::report_script): New method.
3757 (Incremental_inputs::finalize_inputs): New method.
3758 (Incremental_inputs::finalize): Call finalize_inputs().
3759 (Incremental_inputs::sized_create_incremental_inputs_section_data):
3760 Create inputs entries.
3761 * incremental.h (Incremental_input_type): New enum.
3762 (Incremental_inputs::Incremental_input): Initialize new fields.
3763 (Incremental_inputs::report_inputs): New method.
3764 (Incremental_inputs::report_achive): New method.
3765 (Incremental_inputs::report_object): New method.
3766 (Incremental_inputs::report_script): New method.
3767 (Incremental_inputs::finalize_inputs): New method.
3768 (Incremental_inputs::Input_info): New struct.
3769 (Incremental_inputs::Input_info_map): New typedef.
3770 (Incremental_inputs::lock_): New field.
3771 (Incremental_inputs::Inputs_): New field.
3772 (Incremental_inputs::Inputs_map): New field.
3773 * main.cc (main): Call Incremental_input::report_inputs.
3774 * options.h (Input_argument_list): Typedef moved from
3775 Input_arguments.
3776 (Input_file_group::Files): Remove, use ::Input_argument_list.
3777 (Input_file_group::Input_argument_list): Remove, use
3778 ::Input_argument_list.
3779 * plugin.cc (Plugin_manager::add_input_file): Add error in
3780 incremental build.
3781 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
3782 functions.
3783 * script.cc (read_input_script): Call
3784 Incremental_input::report_script.
3785 * script.h (Script_info): New class.
3786
b0481b0b
ILT
37872009-04-27 Ian Lance Taylor <iant@google.com>
3788
3789 * x86_64.cc (do_adjust_output_section): Set entsize to
3790 plt_entry_size.
3791
b22a5a41 37922009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
3793
3794 * output.cc (Output_file::close): After short writes, continue
3795 writing from the correct offset in the buffer being written.
3796
40fde488
CD
37972009-04-23 Chris Demetriou <cgd@google.com>
3798
3799 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
3800 * configure: Regenerate.
3801 * config.in: Regenerate.
3802 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
3803 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
3804
3ce2c28e
ILT
38052009-04-21 Mikolaj Zalewski <mikolajz@google.com>
3806
3807 * incremental.cc (Incremental_inputs_header_data): Renamed from
3808 Incremental_input_header_data.
3809 (Incremental_inputs_header_data::data_size): New field.
3810 (Incremental_inputs_header_data::put_input_file_count): Renamed
3811 from input_file_count.
3812 (Incremental_inputs_header_data::put_command_line_offset): Renamed
3813 from command_line_offset.
3814 (Incremental_inputs_header_data::put_reserved): Renamed from
3815 put_reserved.
3816 (Incremental_inputs_entry_data): Renamed from
3817 Incremental_input_entry_data.
3818 (Incremental_inputs_entry_data::data_size): New field.
3819 (Incremental_inputs::report_command_line): New method.
3820 (Incremental_inputs::finalize): New method.
3821 (Incremental_inputs::create_incremental_inputs_data): New method.
3822 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3823 * incremental.h: New file.
3824 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3825 (Layout::finalize): Create incremental inputs section in
3826 incremental builds.
3827 (Layout::create_incremental_info_sections): New method.
3828 * layout.h (Layout::incremental_inputs): New method.
3829 (Layout::create_incremental_info_sections): New method.
3830 (Layout::incremental_inputs_): New field.
3831 * main.cc (main): Notify Incremental_input of the command line.
3832
e55bde5e
ILT
38332009-04-01 Ian Lance Taylor <iant@google.com>
3834 Mikolaj Zalewski <mikolajz@google.com>
3835
3836 * gold.h (reserve_unordered_map): Define, three versions, one for
3837 each version of Unordered_map.
3838 * layout.cc (Layout::Layout): Remove options parameter. Add
3839 number_of_input_files parameter. Don't initialize options_.
3840 Initialize number_of_input_files_ and resized_signatures_. Move
3841 sections_are_attached_.
3842 (Layout::layout_group): Reserve space for group_signatures_.
3843 (Layout::find_or_add_kept_section): Change name parameter to be a
3844 reference. Resize signatures_ map when it gets large enough.
3845 (Layout::layout_eh_frame): Use parameters->options() instead of
3846 this->options_.
3847 (Layout::make_output_section): Likewise.
3848 (Layout::attach_allocated_section_to_segment): Likewise.
3849 (Layout::finalize, Layout::create_executable_stack): Likewise.
3850 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3851 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3852 * layout.h (class Layout): Update declarations. Remove options_
3853 field. Add number_of_input_files_ and resized_signatures_
3854 fields. Move sections_are_attached_ field.
3855 * main.cc (main): Pass number of input files to Layout
3856 constructor. Don't pass options.
3857
154b857c
ILT
38582009-03-30 Ian Lance Taylor <iant@google.com>
3859
3860 * ffsll.c (ffsll): Correct implementation.
3861
2f35ab9b
ILT
38622009-03-27 Ian Lance Taylor <iant@google.com>
3863
fd03461a
ILT
3864 * ffsll.c: New file.
3865 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3866 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3867 * ftruncate.c (ftruncate): Declare before definition.
3868 * mremap.c (mremap): Likewise.
3869 * pread.c (pread): Likewise.
3870 * configure, Makefile.in, config.in: Rebuild.
3871
2f35ab9b
ILT
3872 * mremap.c: New file.
3873 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3874 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3875 (mremap): Declare if HAVE_MREMAP is not defined.
3876 * configure, Makefile.in, config.in: Rebuild.
3877
33aea2fd
CC
38782009-03-27 Cary Coutant <ccoutant@google.com>
3879
3880 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3881 position independent.
3882 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3883 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3884
6d479619
CC
38852009-03-24 Cary Coutant <ccoutant@google.com>
3886
3887 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3888 an executable.
3889 (needs_dynamic_reloc): Likewise.
3890
afc06bb8
ILT
38912009-03-24 Ian Lance Taylor <iant@google.com>
3892
3893 * yyscript.y (file_cmd): Recognize EXTERN.
3894 (extern_name_list, extern_name_list_body): New nonterminals.
3895 * script.cc (script_add_extern): Define.
3896 * script-c.h (script_add_extern): Declare.
3897
f6060a4d
ILT
38982009-03-24 Rafael Avila de Espindola <espindola@google.com>
3899
3900 * object.cc (is_elf_object): Define.
3901 * object.h (is_elf_object): Declare.
3902 * archive.cc (Archive::get_elf_object_for_member): Call
3903 is_elf_object.
33aea2fd 3904 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 3905
26736d8e
ILT
39062009-03-24 Elliott Hughes <enh@google.com>
3907
3908 * output.cc (Output_file::map_anonymous): Define.
3909 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3910 try an anonymous one. Report the size if the mmap fails.
3911 * output.h (class Output_file): Declare map_anonymous.
3912
22fd9730
ILT
39132009-03-24 Ian Lance Taylor <iant@google.com>
3914
3915 * target-select.cc (instantiate_target): Don't acquire the lock if
3916 the instantiated_target_ field has already been set.
3917
cb010894
ILT
39182009-03-23 Ian Lance Taylor <iant@google.com>
3919
7f055c20
ILT
3920 * gold-threads.h (class Initialize_lock): Define.
3921 * gold-threads.cc (class Initialize_lock_once): Define.
3922 (initialize_lock_control): New static variable.
3923 (initialize_lock_pointer): New static variable.
3924 (initialize_lock_once): New static function.
3925 (Initialize_lock::Initialize_lock): Define.
3926 (Initialize_lock::initialize): Define.
3927 * target-select.h: Include "gold-threads.h".
3928 (class Target_selector): Add lock_ and initialize_lock_ fields.
3929 Don't define instantiate_target, just declare it.
3930 * target-select.cc (Target_selector::Target_selector): Initialize
3931 new fields.
3932 (Target_selector::instantiate_target): Define.
3933 * descriptors.h: Include "gold-threads.h".
3934 (class Descriptors): Add initialize_lock_ field.
3935 * descriptors.cc (Descriptors::Descriptors): Initialize new
3936 field.
3937 (Descriptors::open): Use initialize_lock_ field
3938 * errors.h (class Errors): Add initialize_lock_ field.
3939 * errors.cc (Errors::Errors): Initialize new field.
3940 (Errors::initialize_lock): Use initialize_lock_ field.
3941 * powerpc.cc (class Target_selector_powerpc): Remove
3942 instantiated_target_ field. In do_recognize call
3943 instantiate_target rather than do_instantiate_target. In
3944 do_instantiate_target just allocate a new target.
3945 * sparc.cc (class Target_selector_sparc): Likewise.
3946
36959681
ILT
3947 * freebsd.h: New file.
3948 * i386.cc: Include "freebsd.h".
3949 (Target_i386): Derive from Target_freebsd rather than
3950 Sized_target.
3951 (Target_selector_i386): Derive from Target_selector_freebsd rather
3952 than Target_selector.
3953 * x86_64.cc: Include "freebsd.h".
3954 (Target_x86_64): Derive from Target_freebsd rather than
3955 Sized_target.
3956 (Target_selector_x86_64): Derive from Target_selector_freebsd
3957 rather than Target_selector.
3958 * target.h (class Target): Add adjust_elf_header and
3959 do_adjust_elf_header.
3960 * output.cc (Output_file_header:: do_sized_write): Call target
3961 adjust_elf_header routine.
3962 * configure.tgt: Set targ_osabi.
3963 * configure.ac: Define GOLD_DEFAULT_OSABI.
3964 * parameters.cc (Parameters::default_target): Pass
3965 GOLD_DEFAULT_OSABI to select_target.
3966 * target-select.h (class Target_selector): Make instantiate_target
3967 protected rather than private.
3968 * Makefile.am (HFILES): Add freebsd.h.
3969 * configure, Makefile.in, config.in: Rebuild.
3970
cb010894
ILT
3971 * merge.cc (do_add_input_section): Correct pend value. Change
3972 message about last entry not being null terminated from error to
3973 warning.
3974
0e879927
ILT
39752009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3976
3977 * incremental.cc: New file.
3978 * Makefile.am (CCFILES): Add incremental.cc.
3979 * Makefile.in: Rebuild.
3980
41105937
PP
39812009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3982
3983 * layout.cc (Layout::output_section_name): Preserve names
3984 of '.note.' sections.
3985
60439920
ILT
39862009-03-19 Ian Lance Taylor <iant@google.com>
3987
3988 * descriptors.cc (Descriptors::open): Check that the options are
3989 valid before using them.
3990
0d371ad3
ILT
39912009-03-18 Ian Lance Taylor <iant@google.com>
3992
3993 * script-sections.h: Include <list>.
3994 (class Script_sections): Change Sections_elements from std::vector
3995 to std::list. Typedef public Elements_iterator. Add
3996 orphan_section_placement_, data_segment_align_start_, and
3997 saw_data_segment_align_ fields. Remove data_segment_align_index_
3998 field.
3999 * script-sections.cc (class Orphan_section_placement): New class.
4000 (class Sections_element): Add virtual functions is_relro and
4001 orphan_section_init. Remove virtual function place_orphan_here.
4002 (class Output_section_definition): Add is_relro and
4003 orphan_section_init. Remove place_orphan_here.
4004 (class Orphan_output_section): Likewise.
4005 (Script_sections::Script_sections): Update for field changes.
4006 (Script_sections::data_segment_align): Set saw_data_segment_align_
4007 and data_segment_align_start_, not data_segment_align_index.
4008 (Script_sections::data_segment_relro_end): Check
4009 saw_data_segment_align_. Use data_segment_align_start_ rather
4010 than data_segment_align_index_.
4011 (Script_sections::place_orphan): Rewrite to use
4012 Orphan_section_placement.
4013
9201d894
ILT
40142009-03-17 Ian Lance Taylor <iant@google.com>
4015
9c5b8369
ILT
4016 * archive.cc (Archive::add_symbols): Check for a version attached
4017 to the symbol name in the archive map.
4018 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
4019 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
4020 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
4021 (ver_test_11.a): New target.
4022 * testsuite/Makefile.in: Rebuild.
4023
9201d894
ILT
4024 * configure.ac: Check for chsize and posix_fallocate. Replace
4025 ftruncate.
4026 * ftruncate.c: New file, from gnulib.
4027 * output.cc (posix_fallocate): Define dummy version if not
4028 HAVE_POSIX_FALLOCATE.
4029 (Output_file::map): Call posix_fallocate rather than lseek and
4030 write.
4031 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
4032 * configure, Makefile.in, config.in: Rebuild.
4033
ef4ab7a8
PP
40342009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
4035
4036 * layout.h (Layout::create_note): Add section_name parameter.
4037 * layout.cc (Layout::create_note): Likewise.
4038 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
4039
8c500701
ILT
40402009-03-17 Ian Lance Taylor <iant@google.com>
4041
e85b18e1
ILT
4042 * descriptors.cc: Include "options.h".
4043 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
4044 (Descriptors::open): Always use O_CLOEXEC when opening a new
4045 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
4046 then set FD_CLOEXEC.
4047
9efe6174
ILT
4048 * sparc.cc (class Target_sparc): Add has_got_section.
4049 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
4050 make sure we have a GOT section.
4051
4052 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
4053 (Target_sparc::Scan::local): Likewise.
4054 (Target_sparc::Scan::global): Likewise.
4055 (Target_sparc::Relocate::relocate): Likewise.
4056 (Target_sparc::Relocate::relocate_tls): Likewise.
4057
8c500701
ILT
4058 * symtab.cc (Symbol_table::define_default_version): New function,
4059 broken out of add_from_object.
4060 (Symbol_table::add_from_object): Call define_default_version.
4061 (Symbol_table::define_special_symbol): Add resolve_oldsym
4062 parameter. Change all callers. If the version for a symbol comes
4063 from a version script, resolve it with the symbol with the same
4064 name with no version. Also add the symbol without a version if
4065 appropriate.
4066 (do_define_in_output_data): If resolving with oldsym, don't delete
4067 sym.
4068 (do_define_in_output_segment): Likewise.
4069 (do_define_as_constant): Likewise.
4070 * symtab.h (class Symbol_table): Update declarations.
4071
f1ed28fb
ILT
40722009-03-13 Ian Lance Taylor <iant@google.com>
4073
15f8229b
ILT
4074 * readsyms.cc (Read_symbols::incompatible_warning): New function.
4075 (Read_symbols::requeue): New function.
4076 (Read_symbols::do_read_symbols): If make_elf_object fails because
4077 the target type is not configured, and the file was searched for,
4078 issue a warning and retry with the next directory.
4079 (Add_symbols::run): If the file has an incompatible format, and
4080 it was searched for, requeue the Read_symbols task. On error,
4081 release the object.
4082 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
4083 dirindex parameter to constructor. Change all callers. Declare
4084 incompatible_warning and requeue.
4085 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
4086 input_argument_ and input_group_ fields. Add them to
4087 constructor. Change all callers.
4088 (class Read_script): Add dirindex_ field. Add it to constructor.
4089 Change all callers.
4090 * archive.cc (Archive::setup): Remove input_objects parameter.
4091 Change all callers.
4092 (Archive::get_file_and_offset): Likewise.
4093 (Archive::read_all_symbols): Likewise.
4094 (Archive::read_symbols): Likewise.
4095 (Archive::get_elf_object_for_member): Remove input_objects
4096 parameter. Add punconfigured parameter. Change all callers.
4097 (Archive::add_symbols): Change return type to bool. Check return
4098 value of include_member.
4099 (Archive::include_all_members): Likewise.
4100 (Archive::include_member): Change return type to bool. Return
4101 false if first included object has incompatible target. Set
4102 included_member_ field.
4103 (Add_archive_symbols::run): If add_symbols returns false, requeue
4104 Read_symbols task.
4105 * archive.h (class Archive): Add included_member_ field.
4106 Initialize it in constructor. Add input_file and searched_for
4107 methods. Update declarations.
4108 (class Add_archive_symbols): Add dirpath_, dirindex_, and
4109 input_argument_ fields. Add them to constructor. Change all
4110 callers.
4111 * script.cc: Include "target-select.h".
4112 (class Parser_closure): Add skip_on_incompatible_target_ and
4113 found_incompatible_target_ fields. Add
4114 skip_on_incompatible_target parameter to constructor. Change all
4115 callers. Add methods skip_on_incompatible_target,
4116 clear_skip_on_incompatible_target, found_incompatible_target, and
4117 set_found_incompatible_target.
4118 (read_input_script): Add dirindex parameter. Change all callers.
4119 If parser finds an incompatible target, requeue Read_symbols
4120 task.
4121 (script_set_symbol): Clear skip_on_incompatible_target in
4122 closure.
4123 (script_add_assertion, script_parse_option): Likewise.
4124 (script_start_sections, script_add_phdr): Likewise.
4125 (script_check_output_format): New function.
4126 * script.h (read_input_script): Update declaration.
4127 * script-c.h (script_check_output_format): Declare.
4128 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
4129 (ignore_cmd): Remove OUTPUT_FORMAT.
4130 * fileread.cc (Input_file::Input_file): Add explicit this.
4131 (Input_file::will_search_for): New function.
4132 (Input_file::open): Add pindex parameter. Change all callers.
4133 * fileread.h (class Input_file): Add input_file_argument method.
4134 Declare will_search_for. Update declarations.
4135 * object.cc (make_elf_object): Add punconfigured parameter.
4136 Change all callers.
4137 * object.h (class Object): Make input_file public. Add
4138 searched_for method.
4139 (make_elf_object): Update declaration.
4140 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
4141 restart search.
4142 * dirsearch.h (class Dirsearch): Update declaration.
4143 * options.h (class General_options): Add --warn-search-mismatch.
4144 * parameters.cc (Parameters::is_compatible_target): New function.
4145 * parameters.h (class Parameters): Declare is_compatible_target.
4146 * workqueue.cc (Workqueue::add_blocker): New function.
4147 * workqueue.h (class Workqueue): Declare add_blocker.
4148
f1ed28fb
ILT
4149 * fileread.cc (Input_file::open): Remove options parameter.
4150 Change all callers.
4151 (Input_file::open_binary): Likewise.
4152 * script.cc (read_input_script): Likewise.
4153 * readsyms.h (class Read_symbols): Remove options_ field. Remove
4154 options parameter from constructor. Change all callers.
4155 (class Read_script): Likewise.
4156 * fileread.h (class Input_file): Update declarations.
4157 * script.h (read_input_script): Update declaration.
4158
34dd024a
NC
41592009-03-10 Nick Clifton <nickc@redhat.com>
4160
4161 * po/es.po: New Spanish translation.
4162
6d71b17c
CC
41632009-03-06 Cary Coutant <ccoutant@google.com>
4164
4165 * options.cc (parse_short_option): Keep dash_z from registering itself.
4166
031cdbed
ILT
41672009-03-03 Ian Lance Taylor <iant@google.com>
4168
4169 PR 9918
4170 * target-reloc.h (relocate_section): Pass output_section to
4171 relocate.
4172 * i386.cc (Target_i386::should_apply_static_reloc): Add
4173 output_section parameter. Change all callers.
4174 (Target_i386::Relocate::relocate): Add output_section parameter.
4175 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4176 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
4177 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
4178 * testsuite/two_file_shared.sh: New script.
4179 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
4180 (check_DATA): Add two_file_shared.dbg.
4181 (two_file_shared.dbg): New target.
4182 * testsuite/Makefile.in: Rebuild.
4183
15d5fa16
ILT
41842009-03-01 Ian Lance Taylor <iant@google.com>
4185
4186 * configure.ac: Check for byteswap.h.
4187 * configure: Rebuild.
4188 * config.in: Rebuild.
4189
8a4c0b0d
ILT
41902009-03-01 Mikolaj Zalewski <mikolajz@google.com>
4191
4192 * layout.cc (Layout::find_or_add_kept_section): New function.
4193 (Layout::add_comdat): Removed.
4194 * layout.h (struct Kept_section): Move out of class Layout.
4195 Remove trailing underscores from field names. Add group_sections
4196 field. Rename group_ field to is_group. Change all uses.
4197 (class Layout): Declare find_or_add_kept_section, not add_comdat.
4198 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
4199 comdat_groups_ field.
4200 (Sized_relobj::include_section_group): Use
4201 find_or_add_kept_section and Kept_section::group_sections.
4202 (Sized_relobj::include_linkonce_section): Likewise.
4203 * object.cc (class Sized_relobj): Don't define Comdat_group or
4204 Comdat_group_table. Remove find_comdat_group and
4205 add_comdat_group. Remove comdat_groups_ field.
4206 * plugin.cc (include_comdat_group): Use
4207 Layout::find_or_add_kept_section.
4208
b4ecf66b
ILT
42092009-02-28 Ian Lance Taylor <iant@google.com>
4210
14359ca0
ILT
4211 * README: --gc-sections and map files are now supported. Document
4212 some build requirements.
4213
b4ecf66b
ILT
4214 PR 6992
4215 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
4216 relocatable link set the value of the section symbol to zero.
4217 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
4218 relocatable link don't include the section address in the local
4219 symbol value.
4220
0602e05a
ILT
42212009-02-27 Ian Lance Taylor <iant@google.com>
4222
fd9d194f
ILT
4223 PR 6811
4224 * options.h (class Search_directory): Add is_system_directory.
4225 (class General_options): Declare is_in_system_directory.
4226 * options.cc (get_relative_sysroot): Make static.
4227 (get_default_sysroot): Make static.
4228 (General_optoins::is_in_system_directory): New function.
4229 * fileread.cc (Input_file::is_in_system_directory): New function.
4230 * fileread.h (class Input_file): Declare is_in_system_directory.
4231 * object.h (class Object): Add is_in_system_directory.
4232 (class Input_objects): Remove system_library_directory_ field.
4233 * object.cc (Input_objects::add_object): Don't set
4234 system_library_directory_.
4235 (input_objects::found_in_system_library_directory): Remove.
4236 * symtab.cc (Symbol_table::write_globals): Remove input_objects
4237 parameter. Change all callers.
4238 (Symbol_table::sized_write_globals): Likewise.
4239 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
4240 Call Object::is_in_system_directory.
4241 * symtab.h (class Symbol_table): Update declarations.
4242
61edd21f
ILT
4243 PR 5990
4244 * descriptors.h (Open_descriptor): Add is_on_stack field.
4245 * descriptors.cc (Descriptors::open): If the descriptor is on the
4246 top of the stack, remove it. Initialize is_on_stack field.
4247 (Descriptors::release): Only add pod to stack if it is not on the
4248 stack already.
4249 (Descriptors::close_some_descriptor): Clear stack_next and
4250 is_on_stack fields.
4251
e29e076a
ILT
4252 PR 7091
4253 * output.cc (Output_section::find_starting_output_address): Rename
4254 from starting_output_address; add PADDR parameter; change return
4255 type.
4256 * output.h (class Output_section): Declare
4257 find_starting_output_address instead of starting_output_address.
4258 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
4259 section symbol for which we can't find a merge section.
4260
0602e05a
ILT
4261 PR 9836
4262 * symtab.cc (Symbol_table::add_from_object): If the visibility is
4263 hidden or internal, force the symbol to be local.
4264 * resolve.cc (Symbol::override_visibility): Define.
4265 (Symbol::override_base): Use override_visibility.
4266 (Symbol_table::resolve): Likewise.
4267 (Symbol::override_base_with_special): Likewise.
4268 (Symbol_table::override_with_special): If the visibility is hidden
4269 or internal, force the symbol to be local.
4270 * symtab.h (class Symbol): Add set_visibility and
4271 override_visibility.
4272 * testsuite/ver_test_1.sh: New file.
4273 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
4274 (check_DATA): Add ver_test_1.syms.
4275 (ver_test_1.syms): New target.
4276 * testsuite/Makefile.in: Rebuild.
4277
401a9a73
CC
42782009-02-25 Cary Coutant <ccoutant@google.com>
4279
4280 * layout.cc (Layout::choose_output_section): Don't rename sections
4281 when using a linker script that has a SECTIONS clause.
4282 * Makefile.in: Regenerate.
4283
4284 * testsuite/Makefile.am (script_test_5.sh): New test case.
4285 * testsuite/Makefile.in: Regenerate.
4286 * testsuite/script_test_5.cc: New file.
4287 * testsuite/script_test_5.sh: New file.
4288 * testsuite/script_test_5.t: New file.
4289
f488e4b0
CC
42902009-02-13 Rafael Avila de Espindola <espindola@google.com>
4291
4292 * archive.cc (Archive::include_member): Update calls to add_symbols.
4293 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
4294 the Layout argument.
4295 * dynobj.h (do_add_symbols): Add the Layout argument.
4296 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
4297 Layout argument.
4298 * object.h (Object::add_symbols): Add the Layout argument.
4299 (Object::do_add_symbols): Add the Layout argument.
4300 (Sized_relobj::do_add_symbols): Add the Layout argument.
4301 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
4302 Unify the two versions.
4303 (Add_plugin_symbols): Remove.
4304 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
4305 (Sized_pluginobj::do_add_symbols): Unify the two versions.
4306 (Add_plugin_symbols): Remove.
4307 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
4308 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
4309 (Add_symbols::run): Make it work with Pulginobj.
4310
89dd1680
ILT
43112009-02-06 Ian Lance Taylor <iant@google.com>
4312
4313 * object.cc (Sized_relobj::do_layout): Make info message start
4314 with lower case letter.
4315
266d0a74
ILT
43162009-02-06 Mikolaj Zalewski <mikolajz@google.com>
4317
602b464e
ILT
4318 * binary.cc: Fix file comment.
4319
266d0a74
ILT
4320 * options.h (enum Incremental_disposition): Define.
4321 (class General_options): Add new options: --incremental,
4322 --incremental_changed, --incremental_unchanged,
4323 --incremental_unknown. Add incremental_disposition_ and
4324 implicit_incremental_ fields.
4325 (General_options::incremental_disposition): New function.
4326 (class Position_dependent_options): Add incremental_disposition
4327 option.
4328 (Position_dependent_options::copy_from_options): Set incremental
4329 dispositions.
4330 * options.cc (General_options::parse_incremental_changed): New
4331 function.
4332 (General_options::parse_incremental_unchanged): New function.
4333 (General_options::parse_incremental_unknown): New function.
4334 (General_options::General_options): Initialize new fields
4335 incremental_disposition_ and implicit_incremental_.
4336 (General_options::finalize): Check for uasge of --incremental-*
4337 without --incremental.
4338
f073bbf7
CD
43392009-02-06 Chris Demetriou <cgd@google.com>
4340
4341 * gold.h (gold_undefined_symbol): Change to take only a Symbol
4342 pointer and to report location as the file name associated with
4343 the symbol.
4344 (gold_undefined_symbol_at_location): New function to replace the
4345 old gold_undefined_symbol functionality.
4346 * target-reloc.h (relocate_section): Update to use
4347 gold_undefined_symbol_at_location.
4348 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4349 Call gold_undefined_symbol function rather than gold_error.
4350 * errors.h (Errors::undefined_symbol): Take location as a
4351 string, rather than calculating it from a relocation.
4352 * errors.cc (Errors::fatal): Print "fatal error:" before the
4353 formatted message.
4354 (Errors::error, Errors::error_at_location): Print "error: "
4355 before the formatted message.
4356 (Errors::undefined_symbol): Take location as a string, rather
4357 than calculating it from a relocation.
4358 (gold_undefined_symbol_at_location): New function akin to
4359 old gold_undefined_symbol, calculates location from relocation.
4360 (gold_undefined_symbol): Change to take only a Symbol pointer
4361 and to report location as the file name associated with the symbol.
4362 * testsuite/debug_msg.sh: Update for changed error messages.
4363 * testsuite/undef_symbol.sh: Likewise.
4364
8e94a90c
ILT
43652009-02-04 Duncan Sands <baldrick@free.fr>
4366
4367 PR 9812
4368 * reduced_debug_output.h
4369 (Output_reduced_debug_abbrev_section::failed): Use format for
4370 gold_warning.
4371 (Output_reduced_debug_info_section::faild): Likewise.
4372
88a0e15b
ILT
43732009-01-31 Mikolaj Zalewski <mikolajz@google.com>
4374
4375 * script.cc (Lazy_demangler): New class.
4376 (Version_script_info::get_symbol_version_helper): Demangle a
4377 symbol only once.
4378
5efc7cd2
CC
43792009-01-29 Cary Coutant <ccoutant@google.com>
4380
4381 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
4382 to __tls_get_addr.
4383 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4384
e0ebcf42
ILT
43852009-01-28 Ian Lance Taylor <iant@google.com>
4386
5efc7cd2 4387 * version.cc (version_string): Bump to 1.9.
75fe7426 4388
e0ebcf42
ILT
4389 * gold.h: Include <cstring> and <stdint.h>.
4390 * version.cc: Include <cstdio>.
4391 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
4392 warning.
4393 * reduced_debug_output.cc (insert_into_vector): Rename from
4394 Insert_into_vector; change all callers. Use Swap_unaligned to
4395 avoid aliasing issue; remove union since it is unnecessary.
4396
8e2813be 43972009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
4398
4399 * Makefile.am (CCFILES): Add gc.cc.
4400 (HFILES): Add gc.h.
4401 * Makefile.in: Regenerate.
4402 * gold.cc (Gc_runner): New class.
4403 (queue_initial_tasks): Call garbage collection related tasks
4404 when corresponding options are invoked.
4405 (queue_middle_gc_tasks): New function.
4406 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
4407 processed early before laying out sections during garbage collection.
4408 * gold.h (queue_middle_gc_tasks): New function.
4409 (is_prefix_of): Move from "layout.cc".
4410 * i386.cc (Target_i386::gc_process_relocs): New function.
4411 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
4412 * main.cc (main): Create object of class "Garbage_collection".
4413 * object.cc (Relobj::copy_symbols_data): New function.
4414 (Relobj::is_section_name_included): New function.
4415 (Sized_relobj::do_layout): Allow this function to be called twice
4416 during garbage collection and defer layout of section during the
4417 first call.
4418 * object.h (Relobj::get_symbols_data): New function.
4419 (Relobj::is_section_name_included): New function.
4420 (Relobj::copy_symbols_data): New function.
4421 (Relobj::set_symbols_data): New function.
4422 (Relobj::get_relocs_data): New function.
4423 (Relobj::set_relocs_data): New function.
4424 (Relobj::is_output_section_offset_invalid): New pure virtual function.
4425 (Relobj::gc_process_relocs): New function.
4426 (Relobj::do_gc_process_relocs): New pure virtual function.
4427 (Relobj::sd_): New data member.
4428 (Sized_relobj::is_output_section_offset_invalid): New function.
4429 (Sized_relobj::do_gc_process_relocs): New function.
4430 * options.h (General_options::gc_sections): Modify to not be a no-op.
4431 (General_options::print_gc_sections): New option.
4432 * plugin.cc (Plugin_finish::run): Remove function call to
4433 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
4434 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
4435 * reloc.cc (Read_relocs::run): Add task to process relocs and
4436 determine unreferenced sections when doing garbage collection.
4437 (Gc_process_relocs): New class.
4438 (Sized_relobj::do_gc_process_relocs): New function.
4439 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
4440 sections that are garbage collected.
4441 * reloc.h (Gc_process_relocs): New class.
4442 * sparc.cc (Target_sparc::gc_process_relocs): New function.
4443 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
4444 symbols whose corresponding sections are garbage collected.
4445 (Symbol_table::Symbol_table): Add new parameter for the garbage
4446 collection object.
4447 (Symbol_table::gc_mark_undef_symbols): New function.
4448 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4449 (Symbol_table::gc_mark_dyn_syms): New function.
4450 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
4451 as garbage.
4452 (Symbol_table::add_from_object): Likewise.
4453 (Symbol_table::add_from_relobj): When building shared objects, do not
4454 treat externally visible symbols as garbage.
4455 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
4456 table information for static and relocatable links.
4457 * symtab.h (Symbol_table::set_gc): New function.
4458 (Symbol_table::gc): New function.
4459 (Symbol_table::gc_mark_undef_symbols): New function.
4460 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4461 (Symbol_table::gc_mark_dyn_syms): New function.
4462 (Symbol_table::gc_): New data member.
4463 * target.h (Sized_target::gc_process_relocs): New pure virtual
4464 function.
4465 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
4466 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
4467
3b293544
CF
44682009-01-20 Chris Faylor <me.sourceware@sourceware.org>
4469
4470 * options.h (General_options::gc_sections): Define as a no-op for now.
4471 (General_options::no_keep_memory): Ditto.
4472 (General_options::Bshareable): Define.
4473 * options.cc (General_options::finalize): Honor -Bshareable.
4474
83d22aa8
AS
44752009-01-20 Andreas Schwab <schwab@suse.de>
4476
4477 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
4478 read the value in the contents, since we don't use it. Use the
4479 template endianness when writing.
4480 (Relocate::relocate): Use it for R_PPC_REL16_HA.
4481
cd536b21
AS
44822009-01-19 Andreas Schwab <schwab@suse.de>
4483
4484 * configure.tgt (powerpc64-*): Fix targ_obj.
4485
99e9a495
ILT
44862009-01-15 Ian Lance Taylor <iant@google.com>
4487
4488 * object.cc (Sized_relobj::write_local_symbols): Don't write out
4489 local symbols when stripping all symbols.
4490
bbbfea06
CC
44912009-01-14 Cary Coutant <ccoutant@google.com>
4492
99e9a495 4493 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 4494
0f7c0701
CC
44952009-01-14 Cary Coutant <ccoutant@google.com>
4496
4497 * archive.cc (Archive::get_elf_object_for_member): Remove call
4498 to File_read::claim_for_plugin.
4499 * descriptors.cc (Descriptors::open): Remove reference to
4500 is_claimed.
4501 (Descriptors::claim_for_plugin): Remove.
4502 * descriptors.h (Descriptors::claim_for_plugin): Remove.
4503 (Descriptors::is_claimed): Remove.
4504 (claim_descriptor_for_plugin): Remove.
4505 * fileread.cc (File_read::claim_for_plugin): Remove.
4506 * fileread.h (File_read::claim_for_plugin): Remove.
4507 (File_read::descriptor): Reopen descriptor if necessary.
4508 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
4509 (Plugin_manager::all_symbols_read): Add task parameter. Change
4510 all callers.
4511 (Plugin_manager::get_input_file): New function.
4512 (Plugin_manager::release_input_file): New function.
4513 (Pluginobj::Pluginobj): Add filesize parameter and initialize
4514 corresponding data member.
4515 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
4516 and pass to base constructor. Change all callers.
4517 (get_input_file, release_input_file): New functions.
4518 (make_sized_plugin_object): Add filesize parameter. Change all callers.
4519 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
4520 (Plugin_manager::all_symbols_read): Add task parameter.
4521 (Plugin_manager::get_input_file): New function.
4522 (Plugin_manager::release_input_file): New function.
4523 (Plugin_manager::task_): New data member.
4524 (Pluginobj::Pluginobj): Add filesize parameter.
4525 (Pluginobj::filename): New function.
4526 (Pluginobj::descriptor): New function.
4527 (Pluginobj::filesize): New function.
4528 (Pluginobj::filesize_): New data member.
4529 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
4530 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
4531 File_read::claim_for_plugin; use Object::unlock to unlock the file.
4532
4533 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
4534 with archive libraries.
4535 * testsuite/Makefile.in: Regenerate.
4536 * testsuite/plugin_test.c (struct sym_info): New type.
4537 (get_input_file, release_input_file): New static variables.
4538 (onload): Capture new transfer vector entries.
4539 (claim_file_hook): Stop reading at end of file according to filesize.
4540 Factor out parsing of readelf output into separate function.
4541 (all_symbols_read_hook): Exercise get_input_file and release_input_file
4542 APIs and get the source file name from the symbol table. Convert
4543 source file name to corresponding object file name. Print info
4544 message when adding new input files.
4545 (parse_readelf_line): New function.
4546 * testsuite/plugin_test_1.sh: Add checks for new info messages.
4547 * testsuite/plugin_test_2.sh: Likewise.
4548 * testsuite/plugin_test_3.sh: Likewise.
4549 * testsuite/plugin_test_4.sh: New test case.
4550
62a6d109
ILT
45512009-01-07 Ian Lance Taylor <iant@google.com>
4552
4553 * version.cc (version_string): Bump to 1.8.
4554
483620e8
CC
45552008-12-23 Cary Coutant <ccoutant@google.com>
4556
4557 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
4558 * plugin.cc (Plugin_manager::finish): Rename as
4559 layout_deferred_objects. Move cleanup to separate function.
4560 (Plugin_manager::cleanup): New function.
4561 (Plugin_finish::run): Call layout_deferred_objects and cleanup
4562 separately.
4563 * plugin.h (Plugin_manager::finish): Rename as
4564 layout_deferred_objects.
4565 (Plugin_manager::cleanup): New function.
4566 (Plugin_manager::cleanup_done): New field.
4567
d66a9eb3
CC
45682008-12-23 Cary Coutant <ccoutant@google.com>
4569
4570 * plugin.cc (is_visible_from_outside): New function.
4571 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
4572 so we don't return "IR only" status for exported symbols or -r links.
4573
4574 * testsuite/Makefile.am (plugin_test_3): New test case.
4575 * testsuite/Makefile.in: Regenerate.
4576 * testsuite/plugin_test_3.sh: New file.
4577
5995b570
CC
45782008-12-22 Cary Coutant <ccoutant@google.com>
4579
4580 * object.cc (Sized_relobj::layout_section): New function.
4581 (Sized_relobj::do_layout): Defer layout of input sections until after
4582 plugin has provided replacement files.
4583 (Sized_relobj::do_layout_deferred_sections): New function.
4584 * object.h (Relobj::set_section_offset): Remove virtual keyword.
4585 (Relobj::layout_deferred_sections): New function.
4586 (Relobj::do_layout_deferred_sections): New function.
4587 (Sized_relobj::do_layout_deferred_sections): New function.
4588 (Sized_relobj::layout_section): New function.
4589 (Sized_relobj::Deferred_layout): New structure.
4590 (Sized_relobj::deferred_layout_): New field.
4591 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
4592 Change all callers. Layout deferred sections.
4593 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
4594 references.
4595 (Plugin_hook::run): Move code from do_plugin_hook inline.
4596 (Plugin_hook::do_plugin_hook): Remove.
4597 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
4598 (Plugin_manager::finish): Renamed, was cleanup.
4599 (Plugin_manager::should_defer_layout): New function.
4600 (Plugin_manager::add_deferred_layout_object): New function.
4601 (Plugin_manager::Deferred_layout_list): New type.
4602 (Plugin_manager::deferred_layout_objects_): New field.
4603 (Plugin_hook::do_plugin_hook): Remove.
4604
ee769c88
ILT
46052008-12-17 Ian Lance Taylor <iant@google.com>
4606
4607 * options.h (class General_options): Add --no case for
4608 --export-dynamic.
4609
abc8dcba
CC
46102008-12-16 Cary Coutant <ccoutant@google.com>
4611
4612 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
4613 vector.
4614 (Plugin_manager::claim_file): Create plugin object even if
4615 plugin did not call the add_symbols callback.
4616 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4617 asking for more symbols than were added.
4618 * testsuite/Makefile.am (plugin_test_1): Add test case with
4619 no global symbols.
4620 (empty.syms): New target.
4621 * testsuite/Makefile.in: Regenerate.
4622 * testsuite/plugin_test.c (claim_file_hook): Add new debug
4623 message. Don't call add_symbols if no globals.
4624 (all_symbols_read_hook): Don't provide replacement for empty
4625 claimed file.
4626
b0074644
ILT
46272008-12-12 Ian Lance Taylor <iant@google.com>
4628
68943102
ILT
4629 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4630 r_type == 0 for a local symbol with r_sym == 0.
4631 (scan_relocatable_relocs): Pass r_sym to
4632 local_non_section_strategy.
4633 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4634 r_sym parameter.
4635
b0074644
ILT
4636 * configure.ac: Update test for TLS descriptors: they are
4637 supported as of glibc 2.9.
4638 * configure: Rebuild.
4639
c2508178
ILT
46402008-12-11 Ian Lance Taylor <iant@google.com>
4641
4642 PR 7091
4643 * target-reloc.h (Default_scan_relocatable_relocs): For each
4644 function, map r_type == 0 to RELOC_DISCARD.
4645
2756a258
CC
46462008-12-10 Cary Coutant <ccoutant@google.com>
4647
4648 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4649 object to override a kept COMDAT group from a plugin object.
4650
bb6f53d3
ILT
46512008-12-09 Ian Lance Taylor <iant@google.com>
4652
fbc558e1
ILT
4653 PR 7088
4654 * yyscript.y (file_cmd): Handle INPUT.
4655
bb6f53d3
ILT
4656 * testsuite/initpri1.c: Change all declarations to be full
4657 prototypes by adding void, to avoid compiler warnings.
4658
4674ecfc
CC
46592008-12-05 Rafael Avila de Espindola <espindola@google.com>
4660
4661 * options.cc (General_options::parse_plugin_opt): New.
4662 (General_options::add_plugin): The argument now is just the filename.
4663 (General_options::add_plugin_option): New.
4664 * options.h (plugin_opt): New.
4665 (add_plugin): Change argument name.
4666 (add_plugin_option): New.
4667 * plugin.cc (Plugin::load): Don't parse the plugin option.
4668 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
4669 (Plugin::add_option): New.
4670 (Plugin::args_): Change type.
4671 (Plugin::filename_): New.
4672 (Plugin_manager::add_plugin_option): New.
4673 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
4674 * testsuite/Makefile.in: Regenerate.
4675
fd06b4aa
CC
46762008-12-05 Cary Coutant <ccoutant@google.com>
4677
4678 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4679 Handle --strip-lto-sections option.
4680 * options.h (strip_lto_sections): New option.
4681
6c52134c
CC
46822008-12-01 Cary Coutant <ccoutant@google.com>
4683
4684 * plugin.cc (ld_plugin_message): Change format parameter to const.
4685 Fix mismatch between new[] and delete.
4686
a45248e0
CC
46872008-11-14 Cary Coutant <ccoutant@google.com>
4688
4689 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
4690 instead of -1U.
4691
c82fbeee
CS
46922008-11-05 Craig Silverstein <csilvers@google.com>
4693
4694 * options.cc (General_options::parse_dynamic_list): New function.
4695 * options.h (General_options): New flags dynamic_list,
4696 dynamic_list_data, dynamic_list_cpp_new, and
4697 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
4698 (General_options::in_dynamic_list): New function.
4699 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
4700 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
4701 (Lex::can_continue_name): Likewise.
4702 (yylex): Likewise.
4703 (read_script_file): New parameter script_options.
4704 (read_dynamic_list): New function.
4705 (Script_options::define_dynamic_list): New function.
4706 (dynamic_list_keyword_parsecodes): New variable.
4707 (dynamic_list_keywords): New variable.
4708 * script.h (Script_options::define_dynamic_list): New function
4709 prototype.
4710 (read_dynamic_list): New function prototype.
4711 * symtab.cc (strprefix): New macro.
4712 (Symbol::should_add_dynsym_entry): Support dynamic_list,
4713 dynamic_list_data, dynamic_list_cpp_new, and
4714 dynamic_list_cpp_typeinfo.
4715 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
4716 (dynamic_list_expr): New rule.
4717 (dynamic_list_nodes): Likewise.
4718 (dynamic_list_node): Likewise.
4719 * testsuite/Makefile.am (dynamic_list): New test.
4720 * testsuite/Makefile.in: Regenerated.
4721 * testsuite/dynamic_list.t: New file.
4722 * testsuite/dynamic_list.sh: New file.
4723
e0bb29a5
CS
47242008-11-05 Craig Silverstein <csilvers@google.com>
4725
4726 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
4727 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
4728 (t11_last): Likewise.
4729 * testsuite/ver_test_6.c (main): Likewise.
4730
4e1e25e0
CC
47312008-10-07 Cary Coutant <ccoutant@google.com>
4732
4733 * options.c (General_options::finalize): Add check for -static and
4734 -shared.
4735 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
4736 is not empty.
4737
92f03fcb
CC
47382008-10-02 Cary Coutant <ccoutant@google.com>
4739
4740 * plugin.cc (make_sized_plugin_object): Fix conditional
4741 compilation to work when not all targets are enabled.
4742
fbd8a257
CC
47432008-09-29 Cary Coutant <ccoutant@google.com>
4744
4745 * archive.cc (Archive::get_file_and_offset): Use filename instead
4746 of name to get library path.
4747 (Archive::include_member): Unlock external member of a thin archive.
4748
4749 * testsuite/Makefile.am (TEST_AR): New variable.
4750 (thin_archive_test_1): New test.
4751 (thin_archive_test_2): New test.
81636b3f
CC
4752 * testsuite/Makefile.in: Regenerate.
4753 * testsuite/thin_archive_main.cc: New file.
4754 * testsuite/thin_archive_test_1.cc: New file.
4755 * testsuite/thin_archive_test_2.cc: New file.
4756 * testsuite/thin_archive_test_3.cc: New file.
4757 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 4758
eff45813
CC
47592008-09-29 Cary Coutant <ccoutant@google.com>
4760
4761 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
4762 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
4763 instead of -1U.
4764 (Sized_relobj::do_finalize_local_symbols): Likewise.
4765 (Sized_relobj::map_to_kept_section): Likewise.
4766 * object.h (Sized_relobj::invalid_address): New constant.
4767 (Sized_relobj::do_output_section_offset): Check for invalid_address
4768 and return -1ULL.
4769 * output.cc (Output_reloc::local_section_offset): Use constant
4770 invalid_address instead of -1U.
4771 (Output_reloc::get_address): Likewise.
4772 (Output_section::output_address): Change -1U to -1ULL.
4773 * output.h (Output_reloc::invalid_address): New constant.
4774 * reloc.cc (Sized_relobj::write_sections): Use constant
4775 invalid_address instead of -1U.
4776 (Sized_relobj::relocate_sections): Likewise.
4777 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
4778 values for merge sections.
4779 * target-reloc.h (relocate_for_relocatable): Use constant
4780 invalid_address instead of -1U.
4781
89fc3421
CC
47822008-09-19 Cary Coutant <ccoutant@google.com>
4783
4784 Add plugin functionality for link-time optimization (LTO).
4785 * configure.ac (plugins): Add --enable-plugins option.
4786 * configure: Regenerate.
4787 * config.in: Regenerate.
4788 * Makefile.am (LIBDL): New variable.
4789 (CCFILES): Add plugin.cc.
4790 (HFILES): Add plugin.h.
4791 (ldadd_var): Add LIBDL.
4792 * Makefile.in: Regenerate.
4793
4794 * archive.cc: Include "plugin.h".
4795 (Archive::setup): Don't preread archive symbols when using a plugin.
4796 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
4797 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
4798 files.
4799 (Archive::include_member): Add symbols from plugin objects.
4800 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
4801 * descriptors.cc (Descriptors::open): Check for file descriptors
4802 abandoned by plugins.
4803 (Descriptors::claim_for_plugin): New function.
4804 * descriptors.h (Descriptors::claim_for_plugin): New function.
4805 (Open_descriptor::is_claimed): New field.
4806 (claim_descriptor_for_plugin): New function.
4807 * fileread.cc (File_read::claim_for_plugin): New function.
4808 * fileread.h (File_read::claim_for_plugin): New function.
4809 (File_read::descriptor): New function.
4810 * gold.cc: Include "plugin.h".
4811 (queue_initial_tasks): Add task to call plugin hooks for generating
4812 new object files.
4813 * main.cc: Include "plugin.h".
4814 (main): Load plugin libraries.
4815 * object.h (Pluginobj): Declare.
4816 (Object::pluginobj): New function.
4817 (Object::do_pluginobj): New function.
4818 (Object::set_target): New function.
4819 * options.cc: Include "plugin.h".
4820 (General_options::parse_plugin): New function.
4821 (General_options::General_options): Initialize plugins_ field.
4822 (General_options::add_plugin): New function.
4823 * options.h (Plugin_manager): Declare.
4824 (General_options): Add --plugin option.
4825 (General_options::has_plugins): New function.
4826 (General_options::plugins): New function.
4827 (General_options::add_plugin): New function.
4828 (General_options::plugins_): New field.
4829 * plugin.cc: New file.
4830 * plugin.h: New file.
4831 * readsyms.cc: Include "plugin.h".
4832 (Read_symbols::do_read_symbols): Check for archive before checking
4833 for ELF file. Call plugin hooks to claim files.
4834 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4835 from a real object file; force override when processing replacement
4836 files.
4837 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4838 (Symbol::init_base_object): Likewise.
4839 (Symbol::init_base_output_data): Likewise.
4840 (Symbol::init_base_output_segment): Likewise.
4841 (Symbol::init_base_constant): Likewise.
4842 (Symbol::init_base_undefined): Likewise.
4843 (Symbol::output_section): Assert that object is not a plugin.
4844 (Symbol_table::add_from_pluginobj): New function.
4845 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4846 undefined.
4847 (Symbol_table::sized_write_globals): Likewise.
4848 (Symbol_table::add_from_pluginobj): Instantiate template.
4849 * symtab.h (Sized_pluginobj): Declare.
4850 (Symbol::in_real_elf): New function.
4851 (Symbol::set_in_real_elf): New function.
4852 (Symbol::in_real_elf_): New field.
4853 (Symbol_table::add_from_pluginobj): New function.
4854
4855 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4856 (LIBDL): New variable.
4857 (LDADD): Add LIBDL.
4858 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4859 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4860 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4861 (MOSTLYCLEANFILES): Likewise.
4862 * testsuite/Makefile.in: Regenerate.
4863 * testsuite/plugin_test.c: New file.
4864 * testsuite/plugin_test_1.sh: New file.
4865 * testsuite/plugin_test_2.sh: New file.
4866
de31bda5
ILT
48672008-09-16 Ian Lance Taylor <iant@google.com>
4868
9c2d0ef9
ILT
4869 * target-reloc.h (relocate_section): Check whether a symbol is
4870 defined by the ABI before reporting an undefined symbol error.
4871 * target.h (Target::is_defined_by_abi): Make parameter const.
4872 (Target::do_is_defined_by_abi): Likewise.
4873 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4874 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4875 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4876 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4877 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4878 * testsuite/Makefile.in: Rebuild.
4879
de31bda5
ILT
4880 * fileread.cc (make_view): Add casts to avoid warning.
4881
9fa33bee
AO
48822008-09-16 Alexandre Oliva <aoliva@redhat.com>
4883
4884 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4885 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4886
183fd0e3
AO
48872008-09-16 Alexandre Oliva <aoliva@redhat.com>
4888
4889 * options.h (General_options::output_is_executable): New.
4890 (General_options::output_is_pie): New.
4891 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4892 for shared libraries.
4893 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4894
7be8330a
CD
48952008-09-11 Chris Demetriou <cgd@google.com>
4896
4897 * options.h (origin): New -z option.
4898 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4899 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4900 in DT_FLAGS_1.
4901
a9caad02
CC
49022008-09-05 Cary Coutant <ccoutant@google.com>
4903
4904 * fileread.cc (File_read::make_view): Add check for attempt to map
4905 beyond end of file.
4906
ae6dce4d
CC
49072008-09-05 Cary Coutant <ccoutant@google.com>
4908
4909 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4910 explicit instantiations.
4911
d7ab2a47
KVH
49122008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4913
4914 PR gold/6858
4915 * options.cc (General_options::finalize): Allow undefined symbols
4916 in shlibs if linking -shared.
4917
4918 PR gold/6859
4919 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4920 symbols as not needing a dynsym entry.
4921
1e52a9c1
CS
49222008-08-20 Craig Silverstein <csilvers@google.com>
4923
4924 * fileread.cc (File_read::open): Do not lock the file unless it
4925 was successfully opened.
4926
d85c80a3
CC
49272008-08-14 Cary Coutant <ccoutant@google.com>
4928
4929 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4930 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4931 * testsuite/tls_test.cc (struct int128): 128-bit struct
4932 for testing TLS relocs with non-zero addend.
4933 (v12): New TLS variable.
4934 (t12): New test.
4935 (t_last): Add check for v12.
4936 * testsuite/tls_test.h (t12): New function.
4937 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4938
2d924fd9
ILT
49392008-08-13 Ian Lance Taylor <iant@google.com>
4940
4941 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4942 set tls_segment_ or relro_segment_.
4943 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4944 when appropriate.
4945 * output.h (Output_section::clear_is_relro): New function.
4946 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4947 sections specially even when output_data_ is empty.
4948 (Output_segment::maximum_alignment): When first section is relro,
4949 only force alignment for PT_LOAD segments.
4950 * script.cc (script_data_segment_align): New function.
4951 (script_data_segment_relro_end): New function.
4952 * script-c.h (script_data_segment_align): Declare.
4953 (script_data_segment_relro_end): Declare.
4954 * script-sections.h (class Script_sections): Declare
4955 data_segment_align and data_segment_relro_end. Add fields
4956 segment_align_index_ and saw_relro_end_.
4957 * script-sections.cc (class Sections_element): Add set_is_relro
4958 virtual function. Add new bool* parameter to place_orphan_here.
4959 Add get_output_section virtual function.
4960 (class Output_section_definition): Add set_is_relro. Add new
4961 bool* parameter to place_orphan_here. Add get_output_section.
4962 Add is_relro_ field.
4963 (Output_section_definition::Output_section_definition): Initialize
4964 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4965 and is_relro_ fields.
4966 (Output_section_definition::place_orphan_here): Add is_relro
4967 parameter.
4968 (Output_section_definition::set_section_addresses): Set relro for
4969 output section.
4970 (Output_section_definition::alternate_constraint): Likewise.
4971 (class Orphan_output_section): Add new bool* parameter to
4972 place_orphan_here. Add get_output_section.
4973 (Orphan_output_section::place_orphan_here): Add is_relro
4974 parameter.
4975 (Script_sections::Script_sections): Initialize
4976 data_segment_align_index_ and saw_relro_end_.
4977 (Script_sections::data_segment_align): New function.
4978 (Script_sections::data_segment_relro_end): New function.
4979 (Script_sections::place_orphan): Set or clear is_relro.
4980 (Script_sections::set_section_addresses): Force alignment of first
4981 TLS section.
4982 * yyscript.y (exp): Call script_data_segment_align and
4983 script_data_segment_relro_end.
4984 * testsuite/relro_script_test.t: New file.
4985 * testsuite/relro_test.cc (using_script): Declare.
4986 (t1, t2): Test using_script.
4987 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4988 (relro_script_test_SOURCES): Define.
4989 (relro_script_test_DEPENDENCIES): Define.
4990 (relro_script_test_LDFLAGS): Define.
4991 (relro_script_test_LDADD): Define.
4992 (relro_script_test.so): New target.
4993 * testsuite/Makefile.in: Rebuild.
4994
f827c9a9
CC
49952008-08-06 Cary Coutant <ccoutant@google.com>
4996
4997 * archive.cc (Archive::total_archives, Archive::total_members)
4998 (Archive::total_members_loaded): New variables.
4999 (Archive::setup): Add parameter. Add option to preread
5000 archive symbols.
5001 (Archive::read_armap): Add counter.
5002 (Archive::get_file_and_offset): New function.
5003 (Archive::get_elf_object_for_member): New function.
5004 (Archive::read_all_symbols): New function.
5005 (Archive::read_symbols): New function.
5006 (Archive::add_symbols): Add counters.
5007 (Archive::include_all_members): Use armap to find members if it's
5008 already built.
5009 (Archive::include_member): Skip reading symbols if already read.
5010 Factored code into Archive::get_file_and_offset and
5011 Archive::get_elf_object_for_member. Changed call to
5012 Mapfile::report_include_archive_member.
5013 (Archive::print_stats): New function.
5014 * archive.h: Declare Object and Read_symbols_data classes.
5015 (Archive::Archive): Add initializers for new members.
5016 (Archive::setup): Add parameter.
5017 (Archive::print_stats): New function.
5018 (Archive::total_archives, Archive::total_members)
5019 (Archive::total_members_loaded): New variables.
5020 (Archive::get_file_and_offset): New function.
5021 (Archive::get_elf_object_for_member): New function.
5022 (Archive::read_all_symbols): New function.
5023 (Archive::read_symbols): New function.
5024 (Archive::Archive_member): New class.
5025 (Archive::members_): New member.
5026 (Archive::num_members_): New member.
5027 * main.cc: Include archive.h.
5028 (main): Call Archive::print_stats.
5029 * mapfile.cc (Mapfile::report_include_archive_member): Delete
5030 archive parameter; member_name is now the fully-decorated name.
5031 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
5032 * options.h: (General_options): Add --preread-archive-symbols option.
5033 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
5034 Archive::setup.
5035
de4c45bd
ILT
50362008-08-04 Ian Lance Taylor <iant@google.com>
5037
5038 * symtab.h (Symbol::use_plt_offset): New function.
5039 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
5040 * powerpc.cc (Relocate::relocate): Likewise.
5041 * sparc.cc (Relocate::relocate): Likewise.
5042 * x86_64.cc (Relocate::relocate): Likewise.
5043 * testsuite/weak_plt.sh: New test.
5044 * testsuite/weak_plt_main.cc: New test.
5045 * testsuite/weak_plt_shared.cc: New test.
5046 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
5047 (check_PROGRAMS): Add weak_plt.
5048 (check_DATA): Add weak_plt_shared.so.
5049 (weak_plt_main_pic.o, weak_plt): New targets.
5050 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
5051 * testsuite/Makefile.in: Rebuild.
5052
5053 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
5054 gcctestdir/ld.
5055 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
5056 * testsuite/Makefile.in: Rebuild.
5057
323ee3f4
AM
50582008-08-04 Alan Modra <amodra@bigpond.net.au>
5059
5060 * Makefile.am (POTFILES.in): Set LC_ALL=C.
5061 * Makefile.in: Regenerate.
5062 * po/POTFILES.in: Regenerate.
5063
7c07ecec
ILT
50642008-07-29 Ian Lance Taylor <iant@google.com>
5065
5066 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
5067 symbols before other symbols.
5068 * testsuite/script_test_2.cc (test_addr): Declare.
5069 (test_addr_alias): Declare.
5070 (main): Check that test_addr and test_addr_alias have the right
cd536b21 5071 values.
7c07ecec
ILT
5072 * testsuite/script_test_2.t: Define test_addr_alias and
5073 test_addr.
5074
5778530e
ILT
50752008-07-24 Ian Lance Taylor <iant@google.com>
5076
2a00e4fb
ILT
5077 PR 5990
5078 * descriptors.cc: New file.
5079 * descriptors.h: New file.
5080 * gold-threads.h (class Hold_optional_lock): New class.
5081 * fileread.cc: Include "descriptors.h".
5082 (File_read::~File_read): Release descriptor rather than closing
5083 it.
5084 (File_read::open) [file]: Call open_descriptor rather than open.
5085 Set is_descriptor_opened_.
5086 (File_read::open) [memory]: Assert that descriptor is not open.
5087 (File_read::reopen_descriptor): New function.
5088 (File_read::release): Release descriptor.
5089 (File_read::do_read): Make non-const. Reopen descriptor.
5090 (File_read::read): Make non-const.
5091 (File_read::make_view): Reopen descriptor.
5092 (File_read::do_readv): Likewise.
5093 * fileread.h (class File_read): Add is_descriptor_opened_ field.
5094 Update declarations.
5095 * layout.cc: Include "descriptors.h".
5096 (Layout::create_build_id): Use open_descriptor rather than open.
5097 * output.cc: Include "descriptors.h".
5098 (Output_file::open): Use open_descriptor rather than open.
5099 * archive.cc (Archive::const_iterator): Change Archive to be
5100 non-const.
5101 (Archive::begin, Archive::end): Make non-const.
5102 (Archive::count_members): Likewise.
5103 * archive.h (class Archive): Update declarations.
5104 * object.h (Object::read): Make non-const.
5105 * Makefile.am (CCFILES): Add descriptors.cc.
5106 (HFILES): Add descriptors.h.
5107 * Makefile.in: Rebuild.
5108
801647d1
ILT
5109 PR 6716
5110 * gold.h: Always include <clocale>. Add Solaris workarounds
5111 following code in binutils/sysdep.h.
5112
5edd166e
ILT
5113 PR 6048
5114 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
5115 this->eh_frame_hdr_ is NULL before using it.
5116
c89ad728
ILT
5117 * dynobj.cc (Versions::Versions): Update comment.
5118
aa86f06b
ILT
5119 * dynobj.cc (Versions::Versions): If there is an soname, use it as
5120 the base version name.
5121
5778530e
ILT
5122 * stringpool.cc (Stringpool_template::add_with_length): Set key to
5123 array size plus one.
5124 (Stringpool_template::set_string_offsets): Subtract one from key
5125 before using it as an array index.
5126 (Stringpool_template::get_offset_with_length): Likewise.
5127 (Stringpool_template::write_to_buffer): Likewise.
5128 * stringpool.h (Stringpool_template::get_offset_from_key):
5129 Likewise.
5130
057ead22
ILT
51312008-07-23 Ian Lance Taylor <iant@google.com>
5132
7f649c59
ILT
5133 PR 6658
5134 * object.h (Merged_symbol_value::value): Do our best to handle a
5135 negative addend.
5136
057ead22
ILT
5137 PR 6647
5138 * script.cc (Version_script_info::get_versions): Don't add empty
5139 version tag to return value.
5140 (Version_script_info::get_symbol_version_helper): Change return
5141 type to bool. Add pversion parameter. Change all callers.
5142 (script_register_vers_node): Don't require a non-NULL tag.
5143 * script.h (class Version_script_info): Update declarations.
5144 (Version_script_info::get_symbol_version): Change return type to
5145 bool. Add version parameter. Change all callers.
5146 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
5147 handling. Handle an empty version from a version script.
5148 (Symbol_table::define_special_symbol): Likewise.
5149 * testsuite/ver_test_10.script: New file.
5150 * testsuite/ver_test_10.sh: New file.
5151 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
5152 (check_DATA): Add ver_test_10.syms.
5153 (ver_test_10.syms, ver_test_10.so): New target.
5154 * testsuite/Makefile.in: Rebuild.
5155
58e54ac2
CD
51562008-07-23 Simon Baldwin <simonb@google.com>
5157
5158 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
5159 to zero for undefined symbols from dynamic libraries.
5160
95d14cd3
ILT
51612008-07-23 Ian Lance Taylor <iant@google.com>
5162
5163 * symtab.cc (Symbol_table::resolve): Remove version parameter.
5164 Change all callers.
5165 * symtab.h (class Symbol_table): Update declaration.
5166 * testsuite/ver_test_9.cc: New file.
5167 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
5168 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
5169 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
5170 (ver_test_9.so, ver_test_9.o): New targets.
5171 * testsuite/Makefile.in: Rebuild.
5172
92de84a6
ILT
51732008-07-22 Ian Lance Taylor <iant@google.com>
5174
34810851
ILT
5175 * options.h (class General_options): Define --check-sections.
5176 * layout.cc (Layout::set_segment_offsets): Handle
5177 --check-sections.
5178
af6156ef
ILT
5179 * options.h (class General_options): Define -n/--nmagic and
5180 -N/--omagic.
5181 * options.cc (General_options::finalize): For -n/--nmagic or
5182 -N/--omagic, set -static.
5183 * layout.cc (Layout::attach_allocated_section_to_segment): If
5184 -N/--omagic, don't put read-only and read-write sections in
5185 different segments.
5186 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
5187 finding a read-only segment.
5188 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
5189 don't set the minimum segment alignment to the common page size,
5190 and don't set the file offset to the address modulo the page size.
5191 * script-sections.cc (Script_sections::create_segments): If
5192 -n/--omagic, don't put read-only and read-write sections in
5193 different segments.
5194
92de84a6
ILT
5195 * cref.cc: New file.
5196 * cref.h: New file.
5197 * options.h (class General_options): Add --print-symbol-counts.
5198 * main.cc (main): Issue defined symbol report if requested.
5199 * archive.cc (Archive::interpret_header): Make into a const member
5200 function.
5201 (Archive::add_symbols): Call Input_objects::archive_start and
5202 archive_stop.
5203 (Archive::const_iterator): Define new class.
5204 (Archive::begin, Archive::end): New functions.
5205 (Archive::include_all_members): Rewrite to use iterator.
5206 (Archive::count_members): New function.
5207 * archive.h (class Archive): Update declarations.
5208 (Archive::filename): New function.
5209 * object.cc: Include "cref.h".
5210 (Sized_relobj::Sized_relobj): Initialize defined_count_.
5211 (Sized_relobj::do_get_global_symbol_counts): New function.
5212 (Input_objects::add_object): Add object to cross-referencer.
5213 (Input_objects::archive_start): New function.
5214 (Input_objects::archive_stop): New function.
5215 (Input_objects::print_symbol_counts): New function.
5216 * object.h: Declare Cref and Archive.
5217 (Object::get_global_symbol_counts): New function.
5218 (Object::do_get_global_symbol_counts): New pure virtual function.
5219 (class Sized_relobj): Add defined_count_ field. Update
5220 declarations.
5221 (class Input_objects): Add cref_ field. Update constructor.
5222 Update declarations.
5223 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
5224 defined_count_.
5225 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
5226 symbol counts.
5227 (Sized_dynobj::do_get_global_symbol_counts): New function.
5228 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
5229 defined_count_. Update declarations. Define Symbols typedef.
5230 * symtab.cc (Symbol_table::add_from_relobj): Add defined
5231 parameter. Change all callers.
5232 (Symbol_table::add_from_dynobj): Add sympointers and defined
5233 parameters. Change all callers.
5234 * symtab.h (class Symbol_table): Update declarations.
5235 * Makefile.am (CCFILES): Add cref.cc.
5236 (HFILES): Add cref.h.
5237 * Makefile.in: Rebuild.
5238
3f7c5e1d
CD
52392008-07-22 Simon Baldwin <simonb@google.com>
5240
5241 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
5242 to zero when writing undefined symbols.
5243
e0b64032
ILT
52442008-07-22 Ian Lance Taylor <iant@google.com>
5245
5246 * output.cc (Output_section::add_input_section): Don't try to
5247 merge empty merge sections.
5248
096b02cf
CS
52492008-07-21 Craig Silverstein <csilvers@google.com>
5250
5251 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
5252 Include symbol version in error message.
cd536b21 5253
1d1f116d
CD
52542008-07-20 Chris Demetriou <cgd@google.com>
5255
cd536b21 5256 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
5257 (RANDOM_SEED_CFLAGS): New substituted variable.
5258 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
5259 * configure: Rebuild.
5260 * Makefile.in: Likewise.
5261 * testsuite/Makefile.in: Likewise.
5262
a18f591e
ILT
52632008-07-18 Ian Lance Taylor <iant@google.com>
5264
5265 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
5266 where we see NAME/NULL and NAME/VERSION as separate symbols.
5267 * testsuite/ver_test_main.cc (main): Call t4.
5268 (t4, t4_2a): Define.
5269 * testsuite/ver_test_2.cc (t4_2): Define.
5270 * testsuite/ver_test_2.script: Put t4_2a in VER2.
5271 * testsuite/ver_test_4.cc (t4_2a): Define.
5272 * testsuite/ver_test_4.script: Put t4_2a in VER2.
5273 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
5274
c6e3f6ed
ILT
52752008-07-17 Ian Lance Taylor <iant@google.com>
5276
5277 * dynobj.cc (Versions::add_def): If we give an error about a
5278 missing version, go ahead and create the version anyhow.
5279
ef9beddf
ILT
52802008-07-10 Ian Lance Taylor <iant@google.com>
5281
5282 Handle output sections with more than 0x7fffffff bytes.
5283 * object.h (class Relobj): Change map_to_output_ to
5284 output_sections_, and just keep a section pointer. Change all
5285 uses. Move comdat group support to Sized_relobj.
5286 (Relobj::is_section_specially_mapped): Remove.
5287 (Relobj::output_section): Remove poff parameter. Change all
5288 callers.
5289 (Relobj::output_section_offset): New function.
5290 (Relobj::set_section_offset): Rewrite.
5291 (Relobj::map_to_output): Remove.
5292 (Relobj::output_sections): New function.
5293 (Relobj::do_output_section_offset): New pure virtual function.
5294 (Relobj::do_set_section_offset): Likewise.
5295 (class Sized_relobj): Add section_offsets_ field. Add comdat
5296 group support from Relobj. Update declarations.
5297 (Sized_relobj::get_output_section_offset): New function.
5298 (Sized_relobj::do_output_section_offset): New function.
5299 (Sized_relobj::do_set_section_offset): New function.
5300 * object.cc (Relobj::output_section_address): Remove.
5301 (Sized_relobj::Sized_relobj): Initialize new fields.
5302 (Sized_relobj::include_section_group): Cast find_kept_object to
5303 Sized_relobj.
5304 (Sized_relobj::include_linkonce_section): Likewise.
5305 (Sized_relobj::do_layout): Use separate arrays for output section
5306 and output offset.
5307 (Sized_relobj::do_count_local_symbols): Change map_to_output to
5308 output_sections.
5309 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
5310 output_sections and section_offsets.
5311 (Sized_relobj::write_local_symbols): Likewise.
5312 (map_to_kept_section): Compute output address directly.
5313 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
5314 output_sections and section_offsets.
5315 (Sized_relobj::write_sections): Likewise.
5316 (Sized_relobj::relocate_sections): Likewise.
5317 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
5318 * output.h (class Output_reloc): Update declarations. Change
5319 u2_.relobj to Sized_relobj*.
5320 (class Output_data_reloc): Change add functions to use
5321 Sized_relobj*.
5322 * output.cc (Output_reloc::Output_reloc): Change relobj to
5323 Sized_relobj*.
5324 (Output_reloc::local_section_offset): Change return type to
5325 Elf_Addr. Use get_output_section_offset.
5326 (Output_reloc::get_address): Likewise.
5327 (Output_section::is_input_address_mapped): Don't call
5328 is_section_specially_mapped.
5329 (Output_section::output_offset): Likewise.
5330 (Output_section::output_address): Likewise.
5331 (Output_section::starting_output_address): Likewise.
5332 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
5333 parameter to Sized_relobj*.
5334 (Copy_relocs::need_copy_reloc): Likewise.
5335 (Copy_relocs::save): Likewise.
5336 * copy-relocs.h (class Copy_relocs): Update declarations.
5337 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
5338 Sized_relobj*. Change relobj_ field to Sized_relobj*.
5339 * target-reloc.h (relocate_for_relocatable): Change
5340 offset_in_output_section type to Elf_Addr. Change code that uses
5341 it as well.
5342 * layout.cc (Layout::layout): Always set *off.
5343 * mapfile.cc (Mapfile::print_input_section): Use
5344 output_section_offset.
5345 * i386.cc (Target_i386::copy_reloc): Change object parameter to
5346 Sized_relobj*.
5347 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
5348 * sparc.cc (Target_sparc::copy_reloc): Likewise.
5349 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
5350
5cb66f97
ILT
53512008-07-03 Ian Lance Taylor <iant@google.com>
5352
5353 * layout.cc (Layout::include_section): Do not discard unrecognized
5354 SHT_STRTAB sections.
5355
afe47622
CS
53562008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
5357
5358 * script.cc (Lex::can_continue_name): Make '?' allowable in
5359 version-script names.
5360 * testsuite/version_script.map: Change glob pattern to use '?'
5361
5adf9721
ILT
53622008-06-30 Manish Singh <yosh@gimp.org>
5363
5364 PR 6585
5365 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
5366 Correct typo.
5367
e6fde208
ILT
53682008-06-30 Ian Lance Taylor <iant@google.com>
5369
5370 PR 6660
5371 PR 6682
5372 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
5373 versions]: Don't try to read the value in the contents, since we
5374 don't use it. Use the template endianness when writing.
5375
3f2e6a2d
CC
53762008-06-25 Cary Coutant <ccoutant@google.com>
5377
5378 * fileread.cc (File_read::make_view): Assert on zero-length view.
5379 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
5380 symbol table when there are no symbols to read.
5381
c43d3a48
CS
53822008-06-23 Craig Silverstein <csilvers@google.com>
5383
5384 * version.cc (version_string): Bump to 1.7
5385
5f494ea0
CS
53862008-06-18 Craig Silverstein <csilvers@google.com>
5387
5388 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
5389 constant 0xFFFF to type Valtype.
5390 (Powerpc_relocate_functions::rel16_ha): Likewise.
5391
c42e122e
ILT
53922008-06-17 Ian Lance Taylor <iant@google.com>
5393
f34787f8
ILT
5394 * output.h (Output_section::Input_section): Initialize p2align_ to
5395 zero for Output_section_data constructors.
5396 (Output_section::Input_section::addralign): If not an input
5397 section, return the alignment of the Output_section_data.
5398 * testsuite/copy_test.cc: New file.
5399 * testsuite/copy_test_1.cc: New file.
5400 * testsuite/copy_test_2.cc: New file.
5401 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
5402 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
5403 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
5404 (copy_test_1_pic.o, copy_test_1.so): New targets.
5405 (copy_test_2_pic.o, copy_test_2.so): New targets.
5406 * testsuite/Makefile.in: Rebuild.
5407
c42e122e
ILT
5408 * script-sections.cc (Script_sections::place_orphan): Initialize
5409 local variable exact.
5410
ce3ac18a
DE
54112008-06-13 David Edelsohn <edelsohn@gnu.org>
5412
5413 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
5414
42cacb20
DE
54152008-06-12 David Edelsohn <edelsohn@gnu.org>
5416 David S. Miller <davem@davemloft.net>
5417
5418 * powerpc.cc: New file.
5419 * Makefile.am (TARGETSOURCES): Add powerpc.cc
5420 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
5421 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
5422 * Makefile.in: Rebuild.
5423
7b308235
ILT
54242008-06-09 Ian Lance Taylor <iant@google.com>
5425
5426 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
5427 <exception>.
5428 (throwing, orig_terminate): New static variables.
5429 (terminate_handler): New static function.
5430 (t2): Set terminate handler.
5431
f0b886e3
ILT
54322008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
5433
5434 PR 6584
cd536b21 5435 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
5436 alignment.
5437
3e90f135
CC
54382008-05-30 Cary Coutant <ccoutant@google.com>
5439
5440 * archive.cc (Archive::include_all_members) Correct to step
5441 over symbol table and extended name table in thin archives.
5442
e09ad04a
ILT
54432008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
5444
5445 PR 6407
5446 * target-reloc.h (relocate_for_relocatable): Fix new_offset
5447 calculation.
5448
62b01cb5
ILT
54492008-05-28 Caleb Howe <cshowe@google.com>
5450
5451 * reduced_debug_output.cc: New file.
5452 * reduced_debug_output.h: New file.
92de84a6 5453 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
5454 * options.cc (General_options::finalize): Add strip_debug_non_line
5455 to the strip heirarchy.
5456 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
5457 fields.
5458 * layout.cc: Include "reduced_debug_output.h".
5459 (Layout::Layout): Initialize new fields.
5460 (line_only_debug_sections): New static array.
5461 (is_lines_only_debug_sections): New static inline function.
5462 (Layout::include_section): Handle --strip-debug-non-line.
5463 (Layout::make_output_section): If --strip-debug-non-line, build
5464 new output sections for .debug_abbrev and .debug_info.
5465 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
5466 gold. Warn about possible overflow.
5467 (read_signed_LEB_128): Likewise.
5468 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
5469 (read_signed_LEB_128): Declare.
5470 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
5471 (HFILES): Add reduced_debug_output.h.
5472 * Makefile.in: Rebuild.
5473
7d9e3d98
ILT
54742008-05-21 Ian Lance Taylor <iant@google.com>
5475
5476 * mapfile.cc: New file.
5477 * mapfile.h: New file.
5478 * options.h (class General_options): Add -M/--print-map and -Map.
5479 * options.cc (General_options::finalize): Make -M equivalent to
5480 -Map -.
5481 * main.cc: Include <cstdio> and "mapfile.h".
5482 (main): Open mapfile if requested.
5483 * gold.cc (class Middle_runner): Add mapfile_ field. Update
5484 constructor. Change caller.
5485 (queue_initial_tasks): Add mapfile parameter. Change caller.
5486 (queue_middle_tasks): Likewise.
5487 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
5488 declarations.
5489 * archive.cc: Include "mapfile.h".
5490 (Archive::add_symbols): Add mapfile parameter. Change all
5491 callers. Pass mapfile, symbol, and reason to include_member.
5492 (Archive::include_all_members): Add mapfile parameter. Change all
5493 callers.
5494 (Archive::include_member): Add mapfile, sym, and why parameters.
5495 Change all callers. Report inclusion to map file.
5496 * archive.h: Include "fileread.h".
5497 (class Archive): Update declarations.
5498 (Archive::file): New const method.
5499 (class Add_archive_symbols): Add mapfile_ field. Update
5500 constructor. Change all callers.
5501 * readsyms.h (class Read_symbols): Likewise.
5502 (class Finish_group): Likewise.
5503 (class Read_script): Likewise.
5504 * common.cc: Include "mapfile.h".
5505 (Symbol_table::allocate_commons): Add mapfile parameter. Change
5506 all callers.
5507 (Symbol_table::do_allocate_commons): Likewise.
5508 (Symbol_table::do_allocate_commons_list): Likewise. Report common
5509 symbol allocation to mapfile.
5510 * common.h (class Allocate_commons_task): Add mapfile_ field.
5511 Update constructor. Change all callers.
5512 * symtab.h (class Symbol_table): Update declarations.
5513 * layout.cc: Include "mapfile.h".
5514 (Layout_task_runner::run): Print information to mapfile.
5515 (Layout::create_gold_note): Change Output_data_fixed_space to
5516 Output_data_zero_fill.
5517 (Layout::create_build_id): Likewise.
5518 (Layout::print_to_mapfile): New function.
5519 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
5520 constructor. Change caller.
5521 (class Layout): Declare print_to_mapfile.
5522 * output.cc (Output_section::Input_section::print_to_mapfile): New
5523 function.
5524 (Output_section::add_input_section): If producing a map, always
5525 add to input_sections_ list.
5526 (Output_section::do_print_to_mapfile): New function.
5527 (Output_segment::print_sections_to_mapfile): New function.
5528 (Output_segment::print_section_list_to_mapfile): New function.
5529 * output.h: Include "mapfile.h".
5530 (Output_data::print_to_mapfile): New function.
5531 (Output_data::do_print_to_mapfile): New virtual function.
5532 (Output_segment_headers::do_print_to_mapfile): New function.
5533 (Output_file_header::do_print_to_mapfile): New function.
5534 (Output_data_const::do_print_to_mapfile): New function.
5535 (class Output_data_const_buffer): Add map_name_ field. Update
5536 constructor. Change all callers. Add do_print_to_mapfile
5537 function.
5538 (class Output_data_fixed_space): Likewise.
5539 (class Output_data_space): Likewise.
5540 (class Output_data_zero_fill): New class.
5541 (Output_data_strtab::do_print_to_mapfile): New function.
5542 (Output_data_reloc_base::do_print_to_mapfile): New function.
5543 (Output_relocatable_relocs::do_print_to_mapfile): New function.
5544 (Output_data_group::do_print_to_mapfile): New function.
5545 (Output_data_got::do_print_to_mapfile): New function.
5546 (Output_data_dynamic::do_print_to_mapfile): New function.
5547 (Output_symtab_xindex::do_print_to_mapfile): New function.
5548 (class Output_section): Declare do_print_to_mapflie. Declare
5549 print_to_mapfile in Input_section.
5550 (class Output_segment): Declare new functions.
5551 * object.h (Sized_relobj::symbol_count): New function.
5552 * script-sections.cc
5553 (Output_section_element_dot_assignment::set_section_addresses):
5554 Change Output_data_fixed_space to Output_data_zero_fill.
5555 (Output_data_expression::do_print_to_mapfile): New function.
5556 * script.cc (read_input_script): Add mapfile parameter. Change
5557 all callers.
5558 * script.h (read_input_script): Update declaration.
5559 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
5560 (Eh_frame::do_print_to_mapfile): New function.
5561 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
5562 (Output_merge_string::do_print_to_mapfile): New function.
5563 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
5564 function.
5565 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
5566 function.
5567 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
5568 function.
5569 * Makefile.am (CCFILES): Add mapfile.cc.
5570 (HFILES): Add mapfile.h.
5571 * Makefile.in: Rebuild.
5572
9f1d377b
ILT
55732008-05-19 Ian Lance Taylor <iant@google.com>
5574
5575 * options.h (class General_options): Add -z relro.
5576 * layout.cc (Layout::Layout): Initialize relro_segment_.
5577 (Layout::add_output_section_data): Return the output section.
5578 (Layout::make_output_section): Rcognize relro sections and mark
5579 them appropriately.
5580 (Layout::attach_allocated_section_to_segment): Put relro sections
5581 in a PT_GNU_RELRO segment.
5582 (Layout::create_initial_dynamic_sections): Mark the .dynamic
5583 section as relro.
5584 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
5585 PT_TLS segments.
5586 (Layout::linkonce_mapping): Map d.rel.ro.local to
5587 .data.rel.ro.local.
5588 (Layout::output_section_name): Us .data.rel.ro.local for any
5589 section which begins with that.
5590 * layout.h (class Layout): Update add_output_section_data
5591 declaration. Add relro_segment_ field.
5592 * output.cc (Output_section::Output_section): Initialize is_relro_
5593 and is_relro_local_ fields.
5594 (Output_segment::add_output_section): Group relro sections.
5595 (Output_segment::is_first_section_relro): New function.
5596 (Output_segment::maximum_alignment): If there is a relro section,
5597 align the segment to the common page size.
5598 (Output_segment::set_section_addresses): Track whether we are
5599 looking at relro sections. If the last section is a relro
5600 section, align to the common page size.
5601 (Output_segment::set_section_list_addresses): Add in_relro
5602 parameter. Change all callers. Align to the page size when
5603 moving from relro to non-relro section.
5604 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
5605 segment.
5606 * output.h (class Output_section): Add is_relro_ and
5607 is_relro_local_ fields.
5608 (Output_section::is_relro): New function.
5609 (Output_section::set_is_relro): New function.
5610 (Output_section::is_relro_local): New function.
5611 (Output_section::set_is_relro_local): New function.
5612 (class Output_segment): Update declarations.
5613 * i386.cc (Target_i386::got_section): Mark .got section as relro.
5614 * sparc.cc (Target_sparc::got_section): Likewise.
5615 * x86_64.cc (Target_x86_64::got_section): Likewise.
5616 * testsuite/relro_test_main.cc: New file.
5617 * testsuite/relro_test.cc: New file.
5618 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5619 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5620 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5621 (relro_test.so, relro_test_pic.o): New targets.
5622 * testsuite/Makefile.in: Rebuild.
5623
a984ee1d
ILT
56242008-05-16 Ian Lance Taylor <iant@google.com>
5625
01676dcd
ILT
5626 * output.cc (Output_segment::add_output_section): Remove front
5627 parameter.
5628 * output.h (class Output_segment): Remove
5629 add_initial_output_section and overloaded add_output_section.
5630 Update declaration of remaining add_output_section.
5631 * layout.cc (Layout::create_interp): Call add_output_section
5632 rather than add_initial_output_section.
5633 (Layout::finish_dynamic_section): Likewise.
5634
497897f9
ILT
5635 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5636 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
5637 know the dynamic type.
5638 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5639 field. Initialize it in constructor.
5640 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5641 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5642 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5643 reloc.
5644
a984ee1d
ILT
5645 * output.cc (Output_reloc::get_address): Change return type to
5646 Elf_Addr.
5647 * output.h (class Output_reloc): Update get_address declaration.
5648 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5649 for section addresses.
5650
55ba0940
ILT
56512008-05-09 Ian Lance Taylor <iant@google.com>
5652
5653 PR 6493
5654 * gold.cc (gold_nomem): Use return value of write.
5655
75517b77
ILT
56562008-05-08 Ian Lance Taylor <iant@google.com>
5657
5658 * symtab.c (Symbol::init_base_output_data): Add version
5659 parameter. Change all callers.
5660 (Symbol::init_base_output_segment): Likewise.
5661 (Symbol::init_base_constant): Likewise.
5662 (Symbol::init_base_undefined): Likewise.
5663 (Sized_symbol::init_output_data): Likewise.
5664 (Sized_symbol::init_output_segment): Likewise.
5665 (Sized_symbol::init_constant): Likewise.
5666 (Sized_symbol::init_undefined): Likewise.
5667 (Symbol_table::do_define_in_output_data): If the new symbol has a
5668 version, mark it as the default.
5669 (Symbol_table::do_define_in_output_segment): Likewise.
5670 (Symbol_table::do_define_as_constant): Likewise.
5671 * symtab.h (class Symbol): Update declarations.
5672 (class Sized_symbol): Likewise.
5673 * resolve.cc (Symbol::override_version): New function.
c42e122e 5674 (Symbol::override_base): Call override_version.
75517b77
ILT
5675 (Symbol::override_base_with_special): Likewise.
5676 * testsuite/ver_script_8.script: New file.
5677 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
5678 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
5679 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
5680 (ver_test_8_1.so, ver_test_8_2.so): New targets.
5681
f1f70eae
ILT
56822008-05-06 Ian Lance Taylor <iant@google.com>
5683
f3e9c5c5
ILT
5684 PR 6049
5685 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
5686 functions.
5687 (class General_options): Remove existing --undefined, and add
5688 --no-undefined instead. Add new --undefined as synonym for -u.
5689 * archive.cc (Archive::add_symbols): Check whether symbol was
5690 named with -u.
5691 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
5692 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
5693 all uses. Add IS_UNDEFINED. Update declarations to split
5694 different versions of init_base. Declare init_base_undefined.
5695 (Symbol::is_defined): Handle IS_UNDEFINED.
5696 (Symbol::is_undefined): Likewise.
5697 (Symbol::is_weak_undefined): Call is_undefined.
5698 (Symbol::is_absolute): Handle IS_CONSTANT.
5699 (class Sized_symbol): Update declarations to split different
5700 versions of init. Declare init_undefined.
5701 (class Symbol_table): Declare new functions.
5702 * symtab.cc (Symbol::init_base_object): Rename from init_base.
5703 Change all callers.
5704 (Symbol::init_base_output_data): Likewise.
5705 (Symbol::init_base_output_segment): Likewise.
5706 (Symbol::init_base_constant): Likewise.
5707 (Symbol::init_base_undefined): New function.
5708 (Sized_symbol::init_object): Rename from init. Change all
5709 callers.
5710 (Sized_symbol::init_output_data): Likewise.
5711 (Sized_symbol::init_output_segment): Likewise.
5712 (Sized_symbol::init_constant): Likewise.
5713 (Sized_symbol::init_undefined): New function.
5714 (Symbol_table::add_undefined_symbols_from_command_line): New
5715 function.
5716 (Symbol_table::do_add_undefined_symbols_from_command_line): New
5717 function.
5718 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
5719 (Symbol::output_section): Likewise.
5720 (Symbol::set_output_section): Likewise.
5721 (Symbol_table::sized_finalize_symbol): Likewise.
5722 (Symbol_table::sized_write_globals): Likewise.
5723 * resolve.cc (Symbol_table::should_override): Likewise.
5724 (Symbol::override_base_with_special): Likewise.
5725
8bdcdf2c
ILT
5726 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
5727 symbol, change it to have default visibility.
5728 * testsuite/protected_1.cc: New file.
5729 * testsuite/protected_2.cc: New file.
5730 * testsuite/protected_3.cc: New file.
5731 * testsuite/protected_main_1.cc: New file.
5732 * testsuite/protected_main_2.cc: New file.
5733 * testsuite/protected_main_3.cc: New file.
5734 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
5735 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
5736 (protected_1_LDFLAGS, protected_1_LDADD): Define.
5737 (protected_1.so): New target.
5738 (protected_1_pic.o, protected_2_pic.o): New targets.
5739 (protected_3_pic.o): New target.
5740 (check_PROGRAMS): Add protected_2.
5741 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
5742 (protected_2_LDFLAGS, protected_2_LDADD): Define.
5743 * testsuite/Makefile.in: Rebuild.
5744
2b706932
ILT
5745 * options.h (DEFINE_var): Add set_user_set_##varname__.
5746 (DEFINE_bool_alias): New macro.
5747 (class General_options): Define -Bstatic using DEFINE_bool_alias
5748 rather than DEFINE_special. Add --undefined as an alias for -z
5749 defs.
5750 * options.cc (General_options::parse_Bstatic): Remove.
5751
d82a5bcc
ILT
5752 * options.h (class General_options): Add --fatal-warnings.
5753 * main.cc (main): Implement --fatal-warnings.
5754 * errors.h (Errors::warning_count): New function.
5755
f1f70eae
ILT
5756 * options.h (class General_options): Add -Bsymbolic-functions.
5757 * symtab.h (Symbol::is_preemptible): Check for
5758 -Bsymbolic-functions.
5759
8825ac63
ILT
57602008-05-05 Ian Lance Taylor <iant@google.com>
5761
d98bc257
ILT
5762 * options.h (DEFINE_bool): For DASH_Z, create the negative option
5763 as noVARNAME rather than no-VARNAME.
5764 (class General_options): Add option -z combreloc.
5765 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
5766 get_address.
5767 (Output_reloc::sort_before) [SHT_REL]: New function.
5768 (Output_reloc::sort_before) [SHT_RELA]: New function.
5769 (class Output_data_reloc_base): Add sort_relocs_ field. Define
5770 Sort_relocs_comparison.
5771 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
5772 parameter. Change all callers.
5773 (Output_data_reloc::Output_data_reloc) [both versions]: Add
5774 sort_relocs parameter. Change all callers.
5775 * output.cc (Output_reloc::get_address): New function, broken out
5776 of write_rel.
5777 (Output_reloc::write_rel): Call it.
5778 (Output_reloc::compare): New function.
5779 (Output_data_reloc_base::do_write): Optionally sort relocs.
5780
60b2b4e7
ILT
5781 * configure.ac: If targ_extra_obj is set, link it in.
5782 * configure.tgt: Initialize all variables.
5783 (x86_64*): Set targ_extra_obj and targ_extra_size.
5784 * configure: Rebuild.
5785
8825ac63
ILT
5786 * object.cc (Sized_relobj::include_section_group): Adjust section
5787 indexes read from group data. Build vector to pass to
5788 layout_group.
5789 * layout.cc (Layout::layout_group): Add flags and shndxes
5790 parameters. Remove contents parameter. Change caller. Update
5791 explicit instantiations.
5792 * layout.h (class Layout): Update layout_group declaration.
5793 * output.cc (Output_data_group::Output_data_group): Add flags and
5794 input_shndxes parameters. Remove contents parameter. Change
5795 caller.
5796 (Output_data_group::do_write): Change input_sections_ to
5797 input_shndxes_.
5798 * output.h (class Output_data_group): Update constructor
5799 declaration. Rename input_sections_ to input_shndxes_.
5800 * testsuite/many_sections_test.cc: Add template.
5801
e94cf127
CC
58022008-04-30 Cary Coutant <ccoutant@google.com>
5803
4418b2d5
CC
5804 * target-reloc.h (relocate_section): Fix dead-pointer bug.
5805
e94cf127
CC
5806 * layout.cc (Layout::include_section): Refactored check for debug
5807 info section.
5808 (Layout::add_comdat): Add new parameters. Change type
5809 of signature parameter. Add object and shndx to signatures table.
5810 (Layout::find_kept_object): New function.
5811 * layout.h: Include <cstring>.
5812 (Layout::is_debug_info_section): New function.
5813 (Layout::add_comdat): Add new parameters.
5814 (Layout::find_kept_object): New function.
5815 (Layout::Kept_section): New struct.
5816 (Layout::Signatures): Change type of map range.
5817 * object.cc (Relobj::output_section_address): New function.
5818 (Sized_relobj::include_section_group): Add new parameters. Change
5819 calls to Layout::add_comdat. Change to build table of kept comdat
5820 groups and table mapping discarded sections to kept sections.
5821 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
5822 (Sized_relobj::do_layout): Change calls to include_section_group and
5823 include_linkonce_section.
5824 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5825 value to zero when section is discarded.
5826 (Sized_relobj::map_to_kept_section): New function.
5827 * object.h (Relobj::output_section_address): New function.
5828 (Relobj::Comdat_group): New type.
5829 (Relobj::find_comdat_group): New function.
5830 (Relobj::Comdat_group_table): New type.
5831 (Relobj::Kept_comdat_section): New type.
5832 (Relobj::Kept_comdat_section_table): New type.
5833 (Relobj::add_comdat_group): New function.
5834 (Relobj::set_kept_comdat_section): New function.
5835 (Relobj::get_kept_comdat_section): New function.
5836 (Relobj::comdat_groups_): New field.
5837 (Relobj::kept_comdat_sections_): New field.
5838 (Symbol_value::input_value): Update comment.
5839 (Sized_relobj::map_to_kept_section) New function.
5840 (Sized_relobj::include_linkonce_section): Add new parameter.
5841 * target-reloc.h (Comdat_behavior): New type.
5842 (get_comdat_behavior): New function.
5843 (relocate_section): Add code to map a discarded section to the
5844 corresponding kept section when applying a relocation.
5845
e4e5049b
CS
58462008-04-30 Craig Silverstein <csilvers@google.com>
5847
5848 * dwarf_reader.cc (next_generation_count): New static var.
5849 (Addr2line_cache_entry): New struct.
5850 (addr2line_cache): New static var.
5851 (Dwarf_line_info::one_addr2line): Added caching.
5852 (Dwarf_line_info::clear_addr2line_cache): New function.
5853 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5854 cache-size parameter.
5855 (Dwarf_line_info::one_addr2line_cache): New function.
5856 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5857 new cache-size argument to one_addr2line(), and clear cache.
5858
d09e9154
CC
58592008-04-28 Cary Coutant <ccoutant@google.com>
5860
5861 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5862 R_386_PC8 relocations.
5863
7ef73768
ILT
58642008-04-23 Ian Lance Taylor <iant@google.com>
5865
55438702
ILT
5866 * object.cc (Sized_relobj::include_section_group): Check for
5867 invalid section group.
5868
c165fb93
ILT
5869 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5870 header size.
5871
7ef73768
ILT
5872 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5873 than read for file header.
5874 * archive.cc (Archive::include_member): Likewise.
5875
6194aaab
L
58762008-04-23 Paolo Bonzini <bonzini@gnu.org>
5877
5878 * aclocal.m4: Regenerate.
5879 * configure: Regenerate.
5880
d491d34e
ILT
58812008-04-19 Ian Lance Taylor <iant@google.com>
5882
5ea2bac6
ILT
5883 * version.cc (version_string): Bump to 1.6.
5884
7bc3e21a
ILT
5885 * testsuite/Makefile.am (many_sections_r_test): New target.
5886 (many_sections_r_test_SOURCES): Remove.
5887 (many_sections_r_test_DEPENDENCIES): Remove.
5888 (many_sections_r_test_LDFLAGS): Remove.
5889 (many_sections_r_test_LDADD): Remove.
5890
7fcd3aa9
ILT
5891 * object.cc (Sized_relobj::do_add_symbols): Always pass
5892 local_symbol_count_ to add_from_relobj.
5893
4c94d6ae
ILT
5894 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5895 every thousand variables.
5896 * testsuite/Makefile.in: Rebuild.
5897
d491d34e
ILT
5898 * object.cc (Xindex::initialize_symtab_xindex): New function.
5899 (Xindex::read_symtab_xindex): New function.
5900 (Xindex::sym_xindex_to_shndx): New function.
5901 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5902 available.
5903 (Sized_relobj::do_initialize_xindex): New function.
5904 (Sized_relobj::do_read_symbols): Adjust section links.
5905 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5906 parameter. Change all callers.
5907 (Sized_relobj::include_section_group): Adjust section links and
5908 symbol section indexes.
5909 (Sized_relobj::do_layout): Adjust section links.
5910 (Sized_relobj::do_count_local_symbols): Adjust section links and
5911 symbol section indexes.
5912 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5913 ordinary and special symbols.
5914 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5915 dynsym_xindex parameters. Change all callers. Adjust section
5916 links. Use SHN_XINDEX when needed.
5917 (Sized_relobj::get_symbol_location_info): Adjust section links.
5918 Don't get fooled by special symbols.
5919 * object.h (class Xindex): Define.
5920 (class Object): Add xindex_ parameter. Declare virtual functoin
5921 do_initialize_xindex.
5922 (Object::adjust_sym_shndx): New function.
5923 (Object::set_xindex): New protected function.
5924 (class Symbol_value): Add is_ordinary_shndx_ field.
5925 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5926 (Symbol_value::value): Assert ordinary section.
5927 (Symbol_value::initialize_input_to_output_map): Likewise.
5928 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5929 Change all callers.
5930 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5931 all callers.
5932 (class Sized_relobj): Update declarations.
5933 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5934 parameter. Change all callers.
5935 (Sized_relobj::adjust_shndx): New function.
5936 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5937 field.
5938 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5939 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5940 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5941 (Sized_dynobj::read_dynsym_section): Adjust section links.
5942 (Sized_dynobj::read_dynamic): Likewise.
5943 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5944 section links.
5945 (Sized_dynobj::do_initialize_xindex): New function.
5946 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5947 do_initialize_xindex.
5948 (Sized_dynobj::adjust_shndx): New function.
5949 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5950 dynsym_xindex_ fields.
5951 (Layout::finalize): Add a call to set_section_indexes before
5952 creating the symtab sections.
5953 (Layout::set_section_indexes): Don't do anything if the section
5954 already has a section index.
5955 (Layout::create_symtab_sections): Add shnum parameter. Change
5956 caller. Create .symtab_shndx section if needed.
5957 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5958 caller.
5959 (Layout::allocated_output_section_count): New function.
5960 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5961 needed.
5962 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5963 fields. Update declarations.
5964 (Layout::symtab_xindex): New function.
5965 (Layout::dynsym_xindex): New function.
5966 (class Write_symbols_task): Add layout_ field.
5967 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5968 Change caller.
5969 * output.cc (Output_section_headers::Output_section_headers): Add
5970 shstrtab_section parameter. Change all callers.
5971 (Output_section_headers::do_sized_write): Store overflow values
5972 for section count and section string table section index in
5973 section header zero.
5974 (Output_file_header::do_sized_write): Check for overflow of
5975 section count and section string table section index.
5976 (Output_symtab_xindex::do_write): New function.
5977 (Output_symtab_xindex::endian_do_write): New function.
5978 * output.h (class Output_section_headers): Add shstrtab_section_.
5979 Update declarations.
5980 (class Output_symtab_xindex): Define.
5981 (Output_section::has_out_shndx): New function.
5982 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5983 field.
5984 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5985 Change all callers.
5986 (Sized_symbol::init): Likewise.
5987 (Symbol::output_section): Check for ordinary symbol.
5988 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5989 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5990 callers.
5991 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5992 Change all callers. Simplify handling of symbols from sections
5993 not included in the link.
5994 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5995 distinction.
5996 (Weak_alias_sorter::operator()): Assert that symbols are
5997 ordinary.
5998 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5999 distinction.
6000 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
6001 parameters. Change all callers.
6002 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
6003 symbol distinction. Use SHN_XINDEX when needed.
6004 (Symbol_table::write_section_symbol): Add symtab_xindex
6005 parameter. Change all callers.
6006 (Symbol_table::sized_write_section_symbol): Likewise. Use
6007 SHN_XINDEX when needed.
6008 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
6009 declarations.
6010 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
6011 (Symbol::is_defined): Check is_ordinary.
6012 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
6013 (Symbol::is_absolute, Symbol::is_common): Likewise.
6014 (class Sized_symbol): Update declarations.
6015 (class Symbol_table): Update declarations.
6016 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
6017 parameters. Change all callers.
6018 (Sized_symbol::override): Likewise.
6019 (Symbol_table::override): Likewise.
6020 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
6021 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
6022 is_ordinary, and orig_st_shndx parameters. Change all callers.
6023 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
6024 to be in an ordinary section.
6025 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
6026 object and is_ordinary parameters. Change all callers.
6027 (Sized_dwarf_line_info::read_relocs): Add object parameter.
6028 Change all callers. Don't add undefined or non-ordinary symbols
6029 to reloc_map_.
6030 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
6031 Change all callers.
6032 * dwarf_reader.h (class Sized_dwarf_line_info): Update
6033 declarations.
6034 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
6035 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
6036 (Sized_relobj::relocate_sections): Likewise.
6037 * target-reloc.h (scan_relocs): Adjust section symbol index.
6038 (scan_relocatable_relocs): Likewise.
6039 * i386.cc (Scan::local): Check for ordinary symbols.
6040 * sparc.cc (Scan::local): Likewise.
6041 * x86_64.cc (Scan::local): Likewise.
6042 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
6043 to symbol_section_and_value.
6044 * testsuite/many_sections_test.cc: New file.
6045 * testsuite/Makefile.am (BUILT_SOURCES): Define.
6046 (check_PROGRAMS): Add many_sections_test.
6047 (many_sections_test_SOURCES): Define.
6048 (many_sections_test_DEPENDENCIES): Define.
6049 (many_sections_test_LDFLAGS): Define.
6050 (BUILT_SOURCES): Add many_sections_define.h.
6051 (many_sections_define.h): New target.
6052 (BUILT_SOURCES): Add many_sections_check.h.
6053 (many_sections_check.h): New target.
6054 (check_PROGRAMS): Add many_sections_r_test.
6055 (many_sections_r_test_SOURCES): Define.
6056 (many_sections_r_test_DEPENDENCIES): Define.
6057 (many_sections_r_test_LDFLAGS): Define.
6058 (many_sections_r_test_LDADD): Define.
6059 (many_sections_r_test.o): New target.
6060 * testsuite/Makefile.in: Rebuild.
6061
c5818ff1
CC
60622008-04-17 Cary Coutant <ccoutant@google.com>
6063
6064 * errors.cc (Errors::info): New function.
6065 (gold_info): New function.
6066 * errors.h (Errors::info): New function.
6067 * gold.h (gold_info): New function.
6068 * object.cc (Input_objects::add_object): Print trace output.
6069 * options.cc (options::parse_set): New function.
6070 (General_options::parse_wrap): Deleted.
6071 (General_options::General_options): Deleted initializer.
6072 * options.h (options::String_set): New typedef.
6073 (options::parse_set): New function.
6074 (DEFINE_set): New macro.
6075 (General_options::wrap): Changed to use DEFINE_set. Changed
6076 callers of any_wrap_symbols and is_wrap_symbol.
6077 (General_options::trace, General_options::trace_symbol):
6078 New options.
6079 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
6080 (General_options::wrap_symbols_): Deleted.
6081 * symtab.cc (Symbol_table::add_from_object): Print trace output.
6082
b5be4a7c
DM
60832008-04-17 David S. Miller <davem@davemloft.net>
6084
6085 * options.cc (General_options::parse_V): New function.
6086 * options.h: Add entries for -V and -Qy.
6087
155a0dd7
ILT
60882008-04-17 Ian Lance Taylor <iant@google.com>
6089
6090 * common.cc (Symbol_table::allocate_commons): Remove options
6091 parameter. Change caller.
6092 (Symbol_table::do_allocate_commons): Remove options parameter.
6093 Change caller. Just call do_allocate_commons_list twice.
6094 (Symbol_table::do_allocate_commons_list): New function, broken out
6095 of do_allocate_commons.
6096 * common.h (class Allocate_commons_task): Remove options_ field.
6097 Update constructor.
6098 * symtab.cc (Symbol_table::Symbol_table): Initialize
6099 tls_commons_.
6100 (Symbol_table::add_from_object): Put TLS common symbols on
6101 tls_commons_ list.
6102 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
6103 which are IN_OUTPUT_DATA.
6104 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
6105 allocate_commons and do_allocate_commons declarations. Declare
6106 do_allocate_commons_list.
6107 * gold.cc (queue_middle_tasks): Update creation of
6108 Allocate_commons_task to not pass options.
6109 * testsuite/Makefile.am (INCLUDES): Add -I.. .
6110 (TLS_TEST_C_FLAGS): New variable.
6111 (tls_test_c_pic.o): New target.
6112 (tls_test_shared.so): Link in tls_test_c_pic.o.
6113 (tls_test_c_pic_ie.o): New target.
6114 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
6115 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
6116 (tls_test_c.o): New target.
6117 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
6118 (tls_pic_test_LDADD): Likewise.
6119 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
6120 (tls_shared_gd_to_ie_test_LDADD): Likewise.
6121 (tls_test_c_gnu2.o): New target.
6122 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
6123 tls_test_c_gnu2.o.
6124 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
6125 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
6126 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
6127 * testsuite/tls_test.cc: Include "config.h".
6128 (t_last): Call t11_last.
6129 * testsuite/tls_test.h (t11, t11_last): Declare.
6130 * testsuite/tls_test_c.c: New file.
6131 * testsuite/tls_test_main.cc (thread_routine): Call t11.
6132 * configure.ac: Check for OpenMP support.
6133 * configure, config.in, Makefile.in: Rebuild.
6134 * testsuite/Makefile.in: Rebuild.
6135
edfbb029
CC
61362008-04-16 Cary Coutant <ccoutant@google.com>
6137
6138 * i386.cc (Target_i386::define_tls_base_symbol): New function.
6139 (Target_i386::tls_base_symbol_defined_): New field.
6140 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
6141 (Target_i386::Scan::global): Likewise.
6142 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
6143 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
6144 (Target_x86_64::tls_base_symbol_defined_): New field.
6145 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
6146 (Target_x86_64::Scan::global): Likewise.
6147
f3c69fca
CC
61482008-04-16 Cary Coutant <ccoutant@google.com>
6149
6150 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
6151 (Symbol::needs_plt_entry): Allow weak undefined symbols.
6152 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
6153 building shared libraries.
6154 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
6155 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
6156 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
6157 * testsuite/Makefile.in: Rebuild.
6158 * testsuite/weak_undef.h: New file.
6159 * testsuite/weak_undef_file1.cc: Add extra test cases.
6160 * testsuite/weak_undef_file2.cc: Likewise.
6161 * testsuite/weak_undef_test.cc: Likewise.
6162
7c414435
DM
61632008-04-16 David S. Miller <davem@davemloft.net>
6164
32b769e1
DM
6165 * sparc.cc (Target_sparc::Scan): Change from struct to class.
6166 Add issued_non_pic_error_ field. Declare check_non_pic.
6167 (Target_sparc::Scan::check_non_pic): New function.
6168 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
6169 (Target_sparc::Scan::global): Likewise.
6170
11936fb1
DM
6171 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
6172 * configure: Rebuild.
6173
7c414435
DM
6174 * options.h (DEFINE_enable): New macro.
6175 (new_dtags): New enable option.
6176 (initfirst, interpose, loadfltr, nodefaultlib,
6177 nodelete, nodlopen, nodump): New -z options.
6178 * layout.cc (Layout:finish_dynamic_section): If new
6179 dtags enabled, emit DT_RUNPATH. Also, emit a
6180 DT_FLAGS_1 containing any specified -z flags.
6181
85c7bf8b
ILT
61822008-04-16 Ian Lance Taylor <iant@google.com>
6183
12c0daef
ILT
6184 * copy-relocs.cc: New file.
6185 * copy-relocs.h: New file.
6186 * reloc.cc: Remove Copy_relocs code.
6187 * reloc.h: Likewise.
6188 * reloc-types.h (struct Reloc_types) [both versions]: Add
6189 get_reloc_addend_noerror.
6190 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
6191 variants of add_global which take an addend which must be zero.
6192 * i386.cc: Include "copy-relocs.h".
6193 (class Target_i386): Change type of copy_relocs_ to variable,
6194 update initializer.
6195 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
6196 Change all callers.
6197 (Target_i386::do_finalize_sections): Change handling of
6198 copy_relocs_.
6199 * sparc.cc: Include "copy-relocs.h".
6200 (class Target_sparc): Change type of copy_relocs_ to variable,
6201 update initializer.
6202 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
6203 Change all callers.
6204 (Target_sparc::do_finalize_sections): Change handling of
6205 copy_relocs_.
6206 * x86_64.cc: Include "copy-relocs.h".
6207 (class Target_x86_64): Change type of copy_relocs_ to variable,
6208 update initializer.
6209 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
6210 class. Change all callers.
6211 (Target_x86_64::do_finalize_sections): Change handling of
6212 copy_relocs_.
6213 * Makefile.am (CCFILES): Add copy-relocs.cc.
6214 (HFILES): Add copy-relocs.h.
6215
4f4995b6
ILT
6216 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
6217
85c7bf8b
ILT
6218 * testsuite/script_test_4.sh: Permit leading zeroes.
6219
4f2a9edd
ILT
62202008-04-15 Ian Lance Taylor <iant@google.com>
6221
e6188289
ILT
6222 * script-sections.cc (Script_sections::create_segments): Use
6223 header_size_adjustment even when there is enough room for the
6224 headers.
6225 * testsuite/script_test_4.sh: New file.
6226 * testsuite/script_test_4.t: New file.
6227 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
6228 (check_DATA): Add script_test_4.stdout.
6229 (MOSTLYCLEANFILES): Likewise.
6230 (script_test_4): New target.
6231 (script_test_4.stdout): New target.
6232 * testsuite/Makefile.in: Rebuild.
6233
4f2a9edd
ILT
6234 * sparc.cc: Add definitions for Output_data_plt_sparc class
6235 constants.
6236
f5314dd5
DM
62372008-04-14 David S. Miller <davem@davemloft.net>
6238
6239 * sparc.cc: New file.
6240 * Makefile.am (TARGETSOURCES): Add sparc.cc
6241 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
6242 * configure.tgt: Document targ_extra_size and
6243 targ_extra_big_endian. Add entries for sparc-* and
6244 sparc64-*.
6245 * configure.ac: Handle targ_extra_size and
6246 targ_extra_big_endian.
6247 * Makefile.in: Rebuild.
6248 * configure: Likewise.
6249 * po/POTFILES.in: Likewise.
6250 * po/gold.pot: Likewise.
6251
154e0e9a
ILT
62522008-04-14 Ian Lance Taylor <iant@google.com>
6253
6254 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
6255 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
6256 in the name/type/flags to section mapping. Don't call
6257 allocate_output_section.
6258 (Layout::choose_output_section): Change parameter from adjust_name
6259 to is_input_section. Don't permit input sections after sections
6260 are attached to segments. Don't call allocate_output_section.
6261 (Layout::layout_eh_frame): Call update_flags_for_input_section,
6262 not write_enable_output_section.
6263 (Layout::make_output_section): Don't push to
6264 unattached_section_list_ nor call attach_to_segment. Call
6265 attach_section_to_segment if sections are attached.
6266 (Layout::attach_sections_to_segments): New function.
6267 (Layout::attach_section_to_segment): New function.
6268 (Layout::attach_allocated_section_to_segment): Rename from
6269 attach_to_segment. Remove flags parameter.
6270 (Layout::allocate_output_section): Remove function.
6271 (Layout::write_enable_output_section): Remove function.
6272 * layout.h (class Layout): Update for above changes. Add new
6273 field sections_are_attached_.
6274 * output.h (Output_section::update_flags_for_input_section): New
6275 function.
6276 * output.cc (Output_section::add_input_section): Call
6277 update_flags_for_input_section.
6278 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
6279
009a67a2
CC
62802008-04-11 Cary Coutant <ccoutant@google.com>
6281
6282 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
6283 thought unnecessary.
6284 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
6285
759b1a24
ILT
62862008-04-11 Ian Lance Taylor <iant@google.com>
6287
6288 * output.h (class Output_section_data): Remove inline definition
6289 of set_addralign.
6290 * output.cc (Output_section_data::set_addralign): New function.
6291
c2b45e22
CC
62922008-04-11 Cary Coutant <ccoutant@google.com>
6293
6294 Add support for TLS descriptors for i386 and x86_64.
6295 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
6296 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
6297 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
6298 GOT_TYPE_TLS_DESC.
6299 (Target_i386::got_mod_index_entry): Remove unnecessary code.
6300 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
6301 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
6302 relocations.
6303 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
6304 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
6305 Fix problem with initial-exec relocations.
6306 (Target_i386::Relocate::relocate_tls): Likewise.
6307 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
6308 relaxation.
6309 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
6310 support for section-plus-offset dynamic table entries.
6311 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
6312 (Output_data_dynamic::Dynamic_entry): Add support for
6313 section-plus-offset dynamic table entries.
6314 (Output_data_dynamic::Classification): Likewise.
6315 (Output_data_dynamic::classification_): Renamed offset_.
6316 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
6317 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
6318 (Target_x86_64::make_plt_section): New function.
6319 (Target_x86_64::reserve_tlsdesc_entries): New function.
6320 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
6321 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
6322 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
6323 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
6324 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
6325 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
6326 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
6327 add extra PLT entry for TLS descriptors.
6328 (Output_data_plt_x86_64::got_): New field.
6329 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
6330 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
6331 fields.
6332 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
6333 descriptors.
6334 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
6335 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
6336 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
6337 R_386_TLS_DESC_CALL relocations.
6338 (Target_x86_64::Scan::global): Likewise.
6339 (Target_x86_64::do_finalize_sections): Add dynamic table entries
6340 for TLS descriptors.
6341 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
6342 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
6343 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
6344 GD-to-IE relaxation.
6345 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
6346 and TLS_DESCRIPTORS.
6347 * Makefile.in: Rebuild.
6348 * configure: Rebuild.
6349 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
6350 (tls_test_shared2.so): New target.
6351 (tls_shared_gd_to_ie_test_SOURCES): New variable.
6352 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
6353 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
6354 (tls_shared_gd_to_ie_test_LDADD): New variable.
6355 (tls_shared_gnu2_gd_to_ie_test): New target.
6356 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
6357 New targets.
6358 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
6359 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
6360 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
6361 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
6362 (tls_shared_gnu2_test): New target.
6363 (tls_test_gnu2_shared.so): New target.
6364 (tls_shared_gnu2_test_SOURCES): New variable.
6365 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
6366 (tls_shared_gnu2_test_LDFLAGS): New variable.
6367 (tls_shared_gnu2_test_LDADD): New variable.
6368 * testsuite/Makefile.in: Rebuild.
6369 * testsuite/Makefile.
6370
83bfb6b7
ILT
63712008-04-11 Ian Lance Taylor <iant@google.com>
6372
6373 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
6374 justsyms.t.
6375 * testsuite/Makefile.in: Rebuild.
6376
6377 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
6378 long.
6379 * testsuite/script_test_2.cc (main): Adjust test.
6380
706e1f5e
ILT
63812008-04-11 David S. Miller <davem@davemloft.net>
6382 Ian Lance Taylor <iant@google.com>
6383
6384 * options.h (General_options): Add entries for '-Y' and
6385 '-relax'.
6386 * options.cc (General_options:finalize): If -Y was used, add those
6387 entries to the library path instead of the default "/lib" and
6388 "/usr/lib".
6389
7c98e6bb
DM
63902008-04-11 David S. Miller <davem@davemloft.net>
6391
6392 * testsuite/justsyms.t: Start at 0x100.
6393 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
6394 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
6395 long.
6396 * testsuite/script_test_2.cc: Adjust string and section length
6397 checks.
7c98e6bb 6398
99a37bfd
ILT
63992008-04-09 Ian Lance Taylor <iant@google.com>
6400
2cefc357
ILT
6401 PR gold/5996
6402 * script-sections.cc (Sections_element::allocate_to_segment): Add
6403 orphan parameter.
6404 (Output_section_definition::allocate_to_segment): Likewise.
6405 (Orphan_output_section::allocate_to_segment): Likewise.
6406 (Script_sections::attach_sections_using_phdrs_clause): Don't
6407 propagate non-PT_LOAD segments to orphan sections.
6408 * testsuite/Makefile.am (script_test_3.stdout): Generate using
6409 readelf rather than objdump.
6410 * testsuite/script_test_3.sh: Adjust accordingly. Test that
6411 .interp section and PT_INTERP segment are the same size.
6412 * testsuite/Makefile.in: Rebuild.
6413
99a37bfd
ILT
6414 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
6415 aliases for symbols defined in the same object.
6416 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
6417 (weak_alias_test_SOURCES): New variable.
6418 (weak_alias_test_DEPENDENCIES): New variable.
6419 (weak_alias_test_LDFLAGS): New variable.
6420 (weak_alias_test_LDADD): New variable.
6421 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
6422 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
6423 (weak_alias_test_3.o): New target.
6424 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
6425 * testsuite/weak_alias_test_main.cc: New file.
6426 * testsuite/weak_alias_test_1.cc: New file.
6427 * testsuite/weak_alias_test_2.cc: New file.
6428 * testsuite/weak_alias_test_3.cc: New file.
6429
780e49c5
ILT
64302008-04-08 Ian Lance Taylor <iant@google.com>
6431
cdb0b8f5
ILT
6432 * options.h (class General_options): Add --noinhibit-exec option.
6433 * main.cc (main): Check --noinhibit-exec.
6434
0864d551
ILT
6435 * options.h (class General_options): Define --wrap as a special
6436 option. Add wrap_symbols_ field.
6437 (General_options::any_wrap_symbols): New function.
6438 (General_options::is_wrap_symbol): New function.
6439 * options.cc (General_options::parse_wrap): New function.
6440 (General_options::General_options): Initialize wrap_symbols_.
6441 * symtab.cc (Symbol_table::wrap_symbol): New function.
6442 (Symbol_table::add_from_object): Handle --wrap.
6443 * symtab.h (class Symbol_table): Declare wrap_symbol.
6444 * target.h (Target::wrap_char): New function.
6445 (Target::Target_info): Add wrap_char field.
6446 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
6447 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6448 * testsuite/testfile.cc (Target_test::test_target_info):
6449 Likewise.
6450
789aa6de
ILT
6451 * errors.cc (Errors::undefined_symbol): Mention symbol version if
6452 there is one.
6453
2c38906f
ILT
6454 * layout.h (class Layout): Add added_eh_frame_data_ field.
6455 * layout.cc (Layout::Layout): Initialize new field.
6456 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
6457 output section until we find a section we merged successfully.
6458 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
6459 that the size be non-zero.
6460
780e49c5
ILT
6461 * merge.cc (Object_merge_map::get_output_offset): Remove inline
6462 qualifier.
6463
7fcd0256
ILT
64642008-04-08 Craig Silverstein <csilvers@google.com>
6465
6466 * configure.ac: Export new conditional variable HAVE_ZLIB.
6467 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
6468 on HAVE_ZLIB.
6469 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
6470 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6471
6835af53
ILT
64722008-04-07 Ian Lance Taylor <iant@google.com>
6473
e24f324c
ILT
6474 * version.cc (version_string): Set to "1.5".
6475
a036edd8
ILT
6476 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
6477 Add issued_non_pic_error_ field. Declare check_non_pic.
6478 (Target_x86_64::Scan::check_non_pic): New function.
6479 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
6480 (Target_x86_64::Scan::global): Likewise.
6481
624f8810
ILT
6482 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
6483 addend parameter. Change caller. Handle merge sections.
6484 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
6485 Address to Addend. Don't add in the result of
6486 local_section_offset, pass down the addend and use the returned
6487 value.
6488 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
6489 Update declarations of local_section_offset and symbol_value.
6490 * testsuite/two_file_test_1.cc (t18): New function.
6491 * testsuite/two_file_test_2.cc (f18): New function.
6492 * testsuite/two_file_test_main.cc (main): Call t18.
6493 * testsuite/two_file_test.h (t18, f18): Declare.
6494
6835af53
ILT
6495 * configure.ac: Don't test for objdump, c++filt, or readelf.
6496 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
6497 conditionals.
6498 (TEST_READELF): New variable.
6499 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
6500 (check_PROGRAMS): Add two_file_strip_test.
6501 (two_file_strip_test): New target.
6502 (check_PROGRAMS): Add two_file_same_shared_strip_test.
6503 (two_file_same_shared_strip_test_SOURCES): New variable.
6504 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
6505 (two_file_same_shared_strip_test_LDFLAGS): New variable.
6506 (two_file_same_shared_strip_test_LDADD): New variable.
6507 (two_file_shared_strip.so): New target.
6508 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
6509 (ver_test_5.syms, ver_test_7.syms): Likewise.
6510 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
6511 (strip_test_3.stdout): Use TEST_OBJDUMP.
6512 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6513
86925eef
CC
65142008-04-04 Cary Coutant <ccoutant@google.com>
6515
6516 * symtab.h (Symbol::is_weak_undefined): New function.
6517 (Symbol::is_strong_undefined): New function.
6518 (Symbol::is_absolute): New function.
6519 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
6520 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
6521 absolute symbols.
6522 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
6523 (weak_undef_test): New target.
6524 * testsuite/Makefile.in: Rebuild.
6525 * testsuite/weak_undef_file1.cc: New file.
6526 * testsuite/weak_undef_file2.cc: New file.
6527 * testsuite/weak_undef_test.cc: New file.
6528
126f3ece
ILT
65292008-04-03 Craig Silverstein <csilvers@google.com>
6530
6531 * compressed_output.h (class Output_compressed_section): Use
6532 unsigned buffer.
6533 * compressed_output.cc (zlib_compress): Use unsigned buffers,
6534 add zlib header.
6535 (zlib_compressed_suffix): Removed.
6536 (Output_compressed_section::set_final_data_size): Use unsigned
6537 buffers.
6538 * testsuite/Makefile.am (flagstest_compress_debug_sections):
6539 Fix linker invocation.
6540 (flagstest_o_specialfile_and_compress_debug_sections):
6541 Likewise.
6542 * testsuite/Makefile.in: Regenerated.
6543
deae2a14
DM
65442008-04-02 David S. Miller <davem@davemloft.net>
6545
6546 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
6547 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
6548
70752818
ILT
65492008-04-02 Craig Silverstein <csilvers@google.com>
6550
6551 * TODO: New file.
6552
39d0cb0e
ILT
65532008-04-02 Ian Lance Taylor <iant@google.com>
6554
6555 * fileread.cc (File_read::find_view): Add byteshift and vshifted
6556 parameters. Update for new key type to views_. Change all
6557 callers.
6558 (File_read::read): Adjust for byteshift in returned view.
6559 (File_read::add_view): New function, broken out of
6560 find_and_make_view.
6561 (File_read::make_view): New function, broken out of
6562 find_and_make_view.
6563 (File_read::find_or_make_view): Add offset and aligned
6564 parameters. Rewrite accordingly. Change all callers.
6565 (File_read::get_view): Add offset and aligned parameters. Adjust
6566 for byteshift in return value.
6567 (File_read::get_lasting_view): Likewise.
6568 * fileread.h (class File_read): Update declarations.
6569 (class File_read::View): Add byteshift_ field. Add byteshift to
6570 constructor. Add byteshift method.
6571 * archive.h (Archive::clear_uncached_views): New function.
6572 (Archive::get_view): Add aligned parameter. Change all callers.
6573 * object.h (Object::get_view): Add aligned parameter. Change all
6574 callers.
6575 (Object::get_lasting_view): Likewise.
6576
6577 * fileread.cc (File_read::release): Don't call clear_views if
6578 there are multiple objects.
6579 * fileread.h (File_read::clear_uncached_views): New function.
6580 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
6581 on the archive.
6582
a1207466
CC
65832008-03-31 Cary Coutant <ccoutant@google.com>
6584
6585 Add thin archive support.
6586 * archive.cc (Archive::armagt): New const.
6587 (Archive::setup): Remove task parameter and calls to unlock.
6588 (Archive::unlock_nested_archives): New function.
6589 (Archive::read_header): Add nested_off parameter. Change
6590 all callers.
6591 (Archive::interpret_header): Likewise.
6592 (Archive::include_all_members): Change to handle thin
6593 archives.
6594 (Archive::include_member): Likewise.
6595 * archive.h (Archive::Archive): Add new parameters and
6596 initializers.
6597 (Archive::armagt): New const.
6598 (Archive::setup): Remove task parameter.
6599 (Archive::unlock_nested_archives): New function.
6600 (Archive::read_header): Add nested_off parameter.
6601 (Archive::interpret_header): Likewise.
6602 (Archive::Nested_archive_table): New typedef.
6603 (Archive::is_thin_archive_): New field.
6604 (Archive::nested_archives_): New field.
6605 (Archive::options_): New field.
6606 (Archive::dirpath_): New field.
6607 (Archive::task_): New field.
6608 * readsyms.cc (Read_symbols::do_read_symbols): Add check
6609 for thin archives. Pass additional parameters to
6610 Archive::Archive. Unlock the archive file after calling
6611 Archive::setup.
cd536b21 6612
479f6503
ILT
66132008-03-29 Ian Lance Taylor <iant@google.com>
6614
686c8caf
ILT
6615 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6616 version symbol to be local.
6617 * testsuite/ver_test_4.sh: New file.
6618 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6619 (check_DATA): Add ver_test_4.syms.
6620 (ver_test_4.syms): New target.
6621 * testsuite/Makefile.in: Rebuild.
6622
ab794b6b
ILT
6623 * output.cc
6624 (Output_section::Input_section_sort_entry::has_priority): New
6625 function.
6626 (Output_section::Input_section_sort_entry::match_file_name): New
6627 function.
6628 (Output_section::Input_section_sort_entry::match_section_name):
6629 Remove.
6630 (Output_section::Input_section_sort_entry::match_section_name_prefix):
6631 Remove.
6632 (Output_section::Input_section_sort_entry::match_section_file):
6633 Remove.
6634 (Output_section::Input_section_sort_compare::operator()): Rewrite
6635 using new Input_section_sort_entry functions. Sort crtbegin and
6636 crtend first. Sort sections with no priority before sections with
6637 a priority.
6638 * testsuite/initpri1.c (d3): Check j != 4.
6639 (cd5): New constructor/destructor function.
6640 (main): Check j != 2.
6641
479f6503
ILT
6642 * symtab.cc (Symbol_table::add_from_object): If we don't use the
6643 new symbol when resolving, don't call set_is_default.
6644 * testsuite/ver_test_7.cc: New file.
6645 * testsuite/ver_test_7.sh: New file.
6646 * testsuite/Makefile.am (ver_test_7.so): New target.
6647 (ver_test_7.o): New target.
6648 (check_SCRIPTS): Add ver_test_7.sh.
6649 (check_DATA): Add ver_test_7.syms.
6650 (ver_test_7.syms): New target.
6651
2fd32231
ILT
66522008-03-28 Ian Lance Taylor <iant@google.com>
6653
6654 * layout.cc (Layout::layout): If we see an input section with a
6655 name that needs sorting, set the must_sort flag for the output
6656 section.
6657 (Layout::make_output_section): If the name of the output section
6658 indicates that it might require sorting, set the may_sort flag.
6659 * output.h (Output_section::may_sort_attached_input_sections): New
6660 function.
6661 (Output_section::set_may_sort_attached_input_sections): New
6662 function.
6663 (Output_section::must_sort_attached_input_sections): New
6664 function.
6665 (Output_section::set_must_sort_attached_input_sections): New
6666 function.
6667 (class Output_section): Declare Input_section_sort_entry. Define
6668 Input_section_sort_compare. Declare
6669 sort_attached_input_sections. Add new fields:
6670 may_sort_attached_input_sections_,
6671 must_sort_attached_input_sections_,
6672 attached_input_sections_are_sorted_.
6673 * output.cc (Output_section::Output_section): Initialize new
6674 fields.
6675 (Output_section::add_input_section): Add an entry to
6676 input_sections_ if may_sort or must_sort are true.
6677 (Output_section::set_final_data_size): Call
6678 sort_attached_input_sections if necessary.
6679 (Output_section::Input_section_sort_entry): Define new class.
6680 (Output_section::Input_section_sort_compare::operator()): New
6681 function.
6682 (Output_section::sort_attached_input_sections): New function.
6683 * configure.ac: Check whether the compiler supports constructor
6684 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
6685 * testsuite/initpri1.c: New file.
6686 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
6687 CONSTRUCTOR_PRIORITY.
6688 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
6689 (initpri1_LDFLAGS): New variable.
6690 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6691
18e6b24e
ILT
66922008-03-27 Ian Lance Taylor <iant@google.com>
6693
49bdd526
ILT
6694 * common.cc (Sort_commons::operator): Correct sorting algorithm.
6695 * testsuite/common_test_1.c: New file.
6696 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
6697 (common_test_1_SOURCES): New variable.
6698 (common_test_1_DEPENDENCIES): New variable.
6699 (common_test_1_LDFLAGS): New variable.
6700
18e6b24e
ILT
6701 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
6702 and commons_ correctly when NAME/VERSION does not override
6703 NAME/NULL.
6704 * testsuite/ver_test_6.c: New file.
6705 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
6706 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
6707 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
6708
04bf7072
ILT
67092008-03-26 Ian Lance Taylor <iant@google.com>
6710
5871526f
ILT
6711 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
6712 of an undefined symbol from a version script.
6713 * testsuite/Makefile.am (ver_test_5.so): New target.
6714 (ver_test_5.o): New target.
6715 (check_SCRIPTS): Add ver_test_5.sh.
6716 (check_DATA): Add ver_test_5.syms.
6717 (ver_test_5.syms): New target.
6718 * testsuite/ver_test_5.cc: New file.
6719 * testsuite/ver_test_5.script: New file.
6720 * testsuite/ver_test_5.sh: New file.
6721 * Makefile.in, testsuite/Makefile.in: Rebuild.
6722
04bf7072
ILT
6723 PR gold/5986
6724 Fix problems building gold with gcc 4.3.0.
6725 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
6726 (gold_error_at_location, gold_warning_at_location): Use it.
6727 * configure.ac: Check whether we can compile and use a template
6728 function with a printf attribute.
6729 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
6730 when jumping over bytes.
6731 * object.cc: Instantiate Object::read_section_data.
6732 * debug.h: Include <cstring>
6733 * dwarf_reader.cc: Include <algorithm>
6734 * main.cc: Include <cstring>.
6735 * options.cc: Include <cstring>.
6736 * output.cc: Include <cstring>.
6737 * script.cc: Include <cstring>.
6738 * script.h: Include <string>.
6739 * symtab.cc: Include <cstring> and <algorithm>.
6740 * target-select.cc: Include <cstring>.
6741 * version.cc: Include <string>.
6742 * testsuite/testmain.cc: Include <cstdlib>.
6743 * configure, config.in: Rebuild.
6744
874c5b28
ILT
67452008-03-25 Ian Lance Taylor <iant@google.com>
6746
819d6c3a
ILT
6747 * options.cc: Include "../bfd/bfdver.h".
6748 (options::help): Print bug reporting address.
6749
f4b2c6f5
ILT
6750 * version.cc (print_version): Adjust output for current value of
6751 BFD_VERSION_STRING.
6752
6753 * NEWS: New file.
6754
e96caa79
ILT
6755 * options.cc (options::help): Print list of supported targets.
6756 * target-select.h: Include <vector>.
6757 (class Target_selector): Make machine_, size_, and is_big_endian_
6758 fields const. Add bfd_name_ and instantiated_target_ fields.
6759 (Target_selector::Target_selector): Add bfd_name parameter.
6760 (Target_selector::recognize): Make non-virtual, call
6761 do_recognize.
6762 (Target_selector::recognize_by_name): Make non-virtual, call
6763 do_recognize_by_name.
6764 (Target_selector::supported_names): New function.
6765 (Target_selector::bfd_name): New function.
6766 (Target_selector::do_instantiate_target): New pure virtual
6767 function.
6768 (Target_selector::do_recognize): New virtual function.
6769 (Target_selector::do_recognize_by_name): New virtual function.
6770 (Target_selector::instantiate_target): New private function.
6771 (supported_target_names): Declare.
6772 * target-select.cc (Target_selector::Target_selector): Update for
6773 new parameter and fields.
6774 (select_target_by_name): Check that the name matches before
6775 calling recognize_by_name.
6776 (supported_target_names): New function.
6777 * i386.cc (class Target_selector_i386): Update Target_selector
6778 constructor call. Remove recognize and recognize_by_name. Add
6779 do_instantiate_target.
6780 * x86_64.cc (class Target_selector_x86_64): Likewise.
6781 * testsuite/testfile.cc (class Target_selector_test): Update for
6782 changes to Target_selector.
6783
874c5b28
ILT
6784 * README: Rewrite, with some notes on unsupported features.
6785
0a65a3a7
CC
67862008-03-24 Cary Coutant <ccoutant@google.com>
6787
6788 * i386.cc (Target_i386::Got_type): New enum declaration.
6789 (Target_i386::Scan::local): Updated callers of Output_data_got
6790 member functions.
6791 (Target_i386::Scan::global): Likewise.
6792 (Target_i386::Relocate::relocate): Likewise.
6793 (Target_i386::Relocate::relocate_tls): Likewise.
6794 * object.h (Got_offset_list): New class.
6795 (Sized_relobj::local_has_got_offset): Added got_type parameter.
6796 (Sized_relobj::local_got_offset): Likewise.
6797 (Sized_relobj::set_local_got_offset): Likewise.
6798 (Sized_relobj::local_has_tls_got_offset): Removed.
6799 (Sized_relobj::local_tls_got_offset): Removed.
6800 (Sized_relobj::set_local_tls_got_offset): Removed.
6801 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
6802 * output.cc (Output_data_got::add_global): Added got_type parameter.
6803 (Output_data_got::add_global_with_rel): Likewise.
6804 (Output_data_got::add_global_with_rela): Likewise.
6805 (Output_data_got::add_global_pair_with_rel): New function.
6806 (Output_data_got::add_global_pair_with_rela): New function.
6807 (Output_data_got::add_local): Added got_type parameter.
6808 (Output_data_got::add_local_with_rel): Likewise.
6809 (Output_data_got::add_local_with_rela): Likewise.
6810 (Output_data_got::add_local_pair_with_rel): New function.
6811 (Output_data_got::add_local_pair_with_rela): New function.
6812 (Output_data_got::add_global_tls): Removed.
6813 (Output_data_got::add_global_tls_with_rel): Removed.
6814 (Output_data_got::add_global_tls_with_rela): Removed.
6815 (Output_data_got::add_local_tls): Removed.
6816 (Output_data_got::add_local_tls_with_rel): Removed.
6817 (Output_data_got::add_local_tls_with_rela): Removed.
6818 * output.h (Output_data_got::add_global): Added got_type parameter.
6819 (Output_data_got::add_global_with_rel): Likewise.
6820 (Output_data_got::add_global_with_rela): Likewise.
6821 (Output_data_got::add_global_pair_with_rel): New function.
6822 (Output_data_got::add_global_pair_with_rela): New function.
6823 (Output_data_got::add_local): Added got_type parameter.
6824 (Output_data_got::add_local_with_rel): Likewise.
6825 (Output_data_got::add_local_with_rela): Likewise.
6826 (Output_data_got::add_local_pair_with_rel): New function.
6827 (Output_data_got::add_local_pair_with_rela): New function.
6828 (Output_data_got::add_global_tls): Removed.
6829 (Output_data_got::add_global_tls_with_rel): Removed.
6830 (Output_data_got::add_global_tls_with_rela): Removed.
6831 (Output_data_got::add_local_tls): Removed.
6832 (Output_data_got::add_local_tls_with_rel): Removed.
6833 (Output_data_got::add_local_tls_with_rela): Removed.
6834 * resolve.cc (Symbol::override_base_with_special): Removed
6835 reference to has_got_offset_ field.
6836 * symtab.cc (Symbol::init_fields): Replaced initialization
6837 of got_offset_ with got_offsets_. Removed initialization
6838 of has_got_offset_
53fcba31 6839 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
6840 (Symbol::got_offset): Likewise.
6841 (Symbol::set_got_offset): Likewise.
6842 (Symbol::has_tls_got_offset): Removed.
6843 (Symbol::tls_got_offset): Removed.
6844 (Symbol::set_tls_got_offset): Removed.
6845 (Symbol::got_offset_): Removed.
6846 (Symbol::tls_mod_got_offset_): Removed.
6847 (Symbol::tls_pair_got_offset_): Removed.
6848 (Symbol::got_offsets_): New field.
6849 (Symbol::has_got_offset): Removed.
6850 (Symbol::has_tls_mod_got_offset): Removed.
6851 (Symbol::has_tls_pair_got_offset): Removed.
6852 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6853 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6854 member functions.
6855 (Target_x86_64::Scan::global): Likewise.
6856 (Target_x86_64::Relocate::relocate): Likewise.
6857 (Target_x86_64::Relocate::relocate_tls): Likewise.
6858
bd52eafb
BE
68592008-03-25 Ben Elliston <bje@au.ibm.com>
6860
6861 * yyscript.y: Fix spelling error in comment.
6862
8b105e34
ILT
68632008-03-24 Ian Lance Taylor <iant@google.com>
6864
8ed814a9
ILT
6865 * options.h (class General_options): Define build_id option.
6866 * layout.h (class Layout): Declare write_build_id, create_note,
6867 create_build_id. Add build_id_note_ member.
6868 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6869 "libiberty.h", "md5.h", "sha1.h".
6870 (Layout::Layout): Initialize eh_frame_data_,
6871 eh_frame_hdr_section_, and build_id_note_.
6872 (Layout::finalize): Call create_build_id.
6873 (Layout::create_note): New function, broken out of
6874 Layout::create_gold_note.
6875 (Layout::create_gold_note): Call create_note.
6876 (Layout::create_build_id): New function.
6877 (Layout::write_build_id): New function.
6878 (Close_task_runner::run): Call write_build_id.
6879
8b105e34
ILT
6880 * x86_64.cc: Correct license to GPLv3.
6881
086a1841
ILT
68822008-03-23 Ian Lance Taylor <iant@google.com>
6883
6884 * options.cc: Include "demangle.h".
6885 (parse_optional_string): New function.
6886 (parse_long_option): Handle takes_optional_argument.
6887 (parse_short_option): Update dash_z initializer. Handle
6888 takes_optional_argument.
6889 (General_options::General_options): Initialize do_demangle_.
6890 (General_options::finalize): Set do_demangle_. Handle demangling
6891 style.
6892 * options.h (parse_optional_string): Declare.
6893 (struct One_option): Add optional_arg field. Update constructor.
6894 Update call constructor calls. Add takes_optional_argument
6895 function.
6896 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6897 (DEFINE_optional_string): Define.
6898 (General_options::demangle): Change from DEFINE_bool to
6899 DEFINE_optional_string.
6900 (General_options::no_demangle): New function.
6901 (General_options::do_demangle): New function.
6902 (General_options::set_do_demangle): New function.
6903 (General_options::execstack_status_): Move definition to end of
6904 class definition.
6905 (General_options::static_): Likewise.
6906 (General_options::do_demangle_): New field.
6907 * object.cc (big_endian>::get_symbol_location_info): Call
6908 Options::do_demangle, not Options::demangle.
6909 * symtab.cc (demangle): Likewise.
6910
cbb93e63
ILT
69112008-03-22 Ian Lance Taylor <iant@google.com>
6912
6913 * gold.h: Include <cstddef> and <sys/types.h>
6914 * options.h: Include <cstring>.
6915
ec531623
ILT
69162008-03-21 Ian Lance Taylor <iant@google.com>
6917
6918 * Added source code to GNU binutils.
This page took 0.404468 seconds and 4 git commands to generate.