2009-11-24 Rafael Avila de Espindola <espindola@google.com>
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
e2b8f3c4
RÁE
12009-11-24 Rafael Avila de Espindola <espindola@google.com>
2
3 * Makefile.am: Build incremental-dump
4 * Makefile.in: Regenerate.
5 * incremental-dump.cc: New.
6 * incremental.cc (Incremental_inputs_header_data,
7 Incremental_inputs_entry_data): Move to incremental.h
8 * incremental.h: (Incremental_inputs_header_data,
9 Incremental_inputs_entry_data): Move from incremental.cc
10
bcba9aec
RÁE
112009-11-24 Rafael Avila de Espindola <espindola@google.com>
12
13 * incremental.cc (Incremental_inputs_header,
14 Incremental_inputs_header_write, Incremental_inputs_entry,
15 Incremental_inputs_entry_write): Add a typedef with the data type.
16
7c3afe08
RÁE
172009-11-24 Rafael Avila de Espindola <espindola@google.com>
18
19 * incremental.cc (Incremental_inputs_header,
20 Incremental_inputs_header_write, Incremental_inputs_entry,
21 Incremental_inputs_entry_write): Update comment about which
22 type has the filed descriptions.
23
d204b6e9
DK
242009-11-15 Doug Kwan <dougkwan@google.com>
25
26 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
27 (Arm_relocate_functions::arm_branch_common): Change method defintion
28 in class definition to a method declaration and update list of formal
29 parameters.
30 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
31 Arm_relocation_functions::jump24): Adjust call to
32 Arm_relocate_functions::arm_branch_common. Update list of formal
33 parameters.
34 (Arm_relocate_functions::xpc25): New method definition.
35 (Arm_relocate_functions::arm_branch_common): Move method defintion
36 out from class definition. Use stubs for mode-switching and extending
37 branch ranges.
38 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
39 specially. Change code to enable use of stubs in ARM branches.
40
43d12afe
DK
412009-11-10 Doug Kwan <dougkwan@google.com>
42
43 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
44 in method declaration.
45 (Target_arm::relocate_stub): New method declaration.
46 (Target_arm::default_target): Change to return a pointer instead of
47 a const reference.
48 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
49 Target_arm::default_target.
50 (Arm_Relobj::do_relocate_sections): Remove options paramater in
51 method definition.
52 (Target_arm::relocate_section): Adjust view.
53 (Target_arm::relocate_stub): New method definition.
54
ac33a407
DK
552009-11-10 Doug Kwan <dougkwan@google.com>
56
57 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
58 a format warning.
59 * incremental.cc (open_incremental_binary): Initialized local
60 variables to avoid warnings.
61 * object.cc (make_elf_object): Ditto.
62 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
63 a format warning.
64
88ee28e9
L
65009-11-09 H.J. Lu <hongjiu.lu@intel.com>
66
67 PR gold/10930
68 * testsuite/plugin_test.c: Include "config.h".
69
2daedcd6
DK
702009-11-09 Doug Kwan <dougkwan@google.com>
71
72 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
73 (arm_symbol_value): Remove.
74 (Arm_relocate_functions::arm_branch_common,
75 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
76 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
77 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
78 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
79 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
80 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
81 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
82 Arm_relocate_functions::thm_mobw_abs_nc,
83 Arm_relocate_functions::thm_mov_abs,
84 Arm_relocate_functions::movw_prel_nc,
85 Arm_relocate_functions::thm_movt_abs,
86 Arm_relocate_functions::movt_prel,
87 Arm_relocate_functions::thm_movw_prel_nc,
88 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
89 (Target_arm::Relocate::relocate): Only decompose address into two
90 parts if relocation type uses the thumb-bit and pass the actual
91 bit instead of a flag indicating that the thumb-bit is used. Adjust
92 calls to methods in Arm_relocate_functions for this change.
93
3e4afc80
ILT
942009-11-08 Ian Lance Taylor <ian@airs.com>
95
96 PR 10925
97 * reloc.cc: Instantiate
98 Sized_relobj::initialize_input_to_output_maps and
99 Sized_relobj:free_input_to_output_maps.
100
e53ad1b5
ILT
1012009-11-06 Ian Lance Taylor <iant@google.com>
102
103 PR 10876
104 * defstd.cc (in_segment): Set only_if_ref true for "end".
105
eb44217c
DK
1062009-11-06 Doug Kwan <dougkwan@google.com>
107
108 * arm.cc (class Reloc_stub): Correct a comment.
109 (Target_arm::Target_arm): Initialize arm_input_section_map_.
110 (Target_arm::scan_section_for_stubs): New method declaration.
111 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
112 Change methods from private to protected.
113 (Target_arm::do_may_relax): New method definition.
114 (Target_arm::do_relax, Target_arm::group_sections,
115 Target_arm::scan_reloc_for_stub,
116 Target_arm::scan_reloc_section_for_stubs): New method declarations.
117 (Target_arm::arm_input_section_map_): New data member declaration.
118 (Target_arm::scan_reloc_for_stub,
119 Target_arm::scan_reloc_section_for_stubs,
120 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
121 Target_arm::do_relax): New method definitions.
122
5d329b7d
ILT
1232009-11-06 Mikolaj Zalewski <mikolaj@google.com>
124
125 * configure.ac: Check for (struct stat)::st_mtim
126 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
127 * config.in: Regenerate.
128 * configure: Regenerate.
129
96a0d71b
ILT
1302009-11-05 Ian Lance Taylor <iant@google.com>
131
132 PR 10910
133 * output.cc (Output_segment::add_output_section): Add missing
134 return statement.
135
594c8e5e
ILT
1362009-11-04 Ian Lance Taylor <iant@google.com>
137
138 PR 10880
139 * object.h (class Object): Add is_needed and set_is_needed
140 methods. Add is_needed_ field. Make bool fields into bitfields.
141 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
142 defined in a dynamic object and referenced by a regular object,
143 set is_needed for the dynamic object.
144 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
145 if the file is marked with as_needed and it is not needed.
146
22b127cc
ILT
1472009-11-04 Ian Lance Taylor <iant@google.com>
148
149 PR 10887
150 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
151 tags if data is discarded by linker script.
152 * i386.cc (Target_i386::do_finalize_sections): Likewise.
153 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
154 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
155 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
156
f5c870d2
ILT
1572009-11-04 Ian Lance Taylor <iant@google.com>
158
159 * layout.cc (Layout::get_output_section): Add is_interp and
160 is_dynamic_linker_section parameters. Change all callers.
161 (Layout::choose_output_section): Likewise.
162 (Layout::make_output_section): Likewise.
163 (Layout::add_output_section_data): Add is_dynamic_linker_section
164 parameter. Change all callers.
165 * layout.h (class Layout): Update declarations.
166 * output.h (class Output_section): Add is_interp, set_is_interp,
167 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
168 Add is_interp_, is_dynamic_linker_section_ fields. Change
169 generate_code_fills_at_write_ to a bitfield.
170 * output.cc (Output_section::Output_sections): Initialize new
171 fields.
172 (Output_segment::add_output_section): Add do_sort parameter.
173 Change all callers.
174
1ae4d23b
ILT
1752009-11-03 Ian Lance Taylor <iant@google.com>
176
177 PR 10860
178 * options.h (class General_options): Add --warn-common.
179 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
180 merging two common symbols.
181 (Symbol_table::should_override): Handle --warn-common when merging
182 a common symbol with a defined symbol. Use report_resolve_problem
183 for multiple definitions.
184 (Symbol_table::report_resolve_problem): New function.
185 * symtab.h (class Symbol_table): Declare report_resolve_problem.
186
55da9579
DK
1872009-11-03 Doug Kwan <dougkwan@google.com>
188
189 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
190 stub_factory_.
191 (Target_arm::stub_factory): New method definition.
192 (Target_arm::new_arm_input_section,
193 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
194 Target_arm::reloc_uses_thumb_bit): New method declarations.
195 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
196 New type definitions.
197 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
198 member declarations.
199 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
200 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
201 New method definitions.
202
37a9ac43
ILT
2032009-11-03 Ian Lance Taylor <iant@google.com>
204
205 * options.h (class General_options): Add --warn_constructors.
206
b3d6a3d4
ILT
2072009-11-03 Ian Lance Taylor <iant@google.com>
208
209 PR 10893
210 * defstd.cc (in_section): Add entries for __rel_iplt_start,
211 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
212
934b01dd
ILT
2132009-11-03 Ian Lance Taylor <iant@google.com>
214
215 PR 10895
216 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
217 --msgid-bugs-address.
218 (install-pdf): New target.
219 (install-data_yes): Look up one directory to find mkinstalldirs.
220
03c1939b
L
2212009-11-03 H.J. Lu <hongjiu.lu@intel.com>
222
223 * po/Make-in (.po.gmo): Don't generate .gmo files in source
224 tree.
225
ebd95253
DK
2262009-10-30 Doug Kwan <dougkwan@google.com>
227
228 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
229
e9bbb538
DK
2302009-10-30 Doug Kwan <dougkwan@google.com>
231
232 * arm.cc (Stub_addend_reader): New struct template definition
233 and partial specializations.
234 (Stub_addend_reader::operator()): New method definition for a
235 partially specialized template.
236
d5b40221
DK
2372009-10-30 Doug Kwan <dougkwan@google.com>
238
239 * arm.cc (Arm_relobj::processor_specific_flags): New method
240 definition.
241 (Arm_relobj::do_read_symbols): New method declaration.
242 (Arm_relobj::processor_specific_flags_): New data member declaration.
243 (Arm_dynobj): New class definition.
244 (Target_arm::do_finalize_sections): Add input_objects parameter.
245 (Target_arm::do_adjust_elf_header): New method declaration.
246 (Target_arm::are_eabi_versions_compatible,
247 (Target_arm::merge_processor_specific_flags): New method declaration.
248 (Target_arm::do_make_elf_object): New overloaded method definitions
249 and declaration.
250 (Arm_relobj::do_read_symbols): New method definition.
251 (Arm_dynobj::do_read_symbols): Ditto.
252 (Target_arm::do_finalize_sections): Add input_objects parameters.
253 Merge processor-specific flags from all input objects.
254 (Target_arm::are_eabi_versions_compatible,
255 Target_arm::merge_processor_specific_flags,
256 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
257 New method definitions.
258 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
259 Input_objects pointer type parameter.
260 * layout.cc (Layout::finalize): Pass input objects to target's.
261 finalize_sections function.
262 * output.cc (Output_file_header::do_sized_write): Set ELF file
263 header's processor-specific flags.
264 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
265 Input_objects pointer type parameter.
266 * sparc.cc (Target_sparc::do_finalize_sections): Same.
267 * target.h (Input_objects): New forward class declaration.
268 (Target::processor_specific_flags,
269 Target::are_processor_specific_flags_sect): New method definitions.
270 (Target::finalize_sections): Add input_objects parameter.
271 (Target::Target): Initialize processor_specific_flags_ and
272 are_processor_specific_flags_set_.
273 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
274 parameter.
275 (Target::set_processor_specific_flags): New method definition.
276 (Target::processor_specific_flags_,
277 Target::are_processor_specific_flags_set_): New data member
278 declarations.
279 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
280 Input_objects pointer type parameter.
281
ebabffbd
DK
2822009-10-30 Doug Kwan <dougkwan@google.com>
283
284 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
285
ad0f2072
ILT
2862009-10-28 Ian Lance Taylor <iant@google.com>
287
288 * object.h (class Relobj): Drop options parameter from
289 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
290 do_scan_relocs, do_relocate. Change all callers.
291 (class Sized_relobj): Drop options parameters from
292 do_gc_process_relocs, do_scan_relocs, do_relocate,
293 do_relocate_sections, relocate_sections, emit_relocs_scan,
294 emit_relocs_scan_reltype. Change all callers.
295 (struct Relocate_info): Remove options field and all references to
296 it.
297 * reloc.h (class Read_relocs): Remove options constructor
298 parameter and options_ field. Change all callers.
299 (class Gc_process_relocs, class Scan_relocs): Likewise.
300 (class Relocate_task): Likewise.
301 * target-reloc.h (scan_relocs): Remove options parameter. Change
302 all callers.
303 (scan_relocatable_relocs): Likewise.
304 * target.h (class Sized_target): Remove options parameter from
305 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
306 all callers.
307 * gc.h (gc_process_relocs): Remove options parameter. Change all
308 callers.
309 * arm.cc: Update functions to remove options parameters.
310 * i386.cc: Likewise.
311 * powerpc.cc: Likewise.
312 * sparc.cc: Likewise.
313 * x86_64.cc: Likewise.
314 * testsuite/testfile.cc: Likewise.
315
8ffa3667
DK
3162009-10-28 Doug Kwan <dougkwan@google.com>
317
318 * arm.cc (Arm_relobj): New class definition.
319 (Arm_relobj::scan_sections_for_stubs,
320 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
321 New method definitions.
322
40f36857
CC
3232009-10-28 Cary Coutant <ccoutant@google.com>
324
325 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
326 (Plugin::cleanup_done_): New member.
327 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
328 (Plugin_manager::cleanup_done_): Remove.
329 (Plugin_manager::add_input_file): Edit error message.
330 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
331 (Plugin_manager::cleanup): Remove use of cleanup_done_.
332
2c849493
ILT
3332009-10-27 Mikolaj Zalewski <mikolajz@google.com>
334
335 * fileread.cc: (File_read::View::~View): Use the new
336 data_ownership_ filed.
337 (File_read::~File_read): Dispose the new whole_file_view_.
338 (File_read::open): Mmap the whole file if needed.
339 (File_read::open): Use whole_file_view_ instead of contents_.
340 (File_read::find_view): Use whole_file_view_ if applicable.
341 (File_read::do_read): Use whole_file_view_ instead of contents_.
342 (File_read::make_view): Use whole_file_view_ instead of contents_,
343 update File_read::View::View call.
344 (File_read::find_or_make_view): Update File_read::View::View
345 call.
346 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
347 remove contents_
348 (File_read::View::Data_ownership): New enum.
349 (File_read::View::View): Replace bool mapped_ with Data_ownership
350 argument.
351 (File_read::View::mapped_): Remove (replaced by data_ownership_).
352 (File_read::View::data_ownership_): New field.
353 (File_read::contents_): Remove (replaced by whole_file_view_).
354 (File_read::whole_file_view_): New field.
355 * options.h (class General_options): Add --keep-files-mapped.
356
24998053
CC
3572009-10-27 Cary Coutant <ccoutant@google.com>
358
359 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
360 * testsuite/Makefile.am (plugin_test_5): New test case.
361 * testsuite/Makefile.in: Regenerate.
362
72adc4fa
DK
3632009-10-25 Doug Kwan <dougkwan@google.com>
364
365 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
366 from private to protected to allow access by child class.
367 (Sized_relobj::do_relocate_sections): New method declaration.
368 (Sized_relobj::relocate_sections): Virtualize.
369 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
370 Sized_relobj::relocate_sections. Instantiate template explicitly
371 for different target sizes and endianity.
372
07f508a2
DK
3732009-10-24 Doug Kwan <dougkwan@google.com>
374
375 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
376 (Arm_input_section::as_arm_input_section): New method.
377 (Arm_output_section): New class definition.
378 (Arm_output_section::create_stub_group,
379 Arm_output_section::group_sections): New method definitions.
380
10ad9fe5
DK
3812009-10-22 Doug Kwan <dougkwan@google.com>
382
383 * arm.cc (Arm_input_section): New class definition.
384 (Arm_input_section::init, Arm_input_section:do_write,
385 Arm_input_section::set_final_data_size,
386 Arm_input_section::do_reset_address_and_file_offset): New method
387 definitions.
388
56ee5e00
DK
3892009-10-21 Doug Kwan <dougkwan@google.com>
390
391 * arm.cc (Stub_table, Arm_input_section): New forward class
392 declarations.
393 (Stub_table): New class defintion.
394 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
395 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
396 New method definition.
397
b569affa
DK
3982009-10-21 Doug Kwan <dougkwan@google.com>
399
400 * arm.cc: Update copyright comments.
401 (Target_arm): New forward class template declaration.
402 (Arm_address): New type.
403 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
404 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
405 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
406 constants.
407 (Insn_template): Same.
408 (DEF_STUBS): New macro.
409 (Stub_type): New enum type.
410 (Stub_template): New class definition.
411 (Stub): Same.
412 (Reloc_stub): Same.
413 (Stub_factory): Same.
414 (Target_arm::Target_arm): Initialize may_use_blx_ and
415 should_force_pic_veneer_.
416 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
417 Target_arm::should_force_pic_veneer,
418 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
419 Target_arm::using_thumb_only, Target_arm:;default_target): New
420 method defintions.
421 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
422 New data member declarations.
423 (Insn_template::size, Insn_template::alignment): New method defintions.
424 (Stub_template::Stub_template): New method definition.
425 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
426 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
427 (Stub_factory::Stub_factory): New method definition.
428 * gold.h (string_hash): New template.
429 * output.h (Input_section_specifier::hash_value): Use
430 gold::string_hash.
431 (Input_section_specifier::string_hash): Remove.
432 * stringpool.cc (Stringpool_template::string_hash): Use
433 gold::string_hash.
434
6c172549
DK
4352009-10-20 Doug Kwan <dougkwan@google.com>
436
437 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
438 symbols of relaxed input sections.
439 * output.h (Output_section::find_relaxed_input_section): Make
440 method public.
441
c5617f2f
DK
4422009-10-16 Doug Kwan <dougkwan@google.com>
443
444 * dynobj.cc (Versions::Versions): Initialize version_script_.
445 Only insert base version symbol definition for a shared object
446 if version script defines any version versions.
447 (Versions::define_base_version): New method definition.
448 (Versions::add_def): Check that base version is not needed.
449 (Versions::add_need): Define base version lazily.
450 * dynobj.h (Versions::define_base_version): New method declaration.
451 (Versions::needs_base_version_): New data member declaration.
452 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
453 (check_DATA): Add no_version_test.stdout.
454 (libno_version_test.so, no_version_test.o no_version_test.stdout):
455 New make rules.
456 * testsuite/Makefile.in: Regenerate.
457 * testsuite/no_version_test.c: New file.
458 * testsuite/no_version_test.sh: Ditto.
459
3c12dcdb
DK
4602009-10-16 Doug Kwan <dougkwan@google.com>
461
462 * expression.cc (class Segment_start_expression): New class definition.
463 (Segment_start_expression::value): New method definition.
464 (script_exp_function_segment_start): Return a new
465 Segment_start_expression.
466 * gold/script-c.h (script_saw_segment_start_expression): New function
467 prototype.
468 * script-sections.cc (Script_sections::Script_sections): Initialize
469 SAW_SEGMENT_START_EXPRESSION_ to false.
470 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
471 and -Tbbs options to specify section addresses if given in
472 command line and no SEGMENT_START expression is seen in a script.
473 * script-sections.h (Script_sections::saw_segment_start_expression,
474 Script_sections::set_saw_segment_start_expression): New method
475 definition.
476 (Script_sections::saw_segment_start_expression_): New data member
477 declaration.
478 * script.cc (script_saw_segment_start_expression): New function.
479 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
480 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
481 script_test_7.sh and script_test_8.sh.
482 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
483 script_test_8.stdout.
484 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
485 (script_test_6, script_test_6.stdout, script_test_7,
486 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
487 * Makefile.in: Regenerate.
488 * testsuite/script_test_6.sh: New file.
489 * testsuite/script_test_6.t: Same.
490 * testsuite/script_test_7.sh: Same.
491 * testsuite/script_test_7.t: Same.
492 * testsuite/script_test_8.sh: Same.
493
64b1ae37
DK
4942009-10-16 Doug Kwan <dougkwan@google.com>
495
496 * output.cc (Output_segment::set_section_list_address): Cast
497 expressions to unsigned long long type to avoid format warnings.
498
661be1e2
ILT
4992009-10-15 Ian Lance Taylor <iant@google.com>
500
12edd763 501 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 502 dot assignment to script_sections_.
12edd763
ILT
503 * script-sections.cc (Script_sections::add_dot_assignment):
504 Initialize if necessary.
505
68b6574b
ILT
506 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
507 program headers with no load segment if there is a linker script.
508
661be1e2
ILT
509 * layout.cc (Layout::set_segment_offsets): Align the file offset
510 to the segment aligment for -N or -n with no load segment.
511 * output.cc (Output_segment::add_output_section): Don't crash if
512 the first section is a TLS section.
513 (Output_segment::set_section_list_addresses): Print an error
514 message if the address moves backward in a linker script.
515 * script-sections.cc
516 (Output_section_element_input::set_section_addresses): Don't
517 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
518 (Orphan_output_section::set_section_addresses): Likewise.
519
f15f61a7
DK
5202009-10-15 Doug Kwan <dougkwan@google.com>
521
522 * layout.cc (Layout::finish_dynamic_section): Generate tags
523 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
524 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
525 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
526
82bb573a
ILT
5272009-10-14 Ian Lance Taylor <iant@google.com>
528
529 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
530 fields.
531 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
532 data_shdr fields of relinfo.
533 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
534 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
535 R_386_TLS_LDO_32, adjust based on section flags.
536 (Target_i386::Relocate::fix_up_ldo): Remove.
537
374ad285
ILT
5382009-10-13 Ian Lance Taylor <iant@google.com>
539
540 Add support for -pie.
541 * options.h (class General_options): Add -pie and
542 --pic-executable.
543 (General_options::output_is_position_independent): Test -pie.
544 (General_options::output_is_executable): Return true if not shared
545 and not relocatable.
546 (General_options::output_is_pie): Remove.
547 * options.cc (General_options::finalize): Reject incompatible uses
548 of -pie.
549 * gold.cc (queue_middle_tasks): A -pie link is not static.
550 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
551 * symtab.cc (Symbol::final_value_is_known): Return false if
552 output_is_position_independent.
553 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
554 output_is_position_independent.
555 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
556 output_is_position_independent.
557 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
558 output_is_position_independent.
559 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
560 two_file_pie_test.
561 (basic_pie_test.o, basic_pie_test): New targets.
562 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
563 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
564 (two_file_pie_test): New target.
565 * testsuite/Makefile.in: Rebuild.
566 * README: Remove note saying that -pie is not supported.
567
c6585162
ILT
5682009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
569
570 * options.h (class General_options): Add -init and -fini.
571 * layout.cc (Layout::finish_dynamic_section): Emit
572 given init and fini functions.
573
032ce4e9
ST
5742009-10-13 Sriraman Tallam <tmsriram@google.com>
575
576 * gc.h (gc_process_relocs): Check if icf is enabled using new
577 function.
578 * gold.cc (queue_initial_tasks): Likewise.
579 (queue_middle_tasks): Likewise.
580 * object.cc (do_layout): Likewise.
581 * symtab.cc (is_section_folded): Likewise.
582 * main.cc (main): Likewise.
583 * reloc.cc (Read_relocs::run): Likewise.
584 (Sized_relobj::do_scan_relocs): Likewise.
585 * icf.cc (is_function_ctor_or_dtor): New function.
586 (Icf::find_identical_sections): Check if function is ctor or dtor when
587 safe icf is chosen.
588 * options.h (General_options::icf): Change option to be an enum.
589 (Icf_status): New enum.
590 (icf_enabled): New method.
591 (icf_safe_folding): New method.
592 (set_icf_status): New method.
593 (icf_status_): New variable.
594 * (options.cc) (General_options::finalize): Set icf_status_.
595 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
596 icf_test and icf_keep_unique_test to use the --icf enum flag.
597 * testsuite/icf_safe_test.sh: New file.
598 * testsuite/icf_safe_test.cc: New file.
599
f345227a
ST
6002009-10-12 Sriraman Tallam <tmsriram@google.com>
601
602 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
603 includes to gc.h and icf.h.
604 * arm.cc: Include gc.h.
605 * gold.cc: Likewise.
606 * i386.cc: Likewise.
607 * powerpc.cc: Likewise.
608 * sparc.cc: Likewise.
609 * x86_64.cc: Likewise.
610 * gc.h: Include icf.h.
611
1c7814ed
ILT
6122009-10-11 Ian Lance Taylor <iant@google.com>
613
614 * plugin.cc: Include "gold.h" before other header files.
615
ae3b5189
CD
6162009-10-10 Chris Demetriou <cgd@google.com>
617
618 * options.h (Input_file_argument::Input_file_type): New enum.
619 (Input_file_argument::is_lib_): Replace with...
620 (Input_file_argument::type_): New member.
621 (Input_file_argument::Input_file_argument): Take Input_file_type
622 'type' rather than boolean 'is_lib' as second argument.
623 (Input_file_argument::is_lib): Use type_.
624 (Input_file_argument::is_searched_file): New function.
625 (Input_file_argument::may_need_search): Handle is_searched_file.
626 * options.cc (General_options::parse_library): Support -l:filename.
627 (General_options::parse_just_symbols): Update for Input_file_argument
628 changes.
629 (Command_line::process): Likewise.
630 * archive.cc (Archive::get_file_and_offset): Likewise.
631 * plugin.cc (Plugin_manager::release_input_file): Likewise.
632 * script.cc (read_script_file, script_add_file): Likewise.
633 * fileread.cc (Input_file::Input_file): Likewise.
634 (Input_file::will_search_for): Handle is_searched_file.
635 (Input_file::open): Likewise.
636 * readsyms.cc (Read_symbols::get_name): Likewise.
637 * testsuite/Makefile.am (searched_file_test): New test.
638 * testsuite/Makefile.in: Regenerate.
639 * testsuite/searched_file_test.cc: New file.
640 * testsuite/searched_file_test_lib.cc: New file.
641
f3048a1d
ILT
6422009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
643 Ian Lance Taylor <iant@google.com>
644
645 * descriptor.cc: Include <cstdio> and "binary-io.h".
646 (Descriptors::open): Open the files in binary mode always.
647 * script.cc (Lex::get_token): Treat \r as whitespace.
648
d4780e57
ILT
6492009-10-09 Ian Lance Taylor <iant@google.com>
650
651 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
652
d9a893b8
ILT
6532009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
654 Ian Lance Taylor <iant@google.com>
655
656 * configure.ac: Check for readv function also.
657 * fileread.cc (readv): Define if not HAVE_READV.
658 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
659 does not exist.
660 * config.in: Regenerate.
661 * configure: Regenerate.
662
c0a62865
DK
6632009-10-09 Doug Kwan <dougkwan@google.com>
664
665 * layout.cc (Layout::make_output_section): Call target hook to make
666 ordinary output section.
667 (Layout::finalize): Adjust parameter list of call the
668 Target::may_relax().
669 * layout.h (class Layout::section_list): New method.
670 * merge.h (Output_merge_base::entsize): Change visibility to public.
671 (Output_merge_base::is_string, Output_merge_base::do_is_string):
672 New methods.
673 (Output_merge_string::do_is_string): New method.
674 * object.cc (Sized_relobj::do_setup): renamed from
675 Sized_relobj::set_up.
676 * object.h (Sized_relobj::adjust_shndx,
677 Sized_relobj::initializ_input_to_output_maps,
678 Sized_relobj::free_input_to_output_maps): Change visibilities to
679 protected.
680 (Sized_relobj::setup): Virtualize.
681 (Sized_relobj::do_setup): New method declaration.
682 (Sized_relobj::invalidate_section_offset,
683 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
684 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
685 * options.cc (parse_int): New function.
686 * options.h (parse_int): New declaration.
687 (DEFINE_int): New macro.
688 (stub_group_size): New option.
689 * output.cc (Output_section::Output_section): Initialize memebers
690 merge_section_map_, merge_section_by_properties_map_,
691 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
692 (Output_section::add_input_section): Handled deferred code-fill
693 generation and remove an old comment.
694 (Output_section::add_relaxed_input_section): New method definition.
695 (Output_section::add_merge_input_section): Use merge section by
696 properties map to speed to search. Update merge section maps
697 as appropriate.
698 (Output_section::build_relaxation_map): New method definition.
699 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
700 Same.
701 (Output_section::relax_input_section): Renamed to
702 Output_section::convert_input_sections_to_relaxed_sections and change
703 interface to take a vector of pointers to relaxed sections.
704 (Output_section::find_merge_section,
705 Output_section::find_relaxed_input_section): New method definitions.
706 (Output_section::is_input_address_mapped,
707 Output_section::output_offset, Output_section::output_address):
708 Use output section data maps to speed up searching.
709 (Output_section::find_starting_output_address): Add comments.
710 (Output_section::do_write,
711 Output_section::write_to_postprocessing_buffer): Do code-fill
712 generation as appropriate.
713 (Output_section::get_input_sections): Invalidate relaxed input section
714 map.
715 (Output_section::restore_states): Adjust type of checkpoint .
716 Invalidate relaxed input section map.
717 * output.h (Output_merge_base): New class declaration.
718 (Input_section_specifier): New class defintion.
719 (class Output_relaxed_input_section) Change base class to
720 Output_section_data_build.
721 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
722 base class initializer.
723 (Output_section::add_relaxed_input_section): New method declaration.
724 (Output_section::Input_section): Change visibility to protected.
725 (Output_section::Input_section::relobj,
726 Output_section::Input_section::shndx): Handle relaxed input sections.
727 Output_section::input_sections) Change visibility to protected. Also
728 define overload to return a non-const pointer.
729 (Output_section::Merge_section_properties): New class defintion.
730 (Output_section::Merge_section_by_properties_map,
731 Output_section::Output_section_data_by_input_section_map,
732 Output_section::Relaxation_map): New types.
733 (Output_section::relax_input_section): Rename method to
734 Output_section::convert_input_sections_to_relaxed_sections and change
735 interface to take a vector of relaxed section pointers.
736 (Output_section::find_merge_section,
737 Output_section::find_relaxed_input_section,
738 Output_section::build_relaxation_map,
739 Output_section::convert_input_sections_in_list_to_relaxed_sections):
740 New method declarations.
741 (Output_section::merge_section_map_
742 Output_section::merge_section_by_properties_map_,
743 Output_section::relaxed_input_section_map_,
744 Output_section::is_relaxed_input_section_map_valid_,
745 Output_section::generate_code_fills_at_write_): New data members.
746 * script-sections.cc
747 (Output_section_element_input::set_section_addresses): Call
748 current_data_size and addralign methods of relaxed input sections.
749 (Orphan_output_section::set_section_addresses): Call current_data_size
750 and addralign methods of relaxed input sections.
751 * symtab.cc (Symbol_table::compute_final_value): Extract template
752 from the body of Symbol_table::sized_finalize_symbol.
753 (Symbol_table::sized_finalized_symbol): Call
754 Symbol_table::compute_final_value.
755 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
756 (Symbol_table::compute_final_value): New templated method declaration.
757 * target.cc (Target::do_make_output_section): New method defintion.
758 * target.h (Target::make_output_section): New method declaration.
759 (Target::relax): Add more parameters for input objects, symbol table
760 and layout. Adjust call to do_relax.
761 (Target::do_make_output_section): New method declaration.
762 (Target::do_relax): Add parameters for input objects, symbol table
763 and layout.
764
d446d6c4
ILT
7652009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
766
767 * pread.c: Include stdio.h.
768
bc06c745
ILT
7692009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
770
771 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
772 defined.
773
75aea3d0
ILT
7742009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
775
776 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
777 Change read_shndx type to unsigned int.
778 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
779 int.
780 (Sized_dwarf_line_info::read_line_mappings): Likewise.
781 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
782 Change read_shndx type to unsigned int.
783 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
784 int.
785 (Sized_dwarf_line_info::read_line_mappings): Likewise.
786 * layout.cc (Layout::create_symtab_sections): Cast the result of
787 local_symcount * symsize to off_t in the gold_assert.
788
be8fcb75
ILT
7892009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
790
791 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
792 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
793 R_ARM_BASE_ABS.
794 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
795 (Arm_relocate_functions::thm_abs5): New function.
796 (Arm_relocate_functions::abs12): New function.
797 (Arm_relocate_functions::abs16): New function.
798 (Arm_relocate_functions::base_abs): New function.
799 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
800 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
801 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
802 R_ARM_BASE_ABS.
803 (Scan::global): Likewise.
804 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
805 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
806 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
807 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
808 R_ARM_BASE_ABS.
809
c2a122b6
ILT
8102009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
811
812 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
813 (Arm_relocate_functions::movt_prel): New function.
814 (Arm_relocate_functions::thm_movw_prel_nc): New function.
815 (Arm_relocate_functions::thm_movt_prel): New function.
816 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
817 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
818 (Scan::global, Relocate::relocate): Likewise.
819 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
820
c4aa1e2d
ILT
8212009-10-09 Mikolaj Zalewski <mikolajz@google.com>
822
823 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
824 Incremental_checker.
825 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
826 unsigned int.
827 (class Incremental_inputs_header): New class.
828 (Incremental_inputs_header_writer): Edit comment.
829 (Incremental_inputs_entry): New class.
830 (Incremental_inputs_entry_writer): Edit comment.
831 (Sized_incremental_binary::do_find_incremental_inputs_section):
832 Add *strtab_shndx parameter, fill it.
833 (Sized_incremental_binary::do_check_inputs): New method.
834 (Incremental_checker::can_incrementally_link_output_file): Use
835 Sized_incremental_binary::check_inputs.
836 (Incremental_inputs::report_command_line): Save command line in
837 command_line_.
838 * incremental.h:
839 (Incremental_binary::find_incremental_inputs_section): New
840 method.
841 (Incremental_binary::do_find_incremental_inputs_section): Add
842 strtab_shndx parameter.
843 (Incremental_binary::do_check_inputs): New pure virtual method.
844 (Sized_incremental_binary::do_check_inputs): Declare.
845 (Incremental_checker::Incremental_checker): Add incremental_inputs
846 parameter, use it to initialize incremental_inputs_.
847 (Incremental_checker::incremental_inputs_): New field.
848 (Incremental_checker::command_line): New method.
849 (Incremental_checker::inputs): New method.
850 (Incremental_checker::command_line_): New field.
851
c549a694
ILT
8522009-10-09 Mikolaj Zalewski <mikolajz@google.com>
853
854 * incremental.cc: Include <cstdarg> and "target-select.h".
855 (vexplain_no_incremental): New function.
856 (explain_no_incremental): New function.
857 (Incremental_binary::error): New method.
858 (Sized_incremental_binary::do_find_incremental_inputs_section): New
859 method.
860 (make_sized_incremental_binary): New function.
861 (open_incremental_binary): New function.
862 (can_incrementally_link_file): Add checks if output is ELF and has
863 inputs section.
864 * incremental.h: Include "elfcpp_file.h" and "output.h".
865 (Incremental_binary): New class.
866 (Sized_incremental_binary): New class.
867 (open_incremental_binary): Declare.
868 * object.cc (is_elf_object): Use
869 elfcpp::Elf_recognizer::is_elf_file.
870 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
871 * output.h (Output_file::filesize): New method.
872
fd3c5f0b
ILT
8732009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
874
875 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
876 New function.
877 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
878 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
879 function.
880 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
881 function.
882 (Arm_relocate_functions::movw_abs_nc): New function.
883 (Arm_relocate_functions::movt_abs): New function.
884 (Arm_relocate_functions::thm_movw_abs_nc): New function.
885 (Arm_relocate_functions::thm_movt_abs): New function.
886 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
887 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
888 (Scan::global): Likewise.
889 (Relocate::relocate): Likewise.
890 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
891
7f5309a5
ILT
8922009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
893
894 * arm.cc (Arm_relocate_functions::got_prel) New function.
895 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
896 (Relocate::relocate): Likewise.
897 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
898
364c7fa5
ILT
8992009-10-06 Ian Lance Taylor <iant@google.com>
900
901 * options.h (class General_options): Define
902 split_stack_adjust_size parameter.
903 * object.h (class Object): Add uses_split_stack_ and
904 has_no_split_stack_ fields. Add uses_split_stack and
905 has_no_split_stack accessor functions. Declare
906 handle_split_stack_section.
907 (class Reloc_symbol_changes): Define.
908 (class Sized_relobj): Define Function_offsets. Declare
909 split_stack_adjust, split_stack_adjust_reltype, and
910 find_functions.
911 * object.cc (Object::handle_split_stack_section): New function.
912 (Sized_relobj::do_layout): Call handle_split_stack_section.
913 * dynobj.cc (Sized_dynobj::do_layout): Call
914 handle_split_stack_section.
915 * reloc.cc (Sized_relobj::relocate_sections): Call
916 split_stack_adjust for executable sections in split_stack
917 objects. Pass reloc_map to relocate_section.
918 (Sized_relobj::split_stack_adjust): New function.
919 (Sized_relobj::split_stack_adjust_reltype): New function.
920 (Sized_relobj::find_functions): New function.
921 * target-reloc.h: Include "object.h".
922 (relocate_section): Add reloc_symbol_changes parameter. Change
923 all callers.
924 * target.h (class Target): Add calls_non_split method. Declare
925 do_calls_non_split virtual method. Declare match_view and
926 set_view_to_nop.
927 * target.cc: Include "elfcpp.h".
928 (Target::do_calls_non_split): New function.
929 (Target::match_view): New function.
930 (Target::set_view_to_nop): New function.
931 * gold.cc (queue_middle_tasks): Give an error if mixing
932 split-stack and non-split-stack objects with -r.
933 * i386.cc (Target_i386::relocate_section): Add
934 reloc_symbol_changes parameter.
935 (Target_i386::do_calls_non_split): New function.
936 * x86_64.cc (Target_x86_64::relocate_section): Add
937 reloc_symbol_changes parameter.
938 (Target_x86_64::do_calls_non_split): New function.
939 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
940 parameter.
941 * powerpc.cc (Target_powerpc::relocate_section): Add
942 reloc_symbol_changes parameter.
943 * sparc.cc (Target_sparc::relocate_section): Add
944 reloc_symbol_changes parameter.
945 * configure.ac: Call AM_CONDITIONAL for the default target.
946 * configure: Rebuild.
947 * testsuite/Makefile.am (TEST_AS): New variable.
948 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
949 (check_DATA): Add split_i386 and split_x86_64 files.
950 (SPLIT_DEFSYMS): Define.
951 (split_i386_[1234n].o): New targets.
952 (split_i386_[124]): New targets.
953 (split_i386_[1234r].stdout): New targets.
954 (split_x86_64_[1234n].o): New targets.
955 (split_x86_64_[124]): New targets.
956 (split_x86_64_[1234r].stdout): New targets.
957 (MOSTLYCLEANFILES): Add new executables.
958 * testsuite/split_i386.sh: New file.
959 * testsuite/split_x86_64.sh: New file.
960 * testsuite/split_i386_1.s: New file.
961 * testsuite/split_i386_2.s: New file.
962 * testsuite/split_i386_3.s: New file.
963 * testsuite/split_i386_4.s: New file.
964 * testsuite/split_i386_n.s: New file.
965 * testsuite/split_x86_64_1.s: New file.
966 * testsuite/split_x86_64_2.s: New file.
967 * testsuite/split_x86_64_3.s: New file.
968 * testsuite/split_x86_64_4.s: New file.
969 * testsuite/split_x86_64_n.s: New file.
970 * testsuite/testfile.cc (Target_test): Update relocation_section
971 function.
972 * testsuite/Makefile.in: Rebuild.
973
e8a9fcda
ILT
9742009-10-06 Ian Lance Taylor <iant@google.com>
975
976 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
977 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
978 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
979 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
980 the address on ldo_addrs_.
981 (Target_i386::Relocate::fix_up_ldo): New function.
982
e99daf92
ILT
9832009-10-06 Rafael Espindola <espindola@google.com>
984
985 * plugin.cc (add_input_library): New.
986 (Plugin::load): Add add_input_library to tv.
987 (Plugin_manager::add_input_file): Add the is_lib argument.
988 (add_input_file): Update call to Plugin_manager::add_input_file.
989 (add_input_library): New.
990 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
991
966d4097
DK
9922009-09-30 Doug Kwan <dougkwan@google.com>
993
994 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
995 symbol and call Symbol::may_need_copy_reloc to determine if
996 a copy reloc is needed.
997 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
998 nocopyreloc is given in command line.
999 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
1000 given in command line.
1001 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
1002 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
1003 of the removed Target_i386::may_need_copy_reloc.
1004 * options.h (copyreloc): New option with default value false.
1005 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1006 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
1007 instead of the removed Target_powerpc::may_need_copy_reloc.
1008 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1009 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
1010 instead of the removed Target_sparc::may_need_copy_reloc.
1011 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
1012 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
1013 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
1014 instead of the removed Target_x86_64::may_need_copy_reloc.
1015
029ba973
ILT
10162009-09-30 Ian Lance Taylor <iant@google.com>
1017
1018 * object.h (class Object): Remove target_ field, and target,
1019 sized_target, and set_target methods.
1020 (Object::sized_target): Remove.
1021 (class Sized_relobj): Update declarations. Remove sized_target.
1022 * object.cc (Sized_relobj::setup): Remove target parameter.
1023 Change all callers.
1024 (Input_objects::add_object): Don't do anything with the target.
1025 (make_elf_sized_object): Add punconfigured parameter. Change all
1026 callers. Set or test parameter target.
1027 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
1028 Change all callers.
1029 * parameters.cc (Parameters::set_target): Change parameter type to
1030 be non-const.
1031 (Parameters::default_target): Remove.
1032 (set_parameters_target): Change parameter type to be non-const.
1033 (parameters_force_valid_target): New function.
1034 (parameters_clear_target): New function.
1035 * parameters.h (class Parameters): Update declarations. Remove
1036 default_target method. Add sized_target and clear_target
1037 methods. Change target_ to be non-const.
1038 (set_parameters_target): Update declaration.
1039 (parameters_force_valid_target): Declare.
1040 (parameters_clear_target): Declare.
1041 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
1042 as NULL if we aren't searching.
1043 (Add_symbols::run): Don't check for compatible target.
1044 * fileread.cc (Input_file::open_binary): Call
1045 parameters_force_valid_target.
1046 * gold.cc (queue_middle_tasks): Likewise.
1047 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
1048 set_target on object.
1049 * dynobj.h (class Sized_dynobj): Update declarations.
1050 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
1051 make_elf_object returns NULL.
1052 (Archive::include_member): Don't check whether object target is
1053 compatible.
1054 * output.cc (Output_section::add_input_section): Get target from
1055 parameters.
1056 (Output_section::relax_input_section): Likewise.
1057 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
1058 parameters.
1059 (Sized_relobj::do_scan_relocs): Likewise.
1060 (Sized_relobj::relocate_sections): Likewise.
1061 * resolve.cc (Symbol_table::resolve): Likewise.
1062 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
1063 parameter. Change all callers.
1064 (Symbol_table::add_from_object): Get target from parameters.
1065 (Symbol_table::add_from_relobj): Don't check object target.
1066 (Symbol_table::add_from_dynobj): Likewise.
1067 (Symbol_table::define_special_symbol): Get target from
1068 parameters.
1069 * symtab.h (class Symbol_table): Update declaration.
1070 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
1071 parameter. Change all callers. Clear parameter target.
1072 (Binary_test): Test target here.
1073 * testsuite/object_unittest.cc (gold_testsuite): Remove
1074 target_test_pointer parameter. Change all callers.
1075 (Object_test): Test target here.
1076
a6a22b83
ILT
10772009-09-26 Ian Lance Taylor <iant@google.com>
1078
1079 * testsuite/initpri1.c: Don't try to use constructor priorities if
1080 compiling with gcc before 4.3.
1081
6a8f49fe
ILT
10822009-09-22 Mikolaj Zalewski <mikolajz@google.com>
1083
1084 * testsuite/retain_symbols_file_test.sh (check_present): Change
1085 output file name to retain_symbols_file_test.stdout.
1086 (check_absent): Likewise.
1087
8c604651
CS
10882009-09-18 Craig Silverstein <csilvers@google.com>
1089
1090 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
1091 * options.cc: Include <cerrno> and <fstream>.
1092 (General_options::finalize): Parse -retain-symbols-file tag.
1093 * options.h: New flag.
1094 (General_options): New method should_retain_symbol, new
1095 variable symbols_to_retain.
1096 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
1097 should_retain_symbol map.
1098 * testsuite/Makefile.am (retain_symbols_file_test): New test.
1099 * testsuite/Makefile.in: Regenerate.
1100 * testsuite/retain_symbols_file_test.sh: New file.
1101
ca58b19f
NC
11022009-09-18 Nick Clifton <nickc@redhat.com>
1103
1104 * po/es.po: Updated Spanish translation.
1105
20e6d0d6
DK
11062009-09-17 Doug Kwan <dougkwan@google.com>
1107
1108 * debug.h (DEBUG_RELAXATION): New constant.
1109 (DEBUG_ALL): Add DEBUG_RELAXATION.
1110 (debug_string_to_enum): Add relaxation debug option.
1111 * layout.cc
1112 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
1113 Layout::Relaxation_debug_check::read_sections,
1114 Layout::Relaxation_debug_check::read_sections): New method definitions.
1115 (Layout::Layout): Initialize data members
1116 record_output_section_data_from_scrips_,
1117 script_output_section_data_list_ and relaxation_debug_check_.
1118 (Layout::save_segments, Layout::restore_segments,
1119 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1120 Layout::relaxation_loop_body): New method definitions.
1121 (Layout::finalize): Support relaxation. Move section layout code to
1122 Layout::relaxation_loop_body.
1123 (Layout::set_asection_address_from_script): Move code for orphan
1124 section placement out.
1125 (Layout::place_orphan_sections_in_script): New method definition.
1126 * layout.h (Output_segment_headers, Output_file_header):
1127 New forward class declarations.
1128 (Layout::~Layout): Define.
1129 (Layout::new_output_section_data_from_script): New method definition.
1130 (Layout::place_orphan_sections_in_script): New method declaration.
1131 (Layout::Segment_states): New type declaration.
1132 (Layout::save_segments, Layout::restore_segments,
1133 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1134 Layout::relaxation_loop_body): New method declarations.
1135 (Layout::Output_section_data_list): New type declaration.
1136 (Layout::Relaxation_debug_check): New class definition.
1137 (Layout::record_output_section_data_from_script_,
1138 Layout::script_output_section_data_list_, Layout::segment_states_,
1139 Layout::relaxation_debug_check_): New data members.
1140 * output.cc: (Output_section_headers::do_size): New method definition.
1141 (Output_section_headers::Output_section_headers): Move size
1142 computation to Output_section_headers::do_size.
1143 (Output_segment_headers::do_size): New method definition.
1144 (Output_file_header::Output_file_header): Move size computation to
1145 Output_file_header::do_size and call it.
1146 (Output_file_header::do_size): New method definition.
1147 (Output_data_group::Output_data_group): Adjust call to
1148 Output_section_data.
1149 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
1150 (Output_symtab_xindex::do_write): Add array bound check.
1151 (Output_section::Input_section::print_to_mapfile): Handle
1152 RELAXED_INPUT_SECTION_CODE.
1153 (Output_section::Output_section): Initialize data member checkpoint_.
1154 (Output_section::~Output_section): Delete checkpoint object pointed
1155 by checkpoint_.
1156 (Output_section::add_input_section): Always add an Input_section if
1157 relaxing.
1158 (Output_section::add_merge_input_section): Add assert.
1159 (Output_section::relax_input_section): New method definition.
1160 (Output_section::set_final_data_size): Set load address to zero for
1161 an unallocated section.
1162 (Output_section::do_address_and_file_offset_have_reset_values):
1163 New method definition.
1164 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
1165 Handle relaxed input section.
1166 (Output_section::sort_attached_input_sections): Checkpoint input
1167 section list lazily.
1168 (Output_section::get_input_sections): Change type of input_sections to
1169 list of Simple_input_section pointers. Checkpoint input section list
1170 lazily. Also handle relaxed input sections.
1171 (Output_section::add_input_section_for_script): Take a reference to
1172 a Simple_input_section object instead of Relobj pointer and section
1173 index as parameter. Handle relaxed input sections.
1174 (Output_section::save_states, Output_section::restore_states): New
1175 method definitions.
1176 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
1177 (Output_data::is_data_size_fixed): New method definition.
1178 (Output_data::reset_addresss_and_file_offset): Do not reset data size
1179 if it is fixed.
1180 (Output_data::address_and_file_offset_have_reset_values): New method
1181 definition.
1182 (Output_data::do_address_and_file_offset_have_reset_values): New method
1183 definition.
1184 (Output_data::set_data_size): Check that data size is not fixed.
1185 (Output_data::fix_data_size): New method definition.
1186 (Output_data::is_data_size_fixed_): New data member.
1187 (Output_section_headers::set_final_data_size): New method definition.
1188 (Output_section_headers::do_size): New method declaration.
1189 (Output_segment_headers::set_final_data_size): New method definition.
1190 (Output_segment_headers::do_size): New method declaration.
1191 (Output_file_header::set_final_data_size)::New method definition.
1192 (Output_file_header::do_size)::New method declaration.
1193 (Output_section_data::Output_section_data): Add new parameter
1194 is_data_size_fixed and use it to fix data size.
1195 (Output_data_const::Output_data_const): Adjust call to base class
1196 constructor and fix data size.
1197 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
1198 base class constructor and fix data size.
1199 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
1200 base class constructor and fix data size.
1201 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
1202 class constructor and fix data size.
1203 (Output_data_group::set_final_data_size): New method definition.
1204 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
1205 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
1206 class constructor and fix data size.
1207 (Output_relaxed_input_section): New class definition.
1208 (Output_section::Simple_input_section): New class definition.
1209 (Output_section::get_input_sections): Adjust parameter list.
1210 (Output_section::add_input_section_for_script): Same.
1211 (Output_section::save_states, Output_section::restore_states,
1212 Output_section::do_address_and_file_offset_have_reset_values,
1213 (Output_section::Input_section::Input_section): Handle
1214 RELAXED_INPUT_SECTION_CODE. Add new overload for
1215 Output_relaxed_input_section.
1216 (Output_section::Input_section::is_input_section,
1217 Output_section::Input_section::set_output_section): Handle relaxed
1218 input section.
1219 (Output_section::Input_section::is_relaxed_input_section,
1220 Output_section::Input_section::output_section_data,
1221 Output_section::Input_section::relaxed_input_section): New method
1222 definitions.
1223 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
1224 value.
1225 (Output_section::Input_section::u1_): Update comments.
1226 (Output_section::Input_section::u2_): Add new union member poris.
1227 (Output_section::Checkpoint_output_section): New classs definition.
1228 (Output_section::relax_input_section): New method declaration.
1229 (Output_section::checkpoint_): New data member.
1230 (Output_segment): Update comments.
1231 (Output_segment::Output_segment): Un-privatize copy constructor.
1232 (Output_segment::operator=): Un-privatize.
1233 * script-sections.cc (Output_section_element::Input_section_list):
1234 Change element type to Output_section::Simple_input_section.
1235 (Output_section_element_dot_assignment::set_section_addresses):
1236 Register output section data for relaxation clean up.
1237 (Output_data_exression::Output_data_expression): Adjust call to base
1238 constructor to fix data size.
1239 (Output_section_element_data::set_section_addresses): Register
1240 Output_data_expression object for relaxation clean up.
1241 (struct Input_section_info): Replace Relobj pointer and section index
1242 pair with Output_section::Simple_input_section and Convert struct to a
1243 class.
1244 (Input_section_sorter::operator()): Adjust access to
1245 Input_section_info data member to use accessors.
1246 (Output_section_element_input::set_section_addresses): Use layout
1247 parameter. Adjust code to use Output_section::Simple_input_section
1248 and Input_secction_info classes. Register filler for relaxation
1249 clean up.
1250 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
1251 and section index pair with Output_section::Simple_input_section
1252 class. Adjust code accordingly.
1253 (Phdrs_element::release_segment): New method definition.
1254 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
1255 segment list.
1256 (Script_sections::release_segments): New method definition.
1257 * gold/script-sections.h (Script_sections::release_segments): New
1258 method declaration.
1259 * gold/target.h (Target::may_relax, Target::relax,
1260 Target::do_may_relax, Target::do_relax): New method definitions.
1261
5e445df6
ILT
12622009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1263
1264 * arm.cc (has_signed_unsigned_overflow): New function.
1265 (Arm_relocate_functions::abs8): New function.
1266 (Target_arm::Scan::local): Handle R_ARM_ABS8.
1267 (Target_arm::Scan::global): Likewise.
1268 (Target_arm::relocate::relocate): Likewise.
1269 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1270 Likewise.
1271
8c604651 12722009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
1273
1274 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
1275 * testsuite/Makefile.in: Regenerate.
1276
1e9cc1c2
NC
12772009-09-11 Nick Clifton <nickc@redhat.com>
1278
1279 * po/gold.pot: Updated by the Translation project.
1280
6a89f575
CC
12812009-09-08 Cary Coutant <ccoutant@google.com>
1282
1283 * output.cc (Output_file::open): Add execute permission to empty file.
1284 * testsuite/Makefile.am (permission_test): New test.
1285 * testsuite/Makefile.in: Regenerate.
1286
fdcac5af
ILT
12872009-09-02 Ian Lance Taylor <iant@google.com>
1288
1289 * output.cc (Output_file::resize): Call map_no_anonymous rather
1290 than map.
1291
44453f85
ILT
12922009-09-01 Mikolaj Zalewski <mikolajz@google.com>
1293
1294 * gold.cc: Include "incremental.h".
1295 (queue_initial_tasks): Call Incremental_checker methods.
1296 * incremental.cc: Include "output.h".
1297 (Incremental_checker::can_incrementally_link_output_file): New
1298 method.
1299 * incremental.h (Incremental_checker): New class.
1300
1301 * output.cc (Output_file::open_for_modification): New method.
1302 (Output_file::map_anonymous): Changed return type to bool. Record
1303 map in base_ field.
1304 (Output_file::map_no_anonymous): New method, broken out of map.
1305 (Output_file::map): Use map_no_anonymous and map_anonymous.
1306 * output.h (class Output_file): Update declarations.
1307
293c1386
CC
13082009-08-24 Cary Coutant <ccoutant@google.com>
1309
1310 * options.h (Command_line::Pre_options): New class.
1311 (Command_line::pre_options): New member.
1312 * options.cc (gold::options::ready_to_register): New variable.
1313 (One_option::register_option): Do nothing if not registering options.
1314 Assert if same short option registered twice.
1315 (General_options::General_options): Turn off option registration when
1316 done constructing.
1317 (Command_line::Pre_options::Pre_options): New constructor.
1318
f773f3d2
CC
13192009-08-24 Cary Coutant <ccoutant@google.com>
1320
06a73cfe
CC
1321 * options.h (General_options::no_keep_memory): Remove incorrect
1322 short option.
f773f3d2 1323
a15af8e2
RW
13242009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1325
1326 * Makefile.am (am__skiplex, am__skipyacc): New.
1327 * Makefile.in: Regenerate.
1328
c462b41b
RW
13292009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1330
14ec8efd
RW
1331 * Makefile.am (AM_CPPFLAGS): Renamed from ...
1332 (INCLUDES): ... this.
1333 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
1334 (AM_CPPFLAGS): Renamed from ...
1335 (INCLUDE): ... this.
1336 * Makefile.in, testsuite/Makefile.in: Regenerate.
1337
81ecdfbb
RW
1338 * Makefile.in: Regenerate.
1339 * aclocal.m4: Likewise.
1340 * config.in: Likewise.
1341 * configure: Likewise.
1342 * testsuite/Makefile.in: Likewise.
1343
c462b41b
RW
1344 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1345 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1346 * Makefile.in: Regenerate.
1347 * testsuite/Makefile.in: Regenerate.
1348
2da73f13
CC
13492009-08-19 Cary Coutant <ccoutant@google.com>
1350
1351 * resolve.cc (Symbol_table::resolve): Don't complain about defined
1352 symbols in shared libraries overridden by hidden or internal symbols
1353 in the main program.
1354
2db70501
CD
13552009-08-19 Chris Demetriou <cgd@google.com>
1356
1357 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
1358 checking source file names in error messages.
1359
f733487b
DK
13602009-08-18 Doug Kwan <dougkwan@google.com>
1361
1362 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
1363 an elcpp::Ehdr as parameter. Adjust call to set_target.
1364 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
1365 an elfcpp::Ehdr as parameter.
1366 * object.cc (Object::set_target): Remove the version that looks up
1367 a target and sets it.
1368 (Sized_relobj::setup): Take a Target object instead of
1369 an elfcpp::Ehdr as parameter. Adjust call to set_target.
1370 (make_elf_sized_object): Find target and ask target to
1371 make an ELF object.
1372 * object.h: (Object::set_target): Remove the version that looks up
1373 a target and sets it.
1374 (Sized_relobj::setup): Take a Target object instead of
1375 an elfcpp:Ehdr as parameter.
1376 * target.cc: Include dynobj.h.
1377 (Target::do_make_elf_object_implementation): New.
1378 (Target::do_make_elf_object): New.
1379 * target.h (Target::make_elf_object): New template declaration.
1380 (Target::do_make_elf_object): New method declarations.
1381 (Target::do_make_elf_object_implementation): New template declaration.
1382
cc70f101
ILT
13832009-08-14 Ian Lance Taylor <iant@google.com>
1384
1385 * gold.h (FUNCTION_NAME): Define.
1386 (gold_unreachable): Use FUNCTION_NAME.
1387
ef5e0cb1
ST
13882009-08-12 Sriraman Tallam <tmsriram@google.com>
1389
1390 * icf.cc (Icf::find_identical_sections): Issue a warning when a
1391 symbol in the --keep-unique list is not found.
1392
48c187ce
ST
13932009-08-12 Sriraman Tallam <tmsriram@google.com>
1394
1395 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
1396 been maked as --keep-unique.
1397 (Icf::unfold_section): New function.
1398 * icf.h (Icf::unfold_section): New function.
1399 * options.h (General_options::keep_unique): New option.
1400 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
1401 * testsuite/Makefile.in: Regenerate.
1402 * testsuite/icf_keep_unique_test.sh: New file.
1403 * testsuite/icf_keep_unique_test.cc: New file.
1404
645afe0c
CC
14052009-08-12 Cary Coutant <ccoutant@google.com>
1406
1407 PR 10471
1408 * resolve.cc (Symbol_table::resolve): Check for references from
1409 dynamic objects to hidden and internal symbols.
1410 * testsuite/Makefile.am (hidden_test.sh): New test.
1411 * testsuite/Makefile.in: Regenerate.
1412 * testsuite/hidden_test.sh: New script.
1413 * testsuite/hidden_test_1.c: New test source.
1414 * testsuite/hidden_test_main.c: New test source.
1415
11af873f
DK
14162009-08-11 Doug Kwan <dougkwan@google.com>
1417
1418 * arm.cc: Update comments.
1419 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
1420 segment to locate the .ARM.exidx section if present.
1421
b9f7d72d
DK
14222009-08-09 Doug Kwan <dougkwan@google.com>
1423
1424 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
1425 patch.
1426
ddd3c53c
ST
14272009-08-07 Sriraman Tallam <tmsriram@google.com>
1428 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
1429 compiler warnings.
1430
27721062
ST
14312009-08-06 Sriraman Tallam <tmsriram@google.com>
1432
1433 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
1434 valid tls_segment only for non-debug-section relocations.
1435 * testsuite/Makefile.am: Add gc_tls_test.
1436 * testsuite/Makefile.in: Regenerate.
1437 * testsuite/gc_tls_test.cc: New file.
1438 * testsuite/gc_tls_test.sh: New file.
1439
ef15dade
ST
14402009-08-05 Sriraman Tallam <tmsriram@google.com>
1441
1442 * icf.cc: New file.
1443 * icf.h: New file.
1444 * Makefile.am (CCFILES): Add icf.cc.
1445 (HFILES): Add icf.h
1446 * Makefile.in: Regenerate.
1447 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
1448 * gc.h (gc_process_relocs): Populate lists used by icf to contain
1449 section, symbol and addend information for the relocs.
1450 * gold.cc (queue_middle_tasks): Call identical code folding.
1451 * gold.h: Add defines for multimap.
1452 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
1453 to the call of finalize_local_symbols.
1454 * main.cc (main): Create object of class Icf.
1455 * object.cc (Sized_relobj::do_layout): Allow this function to be
1456 called twice during icf.
1457 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
1458 to sections marked as identical by icf.
1459 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
1460 when available.
1461 (Sized_relobj::do_section_entsize): New function.
1462 * object.h (Object::section_entsize): New function.
1463 (Object::do_section_entsize): New pure virtual function.
1464 (Relobj::finalize_local_symbols): Add new parameter.
1465 (Relobj::do_section_entsize): New function.
1466 * options.h (General_options::icf): New option.
1467 (General_options::icf_iterations): New option.
1468 (General_options::print_icf_sections): New option.
1469 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
1470 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
1471 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
1472 icf.
1473 * symtab.cc (Symbol_table::is_section_folded): New function.
1474 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
1475 to sections marked as identical by icf.
1476 * symtab.h (Symbol_table::set_icf): New function.
1477 (Symbol_table::icf): New function.
1478 (Symbol_table::is_section_folded): New function.
1479 (Symbol_table::icf_): New data member.
1480 * target-reloc.h (relocate_section): Ignore sections folded by icf.
1481 * testsuite/Makefile.am: Add commands to build icf_test.
1482 * testsuite/Makefile.in: Regenerate.
1483 * testsuite/icf_test.sh: New file.
1484 * testsuite/icf_test.cc: New file.
1485
c3b65ac4
CD
14862009-07-24 Chris Demetriou <cgd@google.com>
1487
1488 * layout.cc (is_compressible_debug_section): Fix incorrect
1489 comment about compressed section names.
1490
1caf2c51
ILT
14912009-07-20 Ian Lance Taylor <ian@airs.com>
1492
1493 PR 10419
1494 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
1495
1ef4d87f
ILT
14962009-07-16 Ian Lance Taylor <iant@google.com>
1497
1498 PR 10400
1499 * layout.h: #include <map>.
1500 (class Kept_section): Change from struct to class. Add accessors
1501 and setters. Add section size to Comdat_group mapping. Change
1502 Comdat_group to std::map. Add is_comdat_ field. Add
1503 linkonce_size field in union.
1504 (class Layout): Update declaration of find_or_add_kept_section.
1505 Don't declare find_kept_object.
1506 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
1507 parameter. Add object, shndx, is_comdat, and is_group_name
1508 parameters. Change all callers. Adjust for new Kept_section.
1509 (Layout::find_kept_object): Remove.
1510 * object.cc (Sized_relobj::include_section_group): Update use of
1511 Kept_section. Rename secnum to shndx. Only record
1512 Kept_comdat_section if sections are the same size.
1513 (Sized_relobj::include_linkonce_section): Update use of
1514 Kept_section. Only record Kept_comdat_section if sections are the
1515 same size. Set size of linkonce section.
1516 (Sized_relobj::map_to_kept_section): Update call to
1517 get_kept_comdat_section.
1518 * object.h (class Sized_relobj): Rename fields in
1519 Kept_comdat_section to drop trailing underscores; change object
1520 field to Relobj*. Change Kept_comdat_section_table to store
1521 struct rather than pointer.
1522 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
1523 Add kept_object and kept_shndx parameters. Change all callers.
1524 (Sized_relobj::get_kept_comdat_section): Change return type to
1525 bool. Add kept_object and kept_shndx parameters. Change all
1526 callers.
1527 * plugin.cc (Pluginobj::include_comdat_group): Update call to
1528 Layout::find_or_add_kept_section.
1529
37c3b7b0
ILT
15302009-07-09 Ian Lance Taylor <iant@google.com>
1531
1532 * merge.cc (Object_merge_map::initialize_input_to_output_map):
1533 Reserve space in the hash table.
1534
98fa85cb
ILT
15352009-07-06 Mikolaj Zalewski <mikolajz@google.com>
1536
1537 * fileread.cc (File_read::get_mtime): New method.
1538 * fileread.h (Timespec): New structure.
1539 (File_read::get_mtime): New method.
1540 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
1541 Renamed from timestamp_nsec.
1542 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
1543 Elf_Xword.
1544 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
1545 timestamp_nsec.
1546 (Incremental_inputs::report_archive): Save mtime; style fix.
1547 (Incremental_inputs::report_obejct): Save mtime; style fix.
1548 (Incremental_inputs::report_script): Save mtime; style fix.
1549 (Incremental_inputs::finalize_inputs): Style fix.
1550 (Incremental_inputs::finalize): Style fix.
1551 (Incremental_inputs::create_input_section_data): Store inputs
1552 mtime.
1553 * incremental.h (Incremental_inputs::report_script): Add mtime
1554 argument.
1555 (Incremental_inputs::Input_info::Input_info): Intialize only one
1556 union member.
1557 (Incremental_inputs::Input_info::archive): Move to nameless
1558 union.
1559 (Incremental_inputs::Input_info::obejct): Move to nameless union.
1560 (Incremental_inputs::Input_info::script): Move to nameless union.
1561 (Incremental_inputs::mtime): New field.
1562 * script.cc (read_input_script): Pass file mtime to
1563 Incremental_input.
1564 * script.h (Script_info::inputs): Style fix.
1565
c9d70757
ILT
15662009-07-01 Ian Lance Taylor <ian@airs.com>
1567
1568 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
1569 instead of 32.
1570
9c547ec3
ILT
15712009-06-24 Ian Lance Taylor <iant@google.com>
1572
1573 PR 10156
1574 * layout.cc (Layout::choose_output_section): If we find an
1575 existing section, update the flags.
1576 (Layout::create_notes): New function, broken out of
1577 Layout::finalize.
1578 (Layout::finalize): Don't create note sections.
1579 (Layout::create_note): Don't crash if linker script discards
1580 section.
1581 (Layout::create_gold_note): Likewise.
1582 (Layout::create_build_id): Likewise. Don't set
1583 after_input_sections on the section.
1584 (Layout::create_executable_stack_info): Remove target parameter.
1585 Change caller.
1586 * layout.h (class Layout): Declare create_notes. Update
1587 declaration of create_executable_stack_info.
1588 * gold.cc (queue_middle_tasks): Call create_notes.
1589 * output.cc (Output_section::update_flags_for_input_section): Move
1590 here from output.h. If SHF_ALLOC flag is newly set, mark address
1591 invalid.
1592 * output.h (Output_data::mark_address_invalid): New function.
1593 (class Output_section): Only declare, not define,
1594 update_flags_for_input_section. Remove set_flags.
1595
55458500
ILT
15962009-06-24 Ian Lance Taylor <iant@google.com>
1597
1598 * script-sections.cc (Output_section_definition::
1599 set_section_addresses): Rename shadowing local load_address to
1600 laddr.
1601
1307d6cd
ILT
16022009-06-24 Ian Lance Taylor <iant@google.com>
1603
1604 PR 10244
1605 * reloc.cc (relocate_sections): Skip empty relocation sections.
1606
ec3f783e
ILT
16072009-06-23 Ian Lance Taylor <iant@google.com>
1608
1609 PR 10156
1610 * layout.cc (Layout::create_note): Use choose_output_section
1611 rather than make_output_section.
1612
459c9f1c
ILT
16132009-06-23 Ian Lance Taylor <iant@google.com>
1614
1615 PR 10237
1616 * options.cc (General_options::parse_V): Set printed_version_.
1617 (General_options::General_options): Initialize printed_version_.
1618 * options.h (class General_options): Add printed_version_ field.
1619 * gold.cc (queue_initial_tasks): If there are no input files,
1620 don't give a fatal error if we printed the version information.
1621 (queue_middle_tasks): If using -r with a shared object, give a
1622 fatal error rather than an ordinary error.
1623
1518dc8f
ILT
16242009-06-23 Ian Lance Taylor <iant@google.com>
1625
1626 PR 10219
1627 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
1628 (Layout::make_output_section): Set have_stabstr_section_ if we see
1629 a .stab*str section.
1630 (Layout::finalize): Call link_stabs_sections.
1631 (Layout::link_stabs_sections): New file.
1632 * layout.h (class Layout): Add have_stabstr_section_ field.
1633 Declare link_stabs_sections.
1634
3d857b98
DK
16352009-06-23 Doug Kwan <dougkwan@google.com>
1636
1637 * Makefile.am (libgold_a_LIBADD): New.
1638 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
1639 * Makefile.in: Regenerate.
1640 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
1641 * configure: Regenerate.
1642 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
1643 * fileread.cc: Include sys/state.h
1644 * gold.h: Declare memmem and strndup if found missing.
1645 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
1646
0639a6f6
ILT
16472009-06-23 Ian Lance Taylor <iant@google.com>
1648
1649 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
1650 * configure: Rebuild.
1651
8d63875c
ILT
16522009-06-23 Ian Lance Taylor <iant@google.com>
1653
1654 PR 10147
1655 * object.cc (Object::section_contents): Don't try to get a view if
1656 the section has length zero.
1657 (Object::handle_gnu_warning_section): If the section is empty, use
1658 the name of the section as the warning.
1659
f7c8a183
ILT
16602009-06-23 Ian Lance Taylor <iant@google.com>
1661
1662 PR 10133
1663 * stringpool.h (class Stringpool_template): Add optimize_ field.
1664 (Stringpool_template::set_optimize): New function.
1665 * stringpool.cc (Stringpool_template::Stringpool_template):
1666 Initialize optimize_ field.
1667 (Stringpool_template::set_string_offsets): Test local optimize
1668 fild rather than parameter.
1669 * layout.cc (Layout::Layout): Call set_optimize on the section
1670 name stringpool.
1671
e6a307ba
ILT
16722009-06-22 Ian Lance Taylor <iant@google.com>
1673
1674 PR 10030
1675 * yyscript.y: Parse TARGET.
1676 * script.cc (script_set_target): New function.
1677 * script-c.h (script_set_target): Declare.
1678 * options.cc (General_options::string_to_object_format): Rename
1679 from string_to_object_format in anonymous namespace. Change
1680 callers.
1681 * options.h (class General_options): Declare
1682 string_to_object_format.
1683
3ee173de
ILT
16842009-06-22 Ian Lance Taylor <iant@google.com>
1685
1686 * script-sections.cc (Script_sections::create_segments): Don't put
1687 program headers in a PT_LOAD segment if -n or -N.
1688
16892009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
1690
1691 PR 10141
1692 * options.h (class General_options): Add -z lazy and -z now. Sort
1693 -z options into alphabetical order.
1694 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
1695
cd6739a1 16962009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
1697
1698 * layout.cc (Layout::make_output_section): Call
1699 Target::new_output_section.
1700 (Layout::attach_allocated_section_to_segment): Put large section
1701 sections in a separate load segment with the large segment flag
1702 set.
1703 (Layout::segment_precedes): Sort large data segments after other
1704 load segments.
1705 (align_file_offset): New static function.
1706 (Layout::set_segment_offsets): Use align_file_offset.
1707 * output.h (class Output_section): Add is_small_section_ and
1708 is_large_section_ fields.
1709 (Output_section::is_small_section): New function.
1710 (Output_section::set_is_small_section): New function.
1711 (Output_section::is_large_section): New function.
1712 (Output_section::set_is_large_section): New function.
1713 (Output_section::is_large_data_section): New function.
1714 (class Output_segment): Add is_large_data_segment_ field.
1715 (Output_segment::is_large_data_segment): New function.
1716 (Output_segment::set_is_large_data_segment): New function.
1717 * output.cc (Output_section::Output_section): Initialize new
1718 fields.
1719 (Output_segment::Output_segment): Likewise.
1720 (Output_segment::add_output_section): Add assertion that large
1721 data sections always go in large data segments. Force small data
1722 sections to the end of the list of data sections. Force small BSS
1723 sections to the start of the list of BSS sections. For large BSS
1724 sections to the end of the list of BSS sections.
1725 * symtab.h (class Symbol): Declare is_common_shndx.
1726 (Symbol::is_defined): Check Symbol::is_common_shndx.
1727 (Symbol::is_common): Likewise.
1728 (class Symbol_table): Define enum Commons_section_type. Update
1729 declarations. Add small_commons_ and large_commons_ fields.
1730 * symtab.cc (Symbol::is_common_shndx): New function.
1731 (Symbol_table::Symbol_table): Initialize new fields.
1732 (Symbol_table::add_from_object): Put small and large common
1733 symbols in the right list.
1734 (Symbol_table::sized_finalized_symbol): Check
1735 Symbol::is_common_shndx.
1736 (Symbol_table::sized_write_globals): Likewise.
1737 * common.cc (Symbol_table::do_allocate_commons): Allocate new
1738 common symbol lists. Don't call do_allocate_commons_list if the
1739 list is empty.
1740 (Symbol_table::do_allocate_commons_list): Remove is_tls
1741 parameter. Add comons_section_type parameter. Change all
1742 callers. Handle small and large common symbols.
1743 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
1744 Symbol::is_common_shndx.
1745 * resolve.cc (symbol_to_bits): Likewise.
1746 * target.h (Target::small_common_shndx): New function.
1747 (Target::small_common_section_flags): New function.
1748 (Target::large_common_shndx): New function.
1749 (Target::large_common_section_flags): New function.
1750 (Target::new_output_section): New function.
1751 (Target::Target_info): Add small_common_shndx, large_common_shndx,
1752 small_common_section_flags, and large_common_section_flags
1753 fields.
1754 (Target::do_new_output_section): New virtual function.
1755 * arm.cc (Target_arm::arm_info): Initialize new fields.
1756 * i386.cc (Target_i386::i386_info): Likewise.
1757 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1758 Likewise.
1759 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
1760 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1761 (Target_x86_64::do_new_output_section): New function.
1762 * configure.ac: Define conditional MCMODEL_MEDIUM.
1763 * testsuite/Makefile.am (check_PROGRAMS): Add large.
1764 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
1765 (large_LDFLAGS): Define.
1766 * testsuite/large.c: New file.
1767 * testsuite/testfile.cc (Target_test::test_target_info):
1768 Initialize new fields.
1769 * configure, testsuite/Makefile.in: Rebuild.
1770
bb04269c
DK
17712009-06-05 Doug Kwan <dougkwan@google.com>
1772
1773 * Makefile.am (CCFILES): Add target.cc.
1774 * Makefile.in: Regenerate.
1775 * i386.cc (class Target_i386): Define new virtual method to
1776 override do_is_local_label_name in parent.
1777 * object.cc (Sized_relobj::do_count_local_symbols): Discard
1778 local symbols if --discard-locals or -X is given.
1779 * options.h (class General_options): Declare new options
1780 '--discard-locals' and '-X' for discarding locals.
1781 * target.h (class Target): Define new methods is_local_label_name.
1782 Declare new virtual method do_is_local_label_name.
1783 * target.cc: New file.
1784 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
1785 (check_SCRIPTS): Add discard_locals_test.sh.
1786 (check_DATA): Add discard_local_tests.syms.
1787 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
1788 (discard_local_tests.syms, discard_locals_test.o): New make rules.
1789 * testsuite/Makefile.in: Regenerate.
1790 * testsuite/discard_locals_test.c: New file.
1791 * testsuite/discard_locals_test.sh: Same.
1792
805bb01c
DK
17932009-06-05 Doug Kwan <dougkwan@google.com>
1794
1795 * object.cc (Sized_relobj::Sized_relobj): Initialize
1796 discarded_eh_frame_shndx_ to -1U.
1797 (Sized_relobj::do_layout): Record index of a discard .eh_frame
1798 section.
1799 (Sized_relobj::do_count_local_symbols): Skip local symbols in
1800 a discarded .eh_frame section.
1801 (Sized_relobj::do_finalize_local_symbols): Ditto.
1802 * object.h (class Sized_relobj): Declare new member
1803 discarded_eh_frame_shndx_.
1804 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
1805 (local_labels_test.o, local_labels_test): New rules.
1806 * testsuite/Makefile.in: Regenerate.
1807
1dcd334d
DK
18082009-06-04 Doug Kwan <dougkwan@google.com>
1809
1810 * layout.cc (Layout::section_name_mapping): Add mapping for
1811 special ARM sections.
1812
96d49306
DK
18132009-06-03 Doug Kwan <dougkwan@google.com>
1814
1815 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
1816 (utils::has_overflow): Same.
1817
dff16297
ILT
18182009-06-03 Ian Lance Taylor <iant@google.com>
1819
1820 * layout.cc (Layout::section_name_mapping): New array, replacing
1821 Layout::linkonce_mapping.
1822 (Layout::section_name_mapping_count): New variable, replacing
1823 Layout::linkonce_mapping_count.
1824 (Layout::linkonce_output_name): Remove.
1825 (Layout::output_section_name): Rewrite.
1826 * layout.h (class Layout): Rename Linkonce_mapping to
1827 Section_name_mapping, linkonce_mapping to section_name_mapping,
1828 linkonce_mapping_count to section_name_mapping_count. Don't
1829 declare linkonce_output_name.
1830
c121c671
DK
18312009-06-03 Doug Kwan <dougkwan@google.com>
1832
1833 * gold/arm.cc (namespace utils): New.
1834 (Target_arm::reloc_is_non_pic): Define new method.
1835 (class Arm_relocate_functions): New.
1836 (Target_arm::Relocate::relocate): Handle relocation types used by
1837 Android.
1838
07800fab
ILT
18392009-06-03 Ian Lance Taylor <iant@google.com>
1840
1841 * arm.cc (Target_arm::scan::global): Use || instead of |.
1842
c121c671
DK
18432009-06-02 Doug Kwan <dougkwan@google.com>
1844
1845 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
1846 issued_non_pic_error_.
1847 (class Target_arm::Scan): Declare new method check_non_pic.
1848 Define new method symbol_needs_plt_entry.
1849 Declare new data member issued_non_pic_error_.
1850 (class Target_arm::Relocate): Declare new method
1851 should_apply_static_reloc.
1852 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
1853 (Target_arm::Scan::check_non_pic): Define new method.
1854 (Target_arm::Scan::local): Handle a small subset of reloc types used
1855 by Android.
1856 (Target_arm::Scan::local): Same.
1857 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
1858
b19b0c6d
ILT
18592009-05-31 Mikolaj Zalewski <mikolajz@google.com>
1860
1861 * incremental.cc (Incremental_inputs::report_command_line): Filter
1862 out --incremental-* options.
1863
94cdfcff
DK
18642009-05-29 Doug Kwan <dougkwan@google.com>
1865
1866 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
1867 template class.
1868 (class Target_arm): Update comment.
1869 (Target_arm::Target_arm): Initialize new data members GOT_,
1870 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
1871 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
1872 and Target_arm::rel_dyn_section.
1873 Declare new_enum Target_arm::Got_type.
1874 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
1875 and DYNBSS_.
1876 Update commments for member do_dynsym_value.
1877 (Target_arm::got_size, Target_arm::plt_section,
1878 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
1879 new methods inside class defintion.
1880 (Target_arm::got_section): Define new method.
1881 (Target_arm::rel_dyn_section): Same.
1882 (Output_data_plt_arm): New template class.
1883 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
1884 (Output_data_plt_arm:do_adjust_output_section): Define new method.
1885 (Output_data_plt_arm::add_entry): Same.
1886 (Output_data_plt_arm::first_plt_entry): Define new
1887 static data member for PLT instruction template.
1888 (Output_data_plt_arm::plt_entry): Same.
1889 (Output_data_plt_arm::do_write): Define new method.
1890 (Target_arm::make_plt_entry): Same.
1891 (Target_arm::do_finalize_sections): Same.
1892 (Target_arm::do_dynsym_value): Same.
1893
4a657b0d
DK
18942009-05-28 Doug Kwan <dougkwan@google.com>
1895
1896 * Makefile.am (TARGETSOURCES): Add arm.cc.
1897 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
1898 * Makefile.in: Regenerate.
1899 * arm.cc: New file.
1900 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
1901
e7ae8c36
DK
19022009-05-26 Doug Kwan <dougkwan@google.com>
1903
1904 * options.cc (General_options::parse_exclude_libs). Fix a comment.
1905 (General_options::check_excluded_libs): Strip off directories in
1906 archive name before matching like GNU ld does.
1907 * testsuite/Makefile.am (MOSTLYCLEANFILES,
1908 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
1909 (exclude_libs_test_LDFLAGS): Add linker option
1910 -Wl,--exclude-libs,libexclude_libs_test_3
1911 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
1912 an explicit archive without using -l.
1913 (alt/libexclude_libs_test_3.a): New make rule.
1914 * testsuite/Makefile.in: Regenerate.
1915 * testsuite/exclude_libs_test.c : Declare lib3_default().
1916 (main): Call it.
1917 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
1918 * exclude_libs_test_3.c: New file.
1919
f12e7348
NC
19202009-05-26 Nick Clifton <nickc@redhat.com>
1921
1922 * po/id.po: New Indonesian translation.
1923 * po/gold.pot: Updated template file.
1924
4daadc0d
ST
19252009-05-22 Sriraman Tallam <tmsriram@google.com>
1926
1927 * testsuite/Makefile.am: Add -ffunction-sections to compile
1928 gc_comdat_test files. Add -Wl,--gc-sections to build
1929 gc_comdat_test.
1930 * testsuite/Makefile.in: Regenerate.
1931 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
1932
531813ad
ST
19332009-05-21 Sriraman Tallam <tmsriram@google.com>
1934
1935 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
1936 kept comdat section was garbage collected.
1937 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
1938 * testsuite/Makefile.in: Regenerate.
1939 * testsuite/gc_comdat_test.sh: New file.
1940 * testsuite/gc_comdat_test_1.cc: New file.
1941 * testsuite/gc_comdat_test_2.cc: New file.
1942
65514900
CC
19432009-05-19 Doug Kwan <dougkwan@google.com>
1944
1945 * archive.cc (Archive::Archive): Move constructor from archive.h
1946 to here. Initialize no_export_.
1947 (Archive::get_elf_object_for_member): Set no_export flag of object.
1948 * archive.h (Archive::Archive): Move constructor body to
1949 archive.cc.
1950 (Archive::no_export): New method.
1951 (Archive::no_export_): New field.
1952 * object.h (Object::Object): Initialize no_export_ to false.
1953 (Object::no_export, Object::set_no_export): New methods.
1954 (Object::no_export_): New field.
1955 * options.cc (General_options::parse_exclude_libs): New method.
1956 (General_options::check_excluded_libs) Same.
1957 * options.h (exclude_libs): New option.
1958 (General_options::check_excluded_libs): New method declaration.
1959 (General_options::excluded_libs_): New field.
1960 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
1961 default or protected visibility if an object has no-export flag set.
1962 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
1963 (check_SCRIPTS): Add exclude_libs_test.sh.
1964 (check_DATA): Add exclude_libs_test.syms.
1965 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
1966 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
1967 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
1968 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
1969 (exclude_libs_test.syms, libexclude_libs_test_1.a,
1970 libexclude_libs_test_2.a): New rules.
1971 * testsuite/Makefile.in: Regenerate.
1972 * testsuite/exclude_libs_test.c: New file.
1973 * testsuite/exclude_libs_test.sh: Ditto.
1974 * testsuite/exclude_libs_test_1.c: Ditto.
1975 * testsuite/exclude_libs_test_2.c: Ditto.
1976
1b77ea50
ILT
19772009-05-15 Ian Lance Taylor <iant@google.com>
1978
1979 * configure.ac: Check for declarations for cases where libiberty.h
1980 checks HAVE_DECL_xxx.
1981 * configure, config.in: Rebuild.
1982
072fe7ce
ILT
19832009-05-15 Mikolaj Zalewski <mikolajz@google.com>
1984
1985 * gold.h (Incremental_argument_list): Remove (invalid) forward
1986 declaration.
1987 * incremental.cc (Incremental_inputs::report_achive): New method.
1988 (Incremental_inputs::report_object): New method.
1989 (Incremental_inputs::report_script): New method.
1990 (Incremental_inputs::finalize_inputs): New method.
1991 (Incremental_inputs::finalize): Call finalize_inputs().
1992 (Incremental_inputs::sized_create_incremental_inputs_section_data):
1993 Create inputs entries.
1994 * incremental.h (Incremental_input_type): New enum.
1995 (Incremental_inputs::Incremental_input): Initialize new fields.
1996 (Incremental_inputs::report_inputs): New method.
1997 (Incremental_inputs::report_achive): New method.
1998 (Incremental_inputs::report_object): New method.
1999 (Incremental_inputs::report_script): New method.
2000 (Incremental_inputs::finalize_inputs): New method.
2001 (Incremental_inputs::Input_info): New struct.
2002 (Incremental_inputs::Input_info_map): New typedef.
2003 (Incremental_inputs::lock_): New field.
2004 (Incremental_inputs::Inputs_): New field.
2005 (Incremental_inputs::Inputs_map): New field.
2006 * main.cc (main): Call Incremental_input::report_inputs.
2007 * options.h (Input_argument_list): Typedef moved from
2008 Input_arguments.
2009 (Input_file_group::Files): Remove, use ::Input_argument_list.
2010 (Input_file_group::Input_argument_list): Remove, use
2011 ::Input_argument_list.
2012 * plugin.cc (Plugin_manager::add_input_file): Add error in
2013 incremental build.
2014 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
2015 functions.
2016 * script.cc (read_input_script): Call
2017 Incremental_input::report_script.
2018 * script.h (Script_info): New class.
2019
b0481b0b
ILT
20202009-04-27 Ian Lance Taylor <iant@google.com>
2021
2022 * x86_64.cc (do_adjust_output_section): Set entsize to
2023 plt_entry_size.
2024
b22a5a41 20252009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
2026
2027 * output.cc (Output_file::close): After short writes, continue
2028 writing from the correct offset in the buffer being written.
2029
40fde488
CD
20302009-04-23 Chris Demetriou <cgd@google.com>
2031
2032 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
2033 * configure: Regenerate.
2034 * config.in: Regenerate.
2035 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
2036 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
2037
3ce2c28e
ILT
20382009-04-21 Mikolaj Zalewski <mikolajz@google.com>
2039
2040 * incremental.cc (Incremental_inputs_header_data): Renamed from
2041 Incremental_input_header_data.
2042 (Incremental_inputs_header_data::data_size): New field.
2043 (Incremental_inputs_header_data::put_input_file_count): Renamed
2044 from input_file_count.
2045 (Incremental_inputs_header_data::put_command_line_offset): Renamed
2046 from command_line_offset.
2047 (Incremental_inputs_header_data::put_reserved): Renamed from
2048 put_reserved.
2049 (Incremental_inputs_entry_data): Renamed from
2050 Incremental_input_entry_data.
2051 (Incremental_inputs_entry_data::data_size): New field.
2052 (Incremental_inputs::report_command_line): New method.
2053 (Incremental_inputs::finalize): New method.
2054 (Incremental_inputs::create_incremental_inputs_data): New method.
2055 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
2056 * incremental.h: New file.
2057 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
2058 (Layout::finalize): Create incremental inputs section in
2059 incremental builds.
2060 (Layout::create_incremental_info_sections): New method.
2061 * layout.h (Layout::incremental_inputs): New method.
2062 (Layout::create_incremental_info_sections): New method.
2063 (Layout::incremental_inputs_): New field.
2064 * main.cc (main): Notify Incremental_input of the command line.
2065
e55bde5e
ILT
20662009-04-01 Ian Lance Taylor <iant@google.com>
2067 Mikolaj Zalewski <mikolajz@google.com>
2068
2069 * gold.h (reserve_unordered_map): Define, three versions, one for
2070 each version of Unordered_map.
2071 * layout.cc (Layout::Layout): Remove options parameter. Add
2072 number_of_input_files parameter. Don't initialize options_.
2073 Initialize number_of_input_files_ and resized_signatures_. Move
2074 sections_are_attached_.
2075 (Layout::layout_group): Reserve space for group_signatures_.
2076 (Layout::find_or_add_kept_section): Change name parameter to be a
2077 reference. Resize signatures_ map when it gets large enough.
2078 (Layout::layout_eh_frame): Use parameters->options() instead of
2079 this->options_.
2080 (Layout::make_output_section): Likewise.
2081 (Layout::attach_allocated_section_to_segment): Likewise.
2082 (Layout::finalize, Layout::create_executable_stack): Likewise.
2083 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
2084 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
2085 * layout.h (class Layout): Update declarations. Remove options_
2086 field. Add number_of_input_files_ and resized_signatures_
2087 fields. Move sections_are_attached_ field.
2088 * main.cc (main): Pass number of input files to Layout
2089 constructor. Don't pass options.
2090
154b857c
ILT
20912009-03-30 Ian Lance Taylor <iant@google.com>
2092
2093 * ffsll.c (ffsll): Correct implementation.
2094
2f35ab9b
ILT
20952009-03-27 Ian Lance Taylor <iant@google.com>
2096
fd03461a
ILT
2097 * ffsll.c: New file.
2098 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
2099 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
2100 * ftruncate.c (ftruncate): Declare before definition.
2101 * mremap.c (mremap): Likewise.
2102 * pread.c (pread): Likewise.
2103 * configure, Makefile.in, config.in: Rebuild.
2104
2f35ab9b
ILT
2105 * mremap.c: New file.
2106 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
2107 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
2108 (mremap): Declare if HAVE_MREMAP is not defined.
2109 * configure, Makefile.in, config.in: Rebuild.
2110
33aea2fd
CC
21112009-03-27 Cary Coutant <ccoutant@google.com>
2112
2113 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
2114 position independent.
2115 * sparc.cc (Target_sparc::check_non_pic): Likewise.
2116 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
2117
6d479619
CC
21182009-03-24 Cary Coutant <ccoutant@google.com>
2119
2120 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
2121 an executable.
2122 (needs_dynamic_reloc): Likewise.
2123
afc06bb8
ILT
21242009-03-24 Ian Lance Taylor <iant@google.com>
2125
2126 * yyscript.y (file_cmd): Recognize EXTERN.
2127 (extern_name_list, extern_name_list_body): New nonterminals.
2128 * script.cc (script_add_extern): Define.
2129 * script-c.h (script_add_extern): Declare.
2130
f6060a4d
ILT
21312009-03-24 Rafael Avila de Espindola <espindola@google.com>
2132
2133 * object.cc (is_elf_object): Define.
2134 * object.h (is_elf_object): Declare.
2135 * archive.cc (Archive::get_elf_object_for_member): Call
2136 is_elf_object.
33aea2fd 2137 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 2138
26736d8e
ILT
21392009-03-24 Elliott Hughes <enh@google.com>
2140
2141 * output.cc (Output_file::map_anonymous): Define.
2142 (Output_file::map): Use map_anonymous. If the regular mmap fails,
2143 try an anonymous one. Report the size if the mmap fails.
2144 * output.h (class Output_file): Declare map_anonymous.
2145
22fd9730
ILT
21462009-03-24 Ian Lance Taylor <iant@google.com>
2147
2148 * target-select.cc (instantiate_target): Don't acquire the lock if
2149 the instantiated_target_ field has already been set.
2150
cb010894
ILT
21512009-03-23 Ian Lance Taylor <iant@google.com>
2152
7f055c20
ILT
2153 * gold-threads.h (class Initialize_lock): Define.
2154 * gold-threads.cc (class Initialize_lock_once): Define.
2155 (initialize_lock_control): New static variable.
2156 (initialize_lock_pointer): New static variable.
2157 (initialize_lock_once): New static function.
2158 (Initialize_lock::Initialize_lock): Define.
2159 (Initialize_lock::initialize): Define.
2160 * target-select.h: Include "gold-threads.h".
2161 (class Target_selector): Add lock_ and initialize_lock_ fields.
2162 Don't define instantiate_target, just declare it.
2163 * target-select.cc (Target_selector::Target_selector): Initialize
2164 new fields.
2165 (Target_selector::instantiate_target): Define.
2166 * descriptors.h: Include "gold-threads.h".
2167 (class Descriptors): Add initialize_lock_ field.
2168 * descriptors.cc (Descriptors::Descriptors): Initialize new
2169 field.
2170 (Descriptors::open): Use initialize_lock_ field
2171 * errors.h (class Errors): Add initialize_lock_ field.
2172 * errors.cc (Errors::Errors): Initialize new field.
2173 (Errors::initialize_lock): Use initialize_lock_ field.
2174 * powerpc.cc (class Target_selector_powerpc): Remove
2175 instantiated_target_ field. In do_recognize call
2176 instantiate_target rather than do_instantiate_target. In
2177 do_instantiate_target just allocate a new target.
2178 * sparc.cc (class Target_selector_sparc): Likewise.
2179
36959681
ILT
2180 * freebsd.h: New file.
2181 * i386.cc: Include "freebsd.h".
2182 (Target_i386): Derive from Target_freebsd rather than
2183 Sized_target.
2184 (Target_selector_i386): Derive from Target_selector_freebsd rather
2185 than Target_selector.
2186 * x86_64.cc: Include "freebsd.h".
2187 (Target_x86_64): Derive from Target_freebsd rather than
2188 Sized_target.
2189 (Target_selector_x86_64): Derive from Target_selector_freebsd
2190 rather than Target_selector.
2191 * target.h (class Target): Add adjust_elf_header and
2192 do_adjust_elf_header.
2193 * output.cc (Output_file_header:: do_sized_write): Call target
2194 adjust_elf_header routine.
2195 * configure.tgt: Set targ_osabi.
2196 * configure.ac: Define GOLD_DEFAULT_OSABI.
2197 * parameters.cc (Parameters::default_target): Pass
2198 GOLD_DEFAULT_OSABI to select_target.
2199 * target-select.h (class Target_selector): Make instantiate_target
2200 protected rather than private.
2201 * Makefile.am (HFILES): Add freebsd.h.
2202 * configure, Makefile.in, config.in: Rebuild.
2203
cb010894
ILT
2204 * merge.cc (do_add_input_section): Correct pend value. Change
2205 message about last entry not being null terminated from error to
2206 warning.
2207
0e879927
ILT
22082009-03-20 Mikolaj Zalewski <mikolajz@google.com>
2209
2210 * incremental.cc: New file.
2211 * Makefile.am (CCFILES): Add incremental.cc.
2212 * Makefile.in: Rebuild.
2213
41105937
PP
22142009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
2215
2216 * layout.cc (Layout::output_section_name): Preserve names
2217 of '.note.' sections.
2218
60439920
ILT
22192009-03-19 Ian Lance Taylor <iant@google.com>
2220
2221 * descriptors.cc (Descriptors::open): Check that the options are
2222 valid before using them.
2223
0d371ad3
ILT
22242009-03-18 Ian Lance Taylor <iant@google.com>
2225
2226 * script-sections.h: Include <list>.
2227 (class Script_sections): Change Sections_elements from std::vector
2228 to std::list. Typedef public Elements_iterator. Add
2229 orphan_section_placement_, data_segment_align_start_, and
2230 saw_data_segment_align_ fields. Remove data_segment_align_index_
2231 field.
2232 * script-sections.cc (class Orphan_section_placement): New class.
2233 (class Sections_element): Add virtual functions is_relro and
2234 orphan_section_init. Remove virtual function place_orphan_here.
2235 (class Output_section_definition): Add is_relro and
2236 orphan_section_init. Remove place_orphan_here.
2237 (class Orphan_output_section): Likewise.
2238 (Script_sections::Script_sections): Update for field changes.
2239 (Script_sections::data_segment_align): Set saw_data_segment_align_
2240 and data_segment_align_start_, not data_segment_align_index.
2241 (Script_sections::data_segment_relro_end): Check
2242 saw_data_segment_align_. Use data_segment_align_start_ rather
2243 than data_segment_align_index_.
2244 (Script_sections::place_orphan): Rewrite to use
2245 Orphan_section_placement.
2246
9201d894
ILT
22472009-03-17 Ian Lance Taylor <iant@google.com>
2248
9c5b8369
ILT
2249 * archive.cc (Archive::add_symbols): Check for a version attached
2250 to the symbol name in the archive map.
2251 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
2252 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
2253 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
2254 (ver_test_11.a): New target.
2255 * testsuite/Makefile.in: Rebuild.
2256
9201d894
ILT
2257 * configure.ac: Check for chsize and posix_fallocate. Replace
2258 ftruncate.
2259 * ftruncate.c: New file, from gnulib.
2260 * output.cc (posix_fallocate): Define dummy version if not
2261 HAVE_POSIX_FALLOCATE.
2262 (Output_file::map): Call posix_fallocate rather than lseek and
2263 write.
2264 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
2265 * configure, Makefile.in, config.in: Rebuild.
2266
ef4ab7a8
PP
22672009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
2268
2269 * layout.h (Layout::create_note): Add section_name parameter.
2270 * layout.cc (Layout::create_note): Likewise.
2271 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
2272
8c500701
ILT
22732009-03-17 Ian Lance Taylor <iant@google.com>
2274
e85b18e1
ILT
2275 * descriptors.cc: Include "options.h".
2276 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
2277 (Descriptors::open): Always use O_CLOEXEC when opening a new
2278 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
2279 then set FD_CLOEXEC.
2280
9efe6174
ILT
2281 * sparc.cc (class Target_sparc): Add has_got_section.
2282 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
2283 make sure we have a GOT section.
2284
2285 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
2286 (Target_sparc::Scan::local): Likewise.
2287 (Target_sparc::Scan::global): Likewise.
2288 (Target_sparc::Relocate::relocate): Likewise.
2289 (Target_sparc::Relocate::relocate_tls): Likewise.
2290
8c500701
ILT
2291 * symtab.cc (Symbol_table::define_default_version): New function,
2292 broken out of add_from_object.
2293 (Symbol_table::add_from_object): Call define_default_version.
2294 (Symbol_table::define_special_symbol): Add resolve_oldsym
2295 parameter. Change all callers. If the version for a symbol comes
2296 from a version script, resolve it with the symbol with the same
2297 name with no version. Also add the symbol without a version if
2298 appropriate.
2299 (do_define_in_output_data): If resolving with oldsym, don't delete
2300 sym.
2301 (do_define_in_output_segment): Likewise.
2302 (do_define_as_constant): Likewise.
2303 * symtab.h (class Symbol_table): Update declarations.
2304
f1ed28fb
ILT
23052009-03-13 Ian Lance Taylor <iant@google.com>
2306
15f8229b
ILT
2307 * readsyms.cc (Read_symbols::incompatible_warning): New function.
2308 (Read_symbols::requeue): New function.
2309 (Read_symbols::do_read_symbols): If make_elf_object fails because
2310 the target type is not configured, and the file was searched for,
2311 issue a warning and retry with the next directory.
2312 (Add_symbols::run): If the file has an incompatible format, and
2313 it was searched for, requeue the Read_symbols task. On error,
2314 release the object.
2315 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
2316 dirindex parameter to constructor. Change all callers. Declare
2317 incompatible_warning and requeue.
2318 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
2319 input_argument_ and input_group_ fields. Add them to
2320 constructor. Change all callers.
2321 (class Read_script): Add dirindex_ field. Add it to constructor.
2322 Change all callers.
2323 * archive.cc (Archive::setup): Remove input_objects parameter.
2324 Change all callers.
2325 (Archive::get_file_and_offset): Likewise.
2326 (Archive::read_all_symbols): Likewise.
2327 (Archive::read_symbols): Likewise.
2328 (Archive::get_elf_object_for_member): Remove input_objects
2329 parameter. Add punconfigured parameter. Change all callers.
2330 (Archive::add_symbols): Change return type to bool. Check return
2331 value of include_member.
2332 (Archive::include_all_members): Likewise.
2333 (Archive::include_member): Change return type to bool. Return
2334 false if first included object has incompatible target. Set
2335 included_member_ field.
2336 (Add_archive_symbols::run): If add_symbols returns false, requeue
2337 Read_symbols task.
2338 * archive.h (class Archive): Add included_member_ field.
2339 Initialize it in constructor. Add input_file and searched_for
2340 methods. Update declarations.
2341 (class Add_archive_symbols): Add dirpath_, dirindex_, and
2342 input_argument_ fields. Add them to constructor. Change all
2343 callers.
2344 * script.cc: Include "target-select.h".
2345 (class Parser_closure): Add skip_on_incompatible_target_ and
2346 found_incompatible_target_ fields. Add
2347 skip_on_incompatible_target parameter to constructor. Change all
2348 callers. Add methods skip_on_incompatible_target,
2349 clear_skip_on_incompatible_target, found_incompatible_target, and
2350 set_found_incompatible_target.
2351 (read_input_script): Add dirindex parameter. Change all callers.
2352 If parser finds an incompatible target, requeue Read_symbols
2353 task.
2354 (script_set_symbol): Clear skip_on_incompatible_target in
2355 closure.
2356 (script_add_assertion, script_parse_option): Likewise.
2357 (script_start_sections, script_add_phdr): Likewise.
2358 (script_check_output_format): New function.
2359 * script.h (read_input_script): Update declaration.
2360 * script-c.h (script_check_output_format): Declare.
2361 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
2362 (ignore_cmd): Remove OUTPUT_FORMAT.
2363 * fileread.cc (Input_file::Input_file): Add explicit this.
2364 (Input_file::will_search_for): New function.
2365 (Input_file::open): Add pindex parameter. Change all callers.
2366 * fileread.h (class Input_file): Add input_file_argument method.
2367 Declare will_search_for. Update declarations.
2368 * object.cc (make_elf_object): Add punconfigured parameter.
2369 Change all callers.
2370 * object.h (class Object): Make input_file public. Add
2371 searched_for method.
2372 (make_elf_object): Update declaration.
2373 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
2374 restart search.
2375 * dirsearch.h (class Dirsearch): Update declaration.
2376 * options.h (class General_options): Add --warn-search-mismatch.
2377 * parameters.cc (Parameters::is_compatible_target): New function.
2378 * parameters.h (class Parameters): Declare is_compatible_target.
2379 * workqueue.cc (Workqueue::add_blocker): New function.
2380 * workqueue.h (class Workqueue): Declare add_blocker.
2381
f1ed28fb
ILT
2382 * fileread.cc (Input_file::open): Remove options parameter.
2383 Change all callers.
2384 (Input_file::open_binary): Likewise.
2385 * script.cc (read_input_script): Likewise.
2386 * readsyms.h (class Read_symbols): Remove options_ field. Remove
2387 options parameter from constructor. Change all callers.
2388 (class Read_script): Likewise.
2389 * fileread.h (class Input_file): Update declarations.
2390 * script.h (read_input_script): Update declaration.
2391
34dd024a
NC
23922009-03-10 Nick Clifton <nickc@redhat.com>
2393
2394 * po/es.po: New Spanish translation.
2395
6d71b17c
CC
23962009-03-06 Cary Coutant <ccoutant@google.com>
2397
2398 * options.cc (parse_short_option): Keep dash_z from registering itself.
2399
031cdbed
ILT
24002009-03-03 Ian Lance Taylor <iant@google.com>
2401
2402 PR 9918
2403 * target-reloc.h (relocate_section): Pass output_section to
2404 relocate.
2405 * i386.cc (Target_i386::should_apply_static_reloc): Add
2406 output_section parameter. Change all callers.
2407 (Target_i386::Relocate::relocate): Add output_section parameter.
2408 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2409 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2410 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2411 * testsuite/two_file_shared.sh: New script.
2412 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
2413 (check_DATA): Add two_file_shared.dbg.
2414 (two_file_shared.dbg): New target.
2415 * testsuite/Makefile.in: Rebuild.
2416
15d5fa16
ILT
24172009-03-01 Ian Lance Taylor <iant@google.com>
2418
2419 * configure.ac: Check for byteswap.h.
2420 * configure: Rebuild.
2421 * config.in: Rebuild.
2422
8a4c0b0d
ILT
24232009-03-01 Mikolaj Zalewski <mikolajz@google.com>
2424
2425 * layout.cc (Layout::find_or_add_kept_section): New function.
2426 (Layout::add_comdat): Removed.
2427 * layout.h (struct Kept_section): Move out of class Layout.
2428 Remove trailing underscores from field names. Add group_sections
2429 field. Rename group_ field to is_group. Change all uses.
2430 (class Layout): Declare find_or_add_kept_section, not add_comdat.
2431 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
2432 comdat_groups_ field.
2433 (Sized_relobj::include_section_group): Use
2434 find_or_add_kept_section and Kept_section::group_sections.
2435 (Sized_relobj::include_linkonce_section): Likewise.
2436 * object.cc (class Sized_relobj): Don't define Comdat_group or
2437 Comdat_group_table. Remove find_comdat_group and
2438 add_comdat_group. Remove comdat_groups_ field.
2439 * plugin.cc (include_comdat_group): Use
2440 Layout::find_or_add_kept_section.
2441
b4ecf66b
ILT
24422009-02-28 Ian Lance Taylor <iant@google.com>
2443
14359ca0
ILT
2444 * README: --gc-sections and map files are now supported. Document
2445 some build requirements.
2446
b4ecf66b
ILT
2447 PR 6992
2448 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
2449 relocatable link set the value of the section symbol to zero.
2450 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
2451 relocatable link don't include the section address in the local
2452 symbol value.
2453
0602e05a
ILT
24542009-02-27 Ian Lance Taylor <iant@google.com>
2455
fd9d194f
ILT
2456 PR 6811
2457 * options.h (class Search_directory): Add is_system_directory.
2458 (class General_options): Declare is_in_system_directory.
2459 * options.cc (get_relative_sysroot): Make static.
2460 (get_default_sysroot): Make static.
2461 (General_optoins::is_in_system_directory): New function.
2462 * fileread.cc (Input_file::is_in_system_directory): New function.
2463 * fileread.h (class Input_file): Declare is_in_system_directory.
2464 * object.h (class Object): Add is_in_system_directory.
2465 (class Input_objects): Remove system_library_directory_ field.
2466 * object.cc (Input_objects::add_object): Don't set
2467 system_library_directory_.
2468 (input_objects::found_in_system_library_directory): Remove.
2469 * symtab.cc (Symbol_table::write_globals): Remove input_objects
2470 parameter. Change all callers.
2471 (Symbol_table::sized_write_globals): Likewise.
2472 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
2473 Call Object::is_in_system_directory.
2474 * symtab.h (class Symbol_table): Update declarations.
2475
61edd21f
ILT
2476 PR 5990
2477 * descriptors.h (Open_descriptor): Add is_on_stack field.
2478 * descriptors.cc (Descriptors::open): If the descriptor is on the
2479 top of the stack, remove it. Initialize is_on_stack field.
2480 (Descriptors::release): Only add pod to stack if it is not on the
2481 stack already.
2482 (Descriptors::close_some_descriptor): Clear stack_next and
2483 is_on_stack fields.
2484
e29e076a
ILT
2485 PR 7091
2486 * output.cc (Output_section::find_starting_output_address): Rename
2487 from starting_output_address; add PADDR parameter; change return
2488 type.
2489 * output.h (class Output_section): Declare
2490 find_starting_output_address instead of starting_output_address.
2491 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
2492 section symbol for which we can't find a merge section.
2493
0602e05a
ILT
2494 PR 9836
2495 * symtab.cc (Symbol_table::add_from_object): If the visibility is
2496 hidden or internal, force the symbol to be local.
2497 * resolve.cc (Symbol::override_visibility): Define.
2498 (Symbol::override_base): Use override_visibility.
2499 (Symbol_table::resolve): Likewise.
2500 (Symbol::override_base_with_special): Likewise.
2501 (Symbol_table::override_with_special): If the visibility is hidden
2502 or internal, force the symbol to be local.
2503 * symtab.h (class Symbol): Add set_visibility and
2504 override_visibility.
2505 * testsuite/ver_test_1.sh: New file.
2506 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
2507 (check_DATA): Add ver_test_1.syms.
2508 (ver_test_1.syms): New target.
2509 * testsuite/Makefile.in: Rebuild.
2510
401a9a73
CC
25112009-02-25 Cary Coutant <ccoutant@google.com>
2512
2513 * layout.cc (Layout::choose_output_section): Don't rename sections
2514 when using a linker script that has a SECTIONS clause.
2515 * Makefile.in: Regenerate.
2516
2517 * testsuite/Makefile.am (script_test_5.sh): New test case.
2518 * testsuite/Makefile.in: Regenerate.
2519 * testsuite/script_test_5.cc: New file.
2520 * testsuite/script_test_5.sh: New file.
2521 * testsuite/script_test_5.t: New file.
2522
f488e4b0
CC
25232009-02-13 Rafael Avila de Espindola <espindola@google.com>
2524
2525 * archive.cc (Archive::include_member): Update calls to add_symbols.
2526 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
2527 the Layout argument.
2528 * dynobj.h (do_add_symbols): Add the Layout argument.
2529 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
2530 Layout argument.
2531 * object.h (Object::add_symbols): Add the Layout argument.
2532 (Object::do_add_symbols): Add the Layout argument.
2533 (Sized_relobj::do_add_symbols): Add the Layout argument.
2534 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
2535 Unify the two versions.
2536 (Add_plugin_symbols): Remove.
2537 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
2538 (Sized_pluginobj::do_add_symbols): Unify the two versions.
2539 (Add_plugin_symbols): Remove.
2540 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
2541 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
2542 (Add_symbols::run): Make it work with Pulginobj.
2543
89dd1680
ILT
25442009-02-06 Ian Lance Taylor <iant@google.com>
2545
2546 * object.cc (Sized_relobj::do_layout): Make info message start
2547 with lower case letter.
2548
266d0a74
ILT
25492009-02-06 Mikolaj Zalewski <mikolajz@google.com>
2550
602b464e
ILT
2551 * binary.cc: Fix file comment.
2552
266d0a74
ILT
2553 * options.h (enum Incremental_disposition): Define.
2554 (class General_options): Add new options: --incremental,
2555 --incremental_changed, --incremental_unchanged,
2556 --incremental_unknown. Add incremental_disposition_ and
2557 implicit_incremental_ fields.
2558 (General_options::incremental_disposition): New function.
2559 (class Position_dependent_options): Add incremental_disposition
2560 option.
2561 (Position_dependent_options::copy_from_options): Set incremental
2562 dispositions.
2563 * options.cc (General_options::parse_incremental_changed): New
2564 function.
2565 (General_options::parse_incremental_unchanged): New function.
2566 (General_options::parse_incremental_unknown): New function.
2567 (General_options::General_options): Initialize new fields
2568 incremental_disposition_ and implicit_incremental_.
2569 (General_options::finalize): Check for uasge of --incremental-*
2570 without --incremental.
2571
f073bbf7
CD
25722009-02-06 Chris Demetriou <cgd@google.com>
2573
2574 * gold.h (gold_undefined_symbol): Change to take only a Symbol
2575 pointer and to report location as the file name associated with
2576 the symbol.
2577 (gold_undefined_symbol_at_location): New function to replace the
2578 old gold_undefined_symbol functionality.
2579 * target-reloc.h (relocate_section): Update to use
2580 gold_undefined_symbol_at_location.
2581 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2582 Call gold_undefined_symbol function rather than gold_error.
2583 * errors.h (Errors::undefined_symbol): Take location as a
2584 string, rather than calculating it from a relocation.
2585 * errors.cc (Errors::fatal): Print "fatal error:" before the
2586 formatted message.
2587 (Errors::error, Errors::error_at_location): Print "error: "
2588 before the formatted message.
2589 (Errors::undefined_symbol): Take location as a string, rather
2590 than calculating it from a relocation.
2591 (gold_undefined_symbol_at_location): New function akin to
2592 old gold_undefined_symbol, calculates location from relocation.
2593 (gold_undefined_symbol): Change to take only a Symbol pointer
2594 and to report location as the file name associated with the symbol.
2595 * testsuite/debug_msg.sh: Update for changed error messages.
2596 * testsuite/undef_symbol.sh: Likewise.
2597
8e94a90c
ILT
25982009-02-04 Duncan Sands <baldrick@free.fr>
2599
2600 PR 9812
2601 * reduced_debug_output.h
2602 (Output_reduced_debug_abbrev_section::failed): Use format for
2603 gold_warning.
2604 (Output_reduced_debug_info_section::faild): Likewise.
2605
88a0e15b
ILT
26062009-01-31 Mikolaj Zalewski <mikolajz@google.com>
2607
2608 * script.cc (Lazy_demangler): New class.
2609 (Version_script_info::get_symbol_version_helper): Demangle a
2610 symbol only once.
2611
5efc7cd2
CC
26122009-01-29 Cary Coutant <ccoutant@google.com>
2613
2614 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
2615 to __tls_get_addr.
2616 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2617
e0ebcf42
ILT
26182009-01-28 Ian Lance Taylor <iant@google.com>
2619
5efc7cd2 2620 * version.cc (version_string): Bump to 1.9.
75fe7426 2621
e0ebcf42
ILT
2622 * gold.h: Include <cstring> and <stdint.h>.
2623 * version.cc: Include <cstdio>.
2624 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
2625 warning.
2626 * reduced_debug_output.cc (insert_into_vector): Rename from
2627 Insert_into_vector; change all callers. Use Swap_unaligned to
2628 avoid aliasing issue; remove union since it is unnecessary.
2629
8e2813be 26302009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
2631
2632 * Makefile.am (CCFILES): Add gc.cc.
2633 (HFILES): Add gc.h.
2634 * Makefile.in: Regenerate.
2635 * gold.cc (Gc_runner): New class.
2636 (queue_initial_tasks): Call garbage collection related tasks
2637 when corresponding options are invoked.
2638 (queue_middle_gc_tasks): New function.
2639 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
2640 processed early before laying out sections during garbage collection.
2641 * gold.h (queue_middle_gc_tasks): New function.
2642 (is_prefix_of): Move from "layout.cc".
2643 * i386.cc (Target_i386::gc_process_relocs): New function.
2644 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
2645 * main.cc (main): Create object of class "Garbage_collection".
2646 * object.cc (Relobj::copy_symbols_data): New function.
2647 (Relobj::is_section_name_included): New function.
2648 (Sized_relobj::do_layout): Allow this function to be called twice
2649 during garbage collection and defer layout of section during the
2650 first call.
2651 * object.h (Relobj::get_symbols_data): New function.
2652 (Relobj::is_section_name_included): New function.
2653 (Relobj::copy_symbols_data): New function.
2654 (Relobj::set_symbols_data): New function.
2655 (Relobj::get_relocs_data): New function.
2656 (Relobj::set_relocs_data): New function.
2657 (Relobj::is_output_section_offset_invalid): New pure virtual function.
2658 (Relobj::gc_process_relocs): New function.
2659 (Relobj::do_gc_process_relocs): New pure virtual function.
2660 (Relobj::sd_): New data member.
2661 (Sized_relobj::is_output_section_offset_invalid): New function.
2662 (Sized_relobj::do_gc_process_relocs): New function.
2663 * options.h (General_options::gc_sections): Modify to not be a no-op.
2664 (General_options::print_gc_sections): New option.
2665 * plugin.cc (Plugin_finish::run): Remove function call to
2666 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
2667 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
2668 * reloc.cc (Read_relocs::run): Add task to process relocs and
2669 determine unreferenced sections when doing garbage collection.
2670 (Gc_process_relocs): New class.
2671 (Sized_relobj::do_gc_process_relocs): New function.
2672 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
2673 sections that are garbage collected.
2674 * reloc.h (Gc_process_relocs): New class.
2675 * sparc.cc (Target_sparc::gc_process_relocs): New function.
2676 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
2677 symbols whose corresponding sections are garbage collected.
2678 (Symbol_table::Symbol_table): Add new parameter for the garbage
2679 collection object.
2680 (Symbol_table::gc_mark_undef_symbols): New function.
2681 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2682 (Symbol_table::gc_mark_dyn_syms): New function.
2683 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
2684 as garbage.
2685 (Symbol_table::add_from_object): Likewise.
2686 (Symbol_table::add_from_relobj): When building shared objects, do not
2687 treat externally visible symbols as garbage.
2688 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
2689 table information for static and relocatable links.
2690 * symtab.h (Symbol_table::set_gc): New function.
2691 (Symbol_table::gc): New function.
2692 (Symbol_table::gc_mark_undef_symbols): New function.
2693 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2694 (Symbol_table::gc_mark_dyn_syms): New function.
2695 (Symbol_table::gc_): New data member.
2696 * target.h (Sized_target::gc_process_relocs): New pure virtual
2697 function.
2698 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
2699 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
2700
3b293544
CF
27012009-01-20 Chris Faylor <me.sourceware@sourceware.org>
2702
2703 * options.h (General_options::gc_sections): Define as a no-op for now.
2704 (General_options::no_keep_memory): Ditto.
2705 (General_options::Bshareable): Define.
2706 * options.cc (General_options::finalize): Honor -Bshareable.
2707
83d22aa8
AS
27082009-01-20 Andreas Schwab <schwab@suse.de>
2709
2710 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
2711 read the value in the contents, since we don't use it. Use the
2712 template endianness when writing.
2713 (Relocate::relocate): Use it for R_PPC_REL16_HA.
2714
cd536b21
AS
27152009-01-19 Andreas Schwab <schwab@suse.de>
2716
2717 * configure.tgt (powerpc64-*): Fix targ_obj.
2718
99e9a495
ILT
27192009-01-15 Ian Lance Taylor <iant@google.com>
2720
2721 * object.cc (Sized_relobj::write_local_symbols): Don't write out
2722 local symbols when stripping all symbols.
2723
bbbfea06
CC
27242009-01-14 Cary Coutant <ccoutant@google.com>
2725
99e9a495 2726 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 2727
0f7c0701
CC
27282009-01-14 Cary Coutant <ccoutant@google.com>
2729
2730 * archive.cc (Archive::get_elf_object_for_member): Remove call
2731 to File_read::claim_for_plugin.
2732 * descriptors.cc (Descriptors::open): Remove reference to
2733 is_claimed.
2734 (Descriptors::claim_for_plugin): Remove.
2735 * descriptors.h (Descriptors::claim_for_plugin): Remove.
2736 (Descriptors::is_claimed): Remove.
2737 (claim_descriptor_for_plugin): Remove.
2738 * fileread.cc (File_read::claim_for_plugin): Remove.
2739 * fileread.h (File_read::claim_for_plugin): Remove.
2740 (File_read::descriptor): Reopen descriptor if necessary.
2741 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
2742 (Plugin_manager::all_symbols_read): Add task parameter. Change
2743 all callers.
2744 (Plugin_manager::get_input_file): New function.
2745 (Plugin_manager::release_input_file): New function.
2746 (Pluginobj::Pluginobj): Add filesize parameter and initialize
2747 corresponding data member.
2748 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
2749 and pass to base constructor. Change all callers.
2750 (get_input_file, release_input_file): New functions.
2751 (make_sized_plugin_object): Add filesize parameter. Change all callers.
2752 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
2753 (Plugin_manager::all_symbols_read): Add task parameter.
2754 (Plugin_manager::get_input_file): New function.
2755 (Plugin_manager::release_input_file): New function.
2756 (Plugin_manager::task_): New data member.
2757 (Pluginobj::Pluginobj): Add filesize parameter.
2758 (Pluginobj::filename): New function.
2759 (Pluginobj::descriptor): New function.
2760 (Pluginobj::filesize): New function.
2761 (Pluginobj::filesize_): New data member.
2762 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
2763 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
2764 File_read::claim_for_plugin; use Object::unlock to unlock the file.
2765
2766 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
2767 with archive libraries.
2768 * testsuite/Makefile.in: Regenerate.
2769 * testsuite/plugin_test.c (struct sym_info): New type.
2770 (get_input_file, release_input_file): New static variables.
2771 (onload): Capture new transfer vector entries.
2772 (claim_file_hook): Stop reading at end of file according to filesize.
2773 Factor out parsing of readelf output into separate function.
2774 (all_symbols_read_hook): Exercise get_input_file and release_input_file
2775 APIs and get the source file name from the symbol table. Convert
2776 source file name to corresponding object file name. Print info
2777 message when adding new input files.
2778 (parse_readelf_line): New function.
2779 * testsuite/plugin_test_1.sh: Add checks for new info messages.
2780 * testsuite/plugin_test_2.sh: Likewise.
2781 * testsuite/plugin_test_3.sh: Likewise.
2782 * testsuite/plugin_test_4.sh: New test case.
2783
62a6d109
ILT
27842009-01-07 Ian Lance Taylor <iant@google.com>
2785
2786 * version.cc (version_string): Bump to 1.8.
2787
483620e8
CC
27882008-12-23 Cary Coutant <ccoutant@google.com>
2789
2790 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
2791 * plugin.cc (Plugin_manager::finish): Rename as
2792 layout_deferred_objects. Move cleanup to separate function.
2793 (Plugin_manager::cleanup): New function.
2794 (Plugin_finish::run): Call layout_deferred_objects and cleanup
2795 separately.
2796 * plugin.h (Plugin_manager::finish): Rename as
2797 layout_deferred_objects.
2798 (Plugin_manager::cleanup): New function.
2799 (Plugin_manager::cleanup_done): New field.
2800
d66a9eb3
CC
28012008-12-23 Cary Coutant <ccoutant@google.com>
2802
2803 * plugin.cc (is_visible_from_outside): New function.
2804 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
2805 so we don't return "IR only" status for exported symbols or -r links.
2806
2807 * testsuite/Makefile.am (plugin_test_3): New test case.
2808 * testsuite/Makefile.in: Regenerate.
2809 * testsuite/plugin_test_3.sh: New file.
2810
5995b570
CC
28112008-12-22 Cary Coutant <ccoutant@google.com>
2812
2813 * object.cc (Sized_relobj::layout_section): New function.
2814 (Sized_relobj::do_layout): Defer layout of input sections until after
2815 plugin has provided replacement files.
2816 (Sized_relobj::do_layout_deferred_sections): New function.
2817 * object.h (Relobj::set_section_offset): Remove virtual keyword.
2818 (Relobj::layout_deferred_sections): New function.
2819 (Relobj::do_layout_deferred_sections): New function.
2820 (Sized_relobj::do_layout_deferred_sections): New function.
2821 (Sized_relobj::layout_section): New function.
2822 (Sized_relobj::Deferred_layout): New structure.
2823 (Sized_relobj::deferred_layout_): New field.
2824 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
2825 Change all callers. Layout deferred sections.
2826 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
2827 references.
2828 (Plugin_hook::run): Move code from do_plugin_hook inline.
2829 (Plugin_hook::do_plugin_hook): Remove.
2830 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
2831 (Plugin_manager::finish): Renamed, was cleanup.
2832 (Plugin_manager::should_defer_layout): New function.
2833 (Plugin_manager::add_deferred_layout_object): New function.
2834 (Plugin_manager::Deferred_layout_list): New type.
2835 (Plugin_manager::deferred_layout_objects_): New field.
2836 (Plugin_hook::do_plugin_hook): Remove.
2837
ee769c88
ILT
28382008-12-17 Ian Lance Taylor <iant@google.com>
2839
2840 * options.h (class General_options): Add --no case for
2841 --export-dynamic.
2842
abc8dcba
CC
28432008-12-16 Cary Coutant <ccoutant@google.com>
2844
2845 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
2846 vector.
2847 (Plugin_manager::claim_file): Create plugin object even if
2848 plugin did not call the add_symbols callback.
2849 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
2850 asking for more symbols than were added.
2851 * testsuite/Makefile.am (plugin_test_1): Add test case with
2852 no global symbols.
2853 (empty.syms): New target.
2854 * testsuite/Makefile.in: Regenerate.
2855 * testsuite/plugin_test.c (claim_file_hook): Add new debug
2856 message. Don't call add_symbols if no globals.
2857 (all_symbols_read_hook): Don't provide replacement for empty
2858 claimed file.
2859
b0074644
ILT
28602008-12-12 Ian Lance Taylor <iant@google.com>
2861
68943102
ILT
2862 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
2863 r_type == 0 for a local symbol with r_sym == 0.
2864 (scan_relocatable_relocs): Pass r_sym to
2865 local_non_section_strategy.
2866 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
2867 r_sym parameter.
2868
b0074644
ILT
2869 * configure.ac: Update test for TLS descriptors: they are
2870 supported as of glibc 2.9.
2871 * configure: Rebuild.
2872
c2508178
ILT
28732008-12-11 Ian Lance Taylor <iant@google.com>
2874
2875 PR 7091
2876 * target-reloc.h (Default_scan_relocatable_relocs): For each
2877 function, map r_type == 0 to RELOC_DISCARD.
2878
2756a258
CC
28792008-12-10 Cary Coutant <ccoutant@google.com>
2880
2881 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
2882 object to override a kept COMDAT group from a plugin object.
2883
bb6f53d3
ILT
28842008-12-09 Ian Lance Taylor <iant@google.com>
2885
fbc558e1
ILT
2886 PR 7088
2887 * yyscript.y (file_cmd): Handle INPUT.
2888
bb6f53d3
ILT
2889 * testsuite/initpri1.c: Change all declarations to be full
2890 prototypes by adding void, to avoid compiler warnings.
2891
4674ecfc
CC
28922008-12-05 Rafael Avila de Espindola <espindola@google.com>
2893
2894 * options.cc (General_options::parse_plugin_opt): New.
2895 (General_options::add_plugin): The argument now is just the filename.
2896 (General_options::add_plugin_option): New.
2897 * options.h (plugin_opt): New.
2898 (add_plugin): Change argument name.
2899 (add_plugin_option): New.
2900 * plugin.cc (Plugin::load): Don't parse the plugin option.
2901 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
2902 (Plugin::add_option): New.
2903 (Plugin::args_): Change type.
2904 (Plugin::filename_): New.
2905 (Plugin_manager::add_plugin_option): New.
2906 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
2907 * testsuite/Makefile.in: Regenerate.
2908
fd06b4aa
CC
29092008-12-05 Cary Coutant <ccoutant@google.com>
2910
2911 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
2912 Handle --strip-lto-sections option.
2913 * options.h (strip_lto_sections): New option.
2914
6c52134c
CC
29152008-12-01 Cary Coutant <ccoutant@google.com>
2916
2917 * plugin.cc (ld_plugin_message): Change format parameter to const.
2918 Fix mismatch between new[] and delete.
2919
a45248e0
CC
29202008-11-14 Cary Coutant <ccoutant@google.com>
2921
2922 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
2923 instead of -1U.
2924
c82fbeee
CS
29252008-11-05 Craig Silverstein <csilvers@google.com>
2926
2927 * options.cc (General_options::parse_dynamic_list): New function.
2928 * options.h (General_options): New flags dynamic_list,
2929 dynamic_list_data, dynamic_list_cpp_new, and
2930 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
2931 (General_options::in_dynamic_list): New function.
2932 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
2933 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
2934 (Lex::can_continue_name): Likewise.
2935 (yylex): Likewise.
2936 (read_script_file): New parameter script_options.
2937 (read_dynamic_list): New function.
2938 (Script_options::define_dynamic_list): New function.
2939 (dynamic_list_keyword_parsecodes): New variable.
2940 (dynamic_list_keywords): New variable.
2941 * script.h (Script_options::define_dynamic_list): New function
2942 prototype.
2943 (read_dynamic_list): New function prototype.
2944 * symtab.cc (strprefix): New macro.
2945 (Symbol::should_add_dynsym_entry): Support dynamic_list,
2946 dynamic_list_data, dynamic_list_cpp_new, and
2947 dynamic_list_cpp_typeinfo.
2948 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
2949 (dynamic_list_expr): New rule.
2950 (dynamic_list_nodes): Likewise.
2951 (dynamic_list_node): Likewise.
2952 * testsuite/Makefile.am (dynamic_list): New test.
2953 * testsuite/Makefile.in: Regenerated.
2954 * testsuite/dynamic_list.t: New file.
2955 * testsuite/dynamic_list.sh: New file.
2956
e0bb29a5
CS
29572008-11-05 Craig Silverstein <csilvers@google.com>
2958
2959 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
2960 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
2961 (t11_last): Likewise.
2962 * testsuite/ver_test_6.c (main): Likewise.
2963
4e1e25e0
CC
29642008-10-07 Cary Coutant <ccoutant@google.com>
2965
2966 * options.c (General_options::finalize): Add check for -static and
2967 -shared.
2968 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
2969 is not empty.
2970
92f03fcb
CC
29712008-10-02 Cary Coutant <ccoutant@google.com>
2972
2973 * plugin.cc (make_sized_plugin_object): Fix conditional
2974 compilation to work when not all targets are enabled.
2975
fbd8a257
CC
29762008-09-29 Cary Coutant <ccoutant@google.com>
2977
2978 * archive.cc (Archive::get_file_and_offset): Use filename instead
2979 of name to get library path.
2980 (Archive::include_member): Unlock external member of a thin archive.
2981
2982 * testsuite/Makefile.am (TEST_AR): New variable.
2983 (thin_archive_test_1): New test.
2984 (thin_archive_test_2): New test.
81636b3f
CC
2985 * testsuite/Makefile.in: Regenerate.
2986 * testsuite/thin_archive_main.cc: New file.
2987 * testsuite/thin_archive_test_1.cc: New file.
2988 * testsuite/thin_archive_test_2.cc: New file.
2989 * testsuite/thin_archive_test_3.cc: New file.
2990 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 2991
eff45813
CC
29922008-09-29 Cary Coutant <ccoutant@google.com>
2993
2994 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
2995 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
2996 instead of -1U.
2997 (Sized_relobj::do_finalize_local_symbols): Likewise.
2998 (Sized_relobj::map_to_kept_section): Likewise.
2999 * object.h (Sized_relobj::invalid_address): New constant.
3000 (Sized_relobj::do_output_section_offset): Check for invalid_address
3001 and return -1ULL.
3002 * output.cc (Output_reloc::local_section_offset): Use constant
3003 invalid_address instead of -1U.
3004 (Output_reloc::get_address): Likewise.
3005 (Output_section::output_address): Change -1U to -1ULL.
3006 * output.h (Output_reloc::invalid_address): New constant.
3007 * reloc.cc (Sized_relobj::write_sections): Use constant
3008 invalid_address instead of -1U.
3009 (Sized_relobj::relocate_sections): Likewise.
3010 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
3011 values for merge sections.
3012 * target-reloc.h (relocate_for_relocatable): Use constant
3013 invalid_address instead of -1U.
3014
89fc3421
CC
30152008-09-19 Cary Coutant <ccoutant@google.com>
3016
3017 Add plugin functionality for link-time optimization (LTO).
3018 * configure.ac (plugins): Add --enable-plugins option.
3019 * configure: Regenerate.
3020 * config.in: Regenerate.
3021 * Makefile.am (LIBDL): New variable.
3022 (CCFILES): Add plugin.cc.
3023 (HFILES): Add plugin.h.
3024 (ldadd_var): Add LIBDL.
3025 * Makefile.in: Regenerate.
3026
3027 * archive.cc: Include "plugin.h".
3028 (Archive::setup): Don't preread archive symbols when using a plugin.
3029 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
3030 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
3031 files.
3032 (Archive::include_member): Add symbols from plugin objects.
3033 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
3034 * descriptors.cc (Descriptors::open): Check for file descriptors
3035 abandoned by plugins.
3036 (Descriptors::claim_for_plugin): New function.
3037 * descriptors.h (Descriptors::claim_for_plugin): New function.
3038 (Open_descriptor::is_claimed): New field.
3039 (claim_descriptor_for_plugin): New function.
3040 * fileread.cc (File_read::claim_for_plugin): New function.
3041 * fileread.h (File_read::claim_for_plugin): New function.
3042 (File_read::descriptor): New function.
3043 * gold.cc: Include "plugin.h".
3044 (queue_initial_tasks): Add task to call plugin hooks for generating
3045 new object files.
3046 * main.cc: Include "plugin.h".
3047 (main): Load plugin libraries.
3048 * object.h (Pluginobj): Declare.
3049 (Object::pluginobj): New function.
3050 (Object::do_pluginobj): New function.
3051 (Object::set_target): New function.
3052 * options.cc: Include "plugin.h".
3053 (General_options::parse_plugin): New function.
3054 (General_options::General_options): Initialize plugins_ field.
3055 (General_options::add_plugin): New function.
3056 * options.h (Plugin_manager): Declare.
3057 (General_options): Add --plugin option.
3058 (General_options::has_plugins): New function.
3059 (General_options::plugins): New function.
3060 (General_options::add_plugin): New function.
3061 (General_options::plugins_): New field.
3062 * plugin.cc: New file.
3063 * plugin.h: New file.
3064 * readsyms.cc: Include "plugin.h".
3065 (Read_symbols::do_read_symbols): Check for archive before checking
3066 for ELF file. Call plugin hooks to claim files.
3067 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
3068 from a real object file; force override when processing replacement
3069 files.
3070 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
3071 (Symbol::init_base_object): Likewise.
3072 (Symbol::init_base_output_data): Likewise.
3073 (Symbol::init_base_output_segment): Likewise.
3074 (Symbol::init_base_constant): Likewise.
3075 (Symbol::init_base_undefined): Likewise.
3076 (Symbol::output_section): Assert that object is not a plugin.
3077 (Symbol_table::add_from_pluginobj): New function.
3078 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
3079 undefined.
3080 (Symbol_table::sized_write_globals): Likewise.
3081 (Symbol_table::add_from_pluginobj): Instantiate template.
3082 * symtab.h (Sized_pluginobj): Declare.
3083 (Symbol::in_real_elf): New function.
3084 (Symbol::set_in_real_elf): New function.
3085 (Symbol::in_real_elf_): New field.
3086 (Symbol_table::add_from_pluginobj): New function.
3087
3088 * testsuite/Makefile.am (AM_CFLAGS): New variable.
3089 (LIBDL): New variable.
3090 (LDADD): Add LIBDL.
3091 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
3092 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
3093 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
3094 (MOSTLYCLEANFILES): Likewise.
3095 * testsuite/Makefile.in: Regenerate.
3096 * testsuite/plugin_test.c: New file.
3097 * testsuite/plugin_test_1.sh: New file.
3098 * testsuite/plugin_test_2.sh: New file.
3099
de31bda5
ILT
31002008-09-16 Ian Lance Taylor <iant@google.com>
3101
9c2d0ef9
ILT
3102 * target-reloc.h (relocate_section): Check whether a symbol is
3103 defined by the ABI before reporting an undefined symbol error.
3104 * target.h (Target::is_defined_by_abi): Make parameter const.
3105 (Target::do_is_defined_by_abi): Likewise.
3106 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
3107 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
3108 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
3109 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
3110 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
3111 * testsuite/Makefile.in: Rebuild.
3112
de31bda5
ILT
3113 * fileread.cc (make_view): Add casts to avoid warning.
3114
9fa33bee
AO
31152008-09-16 Alexandre Oliva <aoliva@redhat.com>
3116
3117 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
3118 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3119
183fd0e3
AO
31202008-09-16 Alexandre Oliva <aoliva@redhat.com>
3121
3122 * options.h (General_options::output_is_executable): New.
3123 (General_options::output_is_pie): New.
3124 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
3125 for shared libraries.
3126 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3127
7be8330a
CD
31282008-09-11 Chris Demetriou <cgd@google.com>
3129
3130 * options.h (origin): New -z option.
3131 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
3132 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
3133 in DT_FLAGS_1.
3134
a9caad02
CC
31352008-09-05 Cary Coutant <ccoutant@google.com>
3136
3137 * fileread.cc (File_read::make_view): Add check for attempt to map
3138 beyond end of file.
3139
ae6dce4d
CC
31402008-09-05 Cary Coutant <ccoutant@google.com>
3141
3142 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
3143 explicit instantiations.
3144
d7ab2a47
KVH
31452008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
3146
3147 PR gold/6858
3148 * options.cc (General_options::finalize): Allow undefined symbols
3149 in shlibs if linking -shared.
3150
3151 PR gold/6859
3152 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
3153 symbols as not needing a dynsym entry.
3154
1e52a9c1
CS
31552008-08-20 Craig Silverstein <csilvers@google.com>
3156
3157 * fileread.cc (File_read::open): Do not lock the file unless it
3158 was successfully opened.
3159
d85c80a3
CC
31602008-08-14 Cary Coutant <ccoutant@google.com>
3161
3162 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
3163 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
3164 * testsuite/tls_test.cc (struct int128): 128-bit struct
3165 for testing TLS relocs with non-zero addend.
3166 (v12): New TLS variable.
3167 (t12): New test.
3168 (t_last): Add check for v12.
3169 * testsuite/tls_test.h (t12): New function.
3170 * testsuite/tls_test_main.cc (thread_routine): Call new test.
3171
2d924fd9
ILT
31722008-08-13 Ian Lance Taylor <iant@google.com>
3173
3174 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
3175 set tls_segment_ or relro_segment_.
3176 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
3177 when appropriate.
3178 * output.h (Output_section::clear_is_relro): New function.
3179 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
3180 sections specially even when output_data_ is empty.
3181 (Output_segment::maximum_alignment): When first section is relro,
3182 only force alignment for PT_LOAD segments.
3183 * script.cc (script_data_segment_align): New function.
3184 (script_data_segment_relro_end): New function.
3185 * script-c.h (script_data_segment_align): Declare.
3186 (script_data_segment_relro_end): Declare.
3187 * script-sections.h (class Script_sections): Declare
3188 data_segment_align and data_segment_relro_end. Add fields
3189 segment_align_index_ and saw_relro_end_.
3190 * script-sections.cc (class Sections_element): Add set_is_relro
3191 virtual function. Add new bool* parameter to place_orphan_here.
3192 Add get_output_section virtual function.
3193 (class Output_section_definition): Add set_is_relro. Add new
3194 bool* parameter to place_orphan_here. Add get_output_section.
3195 Add is_relro_ field.
3196 (Output_section_definition::Output_section_definition): Initialize
3197 evaluated_address_, evaluated_load_address, evaluated_addralign_,
3198 and is_relro_ fields.
3199 (Output_section_definition::place_orphan_here): Add is_relro
3200 parameter.
3201 (Output_section_definition::set_section_addresses): Set relro for
3202 output section.
3203 (Output_section_definition::alternate_constraint): Likewise.
3204 (class Orphan_output_section): Add new bool* parameter to
3205 place_orphan_here. Add get_output_section.
3206 (Orphan_output_section::place_orphan_here): Add is_relro
3207 parameter.
3208 (Script_sections::Script_sections): Initialize
3209 data_segment_align_index_ and saw_relro_end_.
3210 (Script_sections::data_segment_align): New function.
3211 (Script_sections::data_segment_relro_end): New function.
3212 (Script_sections::place_orphan): Set or clear is_relro.
3213 (Script_sections::set_section_addresses): Force alignment of first
3214 TLS section.
3215 * yyscript.y (exp): Call script_data_segment_align and
3216 script_data_segment_relro_end.
3217 * testsuite/relro_script_test.t: New file.
3218 * testsuite/relro_test.cc (using_script): Declare.
3219 (t1, t2): Test using_script.
3220 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
3221 (relro_script_test_SOURCES): Define.
3222 (relro_script_test_DEPENDENCIES): Define.
3223 (relro_script_test_LDFLAGS): Define.
3224 (relro_script_test_LDADD): Define.
3225 (relro_script_test.so): New target.
3226 * testsuite/Makefile.in: Rebuild.
3227
f827c9a9
CC
32282008-08-06 Cary Coutant <ccoutant@google.com>
3229
3230 * archive.cc (Archive::total_archives, Archive::total_members)
3231 (Archive::total_members_loaded): New variables.
3232 (Archive::setup): Add parameter. Add option to preread
3233 archive symbols.
3234 (Archive::read_armap): Add counter.
3235 (Archive::get_file_and_offset): New function.
3236 (Archive::get_elf_object_for_member): New function.
3237 (Archive::read_all_symbols): New function.
3238 (Archive::read_symbols): New function.
3239 (Archive::add_symbols): Add counters.
3240 (Archive::include_all_members): Use armap to find members if it's
3241 already built.
3242 (Archive::include_member): Skip reading symbols if already read.
3243 Factored code into Archive::get_file_and_offset and
3244 Archive::get_elf_object_for_member. Changed call to
3245 Mapfile::report_include_archive_member.
3246 (Archive::print_stats): New function.
3247 * archive.h: Declare Object and Read_symbols_data classes.
3248 (Archive::Archive): Add initializers for new members.
3249 (Archive::setup): Add parameter.
3250 (Archive::print_stats): New function.
3251 (Archive::total_archives, Archive::total_members)
3252 (Archive::total_members_loaded): New variables.
3253 (Archive::get_file_and_offset): New function.
3254 (Archive::get_elf_object_for_member): New function.
3255 (Archive::read_all_symbols): New function.
3256 (Archive::read_symbols): New function.
3257 (Archive::Archive_member): New class.
3258 (Archive::members_): New member.
3259 (Archive::num_members_): New member.
3260 * main.cc: Include archive.h.
3261 (main): Call Archive::print_stats.
3262 * mapfile.cc (Mapfile::report_include_archive_member): Delete
3263 archive parameter; member_name is now the fully-decorated name.
3264 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
3265 * options.h: (General_options): Add --preread-archive-symbols option.
3266 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
3267 Archive::setup.
3268
de4c45bd
ILT
32692008-08-04 Ian Lance Taylor <iant@google.com>
3270
3271 * symtab.h (Symbol::use_plt_offset): New function.
3272 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
3273 * powerpc.cc (Relocate::relocate): Likewise.
3274 * sparc.cc (Relocate::relocate): Likewise.
3275 * x86_64.cc (Relocate::relocate): Likewise.
3276 * testsuite/weak_plt.sh: New test.
3277 * testsuite/weak_plt_main.cc: New test.
3278 * testsuite/weak_plt_shared.cc: New test.
3279 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
3280 (check_PROGRAMS): Add weak_plt.
3281 (check_DATA): Add weak_plt_shared.so.
3282 (weak_plt_main_pic.o, weak_plt): New targets.
3283 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
3284 * testsuite/Makefile.in: Rebuild.
3285
3286 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
3287 gcctestdir/ld.
3288 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
3289 * testsuite/Makefile.in: Rebuild.
3290
323ee3f4
AM
32912008-08-04 Alan Modra <amodra@bigpond.net.au>
3292
3293 * Makefile.am (POTFILES.in): Set LC_ALL=C.
3294 * Makefile.in: Regenerate.
3295 * po/POTFILES.in: Regenerate.
3296
7c07ecec
ILT
32972008-07-29 Ian Lance Taylor <iant@google.com>
3298
3299 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
3300 symbols before other symbols.
3301 * testsuite/script_test_2.cc (test_addr): Declare.
3302 (test_addr_alias): Declare.
3303 (main): Check that test_addr and test_addr_alias have the right
cd536b21 3304 values.
7c07ecec
ILT
3305 * testsuite/script_test_2.t: Define test_addr_alias and
3306 test_addr.
3307
5778530e
ILT
33082008-07-24 Ian Lance Taylor <iant@google.com>
3309
2a00e4fb
ILT
3310 PR 5990
3311 * descriptors.cc: New file.
3312 * descriptors.h: New file.
3313 * gold-threads.h (class Hold_optional_lock): New class.
3314 * fileread.cc: Include "descriptors.h".
3315 (File_read::~File_read): Release descriptor rather than closing
3316 it.
3317 (File_read::open) [file]: Call open_descriptor rather than open.
3318 Set is_descriptor_opened_.
3319 (File_read::open) [memory]: Assert that descriptor is not open.
3320 (File_read::reopen_descriptor): New function.
3321 (File_read::release): Release descriptor.
3322 (File_read::do_read): Make non-const. Reopen descriptor.
3323 (File_read::read): Make non-const.
3324 (File_read::make_view): Reopen descriptor.
3325 (File_read::do_readv): Likewise.
3326 * fileread.h (class File_read): Add is_descriptor_opened_ field.
3327 Update declarations.
3328 * layout.cc: Include "descriptors.h".
3329 (Layout::create_build_id): Use open_descriptor rather than open.
3330 * output.cc: Include "descriptors.h".
3331 (Output_file::open): Use open_descriptor rather than open.
3332 * archive.cc (Archive::const_iterator): Change Archive to be
3333 non-const.
3334 (Archive::begin, Archive::end): Make non-const.
3335 (Archive::count_members): Likewise.
3336 * archive.h (class Archive): Update declarations.
3337 * object.h (Object::read): Make non-const.
3338 * Makefile.am (CCFILES): Add descriptors.cc.
3339 (HFILES): Add descriptors.h.
3340 * Makefile.in: Rebuild.
3341
801647d1
ILT
3342 PR 6716
3343 * gold.h: Always include <clocale>. Add Solaris workarounds
3344 following code in binutils/sysdep.h.
3345
5edd166e
ILT
3346 PR 6048
3347 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
3348 this->eh_frame_hdr_ is NULL before using it.
3349
c89ad728
ILT
3350 * dynobj.cc (Versions::Versions): Update comment.
3351
aa86f06b
ILT
3352 * dynobj.cc (Versions::Versions): If there is an soname, use it as
3353 the base version name.
3354
5778530e
ILT
3355 * stringpool.cc (Stringpool_template::add_with_length): Set key to
3356 array size plus one.
3357 (Stringpool_template::set_string_offsets): Subtract one from key
3358 before using it as an array index.
3359 (Stringpool_template::get_offset_with_length): Likewise.
3360 (Stringpool_template::write_to_buffer): Likewise.
3361 * stringpool.h (Stringpool_template::get_offset_from_key):
3362 Likewise.
3363
057ead22
ILT
33642008-07-23 Ian Lance Taylor <iant@google.com>
3365
7f649c59
ILT
3366 PR 6658
3367 * object.h (Merged_symbol_value::value): Do our best to handle a
3368 negative addend.
3369
057ead22
ILT
3370 PR 6647
3371 * script.cc (Version_script_info::get_versions): Don't add empty
3372 version tag to return value.
3373 (Version_script_info::get_symbol_version_helper): Change return
3374 type to bool. Add pversion parameter. Change all callers.
3375 (script_register_vers_node): Don't require a non-NULL tag.
3376 * script.h (class Version_script_info): Update declarations.
3377 (Version_script_info::get_symbol_version): Change return type to
3378 bool. Add version parameter. Change all callers.
3379 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
3380 handling. Handle an empty version from a version script.
3381 (Symbol_table::define_special_symbol): Likewise.
3382 * testsuite/ver_test_10.script: New file.
3383 * testsuite/ver_test_10.sh: New file.
3384 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
3385 (check_DATA): Add ver_test_10.syms.
3386 (ver_test_10.syms, ver_test_10.so): New target.
3387 * testsuite/Makefile.in: Rebuild.
3388
58e54ac2
CD
33892008-07-23 Simon Baldwin <simonb@google.com>
3390
3391 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
3392 to zero for undefined symbols from dynamic libraries.
3393
95d14cd3
ILT
33942008-07-23 Ian Lance Taylor <iant@google.com>
3395
3396 * symtab.cc (Symbol_table::resolve): Remove version parameter.
3397 Change all callers.
3398 * symtab.h (class Symbol_table): Update declaration.
3399 * testsuite/ver_test_9.cc: New file.
3400 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
3401 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
3402 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
3403 (ver_test_9.so, ver_test_9.o): New targets.
3404 * testsuite/Makefile.in: Rebuild.
3405
92de84a6
ILT
34062008-07-22 Ian Lance Taylor <iant@google.com>
3407
34810851
ILT
3408 * options.h (class General_options): Define --check-sections.
3409 * layout.cc (Layout::set_segment_offsets): Handle
3410 --check-sections.
3411
af6156ef
ILT
3412 * options.h (class General_options): Define -n/--nmagic and
3413 -N/--omagic.
3414 * options.cc (General_options::finalize): For -n/--nmagic or
3415 -N/--omagic, set -static.
3416 * layout.cc (Layout::attach_allocated_section_to_segment): If
3417 -N/--omagic, don't put read-only and read-write sections in
3418 different segments.
3419 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
3420 finding a read-only segment.
3421 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
3422 don't set the minimum segment alignment to the common page size,
3423 and don't set the file offset to the address modulo the page size.
3424 * script-sections.cc (Script_sections::create_segments): If
3425 -n/--omagic, don't put read-only and read-write sections in
3426 different segments.
3427
92de84a6
ILT
3428 * cref.cc: New file.
3429 * cref.h: New file.
3430 * options.h (class General_options): Add --print-symbol-counts.
3431 * main.cc (main): Issue defined symbol report if requested.
3432 * archive.cc (Archive::interpret_header): Make into a const member
3433 function.
3434 (Archive::add_symbols): Call Input_objects::archive_start and
3435 archive_stop.
3436 (Archive::const_iterator): Define new class.
3437 (Archive::begin, Archive::end): New functions.
3438 (Archive::include_all_members): Rewrite to use iterator.
3439 (Archive::count_members): New function.
3440 * archive.h (class Archive): Update declarations.
3441 (Archive::filename): New function.
3442 * object.cc: Include "cref.h".
3443 (Sized_relobj::Sized_relobj): Initialize defined_count_.
3444 (Sized_relobj::do_get_global_symbol_counts): New function.
3445 (Input_objects::add_object): Add object to cross-referencer.
3446 (Input_objects::archive_start): New function.
3447 (Input_objects::archive_stop): New function.
3448 (Input_objects::print_symbol_counts): New function.
3449 * object.h: Declare Cref and Archive.
3450 (Object::get_global_symbol_counts): New function.
3451 (Object::do_get_global_symbol_counts): New pure virtual function.
3452 (class Sized_relobj): Add defined_count_ field. Update
3453 declarations.
3454 (class Input_objects): Add cref_ field. Update constructor.
3455 Update declarations.
3456 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
3457 defined_count_.
3458 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
3459 symbol counts.
3460 (Sized_dynobj::do_get_global_symbol_counts): New function.
3461 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
3462 defined_count_. Update declarations. Define Symbols typedef.
3463 * symtab.cc (Symbol_table::add_from_relobj): Add defined
3464 parameter. Change all callers.
3465 (Symbol_table::add_from_dynobj): Add sympointers and defined
3466 parameters. Change all callers.
3467 * symtab.h (class Symbol_table): Update declarations.
3468 * Makefile.am (CCFILES): Add cref.cc.
3469 (HFILES): Add cref.h.
3470 * Makefile.in: Rebuild.
3471
3f7c5e1d
CD
34722008-07-22 Simon Baldwin <simonb@google.com>
3473
3474 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
3475 to zero when writing undefined symbols.
3476
e0b64032
ILT
34772008-07-22 Ian Lance Taylor <iant@google.com>
3478
3479 * output.cc (Output_section::add_input_section): Don't try to
3480 merge empty merge sections.
3481
096b02cf
CS
34822008-07-21 Craig Silverstein <csilvers@google.com>
3483
3484 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3485 Include symbol version in error message.
cd536b21 3486
1d1f116d
CD
34872008-07-20 Chris Demetriou <cgd@google.com>
3488
cd536b21 3489 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
3490 (RANDOM_SEED_CFLAGS): New substituted variable.
3491 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
3492 * configure: Rebuild.
3493 * Makefile.in: Likewise.
3494 * testsuite/Makefile.in: Likewise.
3495
a18f591e
ILT
34962008-07-18 Ian Lance Taylor <iant@google.com>
3497
3498 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
3499 where we see NAME/NULL and NAME/VERSION as separate symbols.
3500 * testsuite/ver_test_main.cc (main): Call t4.
3501 (t4, t4_2a): Define.
3502 * testsuite/ver_test_2.cc (t4_2): Define.
3503 * testsuite/ver_test_2.script: Put t4_2a in VER2.
3504 * testsuite/ver_test_4.cc (t4_2a): Define.
3505 * testsuite/ver_test_4.script: Put t4_2a in VER2.
3506 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
3507
c6e3f6ed
ILT
35082008-07-17 Ian Lance Taylor <iant@google.com>
3509
3510 * dynobj.cc (Versions::add_def): If we give an error about a
3511 missing version, go ahead and create the version anyhow.
3512
ef9beddf
ILT
35132008-07-10 Ian Lance Taylor <iant@google.com>
3514
3515 Handle output sections with more than 0x7fffffff bytes.
3516 * object.h (class Relobj): Change map_to_output_ to
3517 output_sections_, and just keep a section pointer. Change all
3518 uses. Move comdat group support to Sized_relobj.
3519 (Relobj::is_section_specially_mapped): Remove.
3520 (Relobj::output_section): Remove poff parameter. Change all
3521 callers.
3522 (Relobj::output_section_offset): New function.
3523 (Relobj::set_section_offset): Rewrite.
3524 (Relobj::map_to_output): Remove.
3525 (Relobj::output_sections): New function.
3526 (Relobj::do_output_section_offset): New pure virtual function.
3527 (Relobj::do_set_section_offset): Likewise.
3528 (class Sized_relobj): Add section_offsets_ field. Add comdat
3529 group support from Relobj. Update declarations.
3530 (Sized_relobj::get_output_section_offset): New function.
3531 (Sized_relobj::do_output_section_offset): New function.
3532 (Sized_relobj::do_set_section_offset): New function.
3533 * object.cc (Relobj::output_section_address): Remove.
3534 (Sized_relobj::Sized_relobj): Initialize new fields.
3535 (Sized_relobj::include_section_group): Cast find_kept_object to
3536 Sized_relobj.
3537 (Sized_relobj::include_linkonce_section): Likewise.
3538 (Sized_relobj::do_layout): Use separate arrays for output section
3539 and output offset.
3540 (Sized_relobj::do_count_local_symbols): Change map_to_output to
3541 output_sections.
3542 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
3543 output_sections and section_offsets.
3544 (Sized_relobj::write_local_symbols): Likewise.
3545 (map_to_kept_section): Compute output address directly.
3546 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
3547 output_sections and section_offsets.
3548 (Sized_relobj::write_sections): Likewise.
3549 (Sized_relobj::relocate_sections): Likewise.
3550 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
3551 * output.h (class Output_reloc): Update declarations. Change
3552 u2_.relobj to Sized_relobj*.
3553 (class Output_data_reloc): Change add functions to use
3554 Sized_relobj*.
3555 * output.cc (Output_reloc::Output_reloc): Change relobj to
3556 Sized_relobj*.
3557 (Output_reloc::local_section_offset): Change return type to
3558 Elf_Addr. Use get_output_section_offset.
3559 (Output_reloc::get_address): Likewise.
3560 (Output_section::is_input_address_mapped): Don't call
3561 is_section_specially_mapped.
3562 (Output_section::output_offset): Likewise.
3563 (Output_section::output_address): Likewise.
3564 (Output_section::starting_output_address): Likewise.
3565 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
3566 parameter to Sized_relobj*.
3567 (Copy_relocs::need_copy_reloc): Likewise.
3568 (Copy_relocs::save): Likewise.
3569 * copy-relocs.h (class Copy_relocs): Update declarations.
3570 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
3571 Sized_relobj*. Change relobj_ field to Sized_relobj*.
3572 * target-reloc.h (relocate_for_relocatable): Change
3573 offset_in_output_section type to Elf_Addr. Change code that uses
3574 it as well.
3575 * layout.cc (Layout::layout): Always set *off.
3576 * mapfile.cc (Mapfile::print_input_section): Use
3577 output_section_offset.
3578 * i386.cc (Target_i386::copy_reloc): Change object parameter to
3579 Sized_relobj*.
3580 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
3581 * sparc.cc (Target_sparc::copy_reloc): Likewise.
3582 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
3583
5cb66f97
ILT
35842008-07-03 Ian Lance Taylor <iant@google.com>
3585
3586 * layout.cc (Layout::include_section): Do not discard unrecognized
3587 SHT_STRTAB sections.
3588
afe47622
CS
35892008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
3590
3591 * script.cc (Lex::can_continue_name): Make '?' allowable in
3592 version-script names.
3593 * testsuite/version_script.map: Change glob pattern to use '?'
3594
5adf9721
ILT
35952008-06-30 Manish Singh <yosh@gimp.org>
3596
3597 PR 6585
3598 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
3599 Correct typo.
3600
e6fde208
ILT
36012008-06-30 Ian Lance Taylor <iant@google.com>
3602
3603 PR 6660
3604 PR 6682
3605 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
3606 versions]: Don't try to read the value in the contents, since we
3607 don't use it. Use the template endianness when writing.
3608
3f2e6a2d
CC
36092008-06-25 Cary Coutant <ccoutant@google.com>
3610
3611 * fileread.cc (File_read::make_view): Assert on zero-length view.
3612 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
3613 symbol table when there are no symbols to read.
3614
c43d3a48
CS
36152008-06-23 Craig Silverstein <csilvers@google.com>
3616
3617 * version.cc (version_string): Bump to 1.7
3618
5f494ea0
CS
36192008-06-18 Craig Silverstein <csilvers@google.com>
3620
3621 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
3622 constant 0xFFFF to type Valtype.
3623 (Powerpc_relocate_functions::rel16_ha): Likewise.
3624
c42e122e
ILT
36252008-06-17 Ian Lance Taylor <iant@google.com>
3626
f34787f8
ILT
3627 * output.h (Output_section::Input_section): Initialize p2align_ to
3628 zero for Output_section_data constructors.
3629 (Output_section::Input_section::addralign): If not an input
3630 section, return the alignment of the Output_section_data.
3631 * testsuite/copy_test.cc: New file.
3632 * testsuite/copy_test_1.cc: New file.
3633 * testsuite/copy_test_2.cc: New file.
3634 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
3635 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
3636 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
3637 (copy_test_1_pic.o, copy_test_1.so): New targets.
3638 (copy_test_2_pic.o, copy_test_2.so): New targets.
3639 * testsuite/Makefile.in: Rebuild.
3640
c42e122e
ILT
3641 * script-sections.cc (Script_sections::place_orphan): Initialize
3642 local variable exact.
3643
ce3ac18a
DE
36442008-06-13 David Edelsohn <edelsohn@gnu.org>
3645
3646 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
3647
42cacb20
DE
36482008-06-12 David Edelsohn <edelsohn@gnu.org>
3649 David S. Miller <davem@davemloft.net>
3650
3651 * powerpc.cc: New file.
3652 * Makefile.am (TARGETSOURCES): Add powerpc.cc
3653 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
3654 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
3655 * Makefile.in: Rebuild.
3656
7b308235
ILT
36572008-06-09 Ian Lance Taylor <iant@google.com>
3658
3659 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
3660 <exception>.
3661 (throwing, orig_terminate): New static variables.
3662 (terminate_handler): New static function.
3663 (t2): Set terminate handler.
3664
f0b886e3
ILT
36652008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
3666
3667 PR 6584
cd536b21 3668 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
3669 alignment.
3670
3e90f135
CC
36712008-05-30 Cary Coutant <ccoutant@google.com>
3672
3673 * archive.cc (Archive::include_all_members) Correct to step
3674 over symbol table and extended name table in thin archives.
3675
e09ad04a
ILT
36762008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
3677
3678 PR 6407
3679 * target-reloc.h (relocate_for_relocatable): Fix new_offset
3680 calculation.
3681
62b01cb5
ILT
36822008-05-28 Caleb Howe <cshowe@google.com>
3683
3684 * reduced_debug_output.cc: New file.
3685 * reduced_debug_output.h: New file.
92de84a6 3686 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
3687 * options.cc (General_options::finalize): Add strip_debug_non_line
3688 to the strip heirarchy.
3689 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
3690 fields.
3691 * layout.cc: Include "reduced_debug_output.h".
3692 (Layout::Layout): Initialize new fields.
3693 (line_only_debug_sections): New static array.
3694 (is_lines_only_debug_sections): New static inline function.
3695 (Layout::include_section): Handle --strip-debug-non-line.
3696 (Layout::make_output_section): If --strip-debug-non-line, build
3697 new output sections for .debug_abbrev and .debug_info.
3698 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
3699 gold. Warn about possible overflow.
3700 (read_signed_LEB_128): Likewise.
3701 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
3702 (read_signed_LEB_128): Declare.
3703 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
3704 (HFILES): Add reduced_debug_output.h.
3705 * Makefile.in: Rebuild.
3706
7d9e3d98
ILT
37072008-05-21 Ian Lance Taylor <iant@google.com>
3708
3709 * mapfile.cc: New file.
3710 * mapfile.h: New file.
3711 * options.h (class General_options): Add -M/--print-map and -Map.
3712 * options.cc (General_options::finalize): Make -M equivalent to
3713 -Map -.
3714 * main.cc: Include <cstdio> and "mapfile.h".
3715 (main): Open mapfile if requested.
3716 * gold.cc (class Middle_runner): Add mapfile_ field. Update
3717 constructor. Change caller.
3718 (queue_initial_tasks): Add mapfile parameter. Change caller.
3719 (queue_middle_tasks): Likewise.
3720 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
3721 declarations.
3722 * archive.cc: Include "mapfile.h".
3723 (Archive::add_symbols): Add mapfile parameter. Change all
3724 callers. Pass mapfile, symbol, and reason to include_member.
3725 (Archive::include_all_members): Add mapfile parameter. Change all
3726 callers.
3727 (Archive::include_member): Add mapfile, sym, and why parameters.
3728 Change all callers. Report inclusion to map file.
3729 * archive.h: Include "fileread.h".
3730 (class Archive): Update declarations.
3731 (Archive::file): New const method.
3732 (class Add_archive_symbols): Add mapfile_ field. Update
3733 constructor. Change all callers.
3734 * readsyms.h (class Read_symbols): Likewise.
3735 (class Finish_group): Likewise.
3736 (class Read_script): Likewise.
3737 * common.cc: Include "mapfile.h".
3738 (Symbol_table::allocate_commons): Add mapfile parameter. Change
3739 all callers.
3740 (Symbol_table::do_allocate_commons): Likewise.
3741 (Symbol_table::do_allocate_commons_list): Likewise. Report common
3742 symbol allocation to mapfile.
3743 * common.h (class Allocate_commons_task): Add mapfile_ field.
3744 Update constructor. Change all callers.
3745 * symtab.h (class Symbol_table): Update declarations.
3746 * layout.cc: Include "mapfile.h".
3747 (Layout_task_runner::run): Print information to mapfile.
3748 (Layout::create_gold_note): Change Output_data_fixed_space to
3749 Output_data_zero_fill.
3750 (Layout::create_build_id): Likewise.
3751 (Layout::print_to_mapfile): New function.
3752 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
3753 constructor. Change caller.
3754 (class Layout): Declare print_to_mapfile.
3755 * output.cc (Output_section::Input_section::print_to_mapfile): New
3756 function.
3757 (Output_section::add_input_section): If producing a map, always
3758 add to input_sections_ list.
3759 (Output_section::do_print_to_mapfile): New function.
3760 (Output_segment::print_sections_to_mapfile): New function.
3761 (Output_segment::print_section_list_to_mapfile): New function.
3762 * output.h: Include "mapfile.h".
3763 (Output_data::print_to_mapfile): New function.
3764 (Output_data::do_print_to_mapfile): New virtual function.
3765 (Output_segment_headers::do_print_to_mapfile): New function.
3766 (Output_file_header::do_print_to_mapfile): New function.
3767 (Output_data_const::do_print_to_mapfile): New function.
3768 (class Output_data_const_buffer): Add map_name_ field. Update
3769 constructor. Change all callers. Add do_print_to_mapfile
3770 function.
3771 (class Output_data_fixed_space): Likewise.
3772 (class Output_data_space): Likewise.
3773 (class Output_data_zero_fill): New class.
3774 (Output_data_strtab::do_print_to_mapfile): New function.
3775 (Output_data_reloc_base::do_print_to_mapfile): New function.
3776 (Output_relocatable_relocs::do_print_to_mapfile): New function.
3777 (Output_data_group::do_print_to_mapfile): New function.
3778 (Output_data_got::do_print_to_mapfile): New function.
3779 (Output_data_dynamic::do_print_to_mapfile): New function.
3780 (Output_symtab_xindex::do_print_to_mapfile): New function.
3781 (class Output_section): Declare do_print_to_mapflie. Declare
3782 print_to_mapfile in Input_section.
3783 (class Output_segment): Declare new functions.
3784 * object.h (Sized_relobj::symbol_count): New function.
3785 * script-sections.cc
3786 (Output_section_element_dot_assignment::set_section_addresses):
3787 Change Output_data_fixed_space to Output_data_zero_fill.
3788 (Output_data_expression::do_print_to_mapfile): New function.
3789 * script.cc (read_input_script): Add mapfile parameter. Change
3790 all callers.
3791 * script.h (read_input_script): Update declaration.
3792 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
3793 (Eh_frame::do_print_to_mapfile): New function.
3794 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
3795 (Output_merge_string::do_print_to_mapfile): New function.
3796 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
3797 function.
3798 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
3799 function.
3800 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
3801 function.
3802 * Makefile.am (CCFILES): Add mapfile.cc.
3803 (HFILES): Add mapfile.h.
3804 * Makefile.in: Rebuild.
3805
9f1d377b
ILT
38062008-05-19 Ian Lance Taylor <iant@google.com>
3807
3808 * options.h (class General_options): Add -z relro.
3809 * layout.cc (Layout::Layout): Initialize relro_segment_.
3810 (Layout::add_output_section_data): Return the output section.
3811 (Layout::make_output_section): Rcognize relro sections and mark
3812 them appropriately.
3813 (Layout::attach_allocated_section_to_segment): Put relro sections
3814 in a PT_GNU_RELRO segment.
3815 (Layout::create_initial_dynamic_sections): Mark the .dynamic
3816 section as relro.
3817 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
3818 PT_TLS segments.
3819 (Layout::linkonce_mapping): Map d.rel.ro.local to
3820 .data.rel.ro.local.
3821 (Layout::output_section_name): Us .data.rel.ro.local for any
3822 section which begins with that.
3823 * layout.h (class Layout): Update add_output_section_data
3824 declaration. Add relro_segment_ field.
3825 * output.cc (Output_section::Output_section): Initialize is_relro_
3826 and is_relro_local_ fields.
3827 (Output_segment::add_output_section): Group relro sections.
3828 (Output_segment::is_first_section_relro): New function.
3829 (Output_segment::maximum_alignment): If there is a relro section,
3830 align the segment to the common page size.
3831 (Output_segment::set_section_addresses): Track whether we are
3832 looking at relro sections. If the last section is a relro
3833 section, align to the common page size.
3834 (Output_segment::set_section_list_addresses): Add in_relro
3835 parameter. Change all callers. Align to the page size when
3836 moving from relro to non-relro section.
3837 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
3838 segment.
3839 * output.h (class Output_section): Add is_relro_ and
3840 is_relro_local_ fields.
3841 (Output_section::is_relro): New function.
3842 (Output_section::set_is_relro): New function.
3843 (Output_section::is_relro_local): New function.
3844 (Output_section::set_is_relro_local): New function.
3845 (class Output_segment): Update declarations.
3846 * i386.cc (Target_i386::got_section): Mark .got section as relro.
3847 * sparc.cc (Target_sparc::got_section): Likewise.
3848 * x86_64.cc (Target_x86_64::got_section): Likewise.
3849 * testsuite/relro_test_main.cc: New file.
3850 * testsuite/relro_test.cc: New file.
3851 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
3852 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
3853 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
3854 (relro_test.so, relro_test_pic.o): New targets.
3855 * testsuite/Makefile.in: Rebuild.
3856
a984ee1d
ILT
38572008-05-16 Ian Lance Taylor <iant@google.com>
3858
01676dcd
ILT
3859 * output.cc (Output_segment::add_output_section): Remove front
3860 parameter.
3861 * output.h (class Output_segment): Remove
3862 add_initial_output_section and overloaded add_output_section.
3863 Update declaration of remaining add_output_section.
3864 * layout.cc (Layout::create_interp): Call add_output_section
3865 rather than add_initial_output_section.
3866 (Layout::finish_dynamic_section): Likewise.
3867
497897f9
ILT
3868 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
3869 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
3870 know the dynamic type.
3871 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
3872 field. Initialize it in constructor.
3873 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
3874 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
3875 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
3876 reloc.
3877
a984ee1d
ILT
3878 * output.cc (Output_reloc::get_address): Change return type to
3879 Elf_Addr.
3880 * output.h (class Output_reloc): Update get_address declaration.
3881 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
3882 for section addresses.
3883
55ba0940
ILT
38842008-05-09 Ian Lance Taylor <iant@google.com>
3885
3886 PR 6493
3887 * gold.cc (gold_nomem): Use return value of write.
3888
75517b77
ILT
38892008-05-08 Ian Lance Taylor <iant@google.com>
3890
3891 * symtab.c (Symbol::init_base_output_data): Add version
3892 parameter. Change all callers.
3893 (Symbol::init_base_output_segment): Likewise.
3894 (Symbol::init_base_constant): Likewise.
3895 (Symbol::init_base_undefined): Likewise.
3896 (Sized_symbol::init_output_data): Likewise.
3897 (Sized_symbol::init_output_segment): Likewise.
3898 (Sized_symbol::init_constant): Likewise.
3899 (Sized_symbol::init_undefined): Likewise.
3900 (Symbol_table::do_define_in_output_data): If the new symbol has a
3901 version, mark it as the default.
3902 (Symbol_table::do_define_in_output_segment): Likewise.
3903 (Symbol_table::do_define_as_constant): Likewise.
3904 * symtab.h (class Symbol): Update declarations.
3905 (class Sized_symbol): Likewise.
3906 * resolve.cc (Symbol::override_version): New function.
c42e122e 3907 (Symbol::override_base): Call override_version.
75517b77
ILT
3908 (Symbol::override_base_with_special): Likewise.
3909 * testsuite/ver_script_8.script: New file.
3910 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
3911 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
3912 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
3913 (ver_test_8_1.so, ver_test_8_2.so): New targets.
3914
f1f70eae
ILT
39152008-05-06 Ian Lance Taylor <iant@google.com>
3916
f3e9c5c5
ILT
3917 PR 6049
3918 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
3919 functions.
3920 (class General_options): Remove existing --undefined, and add
3921 --no-undefined instead. Add new --undefined as synonym for -u.
3922 * archive.cc (Archive::add_symbols): Check whether symbol was
3923 named with -u.
3924 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
3925 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
3926 all uses. Add IS_UNDEFINED. Update declarations to split
3927 different versions of init_base. Declare init_base_undefined.
3928 (Symbol::is_defined): Handle IS_UNDEFINED.
3929 (Symbol::is_undefined): Likewise.
3930 (Symbol::is_weak_undefined): Call is_undefined.
3931 (Symbol::is_absolute): Handle IS_CONSTANT.
3932 (class Sized_symbol): Update declarations to split different
3933 versions of init. Declare init_undefined.
3934 (class Symbol_table): Declare new functions.
3935 * symtab.cc (Symbol::init_base_object): Rename from init_base.
3936 Change all callers.
3937 (Symbol::init_base_output_data): Likewise.
3938 (Symbol::init_base_output_segment): Likewise.
3939 (Symbol::init_base_constant): Likewise.
3940 (Symbol::init_base_undefined): New function.
3941 (Sized_symbol::init_object): Rename from init. Change all
3942 callers.
3943 (Sized_symbol::init_output_data): Likewise.
3944 (Sized_symbol::init_output_segment): Likewise.
3945 (Sized_symbol::init_constant): Likewise.
3946 (Sized_symbol::init_undefined): New function.
3947 (Symbol_table::add_undefined_symbols_from_command_line): New
3948 function.
3949 (Symbol_table::do_add_undefined_symbols_from_command_line): New
3950 function.
3951 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
3952 (Symbol::output_section): Likewise.
3953 (Symbol::set_output_section): Likewise.
3954 (Symbol_table::sized_finalize_symbol): Likewise.
3955 (Symbol_table::sized_write_globals): Likewise.
3956 * resolve.cc (Symbol_table::should_override): Likewise.
3957 (Symbol::override_base_with_special): Likewise.
3958
8bdcdf2c
ILT
3959 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
3960 symbol, change it to have default visibility.
3961 * testsuite/protected_1.cc: New file.
3962 * testsuite/protected_2.cc: New file.
3963 * testsuite/protected_3.cc: New file.
3964 * testsuite/protected_main_1.cc: New file.
3965 * testsuite/protected_main_2.cc: New file.
3966 * testsuite/protected_main_3.cc: New file.
3967 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
3968 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
3969 (protected_1_LDFLAGS, protected_1_LDADD): Define.
3970 (protected_1.so): New target.
3971 (protected_1_pic.o, protected_2_pic.o): New targets.
3972 (protected_3_pic.o): New target.
3973 (check_PROGRAMS): Add protected_2.
3974 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
3975 (protected_2_LDFLAGS, protected_2_LDADD): Define.
3976 * testsuite/Makefile.in: Rebuild.
3977
2b706932
ILT
3978 * options.h (DEFINE_var): Add set_user_set_##varname__.
3979 (DEFINE_bool_alias): New macro.
3980 (class General_options): Define -Bstatic using DEFINE_bool_alias
3981 rather than DEFINE_special. Add --undefined as an alias for -z
3982 defs.
3983 * options.cc (General_options::parse_Bstatic): Remove.
3984
d82a5bcc
ILT
3985 * options.h (class General_options): Add --fatal-warnings.
3986 * main.cc (main): Implement --fatal-warnings.
3987 * errors.h (Errors::warning_count): New function.
3988
f1f70eae
ILT
3989 * options.h (class General_options): Add -Bsymbolic-functions.
3990 * symtab.h (Symbol::is_preemptible): Check for
3991 -Bsymbolic-functions.
3992
8825ac63
ILT
39932008-05-05 Ian Lance Taylor <iant@google.com>
3994
d98bc257
ILT
3995 * options.h (DEFINE_bool): For DASH_Z, create the negative option
3996 as noVARNAME rather than no-VARNAME.
3997 (class General_options): Add option -z combreloc.
3998 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
3999 get_address.
4000 (Output_reloc::sort_before) [SHT_REL]: New function.
4001 (Output_reloc::sort_before) [SHT_RELA]: New function.
4002 (class Output_data_reloc_base): Add sort_relocs_ field. Define
4003 Sort_relocs_comparison.
4004 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
4005 parameter. Change all callers.
4006 (Output_data_reloc::Output_data_reloc) [both versions]: Add
4007 sort_relocs parameter. Change all callers.
4008 * output.cc (Output_reloc::get_address): New function, broken out
4009 of write_rel.
4010 (Output_reloc::write_rel): Call it.
4011 (Output_reloc::compare): New function.
4012 (Output_data_reloc_base::do_write): Optionally sort relocs.
4013
60b2b4e7
ILT
4014 * configure.ac: If targ_extra_obj is set, link it in.
4015 * configure.tgt: Initialize all variables.
4016 (x86_64*): Set targ_extra_obj and targ_extra_size.
4017 * configure: Rebuild.
4018
8825ac63
ILT
4019 * object.cc (Sized_relobj::include_section_group): Adjust section
4020 indexes read from group data. Build vector to pass to
4021 layout_group.
4022 * layout.cc (Layout::layout_group): Add flags and shndxes
4023 parameters. Remove contents parameter. Change caller. Update
4024 explicit instantiations.
4025 * layout.h (class Layout): Update layout_group declaration.
4026 * output.cc (Output_data_group::Output_data_group): Add flags and
4027 input_shndxes parameters. Remove contents parameter. Change
4028 caller.
4029 (Output_data_group::do_write): Change input_sections_ to
4030 input_shndxes_.
4031 * output.h (class Output_data_group): Update constructor
4032 declaration. Rename input_sections_ to input_shndxes_.
4033 * testsuite/many_sections_test.cc: Add template.
4034
e94cf127
CC
40352008-04-30 Cary Coutant <ccoutant@google.com>
4036
4418b2d5
CC
4037 * target-reloc.h (relocate_section): Fix dead-pointer bug.
4038
e94cf127
CC
4039 * layout.cc (Layout::include_section): Refactored check for debug
4040 info section.
4041 (Layout::add_comdat): Add new parameters. Change type
4042 of signature parameter. Add object and shndx to signatures table.
4043 (Layout::find_kept_object): New function.
4044 * layout.h: Include <cstring>.
4045 (Layout::is_debug_info_section): New function.
4046 (Layout::add_comdat): Add new parameters.
4047 (Layout::find_kept_object): New function.
4048 (Layout::Kept_section): New struct.
4049 (Layout::Signatures): Change type of map range.
4050 * object.cc (Relobj::output_section_address): New function.
4051 (Sized_relobj::include_section_group): Add new parameters. Change
4052 calls to Layout::add_comdat. Change to build table of kept comdat
4053 groups and table mapping discarded sections to kept sections.
4054 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
4055 (Sized_relobj::do_layout): Change calls to include_section_group and
4056 include_linkonce_section.
4057 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
4058 value to zero when section is discarded.
4059 (Sized_relobj::map_to_kept_section): New function.
4060 * object.h (Relobj::output_section_address): New function.
4061 (Relobj::Comdat_group): New type.
4062 (Relobj::find_comdat_group): New function.
4063 (Relobj::Comdat_group_table): New type.
4064 (Relobj::Kept_comdat_section): New type.
4065 (Relobj::Kept_comdat_section_table): New type.
4066 (Relobj::add_comdat_group): New function.
4067 (Relobj::set_kept_comdat_section): New function.
4068 (Relobj::get_kept_comdat_section): New function.
4069 (Relobj::comdat_groups_): New field.
4070 (Relobj::kept_comdat_sections_): New field.
4071 (Symbol_value::input_value): Update comment.
4072 (Sized_relobj::map_to_kept_section) New function.
4073 (Sized_relobj::include_linkonce_section): Add new parameter.
4074 * target-reloc.h (Comdat_behavior): New type.
4075 (get_comdat_behavior): New function.
4076 (relocate_section): Add code to map a discarded section to the
4077 corresponding kept section when applying a relocation.
4078
e4e5049b
CS
40792008-04-30 Craig Silverstein <csilvers@google.com>
4080
4081 * dwarf_reader.cc (next_generation_count): New static var.
4082 (Addr2line_cache_entry): New struct.
4083 (addr2line_cache): New static var.
4084 (Dwarf_line_info::one_addr2line): Added caching.
4085 (Dwarf_line_info::clear_addr2line_cache): New function.
4086 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
4087 cache-size parameter.
4088 (Dwarf_line_info::one_addr2line_cache): New function.
4089 * symtab.cc (Symbol_table::detect_odr_violations): Pass
4090 new cache-size argument to one_addr2line(), and clear cache.
4091
d09e9154
CC
40922008-04-28 Cary Coutant <ccoutant@google.com>
4093
4094 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
4095 R_386_PC8 relocations.
4096
7ef73768
ILT
40972008-04-23 Ian Lance Taylor <iant@google.com>
4098
55438702
ILT
4099 * object.cc (Sized_relobj::include_section_group): Check for
4100 invalid section group.
4101
c165fb93
ILT
4102 * object.cc (make_elf_object): Correct test for 64-bit ELF file
4103 header size.
4104
7ef73768
ILT
4105 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
4106 than read for file header.
4107 * archive.cc (Archive::include_member): Likewise.
4108
6194aaab
L
41092008-04-23 Paolo Bonzini <bonzini@gnu.org>
4110
4111 * aclocal.m4: Regenerate.
4112 * configure: Regenerate.
4113
d491d34e
ILT
41142008-04-19 Ian Lance Taylor <iant@google.com>
4115
5ea2bac6
ILT
4116 * version.cc (version_string): Bump to 1.6.
4117
7bc3e21a
ILT
4118 * testsuite/Makefile.am (many_sections_r_test): New target.
4119 (many_sections_r_test_SOURCES): Remove.
4120 (many_sections_r_test_DEPENDENCIES): Remove.
4121 (many_sections_r_test_LDFLAGS): Remove.
4122 (many_sections_r_test_LDADD): Remove.
4123
7fcd3aa9
ILT
4124 * object.cc (Sized_relobj::do_add_symbols): Always pass
4125 local_symbol_count_ to add_from_relobj.
4126
4c94d6ae
ILT
4127 * testsuite/Makefile.am (many_sections_check.h): Only check one in
4128 every thousand variables.
4129 * testsuite/Makefile.in: Rebuild.
4130
d491d34e
ILT
4131 * object.cc (Xindex::initialize_symtab_xindex): New function.
4132 (Xindex::read_symtab_xindex): New function.
4133 (Xindex::sym_xindex_to_shndx): New function.
4134 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
4135 available.
4136 (Sized_relobj::do_initialize_xindex): New function.
4137 (Sized_relobj::do_read_symbols): Adjust section links.
4138 (Sized_relobj::symbol_section_and_value): Add is_ordinary
4139 parameter. Change all callers.
4140 (Sized_relobj::include_section_group): Adjust section links and
4141 symbol section indexes.
4142 (Sized_relobj::do_layout): Adjust section links.
4143 (Sized_relobj::do_count_local_symbols): Adjust section links and
4144 symbol section indexes.
4145 (Sized_relobj::do_finalize_local_symbols): Distinguish between
4146 ordinary and special symbols.
4147 (Sized_relobj::write_local_symbols): Add symtab_xindex and
4148 dynsym_xindex parameters. Change all callers. Adjust section
4149 links. Use SHN_XINDEX when needed.
4150 (Sized_relobj::get_symbol_location_info): Adjust section links.
4151 Don't get fooled by special symbols.
4152 * object.h (class Xindex): Define.
4153 (class Object): Add xindex_ parameter. Declare virtual functoin
4154 do_initialize_xindex.
4155 (Object::adjust_sym_shndx): New function.
4156 (Object::set_xindex): New protected function.
4157 (class Symbol_value): Add is_ordinary_shndx_ field.
4158 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
4159 (Symbol_value::value): Assert ordinary section.
4160 (Symbol_value::initialize_input_to_output_map): Likewise.
4161 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
4162 Change all callers.
4163 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
4164 all callers.
4165 (class Sized_relobj): Update declarations.
4166 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
4167 parameter. Change all callers.
4168 (Sized_relobj::adjust_shndx): New function.
4169 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
4170 field.
4171 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
4172 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
4173 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
4174 (Sized_dynobj::read_dynsym_section): Adjust section links.
4175 (Sized_dynobj::read_dynamic): Likewise.
4176 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
4177 section links.
4178 (Sized_dynobj::do_initialize_xindex): New function.
4179 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
4180 do_initialize_xindex.
4181 (Sized_dynobj::adjust_shndx): New function.
4182 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
4183 dynsym_xindex_ fields.
4184 (Layout::finalize): Add a call to set_section_indexes before
4185 creating the symtab sections.
4186 (Layout::set_section_indexes): Don't do anything if the section
4187 already has a section index.
4188 (Layout::create_symtab_sections): Add shnum parameter. Change
4189 caller. Create .symtab_shndx section if needed.
4190 (Layout::create_shdrs): Add shstrtab_section parameter. Change
4191 caller.
4192 (Layout::allocated_output_section_count): New function.
4193 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
4194 needed.
4195 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
4196 fields. Update declarations.
4197 (Layout::symtab_xindex): New function.
4198 (Layout::dynsym_xindex): New function.
4199 (class Write_symbols_task): Add layout_ field.
4200 (Write_symbols_task::Write_symbols_task): Add layout parameter.
4201 Change caller.
4202 * output.cc (Output_section_headers::Output_section_headers): Add
4203 shstrtab_section parameter. Change all callers.
4204 (Output_section_headers::do_sized_write): Store overflow values
4205 for section count and section string table section index in
4206 section header zero.
4207 (Output_file_header::do_sized_write): Check for overflow of
4208 section count and section string table section index.
4209 (Output_symtab_xindex::do_write): New function.
4210 (Output_symtab_xindex::endian_do_write): New function.
4211 * output.h (class Output_section_headers): Add shstrtab_section_.
4212 Update declarations.
4213 (class Output_symtab_xindex): Define.
4214 (Output_section::has_out_shndx): New function.
4215 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
4216 field.
4217 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
4218 Change all callers.
4219 (Sized_symbol::init): Likewise.
4220 (Symbol::output_section): Check for ordinary symbol.
4221 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
4222 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
4223 callers.
4224 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
4225 Change all callers. Simplify handling of symbols from sections
4226 not included in the link.
4227 (Symbol_table::add_from_dynobj): Handle ordinary symbol
4228 distinction.
4229 (Weak_alias_sorter::operator()): Assert that symbols are
4230 ordinary.
4231 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
4232 distinction.
4233 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
4234 parameters. Change all callers.
4235 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
4236 symbol distinction. Use SHN_XINDEX when needed.
4237 (Symbol_table::write_section_symbol): Add symtab_xindex
4238 parameter. Change all callers.
4239 (Symbol_table::sized_write_section_symbol): Likewise. Use
4240 SHN_XINDEX when needed.
4241 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
4242 declarations.
4243 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
4244 (Symbol::is_defined): Check is_ordinary.
4245 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
4246 (Symbol::is_absolute, Symbol::is_common): Likewise.
4247 (class Sized_symbol): Update declarations.
4248 (class Symbol_table): Update declarations.
4249 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
4250 parameters. Change all callers.
4251 (Sized_symbol::override): Likewise.
4252 (Symbol_table::override): Likewise.
4253 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
4254 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
4255 is_ordinary, and orig_st_shndx parameters. Change all callers.
4256 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
4257 to be in an ordinary section.
4258 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
4259 object and is_ordinary parameters. Change all callers.
4260 (Sized_dwarf_line_info::read_relocs): Add object parameter.
4261 Change all callers. Don't add undefined or non-ordinary symbols
4262 to reloc_map_.
4263 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
4264 Change all callers.
4265 * dwarf_reader.h (class Sized_dwarf_line_info): Update
4266 declarations.
4267 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
4268 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
4269 (Sized_relobj::relocate_sections): Likewise.
4270 * target-reloc.h (scan_relocs): Adjust section symbol index.
4271 (scan_relocatable_relocs): Likewise.
4272 * i386.cc (Scan::local): Check for ordinary symbols.
4273 * sparc.cc (Scan::local): Likewise.
4274 * x86_64.cc (Scan::local): Likewise.
4275 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
4276 to symbol_section_and_value.
4277 * testsuite/many_sections_test.cc: New file.
4278 * testsuite/Makefile.am (BUILT_SOURCES): Define.
4279 (check_PROGRAMS): Add many_sections_test.
4280 (many_sections_test_SOURCES): Define.
4281 (many_sections_test_DEPENDENCIES): Define.
4282 (many_sections_test_LDFLAGS): Define.
4283 (BUILT_SOURCES): Add many_sections_define.h.
4284 (many_sections_define.h): New target.
4285 (BUILT_SOURCES): Add many_sections_check.h.
4286 (many_sections_check.h): New target.
4287 (check_PROGRAMS): Add many_sections_r_test.
4288 (many_sections_r_test_SOURCES): Define.
4289 (many_sections_r_test_DEPENDENCIES): Define.
4290 (many_sections_r_test_LDFLAGS): Define.
4291 (many_sections_r_test_LDADD): Define.
4292 (many_sections_r_test.o): New target.
4293 * testsuite/Makefile.in: Rebuild.
4294
c5818ff1
CC
42952008-04-17 Cary Coutant <ccoutant@google.com>
4296
4297 * errors.cc (Errors::info): New function.
4298 (gold_info): New function.
4299 * errors.h (Errors::info): New function.
4300 * gold.h (gold_info): New function.
4301 * object.cc (Input_objects::add_object): Print trace output.
4302 * options.cc (options::parse_set): New function.
4303 (General_options::parse_wrap): Deleted.
4304 (General_options::General_options): Deleted initializer.
4305 * options.h (options::String_set): New typedef.
4306 (options::parse_set): New function.
4307 (DEFINE_set): New macro.
4308 (General_options::wrap): Changed to use DEFINE_set. Changed
4309 callers of any_wrap_symbols and is_wrap_symbol.
4310 (General_options::trace, General_options::trace_symbol):
4311 New options.
4312 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
4313 (General_options::wrap_symbols_): Deleted.
4314 * symtab.cc (Symbol_table::add_from_object): Print trace output.
4315
b5be4a7c
DM
43162008-04-17 David S. Miller <davem@davemloft.net>
4317
4318 * options.cc (General_options::parse_V): New function.
4319 * options.h: Add entries for -V and -Qy.
4320
155a0dd7
ILT
43212008-04-17 Ian Lance Taylor <iant@google.com>
4322
4323 * common.cc (Symbol_table::allocate_commons): Remove options
4324 parameter. Change caller.
4325 (Symbol_table::do_allocate_commons): Remove options parameter.
4326 Change caller. Just call do_allocate_commons_list twice.
4327 (Symbol_table::do_allocate_commons_list): New function, broken out
4328 of do_allocate_commons.
4329 * common.h (class Allocate_commons_task): Remove options_ field.
4330 Update constructor.
4331 * symtab.cc (Symbol_table::Symbol_table): Initialize
4332 tls_commons_.
4333 (Symbol_table::add_from_object): Put TLS common symbols on
4334 tls_commons_ list.
4335 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
4336 which are IN_OUTPUT_DATA.
4337 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
4338 allocate_commons and do_allocate_commons declarations. Declare
4339 do_allocate_commons_list.
4340 * gold.cc (queue_middle_tasks): Update creation of
4341 Allocate_commons_task to not pass options.
4342 * testsuite/Makefile.am (INCLUDES): Add -I.. .
4343 (TLS_TEST_C_FLAGS): New variable.
4344 (tls_test_c_pic.o): New target.
4345 (tls_test_shared.so): Link in tls_test_c_pic.o.
4346 (tls_test_c_pic_ie.o): New target.
4347 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
4348 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
4349 (tls_test_c.o): New target.
4350 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
4351 (tls_pic_test_LDADD): Likewise.
4352 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
4353 (tls_shared_gd_to_ie_test_LDADD): Likewise.
4354 (tls_test_c_gnu2.o): New target.
4355 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
4356 tls_test_c_gnu2.o.
4357 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
4358 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
4359 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
4360 * testsuite/tls_test.cc: Include "config.h".
4361 (t_last): Call t11_last.
4362 * testsuite/tls_test.h (t11, t11_last): Declare.
4363 * testsuite/tls_test_c.c: New file.
4364 * testsuite/tls_test_main.cc (thread_routine): Call t11.
4365 * configure.ac: Check for OpenMP support.
4366 * configure, config.in, Makefile.in: Rebuild.
4367 * testsuite/Makefile.in: Rebuild.
4368
edfbb029
CC
43692008-04-16 Cary Coutant <ccoutant@google.com>
4370
4371 * i386.cc (Target_i386::define_tls_base_symbol): New function.
4372 (Target_i386::tls_base_symbol_defined_): New field.
4373 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4374 (Target_i386::Scan::global): Likewise.
4375 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
4376 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
4377 (Target_x86_64::tls_base_symbol_defined_): New field.
4378 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4379 (Target_x86_64::Scan::global): Likewise.
4380
f3c69fca
CC
43812008-04-16 Cary Coutant <ccoutant@google.com>
4382
4383 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
4384 (Symbol::needs_plt_entry): Allow weak undefined symbols.
4385 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
4386 building shared libraries.
4387 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
4388 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
4389 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
4390 * testsuite/Makefile.in: Rebuild.
4391 * testsuite/weak_undef.h: New file.
4392 * testsuite/weak_undef_file1.cc: Add extra test cases.
4393 * testsuite/weak_undef_file2.cc: Likewise.
4394 * testsuite/weak_undef_test.cc: Likewise.
4395
7c414435
DM
43962008-04-16 David S. Miller <davem@davemloft.net>
4397
32b769e1
DM
4398 * sparc.cc (Target_sparc::Scan): Change from struct to class.
4399 Add issued_non_pic_error_ field. Declare check_non_pic.
4400 (Target_sparc::Scan::check_non_pic): New function.
4401 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
4402 (Target_sparc::Scan::global): Likewise.
4403
11936fb1
DM
4404 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
4405 * configure: Rebuild.
4406
7c414435
DM
4407 * options.h (DEFINE_enable): New macro.
4408 (new_dtags): New enable option.
4409 (initfirst, interpose, loadfltr, nodefaultlib,
4410 nodelete, nodlopen, nodump): New -z options.
4411 * layout.cc (Layout:finish_dynamic_section): If new
4412 dtags enabled, emit DT_RUNPATH. Also, emit a
4413 DT_FLAGS_1 containing any specified -z flags.
4414
85c7bf8b
ILT
44152008-04-16 Ian Lance Taylor <iant@google.com>
4416
12c0daef
ILT
4417 * copy-relocs.cc: New file.
4418 * copy-relocs.h: New file.
4419 * reloc.cc: Remove Copy_relocs code.
4420 * reloc.h: Likewise.
4421 * reloc-types.h (struct Reloc_types) [both versions]: Add
4422 get_reloc_addend_noerror.
4423 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
4424 variants of add_global which take an addend which must be zero.
4425 * i386.cc: Include "copy-relocs.h".
4426 (class Target_i386): Change type of copy_relocs_ to variable,
4427 update initializer.
4428 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
4429 Change all callers.
4430 (Target_i386::do_finalize_sections): Change handling of
4431 copy_relocs_.
4432 * sparc.cc: Include "copy-relocs.h".
4433 (class Target_sparc): Change type of copy_relocs_ to variable,
4434 update initializer.
4435 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
4436 Change all callers.
4437 (Target_sparc::do_finalize_sections): Change handling of
4438 copy_relocs_.
4439 * x86_64.cc: Include "copy-relocs.h".
4440 (class Target_x86_64): Change type of copy_relocs_ to variable,
4441 update initializer.
4442 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
4443 class. Change all callers.
4444 (Target_x86_64::do_finalize_sections): Change handling of
4445 copy_relocs_.
4446 * Makefile.am (CCFILES): Add copy-relocs.cc.
4447 (HFILES): Add copy-relocs.h.
4448
4f4995b6
ILT
4449 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
4450
85c7bf8b
ILT
4451 * testsuite/script_test_4.sh: Permit leading zeroes.
4452
4f2a9edd
ILT
44532008-04-15 Ian Lance Taylor <iant@google.com>
4454
e6188289
ILT
4455 * script-sections.cc (Script_sections::create_segments): Use
4456 header_size_adjustment even when there is enough room for the
4457 headers.
4458 * testsuite/script_test_4.sh: New file.
4459 * testsuite/script_test_4.t: New file.
4460 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
4461 (check_DATA): Add script_test_4.stdout.
4462 (MOSTLYCLEANFILES): Likewise.
4463 (script_test_4): New target.
4464 (script_test_4.stdout): New target.
4465 * testsuite/Makefile.in: Rebuild.
4466
4f2a9edd
ILT
4467 * sparc.cc: Add definitions for Output_data_plt_sparc class
4468 constants.
4469
f5314dd5
DM
44702008-04-14 David S. Miller <davem@davemloft.net>
4471
4472 * sparc.cc: New file.
4473 * Makefile.am (TARGETSOURCES): Add sparc.cc
4474 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
4475 * configure.tgt: Document targ_extra_size and
4476 targ_extra_big_endian. Add entries for sparc-* and
4477 sparc64-*.
4478 * configure.ac: Handle targ_extra_size and
4479 targ_extra_big_endian.
4480 * Makefile.in: Rebuild.
4481 * configure: Likewise.
4482 * po/POTFILES.in: Likewise.
4483 * po/gold.pot: Likewise.
4484
154e0e9a
ILT
44852008-04-14 Ian Lance Taylor <iant@google.com>
4486
4487 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
4488 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
4489 in the name/type/flags to section mapping. Don't call
4490 allocate_output_section.
4491 (Layout::choose_output_section): Change parameter from adjust_name
4492 to is_input_section. Don't permit input sections after sections
4493 are attached to segments. Don't call allocate_output_section.
4494 (Layout::layout_eh_frame): Call update_flags_for_input_section,
4495 not write_enable_output_section.
4496 (Layout::make_output_section): Don't push to
4497 unattached_section_list_ nor call attach_to_segment. Call
4498 attach_section_to_segment if sections are attached.
4499 (Layout::attach_sections_to_segments): New function.
4500 (Layout::attach_section_to_segment): New function.
4501 (Layout::attach_allocated_section_to_segment): Rename from
4502 attach_to_segment. Remove flags parameter.
4503 (Layout::allocate_output_section): Remove function.
4504 (Layout::write_enable_output_section): Remove function.
4505 * layout.h (class Layout): Update for above changes. Add new
4506 field sections_are_attached_.
4507 * output.h (Output_section::update_flags_for_input_section): New
4508 function.
4509 * output.cc (Output_section::add_input_section): Call
4510 update_flags_for_input_section.
4511 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
4512
009a67a2
CC
45132008-04-11 Cary Coutant <ccoutant@google.com>
4514
4515 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
4516 thought unnecessary.
4517 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
4518
759b1a24
ILT
45192008-04-11 Ian Lance Taylor <iant@google.com>
4520
4521 * output.h (class Output_section_data): Remove inline definition
4522 of set_addralign.
4523 * output.cc (Output_section_data::set_addralign): New function.
4524
c2b45e22
CC
45252008-04-11 Cary Coutant <ccoutant@google.com>
4526
4527 Add support for TLS descriptors for i386 and x86_64.
4528 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
4529 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
4530 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
4531 GOT_TYPE_TLS_DESC.
4532 (Target_i386::got_mod_index_entry): Remove unnecessary code.
4533 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
4534 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
4535 relocations.
4536 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
4537 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
4538 Fix problem with initial-exec relocations.
4539 (Target_i386::Relocate::relocate_tls): Likewise.
4540 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
4541 relaxation.
4542 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
4543 support for section-plus-offset dynamic table entries.
4544 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
4545 (Output_data_dynamic::Dynamic_entry): Add support for
4546 section-plus-offset dynamic table entries.
4547 (Output_data_dynamic::Classification): Likewise.
4548 (Output_data_dynamic::classification_): Renamed offset_.
4549 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
4550 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
4551 (Target_x86_64::make_plt_section): New function.
4552 (Target_x86_64::reserve_tlsdesc_entries): New function.
4553 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
4554 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
4555 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
4556 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
4557 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
4558 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
4559 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
4560 add extra PLT entry for TLS descriptors.
4561 (Output_data_plt_x86_64::got_): New field.
4562 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
4563 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
4564 fields.
4565 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
4566 descriptors.
4567 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
4568 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
4569 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
4570 R_386_TLS_DESC_CALL relocations.
4571 (Target_x86_64::Scan::global): Likewise.
4572 (Target_x86_64::do_finalize_sections): Add dynamic table entries
4573 for TLS descriptors.
4574 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
4575 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
4576 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
4577 GD-to-IE relaxation.
4578 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
4579 and TLS_DESCRIPTORS.
4580 * Makefile.in: Rebuild.
4581 * configure: Rebuild.
4582 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
4583 (tls_test_shared2.so): New target.
4584 (tls_shared_gd_to_ie_test_SOURCES): New variable.
4585 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
4586 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
4587 (tls_shared_gd_to_ie_test_LDADD): New variable.
4588 (tls_shared_gnu2_gd_to_ie_test): New target.
4589 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
4590 New targets.
4591 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
4592 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
4593 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
4594 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
4595 (tls_shared_gnu2_test): New target.
4596 (tls_test_gnu2_shared.so): New target.
4597 (tls_shared_gnu2_test_SOURCES): New variable.
4598 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
4599 (tls_shared_gnu2_test_LDFLAGS): New variable.
4600 (tls_shared_gnu2_test_LDADD): New variable.
4601 * testsuite/Makefile.in: Rebuild.
4602 * testsuite/Makefile.
4603
83bfb6b7
ILT
46042008-04-11 Ian Lance Taylor <iant@google.com>
4605
4606 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
4607 justsyms.t.
4608 * testsuite/Makefile.in: Rebuild.
4609
4610 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
4611 long.
4612 * testsuite/script_test_2.cc (main): Adjust test.
4613
706e1f5e
ILT
46142008-04-11 David S. Miller <davem@davemloft.net>
4615 Ian Lance Taylor <iant@google.com>
4616
4617 * options.h (General_options): Add entries for '-Y' and
4618 '-relax'.
4619 * options.cc (General_options:finalize): If -Y was used, add those
4620 entries to the library path instead of the default "/lib" and
4621 "/usr/lib".
4622
7c98e6bb
DM
46232008-04-11 David S. Miller <davem@davemloft.net>
4624
4625 * testsuite/justsyms.t: Start at 0x100.
4626 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
4627 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
4628 long.
4629 * testsuite/script_test_2.cc: Adjust string and section length
4630 checks.
7c98e6bb 4631
99a37bfd
ILT
46322008-04-09 Ian Lance Taylor <iant@google.com>
4633
2cefc357
ILT
4634 PR gold/5996
4635 * script-sections.cc (Sections_element::allocate_to_segment): Add
4636 orphan parameter.
4637 (Output_section_definition::allocate_to_segment): Likewise.
4638 (Orphan_output_section::allocate_to_segment): Likewise.
4639 (Script_sections::attach_sections_using_phdrs_clause): Don't
4640 propagate non-PT_LOAD segments to orphan sections.
4641 * testsuite/Makefile.am (script_test_3.stdout): Generate using
4642 readelf rather than objdump.
4643 * testsuite/script_test_3.sh: Adjust accordingly. Test that
4644 .interp section and PT_INTERP segment are the same size.
4645 * testsuite/Makefile.in: Rebuild.
4646
99a37bfd
ILT
4647 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
4648 aliases for symbols defined in the same object.
4649 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
4650 (weak_alias_test_SOURCES): New variable.
4651 (weak_alias_test_DEPENDENCIES): New variable.
4652 (weak_alias_test_LDFLAGS): New variable.
4653 (weak_alias_test_LDADD): New variable.
4654 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
4655 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
4656 (weak_alias_test_3.o): New target.
4657 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
4658 * testsuite/weak_alias_test_main.cc: New file.
4659 * testsuite/weak_alias_test_1.cc: New file.
4660 * testsuite/weak_alias_test_2.cc: New file.
4661 * testsuite/weak_alias_test_3.cc: New file.
4662
780e49c5
ILT
46632008-04-08 Ian Lance Taylor <iant@google.com>
4664
cdb0b8f5
ILT
4665 * options.h (class General_options): Add --noinhibit-exec option.
4666 * main.cc (main): Check --noinhibit-exec.
4667
0864d551
ILT
4668 * options.h (class General_options): Define --wrap as a special
4669 option. Add wrap_symbols_ field.
4670 (General_options::any_wrap_symbols): New function.
4671 (General_options::is_wrap_symbol): New function.
4672 * options.cc (General_options::parse_wrap): New function.
4673 (General_options::General_options): Initialize wrap_symbols_.
4674 * symtab.cc (Symbol_table::wrap_symbol): New function.
4675 (Symbol_table::add_from_object): Handle --wrap.
4676 * symtab.h (class Symbol_table): Declare wrap_symbol.
4677 * target.h (Target::wrap_char): New function.
4678 (Target::Target_info): Add wrap_char field.
4679 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
4680 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4681 * testsuite/testfile.cc (Target_test::test_target_info):
4682 Likewise.
4683
789aa6de
ILT
4684 * errors.cc (Errors::undefined_symbol): Mention symbol version if
4685 there is one.
4686
2c38906f
ILT
4687 * layout.h (class Layout): Add added_eh_frame_data_ field.
4688 * layout.cc (Layout::Layout): Initialize new field.
4689 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
4690 output section until we find a section we merged successfully.
4691 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
4692 that the size be non-zero.
4693
780e49c5
ILT
4694 * merge.cc (Object_merge_map::get_output_offset): Remove inline
4695 qualifier.
4696
7fcd0256
ILT
46972008-04-08 Craig Silverstein <csilvers@google.com>
4698
4699 * configure.ac: Export new conditional variable HAVE_ZLIB.
4700 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
4701 on HAVE_ZLIB.
4702 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
4703 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4704
6835af53
ILT
47052008-04-07 Ian Lance Taylor <iant@google.com>
4706
e24f324c
ILT
4707 * version.cc (version_string): Set to "1.5".
4708
a036edd8
ILT
4709 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
4710 Add issued_non_pic_error_ field. Declare check_non_pic.
4711 (Target_x86_64::Scan::check_non_pic): New function.
4712 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
4713 (Target_x86_64::Scan::global): Likewise.
4714
624f8810
ILT
4715 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
4716 addend parameter. Change caller. Handle merge sections.
4717 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
4718 Address to Addend. Don't add in the result of
4719 local_section_offset, pass down the addend and use the returned
4720 value.
4721 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
4722 Update declarations of local_section_offset and symbol_value.
4723 * testsuite/two_file_test_1.cc (t18): New function.
4724 * testsuite/two_file_test_2.cc (f18): New function.
4725 * testsuite/two_file_test_main.cc (main): Call t18.
4726 * testsuite/two_file_test.h (t18, f18): Declare.
4727
6835af53
ILT
4728 * configure.ac: Don't test for objdump, c++filt, or readelf.
4729 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
4730 conditionals.
4731 (TEST_READELF): New variable.
4732 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
4733 (check_PROGRAMS): Add two_file_strip_test.
4734 (two_file_strip_test): New target.
4735 (check_PROGRAMS): Add two_file_same_shared_strip_test.
4736 (two_file_same_shared_strip_test_SOURCES): New variable.
4737 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
4738 (two_file_same_shared_strip_test_LDFLAGS): New variable.
4739 (two_file_same_shared_strip_test_LDADD): New variable.
4740 (two_file_shared_strip.so): New target.
4741 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
4742 (ver_test_5.syms, ver_test_7.syms): Likewise.
4743 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
4744 (strip_test_3.stdout): Use TEST_OBJDUMP.
4745 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4746
86925eef
CC
47472008-04-04 Cary Coutant <ccoutant@google.com>
4748
4749 * symtab.h (Symbol::is_weak_undefined): New function.
4750 (Symbol::is_strong_undefined): New function.
4751 (Symbol::is_absolute): New function.
4752 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
4753 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
4754 absolute symbols.
4755 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
4756 (weak_undef_test): New target.
4757 * testsuite/Makefile.in: Rebuild.
4758 * testsuite/weak_undef_file1.cc: New file.
4759 * testsuite/weak_undef_file2.cc: New file.
4760 * testsuite/weak_undef_test.cc: New file.
4761
126f3ece
ILT
47622008-04-03 Craig Silverstein <csilvers@google.com>
4763
4764 * compressed_output.h (class Output_compressed_section): Use
4765 unsigned buffer.
4766 * compressed_output.cc (zlib_compress): Use unsigned buffers,
4767 add zlib header.
4768 (zlib_compressed_suffix): Removed.
4769 (Output_compressed_section::set_final_data_size): Use unsigned
4770 buffers.
4771 * testsuite/Makefile.am (flagstest_compress_debug_sections):
4772 Fix linker invocation.
4773 (flagstest_o_specialfile_and_compress_debug_sections):
4774 Likewise.
4775 * testsuite/Makefile.in: Regenerated.
4776
deae2a14
DM
47772008-04-02 David S. Miller <davem@davemloft.net>
4778
4779 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
4780 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
4781
70752818
ILT
47822008-04-02 Craig Silverstein <csilvers@google.com>
4783
4784 * TODO: New file.
4785
39d0cb0e
ILT
47862008-04-02 Ian Lance Taylor <iant@google.com>
4787
4788 * fileread.cc (File_read::find_view): Add byteshift and vshifted
4789 parameters. Update for new key type to views_. Change all
4790 callers.
4791 (File_read::read): Adjust for byteshift in returned view.
4792 (File_read::add_view): New function, broken out of
4793 find_and_make_view.
4794 (File_read::make_view): New function, broken out of
4795 find_and_make_view.
4796 (File_read::find_or_make_view): Add offset and aligned
4797 parameters. Rewrite accordingly. Change all callers.
4798 (File_read::get_view): Add offset and aligned parameters. Adjust
4799 for byteshift in return value.
4800 (File_read::get_lasting_view): Likewise.
4801 * fileread.h (class File_read): Update declarations.
4802 (class File_read::View): Add byteshift_ field. Add byteshift to
4803 constructor. Add byteshift method.
4804 * archive.h (Archive::clear_uncached_views): New function.
4805 (Archive::get_view): Add aligned parameter. Change all callers.
4806 * object.h (Object::get_view): Add aligned parameter. Change all
4807 callers.
4808 (Object::get_lasting_view): Likewise.
4809
4810 * fileread.cc (File_read::release): Don't call clear_views if
4811 there are multiple objects.
4812 * fileread.h (File_read::clear_uncached_views): New function.
4813 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
4814 on the archive.
4815
a1207466
CC
48162008-03-31 Cary Coutant <ccoutant@google.com>
4817
4818 Add thin archive support.
4819 * archive.cc (Archive::armagt): New const.
4820 (Archive::setup): Remove task parameter and calls to unlock.
4821 (Archive::unlock_nested_archives): New function.
4822 (Archive::read_header): Add nested_off parameter. Change
4823 all callers.
4824 (Archive::interpret_header): Likewise.
4825 (Archive::include_all_members): Change to handle thin
4826 archives.
4827 (Archive::include_member): Likewise.
4828 * archive.h (Archive::Archive): Add new parameters and
4829 initializers.
4830 (Archive::armagt): New const.
4831 (Archive::setup): Remove task parameter.
4832 (Archive::unlock_nested_archives): New function.
4833 (Archive::read_header): Add nested_off parameter.
4834 (Archive::interpret_header): Likewise.
4835 (Archive::Nested_archive_table): New typedef.
4836 (Archive::is_thin_archive_): New field.
4837 (Archive::nested_archives_): New field.
4838 (Archive::options_): New field.
4839 (Archive::dirpath_): New field.
4840 (Archive::task_): New field.
4841 * readsyms.cc (Read_symbols::do_read_symbols): Add check
4842 for thin archives. Pass additional parameters to
4843 Archive::Archive. Unlock the archive file after calling
4844 Archive::setup.
cd536b21 4845
479f6503
ILT
48462008-03-29 Ian Lance Taylor <iant@google.com>
4847
686c8caf
ILT
4848 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
4849 version symbol to be local.
4850 * testsuite/ver_test_4.sh: New file.
4851 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
4852 (check_DATA): Add ver_test_4.syms.
4853 (ver_test_4.syms): New target.
4854 * testsuite/Makefile.in: Rebuild.
4855
ab794b6b
ILT
4856 * output.cc
4857 (Output_section::Input_section_sort_entry::has_priority): New
4858 function.
4859 (Output_section::Input_section_sort_entry::match_file_name): New
4860 function.
4861 (Output_section::Input_section_sort_entry::match_section_name):
4862 Remove.
4863 (Output_section::Input_section_sort_entry::match_section_name_prefix):
4864 Remove.
4865 (Output_section::Input_section_sort_entry::match_section_file):
4866 Remove.
4867 (Output_section::Input_section_sort_compare::operator()): Rewrite
4868 using new Input_section_sort_entry functions. Sort crtbegin and
4869 crtend first. Sort sections with no priority before sections with
4870 a priority.
4871 * testsuite/initpri1.c (d3): Check j != 4.
4872 (cd5): New constructor/destructor function.
4873 (main): Check j != 2.
4874
479f6503
ILT
4875 * symtab.cc (Symbol_table::add_from_object): If we don't use the
4876 new symbol when resolving, don't call set_is_default.
4877 * testsuite/ver_test_7.cc: New file.
4878 * testsuite/ver_test_7.sh: New file.
4879 * testsuite/Makefile.am (ver_test_7.so): New target.
4880 (ver_test_7.o): New target.
4881 (check_SCRIPTS): Add ver_test_7.sh.
4882 (check_DATA): Add ver_test_7.syms.
4883 (ver_test_7.syms): New target.
4884
2fd32231
ILT
48852008-03-28 Ian Lance Taylor <iant@google.com>
4886
4887 * layout.cc (Layout::layout): If we see an input section with a
4888 name that needs sorting, set the must_sort flag for the output
4889 section.
4890 (Layout::make_output_section): If the name of the output section
4891 indicates that it might require sorting, set the may_sort flag.
4892 * output.h (Output_section::may_sort_attached_input_sections): New
4893 function.
4894 (Output_section::set_may_sort_attached_input_sections): New
4895 function.
4896 (Output_section::must_sort_attached_input_sections): New
4897 function.
4898 (Output_section::set_must_sort_attached_input_sections): New
4899 function.
4900 (class Output_section): Declare Input_section_sort_entry. Define
4901 Input_section_sort_compare. Declare
4902 sort_attached_input_sections. Add new fields:
4903 may_sort_attached_input_sections_,
4904 must_sort_attached_input_sections_,
4905 attached_input_sections_are_sorted_.
4906 * output.cc (Output_section::Output_section): Initialize new
4907 fields.
4908 (Output_section::add_input_section): Add an entry to
4909 input_sections_ if may_sort or must_sort are true.
4910 (Output_section::set_final_data_size): Call
4911 sort_attached_input_sections if necessary.
4912 (Output_section::Input_section_sort_entry): Define new class.
4913 (Output_section::Input_section_sort_compare::operator()): New
4914 function.
4915 (Output_section::sort_attached_input_sections): New function.
4916 * configure.ac: Check whether the compiler supports constructor
4917 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
4918 * testsuite/initpri1.c: New file.
4919 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
4920 CONSTRUCTOR_PRIORITY.
4921 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
4922 (initpri1_LDFLAGS): New variable.
4923 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4924
18e6b24e
ILT
49252008-03-27 Ian Lance Taylor <iant@google.com>
4926
49bdd526
ILT
4927 * common.cc (Sort_commons::operator): Correct sorting algorithm.
4928 * testsuite/common_test_1.c: New file.
4929 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
4930 (common_test_1_SOURCES): New variable.
4931 (common_test_1_DEPENDENCIES): New variable.
4932 (common_test_1_LDFLAGS): New variable.
4933
18e6b24e
ILT
4934 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
4935 and commons_ correctly when NAME/VERSION does not override
4936 NAME/NULL.
4937 * testsuite/ver_test_6.c: New file.
4938 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
4939 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
4940 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
4941
04bf7072
ILT
49422008-03-26 Ian Lance Taylor <iant@google.com>
4943
5871526f
ILT
4944 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
4945 of an undefined symbol from a version script.
4946 * testsuite/Makefile.am (ver_test_5.so): New target.
4947 (ver_test_5.o): New target.
4948 (check_SCRIPTS): Add ver_test_5.sh.
4949 (check_DATA): Add ver_test_5.syms.
4950 (ver_test_5.syms): New target.
4951 * testsuite/ver_test_5.cc: New file.
4952 * testsuite/ver_test_5.script: New file.
4953 * testsuite/ver_test_5.sh: New file.
4954 * Makefile.in, testsuite/Makefile.in: Rebuild.
4955
04bf7072
ILT
4956 PR gold/5986
4957 Fix problems building gold with gcc 4.3.0.
4958 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
4959 (gold_error_at_location, gold_warning_at_location): Use it.
4960 * configure.ac: Check whether we can compile and use a template
4961 function with a printf attribute.
4962 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
4963 when jumping over bytes.
4964 * object.cc: Instantiate Object::read_section_data.
4965 * debug.h: Include <cstring>
4966 * dwarf_reader.cc: Include <algorithm>
4967 * main.cc: Include <cstring>.
4968 * options.cc: Include <cstring>.
4969 * output.cc: Include <cstring>.
4970 * script.cc: Include <cstring>.
4971 * script.h: Include <string>.
4972 * symtab.cc: Include <cstring> and <algorithm>.
4973 * target-select.cc: Include <cstring>.
4974 * version.cc: Include <string>.
4975 * testsuite/testmain.cc: Include <cstdlib>.
4976 * configure, config.in: Rebuild.
4977
874c5b28
ILT
49782008-03-25 Ian Lance Taylor <iant@google.com>
4979
819d6c3a
ILT
4980 * options.cc: Include "../bfd/bfdver.h".
4981 (options::help): Print bug reporting address.
4982
f4b2c6f5
ILT
4983 * version.cc (print_version): Adjust output for current value of
4984 BFD_VERSION_STRING.
4985
4986 * NEWS: New file.
4987
e96caa79
ILT
4988 * options.cc (options::help): Print list of supported targets.
4989 * target-select.h: Include <vector>.
4990 (class Target_selector): Make machine_, size_, and is_big_endian_
4991 fields const. Add bfd_name_ and instantiated_target_ fields.
4992 (Target_selector::Target_selector): Add bfd_name parameter.
4993 (Target_selector::recognize): Make non-virtual, call
4994 do_recognize.
4995 (Target_selector::recognize_by_name): Make non-virtual, call
4996 do_recognize_by_name.
4997 (Target_selector::supported_names): New function.
4998 (Target_selector::bfd_name): New function.
4999 (Target_selector::do_instantiate_target): New pure virtual
5000 function.
5001 (Target_selector::do_recognize): New virtual function.
5002 (Target_selector::do_recognize_by_name): New virtual function.
5003 (Target_selector::instantiate_target): New private function.
5004 (supported_target_names): Declare.
5005 * target-select.cc (Target_selector::Target_selector): Update for
5006 new parameter and fields.
5007 (select_target_by_name): Check that the name matches before
5008 calling recognize_by_name.
5009 (supported_target_names): New function.
5010 * i386.cc (class Target_selector_i386): Update Target_selector
5011 constructor call. Remove recognize and recognize_by_name. Add
5012 do_instantiate_target.
5013 * x86_64.cc (class Target_selector_x86_64): Likewise.
5014 * testsuite/testfile.cc (class Target_selector_test): Update for
5015 changes to Target_selector.
5016
874c5b28
ILT
5017 * README: Rewrite, with some notes on unsupported features.
5018
0a65a3a7
CC
50192008-03-24 Cary Coutant <ccoutant@google.com>
5020
5021 * i386.cc (Target_i386::Got_type): New enum declaration.
5022 (Target_i386::Scan::local): Updated callers of Output_data_got
5023 member functions.
5024 (Target_i386::Scan::global): Likewise.
5025 (Target_i386::Relocate::relocate): Likewise.
5026 (Target_i386::Relocate::relocate_tls): Likewise.
5027 * object.h (Got_offset_list): New class.
5028 (Sized_relobj::local_has_got_offset): Added got_type parameter.
5029 (Sized_relobj::local_got_offset): Likewise.
5030 (Sized_relobj::set_local_got_offset): Likewise.
5031 (Sized_relobj::local_has_tls_got_offset): Removed.
5032 (Sized_relobj::local_tls_got_offset): Removed.
5033 (Sized_relobj::set_local_tls_got_offset): Removed.
5034 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
5035 * output.cc (Output_data_got::add_global): Added got_type parameter.
5036 (Output_data_got::add_global_with_rel): Likewise.
5037 (Output_data_got::add_global_with_rela): Likewise.
5038 (Output_data_got::add_global_pair_with_rel): New function.
5039 (Output_data_got::add_global_pair_with_rela): New function.
5040 (Output_data_got::add_local): Added got_type parameter.
5041 (Output_data_got::add_local_with_rel): Likewise.
5042 (Output_data_got::add_local_with_rela): Likewise.
5043 (Output_data_got::add_local_pair_with_rel): New function.
5044 (Output_data_got::add_local_pair_with_rela): New function.
5045 (Output_data_got::add_global_tls): Removed.
5046 (Output_data_got::add_global_tls_with_rel): Removed.
5047 (Output_data_got::add_global_tls_with_rela): Removed.
5048 (Output_data_got::add_local_tls): Removed.
5049 (Output_data_got::add_local_tls_with_rel): Removed.
5050 (Output_data_got::add_local_tls_with_rela): Removed.
5051 * output.h (Output_data_got::add_global): Added got_type parameter.
5052 (Output_data_got::add_global_with_rel): Likewise.
5053 (Output_data_got::add_global_with_rela): Likewise.
5054 (Output_data_got::add_global_pair_with_rel): New function.
5055 (Output_data_got::add_global_pair_with_rela): New function.
5056 (Output_data_got::add_local): Added got_type parameter.
5057 (Output_data_got::add_local_with_rel): Likewise.
5058 (Output_data_got::add_local_with_rela): Likewise.
5059 (Output_data_got::add_local_pair_with_rel): New function.
5060 (Output_data_got::add_local_pair_with_rela): New function.
5061 (Output_data_got::add_global_tls): Removed.
5062 (Output_data_got::add_global_tls_with_rel): Removed.
5063 (Output_data_got::add_global_tls_with_rela): Removed.
5064 (Output_data_got::add_local_tls): Removed.
5065 (Output_data_got::add_local_tls_with_rel): Removed.
5066 (Output_data_got::add_local_tls_with_rela): Removed.
5067 * resolve.cc (Symbol::override_base_with_special): Removed
5068 reference to has_got_offset_ field.
5069 * symtab.cc (Symbol::init_fields): Replaced initialization
5070 of got_offset_ with got_offsets_. Removed initialization
5071 of has_got_offset_
53fcba31 5072 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
5073 (Symbol::got_offset): Likewise.
5074 (Symbol::set_got_offset): Likewise.
5075 (Symbol::has_tls_got_offset): Removed.
5076 (Symbol::tls_got_offset): Removed.
5077 (Symbol::set_tls_got_offset): Removed.
5078 (Symbol::got_offset_): Removed.
5079 (Symbol::tls_mod_got_offset_): Removed.
5080 (Symbol::tls_pair_got_offset_): Removed.
5081 (Symbol::got_offsets_): New field.
5082 (Symbol::has_got_offset): Removed.
5083 (Symbol::has_tls_mod_got_offset): Removed.
5084 (Symbol::has_tls_pair_got_offset): Removed.
5085 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
5086 (Target_x86_64::Scan::local): Updated callers of Output_data_got
5087 member functions.
5088 (Target_x86_64::Scan::global): Likewise.
5089 (Target_x86_64::Relocate::relocate): Likewise.
5090 (Target_x86_64::Relocate::relocate_tls): Likewise.
5091
bd52eafb
BE
50922008-03-25 Ben Elliston <bje@au.ibm.com>
5093
5094 * yyscript.y: Fix spelling error in comment.
5095
8b105e34
ILT
50962008-03-24 Ian Lance Taylor <iant@google.com>
5097
8ed814a9
ILT
5098 * options.h (class General_options): Define build_id option.
5099 * layout.h (class Layout): Declare write_build_id, create_note,
5100 create_build_id. Add build_id_note_ member.
5101 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
5102 "libiberty.h", "md5.h", "sha1.h".
5103 (Layout::Layout): Initialize eh_frame_data_,
5104 eh_frame_hdr_section_, and build_id_note_.
5105 (Layout::finalize): Call create_build_id.
5106 (Layout::create_note): New function, broken out of
5107 Layout::create_gold_note.
5108 (Layout::create_gold_note): Call create_note.
5109 (Layout::create_build_id): New function.
5110 (Layout::write_build_id): New function.
5111 (Close_task_runner::run): Call write_build_id.
5112
8b105e34
ILT
5113 * x86_64.cc: Correct license to GPLv3.
5114
086a1841
ILT
51152008-03-23 Ian Lance Taylor <iant@google.com>
5116
5117 * options.cc: Include "demangle.h".
5118 (parse_optional_string): New function.
5119 (parse_long_option): Handle takes_optional_argument.
5120 (parse_short_option): Update dash_z initializer. Handle
5121 takes_optional_argument.
5122 (General_options::General_options): Initialize do_demangle_.
5123 (General_options::finalize): Set do_demangle_. Handle demangling
5124 style.
5125 * options.h (parse_optional_string): Declare.
5126 (struct One_option): Add optional_arg field. Update constructor.
5127 Update call constructor calls. Add takes_optional_argument
5128 function.
5129 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
5130 (DEFINE_optional_string): Define.
5131 (General_options::demangle): Change from DEFINE_bool to
5132 DEFINE_optional_string.
5133 (General_options::no_demangle): New function.
5134 (General_options::do_demangle): New function.
5135 (General_options::set_do_demangle): New function.
5136 (General_options::execstack_status_): Move definition to end of
5137 class definition.
5138 (General_options::static_): Likewise.
5139 (General_options::do_demangle_): New field.
5140 * object.cc (big_endian>::get_symbol_location_info): Call
5141 Options::do_demangle, not Options::demangle.
5142 * symtab.cc (demangle): Likewise.
5143
cbb93e63
ILT
51442008-03-22 Ian Lance Taylor <iant@google.com>
5145
5146 * gold.h: Include <cstddef> and <sys/types.h>
5147 * options.h: Include <cstring>.
5148
ec531623
ILT
51492008-03-21 Ian Lance Taylor <iant@google.com>
5150
5151 * Added source code to GNU binutils.
This page took 0.335361 seconds and 4 git commands to generate.