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