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