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