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