692ebc231e9808f1885d43cf3a708644082f31bd
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-12-14 Cary Coutant <ccoutant@google.com>
2
3 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
4 (Dwp_output_file::Dwp_index::enter_set): Add assert.
5
6 2012-12-12 Alan Modra <amodra@gmail.com>
7
8 * powerpc.cc (class Track_tls): New.
9 (class Relocate, class Scan): Inherit Track_tls.
10 (Target_powerpc::Scan::local, global): Track tls optimization
11 and avoid creating plt entry for __tls_get_addr if all uses
12 are optimized away.
13 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
14
15 2012-12-12 Alan Modra <amodra@gmail.com>
16
17 * options.h (General_options): Add --toc-sort/--no-toc-sort.
18 Replace no_toc_optimize with toc_optimize.
19 * output.h (Output_section::input_sections): Provide non-const variant.
20 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
21 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
22 accessors.
23 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
24 (class Sort_toc_sections): New.
25 (Target_powerpc::do_finalize_sections): Sort toc sections.
26 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
27
28 2012-12-10 Roland McGrath <mcgrathr@google.com>
29
30 * testsuite/binary_unittest.cc (read_all): New function.
31 (Sized_binary_test): Use it instead of ::read.
32 * fileread.cc (do_read): Don't assume pread always reads the whole
33 amount in a single call.
34
35 2012-12-10 Alan Modra <amodra@gmail.com>
36
37 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
38 Set EM_PPC64 or EM_PPC here.
39 (Target_selector_powerpc::do_recognize): Delete.
40
41 2012-12-10 Alan Modra <amodra@gmail.com>
42
43 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
44 stub_table_.
45 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
46
47 2012-12-07 Roland McGrath <mcgrathr@google.com>
48
49 * testsuite/binary_unittest.cc (Sized_binary_test):
50 Use open_descriptor rather than ::open.
51
52 2012-12-07 Alan Modra <amodra@gmail.com>
53
54 * powerpc.cc (Stub_table::do_write): Delete redundant Address
55 typedef and invalid_address constant.
56 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
57 instantiate constants.
58
59 2012-12-06 Roland McGrath <mcgrathr@google.com>
60
61 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
62 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
63 * aclocal.m4: Regenerate.
64 * configure: Regenerate.
65 * Makefile.in: Regenerate.
66 * testsuite/Makefile.in: Regenerate.
67
68 2012-12-07 Alan Modra <amodra@gmail.com>
69
70 * options.h (General_options): Add no_toc_optimize.
71 * powerpc.cc (ok_lo_toc_insn): New function.
72 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
73
74 2012-12-06 Alan Modra <amodra@gmail.com>
75
76 * options.h (General_options): Add plt_align, plt_static_chain,
77 plt_thread_safe. Update stub_group_size help text.
78 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
79 for new plt_thread_safe_ var.
80 (use_plt_offset): Correct comments.
81 (Target_powerpc::do_relax): Look for thread creation symbols to
82 determine default plt_thread_safe value. Clear plt call stubs
83 as well as branch stubs each iteration.
84 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
85 insn constants.
86 (l, hi, ha, write_insn): Move earlier.
87 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
88 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
89 plt stubs too.
90 (Stub_table::update_size): Adjust.
91 (Stub_table::prev_size, set_prev_size): Delete.
92 (Stub_table::stub_align): Let --plt-align affect result.
93 (Stub_table::plt_call_size): Calculate sizes for various stubs.
94 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
95 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
96 (Stub_table::do_write): Support more stub variants.
97
98 2012-12-04 Alan Modra <amodra@gmail.com>
99
100 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
101 (Target_powerpc::do_define_standard_symbols): New function.
102
103 2012-12-03 Alan Modra <amodra@gmail.com>
104
105 * output.h: Formatting, whitespace.
106
107 2012-12-03 Alan Modra <amodra@gmail.com>
108
109 * layout.h (Layout::get_executable_sections): Declare.
110 * layout.cc (Layout::get_executable_sections): New function.
111 * arm.cc (Target_arm::group_sections): Use it.
112 (Arm_output_section::group_sections): Delete now redundant test.
113 * output.cc (Output_reloc::Output_reloc): Add is_relative.
114 param to handle relative relocs.
115 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
116 (Output_data_reloc::add_absolute): Adjust.
117 (Output_data_reloc::add_relative): New function.
118 (Output_data::reset_data_size): New function.
119 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
120 (Output_section::set_addralign): New function.
121 (Output_section::checkpoint_set_addralign): New function.
122 (Output_section::clear_section_offsets_need_adjustment): New function.
123 (Output_section::input_sections): Make public.
124 * powerpc.cc (class Output_data_brlt_powerpc): New.
125 (class Stub_table, class Stub_control): New.
126 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
127 stub_table_, set_stub_table, stub_table): New vectors and accessor
128 functions.
129 (Target_powerpc::do_may_relax, do_relax, push_branch,
130 new_stub_table, stub_tables, brlt_section, group_sections,
131 add_branch_lookup_table, find_branch_lookup_table,
132 write_branch_lookup_table, make_brlt_section): New functions.
133 (Target_powerpc::struct Sort_sections, class Branch_info): New.
134 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
135 branch_info_): New vars.
136 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
137 make call stubs here.
138 (Output_data_glink): Remove all call stub handling from this class.
139 (Target_powerpc::Scan::local, global): Save interesting branch
140 relocs and relocs for ifunc. Adjust calls to plt entry functions.
141 (Target_powerpc::do_finalize_sections): Only make reg save/restore
142 functions on final link.
143 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
144 Handle long branch destinations too.
145 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
146 do_plt_address_for_local): Adjust lookup of plt call stubs.
147
148 2012-11-30 Alan Modra <amodra@gmail.com>
149
150 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
151 relocs against protected symbols when building 32-bit shared libs.
152
153 2012-11-30 Alan Modra <amodra@gmail.com>
154
155 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
156 param. Call got_section() to make .got. Update all callers
157 and their callers and so on.
158
159 2012-11-30 Alan Modra <amodra@gmail.com>
160
161 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
162 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
163 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
164 value if it already exists.
165
166 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
167
168 PR gold/14858
169 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
170
171 2012-11-14 Roland McGrath <mcgrathr@google.com>
172
173 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
174 than bfc instruction for data sandboxing.
175
176 2012-11-08 Alan Modra <amodra@gmail.com>
177
178 * po/POTFILES.in: Regenerate.
179
180 2012-11-05 Alan Modra <amodra@gmail.com>
181
182 * configure.ac: Apply 2012-09-10 change to config.in here.
183 * configure: Regenerate.
184
185 2012-11-05 Alan Modra <amodra@gmail.com>
186
187 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
188 (struct Opd_ent): Use "Address" rather than "Offset".
189 (Output_data_got_powerpc::got_base_offset): Return Valtype.
190 (Target_powerpc::got_section): Make public.
191 (Target_powerpc::scan_relocs): Move code setting symbols..
192 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
193 Create _SDA_BASE_ only when referenced.
194
195 2012-11-02 Roland McGrath <mcgrathr@google.com>
196
197 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
198 from last change.
199
200 2012-11-01 Roland McGrath <mcgrathr@google.com>
201
202 * target.h (Sized_target::relocate_relocs): Use Elf_Off
203 for offset_in_output_section parameter.
204 (Sized_target::relocate_special_relocatable): Likewise.
205 * arm.cc (Target_arm::relocate_relocs): Likewise.
206 (Target_arm::relocate_special_relocatable): Likewise.
207 * i386.cc (Target_i386::relocate_relocs): Likewise.
208 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
209 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
210 * target-reloc.h (relocate_relocs): Likewise.
211 * testsuite/testfile.cc (Target_test): Likewise.
212 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
213 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
214
215 * system.h: Move inclusion of <clocale> to after <libintl.h> in
216 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
217
218 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
219 parameter, which is unused in the [!F_SETFD] case.
220
221 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
222 SYMNDX to off_t before comparing it to this->data_size().
223 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
224 * incremental.cc (Output_section_incremental_inputs::do_write):
225 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
226
227 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
228
229 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
230
231 * gold.cc (Target_arm::do_adjust_elf_header): Add the
232 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
233 in EABI_VER5.
234
235 2012-10-29 Cary Coutant <ccoutant@google.com>
236
237 * dwp.cc (usage): Add file and exit status parameters;
238 add --help and --version options.
239 (print_version): New function.
240 (main): Add --help and --version options.
241
242 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
243
244 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
245 final_layout_sequence.txt.
246 * testsuite/Makefile.in: Regenerated.
247
248 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
249
250 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
251 COMPILE generated by automake.
252 (LINK1): Likewise.
253 (CXXCOMPILE1): Likewise.
254 (CXXLINK1): Likewise.
255 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
256 (LINK): Likewise.
257 (CXXCOMPILE): Likewise.
258 (CXXLINK): Likewise.
259 * testsuite/Makefile.in: Regenerated.
260
261 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
262
263 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
264 on bad fwrite return.
265
266 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
267
268 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
269 on val.
270
271 2012-10-23 Cary Coutant <ccoutant@google.com>
272
273 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
274 * testsuite/Makefile.in: Regenerate.
275 * testsuite/dwp_test.h: New source file.
276 * testsuite/dwp_test_1.cc: New source file.
277 * testsuite/dwp_test_1.s: New source file.
278 * testsuite/dwp_test_1.sh: New source file.
279 * testsuite/dwp_test_1b.cc: New source file.
280 * testsuite/dwp_test_1b.s: New source file.
281 * testsuite/dwp_test_2.cc: New source file.
282 * testsuite/dwp_test_2.s: New source file.
283 * testsuite/dwp_test_2.sh: New source file.
284 * testsuite/dwp_test_main.cc: New source file.
285 * testsuite/dwp_test_main.s: New source file.
286
287 2012-10-23 Cary Coutant <ccoutant@google.com>
288
289 * dwp.h: New header file.
290 * dwp.cc: New source file.
291 * gold.h: Move shared declarations to system.h.
292 * system.h: New header file.
293 * Makefile.am: Add dwp.
294 * Makefile.in: Regenerate.
295
296 2012-10-23 Cary Coutant <ccoutant@google.com>
297
298 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
299 Dwarf_info_reader::read_from_pointer.
300 (Dwarf_pubnames_table::read_header): Likewise.
301 (Dwarf_pubnames_table::next_name): Likewise.
302 (Dwarf_die::read_attributes): Likewise.
303 (Dwarf_die::skip_attributes): Likewise.
304 (Dwarf_info_reader::read_from_pointer): New function template.
305 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
306 (Dwarf_pubnames_table): Likewise.
307 (Dwarf_info_reader::read_from_pointer): New function template.
308 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
309 Dwarf_pubnames_table ctor.
310
311 2012-10-23 Cary Coutant <ccoutant@google.com>
312
313 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
314 abbrev_shndx.
315 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
316 abbrev_shndx_.
317 (Dwarf_info_reader::set_abbrev_shndx): New method.
318 (Dwarf_info_reader::abbrev_shndx_): New data member.
319
320 2012-10-23 Cary Coutant <ccoutant@google.com>
321
322 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
323 from object, not parameters.
324 (Dwarf_info_reader::parse): Likewise.
325 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
326 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
327 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
328 methods.
329
330 2012-10-23 Cary Coutant <ccoutant@google.com>
331
332 * fileread.cc (Input_file::Input_file): New constructor.
333 * fileread.h (class Input_file): Add new constructor.
334
335 2012-10-18 Alan Modra <amodra@gmail.com>
336
337 PR gold/14727
338 * object.cc (Relobj::is_section_name_included): Also match
339 .sdata personality section.
340
341 2012-10-18 Alan Modra <amodra@gmail.com>
342
343 * target-reloc.h (class Default_comdat_behavior): New, package up..
344 (get_comdat_behaviour): ..this.
345 (relocate_section): Add Relocate_comdat_behavior template arg,
346 adjust code to suit.
347 * arm.cc (Target_arm::relocate_section): Adjust to suit.
348 (Target_arm::scan_reloc_section): Likewise.
349 * i386.cc (Target_i386::relocate_section): Likewise.
350 * sparc.cc (Target_sparc::relocate_section): Likewise.
351 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
352 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
353 * powerpc.cc (class Relocate_comdat_behavior): New.
354 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
355 gold::relocate_section with new template arg.
356
357 2012-10-18 Alan Modra <amodra@gmail.com>
358
359 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
360 dynamic relocs for GOT_TPREL got entries, without symbol if
361 resolving locally.
362 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
363 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
364 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
365
366 2012-10-17 Alan Modra <amodra@gmail.com>
367
368 PR gold/14726
369 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
370
371 2012-10-16 Sriraman Tallam <tmsriram@google.com>
372
373 * layout.cc (Layout::include_section): Keep sections marked
374 SHF_EXCLUDE when doing relocatable links.
375
376 2012-10-16 Alan Modra <amodra@gmail.com>
377
378 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
379 (Target_powerpc::do_finalize_sections): Call it.
380 (Output_data_save_res): New class and supporting functions.
381 (Target_powerpc::symval_for_branch): Only look up .opd entry for
382 normal symbols defined in object files.
383
384 2012-10-12 Alan Modra <amodra@gmail.com>
385
386 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
387 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
388 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
389 section if scan_opd_relocs not yet called.
390 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
391
392 2012-10-12 Alan Modra <amodra@gmail.com>
393
394 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
395 add_local_ifunc_entry): Revert last change.
396 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
397
398 2012-10-05 Alan Modra <amodra@gmail.com>
399
400 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
401 do_plt_address_for_global): New functions.
402 (Output_data_got_powerpc::do_write): Don't segfault when linking
403 statically.
404 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
405 add_local_ifunc_entry): Return true on adding entry..
406 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
407 glink->add_entry call. Remove unused symtab param. Adjust calls.
408 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
409 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
410 set up symbols here.
411 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
412 syms here. Do so even when no .iplt. Don't segfault when linking
413 statically.
414 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
415 new variants without reloc param.
416 (Glink_sym_ent::Glink_sym_ent): Likewise.
417 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
418 reloc when refs will resolve to plt call stub.
419 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
420 R_PPC_PLTREL24 to resolve locally.
421 (Target_powerpc::Scan::global): Correct ifunc handling.
422 (Target_powerpc::Relocate::relocate): Correct local sym glink
423 lookup. Don't destroy "value" when we have a plt call stub,
424 and when checking plt call validity.
425 (Target_powerpc::do_dynsym_value): Simplify.
426
427 2012-10-05 Alan Modra <amodra@gmail.com>
428
429 * i386.cc (Output_data_plt_i386::address_for_global,
430 address_for_local): Add plt offset to returned value. Adjust uses.
431 * sparc.cc (Output_data_plt_sparc::address_for_global,
432 address_for_local): Likewise.
433 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
434 address_for_local): Likewise.
435 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
436 address_for_local): Likewise.
437 * target.h (Target::plt_address_for_global, plt_address_for_local):
438 Update comment.
439 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
440 (Output_data_got::Got_entry::write): Nor here.
441 * output.h: Comment fix.
442
443 2012-10-02 Jiong Wang <jiwang@tilera.com>
444
445 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
446 global_offset_table_ value for larget got.
447 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
448
449 2012-09-29 Alan Modra <amodra@gmail.com>
450
451 * powerpc.cc (Target_powerpc::iplt_): New output section.
452 (Target_powerpc::iplt_section, make_iplt_section,
453 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
454 (Target_powerpc::make_plt_entry): Handle ifunc syms.
455 Target_powerpc::plt_entry_count): Count iplt entries too.
456 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
457 reloc section in constructor. New params.
458 (Target_powerpc::make_plt_section): Create reloc section here instead.
459 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
460 functions.
461 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
462 (Output_data_glink::add_entry, find_entry): New functions to
463 deal with local syms.
464 (Glink_sym_ent): Add support for local syms.
465 (Output_data_glink::do_write): Handle ifunc plt entries.
466 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
467 (Target_powerpc::Scan::local, global): Handle ifunc syms.
468 (Target_powerpc::Relocate::relocate): Likewise.
469 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
470
471 2012-09-25 Alan Modra <amodra@gmail.com>
472
473 * object.h (Sized_relobj_file::adjust_local_symbol,
474 do_adjust_local_symbol): New functions.
475 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
476 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
477 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
478 and irregular opd entry spacing.
479 (Powerpc_relobj::do_read_relocs): Add opd size checks.
480 (Global_symbol_visitor_opd): New functor.
481 (Target_powerpc::do_finalize_sections): Omit global symbols defined
482 on deleted opd entries.
483
484 2012-09-15 Jiong Wang <jiwang@tilera.com>
485
486 * tilegx.cc: New file.
487 * Makefile.am (TARGETSOURCES): Add tilegx.cc
488 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
489 * configure.tgt: Add entries for tilegx*.
490 * configure.ac: Likewise.
491 * Makefile.in: Rebuild.
492 * configure: Likewise.
493 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
494 tilegx.
495
496 2012-09-13 Alan Modra <amodra@gmail.com>
497
498 * target-reloc.h (scan_relocs): Call scan.local for relocs
499 against symbols in discarded sections. Pass is_discarded
500 param.
501 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
502 Add is_discarded param.
503 * powerpc (Target_powerpc::Scan::local): Likewise. Use
504 is_discarded to flag opd entry as discarded. Don't emit dyn
505 relocs on such entries.
506 (Target_powerpc::Scan::global): Similarly detect and handle
507 such opd entries.
508 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
509 opd_ent_. Update all uses.
510 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
511 (Target_powerpc::relocate_section): Zero out discarded opd
512 entry relocs.
513
514 2012-09-12 Ian Lance Taylor <iant@google.com>
515
516 PR gold/14570
517 * output.cc: Rename Output_data_got template parameter from size
518 to got_size for all functions. Compile all variants of
519 Output_data_got.
520 (Output_data_got::Got_entry::write): Correct use of size for
521 symbol value. Use local_is_tls rather than casting to
522 Sized_relobj_file.
523 * object.h (class Object): Add local_is_tls and do_local_is_tls.
524 (class Sized_relobj_file): Add do_local_is_tls.
525 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
526
527 2012-09-11 Alan Modra <amodra@gmail.com>
528
529 PR gold/14566
530 * layout.cc (Layout::set_segment_offsets): When using
531 common-page-size alignment, ensure we are on a new max-page-size
532 page.
533 * output.cc (Output_segment::set_section_addresses): Use
534 abi_pagesize, not common_pagesize for relro boundary.
535 (Output_segment::set_offset): Likewise.
536
537 2012-09-11 Alan Modra <amodra@gmail.com>
538
539 * output.h (Output_data_got::add_global_tls, add_local_tls,
540 add_local_tls_pair): New functions.
541 (Output_data_got::add_local_pair_with_rel): Remove second
542 reloc param. Expand comment.
543 (Output_data_got::Got_entry): Rename use_plt_offset_ to
544 use_plt_or_tls_offset_, similarly for constructor param.
545 (Output_data_got::Got_entry::write): Add got_index param.
546 * output.cc (Output_data_got::add_global_tls, add_local_tls,
547 add_local_tls_pair): New functions.
548 (Output_data_got::Got_entry::write): Handle tls symbols
549 with use_plt_or_tls_offset_ set specially.
550 (Output_data_got::add_local_pair_with_rel): Only one reloc.
551 (Output_data_got::do_write): Replace iterator with index, pass
552 index to entry write function.
553 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
554 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
555 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
556 call.
557 * i386.cc (Target_i386::Scan::local): Likewise.
558 * sparc.cc (Target_sparc::Scan::local): Likewise.
559 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
560 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
561 do_tls_offset_for_global): New functions.
562 (Target_powerpc::Scan::local): Correct TLS relocations and got
563 entry values.
564 (Target_powerpc::Scan::global): Don't emit unnecessary
565 dynamic relocations on TLS GOT entries.
566
567 2012-09-10 Matthias Klose <doko@ubuntu.com>
568
569 * config.in: Disable sanity check for kfreebsd.
570
571 2012-09-10 Sterling Augustine <saugustine@google.com>
572
573 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
574 (Gdb_index::pubtypes_read): New parameter.
575 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
576 to calls.
577 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
578 pubtypes_object_.
579
580 2012-09-09 Alan Modra <amodra@gmail.com>
581
582 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
583 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
584 * gc.h (gc_process_relocs): Call target gc_add_reference.
585 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
586 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
587 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
588 unnecessary cast.
589 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
590 to cater for when we don't need code offset. Update use.
591 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
592 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
593 set_opd_valid): New functions.
594 (Target_powerpc::do_gc_add_reference): New function.
595 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
596 stashed refs.
597 (Target_powerpc::do_gc_mark_symbol): New function.
598
599 2012-09-06 Cary Coutant <ccoutant@google.com>
600
601 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
602 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
603 (Dwarf_die::skip_attributes): Likewise.
604 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
605 * testsuite/gdb_index_test.cc (inline_func_1): New function.
606 (main): Call it.
607 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
608
609 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
610
611 * testsuite/script_test_3.t: Add .got.plt output section
612 statement.
613 * testsuite/script_test_4.t: Likewise.
614
615 2012-09-05 Alan Modra <amodra@gmail.com>
616
617 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
618 update all uses and lose "enum" when using type.
619
620 2012-09-05 Alan Modra <amodra@gmail.com>
621
622 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
623 * configure: Regenerate.
624 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
625 (plugin_final_layout.stdout): Likewise.
626 (memory_test): Set page sizes to 0x1000.
627 * testsuite/Makefile.in: Regenerate.
628 * testsuite/discard_locals_test.sh: Add FIXME comment.
629 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
630 * testsuite/pr14265.t: Add .got output section statement.
631 * testsuite/script_test_2.t: Likewise.
632 * testsuite/script_test_3.t: Likewise.
633 * testsuite/script_test_4.t: Likewise.
634 * testsuite/script_test_5.t: Likewise.
635 * testsuite/script_test_6.t: Likewise.
636 * testsuite/script_test_7.t: Likewise.
637 * testsuite/script_test_9.t: Likewise.
638
639 2012-09-05 Alan Modra <amodra@gmail.com>
640
641 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
642 (Powerpc_relocate_functions::Status): New typedef.
643 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
644 (Target_powerpc::Scan::local): Handle REL64.
645 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
646 for REL32 and REL64.
647 (Target_powerpc::symval_for_branch): New function, extracted from..
648 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
649 checks. Report overflow errors.
650
651 2012-09-05 Alan Modra <amodra@gmail.com>
652
653 * object.h (Sized_relobj_file::emit_relocs): Delete.
654 (Sized_relobj_file::emit_relocs_reltype): Delete.
655 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
656 relocate_relocs for --emit-relocs.
657 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
658 * output.h: Update comment.
659 (Output_segment::first_section): New function.
660 (Output_segment::first_section_load_address): Use first_section.
661 * output.cc (Output_segment::first_section): New function extracted..
662 (Output_segment::first_section_load_address): ..from here. Delete.
663 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
664 * target.h (Sized_target::relocate_for_relocatable): Likewise.
665 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
666 adjust call to target.h function.
667 * i386.cc (Target_i386): Likewise.
668 * sparc.cc (Target_sparc): Likewise.
669 * x86_64.cc (Target_x86_64): Likewise.
670 * powerpc.cc (Target_powerpc): Likewise.
671 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
672 first tls section has section symbol for optimised local dynamic
673 output relocs.
674 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
675 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
676 optimised tls code.
677 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
678 Rename to relocate_relocs. Update error message.
679
680 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
681
682 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
683 --just-symbols.
684
685 2012-08-31 Alan Modra <amodra@gmail.com>
686
687 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
688 (Powerpc_relobj::toc_base_offset): New stub function.
689 (Target_powerpc): Add tp_offset, dtp_offset. Rename
690 got_mod_index_offset to tlsld_got_offset. Update all refs.
691 (Target_powerpc::Relocate::enum skip_tls): New.
692 (Target_powerpc::call_tls_get_addr_): New var.
693 (Target_powerpc::is_branch_reloc): Move to file scope.
694 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
695 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
696 New functions.
697 (Target_powerpc::enum Got_type): Delete old values, add new ones.
698 (powerpc_info): Correct common_pagesize for ppc64.
699 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
700 (Powerpc_relocate_functions): Add overflow check enums and functions.
701 Add non-shift version of rela, rela_ua. Delete all rel public
702 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
703 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
704 addr16_ha3, addr14 functions.
705 (Output_data_got_powerpc::add_constant_pair): New function.
706 (Output_data_got_powerpc::got_base_offset): Likewise.
707 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
708 (instruction constants): Sort, add some more.
709 (Output_data_glink::do_write): Add and use Address typedef. Use
710 object->toc_base_offset() stub for 64-bit.
711 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
712 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
713 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
714 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
715 Always treat .opd relocs as against locally defined symbol.
716 Correct condition for RELATIVE relocs.
717 (Target_powerpc::do_finalize_sections): Test for NULL sections.
718 (Target_powerpc::Relocate::relocate): Use plt call stub as value
719 for 32-bit syms with a plt entry. Correct ppc64 toc base
720 calculations. Handle TLS relocs, and more. Add overflow
721 checking and adjust for Powerpc_relocate_functions changes.
722 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
723 Reinstate --emit-relocs code with FIXME.
724
725 2012-08-30 Alan Modra <amodra@gmail.com>
726
727 * layout.cc (Layout::set_segment_offsets): Set p_align to
728 abi_pagesize, not common_pagesize.
729 (Layout::relaxation_loop_body): Similarly use abi_pagesize
730 to determine whether file header can go in segment.
731
732 2012-08-30 Alan Modra <amodra@gmail.com>
733
734 * output.h (Output_reloc::Output_reloc <output section>): Add
735 is_relative param. Adjust calls.
736 (Output_reloc::add_output_section_relative): New functions.
737 * output.cc (Output_reloc::Output_reloc <output section>): Handle
738 is_relative.
739 (Output_reloc::symbol_value): Handle SECTION_CODE.
740
741 2012-08-24 Sriraman Tallam <tmsriram@google.com>
742
743 * gold.cc (queue_middle_tasks): Call layout again when unique
744 segments for sections is desired.
745 * layout.cc (Layout::Layout): Initialize new members.
746 (Layout::get_output_section_flags): New function.
747 (Layout::choose_output_section): Call get_output_section_flags.
748 (Layout::layout): Make output section for mapping to a unique segment.
749 (Layout::insert_section_segment_map): New function.
750 (Layout::attach_allocated_section_to_segment): Make unique segment for
751 output sections marked so.
752 (Layout::segment_precedes): Check for unique segments when sorting.
753 * layout.h (Layout::Unique_segment_info): New struct.
754 (Layout::Section_segment_map): New typedef.
755 (Layout::insert_section_segment_map): New function.
756 (Layout::get_output_section_flags): New function.
757 (Layout::is_unique_segment_for_sections_specified): New function.
758 (Layout::set_unique_segment_for_sections_specified): New function.
759 (Layout::unique_segment_for_sections_specified_): New member.
760 (Layout::section_segment_map_): New member.
761 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
762 Rename is_gc_pass_one to is_pass_one.
763 Rename is_gc_pass_two to is_pass_two.
764 Rename is_gc_or_icf to is_two_pass.
765 Check for which pass based on whether symbols data is present.
766 Make it two pass when unique segments for sections is desired.
767 * output.cc (Output_section::Output_section): Initialize new
768 members.
769 * output.h (Output_section::is_unique_segment): New function.
770 (Output_section::set_is_unique_segment): New function.
771 (Output_section::is_unique_segment_): New member.
772 (Output_section::extra_segment_flags): New function.
773 (Output_section::set_extra_segment_flags): New function.
774 (Output_section::extra_segment_flags_): New member.
775 (Output_section::segment_alignment): New function.
776 (Output_section::set_segment_alignment): New function.
777 (Output_section::segment_alignment_): New member.
778 (Output_segment::Output_segment): Initialize is_unique_segment_.
779 (Output_segment::is_unique_segment): New function.
780 (Output_segment::set_is_unique_segment): New function.
781 (Output_segment::is_unique_segment_): New member.
782 * plugin.cc (allow_unique_segment_for_sections): New function.
783 (unique_segment_for_sections): New function.
784 (Plugin::load): Add new functions to transfer vector.
785 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
786 * Makefile.in: Regenerate.
787 * testsuite/plugin_final_layout.sh: Check if unique segment
788 functionality works.
789 * testsuite/plugin_section_order.c (onload): Check if new interfaces
790 are available.
791 (allow_unique_segment_for_sections): New global.
792 (unique_segment_for_sections): New global.
793 (claim_file_hook): Call allow_unique_segment_for_sections.
794 (all_symbols_read_hook): Call unique_segment_for_sections.
795
796 2012-08-22 Cary Coutant <ccoutant@google.com>
797
798 * layout.cc (Layout::include_section): Don't assert on GROUP
799 sections with --emit-relocs.
800
801 2012-08-21 Cary Coutant <ccoutant@google.com>
802
803 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
804 if --export-dynamic-symbol names an undef symbol.
805
806 2012-08-18 Alan Modra <amodra@gmail.com>
807
808 * powerpc.cc: Formatting and white space.
809 (Powerpc_relobj): Rename got2_section_ to special_.
810 Add opd_ent_shndx_ and opd_ent_off_ vectors.
811 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
812 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
813 (Target_powerpc): Add Address typedef and invalid_address. Use
814 throughout.
815 (Target_powerpc::is_branch_reloc): New function.
816 (Powerpc_relocate_functions): Add Address typedef, use throughout.
817 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
818 for dst_mask, value and addend.
819 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
820 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
821 (Output_data_glink::do_write): Correct toc base. Don't try to use
822 uint16_t for 24-bit offset. Use get_output_section_offset and
823 check return.
824 (Target_powerpc::Scan::local): Handle more relocs.
825 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
826 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
827 Plug in toc restoring insn after plt calls. Translate branches
828 to function descriptor symbols to corresponding entry point.
829 (Target_powerpc::relocate_for_relocatable): Check return from
830 get_output_section_offset.
831 * symtab.h: Comment typo.
832
833 2012-08-14 Ian Lance Taylor <iant@google.com>
834
835 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
836 unsupported_relocal_local to call unsupported_reloc_global.
837
838 2012-08-14 Nick Clifton <nickc@redhat.com>
839
840 PR ld/14265
841 * script-sections.cc (Sections_element::output_section_name): Add
842 keep return parameter.
843 (Output_section_element::match_name): Add keep return parameter.
844 Return the value of the keep_ member.
845 * script-sections.h (class Output_section): Update
846 output_section_name prototype.
847 * layout.cc (Layout::keep_input_section): New public member
848 function.
849 (Layout::choose_output_section): Pass keep parameter to
850 output_section_name.
851 * layout.h (class Layout): Add keep_input_section.
852 * object.cc (Sized_relobj_file::do_layout): Check for kept input
853 sections.
854 * testsuite/Makefile.am: Add a test.
855 * testsuite/Makefile.in: Regenerate.
856 * testsuite/pr14265.c: Source file for the test.
857 * testsuite/pr14265.t: Linker script for the test.
858 * testsuite/pr14265.sh: Shell script for the test.
859
860 2012-08-14 Alan Modra <amodra@gmail.com>
861
862 * target.h (Target::output_section_name): New function.
863 (Target::do_output_section_name): New function.
864 * layout.cc (Layout::choose_output_section): Call the above.
865 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
866
867 2012-08-14 Alan Modra <amodra@gmail.com>
868
869 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
870 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
871 for replace_constant call.
872 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
873 (Output_data_glink::do_print_to_mapfile): New function.
874 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
875 (Target_powerpc::Relocate::relocate): Likewise.
876
877 2012-08-14 Alan Modra <amodra@gmail.com>
878
879 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
880 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
881 (Output_data_glink::add_entry,find_entry): Remove shndx param.
882 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
883 all references to shndx_. Handle special case for R_PPC_PLTREL24
884 here.
885 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
886 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
887 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
888 here.
889 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
890 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
891
892 2012-08-12 Alan Modra <amodra@gmail.com>
893
894 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
895 (glink insn constants): Use uint32_t.
896 (Output_data_glink::add_entry): Use insert, not [] operator.
897
898 2012-08-11 Alan Modra <amodra@gmail.com>
899
900 * object.h (Sized_relobj_file::find_shdr): New function.
901 (Sized_relobj_file::find_special_sections): New function.
902 * object.cc (Sized_relobj_file::find_shdr): New function.
903 (Sized_relobj_file::find_eh_frame): Use find_shdr.
904 (Sized_relobj_file::find_special_sections): New function, split out..
905 (Sized_relobj_file::do_read_symbols): ..from here.
906 * output.h (Output_data_got::replace_constant): New function.
907 (Output_data_got::num_entries): New function.
908 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
909 (Output_data_got::got_offset): Protected rather than private.
910 (Output_data_got::replace_got_entry): New function.
911 * output.cc (Output_data_got::replace_got_entry): New function.
912 * powerpc.cc (class Powerpc_relobj): New.
913 (class Powerpc_relocate_functions): Delete all psymval variants or
914 convert to value,addend type. Delete pcrela, pcrela_unaligned.
915 Implement _ha functions using corresponding _hi function.
916 (Powerpc_relobj::find_special_sections): New function.
917 (Target_powerpc::do_make_elf_object): New function.
918 (class Output_data_got_powerpc): New.
919 (class Output_data_glink): New.
920 (class Powerpc_scan_relocatable_reloc): New.
921 Many more changes througout file.
922
923 2012-08-09 Nick Clifton <nickc@redhat.com>
924
925 * po/vi.po: Updated Vietnamese translation.
926
927 2012-08-07 Ian Lance Taylor <iant@google.com>
928
929 * layout.cc (Layout::add_target_dynamic_tags): If
930 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
931 plt_rel.
932
933 2012-07-30 Nick Clifton <nickc@redhat.com>
934
935 * po/gold.pot: Updated template.
936 * po/es.po: Updated Spanish translation.
937
938 2012-07-18 Cary Coutant <ccoutant@google.com>
939
940 PR gold/14344
941 * configure.ac: Add check for -gpubnames support.
942 * configure: Regenerate.
943 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
944 support; force -gno-pubnames.
945 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
946 support.
947 (gdb_index_test_4): New test.
948 * testsuite/Makefile.in: Regenerate.
949 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
950 * testsuite/gdb_index_test_2.sh: Likewise.
951 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
952 * testsuite/gdb_index_test_4.sh: New script.
953 * testsuite/gdb_index_test_comm.sh: New script with common code;
954 don't look for space after colon.
955
956 2012-07-16 Sriraman Tallam <tmsriram@google.com>
957
958 * gold.cc (queue_middle_tasks): Update function order only after
959 deferred objects due to plugins are processed.
960
961 2012-07-11 Ian Lance Taylor <iant@google.com>
962
963 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
964 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
965 (Target_arm::scan_reloc_for_stub): Likewise.
966 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
967 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
968 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
969 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
970 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
971
972 2012-07-10 Dodji Seketeli <dodji@redhat.com>
973 Ian Lance Taylor <iant@google.com>
974
975 PR gold/14309
976 * configure.ac: Test whether std::tr1::hash<off_t> works.
977 * gold.h: Add a specialization for std::tr1::hash<off_t> if
978 needed.
979 * output.h (class Output_fill): Add virtual destructor.
980 * configure, config.in: Rebuild.
981
982 2012-06-22 Roland McGrath <mcgrathr@google.com>
983
984 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
985
986 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
987
988 * plugin.cc (Plugin::load): Handle position independent executables.
989
990 2012-06-06 Cary Coutant <ccoutant@google.com>
991
992 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
993 add .debug_macro.
994 (lines_only_debug_sections): Likewise.
995 (gdb_fast_lookup_sections): New static array.
996 (is_gdb_debug_section): Rename formal parameter.
997 (is_lines_only_debug_section): Likewise.
998 (is_gdb_fast_lookup_section): New function.
999 (Layout::include_section): Check for ".zdebug_" prefix; pass
1000 section name suffix to is_gdb_debug_section, et al.; check for
1001 fast-lookup sections when building .gdb_index.
1002 * options.h (--strip-debug-gdb): Update GDB version number.
1003
1004 2012-06-06 Cary Coutant <ccoutant@google.com>
1005
1006 * configure.ac: Add check for fallocate.
1007 * configure: Regenerate.
1008 * config.in: Regenerate.
1009
1010 * options.h (class General_options): Add --mmap-output-file and
1011 --posix-fallocate options.
1012 * output.cc: (posix_fallocate): Remove; replace with...
1013 (gold_fallocate): New function.
1014 (Output_file::map_no_anonymous): Call gold_fallocate.
1015 (Output_file::map): Check --mmap-output-file option.
1016
1017 2012-06-05 Jing Yu <jingyu@google.com>
1018
1019 * gold.h (textdomain): Add do {} to empty while(0).
1020 (bindtextdomain): Likewise.
1021
1022 2012-06-04 Cary Coutant <ccoutant@google.com>
1023
1024 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1025 has_dynsym_index.
1026
1027 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1028
1029 * symtab.cc (Symbol_table::define_special_symbol):
1030 Initialize *poldsym to prevent uninitialized variable errors.
1031
1032 2012-05-23 Cary Coutant <ccoutant@google.com>
1033
1034 * layout.cc (Layout::section_name_mapping): Add rules to handle
1035 exact match on .data.rel.ro.local or .data.rel.ro.
1036 (Layout::output_section_name): Check for exact matches.
1037
1038 2012-05-23 Cary Coutant <ccoutant@google.com>
1039
1040 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1041 more carefully.
1042
1043 2012-05-22 Cary Coutant <ccoutant@google.com>
1044
1045 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1046 object before exporting symbol.
1047
1048 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1049
1050 * testsuite/tls_test.cc: Include "config.h" first.
1051 * testsuite/tls_test_c.c: Likewise.
1052
1053 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1054 Nick Clifton <nickc@redhat.com>
1055
1056 PR 14072
1057 * configure.in: Add check that sysdep.h has been included before
1058 any system header files.
1059 * configure: Regenerate.
1060 * config.in: Regenerate.
1061
1062 2012-05-14 Cary Coutant <ccoutant@google.com>
1063
1064 * layout.cc (Layout::make_output_section): Mark .tdata section
1065 as RELRO.
1066 * testsuite/relro_test.cc: Add a TLS variable.
1067
1068 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1069
1070 PR gold/14091
1071 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1072 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1073 R_X86_64_64.
1074
1075 2012-05-08 Cary Coutant <ccoutant@google.com>
1076
1077 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1078 (lines_only_debug_sections): Likewise.
1079
1080 2012-05-02 Roland McGrath <mcgrathr@google.com>
1081
1082 * nacl.cc: New file.
1083 * nacl.h: New file.
1084 * Makefile.am (CCFILES, HFILES): Add them.
1085 * Makefile.in: Regenerate.
1086 * i386.cc (Output_data_plt_i386_nacl): New class.
1087 (Output_data_plt_i386_nacl_exec): New class.
1088 (Output_data_plt_i386_nacl_dyn): New class.
1089 (Target_i386_nacl): New class.
1090 (Target_selector_i386_nacl): New class.
1091 (target_selector_i386): Use it instead of Target_selector_i386.
1092 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1093 (Target_x86_64_nacl): New class.
1094 (Target_selector_x86_64_nacl): New class.
1095 (target_selector_x86_64, target_selector_x32): Use it instead of
1096 Target_selector_x86_64.
1097 * arm.cc (Output_data_plt_arm_nacl): New class.
1098 (Target_arm_nacl): New class.
1099 (Target_selector_arm_nacl): New class.
1100 (target_selector_arm, target_selector_armbe): Use it instead of
1101 Target_selector_arm.
1102
1103 * target-select.cc (select_target): Take new Input_file* and off_t
1104 arguments, pass them on to recognize method of selector.
1105 * object.cc (make_elf_sized_object): Update caller.
1106 * parameters.cc (parameters_force_valid_target): Likewise.
1107 * incremental.cc (make_sized_incremental_binary): Likewise.
1108 * target-select.h: Update decl.
1109 (Target_selector::recognize): Take new Input_file* argument,
1110 pass it on to do_recognize.
1111 (Target_selector::do_recognize): Take new Input_file* argument.
1112 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1113 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1114 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1115 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1116
1117 * target.h (Target::Target_info): New members isolate_execinstr
1118 and rosegment_gap.
1119 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1120 * arm.cc (Target_arm::arm_info): Update initializer.
1121 * i386.cc (Target_i386::i386_info): Likewise.
1122 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1123 * sparc.cc (Target_sparc::sparc_info): Likewise.
1124 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1125 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1126 * layout.cc (Layout::attach_allocated_section_to_segment):
1127 Take new const Target* argument. If target->isolate_execinstr(), act
1128 like --rosegment.
1129 (Layout::find_first_load_seg): Take new const Target* argument;
1130 if target->isolate_execinstr(), reject PF_X segments.
1131 (Layout::relaxation_loop_body): Update caller.
1132 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1133 reset file offset to zero when we hit LOAD_SEG, and then do a second
1134 loop over the segments before LOAD_SEG to reassign offsets after
1135 addresses have been determined. Handle target->rosegment_gap().
1136 (Layout::attach_section_to_segment): Take new const Target* argument;
1137 pass it to attach_allocated_section_to_segment.
1138 (Layout::make_output_section): Update caller.
1139 (Layout::attach_sections_to_segments): Take new const Target* argument;
1140 pass it to attach_section_to_segment.
1141 * gold.cc (queue_middle_tasks): Update caller.
1142 * layout.h (Layout): Update method decls with new arguments.
1143
1144 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1145 Target_info pointer to use.
1146 (Target_arm::do_make_data_plt): New virtual method.
1147 (Target_arm::make_data_plt): New method that calls it.
1148 (Target_arm::make_plt_entry): Use it.
1149 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1150 for the section alignment.
1151 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1152 method.
1153 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1154 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1155 method.
1156 (Output_data_plt_arm::get_plt_entry_size): Call it.
1157 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1158 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1159 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1160 method.
1161 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1162 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1163 method instead of sizeof(plt_entry).
1164 (Output_data_plt_arm::add_entry): Likewise.
1165 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1166 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1167 than static method.
1168 (Target_arm::plt_entry_size): Likewise.
1169 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1170 Move to ...
1171 (Output_data_plt_arm_standard): ... here, new class.
1172 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1173 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1174 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1175
1176 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1177 Take additional argument for the PLT entry size.
1178 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1179 Use get_plt_entry_size method rather than plt_entry_size variable.
1180 (Output_data_plt_x86_64::reserve_slot): Likewise.
1181 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1182 (Output_data_plt_x86_64::add_entry): Likewise.
1183 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1184 (Output_data_plt_x86_64::address_for_global): Likewise.
1185 (Output_data_plt_x86_64::address_for_local): Likewise.
1186 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1187 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1188 Make method non-static.
1189 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1190 method.
1191 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1192 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1193 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1194 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1195 virtual method.
1196 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1197 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1198 virtual method.
1199 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1200 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1201 virtual method.
1202 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1203 (Output_data_plt_x86_64::plt_entry_size)
1204 (Output_data_plt_x86_64::first_plt_entry)
1205 (Output_data_plt_x86_64::plt_entry)
1206 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1207 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1208 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1209 (Output_data_plt_x86_64_standard): ... here, new class.
1210 (Target_x86_64::Target_x86_64): Take optional argument for the
1211 Target_info pointer to use.
1212 (Target_x86_64::do_make_data_plt): New virtual method.
1213 (Target_x86_64::make_data_plt): New method to call it.
1214 (Target_x86_64::init_got_plt_for_update): Use that.
1215 Call this->plt_->add_eh_frame method here.
1216 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1217 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1218 rather than static method.
1219 (Target_x86_64::plt_entry_size): Likewise.
1220 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1221 rather than plt_entry_size variable. Move guts of PLT filling to...
1222 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1223 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1224 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1225
1226 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1227 additional argument for the section alignment.
1228 Don't do add_eh_frame_for_plt here.
1229 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1230 non-static. Use get_plt_entry_size method rather than plt_entry_size
1231 variable.
1232 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1233 method.
1234 (Output_data_plt_i386::get_plt_entry_size): Call it.
1235 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1236 (Output_data_plt_i386::add_eh_frame): New method to call it.
1237 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1238 method.
1239 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1240 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1241 method.
1242 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1243 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1244 method instead of plt_entry_size.
1245 (Output_data_plt_i386::plt_entry_size)
1246 (Output_data_plt_i386::plt_eh_frame_fde_size)
1247 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1248 (Output_data_plt_i386_standard): ... here, new class.
1249 (Output_data_plt_i386_exec): New class.
1250 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1251 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1252 (Output_data_plt_i386::exec_plt_entry): Move to ...
1253 (Output_data_plt_i386_exec::plt_entry): ... here.
1254 (Output_data_plt_i386_dyn): New class.
1255 (Output_data_plt_i386::first_plt_entry): Move to ...
1256 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1257 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1258 (Output_data_plt_i386_dyn::plt_entry): ... here.
1259 (Target_i386::Target_i386): Take optional argument for the Target_info
1260 pointer to use.
1261 (Target_i386::do_make_data_plt): New virtual method.
1262 (Target_i386::make_data_plt): New method to call it.
1263 (Target_i386::make_plt_section): Use that.
1264 Call this->plt_->add_eh_frame method here.
1265 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1266 rather than plt_entry_size variable.
1267 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1268 (Output_data_plt_i386::address_for_local): Likewise.
1269 (Output_data_plt_i386::do_write): Likewise.
1270 Move guts of PLT filling to...
1271 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1272 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1273 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1274 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1275
1276 2012-05-01 Cary Coutant <ccoutant@google.com>
1277
1278 * dwarf_reader.cc (Dwarf_die::read_attributes)
1279 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1280 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1281 * reduced_debug_output.cc
1282 (Output_reduced_debug_info_section::get_die_end): Remove
1283 DW_FORM_GNU_ref_index. Add default case.
1284
1285 2012-04-26 Mark Wielaard <mjw@redhat.com>
1286
1287 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1288 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1289 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1290 DW_AT_high_pc as offset from DW_AT_low_pc.
1291
1292 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1293 * testsuite/Makefile.in: Regenerate.
1294 * testsuite/gdb_index_test_3.c: New test source file.
1295 * testsuite/gdb_index_test_3.sh: New test source file.
1296
1297 2012-04-25 Ian Lance Taylor <iant@google.com>
1298
1299 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1300 pointer.
1301 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1302 as a class, not a struct.
1303 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1304 (Target_arm::apply_cortex_a8_workaround): Likewise.
1305 * gc.h: Declare Reloc_types as a struct, not a class.
1306 * object.h: Declare Symbols_data as a struct.
1307 * reloc.h: Declare Read_relocs_data as a struct.
1308 * target.h: Declare Relocate_info as a struct.
1309
1310 2012-04-24 David S. Miller <davem@davemloft.net>
1311
1312 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1313 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1314 and R_SPARC_WPLT30.
1315
1316 2012-04-24 Cary Coutant <ccoutant@google.com>
1317
1318 * incremental-dump.cc (find_input_containing_global): Replace
1319 magic number with symbolic constant.
1320 (dump_incremental_inputs): Update version number.
1321 * incremental.cc (Output_section_incremental_inputs): Update version
1322 number; import symbolic constants from Incremental_inputs_reader.
1323 (Incremental_inputs::create_data_sections): Align relocations
1324 section correctly for 64-bit targets.
1325 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1326 constants; add padding.
1327 (Output_section_incremental_inputs::write_header): Add assert for
1328 header_size.
1329 (Output_section_incremental_inputs::write_input_files): Add assert
1330 for input_entry_size.
1331 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1332 add assert for object_info_size, input_section_entry_size,
1333 global_sym_entry_size.
1334 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1335 for data structure sizes; use them.
1336 (Incremental_input_entry_reader): Import symbolic constants from
1337 Incremental_inputs_reader; use them.
1338
1339 2012-04-23 David S. Miller <davem@davemloft.net>
1340
1341 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1342 and elf_flags_set_.
1343 (Target_sparc::Target_sparc): Initialize new fields.
1344 (Target_sparc::do_make_elf_object): New function.
1345 (Target_sparc::do_adjust_elf_header): New function.
1346
1347 2012-04-23 Cary Coutant <ccoutant@google.com>
1348
1349 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1350 CU range table of gdb index.
1351
1352 2012-04-20 David S. Miller <davem@davemloft.net>
1353
1354 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1355 instead of false.
1356
1357 2012-04-16 David S. Miller <davem@davemloft.net>
1358
1359 * sparc.cc (Target_sparc::got_address): New function.
1360 (Sparc_relocate_functions::gdop_hix22): New function.
1361 (Sparc_relocate_functions::gdop_lox10): New function.
1362 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1363 relocs.
1364 (Target_sparc::Scan::local): Likewise if the global symbol is not
1365 preemptible and is not IFUNC.
1366 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1367 transformations for local and non-preemptible non-IFUNC global
1368 symbols.
1369
1370 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1371 writing out 64-bit part of ranges.
1372
1373 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1374 -fpic and -fpie respectively.
1375 * Makefile.in: Regenerate.
1376
1377 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1378 (Target_sparc::Target_sparc): Initialize new field.
1379 (Target_sparc::do_plt_section_for_global): New function.
1380 (Target_sparc::do_plt_section_for_local): New function.
1381 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1382 (Target_sparc::make_plt_section): New function, broken out of
1383 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1384 (Target_sparc::make_plt_entry): Call make_plt_section.
1385 (Target_sparc::make_local_ifunc_plt_entry): New function.
1386 (Target_sparc::rela_ifunc_section): New function.
1387 (Target_sparc::plt_section): Remove const.
1388 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1389 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1390 and ifunc_count_ fields.
1391 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1392 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1393 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1394 (Output_data_plt_sparc::rela_ifunc): New function.
1395 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1396 (Output_data_plt_sparc::has_ifunc_section): New function.
1397 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1398 (Output_data_plt_sparc::address_for_global): New function.
1399 (Output_data_plt_sparc::address_for_local): New function.
1400 (Output_data_plt_sparc::plt_index_to_offset): New function.
1401 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1402 and entry_count.
1403 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1404 entry_count.
1405 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1406 R_SPARC_JMP_IREL to switch.
1407 (Target_sparc::Scan::check_non_pic): Likewise.
1408 (Target_sparc::Scan::local): Handle IFUNC symbols.
1409 (Target_sparc::Scan::local): Likewise.
1410 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1411 and plt_address_for_local.
1412 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1413 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1414
1415 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1416 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1417 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1418 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1419 global relocs too.
1420 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1421 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1422 calls.
1423 * sparc.cc (Target_sparc::Scan::global): Likewise.
1424 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1425
1426 2012-04-16 Cary Coutant <ccoutant@google.com>
1427
1428 * archive.cc (Library_base::should_include_member): Check for
1429 --export-dynamic-symbol.
1430 * options.h (class General_options): Add --export-dynamic-symbol.
1431 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1432 --export-dynamic-symbol.
1433 (Symbol_table::gc_mark_undef_symbols): Likewise.
1434 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1435
1436 2012-04-12 David S. Miller <davem@davemloft.net>
1437
1438 * sparc.cc (Reloc::wdisp10): New relocation method.
1439 (Reloc::h34): Likewise.
1440 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1441 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1442 R_SPARC_WDISP10.
1443 (Target_sparc::Scan::local): Likewise.
1444 (Target_sparc::Scan::global): Likewise.
1445 (Target_sparc::Relocate::relocate): Likewise.
1446
1447 2012-04-09 Cary Coutant <ccoutant@google.com>
1448
1449 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1450 low_pc == 0.
1451
1452 2012-04-06 Ian Lance Taylor <iant@google.com>
1453
1454 * timer.cc: #include <unistd.h>.
1455
1456 2012-04-06 Roland McGrath <mcgrathr@google.com>
1457
1458 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1459 * config.in: Regenerate.
1460 * configure: Regenerate.
1461
1462 2012-04-05 Nick Clifton <nickc@redhat.com>
1463
1464 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1465 (AM_LC_MESSAGES): Add.
1466 * aclocal.m4: Regenerate.
1467 * config.in: Regenerate.
1468 * configure: Regenerate.
1469
1470 2012-03-21 Cary Coutant <ccoutant@google.com>
1471
1472 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1473 * Makefile.in: Regenerate.
1474 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1475 (Sized_elf_reloc_mapper::symbol_section): New function.
1476 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1477 (make_elf_reloc_mapper): New function.
1478 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1479 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1480 (Dwarf_abbrev_table::do_get_abbrev): New function.
1481 (Dwarf_ranges_table::read_ranges_table): New function.
1482 (Dwarf_ranges_table::read_range_list): New function.
1483 (Dwarf_pubnames_table::read_section): New function.
1484 (Dwarf_pubnames_table::read_header): New function.
1485 (Dwarf_pubnames_table::next_name): New function.
1486 (Dwarf_die::Dwarf_die): New function.
1487 (Dwarf_die::read_attributes): New function.
1488 (Dwarf_die::skip_attributes): New function.
1489 (Dwarf_die::set_name): New function.
1490 (Dwarf_die::set_linkage_name): New function.
1491 (Dwarf_die::attribute): New function.
1492 (Dwarf_die::string_attribute): New function.
1493 (Dwarf_die::int_attribute): New function.
1494 (Dwarf_die::uint_attribute): New function.
1495 (Dwarf_die::ref_attribute): New function.
1496 (Dwarf_die::child_offset): New function.
1497 (Dwarf_die::sibling_offset): New function.
1498 (Dwarf_info_reader::check_buffer): New function.
1499 (Dwarf_info_reader::parse): New function.
1500 (Dwarf_info_reader::do_parse): New function.
1501 (Dwarf_info_reader::do_read_string_table): New function.
1502 (Dwarf_info_reader::lookup_reloc): New function.
1503 (Dwarf_info_reader::get_string): New function.
1504 (Dwarf_info_reader::visit_compilation_unit): New function.
1505 (Dwarf_info_reader::visit_type_unit): New function.
1506 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1507 Sized_elf_reloc_mapper.
1508 (Sized_dwarf_line_info::symbol_section): Remove function.
1509 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1510 (Sized_dwarf_line_info::read_line_mappings): Remove object
1511 parameter, adjust callers.
1512 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1513 * dwarf_reader.h: Include <sys/types.h>.
1514 (class Track_relocs): Remove forward declaration.
1515 (class Elf_reloc_mapper): New class.
1516 (class Sized_elf_reloc_mapper): New class.
1517 (class Dwarf_abbrev_table): New class.
1518 (class Dwarf_range_list): New class.
1519 (class Dwarf_ranges_table): New class.
1520 (class Dwarf_pubnames_table): New class.
1521 (class Dwarf_die): New class.
1522 (class Dwarf_info_reader): New class.
1523 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1524 (Sized_dwarf_line_info::symbol_section): Remove member function.
1525 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1526 base class.
1527 * gdb-index.cc: New source file.
1528 * gdb-index.h: New source file.
1529 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1530 and .debug_types sections, call Layout::add_to_gdb_index.
1531 (Sized_relobj_incr::do_section_name): Implement.
1532 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1533 return type; Implement.
1534 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1535 return type.
1536 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1537 parameter list and return type.
1538 (Sized_incr_dynobj::do_section_contents): Likewise.
1539 * layout.cc: Include gdb-index.h.
1540 (Layout::Layout): Initialize gdb_index_data_.
1541 (Layout::init_fixed_output_section): Check for .gdb_index section.
1542 (Layout::add_to_gdb_index): New function. Instantiate.
1543 * layout.h: Add forward declaration for class Gdb_index.
1544 (Layout::add_to_gdb_index): New member function.
1545 (Layout::gdb_index_data_): New data member.
1546 * main.cc: Include gdb-index.h.
1547 (main): Print statistics for gdb index.
1548 * object.cc (Object::section_contents): Move code into
1549 do_section_contents.
1550 (need_decompressed_section): Check for sections needed when building
1551 gdb index.
1552 (build_compressed_section_map): Likewise.
1553 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1554 gdb index.
1555 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1556 sections; call Layout::add_to_gdb_index.
1557 (Sized_relobj_file::do_decompressed_section_contents): Call
1558 do_section_contents directly.
1559 * object.h (Object::do_section_contents): Adjust parameter list and
1560 return type.
1561 (Object::do_decompressed_section_contents): Call do_section_contents
1562 directly.
1563 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1564 return type.
1565 * options.h (class General_options): Add --gdb-index option.
1566 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1567 list and return type.
1568 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1569 * reloc.h (Track_relocs::checkpoint): New function.
1570 (Track_relocs::reset): New function.
1571
1572 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1573 New test cases.
1574 * testsuite/Makefile.in: Regenerate.
1575 * testsuite/gdb_index_test.cc: New test source file.
1576 * testsuite/gdb_index_test_1.sh: New test source file.
1577 * testsuite/gdb_index_test_2.sh: New test source file.
1578
1579 2012-03-19 Doug Kwan <dougkwan@google.com>
1580
1581 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1582 (Target_arm::do_finalize_sections): Remove code which defines
1583 __exidx_start and __exidx_end. Make symbol table parameter
1584 anonymous as it is not used.
1585 * gold.cc (queue_middle_tasks): Call target hook to define any
1586 target-specific symbols.
1587 * target.h (Target::define_standard_symbols): New method.
1588 (Target::do_define_standard_symbols): Same.
1589 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1590 * testsuite/Makefile.in: Regenerate.
1591 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1592 and __exidx_end.
1593 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1594 relocations are generated for __exidx_start and __exidx_end.
1595
1596 2012-03-16 Doug Kwan <dougkwan@google.com>
1597
1598 * testsuite/Makefile.am: Disable test initpri3b.
1599 * testsuite/Makefile.in: Regenerate.
1600
1601 2012-03-15 Doug Kwan <dougkwan@google.com>
1602
1603 * arm.cc (Target_arm::got_section): Make .got section read-only
1604 if -z now is given.
1605
1606 2012-03-15 Ian Lance Taylor <iant@google.com>
1607
1608 PR gold/13850
1609 * layout.cc (Layout::make_output_section): Correctly mark
1610 SHT_INIT_ARRAY, et. al., as relro.
1611
1612 2012-03-14 Doug Kwan <dougkwan@google.com>
1613
1614 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1615 dynamic relocations for protected symbols in shared objects.
1616
1617 2012-03-13 Ian Lance Taylor <iant@google.com>
1618
1619 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1620 keep the larger alignment.
1621
1622 2012-03-12 Cary Coutant <ccoutant@google.com>
1623
1624 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1625 handling of DW_LNE_define_file.
1626
1627 2012-03-12 Cary Coutant <ccoutant@google.com>
1628
1629 * reduced_debug_output.cc
1630 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1631 codes to switch.
1632
1633 2012-02-29 Cary Coutant <ccoutant@google.com>
1634
1635 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1636
1637 2012-02-29 Cary Coutant <ccoutant@google.com>
1638
1639 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1640 Call Object::decompressed_section_contents.
1641 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1642 New dtor.
1643 (Sized_dwarf_line_info::buffer_start_): New data member.
1644 * merge.cc (Output_merge_data::do_add_input_section): Call
1645 Object::decompressed_section_contents.
1646 (Output_merge_string::do_add_input_section): Likewise.
1647 * object.cc (need_decompressed_section): New function.
1648 (build_compressed_section_map): Decompress sections needed later.
1649 (Sized_relobj_file::do_decompressed_section_contents): New function.
1650 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1651 * object.h (Object::decompressed_section_contents): New function.
1652 (Object::discard_decompressed_sections): New function.
1653 (Object::do_decompressed_section_contents): New function.
1654 (Object::do_discard_decompressed_sections): New function.
1655 (Compressed_section_info): New type.
1656 (Compressed_section_map): Include decompressed section contents.
1657 (Sized_relobj_file::do_decompressed_section_contents): New function.
1658 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1659
1660 2012-02-16 Cary Coutant <ccoutant@google.com>
1661
1662 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1663 * testsuite/Makefile.in: Regenerate.
1664
1665 2012-02-14 Cary Coutant <ccoutant@google.com>
1666
1667 * options.cc (General_options::finalize): Disallow -pie and -static.
1668
1669 2012-02-03 Doug Kwan <dougkwan@google.com>
1670
1671 * arm.cc (Arm_relocate_functions::abs8,
1672 Arm_relocate_functions::abs16): Use
1673 Bits::has_signed_unsigned_overflow32.
1674 (Arm_relocate_functions::thm_abs8): Correct range of
1675 overflow check.
1676 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1677 in assertions.
1678
1679 2012-02-02 Doug Kwan <dougkwan@google.com>
1680
1681 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1682 position independent outputs, not just shared objects.
1683
1684 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1685
1686 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1687 * configure: Regenerated.
1688
1689 2012-01-27 Ian Lance Taylor <iant@google.com>
1690
1691 * reloc.h (Bits): New class with static functions, copied from
1692 namespace utils in arm.cc.
1693 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1694 instead.
1695
1696 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1697
1698 * incremental.cc (write_info_blocks): Correct relocation offset.
1699
1700 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1701
1702 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1703 (Relocate::tls_gd_to_le): Likewise.
1704
1705 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1706
1707 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1708
1709 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1710
1711 * configure.ac: Check if -mcmodel=medium works.
1712 * configure: Regenerated.
1713
1714 2012-01-24 Cary Coutant <ccoutant@google.com>
1715
1716 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1717 definition and ...
1718 (read_unsigned_LEB_128_x): ... this new function.
1719 (read_signed_LEB_128): Replaced with inline definition and ...
1720 (read_signed_LEB_128_x): ... this new function.
1721 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1722 (read_unsigned_LEB_128): Add inline definition.
1723 (read_signed_LEB_128_x): New function.
1724 (read_signed_LEB_128): Add inline definition.
1725 * testsuite/Makefile.am (leb128_unittest): New unit test.
1726 * testsuite/Makefile.in: Regenerate.
1727 * testsuite/leb128_unittest.cc: New unit test.
1728
1729 2012-01-23 Ian Lance Taylor <iant@google.com>
1730
1731 PR gold/13617
1732 * i386.cc (Target_i386::do_code_fill): When using a jmp
1733 instruction, pad with nop instructions.
1734 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1735
1736 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1737
1738 * x86_64.cc (gc_process_relocs): Add typename on types used in
1739 template.
1740 (scan_relocs): Likewise.
1741 (relocate_section): Likewise.
1742 (apply_relocation): Likewise.
1743
1744 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1745
1746 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1747 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1748 under x32.
1749
1750 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1751
1752 * x86_64.cc: Initial support for x32.
1753
1754 2012-01-03 Cary Coutant <ccoutant@google.com>
1755
1756 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1757 Use abstract base class for GOT.
1758 * gold/output.h (class Output_data_got_base): New abstract base class.
1759 (class Output_data_got): Derive from new base class, adjust ctors.
1760 (Output_data_got::reserve_slot): Make virtual; rename to
1761 do_reserve_slot; Adjust callers.
1762 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1763 pointer to abstract base class.
1764 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1765
1766 2011-12-18 Ian Lance Taylor <iant@google.com>
1767
1768 * object.h (Relobj::local_symbol_value): New function.
1769 (Relobj::local_plt_offset): New function.
1770 (Relobj::local_has_got_offset): New function.
1771 (Relobj::local_got_offset): New function.
1772 (Relobj::set_local_got_offset): New function.
1773 (Relobj::do_local_symbol_value): New pure virtual function.
1774 (Relobj::do_local_plt_offset): Likewise.
1775 (Relobj::do_local_has_got_offset): Likewise.
1776 (Relobj::do_local_got_offset): Likewise.
1777 (Relobj::do_set_local_got_offset): Likewise.
1778 (Sized_relobj::do_local_has_got_offset): Rename from
1779 local_has_got_offset.
1780 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1781 (Sized_relobj::do_set_local_got_offset): Rename from
1782 set_local_got_offset.
1783 (Sized_relobj_file::do_local_plt_offset): Rename from
1784 local_plt_offset.
1785 (Sized_relobj_file::do_local_symbol_value): New function.
1786 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1787 local_plt_offset.
1788 * output.cc (Output_data_got::Got_entry::write): Change object to
1789 Relobj. Use local_symbol_value.
1790 (Output_data_got::add_global_with_rel): Change rel_dyn to
1791 Output_data_reloc_generic*. Use add_global_generic.
1792 (Output_data_got::add_global_with_rela): Remove. Change all
1793 callers to use add_global_with_rel.
1794 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1795 Output_data_reloc_generic*. Use add_global_generic.
1796 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1797 callers to use add_global_pair_with_rel.
1798 (Output_data_got::add_local): Change object to Relobj*.
1799 (Output_data_got::add_local_plt): Likewise.
1800 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1801 change rel_dyn to Output_data_reloc_generic*. Use
1802 add_local_generic.
1803 (Output_data_got::add_local_with_rela): Remove. Change all
1804 callers to use all_local_with_rel.
1805 (Output_data_got::add_local_pair_with_rel): Change object to
1806 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1807 add_output_section_generic.
1808 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1809 callers to use add_local_pair_with_rel.
1810 (Output_data_got::reserve_local): Change object to Relobj*.
1811 * output.h: (class Output_data_reloc_generic): Add pure virtual
1812 declarations for add_global_generic, add_local_generic,
1813 add_output_section_generic.
1814 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1815 functions for Output_data_reloc_generic. Update declarations for
1816 changes listed in output.cc.
1817 (class Output_data_got): Change template parameter to got_size.
1818 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1819 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1820 function.
1821 (Sized_relobj_incr::do_local_plt_offset): New function.
1822 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1823 add_global_generic.
1824
1825 2011-12-17 Cary Coutant <ccoutant@google.com>
1826
1827 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1828 * resolve.cc (Symbol_table::resolve): Likewise.
1829 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1830 arrays.
1831 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1832
1833 2011-12-16 Ian Lance Taylor <iant@google.com>
1834
1835 * output.h (Output_data_reloc_generic::add): Only call
1836 add_dynamic_reloc if this is a dynamic reloc section.
1837
1838 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1839
1840 PR gold/13505
1841 * target-reloc.h (apply_relocation): Replace <64, false> with
1842 <size, big_endian>.
1843
1844 2011-11-25 Nick Clifton <nickc@redhat.com>
1845
1846 * po/it.po: New Italian translation.
1847
1848 2011-11-17 Sterling Augustine <saugustine@google.com>
1849
1850 * script.cc (script_include_directive): Implement.
1851 (read_script_file): New local variables name and search_path. Update
1852 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1853 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1854 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1855
1856 2011-11-11 Sterling Augustine <saugustine@google.com>
1857
1858 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1859 (file_or_sections_cmd): Likewise.
1860
1861 2011-11-11 Doug Kwan <dougkwan@google.com>
1862
1863 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1864 if --just-symbols is given.
1865
1866 2011-11-10 Doug Kwan <dougkwan@google.com>
1867
1868 PR gold/13362
1869 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1870 when processing data relocs.
1871 * reloc.h (Relocate_functions::rel_unaligned): New method.
1872 (Relocate_functions::pcrel_unaligned): Ditto.
1873 (Relocate_functions::rel32_unaligned): Ditto.
1874 (Relocate_functions::pcrel32_unaligned): Ditto.
1875
1876 2011-11-09 Doug Kwan <dougkwan@google.com>
1877
1878 PR gold/13362
1879 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1880 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1881 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1882 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1883 (Relocate_functions::rel_unaligned): New.
1884 (Relocate_functions::rel32_unaligned): New.
1885 * target-reloc.h (relocate_for_relocatable): Add code to handle
1886 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1887 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1888 arm_unaligned_reloc_r): New targets.
1889 * testsuite/Makefile.in: Regenerate.
1890 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1891 linking.
1892
1893 2011-11-02 Ian Lance Taylor <iant@google.com>
1894
1895 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1896 NATIVE_LINKER.
1897 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1898 * options.cc (General_options::finalize): Use library search path
1899 from configure script if specified. If not native and no sysroot,
1900 only search TOOLLIBDIR.
1901 * options.h (Search_directory::Search_directory): Change name to
1902 const std::string&.
1903 (General_options::add_to_library_path_with_sysroot): Change arg to
1904 const std::string&.
1905 * configure, Makefile.in, config.in: Rebuild.
1906
1907 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1908
1909 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1910 we are working around the ARM1176 Erratum.
1911 * options.h (General_options::fix_arm1176): Add option.
1912 * testsuite/Makefile.am: Add testcases, and keep current ones
1913 working.
1914 * testsuite/Makefile.in: Regenerate.
1915 * testsuite/arm_fix_1176.s: New file.
1916 * testsuite/arm_fix_1176.sh: Likewise.
1917
1918 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1919
1920 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1921 may_use_blx_.
1922 (Target_arm::may_use_blx): Remove method.
1923 (Target_arm::set_may_use_blx): Likewise.
1924 (Target_arm::may_use_v4t_interworking): New method.
1925 (Target_arm::may_use_v5t_interworking): Likewise.
1926 (Target_arm::may_use_blx_): Remove member variable.
1927 (Arm_relocate_functions::arm_branch_common): Check for v5T
1928 interworking.
1929 (Arm_relocate_functions::thumb_branch_common): Likewise.
1930 (Reloc_stub::stub_type_for_reloc): Likewise.
1931 (Target_arm::do_finalize_sections): Correct interworking checks.
1932 * testsuite/Makefile.am: Add new tests.
1933 * testsuite/Makefile.in: Regenerate.
1934 * testsuite/arm_farcall_arm_arm.s: New test.
1935 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1936 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1937 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1938 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1939 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1940 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1941 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1942
1943 2011-10-31 Cary Coutant <ccoutant@google.com>
1944
1945 PR gold/13023
1946 * expression.cc (Expression::eval_with_dot): Add
1947 is_section_dot_assignment parameter.
1948 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1949 absolute and assigning to dot within a section.
1950 * script-sections.cc
1951 (Output_section_element_assignment::set_section_addresses): Pass
1952 dot_section to set_if_absolute.
1953 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1954 as is_section_dot_assignment flag to eval_with_dot.
1955 (Output_section_element_dot_assignment::set_section_addresses):
1956 Likewise.
1957 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1958 parameter. Also set value if relative to dot_section; set the
1959 symbol's output_section.
1960 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1961 parameter. Adjust all callers.
1962 (Expression::eval_maybe_dot): Likewise.
1963 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1964 Adjust all callers.
1965 * testsuite/script_test_2.t: Test assignment of an absolute value
1966 to dot within an output section element.
1967
1968 2011-10-31 Cary Coutant <ccoutant@google.com>
1969
1970 * options.h (class General_options): Add --[no-]gnu-unique options.
1971 * symtab.cc (Symbol_table::sized_write_globals): Convert
1972 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1973
1974 2011-10-31 Cary Coutant <ccoutant@google.com>
1975
1976 PR gold/13359
1977 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1978 unnecessary assertion.
1979 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1980
1981 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1982
1983 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1984 gc_mark_symbol.
1985 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1986 gc_mark_symbol.
1987 Change to just keep the section associated with symbol.
1988 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1989 they are externally visible and --export-dynamic is turned on.
1990 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1991
1992 2011-10-19 Ian Lance Taylor <iant@google.com>
1993
1994 PR gold/13163
1995 * script-sections.cc
1996 (Output_section_element_dot_assignment::needs_output_section): New
1997 function.
1998
1999 2011-10-19 Ian Lance Taylor <iant@google.com>
2000
2001 PR gold/13204
2002 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2003 --section-start option was seen.
2004 * options.h (General_options::any_section_start): New function.
2005
2006 2011-10-18 David S. Miller <davem@davemloft.net>
2007
2008 PR binutils/13301
2009 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2010 member to track relocation locations that have moved during TLS
2011 reloc optimizations.
2012 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2013 (Target_sparc::Relocate::relocate): Adjust view down by 4
2014 bytes if it matches reloc_adjust_addr_.
2015 (Target_sparc::Relocate::relocate_tls): Always move the
2016 __tls_get_addr call delay slot instruction forward 4 bytes when
2017 performing relaxation.
2018
2019 2011-10-18 Cary Coutant <ccoutant@google.com>
2020
2021 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2022 (Output_file::map_no_anonymous): Check for non-zero
2023 return code from posix_fallocate.
2024
2025 2011-10-17 Cary Coutant <ccoutant@google.com>
2026
2027 PR gold/13245
2028 * plugin.cc (is_visible_from_outside): Check for symbols
2029 referenced from dynamic objects.
2030 * resolve.cc (Symbol_table::resolve): Don't count references
2031 from dynamic objects as references from real ELF files.
2032 * testsuite/plugin_test_2.sh: Adjust expected result.
2033
2034 2011-10-17 Cary Coutant <ccoutant@google.com>
2035
2036 * gold.cc: Include timer.h.
2037 (queue_middle_tasks): Stamp time.
2038 (queue_final_tasks): Likewise.
2039 * main.cc (main): Store timer in parameters. Print timers
2040 for each pass.
2041 * parameters.cc (Parameters::Parameters): Initialize timer_.
2042 (Parameters::set_timer): New function.
2043 (set_parameters_timer): New function.
2044 * parameters.h (Parameters::set_timer): New function.
2045 (Parameters::timer): New function.
2046 (Parameters::timer_): New data member.
2047 (set_parameters_timer): New function.
2048 * timer.cc (Timer::stamp): New function.
2049 (Timer::get_pass_time): New function.
2050 * timer.h (Timer::stamp): New function.
2051 (Timer::get_pass_time): New function.
2052 (Timer::pass_times_): New data member.
2053
2054 2011-10-17 Cary Coutant <ccoutant@google.com>
2055
2056 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2057 task for members of lib groups.
2058
2059 2011-10-17 Cary Coutant <ccoutant@google.com>
2060
2061 PR gold/13288
2062 * fileread.cc (File_read::find_view): Add assert.
2063 (File_read::make_view): Move bounds check (replace with assert)...
2064 (File_read::find_or_make_view): ... to here.
2065
2066 2011-10-12 Cary Coutant <ccoutant@google.com>
2067
2068 * output.cc (Output_file::open_base_file): Handle case where
2069 ::read returns less than requested size.
2070
2071 2011-10-10 Cary Coutant <ccoutant@google.com>
2072
2073 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2074 Initialize defined_count_.
2075 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2076 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2077 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2078 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2079 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2080 * incremental.h (Sized_relobj_incr::defined_count_): New data
2081 member.
2082 (Sized_incr_dynobj::defined_count_): New data member.
2083 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2084 Return zeroes instead of internal error.
2085
2086 2011-10-10 Cary Coutant <ccoutant@google.com>
2087
2088 PR gold/13249
2089 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2090 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2091 * output.h (class Output_reloc): Add use_plt_offset flag.
2092 (Output_reloc::type_): Adjust size of bit field.
2093 (Output_reloc::use_plt_offset_): New bit field.
2094 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2095 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2096 flag. Adjust all callers.
2097 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2098 creating RELATIVE relocations.
2099
2100 2011-10-10 Nick Clifton <nickc@redhat.com>
2101
2102 * po/es.po: Updated Spanish translation.
2103 * po/fi.po: Updated Finnish translation.
2104
2105 2011-10-03 Diego Novillo <dnovillo@google.com>
2106
2107 * options.cc (parse_uint): Fix dereference of RETVAL.
2108
2109 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2110
2111 * layout.h (section_order_map_): New member.
2112 (get_section_order_map): New member function.
2113 * output.cc (Output_section::add_input_section): Check for patterns
2114 only when --section-ordering-file is specified.
2115 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2116 output_sections have been formed.
2117 * layout.cc (Layout_Layout): Initialize section_order_map_.
2118 * plugin.cc (update_section_order): Store order in order_map. Do not
2119 update the order.
2120 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2121 * testsuite/Makefile.in: Regenerate.
2122 * testsuite/plugin_section_order.c: New file.
2123 * testsuite/plugin_final_layout.cc: New file.
2124 * testsuite/plugin_final_layout.sh: New file.
2125
2126 2011-09-29 Cary Coutant <ccoutant@google.com>
2127
2128 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2129 Check for NULL.
2130 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2131 symbols during incremental update.
2132 (Symbol_table::add_from_dynobj): Likewise.
2133
2134 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2135 Ian Lance Taylor <iant@google.com>
2136
2137 * symtab.cc (Symbol_table::define_special_symbol): Always
2138 canonicalize version string.
2139
2140 2011-09-26 Cary Coutant <ccoutant@google.com>
2141
2142 * gold.cc (queue_initial_tasks): Move option checks ...
2143 * options.cc (General_options::finalize): ... to here. Disable
2144 some options; make others fatal.
2145
2146 2011-09-26 Cary Coutant <ccoutant@google.com>
2147
2148 gcc PR lto/47247
2149 * plugin.cc (get_symbols_v2): New function.
2150 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2151 (is_referenced_from_outside): New function.
2152 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2153 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2154 (get_symbols): Pass version parameter.
2155 (get_symbols_v2): New function.
2156 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2157 parameter.
2158 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2159 (onload): Add LDPT_GET_SYMBOLS_V2.
2160 (all_symbols_read_hook): Use get_symbols_v2; check for
2161 LDPR_PREVAILING_DEF_IRONLY_EXP.
2162 * testsuite/plugin_test_3.sh: Update expected results.
2163
2164 2011-09-23 Simon Baldwin <simonb@google.com>
2165
2166 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2167 configuration options.
2168 * configure: Regenerate.
2169 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2170 * Makefile.in: Regenerate.
2171 * testsuite/Makefile.in: Regenerate.
2172
2173 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2174
2175 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2176
2177 2011-09-19 Cary Coutant <ccoutant@google.com>
2178
2179 * incremental.cc (can_incremental_update): Fix typo in comment.
2180 * incremental.h (can_incremental_update): Likewise.
2181
2182 2011-09-18 Cary Coutant <ccoutant@google.com>
2183
2184 * incremental.cc (can_incremental_update): New function.
2185 * incremental.h (can_incremental_update): New function.
2186 * layout.cc (Layout::init_fixed_output_section): Call it.
2187 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2188 * object.cc (Sized_relobj_file::do_layout): Call
2189 can_incremental_update.
2190
2191 2011-09-13 Cary Coutant <ccoutant@google.com>
2192
2193 * configure.ac: Check for glibc support for gnu_indirect_function
2194 support with static linking, setting automake conditional
2195 IFUNC_STATIC.
2196 * Makefile.in: Regenerate.
2197 * configure: Regenerate.
2198
2199 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2200 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2201 for IFUNC_STATIC.
2202 * testsuite/Makefile.in: Regenerate.
2203
2204 2011-09-13 Cary Coutant <ccoutant@google.com>
2205
2206 * incremental.cc (Sized_relobj_incr::do_layout): Call
2207 report_comdat_group for kept comdat sections.
2208 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2209 * testsuite/Makefile.in: Regenerate.
2210 * testsuite/incr_comdat_test_1.cc: New source file.
2211 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2212 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2213 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2214
2215 2011-09-13 Ian Lance Taylor <iant@google.com>
2216
2217 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2218 variable external_symbols_offset.
2219
2220 2011-09-12 Ian Lance Taylor <iant@google.com>
2221
2222 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2223 triggered if object has no symbols.
2224
2225 2011-09-09 David S. Miller <davem@davemloft.net>
2226
2227 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2228 (Output_fill_debug_line::do_write): Likewise.
2229
2230 2011-08-29 Cary Coutant <ccoutant@google.com>
2231
2232 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2233 casts to match formatting specs.
2234 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2235
2236 2011-08-26 Cary Coutant <ccoutant@google.com>
2237
2238 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2239 remaining hole size when allocating.
2240 (Layout::make_output_section): Set fill methods for debug sections.
2241 * layout.h (Free_list::Free_list_node): Move from private to
2242 public.
2243 (Free_list::set_min_hole_size): New function.
2244 (Free_list::begin, Free_list::end): New functions.
2245 (Free_list::min_hole_): New data member.
2246 * output.cc: Include dwarf.h.
2247 (Output_fill_debug_info::do_minimum_hole_size): New function.
2248 (Output_fill_debug_info::do_write): New function.
2249 (Output_fill_debug_line::do_minimum_hole_size): New function.
2250 (Output_fill_debug_line::do_write): New function.
2251 (Output_section::Output_section): Initialize new data member.
2252 (Output_section::set_final_data_size): Ensure patch space is larger
2253 than minimum hole size.
2254 (Output_section::do_write): Fill holes in debug sections.
2255 * output.h (Output_fill): New class.
2256 (Output_fill_debug_info): New class.
2257 (Output_fill_debug_line): New class.
2258 (Output_section::set_free_space_fill): New function.
2259 (Output_section::free_space_fill_): New data member.
2260 * testsuite/Makefile.am (incremental_test_3): Add
2261 --incremental-patch option.
2262 (incremental_test_4): Likewise.
2263 (incremental_test_5): Likewise.
2264 (incremental_test_6): Likewise.
2265 (incremental_copy_test): Likewise.
2266 (incremental_common_test_1): Likewise.
2267 * testsuite/Makefile.in: Regenerate.
2268
2269 2011-08-26 Nick Clifton <nickc@redhat.com>
2270
2271 * po/es.po: Updated Spanish translation.
2272
2273 2011-08-01 Cary Coutant <ccoutant@google.com>
2274
2275 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2276 * gold/testsuite/Makefile.in: Regenerate.
2277 * gold/testsuite/justsyms_exec.c: New source file.
2278 * gold/testsuite/justsyms_lib.c: New source file.
2279
2280 2011-08-01 Cary Coutant <ccoutant@google.com>
2281
2282 * layout.cc (Layout::set_segment_offsets): Don't realign text
2283 segment if -Ttext was specified.
2284 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2285 file type.
2286 * object.h (Sized_relobj_file::e_type): New function.
2287 (Sized_relobj_file::e_type_): New data member.
2288 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2289 base address for ET_EXEC files.
2290 * target.cc (Target::do_make_elf_object_implementation): Allow
2291 ET_EXEC files with --just-symbols option.
2292
2293 2011-07-28 Cary Coutant <ccoutant@google.com>
2294
2295 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2296 Add thread_number parameter.
2297 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2298 * workqueue-threads.cc
2299 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2300 current thread if its thread number is greater than desired thread
2301 count.
2302 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2303 Add thread_number parameter.
2304 (Workqueue::should_cancel_thread): Likewise.
2305 (Workqueue::find_runnable_or_wait): Pass thread_number to
2306 should_cancel_thread.
2307 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2308 parameter.
2309
2310 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2311
2312 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2313 only after checking if it cannot be forced local.
2314 * symtab.h (is_externally_visible): Check if the symbol is not forced
2315 local.
2316
2317 2011-07-15 Ian Lance Taylor <iant@google.com>
2318
2319 * options.h (class General_options): Add --print-output-format.
2320 Move -EL next to -EB, for better --help output.
2321 * target-select.cc: Include <cstdio>, "options.h", and
2322 "parameters.h".
2323 (Target_selector::do_target_bfd_name): New function.
2324 (print_output_format): New function.
2325 * target-select.h (class Target_selector): Update declarations.
2326 (Target_selector::target_bfd_name): New function.
2327 (print_output_format): Declare.
2328 * main.cc: Include "target-select.h".
2329 (main): Handle --print-output-format.
2330 * gold.cc: Include "target-select.h".
2331 (queue_initial_tasks): Handle --print-output-format when there are
2332 no input files.
2333 * parameters.cc (parameters_force_valid_target): Give a better
2334 error message if -EB/-EL does not match target.
2335 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2336 function.
2337
2338 2011-07-15 Ian Lance Taylor <iant@google.com>
2339
2340 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2341 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2342 (Output_data_plt_i386::do_write): Write address of .dynamic
2343 section to first entry in .got.plt section.
2344 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2345 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2346 Initialize layout_.
2347 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2348 section to first entry in .got.plt section.
2349 * layout.h (Layout::dynamic_section): New function.
2350
2351 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2352
2353 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2354 to claim_file call.
2355 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2356 input_section_position_, and input_section_glob_.
2357 (read_layout_from_file): Call function section_ordering_specified.
2358 * layout.h (is_section_ordering_specified): New function.
2359 (section_ordering_specified): New function.
2360 (section_ordering_specified_): New boolean member.
2361 * main.cc(main): Call load_plugins after layout object is defined.
2362 * output.cc (Output_section::add_input_section): Use
2363 function section_ordering_specified to check if section ordering is
2364 needed.
2365 * output.cc (Output_section::add_relaxed_input_section): Use
2366 function section_ordering_specified to check if section ordering is
2367 needed.
2368 (Output_section::update_section_layout): New function.
2369 (Output_section::sort_attached_input_sections): Check if input section
2370 must be reordered.
2371 * output.h (Output_section::update_section_layout): New function.
2372 * plugin.cc (get_section_count): New function.
2373 (get_section_type): New function.
2374 (get_section_name): New function.
2375 (get_section_contents): New function.
2376 (update_section_order): New function.
2377 (allow_section_ordering): New function.
2378 (Plugin::load): Add the new interfaces to the transfer vector.
2379 (Plugin_manager::load_plugins): New parameter.
2380 (Plugin_manager::all_symbols_read): New parameter.
2381 (Plugin_manager::claim_file): New parameter. Save the elf object for
2382 unclaimed objects.
2383 (Plugin_manager::get_elf_object): New function.
2384 (Plugin_manager::get_view): Change to directly use the bool to check
2385 if get_view is called from claim_file_hook.
2386 * plugin.h (input_objects): New function
2387 (Plugin__manager::load_plugins): New parameter.
2388 (Plugin_manager::claim_file): New parameter.
2389 (Plugin_manager::get_elf_object): New function.
2390 (Plugin_manager::in_claim_file_handler): New function.
2391 (Plugin_manager::in_claim_file_handler_): New member.
2392 (layout): New function.
2393 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2394 handler with an extra parameter. Make the elf object before calling
2395 claim_file handler.
2396 * testsuite/plugin_test.c (get_section_count): New function pointer.
2397 (get_section_type): New function pointer.
2398 (get_section_name): New function pointer.
2399 (get_section_contents): New function pointer.
2400 (update_section_order): New function pointer.
2401 (allow_section_ordering): New function pointer.
2402 (onload): Check if the new interfaces exist.
2403
2404 2011-07-13 Ian Lance Taylor <iant@google.com>
2405
2406 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2407 relro section.
2408 * x86_64.cc (Target_x86_64::got_section): Likewise.
2409 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2410 (relro_now_test_SOURCES): New variable.
2411 (relro_now_test_DEPENDENCIES): New variable.
2412 (relro_now_test_LDFLAGS): New variable.
2413 (relro_now_test_LDADD): New variable.
2414 (relro_now_test.so): New target.
2415 * testsuite/Makefile.in: Rebuild.
2416
2417 2011-07-12 Ian Lance Taylor <iant@google.com>
2418
2419 PR gold/12980
2420 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2421 GLOB_DAT relocation rather than a RELATIVE relocation for a
2422 protected symbol when creating a shared library.
2423 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2424 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2425 * testsuite/protected_main_1.cc (main): Test that protected
2426 function has same address.
2427
2428 2011-07-11 Ian Lance Taylor <iant@google.com>
2429
2430 PR gold/12979
2431 * options.h (class General_options): Add -Bgroup.
2432 * options.cc (General_options::finalize): If -Bgroup is set,
2433 default to --unresolved-symbols=report-all.
2434 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2435 * target-reloc.h (issue_undefined_symbol_error): Handle
2436 --unresolved-symbols=report-all.
2437
2438 2011-07-08 Ian Lance Taylor <iant@google.com>
2439
2440 PR gold/11985
2441 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2442 if linker script discards key sections.
2443 (Layout::create_dynamic_symtab): Likewise.
2444 (Layout::assign_local_dynsym_offsets): Likewise.
2445 (Layout::sized_create_version_sections): Likewise.
2446 (Layout::create_interp): Likewise.
2447 (Layout::finish_dynamic_section): Likewise.
2448 (Layout::set_dynamic_symbol_size): Likewise.
2449
2450 2011-07-08 Ian Lance Taylor <iant@google.com>
2451
2452 PR gold/12386
2453 * options.h (class General_options): Add --unresolved-symbols.
2454 * target-reloc.h (issue_undefined_symbol_error): Check
2455 --unresolved-symbols. Add comments.
2456
2457 2011-07-08 Ian Lance Taylor <iant@google.com>
2458
2459 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2460 expression more complex.
2461
2462 2011-07-08 Ian Lance Taylor <iant@google.com>
2463
2464 PR gold/11317
2465 * target-reloc.h (issue_undefined_symbol_error): New inline
2466 function, broken out of relocate_section.
2467 (relocate_section): Call issue_undefined_symbol_error.
2468 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2469 there is no TLS segment if we are about to issue an undefined
2470 symbol error.
2471 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2472
2473 2011-07-08 Ian Lance Taylor <iant@google.com>
2474
2475 PR gold/12279
2476 * resolve.cc (Symbol_table::should_override): Add fromtype
2477 parameter. Change all callers. Give error when linking together
2478 TLS and non-TLS symbol.
2479 (Symbol_table::should_override_with_special): Add fromtype
2480 parameter. Change all callers.
2481 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2482 there is no TLS segment if we have reported some errors.
2483 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2484
2485 2011-07-08 Ian Lance Taylor <iant@google.com>
2486
2487 PR gold/12372
2488 * target.h (Target::plt_address_for_global): New function.
2489 (Target::plt_address_for_local): New function.
2490 (Target::plt_section_for_global): Remove.
2491 (Target::plt_section_for_local): Remove.
2492 (Target::do_plt_address_for_global): New virtual function.
2493 (Target::do_plt_address_for_local): New virtual function.
2494 (Target::do_plt_section_for_global): Remove.
2495 (Target::do_plt_section_for_local): Remove.
2496 (Target::register_global_plt_entry): Add Symbol_table and Layout
2497 parameters.
2498 * output.cc (Output_data_got::Got_entry::write): Use
2499 plt_address_for_global and plt_address_for_local.
2500 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2501 address of output section.
2502 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2503 got_irelative_, and irelative_count_ fields. Update
2504 declarations.
2505 (Output_data_plt_i386::has_irelative_section): New function.
2506 (Output_data_plt_i386::entry_count): Add irelative_count_.
2507 (Output_data_plt_i386::set_final_data_size): Likewise.
2508 (class Target_i386): Add got_irelative_ and rel_irelative_
2509 fields. Update declarations.
2510 (Target_i386::Target_i386): Initialize new fields.
2511 (Target_i386::do_plt_address_for_global): New function replacing
2512 do_plt_section_for_global.
2513 (Target_i386::do_plt_address_for_local): New function replacing
2514 do_plt_section_for_local.
2515 (Target_i386::got_section): Create got_irelative_.
2516 (Target_i386::rel_irelative_section): New function.
2517 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2518 fields. Don't define __rel_iplt_{start,end}.
2519 (Output_data_plt_i386::add_entry): Add symtab and layout
2520 parameters. Change all callers. Use different PLT and GOT for
2521 IFUNC symbols.
2522 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2523 layout parameters. Change all callers. Use different PLT and
2524 GOT.
2525 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2526 (Output_data_plt_i386::rel_irelative): New function.
2527 (Output_data_plt_i386::address_for_global): New function.
2528 (Output_data_plt_i386::address_for_local): New function.
2529 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2530 IRELATIVE GOT when changing IFUNC GOT entries.
2531 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2532 reloc.
2533 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2534 if we didn't create an IRELATIVE GOT.
2535 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2536 plt_address_for_local.
2537 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2538 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2539 got_irelative_, and irelative_count_ fields. Update
2540 declarations.
2541 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2542 Initialize new fields. Remove symtab parameter. Change all
2543 callers.
2544 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2545 irelative_count_.
2546 (Output_data_plt_x86_64::has_irelative_section): New function.
2547 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2548 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2549 fields. Update declarations.
2550 (Target_x86_64::Target_x86_64): Initialize new fields.
2551 (Target_x86_64::do_plt_address_for_global): New function replacing
2552 do_plt_section_for_global.
2553 (Target_x86_64::do_plt_address_for_local): New function replacing
2554 do_plt_section_for_local.
2555 (Target_x86_64::got_section): Create got_irelative_.
2556 (Target_x86_64::rela_irelative_section): New function.
2557 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2558 all callers. Don't create __rel_iplt_{start,end}.
2559 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2560 parameters. Change all callers. Use different PLT and GOT for
2561 IFUNC symbols.
2562 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2563 layout parameters. Change all callers. Use different PLT and
2564 GOT.
2565 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2566 parameters. Change all callers. Use different PLT and GOT for
2567 IFUNC symbols.
2568 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2569 (Output_data_plt_x86_64::rela_irelative): New function.
2570 (Output_data_plt_x86_64::address_for_global): New function.
2571 (Output_data_plt_x86_64::address_for_local): New function.
2572 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2573 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2574 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2575 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2576 parameters.
2577 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2578 reloc.
2579 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2580 symbols if we didn't create an IRELATIVE GOT.
2581 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2582 plt_address_for_local.
2583 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2584 * testsuite/ifuncvar1.c: New test file.
2585 * testsuite/ifuncvar2.c: New test file.
2586 * testsuite/ifuncvar3.c: New test file.
2587 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2588 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2589 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2590 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2591 * testsuite/Makefile.in: Rebuild.
2592
2593 2011-07-07 Cary Coutant <ccoutant@google.com>
2594
2595 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2596 (two_file_test_1_ndebug.o): Likewise.
2597 (two_file_test_1b_ndebug.o): Likewise.
2598 (two_file_test_2_ndebug.o): Likewise.
2599 (two_file_test_main_ndebug.o): Likewise.
2600 (incremental_test_2): Link with no-debug versions.
2601
2602 2011-07-06 Cary Coutant <ccoutant@google.com>
2603
2604 * gold/incremental.cc
2605 (Output_section_incremental_inputs::write_info_blocks): Check for
2606 hidden and internal symbols.
2607
2608 2011-07-06 Cary Coutant <ccoutant@google.com>
2609
2610 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2611 Check disposition for startup file.
2612 (Incremental_inputs::report_command_line): Ignore
2613 --incremental-startup-unchanged option.
2614 * options.cc (General_options::parse_incremental_startup_unchanged):
2615 New function.
2616 (General_options::General_options): Initialize new data member.
2617 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2618 (General_options): Add --incremental-startup-unchanged option.
2619 (General_options::incremental_startup_disposition): New function.
2620 (General_options::incremental_startup_disposition_): New data member.
2621
2622 2011-07-06 Cary Coutant <ccoutant@google.com>
2623
2624 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2625 input file index to Script_info ctor.
2626 (Sized_incremental_binary::do_file_has_changed): Find the
2627 command-line argument for files named in scripts.
2628 * incremental.h (Script_info::Script_info): New ctor
2629 with input file index.
2630 (Script_info::input_file_index): New function.
2631 (Script_info::input_file_index_): New data member.
2632 (Incremental_binary::get_library): Add const.
2633 (Incremental_binary::get_script_info): Add const.
2634 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2635 * testsuite/Makefile.am (incremental_test_5): New test case.
2636 (incremental_test_6): New test case.
2637 * testsuite/Makefile.in: Regenerate.
2638
2639 2011-07-06 Cary Coutant <ccoutant@google.com>
2640
2641 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2642 debug output when command lines differ.
2643
2644 2011-07-06 Cary Coutant <ccoutant@google.com>
2645
2646 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2647 --incremental-patch option.
2648 * layout.cc (Free_list::allocate): Extend allocation beyond original
2649 end if enabled.
2650 (Layout::make_output_section): Mark sections that should get
2651 patch space.
2652 * options.cc (parse_percent): New function.
2653 * options.h (parse_percent): New function.
2654 (DEFINE_percent): New macro.
2655 (General_options): Add --incremental-patch option.
2656 * output.cc (Output_section::Output_section): Initialize new data
2657 members.
2658 (Output_section::add_input_section): Print section name when out
2659 of patch space.
2660 (Output_section::add_output_section_data): Likewise.
2661 (Output_section::set_final_data_size): Add patch space when
2662 doing --incremental-full.
2663 (Output_section::do_reset_address_and_file_offset): Remove patch
2664 space.
2665 (Output_segment::set_section_list_addresses): Print debug output
2666 only if --incremental-update.
2667 * output.h (Output_section::set_is_patch_space_allowed): New function.
2668 (Output_section::is_patch_space_allowed_): New data member.
2669 (Output_section::patch_space_): New data member.
2670 * parameters.cc (Parameters::incremental_full): New function.
2671 * parameters.h (Parameters::incremental_full): New function
2672 * testsuite/Makefile.am (incremental_test_2): Add test for
2673 --incremental-patch option.
2674 * testsuite/Makefile.in: Regenerate.
2675 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2676 (t18): Remove function body.
2677
2678 2011-07-05 Doug Kwan <dougkwan@google.com>
2679
2680 PR gold/12771
2681 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2682 Arm_Address type for relocation result.
2683 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2684 overflow check.
2685 (Arm_relocate_functions::abs32): Use unaligned access.
2686 (Arm_relocate_functions::rel32): Ditto.
2687 (Arm_relocate_functions::prel31): Ditto.
2688 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2689 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2690 static data relocations.
2691 * testsuite/Makefile.in: Regnerate.
2692 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2693
2694 2011-07-05 Ian Lance Taylor <iant@google.com>
2695
2696 PR gold/12392
2697 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2698 symbols if necessary.
2699 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2700
2701 2011-07-05 Ian Lance Taylor <iant@google.com>
2702
2703 PR gold/12952
2704 * resolve.cc (Symbol::override_base_with_special): Simply override
2705 version with special symbol version, ignoring previous version.
2706
2707 2011-07-05 Ian Lance Taylor <iant@google.com>
2708
2709 * object.cc (Sized_relobj_file::include_section_group): Add
2710 information to comment about signature location.
2711
2712 2011-07-02 Ian Lance Taylor <iant@google.com>
2713
2714 PR gold/12957
2715 * options.h (class General_options): Add -f and -F.
2716 * options.cc (General_options::finalize): Fatal error if -f/-F
2717 are used without -shared.
2718 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2719
2720 2011-07-02 Ian Lance Taylor <iant@google.com>
2721
2722 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2723
2724 2011-07-01 Ian Lance Taylor <iant@google.com>
2725
2726 PR gold/12525
2727 PR gold/12952
2728 * resolve.cc (Symbol::override_base_with_special): Don't override
2729 the version if the overriding symbol has a different name.
2730 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2731 all callers. If we give an error about an undefined version,
2732 define the base version if necessary.
2733 * dynobj.h (class Versions): Update declaration.
2734 * testsuite/weak_alias_test_5.cc: New file.
2735 * testsuite/weak_alias_test.script: New file.
2736 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2737 and versioned_alias have the right value, and call t2.
2738 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2739 weak_alias_test_5.so.
2740 (weak_alias_test_LDADD): Likewise.
2741 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2742 * testsuite/Makefile.in: Rebuild.
2743
2744 2011-07-01 Ian Lance Taylor <iant@google.com>
2745
2746 PR gold/12525
2747 * options.h (class General_options): Support -z notext.
2748 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2749 -Wl,-z,notext.
2750 (two_file_shared_nonpic.so): Likewise.
2751 (two_file_shared_mixed.so): Likewise.
2752 (two_file_shared_mixed_1.so): Likewise.
2753 (weak_undef_lib_nonpic.so): Likewise.
2754 (alt/weak_undef_lib_nonpic.so): Likewise.
2755 (tls_test_shared_nonpic.so): Likewise.
2756 * testsuite/Makefile.in: Rebuild.
2757
2758 2011-07-01 Ian Lance Taylor <iant@google.com>
2759
2760 PR gold/12525
2761 * configure.ac: Test whether static linking works, setting
2762 the automake conditional HAVE_STATIC.
2763 * testsuite/Makefile.am: Disable tests using -static if
2764 HAVE_STATIC is not true.
2765 * configure, testsuite/Makefile.in: Rebuild.
2766
2767 2011-07-01 Ian Lance Taylor <iant@google.com>
2768
2769 PR gold/12525
2770 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2771 Assert if we see DW_EH_PE_indirect.
2772 * target.h (Target::ehframe_datarel_base): New function.
2773 (Target::do_ehframe_datarel_base): New target function.
2774 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2775 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2776 function.
2777
2778 2011-07-01 Ian Lance Taylor <iant@google.com>
2779
2780 PR gold/12571
2781 * options.h (class General_options): Add
2782 --ld-generated-unwind-info.
2783 * ehframe.cc (Fde::write): Add address parameter. Change all
2784 callers. If associated with PLT, fill in address and size.
2785 (Cie::set_output_offset): Only add merge mapping if there is an
2786 object.
2787 (Cie::write): Add address parameter. Change all callers.
2788 (Eh_frame::add_ehframe_for_plt): New function.
2789 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2790 input_offset_ fields into union u_, with new plt field.
2791 (Fde::Fde): Adjust for new union field.
2792 (Fde::Fde) [Output_data version]: New constructor.
2793 (Fde::add_mapping): Only add merge mapping if there is an object.
2794 (class Cie): Update declarations.
2795 (class Eh_frame): Declare add_ehframe_for_plt.
2796 * layout.cc (Layout::layout_eh_frame): Break out code into
2797 make_eh_frame_section, and call it.
2798 (Layout::make_eh_frame_section): New function.
2799 (Layout::add_eh_frame_for_plt): New function.
2800 * layout.h (class Layout): Update declarations.
2801 * merge.cc (Merge_map::add_mapping): Add assertion.
2802 * i386.cc: Include "dwarf.h".
2803 (class Output_data_plt_i386): Make first_plt_entry,
2804 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2805 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2806 and plt_eh_frame_fde.
2807 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2808 boundary. Call add_eh_frame_for_plt if appropriate.
2809 * x86_64.cc: Include "dwarf.h".
2810 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2811 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2812 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2813 and plt_eh_frame_fde.
2814 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2815 appropriate.
2816
2817 2011-06-29 Ian Lance Taylor <iant@google.com>
2818
2819 PR gold/12629
2820 * object.cc (Sized_relobj_file::layout_section): Change shdr
2821 parameter to be const.
2822 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2823 out of do_layout.
2824 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2825 appropriate. Call layout_eh_frame_section.
2826 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2827 sections.
2828 * object.h (class Sized_relobj_file): Update declarations.
2829
2830 2011-06-29 Ian Lance Taylor <iant@google.com>
2831
2832 PR gold/12652
2833 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2834 modifier.
2835 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2836
2837 2011-06-29 Ian Lance Taylor <iant@google.com>
2838
2839 PR gold/12675
2840 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2841 SHT_X86_64_UNWIND.
2842 * layout.cc (Layout::layout_eh_frame): Likewise.
2843
2844 2011-06-29 Ian Lance Taylor <iant@google.com>
2845
2846 PR gold/12695
2847 * layout.cc (Layout::symtab_section_shndx): New function.
2848 * layout.h (class Layout): Declare symtab_section_shndx.
2849 * output.cc (Output_section::write_header): Call it.
2850
2851 2011-06-29 Ian Lance Taylor <iant@google.com>
2852
2853 PR gold/12818
2854 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2855 symbols which are not used in a relocation.
2856
2857 2011-06-28 Ian Lance Taylor <iant@google.com>
2858
2859 PR gold/12898
2860 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2861 script create indistinguishable segments.
2862 (Layout::set_segment_offsets): Use stable_sort when sorting
2863 segments. Pass this to Compare_segments constructor.
2864 * layout.h (class Layout): Make segment_precedes non-static.
2865 (class Compare_segments): Change from struct to class. Add
2866 layout_ field. Add constructor.
2867 * script-sections.cc
2868 (Script_sections::attach_sections_using_phdrs_clause): Rename
2869 local orphan to is_orphan. Don't report failure to put empty
2870 section in segment. On attachment failure, report name of
2871 section, and attach to first PT_LOAD segment.
2872
2873 2011-06-28 Ian Lance Taylor <iant@google.com>
2874
2875 PR gold/12934
2876 * target-select.cc (Target_selector::Target_selector): Add
2877 emulation parameter. Change all callers.
2878 (select_target_by_bfd_name): Rename from select_target_by_name.
2879 Change all callers.
2880 (select_target_by_emulation): New function.
2881 (supported_emulation_names): New function.
2882 * target-select.h (class Target_selector): Add emulation_ field.
2883 Update declarations.
2884 (Target_selector::recognize_by_bfd_name): Rename from
2885 recognize_by_name. Change all callers.
2886 (Target_selector::supported_bfd_names): Rename from
2887 supported_names. Change all callers.
2888 (Target_selector::recognize_by_emulation): New function.
2889 (Target_selector::supported_emulations): New function.
2890 (Target_selector::emulation): New function.
2891 (Target_selector::do_recognize_by_bfd_name): Rename from
2892 do_recognize_by_name. Change all callers.
2893 (Target_selector::do_supported_bfd_names): Rename from
2894 do_supported_names. Change all callers.
2895 (Target_selector::do_recognize_by_emulation): New function.
2896 (Target_selector::do_supported_emulations): New function.
2897 (select_target_by_bfd_name): Change name in declaration.
2898 (select_target_by_emulation): Declare.
2899 (supported_emulation_names): Declare.
2900 * parameters.cc (parameters_force_valid_target): Try to find
2901 target based on emulation from -m option.
2902 * options.h (class General_options): Change doc string for -m.
2903 * options.cc (help): Print emulations.
2904 (General_options::parse_V): Likewise.
2905 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2906 Add emulation parameter. Change all callers.
2907
2908 2011-06-28 Ian Lance Taylor <iant@google.com>
2909
2910 * target.h (class Target): Add osabi_ field.
2911 (Target::osabi): New function.
2912 (Target::set_osabi): New function.
2913 (Target::Target): Initialize osabi_.
2914 (Target::do_adjust_elf_header): Make pure virtual.
2915 (Sized_target::do_adjust_elf_header): Declare.
2916 * target.cc (Sized_target::do_adjust_elf_header): New function.
2917 (class Sized_target): Instantiate all versions.
2918 * freebsd.h (class Target_freebsd): Remove.
2919 (Target_selector_freebsd::do_recognize): Call set_osabi on
2920 Target.
2921 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2922 (Target_selector_freebsd::set_osabi): Remove.
2923 * i386.cc (class Target_i386): Inherit from Sized_target rather
2924 than Target_freebsd.
2925 * x86_64.cc (class Target_x86_64): Likewise.
2926
2927 2011-06-28 Ian Lance Taylor <iant@google.com>
2928
2929 * target.h (Target::can_check_for_function_pointers): Rewrite.
2930 Make non-virtual.
2931 (Target::can_icf_inline_merge_sections): Likewise.
2932 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2933 (Target::Target_info): Add can_icf_inline_merge_sections field.
2934 (Target::do_can_check_for_function_pointers): New virtual
2935 function.
2936 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2937 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2938 from can_check_for_function_pointers, move in file.
2939 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2940 section_may_have_icf_unsafe_poineters, move in file.
2941 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2942 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2943 Rename from can_check_for_function_pointers, move in file.
2944 (Target_i386::can_icf_inline_merge_sections): Remove.
2945 (Target_i386::i386_info): Initialize
2946 can_icf_inline_merge_sections.
2947 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2948 Initialize can_icf_inline_merge_sections.
2949 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2950 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2951 Rename from can_check_for_function_pointers, move in file.
2952 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2953 (Target_x86_64::x86_64_info): Initialize
2954 can_icf_inline_merge_sections.
2955 * testsuite/testfile.cc (Target_test::test_target_info):
2956 Likewise.
2957 * icf.cc (get_section_contents): Correct formatting.
2958
2959 2011-06-27 Ian Lance Taylor <iant@google.com>
2960
2961 * symtab.cc (Symbol::versioned_name): New function.
2962 (Symbol_table::add_to_final_symtab): Use versioned_name when
2963 appropriate.
2964 (Symbol_table::sized_write_symbol): Likewise.
2965 * symtab.h (class Symbol): Declare versioned_name.
2966 * stringpool.h (class Stringpool_template): Add variant of add
2967 which takes a std::basic_string.
2968 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2969 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2970 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2971 (ver_test_12.o): New target.
2972 * testsuite/Makefile.in: Rebuild.
2973
2974 2011-06-27 Doug Kwan <dougkwan@google.com>
2975
2976 * arm.cc (Arm_relocate_functions::thm_jump8,
2977 Arm_relocate_functions::thm_jump11): Use a wider signed
2978 type to compute offset.
2979 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2980 arm_thm_jump8.
2981 * testsuite/Makefile.in: Regenerate.
2982 * testsuite/arm_branch_in_range.sh: Check test results of
2983 arm_thm_jump11 and arm_thm_jump8.
2984 * testsuite/arm_thm_jump11.s: New test source file.
2985 * testsuite/arm_thm_jump11.t: New linker script.
2986 * testsuite/arm_thm_jump8.s: New test source file.
2987 * testsuite/arm_thm_jump8.t: New linker script.
2988
2989 2011-06-24 Ian Lance Taylor <iant@google.com>
2990
2991 * layout.cc: Include "object.h".
2992 (ctors_sections_in_init_array): New static variable.
2993 (Layout::is_ctors_in_init_array): New function.
2994 (Layout::layout): Add entry to ctors_sections_in_init_array if
2995 appropriate.
2996 * layout.h (class Layout): Declare is_ctors_in_init_array.
2997 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2998 is_ctors_reverse_view is set.
2999 (Sized_relobj_file::write_sections): Add layout parameter. Change
3000 all callers. Set is_ctors_reverse_view field of View_size.
3001 (Sized_relobj_file::reverse_words): New function.
3002 * object.h (Sized_relobj_file::View_size): Add
3003 is_ctors_reverse_view field.
3004 (class Sized_relobj_file): Update declarations.
3005 * testsuite/initpri3.c: New test.
3006 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3007 initpri3b.
3008 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3009 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3010 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3011 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3012 * testsuite/Makefile.in: Rebuild.
3013
3014 2011-06-24 Cary Coutant <ccoutant@google.com>
3015
3016 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3017 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3018 (debug_msg_cdebug.err): New targets.
3019 * testsuite/Makefile.in: Regenerate.
3020 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3021 Fix checks for link with shared library.
3022
3023 2011-06-24 Doug Kwan <dougkwan@google.com>
3024
3025 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3026 skip empty text sections.
3027 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3028
3029 2011-06-22 Ian Lance Taylor <iant@google.com>
3030
3031 PR gold/12910
3032 * options.h (class General_options): Add --ctors-in-init-array.
3033 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3034 friends as SHT_PROGBITS for merging sections.
3035 (Layout::layout): Remove special handling of .init_array and
3036 friends. Don't sort if doing relocatable link. Sort for .ctors
3037 and .dtors if ctors_in_init_array.
3038 (Layout::make_output_section): Force correct section types for
3039 .init_array and friends. Don't sort if doing relocatable link,
3040 Don't sort .ctors and .dtors if ctors_in_init_array.
3041 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3042 (Layout::output_section_name): Add relobj parameter. Change all
3043 callers. Handle .ctors. and .dtors. in code rather than table.
3044 Handle .ctors and .dtors if ctors_in_init_array.
3045 (Layout::match_file_name): New function, moved from output.cc.
3046 * layout.h (class Layout): Update declarations.
3047 * output.cc: Include "layout.h".
3048 (Input_section_sort_entry::get_priority): New function.
3049 (Input_section_sort_entry::match_file_name): Just call
3050 Layout::match_file_name.
3051 (Output_section::Input_section_sort_init_fini_compare::operator()):
3052 Handle .ctors and .dtors. Sort by explicit priority rather than
3053 by name.
3054 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3055 * testsuite/initpri2.c: New test.
3056 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3057 (check_PROGRAMS): Add initpri2.
3058 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3059 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3060 * configure, testsuite/Makefile.in: Rebuild.
3061
3062 2011-06-19 Ian Lance Taylor <iant@google.com>
3063
3064 PR gold/12880
3065 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3066 .interp section to a PT_INTERP segment even if we have seen a
3067 --dynamic-linker option. Don't do it if we have seen a PHDRS
3068 clause in a linker script.
3069 (Layout::finalize): Don't create a .interp section if we've
3070 already create a PT_INTERP segment.
3071 (Layout::create_interp): Always call choose_output_section (revert
3072 patch of 2011-06-17). Don't create PT_INTERP segment.
3073 * script-sections.cc
3074 (Script_sections::create_note_and_tls_segments): Add a .interp
3075 section to a PT_INTERP segment even if we have seen a
3076 --dynamic-linker option.
3077
3078 2011-06-18 Ian Lance Taylor <iant@google.com>
3079
3080 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3081 merely because a non-PT_LOAD segment has a dynamic reloc.
3082
3083 2011-06-18 Ian Lance Taylor <iant@google.com>
3084
3085 * layout.cc (Layout::finish_dynamic_section): Don't create
3086 DT_FLAGS entry if not needed.
3087
3088 2011-06-18 Ian Lance Taylor <iant@google.com>
3089
3090 PR gold/12745
3091 * layout.cc (Layout::layout_eh_frame): Correct handling of
3092 writable .eh_frame section.
3093
3094 2011-06-17 Ian Lance Taylor <iant@google.com>
3095
3096 PR gold/12893
3097 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3098 symbol is redefined with the exact same object and value.
3099
3100 2011-06-17 Ian Lance Taylor <iant@google.com>
3101
3102 PR gold/12880
3103 * layout.h (class Layout): Add interp_segment_ field.
3104 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3105 (Layout::attach_allocated_section_to_segment): If making shared
3106 library, put .interp section in PT_INTERP segment.
3107 (Layout::finalize): Also call create_interp if -dynamic-linker
3108 option was used.
3109 (Layout::create_interp): Assert that there is no PT_INTERP
3110 segment. If not using a SECTIONS clause, use make_output_section.
3111 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3112 * script-sections.cc
3113 (Script_sections::create_note_and_tls_segments): If making shared
3114 library, put .interp section in PT_INTERP segment.
3115
3116 2011-06-17 Ian Lance Taylor <iant@google.com>
3117
3118 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3119 when making a shared library.
3120
3121 2011-06-17 Ian Lance Taylor <iant@google.com>
3122
3123 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3124 parameter. Change all callers. Don't issue warning about PC32
3125 against locally defined symbol.
3126
3127 2011-06-16 Ian Lance Taylor <iant@google.com>
3128
3129 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3130 occurs in same object.
3131
3132 2011-06-14 Alan Modra <amodra@gmail.com>
3133
3134 * po/POTFILES.in: Regenerate.
3135
3136 2011-06-09 Ian Lance Taylor <iant@google.com>
3137
3138 * script-sections.cc
3139 (Orphan_output_section::set_section_addresses): For a relocatable
3140 link set address to 0.
3141
3142 2011-06-09 Cary Coutant <ccoutant@google.com>
3143
3144 PR gold/12804
3145 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3146 used with --compress-debug-sections.
3147 * gold/object.cc (Sized_relobj_file::do_layout): Report
3148 uncompressed size of compressed input sections.
3149
3150 2011-06-08 Cary Coutant <ccoutant@google.com>
3151
3152 PR gold/12804
3153 * testsuite/two_file_test_2_v1.cc: Change initialization of
3154 v2 to keep it in .data.
3155
3156 2011-06-07 Cary Coutant <ccoutant@google.com>
3157
3158 * common.cc (Symbol_table::do_allocate_commons_list): Call
3159 gold_fallback.
3160 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3161 (Errors::fallback): New function.
3162 (gold_fallback): New function.
3163 * errors.h (Errors::fallback): New function.
3164 * gold.cc (gold_exit): Change status parameter to enum; adjust
3165 all callers.
3166 (queue_initial_tasks): Call gold_fallback.
3167 * gold.h: Include cstdlib.
3168 (Exit_status): New enum type.
3169 (gold_exit): Change status parameter to enum.
3170 (gold_fallback): New function.
3171 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3172 (Layout::create_symtab_sections): Likewise.
3173 (Layout::create_shdrs): Likewise.
3174 * main.cc (main): Adjust call to gold_exit.
3175 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3176 (Output_data_got::add_got_entry_pair): Likewise.
3177 (Output_section::add_input_section): Likewise.
3178 (Output_section::add_output_section_data): Likewise.
3179 (Output_segment::set_section_list_addresses): Likewise.
3180 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3181
3182 2011-06-07 Cary Coutant <ccoutant@google.com>
3183
3184 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3185 for incremental links.
3186 * output.cc (Output_segment::set_section_list_addresses): Remove
3187 FIXME and test for TLS or BSS.
3188
3189 2011-06-07 Cary Coutant <ccoutant@google.com>
3190
3191 * testsuite/Makefile.am: Add incremental_copy_test,
3192 incremental_common_test_1.
3193 * testsuite/Makefile.in: Regenerate.
3194 * testsuite/common_test_1_v1.c: New source file.
3195 * testsuite/common_test_1_v2.c: New source file.
3196 * testsuite/copy_test_v1.cc: New source file.
3197
3198 2011-06-07 Cary Coutant <ccoutant@google.com>
3199
3200 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3201 update, allocate common from bss section's free list.
3202 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3203 linker-defined symbols.
3204 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3205 Skip GOT and PLT entries that are no longer referenced.
3206 (Output_section_incremental_inputs::write_info_blocks): Mark
3207 linker-defined symbols.
3208 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3209 * output.cc (Output_section::allocate): New function.
3210 * output.h (Output_section::allocate): New function.
3211 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3212 linker-defined symbols.
3213 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3214 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3215 (Symbol::init_base_output_data): Likewise.
3216 (Symbol::init_base_output_segment): Likewise.
3217 (Symbol::init_base_constant): Likewise.
3218 (Sized_symbol::init_output_data): Likewise.
3219 (Sized_symbol::init_output_segment): Likewise.
3220 (Sized_symbol::init_constant): Likewise.
3221 (Symbol_table::do_define_in_output_data): Likewise.
3222 (Symbol_table::do_define_in_output_segment): Likewise.
3223 (Symbol_table::do_define_as_constant): Likewise.
3224 * symtab.h (Symbol::is_predefined): New function.
3225 (Symbol::init_base_output_data): Add is_predefined parameter.
3226 (Symbol::init_base_output_segment): Likewise.
3227 (Symbol::init_base_constant): Likewise.
3228 (Symbol::is_predefined_): New data member.
3229 (Sized_symbol::init_output_data): Add is_predefined parameter.
3230 (Sized_symbol::init_output_segment): Likewise.
3231 (Sized_symbol::init_constant): Likewise.
3232 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3233
3234 2011-06-07 Cary Coutant <ccoutant@google.com>
3235
3236 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3237 instead of emit_copy_reloc.
3238 (Copy_relocs::emit_copy_reloc): Refactor.
3239 (Copy_relocs::make_copy_reloc): New function.
3240 (Copy_relocs::add_copy_reloc): Remove.
3241 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3242 section.
3243 (Copy_relocs::make_copy_reloc): New function.
3244 (Copy_relocs::add_copy_reloc): Remove.
3245 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3246 unchanged input files.
3247 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3248 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3249 Reserve BSS space for COPY relocations.
3250 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3251 (Output_section_incremental_inputs::write_info_blocks): Record
3252 whether a symbol is copied from a shared object.
3253 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3254 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3255 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3256 (Incremental_input_entry_reader::get_output_symbol_index): Add
3257 is_copy parameter.
3258 (Incremental_binary::emit_copy_relocs): New function.
3259 (Incremental_binary::do_emit_copy_relocs): New function.
3260 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3261 new data member.
3262 (Sized_incremental_binary::add_copy_reloc): New function.
3263 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3264 (Sized_incremental_binary::Copy_reloc): New struct.
3265 (Sized_incremental_binary::Copy_relocs): New typedef.
3266 (Sized_incremental_binary::copy_relocs_): New data member.
3267 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3268 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3269 * target.h (Sized_target::emit_copy_reloc): New function.
3270 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3271
3272 2011-06-02 Cary Coutant <ccoutant@google.com>
3273
3274 PR gold/12163
3275 * gold/archive.cc (Archive::Archive): Initialize new data member.
3276 (Archive::include_all_members): Return if archive has already been
3277 included.
3278 * gold/archive.h (Archive::include_all_members_): New data member.
3279
3280 2011-06-02 Nick Clifton <nickc@redhat.com>
3281
3282 * dynobj.h: Fix spelling mistake in comment.
3283 * output.cc: Likewise.
3284
3285 2011-05-31 Doug Kwan <dougkwan@google.com>
3286 Asier Llano
3287
3288 PR gold/12826
3289 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3290 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3291 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3292 redundant arm_exidx_test.so.
3293 * testsuite/Makefile.in: Regenerate.
3294 (check_SCRIPTS): Add pr12826.sh
3295 (check_DATA): Add pr12826.stdout
3296 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3297 * testsuite/pr12826.sh: New file.
3298 * testsuite/pr12826_1.s: Ditto.
3299 * testsuite/pr12826_1.s: Ditto.
3300
3301 2011-05-30 Ian Lance Taylor <iant@google.com>
3302
3303 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3304 sections.
3305
3306 2011-05-29 Ian Lance Taylor <iant@google.com>
3307
3308 PR gold/12804
3309 * testsuite/Makefile.am: Use different file name for two_file_test
3310 temporary file for each incremental test.
3311 * testsuite/Makefile.in: Rebuild.
3312
3313 2011-05-29 Ian Lance Taylor <iant@google.com>
3314
3315 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3316 binary input file is empty.
3317
3318 2011-05-27 Ian Lance Taylor <iant@google.com>
3319
3320 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3321 (ver_test_9.so): Likewise.
3322 * testsuite/Makefile.in: Rebuild.
3323
3324 2011-05-26 Cary Coutant <ccoutant@google.com>
3325
3326 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3327 * incremental.cc (Incremental_inputs::report_input_section): Fix
3328 comment, indentation.
3329 (Incremental_inputs::report_comdat_group): New function.
3330 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3331 of data for incremental input file entry.
3332 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3333 group count, COMDAT group signatures.
3334 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3335 an unchanged input file.
3336 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3337 Initialize new data member.
3338 (Incremental_object_entry::add_comdat_group): New function.
3339 (Incremental_object_entry::get_comdat_group_count): New function.
3340 (Incremental_object_entry::get_comdat_signature_key): New function.
3341 (Incremental_object_entry::groups_): New data member.
3342 (Incremental_inputs::report_comdat_group): New function.
3343 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3344 data for incremental input file entry.
3345 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3346 (Incremental_input_entry_reader::get_input_section): Adjust size of
3347 data for incremental input file entry.
3348 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3349 (Incremental_input_entry_reader::get_comdat_group_signature): New
3350 function.
3351 * object.cc (Sized_relobj::include_section_group): Report kept
3352 COMDAT groups for incremental links.
3353
3354 2011-05-24 David Meyer <pdox@google.com>
3355
3356 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3357 with name parameter. Add found_name parameter.
3358 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3359 * dirsearch.h (class Dirsearch): Update declaration.
3360
3361 2011-05-24 Ian Lance Taylor <iant@google.com>
3362
3363 * archive.cc (Library_base::should_include_member): Pull in object
3364 from archive if it defines the entry symbol.
3365 * parameters.cc (Parameters::entry): New function.
3366 * parameters.h (class Parameters): Declare entry.
3367 * output.h (class Output_file_header): Remove entry_ field.
3368 * output.cc (Output_file_header::Output_file_header): Remove entry
3369 parameter. Change all callers.
3370 (Output_file_header::entry): Use parameters->entry.
3371 * gold.cc (queue_middle_tasks): Likewise.
3372 * plugin.cc (Plugin_hook::run): Likewise.
3373
3374 2011-05-24 Cary Coutant <ccoutant@google.com>
3375
3376 * gold.cc (queue_initial_tasks): Pass incremental base filename
3377 to Output_file::open_base_file; don't print error message.
3378 * incremental-dump.cc (main): Adjust call to
3379 Output_file::open_for_modification.
3380 * incremental-dump.cc (main): Likewise.
3381 * incremental.cc (Incremental_inputs::report_command_line):
3382 Ignore --incremental-base option when comparing command lines.
3383 Ignore parameter when given as separate argument.
3384 * options.h (class General_options): Add --incremental-base.
3385 * output.cc (Output_file::Output_file):
3386 (Output_file::open_base_file): Add base_name and writable parameters;
3387 read base file into new file; print error message here.
3388 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3389 callers.
3390 * output.h (Output_file::open_for_modification): Rename to...
3391 (Output_file::open_base_file): ...this; add base_name and
3392 writable parameters; adjust all callers.
3393 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3394 callers.
3395 * testsuite/Makefile.am (incremental_test_4): Test
3396 --incremental-base.
3397 * testsuite/Makefile.in: Regenerate.
3398
3399 2011-05-24 Cary Coutant <ccoutant@google.com>
3400
3401 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3402 incremental_test_4.
3403 * testsuite/Makefile.in: Regenerate.
3404 * testsuite/two_file_test_1_v1.cc: New test source file.
3405 * testsuite/two_file_test_1b_v1.cc: New test source file.
3406 * testsuite/two_file_test_2_v1.cc: New test source file.
3407
3408 2011-05-24 Cary Coutant <ccoutant@google.com>
3409
3410 * dynobj.h (Dynobj::do_dynobj): New function.
3411 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3412 flag and soname for shared objects.
3413 * incremental.cc (Incremental_inputs::report_object): Make
3414 either Incremental_object_entry or Incremental_dynobj_entry; add
3415 soname to string table.
3416 (Incremental_inputs::report_input_section): Add assertion.
3417 (Output_section_incremental_inputs::set_final_data_size): Adjust
3418 type of input file entry for shared libraries; adjust size of
3419 shared library info entry.
3420 (Output_section_incremental_inputs::write_input_files): Write
3421 as_needed flag for shared libraries.
3422 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3423 of input file entry for shared libraries; write soname.
3424 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3425 soname from incremental info.
3426 * incremental.h (enum Incremental_input_flags): Add
3427 INCREMENTAL_INPUT_AS_NEEDED.
3428 (Incremental_input_entry::Incremental_input_entry): Initialize new
3429 data member.
3430 (Incremental_input_entry::set_as_needed): New function.
3431 (Incremental_input_entry::as_needed): New function.
3432 (Incremental_input_entry::do_dynobj_entry): New function.
3433 (Incremental_input_entry::as_needed_): New data member.
3434 (Incremental_object_entry::Incremental_object_entry): Don't check
3435 for shared library.
3436 (Incremental_object_entry::do_type): Likewise.
3437 (class Incremental_dynobj_entry): New class.
3438 (Incremental_input_entry_reader::as_needed): New function.
3439 (Incremental_input_entry_reader::get_soname): New function.
3440 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3441 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3442 size of shared library info entry.
3443 * layout.cc (Layout::finish_dynamic_section): Don't test for
3444 incremental link when adding DT_NEEDED entries.
3445 * object.h (Object::Object): Initialize new data member.
3446 (Object::dynobj): New function.
3447 (Object::set_as_needed): New function.
3448 (Object::as_needed): New function.
3449 (Object::do_dynobj): New function.
3450 (Object::as_needed_): New data member.
3451
3452 2011-05-24 Cary Coutant <ccoutant@google.com>
3453
3454 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3455 info; adjust display of GOT entries.
3456 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3457 vector of input objects; remove file_status_.
3458 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3459 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3460 got_plt reader; call target hooks to reserve GOT entries.
3461 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3462 of input file info header and GOT info entry.
3463 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3464 relocation info.
3465 (Got_plt_view_info::got_descriptor): Remove.
3466 (Got_plt_view_info::sym_index): New data member.
3467 (Got_plt_view_info::input_index): New data member.
3468 (Local_got_offset_visitor::visit): Write input file index.
3469 (Global_got_offset_visitor::visit): Write 0 for input file index.
3470 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3471 with sym_index and input_index.
3472 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3473 incremental info GOT entry; replace got_descriptor with input_index.
3474 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3475 map from input file index to object.
3476 (Sized_relobj_incr::do_layout): Replace direct data member reference
3477 with accessor function.
3478 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3479 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3480 Adjust size of input file info header.
3481 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3482 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3483 (Incremental_input_entry_reader::get_input_section): Adjust size of
3484 input file info header.
3485 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3486 of incremental info GOT entry.
3487 (Incremental_got_plt_reader::get_got_desc): Remove.
3488 (Incremental_got_plt_reader::get_got_symndx): New function.
3489 (Incremental_got_plt_reader::get_got_input_index): New function.
3490 (Sized_incremental_binary::Sized_incremental_binary): Remove
3491 file_status_; add input_objects_.
3492 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3493 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3494 (Sized_incremental_binary::file_is_unchanged): Remove.
3495 (Sized_incremental_binary::set_input_object): New function.
3496 (Sized_incremental_binary::input_object): New function.
3497 (Sized_incremental_binary::file_status_): Remove.
3498 (Sized_incremental_binary::input_objects_): New data member.
3499 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3500 references.
3501 (Sized_relobj_incr::invalid_address): Move to base class.
3502 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3503 class.
3504 (Sized_relobj_incr::do_output_section_offset): Likewise.
3505 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3506 (Sized_relobj_incr::section_offsets_): Likewise.
3507 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3508 function.
3509 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3510 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3511 with accessor function.
3512 (Sized_relobj_file::do_layout): Likewise.
3513 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3514 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3515 (Sized_relobj_file::compute_final_local_value): Replace refs to
3516 section_offsets_ with accessor function.
3517 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3518 * object.h (Relobj::Relobj): Initialize new data members.
3519 (Relobj::add_dyn_reloc): New function.
3520 (Relobj::first_dyn_reloc): New function.
3521 (Relobj::dyn_reloc_count): New function.
3522 (Relobj::first_dyn_reloc_): New data member.
3523 (Relobj::dyn_reloc_count_): New data member.
3524 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3525 references.
3526 (Sized_relobj::Address): New typedef.
3527 (Sized_relobj::invalid_address): Move here from child class.
3528 (Sized_relobj::Sized_relobj): Initialize new data members.
3529 (Sized_relobj::sized_relobj): New function.
3530 (Sized_relobj::is_output_section_offset_invalid): Move here from
3531 child class.
3532 (Sized_relobj::get_output_section_offset): Likewise.
3533 (Sized_relobj::local_has_got_offset): Likewise.
3534 (Sized_relobj::local_got_offset): Likewise.
3535 (Sized_relobj::set_local_got_offset): Likewise.
3536 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3537 (Sized_relobj::clear_got_offsets): New function.
3538 (Sized_relobj::section_offsets): Move here from child class.
3539 (Sized_relobj::do_output_section_offset): Likewise.
3540 (Sized_relobj::do_set_section_offset): Likewise.
3541 (Sized_relobj::Local_got_offsets): Likewise.
3542 (Sized_relobj::local_got_offsets_): Likewise.
3543 (Sized_relobj::section_offsets_): Likewise.
3544 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3545 references.
3546 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3547 class.
3548 (Sized_relobj_file::sized_relobj): New function
3549 (Sized_relobj_file::local_has_got_offset): Move to base class.
3550 (Sized_relobj_file::local_got_offset): Likewise.
3551 (Sized_relobj_file::set_local_got_offset): Likewise.
3552 (Sized_relobj_file::get_output_section_offset): Likewise.
3553 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3554 (Sized_relobj_file::do_output_section_offset): Likewise.
3555 (Sized_relobj_file::do_set_section_offset): Likewise.
3556 (Sized_relobj_file::Local_got_offsets): Likewise.
3557 (Sized_relobj_file::local_got_offsets_): Likewise.
3558 (Sized_relobj_file::section_offsets_): Likewise.
3559 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3560 (all constructors).
3561 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3562 (Output_reloc::get_symbol_index): Likewise.
3563 (Output_reloc::local_section_offset): Likewise.
3564 (Output_reloc::get_address): Likewise.
3565 (Output_reloc::symbol_value): Likewise.
3566 (Output_data_got::reserve_slot): Move to class definition.
3567 (Output_data_got::reserve_local): New function.
3568 (Output_data_got::reserve_slot_for_global): Remove.
3569 (Output_data_got::reserve_global): New function.
3570 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3571 (all constructors, two instantiations).
3572 (Output_reloc::get_relobj): New function (two instantiations).
3573 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3574 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3575 (Output_data_reloc::add_global): Adjust type of relobj.
3576 (Output_data_reloc::add_global_relative): Likewise.
3577 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3578 (Output_data_reloc::add_local): Likewise.
3579 (Output_data_reloc::add_local_relative): Likewise.
3580 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3581 (Output_data_reloc::add_local_section): Likewise.
3582 (Output_data_reloc::add_output_section): Likewise.
3583 (Output_data_reloc::add_absolute): Likewise.
3584 (Output_data_reloc::add_target_specific): Likewise.
3585 (Output_data_got::reserve_slot): Move definition here.
3586 (Output_data_got::reserve_local): New function.
3587 (Output_data_got::reserve_global): New function.
3588 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3589 section_offsets_ with accessor function.
3590 (Sized_relobj_file::write_sections): Likewise.
3591 (Sized_relobj_file::do_relocate_sections): Likewise.
3592 * target.h (Sized_target::reserve_local_got_entry): New function.
3593 (Sized_target::reserve_global_got_entry): New function.
3594 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3595 (Target_x86_64::reserve_global_got_entry): New function.
3596 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3597
3598 2011-05-23 Cary Coutant <ccoutant@google.com>
3599
3600 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3601 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3602 bit when checking got_type.
3603 * incremental.cc (Sized_incremental_binary::setup_readers):
3604 Store symbol table and string table locations; initialize bit vector
3605 of file status flags.
3606 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3607 unchanged files.
3608 (Sized_incremental_binary::do_process_got_plt): New function.
3609 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3610 (Output_section_incremental_inputs::set_final_data_size): Record
3611 file index for each input file.
3612 (Output_section_incremental_inputs::write_got_plt): Store file index
3613 instead of input entry offset for each GOT entry.
3614 * incremental.h
3615 (Incremental_input_entry::Incremental_input_entry): Initialize new
3616 data member.
3617 (Incremental_input_entry::set_offset): Store file index.
3618 (Incremental_input_entry::get_file_index): New function.
3619 (Incremental_input_entry::file_index_): New data member.
3620 (Incremental_binary::process_got_plt): New function.
3621 (Incremental_binary::do_process_got_plt): New function.
3622 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3623 data members.
3624 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3625 (Sized_incremental_binary::set_file_is_unchanged): New function.
3626 (Sized_incremental_binary::file_is_unchanged): New function.
3627 (Sized_incremental_binary::do_process_got_plt): New function.
3628 (Sized_incremental_binary::file_status_): New data member.
3629 (Sized_incremental_binary::main_symtab_loc_): New data member.
3630 (Sized_incremental_binary::main_strtab_loc_): New data member.
3631 * output.cc (Output_data_got::Got_entry::write): Add case
3632 RESERVED_CODE.
3633 (Output_data_got::add_global): Call add_got_entry.
3634 (Output_data_got::add_global_plt): Likewise.
3635 (Output_data_got::add_global_with_rel): Likewise.
3636 (Output_data_got::add_global_with_rela): Likewise.
3637 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3638 (Output_data_got::add_global_pair_with_rela): Likewise.
3639 (Output_data_got::add_local): Call add_got_entry.
3640 (Output_data_got::add_local_plt): Likewise.
3641 (Output_data_got::add_local_with_rel): Likewise.
3642 (Output_data_got::add_local_with_rela): Likewise.
3643 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3644 (Output_data_got::add_local_pair_with_rela): Likewise.
3645 (Output_data_got::reserve_slot): New function.
3646 (Output_data_got::reserve_slot_for_global): New function.
3647 (Output_data_got::add_got_entry): New function.
3648 (Output_data_got::add_got_entry_pair): New function.
3649 (Output_section::add_output_section_data): Edit FIXME.
3650 * output.h
3651 (Output_section_data_build::Output_section_data_build): New
3652 constructor with size parameter.
3653 (Output_data_space::Output_data_space): Likewise.
3654 (Output_data_got::Output_data_got): Initialize new data member; new
3655 constructor with size parameter.
3656 (Output_data_got::add_constant): Call add_got_entry.
3657 (Output_data_got::reserve_slot): New function.
3658 (Output_data_got::reserve_slot_for_global): New function.
3659 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3660 (Output_data_got::add_got_entry): New function.
3661 (Output_data_got::add_got_entry_pair): New function.
3662 (Output_data_got::free_list_): New data member.
3663 * target.h (Sized_target::init_got_plt_for_update): New function.
3664 (Sized_target::register_global_plt_entry): New function.
3665 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3666 Initialize new data member; call init; add constructor with PLT count.
3667 (Output_data_plt_x86_64::init): New function.
3668 (Output_data_plt_x86_64::add_relocation): New function.
3669 (Output_data_plt_x86_64::reserve_slot): New function.
3670 (Output_data_plt_x86_64::free_list_): New data member.
3671 (Target_x86_64::init_got_plt_for_update): New function.
3672 (Target_x86_64::register_global_plt_entry): New function.
3673 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3674 incremental updates.
3675 (Output_data_plt_x86_64::add_relocation): New function.
3676 * testsuite/object_unittest.cc (Object_test): Set default options.
3677
3678 2011-05-16 Ian Lance Taylor <iant@google.com>
3679
3680 * options.h (class General_options): Make -i a synonym for -r.
3681
3682 2011-05-16 Ian Lance Taylor <iant@google.com>
3683
3684 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3685
3686 2011-05-10 Cary Coutant <ccoutant@google.com>
3687
3688 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3689 strip_all (-s).
3690
3691 2011-05-06 Ian Lance Taylor <iant@google.com>
3692
3693 * layout.cc (Layout::layout): If the output section flags change,
3694 update the ordering.
3695
3696 2011-04-25 Cary Coutant <ccoutant@google.com>
3697
3698 * incremental-dump.cc (dump_incremental_inputs): Print local
3699 symbol info for each input file.
3700 * incremental.cc
3701 (Output_section_incremental_inputs::set_final_data_size): Add local
3702 symbol info to input file entries in incremental info.
3703 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3704 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3705 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3706 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3707 implementation.
3708 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3709 (Sized_incr_relobj::do_relocate): Write the local symbols.
3710 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3711 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3712 Adjust size of input file header.
3713 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3714 (Incremental_inputs_reader::get_local_symbol_count): New function.
3715 (Incremental_inputs_reader::get_input_section): Adjust size of input
3716 file header.
3717 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3718 (Sized_incr_relobj::This): New typedef.
3719 (Sized_incr_relobj::sym_size): New const data member.
3720 (Sized_incr_relobj::Local_symbol): New struct.
3721 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3722 (Sized_incr_relobj::do_local_symbol_offset): New function.
3723 (Sized_incr_relobj::local_symbol_count_): New data member.
3724 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3725 (Sized_incr_relobj::local_symbol_index_): New data member.
3726 (Sized_incr_relobj::local_symbol_offset_): New data member.
3727 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3728 (Sized_incr_relobj::local_symbols_): New data member.
3729 * object.h (Relobj::output_local_symbol_count): New function.
3730 (Relobj::local_symbol_offset): New function.
3731 (Relobj::do_output_local_symbol_count): New function.
3732 (Relobj::do_local_symbol_offset): New function.
3733 (Sized_relobj::do_output_local_symbol_count): New function.
3734 (Sized_relobj::do_local_symbol_offset): New function.
3735
3736 2011-04-22 Vladimir Simonov <sv@sw.ru>
3737
3738 * descriptors.cc (set_close_on_exec): New function.
3739 (Descriptors::open): Use set_close_on_exec.
3740 * output.cc (S_ISLNK): Define if not defined.
3741
3742 2011-04-22 Cary Coutant <ccoutant@google.com>
3743
3744 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3745 global symbol map.
3746 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3747 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3748 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3749 relocations.
3750 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3751 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3752 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3753 * incremental.h
3754 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3755 function.
3756 (Incremental_binary::apply_incremental_relocs): New function.
3757 (Incremental_binary::do_apply_incremental_relocs): New function.
3758 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3759 data member.
3760 (Sized_incremental_binary::add_global_symbol): New function.
3761 (Sized_incremental_binary::global_symbol): New function.
3762 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3763 (Sized_incremental_binary::symbol_map_): New data member.
3764 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3765 * target.h (Sized_target::apply_relocation): New function.
3766 * target-reloc.h (apply_relocation): New function.
3767 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3768
3769 2011-04-22 Doug Kwan <dougkwan@google.com>
3770
3771 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3772 flag of a SHT_ARM_EXIDX section.
3773 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3774 * testsuite/Makefile.in: Regenerate.
3775 * testsuite/arm_exidx_test.s: New file.
3776 * testsuite/arm_exidx_test.sh: Same.
3777
3778 2011-04-20 Cary Coutant <ccoutant@google.com>
3779
3780 PR gold/12689
3781 * archive.h (Incremental_archive_entry::Archive_member):
3782 Initialize arg_serial_ (second constructor).
3783
3784 2011-04-17 Ian Lance Taylor <iant@google.com>
3785
3786 * object.cc (Relocate_info::location): Simplify location string.
3787 * errors.cc (Errors::error_at_location): Don't print program
3788 name.
3789 (Errors::warning_at_location): Likewise.
3790 (Errors::undefined_symbol): Likewise.
3791 * testsuite/debug_msg.sh: Update accordingly.
3792
3793 2011-04-14 Cary Coutant <ccoutant@google.com>
3794
3795 * gold/layout.cc (Layout::symtab_section_offset): New function.
3796 * gold/layout.h (Layout::symtab_section_offset): New function.
3797 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3798
3799 2011-04-12 Ian Lance Taylor <iant@google.com>
3800
3801 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3802 with MREMAP_MAYMOVE.
3803 * output.h (class Output_file): Add map_is_allocated_ field.
3804 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3805 not available, provide stubs. If mremap is not available, #define
3806 it to gold_mremap.
3807 (MREMAP_MAYMOVE): Define if not defined.
3808 (Output_file::Output_file): Initialize map_is_allocated_.
3809 (Output_file::resize): Check map_is_allocated_.
3810 (Output_file::map_anonymous): If mmap fails, use malloc.
3811 (Output_file::unmap): Don't do anything for an anonymous map.
3812 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3813 is not available, provide stubs.
3814 (File_read::View::~View): Use free rather than delete[].
3815 (File_read::make_view): Use malloc rather than new[]. If mmap
3816 fails, use malloc.
3817 (File_read::find_or_make_view): Use malloc rather than new[].
3818 * gold.h: Remove HAVE_REMAP code.
3819 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3820 exists. Rename mremap to gold_mremap. If mmap is not available
3821 don't do anything.
3822 * configure, config.in: Rebuild.
3823
3824 2011-04-11 Ian Lance Taylor <iant@google.com>
3825
3826 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3827 initialize local variable v.
3828
3829 2011-04-11 Cary Coutant <ccoutant@google.com>
3830
3831 * archive.cc (Archive::include_member): Adjust call to
3832 report_object.
3833 (Add_archive_symbols::run): Track argument serial numbers.
3834 (Lib_group::include_member): Likewise.
3835 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3836 * archive.h (Incremental_archive_entry::Archive_member):
3837 Initialize arg_serial_.
3838 (Archive_member::arg_serial_): New data member.
3839 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3840 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3841 incremental link.
3842 (Sized_dynobj::do_for_all_local_got_entries): New function.
3843 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3844 function.
3845 * fileread.cc (get_mtime): New function.
3846 * fileread.h (get_mtime): New function.
3847 * gold.cc (queue_initial_tasks): Check for incremental update.
3848 (process_incremental_input): New function.
3849 (queue_middle_tasks): Don't force valid target for incremental
3850 update.
3851 * incremental-dump.cc (find_input_containing_global): Adjust
3852 size of symbol info entry.
3853 (dump_incremental_inputs): Dump argument serial number and
3854 in_system_directory flag; bias shndx by 1; print symbol names
3855 when dumping per-file symbol lists; use new symbol info readers.
3856 * incremental.cc
3857 (Output_section_incremental_inputs:update_data_size): New function.
3858 (Sized_incremental_binary::setup_readers): Setup input readers
3859 for each input file; build maps for files added from libraries
3860 and scripts.
3861 (Sized_incremental_binary::check_input_args): New function.
3862 (Sized_incremental_binary::do_check_inputs): Build map of argument
3863 serial numbers to input arguments.
3864 (Sized_incremental_binary::do_file_has_changed): Rename
3865 do_file_is_unchanged to this; compare file modification times.
3866 (Sized_incremental_binary::do_init_layout): New function.
3867 (Sized_incremental_binary::do_reserve_layout): New function.
3868 (Sized_incremental_binary::do_get_input_reader): Remove.
3869 (Sized_incremental_binary::get_symtab_view): New function.
3870 (Incremental_checker::can_incrementally_link_output_file): Remove.
3871 (Incremental_inputs::report_command_line): Exclude --debug options.
3872 (Incremental_inputs::report_archive_begin): Add parameter; track
3873 argument serial numbers; don't put input file entry for archive
3874 before archive members.
3875 (Incremental_inputs::report_archive_end): Put input file entry
3876 for archive after archive members.
3877 (Incremental_inputs::report_object): Add parameter; track argument
3878 serial numbers and in_system_directory flag.
3879 (Incremental_inputs::report_script): Add parameter; track argument
3880 serial numbers.
3881 (Output_section_incremental_inputs::set_final_data_size): Adjust
3882 size of symbol info entry; check for forwarding symbols.
3883 (Output_section_incremental_inputs::write_input_files): Write
3884 in_system_directory flag and argument serial number.
3885 (Output_section_incremental_inputs::write_info_blocks): Map section
3886 indices between incremental info and original input file; store
3887 input section index for each symbol.
3888 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3889 change operator() to visit().
3890 (class Global_got_offset_visitor): Likewise.
3891 (class Global_symbol_visitor_got_plt):
3892 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3893 classes.
3894 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3895 (Sized_incr_relobj::do_read_symbols): New function.
3896 (Sized_incr_relobj::do_layout): New function.
3897 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3898 (Sized_incr_relobj::do_add_symbols): New function.
3899 (Sized_incr_relobj::do_should_include_member): New function.
3900 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3901 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3902 (Sized_incr_relobj::do_section_size): New function.
3903 (Sized_incr_relobj::do_section_name): New function.
3904 (Sized_incr_relobj::do_section_contents): New function.
3905 (Sized_incr_relobj::do_section_flags): New function.
3906 (Sized_incr_relobj::do_section_entsize): New function.
3907 (Sized_incr_relobj::do_section_address): New function.
3908 (Sized_incr_relobj::do_section_type): New function.
3909 (Sized_incr_relobj::do_section_link): New function.
3910 (Sized_incr_relobj::do_section_info): New function.
3911 (Sized_incr_relobj::do_section_addralign): New function.
3912 (Sized_incr_relobj::do_initialize_xindex): New function.
3913 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3914 (Sized_incr_relobj::do_read_relocs): New function.
3915 (Sized_incr_relobj::do_gc_process_relocs): New function.
3916 (Sized_incr_relobj::do_scan_relocs): New function.
3917 (Sized_incr_relobj::do_count_local_symbols): New function.
3918 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3919 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3920 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3921 (Sized_incr_relobj::do_relocate): New function.
3922 (Sized_incr_relobj::do_set_section_offset): New function.
3923 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3924 (Sized_incr_dynobj::do_read_symbols): New function.
3925 (Sized_incr_dynobj::do_layout): New function.
3926 (Sized_incr_dynobj::do_add_symbols): New function.
3927 (Sized_incr_dynobj::do_should_include_member): New function.
3928 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3929 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3930 (Sized_incr_dynobj::do_section_size): New function.
3931 (Sized_incr_dynobj::do_section_name): New function.
3932 (Sized_incr_dynobj::do_section_contents): New function.
3933 (Sized_incr_dynobj::do_section_flags): New function.
3934 (Sized_incr_dynobj::do_section_entsize): New function.
3935 (Sized_incr_dynobj::do_section_address): New function.
3936 (Sized_incr_dynobj::do_section_type): New function.
3937 (Sized_incr_dynobj::do_section_link): New function.
3938 (Sized_incr_dynobj::do_section_info): New function.
3939 (Sized_incr_dynobj::do_section_addralign): New function.
3940 (Sized_incr_dynobj::do_initialize_xindex): New function.
3941 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3942 (make_sized_incremental_object): New function.
3943 (Incremental_library::copy_unused_symbols): New function.
3944 (Incremental_library::do_for_all_unused_symbols): New function.
3945 * incremental.h (enum Incremental_input_flags): New type.
3946 (class Incremental_checker): Remove.
3947 (Incremental_input_entry::Incremental_input_entry): Add argument
3948 serial number.
3949 (Incremental_input_entry::arg_serial): New function.
3950 (Incremental_input_entry::set_is_in_system_directory): New function.
3951 (Incremental_input_entry::is_in_system_directory): New function.
3952 (Incremental_input_entry::arg_serial_): New data member.
3953 (Incremental_input_entry::is_in_system_directory_): New data member.
3954 (class Script_info): Move here from script.h.
3955 (Script_info::Script_info): Add filename parameter.
3956 (Script_info::filename): New function.
3957 (Script_info::filename_): New data member.
3958 (Incremental_script_entry::Incremental_script_entry): Add argument
3959 serial number.
3960 (Incremental_object_entry::Incremental_object_entry): Likewise.
3961 (Incremental_object_entry::add_input_section): Build list of input
3962 sections with map to original shndx.
3963 (Incremental_object_entry::get_input_section_index): New function.
3964 (Incremental_object_entry::shndx_): New data member.
3965 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3966 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3967 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3968 serial number.
3969 (Incremental_inputs::report_archive_begin): Likewise.
3970 (Incremental_inputs::report_object): Likewise.
3971 (Incremental_inputs::report_script): Likewise.
3972 (class Incremental_global_symbol_reader): New class.
3973 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3974 and store flags and input file type.
3975 (Incremental_input_entry_reader::arg_serial): New function.
3976 (Incremental_input_entry_reader::type): Extract type from flags.
3977 (Incremental_input_entry_reader::is_in_system_directory): New function.
3978 (Incremental_input_entry_reader::get_input_section_count): Call
3979 accessor function for type.
3980 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3981 function for type; adjust size of global symbol entry.
3982 (Incremental_input_entry_reader::get_global_symbol_count): Call
3983 accessor function for type.
3984 (Incremental_input_entry_reader::get_object_count): Likewise.
3985 (Incremental_input_entry_reader::get_object_offset): Likewise.
3986 (Incremental_input_entry_reader::get_member_count): Likewise.
3987 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3988 (Incremental_input_entry_reader::get_member_offset): Likewise.
3989 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3990 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3991 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3992 (Incremental_input_entry_reader::get_global_symbol_reader): New
3993 function.
3994 (Incremental_input_entry_reader::get_output_symbol_index): New
3995 function.
3996 (Incremental_input_entry_reader::type_): Remove.
3997 (Incremental_input_entry_reader::flags_): New data member.
3998 (Incremental_inputs_reader::input_file_offset): New function.
3999 (Incremental_inputs_reader::input_file_index): New function.
4000 (Incremental_inputs_reader::input_file): Call input_file_offset.
4001 (Incremental_inputs_reader::input_file_at_offset): New function.
4002 (Incremental_relocs_reader::get_r_type): Reformat.
4003 (Incremental_relocs_reader::get_r_shndx): Reformat.
4004 (Incremental_relocs_reader::get_r_offset): Reformat.
4005 (Incremental_relocs_reader::data): New function.
4006 (Incremental_binary::Incremental_binary): Initialize new data members.
4007 (Incremental_binary::check_inputs): Add cmdline parameter.
4008 (Incremental_binary::file_is_unchanged): Remove.
4009 (Input_reader::arg_serial): New function.
4010 (Input_reader::get_unused_symbol_count): New function.
4011 (Input_reader::get_unused_symbol): New function.
4012 (Input_reader::do_arg_serial): New function.
4013 (Input_reader::do_get_unused_symbol_count): New function.
4014 (Input_reader::do_get_unused_symbol): New function.
4015 (Incremental_binary::input_file_count): New function.
4016 (Incremental_binary::get_input_reader): Change signature to use
4017 index instead of filename.
4018 (Incremental_binary::file_has_changed): New function.
4019 (Incremental_binary::get_input_argument): New function.
4020 (Incremental_binary::get_library): New function.
4021 (Incremental_binary::get_script_info): New function.
4022 (Incremental_binary::init_layout): New function.
4023 (Incremental_binary::reserve_layout): New function.
4024 (Incremental_binary::output_file): New function.
4025 (Incremental_binary::do_check_inputs): New function.
4026 (Incremental_binary::do_file_is_unchanged): Remove.
4027 (Incremental_binary::do_file_has_changed): New function.
4028 (Incremental_binary::do_init_layout): New function.
4029 (Incremental_binary::do_reserve_layout): New function.
4030 (Incremental_binary::do_input_file_count): New function.
4031 (Incremental_binary::do_get_input_reader): Change signature.
4032 (Incremental_binary::input_args_map_): New data member.
4033 (Incremental_binary::library_map_): New data member.
4034 (Incremental_binary::script_map_): New data member.
4035 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4036 new data members.
4037 (Sized_incremental_binary::output_section): New function.
4038 (Sized_incremental_binary::inputs_reader): Add const.
4039 (Sized_incremental_binary::symtab_reader): Add const.
4040 (Sized_incremental_binary::relocs_reader): Add const.
4041 (Sized_incremental_binary::got_plt_reader): Add const.
4042 (Sized_incremental_binary::get_symtab_view): New function.
4043 (Sized_incremental_binary::Inputs_reader): New typedef.
4044 (Sized_incremental_binary::Input_entry_reader): New typedef.
4045 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4046 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4047 (Sized_incremental_binary::do_file_has_changed): New function.
4048 (Sized_incremental_binary::do_init_layout): New function.
4049 (Sized_incremental_binary::do_reserve_layout): New function.
4050 (Sized_input_reader::Inputs_reader): Remove.
4051 (Sized_input_reader::Input_entry_reader): Remove.
4052 (Sized_input_reader::do_arg_serial): New function.
4053 (Sized_input_reader::do_get_unused_symbol_count): New function.
4054 (Sized_input_reader::do_get_unused_symbol): New function.
4055 (Sized_incremental_binary::do_input_file_count): New function.
4056 (Sized_incremental_binary::do_get_input_reader): Change signature;
4057 use index instead of filename.
4058 (Sized_incremental_binary::section_map_): New data member.
4059 (Sized_incremental_binary::input_entry_readers_): New data member.
4060 (class Sized_incr_relobj): New class.
4061 (class Sized_incr_dynobj): New class.
4062 (make_sized_incremental_object): New function.
4063 (class Incremental_library): New class.
4064 * layout.cc (Free_list::num_lists): New static data member.
4065 (Free_list::num_nodes): New static data member.
4066 (Free_list::num_removes): New static data member.
4067 (Free_list::num_remove_visits): New static data member.
4068 (Free_list::num_allocates): New static data member.
4069 (Free_list::num_allocate_visits): New static data member.
4070 (Free_list::init): New function.
4071 (Free_list::remove): New function.
4072 (Free_list::allocate): New function.
4073 (Free_list::dump): New function.
4074 (Free_list::print_stats): New function.
4075 (Layout_task_runner::run): Resize output file for incremental updates.
4076 (Layout::Layout): Initialize new data members.
4077 (Layout::set_incremental_base): New function.
4078 (Layout::init_fixed_output_section): New function.
4079 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4080 incremental updates.
4081 (Layout::create_gold_note): Do not create gold note section for
4082 incremental updates.
4083 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4084 for incremental updates.
4085 (Layout::set_section_offsets): For incremental updates, allocate space
4086 from free list.
4087 (Layout::create_symtab_sections): Layout with offsets relative to
4088 start of section; for incremental updates, allocate space from free
4089 list.
4090 (Layout::create_shdrs): For incremental updates, allocate space from
4091 free list.
4092 (Layout::finish_dynamic_section): For incremental updates, do not
4093 check --as-needed (fixed in subsequent patch).
4094 * layout.h (class Free_list): New class.
4095 (Layout::set_incremental_base): New function.
4096 (Layout::incremental_base): New function.
4097 (Layout::init_fixed_output_section): New function.
4098 (Layout::allocate): New function.
4099 (Layout::incremental_base_): New data member.
4100 (Layout::free_list_): New data member.
4101 * main.cc (main): Print Free_list statistics.
4102 * object.cc (Relobj::finalize_incremental_relocs): Add
4103 clear_counts parameter; clear counts only when clear_counts is set.
4104 (Sized_relobj::Sized_relobj): Initialize new base class.
4105 (Sized_relobj::do_layout): Don't report special sections.
4106 (Sized_relobj::do_for_all_local_got_entries): New function.
4107 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4108 symtab_off to all symbol table offsets.
4109 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4110 * object.h (class Got_offset_list): Move to top of file.
4111 (Object::Object): Allow case where input_file == NULL.
4112 (Object::~Object): Likewise.
4113 (Object::input_file): Assert that input_file != NULL.
4114 (Object::lock): Allow case where input_file == NULL.
4115 (Object::unlock): Likewise.
4116 (Object::is_locked): Likewise.
4117 (Object::token): Likewise.
4118 (Object::release): Likewise.
4119 (Object::is_incremental): New function.
4120 (Object::get_mtime): New function.
4121 (Object::for_all_local_got_entries): New function.
4122 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4123 (Object::set_is_in_system_directory): New function.
4124 (Object::is_in_system_directory): New function.
4125 (Object::do_is_incremental): New function.
4126 (Object::do_get_mtime): New function.
4127 (Object::do_for_all_local_got_entries): New function.
4128 (Object::is_in_system_directory_): New data member.
4129 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4130 (class Sized_relobj_base): New class.
4131 (class Sized_relobj): Derive from Sized_relobj_base.
4132 (class Sized_relobj::Symbols): Redeclare from base class.
4133 (class Sized_relobj::local_got_offset_list): Remove.
4134 (class Sized_relobj::Output_sections): Redeclare from base class.
4135 (class Sized_relobj::do_for_all_local_got_entries): New function.
4136 (class Sized_relobj::write_local_symbols): Add offset parameter.
4137 (class Sized_relobj::local_symbol_offset_): Update comment.
4138 (class Sized_relobj::local_dynsym_offset_): Update comment.
4139 * options.cc (Input_arguments::add_file): Remove const.
4140 * options.h (Input_file_argument::Input_file_argument):
4141 Initialize arg_serial_ (all constructors).
4142 (Input_file_argument::set_arg_serial): New function.
4143 (Input_file_argument::arg_serial): New function.
4144 (Input_file_argument::arg_serial_): New data member.
4145 (Input_arguments::Input_arguments): Initialize file_count_.
4146 (Input_arguments::add_file): Remove const.
4147 (Input_arguments::number_of_input_files): New function.
4148 (Input_arguments::file_count_): New data member.
4149 (Command_line::number_of_input_files): Call
4150 Input_arguments::number_of_input_files.
4151 * output.cc (Output_segment_headers::Output_segment_headers):
4152 Set current size.
4153 (Output_section::Input_section::current_data_size): New function.
4154 (Output_section::Output_section): Initialize new data members.
4155 (Output_section::add_input_section): Don't do merge sections for
4156 an incremental link; allocate space from free list for an
4157 incremental update.
4158 (Output_section::add_output_section_data): Allocate space from
4159 free list for an incremental update.
4160 (Output_section::update_data_size): New function.
4161 (Output_section::set_fixed_layout): New function.
4162 (Output_section::reserve): New function.
4163 (Output_segment::set_section_addresses): Remove const.
4164 (Output_segment::set_section_list_addresses): Remove const; allocate
4165 space from free list for an incremental update.
4166 (Output_segment::set_offset): Adjust size of RELRO segment for an
4167 incremental update.
4168 * output.h (Output_data::current_data_size): Move here from
4169 child classes.
4170 (Output_data::pre_finalize_data_size): New function.
4171 (Output_data::update_data_size): New function.
4172 (Output_section_headers::update_data_size): new function.
4173 (Output_section_data_build::current_data_size): Move to Output_data.
4174 (Output_data_strtab::update_data_size): New function.
4175 (Output_section::current_data_size): Move to Output_data.
4176 (Output_section::set_fixed_layout): New function.
4177 (Output_section::has_fixed_layout): New function.
4178 (Output_section::reserve): New function.
4179 (Output_section::update_data_size): New function.
4180 (Output_section::has_fixed_layout_): New data member.
4181 (Output_section::free_list_): New data member.
4182 (Output_segment::set_section_addresses): Remove const.
4183 (Output_segment::set_section_list_addresses): Remove const.
4184 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4185 New function.
4186 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4187 New function.
4188 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4189 parameter when calling Add_symbols constructor; store argument
4190 serial number for members of a lib group.
4191 (Add_symbols::locks): Allow case where token == NULL.
4192 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4193 (Read_member::~Read_member): New function.
4194 (Read_member::is_runnable): New function.
4195 (Read_member::locks): New function.
4196 (Read_member::run): New function.
4197 (Check_script::~Check_script): New function.
4198 (Check_script::is_runnable): New function.
4199 (Check_script::locks): New function.
4200 (Check_script::run): New function.
4201 (Check_library::~Check_library): New function.
4202 (Check_library::is_runnable): New function.
4203 (Check_library::locks): New function.
4204 (Check_library::run): New function.
4205 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4206 (Add_symbols::library_): New data member.
4207 (class Read_member): New class.
4208 (class Check_script): New class.
4209 (class Check_library): New class.
4210 * reloc.cc (Read_relocs::is_runnable): Allow case where
4211 token == NULL.
4212 (Read_relocs::locks): Likewise.
4213 (Scan_relocs::locks): Likewise.
4214 (Relocate_task::locks): Likewise.
4215 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4216 to clear counters.
4217 (Sized_relobj::incremental_relocs_scan): Fix comment.
4218 (Sized_relobj::do_relocate): Pass output file offset to
4219 write_local_symbols.
4220 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4221 from class declaration.
4222 * script.cc (read_input_script): Allocate Script_info; pass
4223 argument serial number to report_script.
4224 * script.h (class Script_info): Move to incremental.h.
4225 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4226 * symtab.h (Symbol_table::add_from_incrobj): New function.
4227 (Symbol_table::set_file_offset): New function.
4228
4229 2011-04-05 Cary Coutant <ccoutant@google.com>
4230
4231 * incremental-dump.cc (dump_incremental_inputs): Change signature
4232 to take a Sized_incremental_binary; change caller. Use readers
4233 in Sized_incremental_binary.
4234 * incremental.cc
4235 (Sized_incremental_binary::find_incremental_inputs_sections):
4236 Rename do_find_incremental_inputs_sections to this.
4237 (Sized_incremental_binary::setup_readers): New function.
4238 (Sized_incremental_binary::do_check_inputs): Check
4239 has_incremental_info_ flag; move setup code to setup_readers;
4240 use input readers.
4241 (Sized_incremental_binary::do_file_is_unchanged): New function.
4242 (Sized_incremental_binary::do_get_input_reader): New function.
4243 * incremental.h (class Incremental_binary): Move to end of file.
4244 (Incremental_binary::file_is_unchanged): New function.
4245 (Incremental_binary::do_file_is_unchanged): New function.
4246 (Incremental_binary::Input_reader): New class.
4247 (Incremental_binary::get_input_reader): New function.
4248 (class Sized_incremental_binary): Move to end of file.
4249 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4250 input section reader classes.
4251 (Sized_incremental_binary::has_incremental_info): New function.
4252 (Sized_incremental_binary::inputs_reader): New function.
4253 (Sized_incremental_binary::symtab_reader): New function.
4254 (Sized_incremental_binary::relocs_reader): New function.
4255 (Sized_incremental_binary::got_plt_reader): New function.
4256 (Sized_incremental_binary::do_file_is_unchanged): New function.
4257 (Sized_incremental_binary::Sized_input_reader): New class.
4258 (Sized_incremental_binary::get_input_reader): New function.
4259 (Sized_incremental_binary::find_incremental_inputs_sections):
4260 Rename do_find_incremental_inputs_sections to this.
4261 (Sized_incremental_binary::setup_readers): New function.
4262 (Sized_incremental_binary::has_incremental_info_): New data member.
4263 (Sized_incremental_binary::inputs_reader_): New data member.
4264 (Sized_incremental_binary::symtab_reader_): New data member.
4265 (Sized_incremental_binary::relocs_reader_): New data member.
4266 (Sized_incremental_binary::got_plt_reader_): New data member.
4267 (Sized_incremental_binary::current_input_file_): New data member.
4268
4269 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4270
4271 PR gold/12640
4272 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4273 violation.
4274
4275 2011-03-30 Cary Coutant <ccoutant@google.com>
4276
4277 * archive.cc (Archive::include_member): Adjust call to report_object.
4278 (Add_archive_symbols::run): Add script_info to call to
4279 report_archive_begin.
4280 (Lib_group::include_member): Adjust call to report_object.
4281 (Add_lib_group_symbols::run): Adjust call to report_object.
4282 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4283 blocks. Add object count for script input files.
4284 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4285 script_info parameter; change all callers.
4286 (Incremental_inputs::report_object): Add script_info parameter;
4287 change all callers.
4288 (Incremental_inputs::report_script): Store backpointer to
4289 incremental info entry.
4290 (Output_section_incremental_inputs::set_final_data_size): Record
4291 additional information for scripts.
4292 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4293 * incremental.h (Incremental_script_entry::add_object): New function.
4294 (Incremental_script_entry::get_object_count): New function.
4295 (Incremental_script_entry::get_object): New function.
4296 (Incremental_script_entry::objects_): New data member; adjust
4297 constructor.
4298 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4299 (Incremental_inputs::report_object): Add script_info parameter.
4300 (Incremental_inputs_reader::get_object_count): New function.
4301 (Incremental_inputs_reader::get_object_offset): New function.
4302 * options.cc (Input_arguments::add_file): Return reference to
4303 new input argument.
4304 * options.h (Input_argument::set_script_info): New function.
4305 (Input_argument::script_info): New function.
4306 (Input_argument::script_info_): New data member; adjust all
4307 constructors.
4308 (Input_file_group::add_file): Return reference to new input argument.
4309 (Input_file_lib::add_file): Likewise.
4310 (Input_arguments::add_file): Likewise.
4311 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4312 * script.cc (Parser_closure::Parser_closure): Add script_info
4313 parameter; adjust all callers.
4314 (Parser_closure::script_info): New function.
4315 (Parser_closure::script_info_): New data member.
4316 (read_input_script): Report scripts earlier to incremental info.
4317 (script_add_file): Set script_info in Input_argument.
4318 (script_add_library): Likewise.
4319 * script.h (Script_options::Script_info): Rewrite class.
4320
4321 2011-03-29 Cary Coutant <ccoutant@google.com>
4322
4323 * archive.cc (Library_base::should_include_member): Move
4324 method here from class Archive.
4325 (Archive::Archive): Initialize base class.
4326 (Archive::should_include_member): Move to base class.
4327 (Archive::do_for_all_unused_symbols): New function.
4328 (Add_archive_symbols::run): Remove redundant access to
4329 incremental_inputs.
4330 (Lib_group::Lib_group): Initialize base class.
4331 (Lib_group::do_filename): New function.
4332 (Lib_group::include_member): Pass pointer to Lib_group to
4333 report_object.
4334 (Lib_group::do_for_all_unused_symbols): New function.
4335 (Add_lib_group_symbols::run): Report archive information for
4336 incremental links.
4337 * archive.h (class Library_base): New base class.
4338 (class Archive): Derive from Library_base.
4339 (Archive::filename): Move to base class.
4340 (Archive::set_incremental_info): Likewise.
4341 (Archive::incremental_info): Likewise.
4342 (Archive::Should_include): Likewise.
4343 (Archive::should_include_member): Likewise.
4344 (Archive::Armap_entry): Remove.
4345 (Archive::Unused_symbol_iterator): Remove.
4346 (Archive::unused_symbols_begin): Remove.
4347 (Archive::unused_symbols_end): Remove.
4348 (Archive::do_filename): New function.
4349 (Archive::do_get_mtime): New function.
4350 (Archive::do_for_all_unused_symbols): New function.
4351 (Archive::task_): Move to base class.
4352 (Archive::incremental_info_): Likewise.
4353 (class Lib_group): Derive from Library_base.
4354 (Lib_group::do_filename): New function.
4355 (Lib_group::do_get_mtime): New function.
4356 (Lib_group::do_for_all_unused_symbols): New function.
4357 (Lib_group::task_): Move to base class.
4358 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4359 function.
4360 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4361 function.
4362 * incremental.cc (Incremental_inputs::report_archive_begin):
4363 Use Library_base; call library's get_mtime; add incremental inputs
4364 entry before members.
4365 (class Unused_symbol_visitor): New class.
4366 (Incremental_inputs::report_archive_end): Use Library_base; use
4367 visitor class to record unused symbols; don't add incremental inputs
4368 entry after members.
4369 (Incremental_inputs::report_object): Use Library_base.
4370 * incremental.h
4371 (Incremental_archive_entry::Incremental_archive_entry): Remove
4372 unused Archive parameter.
4373 (Incremental_inputs::report_archive_begin): Use Library_base.
4374 (Incremental_inputs::report_archive_end): Likewise.
4375 (Incremental_inputs::report_object): Likewise.
4376 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4377 function.
4378 * object.h (Object::for_all_global_symbols): New function.
4379 (Object::do_for_all_global_symbols): New function.
4380 (Sized_relobj::do_for_all_global_symbols): New function.
4381 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4382 function.
4383 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4384 function.
4385
4386 2011-03-27 Ian Lance Taylor <iant@google.com>
4387
4388 * archive.cc (Archive::interpret_header): Return -1 if something
4389 goes wrong. Change callers accordingly.
4390
4391 2011-03-25 Cary Coutant <ccoutant@google.com>
4392
4393 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4394 * testsuite/Makefile.in: Regenerate.
4395
4396 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4397
4398 * plugin.cc (get_view): New.
4399 (Plugin::load): Pass get_view to the plugin.
4400 (Plugin_manager::get_view): New.
4401
4402 2011-03-21 Ian Lance Taylor <iant@google.com>
4403
4404 * testsuite/final_layout.sh: Rewrite to not use dc.
4405 * testsuite/relro_test.sh: Fail if dc is not present.
4406
4407 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4408
4409 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4410 Change == to -eq.
4411 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4412 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4413 Change == to -eq.
4414 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4415 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4416
4417 2011-03-14 Ian Lance Taylor <iant@google.com>
4418
4419 * script-sections.cc (Sort_output_sections::script_compare):
4420 Rename from is_before, change return type.
4421 (Sort_output_sections::operator()): Adjust accordingly.
4422
4423 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4424
4425 PR gold/12572
4426 * testsuite/odr_violation2.cc: Add comment to make all error line
4427 numbers double digits.
4428 * testsuite/debug_msg.sh: Adjust expected errors.
4429
4430 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4431
4432 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4433 but mark earlier ones as non-canonical
4434 (offset_to_iterator): Update search target and example
4435 (do_addr2line): Return extra lines in a vector*
4436 (format_file_lineno): Extract from do_addr2line
4437 (one_addr2line): Add vector* out-param
4438 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4439 when a lineno entry appeared last for its instruction
4440 (Dwarf_line_info): Add vector* out-param
4441 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4442 * symtab.cc (Odr_violation_compare): Include the lineno in the
4443 comparison again.
4444 (linenos_from_loc): New. Combine the canonical line for an
4445 address with its other lines.
4446 (True_if_intersect): New. Helper functor to make
4447 std::set_intersection a query.
4448 (detect_odr_violations): Compare sets of lines instead of just
4449 one line for each function. This became less deterministic, but
4450 has fewer false positives.
4451 * symtab.h: Declarations.
4452 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4453 mix an optimized and non-optimized object in the same binary
4454 (odr_violation2.so): Same.
4455 * testsuite/Makefile.in: Regenerate from Makefile.am.
4456 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4457 * testsuite/debug_msg.sh: Update line numbers and add
4458 assertions.
4459 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4460 non-optimized context.
4461 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4462 isn't inlined, and use OdrDerived in an optimized context.
4463 * testsuite/odr_header1.h: Defines OdrDerived, where
4464 optimization will change the
4465 first-instruction-in-the-destructor's file and line number.
4466 * testsuite/odr_header2.h: Defines OdrBase.
4467
4468 2011-03-09 Ian Lance Taylor <iant@google.com>
4469
4470 * fileread.cc (File_read::clear_views): Don't delete the whole
4471 file view.
4472
4473 2011-03-08 Ian Lance Taylor <iant@google.com>
4474
4475 PR gold/12525
4476 * fileread.cc: #include <climits>.
4477 (GOLD_IOV_MAX): Define.
4478 (File_read::read_multiple): Limit number of entries by iov_max.
4479 * fileread.h (class File_read): Always set max_readv_entries to
4480 128.
4481
4482 2011-03-07 Ian Lance Taylor <iant@google.com>
4483
4484 PR gold/12525
4485 * options.h (class General_options): Add -dy and -dn.
4486
4487 2011-03-02 Cary Coutant <ccoutant@google.com>
4488
4489 * testsuite/script_test_9.t: Add TLS segment.
4490
4491 2011-03-02 Simon Baldwin <simonb@google.com>
4492
4493 * configure.ac: Add check for gnu_indirect_function support in
4494 the toolchain building binutils.
4495 * configure: Rebuild.
4496
4497 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4498
4499 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4500 plugin only symbols.
4501 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4502 in plugin files as not needed in the symbol table.
4503
4504 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4505
4506 * output.cc (Output_section::add_input_section): Delay fill
4507 generation for section ordering.
4508
4509 2011-02-09 Ian Lance Taylor <iant@google.com>
4510
4511 PR gold/12316
4512 * object.h (class Sized_relobj): Remove clear_local_symbols.
4513 * reloc.cc (Sized_relobj::do_relocate): Don't call
4514 clear_local_symbols.
4515
4516 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4517
4518 * plugin.cc (is_visible_from_outside): Return true for symbols
4519 in the -u option.
4520
4521 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4522
4523 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4524 filename.
4525
4526 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4527
4528 * icf.h (is_section_foldable_candidate): Change type of parameter
4529 to std::string.
4530 * icf.cc (Icf::find_identical_sections): Change type of local variable
4531 section_name to be std::string.
4532 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4533
4534 2011-01-25 Ian Lance Taylor <iant@google.com>
4535
4536 * script.cc (script_add_extern): Rewrite to use
4537 add_symbol_reference.
4538
4539 2011-01-25 Doug Kwan <dougkwan@google.com>
4540
4541 * icf.cc (get_section_contents): Always lock section's object.
4542
4543 2011-01-24 Ian Lance Taylor <iant@google.com>
4544
4545 * options.h (class General_options): Accept
4546 --no-detect-odr-violations.
4547
4548 2011-01-24 Ian Lance Taylor <iant@google.com>
4549
4550 * version.cc (version_string): Bump to 1.11.
4551
4552 2011-01-24 Ian Lance Taylor <iant@google.com>
4553
4554 * plugin.cc (class Plugin_rescan): Define new class.
4555 (Plugin_manager::claim_file): Set any_claimed_.
4556 (Plugin_manager::save_archive): New function.
4557 (Plugin_manager::save_input_group): New function.
4558 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4559 necessary.
4560 (Plugin_manager::new_undefined_symbol): New function.
4561 (Plugin_manager::rescan): New function.
4562 (Plugin_manager::rescannable_defines): New function.
4563 (Plugin_manager::add_input_file): Set any_added_.
4564 * plugin.h (class Plugin_manager): define new fields rescannable_,
4565 undefined_symbols_, any_claimed_, and any_added_. Declare
4566 Plugin_rescan as friend. Declare new functions.
4567 (Plugin_manager::Rescannable): Define type.
4568 (Plugin_manager::Rescannable_list): Define type.
4569 (Plugin_manager::Undefined_symbol_list): Define type.
4570 (Plugin_manager::Plugin_manager): Initialize new fields.
4571 * archive.cc (Archive::defines_symbol): New function.
4572 (Add_archive_symbols::run): Pass archive to plugins if any.
4573 * archive.h (class Archive): Declare defines_symbol.
4574 * readsyms.cc (Input_group::~Input_group): New function.
4575 (Finish_group::run): Pass input_group to plugins if any.
4576 * readsyms.h (class Input_group): Declare destructor.
4577 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4578 any.
4579
4580 2011-01-10 Ian Lance Taylor <iant@google.com>
4581
4582 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4583 section as relro.
4584 (Layout::set_segment_offsets): Reset increase_relro before calling
4585 set_section_addresses a second time.
4586
4587 2011-01-04 Cary Coutant <ccoutant@google.com>
4588
4589 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4590 sections before NOBITS sections.
4591
4592 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4593
4594 * version.cc (print_version): Update copyright to 2011.
4595
4596 2010-12-23 Cary Coutant <ccoutant@google.com>
4597
4598 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4599 of OS to this->add. Add OD parameter to second form of the function.
4600
4601 2010-12-20 Ian Lance Taylor <iant@google.com>
4602
4603 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4604 second of two consecutive entries with same offset.
4605
4606 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4607
4608 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4609 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4610 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4611 to avoid unneeded links against $(LDADD).
4612 * testsuite/Makefile.in: Regenerate.
4613
4614 2010-12-15 Ian Lance Taylor <iant@google.com>
4615
4616 PR gold/12324
4617 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4618 for R_X86_64_32 and R_X86_64_PC32.
4619 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4620 ver_matching_def_pic.o.
4621 (ver_matching_def_pic.o): New target.
4622
4623 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4624
4625 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4626 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4627 Move definition before File_read::View member definitions.
4628 (File_read::View::~View): Initialize and hold lock before
4629 updating current_mapped_bytes.
4630
4631 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4632
4633 * dwarf_reader.cc: Remove outdated comment.
4634 * gold-threads.cc: Fix typo in error message.
4635 * archive.cc: Fix typos in comments.
4636 * archive.h: Likewise.
4637 * arm-reloc-property.cc: Likewise.
4638 * arm-reloc-property.h: Likewise.
4639 * arm-reloc.def: Likewise.
4640 * arm.cc: Likewise.
4641 * attributes.h: Likewise.
4642 * cref.cc: Likewise.
4643 * ehframe.cc: Likewise.
4644 * fileread.h: Likewise.
4645 * gold.h: Likewise.
4646 * i386.cc: Likewise.
4647 * icf.cc: Likewise.
4648 * incremental.h: Likewise.
4649 * int_encoding.cc: Likewise.
4650 * layout.h: Likewise.
4651 * main.cc: Likewise.
4652 * merge.h: Likewise.
4653 * object.cc: Likewise.
4654 * object.h: Likewise.
4655 * options.cc: Likewise.
4656 * readsyms.cc: Likewise.
4657 * reduced_debug_output.cc: Likewise.
4658 * reloc.cc: Likewise.
4659 * script-sections.cc: Likewise.
4660 * sparc.cc: Likewise.
4661 * symtab.h: Likewise.
4662 * target-reloc.h: Likewise.
4663 * target.cc: Likewise.
4664 * target.h: Likewise.
4665 * timer.cc: Likewise.
4666 * timer.h: Likewise.
4667 * x86_64.cc: Likewise.
4668
4669 2010-12-09 Cary Coutant <ccoutant@google.com>
4670
4671 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4672 stack.
4673 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4674 parameter; change all callers.
4675 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4676 * options.h (warn_execstack): New option.
4677
4678 2010-12-07 Doug Kwan <dougkwan@google.com>
4679
4680 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4681 like function call relocations.
4682
4683 2010-12-07 Ian Lance Taylor <iant@google.com>
4684
4685 * archive.cc (Archive::get_elf_object_for_member): Permit
4686 punconfigured to be NULL.
4687 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4688 (Archive::include_member): Pass NULL to get_elf_object_for_member
4689 if we searched for the archive and this is the first included
4690 object.
4691
4692 2010-12-01 Ian Lance Taylor <iant@google.com>
4693
4694 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4695 track_relocs_type_ field.
4696 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4697 Set track_relocs_type_.
4698 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4699 contents when using RELA relocs.
4700 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4701 reloc_map_.
4702 * reloc.cc (Track_relocs::next_addend): New function.
4703 * reloc.h (class Track_relocs): Declare next_addend.
4704
4705 2010-12-01 Ian Lance Taylor <iant@google.com>
4706
4707 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4708 virtual destructor.
4709
4710 2010-12-01 Ian Lance Taylor <iant@google.com>
4711
4712 * README: Update compilers known to work and fail.
4713
4714 2010-11-23 Matthias Klose <doko@ubuntu.com>
4715
4716 * configure.in: For --enable-gold, handle value `default' instead of
4717 `both*'. Always install ld as ld.bfd, install as ld if gold is
4718 not the default.
4719 * configure: Regenerate.
4720
4721 2010-11-18 Doug Kwan <dougkwan@google.com>
4722
4723 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4724 and right_alignment to be zero. Store result alignment only if it is
4725 greater than existing alignment.
4726
4727 2010-11-16 Cary Coutant <ccoutant@google.com>
4728
4729 PR gold/12220
4730 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4731 Check for ".zdebug_line".
4732
4733 2010-11-16 Doug Kwan <dougkwan@google.com>
4734 Cary Coutant <ccoutant@google.com>
4735
4736 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4737 by reference; adjust all callers.
4738 * output.cc (Output_segment::set_section_addresses): Adjust references
4739 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4740 list is empty.
4741 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4742 end at page boundary.
4743
4744 2010-11-16 Cary Coutant <ccoutant@google.com>
4745
4746 PR gold/12220
4747 * layout.cc (Layout::choose_output_section): Transform names of
4748 compressed sections even when using a script with a SECTIONS clause.
4749 (Layout::output_section_name): Remove code to transform
4750 compressed debug section names.
4751 * output.cc (Output_section::add_input_section): Use uncompressed
4752 section size when tracking input sections.
4753
4754 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4755
4756 * symtab.h (Symbol::NON_PIC_REF): Remove.
4757 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4758 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4759 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4760 (Symbol::use_plt_offset): Take a flags argument and pass it
4761 directly to needs_dynamic_reloc. Restrict check for undefined
4762 weak symbols to function calls.
4763 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4764 (Target_arm::Scan::global): Use it.
4765 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4766 (Target_arm::Relocate::relocate): Likewise.
4767 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4768 parameter with an r_type parameter. Use get_reference_flags
4769 to get the flags.
4770 (Target_arm::Relocate::relocate): Update accordingly.
4771 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4772 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4773 (Target_i386::Scan::global): Likewise.
4774 (Target_i386::Relocate::relocate): Likewise.
4775 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4776 parameter with an r_type parameter. Use get_reference_flags
4777 to get the flags.
4778 (Target_i386::Relocate::relocate): Update accordingly.
4779 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4780 (Target_powerpc::Scan::global): Use it.
4781 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4782 (Target_powerpc::Relocate::relocate): Likewise.
4783 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4784 (Target_sparc::Scan::global): Use it.
4785 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4786 (Target_sparc::Relocate::relocate): Likewise.
4787 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4788 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4789 (Target_x86_64::Scan::global): Likewise.
4790 (Target_x86_64::Relocate::relocate): Likewise.
4791
4792 2010-11-08 Doug Kwan <dougkwan@google.com>
4793 Cary Coutant <ccoutant@google.com>
4794
4795 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4796 (Arm_exidx_merge_section::section_contents_): New data member.
4797 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4798 (Arm_input_section::~Arm_input_section): De-allocate memory.
4799 (Arm_input_section::original_contents_): New data member.
4800 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4801 in parameters instead of calling Object::section_contents without
4802 locking.
4803 (Arm_output_section::group_section): New parameter TASK. Pass it
4804 to callees that need locking objects.
4805 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4806 to lock EXIDX input sections. Fix a formatting issue. Call
4807 Arm_exidx_merged_section::build_contents to create merged section
4808 contents.
4809 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4810 to lock object of stub table owner.
4811 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4812 TEXT_SIZE to initialize data member TEXT_SIZE_.
4813 (Arm_exidx_input_section::addralign): Fix typo in comment.
4814 (Arm_exidx_input_section::text_size): New method.
4815 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4816 that require locking objects. Lock objects before scanning for stubs
4817 and updating local symbols.
4818 (Arm_input_section<big_endian>::init): Copy contents of original
4819 input section.
4820 (Arm_input_section<big_endian>::do_write): Use saved contents of
4821 original input section instead of calling Object::section_contents
4822 without locking.
4823 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4824 size without calling Object::section_size().
4825 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4826 for size. Allocate a buffer for merged EXIDX entries.
4827 (Arm_exidx_merged_section::build_contents): New method.
4828 (Arm_exidx_merged_section::do_write): Move merge section contents
4829 building code to Arm_exidx_merged_section::build_contetns. Write
4830 out contetns in buffer instead of building it on the fly.
4831 (Arm_relobj::make_exidx_input_section): Also pass text section size
4832 to Arm_exidx_input_section constructor.
4833 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4834 (Arm_dynobj::do_read_symbols): Fix memory leak.
4835 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4836 * target.h: (class Task): Add forward declaration.
4837 (Target::relax): Add new parameter TASK and pass it to
4838 Target::do_relax().
4839 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4840
4841 2010-11-05 Cary Coutant <ccoutant@google.com>
4842
4843 PR gold/10708
4844 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4845 object when reading from the file.
4846 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4847 second layout pass.
4848 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4849 when reading section contents.
4850 (get_section_contents): Likewise.
4851 (icf::find_identical_sections): Likewise.
4852 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4853 object when reading from the file.
4854 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4855 the object when doing deferred section layout.
4856
4857 2010-11-03 Nick Clifton <nickc@redhat.com>
4858
4859 PR gold/12001
4860 * script.h (class Symbol_assignment: name): New member. Returns
4861 the name of the symbol.
4862 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4863 Returns true if the given symbol name is on the list of
4864 assignments wating to be processed.
4865 * archive.cc (should_incldue_member): If the symbol is undefined,
4866 check to see if it is on the list of symbols pending assignment.
4867
4868 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4869
4870 * script-sections.cc (Script_sections::find_memory_region): Check
4871 for a NULL output section pointer.
4872
4873 2010-10-29 Doug Kwan <dougkwan@google.com>
4874
4875 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4876 Output_section::add_relaxed_input_section.
4877 * output.cc (Output_section::add_relaxed_input_section): Add new
4878 arguments LAYOUT and NAME. Set section order index.
4879 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4880 Copy section order index.
4881 * output.h (Output_section::add_relaxed_input_section): Add new
4882 arguments LAYOUT and NAME.
4883
4884 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4885
4886 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4887 NATIVE_OR_CROSS_LINKER.
4888 * testsuite/Makefile.in: Regenerate.
4889
4890 2010-10-20 Doug Kwan <dougkwan@google.com>
4891
4892 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4893 without SHF_LINK_ORDER flags.
4894 * layout.cc (Layout::choose_output_section): Do not filter
4895 SHF_LINK_ORDER flag in a relocatable link.
4896
4897 2010-10-17 Cary Coutant <ccoutant@google.com>
4898
4899 * output.h (Output_segment::set_section_addresses): Change function
4900 signature. Update all callers.
4901 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4902 sections.
4903 (Output_segment::set_section_addresses): Align after last TLS
4904 section. Add padding before last relro section instead of after.
4905
4906 2010-10-17 Doug Kwan <dougkwan@google.com>
4907
4908 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4909 GOT output section to be writable.
4910
4911 2010-10-14 Cary Coutant <ccoutant@google.com>
4912
4913 * debug.h (DEBUG_INCREMENTAL): New flag.
4914 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4915 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4916 mode.
4917 * incremental.cc (report_command_line): Ignore all forms of
4918 --incremental.
4919 * layout.cc (Layout::Layout): Check parameters for incremental link
4920 mode.
4921 * options.cc (General_options::parse_incremental): New function.
4922 (General_options::parse_no_incremental): New function.
4923 (General_options::parse_incremental_full): New function.
4924 (General_options::parse_incremental_update): New function.
4925 (General_options::incremental_mode_): New data member.
4926 (General_options::finalize): Check incremental_mode_.
4927 * options.h (General_options): Update help text for --incremental.
4928 Add --no-incremental, --incremental-full, --incremental-update.
4929 (General_options::Incremental_mode): New enum type.
4930 (General_options::incremental_mode): New function.
4931 (General_options::incremental_mode_): New data member.
4932 * parameters.cc (Parameters::incremental_mode_): New data member.
4933 (Parameters::set_options): Set incremental_mode_.
4934 (Parameters::set_incremental_full): New function.
4935 (Parameters::incremental): New function.
4936 (Parameters::incremental_update): New function.
4937 (set_parameters_incremental_full): New function.
4938 * parameters.h (Parameters::set_incremental_full): New function.
4939 (Parameters::incremental): New function.
4940 (Parameters::incremental_update): New function.
4941 (Parameters::incremental_mode_): New data member.
4942 (set_parameters_incremental_full): New function.
4943 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4944 incremental link mode.
4945 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4946 (Sized_relobj::do_relocate_sections): Likewise.
4947 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4948 option.
4949 * testsuite/Makefile.in: Regenerate.
4950 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4951
4952 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4953
4954 * script-sections.h (class Script_sections): Make
4955 Sections_elements typedef public.
4956 * script-sections.cc (class Sort_output_sections): Add elements_
4957 field. Add constructor which sets it; change all callers.
4958 (Sort_output_sections::is_before): New function.
4959 (Sort_output_sections::operator()): Call is_before.
4960 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4961 conditional.
4962 * testsuite/script_test_10.sh: New test. Test script section
4963 order.
4964 * testsuite/script_test_10.t: Likewise.
4965 * testsuite/script_test_10.s: Likewise.
4966 * testsuite/Makefile.am: Wrap the cross linker tests and the
4967 common tests into NATIVE_OR_CROSS_LINKER.
4968 (check_SCRIPTS): Add script_test_10.sh.
4969 (check_DATA): Add script_test_10.stdout.
4970 (script_test_10.o, script_test_10): New targets.
4971 (script_test_10.stdout): New target.
4972 * configure, testsuite/Makefile.in: Regenerate.
4973
4974 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4975
4976 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4977 error for the deprecated relocations.
4978 (Target_arm::Scan::global): Likewise.
4979 (Target_arm::Relocate::relocate): Likewise.
4980
4981 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4982
4983 * fileread.cc (Input_file::find_file): Initialize *found_name
4984 and *namep when using the fallback search for case 4.
4985
4986 2010-10-11 Cary Coutant <ccoutant@google.com>
4987
4988 * options.h (class General_options): Redefine -z lazy as an alias for
4989 the negation of -z now.
4990
4991 2010-10-11 Ian Lance Taylor <iant@google.com>
4992
4993 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4994 binding.
4995
4996 2010-10-06 Nick Clifton <nickc@redhat.com>
4997
4998 * script-sections.cc(class Memory_region): Remove
4999 current_lma_offset_ field. Rename current_vma_offset_ to
5000 current_offset_. Add last_section_ field.
5001 (Memory_region::get_current_vma_address): Rename to
5002 get_current_address.
5003 (Memory_region::get_current_lma_address): Delete.
5004 (Memory_region::increment_vma_offset): Rename to
5005 increment_offset.
5006 (Memory_region::increment_lma_offset): Delete.
5007 (Memory_region::attributes_compatible): New method. Returns
5008 true if the provided section is compatible with the region.
5009 (Memory_region::get_last_section): New method. Returns the last
5010 section to use the region.
5011 (Memory_region::set_last_section): New method. Stores the last
5012 section to use the region.
5013 (Script_sections::block_in_region): New method. Returns true if
5014 a block of memory is contained within a region.
5015 (Script_sections::find_memory_region): New method. Locates a
5016 memory region to be used to set a VMA or LMA address.
5017 (Output_section_definition::set_section_addresses): Add code to
5018 check for addresses set by memory regions.
5019 (Output_segment::set_section_addresses): Remove memory region
5020 walking code.
5021 (Script_sections::create_segment): Add a warning if a header
5022 segment is created outside of any region.
5023 * script-sections.h (class Script_sections): Add prototypes for
5024 find_memory_region and block_in_region methods.
5025 * testsuite/memory_test.s: Use .long instead of .word.
5026 * testsuite/memory_test.t: Add some more output sections.
5027 * testsuite/memory_test.sh: Update expected output.
5028
5029 2010-10-02 Doug Kwan <dougkwan@google.com>
5030
5031 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5032 defintion to symtab.h
5033 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5034 declaration to defintion.
5035
5036 2010-10-01 Nick Clifton <nickc@redhat.com>
5037
5038 * expression.cc (eval): Replace dummy argument with NULL.
5039 (eval_maybe_dot): Check for a NULL result section pointer.
5040 (Symbol_expression::value): Likewise.
5041 (Dot_expression::value): Likewise.
5042 (BINARY_EXPRESSION): Likewise.
5043 (Max_expression::value): Likewise.
5044 (Min_expression::value): Likewise.
5045 (Absolute_expression::value): Likewise.
5046 (Addr_expression::value_from_output_section): Likewise.
5047 (Loaddddr_expression::value_from_output_section): Likewise.
5048 (Segment_start_expression::value): Likewise.
5049 * script-sections.cc
5050 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5051 argument with NULL.
5052 (Sections_elememt_dot_assignment::set_section_addresses):
5053 Likewise.
5054 (Output_data_expression::do_write_to_buffer): Likewise.
5055 (Output_section_definition::finalize_symbols): Likewise.
5056 (Output_section_definition::set_section_addresses): Likewise.
5057
5058 2010-09-30 Doug Kwan <dougkwan@google.com>
5059
5060 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5061
5062 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5063
5064 * target.h (Target::can_icf_inline_merge_sections): New virtual
5065 function.
5066 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5067 virtual function.
5068 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5069 virtual function.
5070 * icf.cc (get_section_contents): Inline merge sections only when
5071 target allows it.
5072
5073 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5074
5075 * configure: Regenerate.
5076
5077 2010-09-17 Ian Lance Taylor <iant@google.com>
5078
5079 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5080 * testsuite/Makefile.am (memory_test.o): New target.
5081 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5082 memory_test.t.
5083 * testsuite/Makefile.in: Rebuild.
5084
5085 2010-09-17 Doug Kwan <dougkwan@google.com>
5086
5087 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5088 defintion if relocation uses GOT entries of the symbol.
5089 * testsuite/icf_safe_test.sh: Fix test.
5090 * testsuite/icf_safe_so_test.sh: Fix test.
5091
5092 2010-09-16 Cary Coutant <ccoutant@google.com>
5093
5094 * script_sections.cc (class Memory_region): Remove "NULL" from
5095 vector initializations.
5096
5097 2010-09-15 Cary Coutant <ccoutant@google.com>
5098
5099 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5100 Resolve forwarding symbols.
5101
5102 2010-09-15 Doug Kwan <dougkwan@google.com>
5103
5104 * gold/testsuite/script_test_3.t: Add ARM special sections.
5105 * gold/testsuite/script_test_4.t: Same.
5106 * gold/testsuite/script_test_5.t: Same.
5107 * gold/testsuite/script_test_6.t: Same.
5108 * gold/testsuite/script_test_7.t: Same.
5109 * gold/testsuite/script_test_7.t: Same.
5110 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5111
5112 2010-09-14 Cary Coutant <ccoutant@google.com>
5113
5114 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5115 (Target_x86_64::Relocate::relocate_tls): Replace check for
5116 saw_tls_block_reloc_ with test for executable section.
5117
5118 2010-09-12 Cary Coutant <ccoutant@google.com>
5119
5120 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5121 position-independent executables to shared libraries need dynamic
5122 relocations.
5123 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5124 position-independent executables.
5125 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5126 * testsuite/Makefile.in: Regenerate.
5127
5128 2010-09-10 Nick Clifton <nickc@redhat.com>
5129
5130 PR gold/11997
5131 * testsuite/memory_test.t: Discard any sections that are not
5132 needed.
5133
5134 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5135
5136 PR gold/11996
5137 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5138 "This::" to work around a bug in gcc 4.2.
5139
5140 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5141
5142 2010-09-09 Rafael Espindola <espindola@google.com>
5143
5144 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5145 sections with different PF_X flags in the same segment.
5146 (Layout::find_first_load_seg): Search all segments to find the first
5147 one.
5148 * options.h (rosegment): New.
5149
5150 2010-09-08 Rafael Espindola <espindola@google.com>
5151
5152 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5153
5154 2010-09-08 Doug Kwan <dougkwan@google.com>
5155
5156 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5157 (Arm_relobj::do_relocate_sections): Add new parameter for output
5158 file to match the parent.
5159 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5160 of local symbols instead of input values. Update code to track
5161 changes in gold::relocate_section.
5162 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5163 (Sized_relobj::compute_final_local_value_internal): New methods.
5164 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5165 body into private version of Sized_relobj::compute_final_local_value.
5166 Call the inline method.
5167 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5168 merged symbol value if there is one.
5169 (Symbol_value::has_output_value): New method defintiion.
5170 (Sized_relobj::Compute_final_local_value_status): New enum type.
5171 (Sized_relobj::compute_final_local_value): New methods.
5172 (Sized_relobj::compute_final_local_value_internal): New methods.
5173 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5174 and arm_cortex_a8.sh.
5175 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5176 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5177 New tests.
5178 * Makefile.in: Regenerate.
5179 * testsuite/arm_bl_out_of_range.s: Update test.
5180 * testsuite/thumb_bl_out_of_range.s: Ditto.
5181 * testsuite/thumb_blx_out_of_range.s: Ditto.
5182 * testsuite/arm_branch_out_of_range.sh: New file.
5183 * testsuite/arm_cortex_a8.sh: Ditto.
5184 * testsuite/arm_cortex_a8_b.s: Ditto.
5185 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5186 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5187 * testsuite/arm_cortex_a8_bl.s: Ditto.
5188 * testsuite/arm_cortex_a8_blx.s: Ditto.
5189 * testsuite/arm_cortex_a8_local.s: Ditto.
5190 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5191 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5192
5193 2010-09-08 Rafael Espindola <espindola@google.com>
5194
5195 * Makefile.am (memory_test.stdout): Run readelf with -W.
5196 * Makefile.in: Regenerate.
5197 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5198 64 bit output.
5199
5200 2010-09-08 Rafael Espindola <espindola@google.com>
5201
5202 * script-sections.cc (Script_sections::add_memory_region): Convert
5203 field precision to int.
5204 * script.cc (script_set_section_region, script_set_section_region):
5205 Convert field precision to int.
5206
5207 2010-09-08 Rafael Espindola <espindola@google.com>
5208
5209 * arm.cc (do_finalize_sections): Create the __exidx_start and
5210 __exdix_end symbols even when the section is missing.
5211
5212 2010-09-08 Nick Clifton <nickc@redhat.com>
5213
5214 * README: Remove claim that MEMORY is not supported.
5215 * expression.cc (script_exp_function_origin)
5216 (script_exp_function_length): Move from here to ...
5217 * script.cc: ... here.
5218 (script_set_section_region, script_add_memory)
5219 (script_parse_memory_attr, script_include_directive): New
5220 functions.
5221 * script-sections.cc
5222 (class Memory_region): New class.
5223 (class Output_section_definition): Add set_memory_region,
5224 set_section_vma, set_section_lma and get_section_name methods.
5225 (class Script_Sections): Add add_memory_region,
5226 find_memory_region, find_memory_region_origin,
5227 find_memory_region_length and set_memory_region methods.
5228 Have set_section_addresses method walk the list of set memory
5229 regions.
5230 Extend the print methos to display memory regions.
5231 * script-sections.h: Add prototypes for new methods.
5232 Add enum for MEMORY region attributes.
5233 * yyscript.y: Add support for parsing MEMORY regions.
5234 * script-c.h: Add prototypes for new functions.
5235 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5236 * testsuite/Makefile.in: Regenerate.
5237 * testsuite/memory_test.sh: New script.
5238 * testsuite/memory_test.s: New assembler source file.
5239 * testsuite/memory_test.t: New linker script.
5240
5241 2010-08-27 Doug Kwan <dougkwan@google.com>
5242
5243 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5244 reference override an existing dynamic weak reference.
5245 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5246 * testsuite/Makefile.in: Regenerate.
5247 * testsuite/dyn_weak_ref.sh: New file.
5248 * testsuite/dyn_weak_ref_1.c: Ditto.
5249 * testsuite/dyn_weak_ref_2.c: Ditto.
5250
5251 2010-08-27 Ian Lance Taylor <iant@google.com>
5252
5253 * incremental.h (class Incremental_input_entry): Add virtual
5254 destructor.
5255
5256 2010-08-27 Ian Lance Taylor <iant@google.com>
5257
5258 * testsuite/start_lib_test_3.c: Mark t3 as used.
5259
5260 2010-08-27 Nick Clifton <nickc@redhat.com>
5261
5262 * options.cc (version_script): Fix small typo in previous
5263 whitespace tidyup.
5264
5265 2010-08-25 Nick Clifton <nickc@redhat.com>
5266
5267 * archive.cc: Formatting fixes: Remove whitespace between
5268 typename and following asterisk. Remove whitespace between
5269 function name and opening parenthesis.
5270 * archive.h: Likewise.
5271 * arm.cc: Likewise.
5272 * attributes.cc: Likewise.
5273 * attributes.h: Likewise.
5274 * common.cc: Likewise.
5275 * copy-relocs.cc: Likewise.
5276 * dirsearch.h: Likewise.
5277 * dynobj.cc: Likewise.
5278 * ehframe.cc: Likewise.
5279 * ehframe.h: Likewise.
5280 * expression.cc: Likewise.
5281 * fileread.cc: Likewise.
5282 * fileread.h: Likewise.
5283 * gc.h: Likewise.
5284 * gold-threads.cc: Likewise.
5285 * gold.cc: Likewise.
5286 * i386.cc: Likewise.
5287 * icf.h: Likewise.
5288 * incremental-dump.cc: Likewise.
5289 * incremental.cc: Likewise.
5290 * layout.cc: Likewise.
5291 * layout.h: Likewise.
5292 * main.cc: Likewise.
5293 * merge.cc: Likewise.
5294 * merge.h: Likewise.
5295 * object.cc: Likewise.
5296 * object.h: Likewise.
5297 * options.cc: Likewise.
5298 * options.h: Likewise.
5299 * output.cc: Likewise.
5300 * output.h: Likewise.
5301 * plugin.cc: Likewise.
5302 * plugin.h: Likewise.
5303 * powerpc.cc: Likewise.
5304 * reloc.cc: Likewise.
5305 * script-c.h: Likewise.
5306 * script-sections.cc: Likewise.
5307 * script.cc: Likewise.
5308 * stringpool.cc: Likewise.
5309 * symtab.cc: Likewise.
5310 * symtab.h: Likewise.
5311 * target.cc: Likewise.
5312 * timer.cc: Likewise.
5313 * timer.h: Likewise.
5314 * version.cc: Likewise.
5315 * x86_64.cc: Likewise.
5316
5317 2010-08-24 Nick Clifton <nickc@redhat.com>
5318
5319 PR 11899
5320 * layout.cc (segment_precedes): Sort segments by their physical
5321 addresses, if they have been set.
5322
5323 2010-08-23 Cary Coutant <ccoutant@google.com>
5324
5325 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5326 symbols data.
5327 (Lib_group::include_member): Unlock object after deleting its
5328 symbols data.
5329 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5330 the bug fixed here.
5331
5332 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5333 Cary Coutant <ccoutant@google.com>
5334
5335 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5336 constructor, and set_blocker.
5337 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5338 readsyms_blocker_.
5339 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5340 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5341 * testsuite/Makefile.am (start_lib_test): New test case.
5342 * testsuite/Makefile.in: Regenerate.
5343 * testsuite/start_lib_test_main.c: New file.
5344 * testsuite/start_lib_test_1.c: New file.
5345 * testsuite/start_lib_test_2.c: New file.
5346 * testsuite/start_lib_test_3.c: New file.
5347
5348 2010-08-19 Ian Lance Taylor <iant@google.com>
5349
5350 * Makefile.in: Rebuild with automake 1.11.1.
5351 * aclocal.m4: Likewise.
5352 * testsuite/Makefile.in: Likewise.
5353
5354 2010-08-19 Ian Lance Taylor <iant@google.com>
5355
5356 PR 10893
5357 * i386.cc (class Output_data_plt_i386): Update declarations.
5358 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5359 local_ifuncs_ fields.
5360 (Target_i386::do_plt_section_for_global): New function.
5361 (Target_i386::do_plt_section_for_local): New function.
5362 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5363 parameter; change all callers. Initialize global_ifuncs_ and
5364 local_ifuncs_. If doing a static link define __rel_iplt_start and
5365 __rel_iplt_end.
5366 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5367 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5368 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5369 symbols.
5370 (Target_i386::make_plt_section): New function, broken out of
5371 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5372 (Target_i386::make_plt_entry): Call make_plt_section.
5373 (Target_i386::make_local_ifunc_plt_entry): New function.
5374 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5375 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5376 R_386_IRELATIVE to switch.
5377 (Target_i386::Scan::global): Likewise.
5378 (Target_i386::Relocate::relocate): Likewise.
5379 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5380 switch.
5381 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5382 (Target_x86_64::do_plt_section_for_global): New function.
5383 (Target_x86_64::do_plt_section_for_local): New function.
5384 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5385 parameter; change all callers. If doing a static link define
5386 __rela_iplt_start and __rela_iplt_end.
5387 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5388 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5389 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5390 to point to .plt.
5391 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5392 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5393 switch.
5394 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5395 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5396 R_X86_64_IRELATIVE to switch.
5397 (Target_x86_64::Scan::global): Likewise.
5398 (Target_x86_64::Relocate::relocate): Likewise.
5399 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5400 switch.
5401 * target.h (class Target): Add plt_section_for_global and
5402 plt_section_for_local functions. Add do_plt_section_for_global
5403 and do_plt_section_for_local virtual functions.
5404 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5405 clarifying comments.
5406 (Symbol::use_plt_offset): Handle IFUNC symbol.
5407 * object.cc (Sized_relobj::Sized_relobj): Initialize
5408 local_plt_offsets_.
5409 (Sized_relobj::local_has_plt_offset): New function.
5410 (Sized_relobj::local_plt_offset): New function.
5411 (Sized_relobj::set_local_plt_offset): New function.
5412 (Sized_relobj::do_count): Handle IFUNC symbol.
5413 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5414 a bit away from input_shndx_ field. Add set_is_func_symbol and
5415 is_ifunc_symbol functions.
5416 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5417 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5418 local_plt_offsets_ field.
5419 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5420 * output.h (class Output_section_data): Add non-const
5421 output_section function.
5422 (class Output_data_got): Update declarations.
5423 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5424 Add use_plt_offset parameter to global and local constructors.
5425 Change all callers. Change local_sym_index_ field to 31 bits.
5426 Change GSYM_CODE and CONSTANT_CODE accordingly.
5427 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5428 doing a static link don't set sh_link field.
5429 (Output_data_got::Got_entry::write): Use PLT offset if
5430 appropriate.
5431 (Output_data_got::add_global_plt): New function.
5432 (Output_data_got::add_local_plt): New function.
5433 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5434 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5435 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5436 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5437 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5438 IFUNC conditional.
5439 * testsuite/ifunc-sel.h: New file.
5440 * testsuite/ifuncmain1.c: New file.
5441 * testsuite/ifuncmain1vis.c: New file.
5442 * testsuite/ifuncmod1.c: New file.
5443 * testsuite/ifuncdep2.c: New file.
5444 * testsuite/ifuncmain2.c: New file.
5445 * testsuite/ifuncmain3.c: New file.
5446 * testsuite/ifuncmod3.c: New file.
5447 * testsuite/ifuncmain4.c: New file.
5448 * testsuite/ifuncmain5.c: New file.
5449 * testsuite/ifuncmod5.c: New file.
5450 * testsuite/ifuncmain6pie.c: New file.
5451 * testsuite/ifuncmod6.c: New file.
5452 * testsuite/ifuncmain7.c: New file.
5453 * configure, testsuite/Makefile.in: Rebuild.
5454
5455 2010-08-18 Ian Lance Taylor <iant@google.com>
5456
5457 * incremental.cc
5458 (Output_section_incremental_inputs::write_input_files): Add cast
5459 to avoid signed/unsigned comparison warning.
5460 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5461
5462 2010-08-12 Cary Coutant <ccoutant@google.com>
5463
5464 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5465
5466 2010-08-13 Ian Lance Taylor <iant@google.com>
5467
5468 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5469
5470 2010-08-12 Cary Coutant <ccoutant@google.com>
5471 Doug Kwan <dougkwan@google.com>
5472
5473 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5474 defintion overrides non-weak undef, remember that the original undef
5475 is not weak.
5476 * symtab.cc (Symbol_table::sized_write_global): For undef without
5477 an original weak binding, set binding to global in output.
5478 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5479 * testsuite/Makefile.in: Regenerate.
5480 * testsuite/strong_ref_weak_def.sh: New file.
5481 * testsuite/strong_ref_weak_def_1.c: Ditto.
5482 * testsuite/strong_ref_weak_def_2.c: Ditto.
5483
5484 2010-08-12 Cary Coutant <ccoutant@google.com>
5485
5486 * testsuite/incremental_test.sh: Rewrite.
5487 * testsuite/incremental_test_1.c: Rewrite.
5488 * testsuite/incremental_test_2.c: Rewrite.
5489
5490 2010-08-12 Cary Coutant <ccoutant@google.com>
5491
5492 * arm.cc (Target_arm::got_size): Add const.
5493 (Target_arm::got_entry_count): New function.
5494 (Target_arm::plt_entry_count): New function.
5495 (Target_arm::first_plt_entry_offset): New function.
5496 (Target_arm::plt_entry_size): New function.
5497 (Output_data_plt_arm::entry_count): New function.
5498 (Output_data_plt_arm::first_plt_entry_offset): New function.
5499 (Output_data_plt_arm::get_plt_entry_size): New function.
5500 * i386.cc (Target_i386::got_size): Add const.
5501 (Target_i386::got_entry_count): New function.
5502 (Target_i386::plt_entry_count): New function.
5503 (Target_i386::first_plt_entry_offset): New function.
5504 (Target_i386::plt_entry_size): New function.
5505 (Output_data_plt_i386::entry_count): New function.
5506 (Output_data_plt_i386::first_plt_entry_offset): New function.
5507 (Output_data_plt_i386::get_plt_entry_size): New function.
5508 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5509 find_incremental_inputs_sections. Dump incremental_got_plt section.
5510 * incremental.cc: Include target.h.
5511 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5512 parameter. Adjust all callers. Find incremental_got_plt section.
5513 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5514 section.
5515 (Output_section_incremental_inputs::set_final_data_size): Calculate
5516 size of incremental_got_plt section.
5517 (Output_section_incremental_inputs::do_write): Write the
5518 incremental_got_plt section.
5519 (Got_plt_view_info): New struct.
5520 (Local_got_offset_visitor): New class.
5521 (Global_got_offset_visitor): New class.
5522 (Global_symbol_visitor_got_plt): New class.
5523 (Output_section_incremental_inputs::write_got_plt): New function.
5524 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5525 Add parameter. Adjust all callers.
5526 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5527 (Incremental_inputs::got_plt_section): New function.
5528 (Incremental_inputs::got_plt_section_): New data member.
5529 (Incremental_got_plt_reader): New class.
5530 * layout.cc (Layout::create_incremental_info_sections): Add the
5531 incremental_got_plt section.
5532 * object.h (Got_offset_list::get_list): New function.
5533 (Got offset_list::for_all_got_offsets): New function.
5534 (Sized_relobj::local_got_offset_list): New function.
5535 * powerpc.cc (Target_powerpc::got_size): Add const.
5536 (Target_powerpc::got_entry_count): New function.
5537 (Target_powerpc::plt_entry_count): New function.
5538 (Target_powerpc::first_plt_entry_offset): New function.
5539 (Target_powerpc::plt_entry_size): New function.
5540 (Output_data_plt_powerpc::entry_count): New function.
5541 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5542 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5543 * sparc.cc (Target_sparc::got_size): Add const.
5544 (Target_sparc::got_entry_count): New function.
5545 (Target_sparc::plt_entry_count): New function.
5546 (Target_sparc::first_plt_entry_offset): New function.
5547 (Target_sparc::plt_entry_size): New function.
5548 (Output_data_plt_sparc::entry_count): New function.
5549 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5550 (Output_data_plt_sparc::get_plt_entry_size): New function.
5551 * symtab.h (Symbol::got_offset_list): New function.
5552 (Symbol_table::for_all_symbols): New function.
5553 * target.h (Sized_target::got_entry_count): New function.
5554 (Sized_target::plt_entry_count): New function.
5555 (Sized_target::plt_entry_size): New function.
5556 * x86_64.cc (Target_x86_64::got_size): Add const.
5557 (Target_x86_64::got_entry_count): New function.
5558 (Target_x86_64::plt_entry_count): New function.
5559 (Target_x86_64::first_plt_entry_offset): New function.
5560 (Target_x86_64::plt_entry_size): New function.
5561 (Output_data_plt_x86_64::entry_count): New function.
5562 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5563 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5564
5565 2010-08-12 Cary Coutant <ccoutant@google.com>
5566
5567 * archive.cc: Include incremental.h.
5568 (Archive::Archive): Initialize incremental_info_.
5569 (Archive::include_member): Record archive members in incremental info.
5570 (Add_archive_symbols::run): Record begin and end of an archive in
5571 incremental info.
5572 (Lib_group::include_member): Record objects in incremental info.
5573 * archive.h (Incremental_archive_entry): Forward declaration.
5574 (Archive::set_incremental_info): New member function.
5575 (Archive::incremental_info): New member function.
5576 (Archive::Unused_symbol_iterator): New class.
5577 (Archive::unused_symbols_begin): New member function.
5578 (Archive::unused_symbols_end): New member function.
5579 (Archive::incremental_info_): New data member.
5580 * incremental-dump.cc (find_input_containing_global): New function.
5581 (dump_incremental_inputs): Dump new incremental info sections.
5582 * incremental.cc: Include symtab.h.
5583 (Output_section_incremental_inputs): New class.
5584 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5585 new incremental info sections.
5586 (Sized_incremental_binary::do_check_inputs): Likewise.
5587 (Incremental_inputs::report_archive): Remove.
5588 (Incremental_inputs::report_archive_begin): New function.
5589 (Incremental_inputs::report_archive_end): New function.
5590 (Incremental_inputs::report_object): New function.
5591 (Incremental_inputs::finalize_inputs): Remove.
5592 (Incremental_inputs::report_input_section): New function.
5593 (Incremental_inputs::report_script): Rewrite.
5594 (Incremental_inputs::finalize): Do nothing but finalize string table.
5595 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5596 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5597 (Incremental_inputs::create_data_sections): New function.
5598 (Incremental_inputs::relocs_entsize): New function.
5599 (Output_section_incremental_inputs::set_final_data_size): New function.
5600 (Output_section_incremental_inputs::do_write): New function.
5601 (Output_section_incremental_inputs::write_header): New function.
5602 (Output_section_incremental_inputs::write_input_files): New function.
5603 (Output_section_incremental_inputs::write_info_blocks): New function.
5604 (Output_section_incremental_inputs::write_symtab): New function.
5605 * incremental.h (Incremental_script_entry): Forward declaration.
5606 (Incremental_object_entry): Forward declaration.
5607 (Incremental_archive_entry): Forward declaration.
5608 (Incremental_inputs): Forward declaration.
5609 (Incremental_inputs_header_data): Remove.
5610 (Incremental_inputs_header): Remove.
5611 (Incremental_inputs_header_write): Remove.
5612 (Incremental_inputs_entry_data): Remove.
5613 (Incremental_inputs_entry): Remove.
5614 (Incremental_inputs_entry_write): Remove.
5615 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5616 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5617 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5618 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5619 Likewise.
5620 (Incremental_input_entry): New class.
5621 (Incremental_script_entry): New class.
5622 (Incremental_object_entry): New class.
5623 (Incremental_archive_entry): New class.
5624 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5625 (Incremental_inputs::report_inputs): Remove.
5626 (Incremental_inputs::report_archive): Remove.
5627 (Incremental_inputs::report_archive_begin): New function.
5628 (Incremental_inputs::report_archive_end): New function.
5629 (Incremental_inputs::report_object): Change prototype.
5630 (Incremental_inputs::report_input_section): New function.
5631 (Incremental_inputs::report_script): Change prototype.
5632 (Incremental_inputs::get_reloc_count): New function.
5633 (Incremental_inputs::set_reloc_count): New function.
5634 (Incremental_inputs::create_data_sections): New function.
5635 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5636 (Incremental_inputs::inputs_section): New function.
5637 (Incremental_inputs::symtab_section): New function.
5638 (Incremental_inputs::relocs_section): New function.
5639 (Incremental_inputs::get_stringpool): Add const.
5640 (Incremental_inputs::command_line): Add const.
5641 (Incremental_inputs::inputs): Remove.
5642 (Incremental_inputs::command_line_key): New function.
5643 (Incremental_inputs::input_file_count): New function.
5644 (Incremental_inputs::input_files): New function.
5645 (Incremental_inputs::relocs_entsize): New function.
5646 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5647 (Incremental_inputs::finalize_inputs): Remove.
5648 (Incremental_inputs::Input_info): Remove.
5649 (Incremental_inputs::lock_): Remove.
5650 (Incremental_inputs::inputs_): Change type.
5651 (Incremental_inputs::inputs_map_): Remove.
5652 (Incremental_inputs::current_object_entry_): New data member.
5653 (Incremental_inputs::inputs_section_): New data member.
5654 (Incremental_inputs::symtab_section_): New data member.
5655 (Incremental_inputs::relocs_section_): New data member.
5656 (Incremental_inputs::reloc_count_): New data member.
5657 (Incremental_inputs_reader): New class.
5658 (Incremental_symtab_reader): New class.
5659 (Incremental_relocs_reader): New class.
5660 * layout.cc (Layout::finalize): Move finalization of incremental info
5661 and creation of incremental info sections to follow finalization of
5662 symbol table. Set offsets for postprocessing sections.
5663 (Layout::create_incremental_info_sections): Call
5664 Incremental_inputs::create_data_sections. Add incremental symtab
5665 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5666 sections to layout after input sections.
5667 * layout.h (struct Timespec): Forward declaration.
5668 (Layout::incremental_inputs): Add const.
5669 (Layout::create_incremental_info_sections): Add parameter.
5670 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5671 * object.cc: Include incremental.h.
5672 (Relobj::finalize_incremental_relocs): New function.
5673 (Sized_relobj::do_layout): Record input sections in incremental info.
5674 * object.h (Object::output_section): New function.
5675 (Object::output_section_offset): Moved from Relobj.
5676 (Object::get_incremental_reloc_base): New function.
5677 (Object::get_incremental_reloc_count): New function.
5678 (Object::do_output_section): New function.
5679 (Object::do_output_section_offset): Moved from Relobj.
5680 (Object::do_get_incremental_reloc_base): New function.
5681 (Object::do_get_incremental_reloc_count): New function.
5682 (Object::Object): Initialize new data members.
5683 (Relobj::output_section): Renamed do_output_section and moved to
5684 protected.
5685 (Relobj::output_section_offset): Moved to Object.
5686 (Relobj::do_get_incremental_reloc_base): New function.
5687 (Relobj::do_get_incremental_reloc_count): New function.
5688 (Relobj::allocate_incremental_reloc_counts): New function.
5689 (Relobj::count_incremental_reloc): New function.
5690 (Relobj::finalize_incremental_relocs): New function.
5691 (Relobj::next_incremental_reloc_index): New function.
5692 (Relobj::reloc_counts_): New data member.
5693 (Relobj::reloc_bases_): New data member.
5694 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5695 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5696 (Sized_relobj::incremental_relocs_scan): New function.
5697 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5698 (Sized_relobj::incremental_relocs_write): New function.
5699 (Sized_relobj::incremental_relocs_write_reltype): New function.
5700 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5701 incremental link.
5702 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5703 archives and object files elsewhere.
5704 (Add_symbols::run): Report object files here.
5705 (Finish_group::run): Report end of archive at end of group.
5706 * reloc.cc: Include layout.h, incremental.h.
5707 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5708 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5709 (Sized_relobj::incremental_relocs_scan): New function.
5710 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5711 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5712 (Sized_relobj::incremental_relocs_write): New function.
5713 (Sized_relobj::incremental_relocs_write_reltype): New function.
5714 * script.cc (read_input_script): Rewrite test for incremental link.
5715 Change call to Incremental_inputs::report_script.
5716 * symtab.h (Symbol_table::first_global_index): New function.
5717 (Symbol_table::output_count): New function.
5718
5719 2010-08-12 Doug Kwan <dougkwan@google.com>
5720
5721 * arm.cc (Target_arm::merge_object_attributes): Check command line
5722 options --no-wchar-size-warning and --no-enum-size-warning.
5723 * options.h (General_options): Add ld-compatible options
5724 --no-enum-size-warning and --no-wchar-size-warning.
5725
5726 2010-08-04 Ian Lance Taylor <iant@google.com>
5727
5728 * x86_64.cc (Target_x86_64::Scan::local): Use
5729 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5730 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5731 (Target_x86_64::Scan::global): Likewise.
5732 (Target_x86_64::Relocate::relocate): Likewise.
5733 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5734 Likewise.
5735
5736 2010-08-03 Cary Coutant <ccoutant@google.com>
5737
5738 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5739 to reserve space in merged_strings vector. Keep total input size
5740 for stats.
5741 (Output_merge_string::do_print_merge_stats): Print total input size.
5742 * merge.h (Output_merge_string): Add input_size_ field.
5743 * stringpool.cc (Stringpool_template::string_length): Move
5744 implementations out of Stringpool_template class and place in
5745 stringpool.h.
5746 * stringpool.h (string_length): Move out of Stringpool_template.
5747
5748 2010-08-03 Ian Lance Taylor <iant@google.com>
5749
5750 PR 11712
5751 * layout.cc (relaxation_loop_body): If address of load segment is
5752 set, adjust address to include headers if possible.
5753
5754 2010-08-03 Ian Lance Taylor <iant@google.com>
5755
5756 * version.cc (version_string): Bump to 1.10.
5757
5758 2010-08-03 Ian Lance Taylor <iant@google.com>
5759
5760 PR 11805
5761 * layout.h (enum Output_section_order): Define.
5762 (class Layout): Update declarations.
5763 * layout.cc (Layout::get_output_section): Add order parameter.
5764 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5765 is_first_non_relro parameters. Change all callers.
5766 (Layout::choose_output_section): Likewise.
5767 (Layout::add_output_section_data): Likewise.
5768 (Layout::make_output_section): Likewise. Set order.
5769 (Layout::default_section_order): New function.
5770 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5771 * output.cc (Output_section::Output_section): Initialize order_.
5772 Don't initialize deleted fields.
5773 (Output_segment::Output_segment): Don't initialize deleted
5774 fields.
5775 (Output_segment::add_output_section_to_load): New function
5776 replacing add_output_section. Change all callers to call this or
5777 add_output_section_to_nonload.
5778 (Output_segment::add_output_section_to_nonload): New function.
5779 (Output_segment::remove_output_section): Rewrite.
5780 (Output_segment::add_initial_output_data): Likewise.
5781 (Output_segment::has_any_data_sections): Likewise.
5782 (Output_segment::is_first_section_relro): Likewise.
5783 (Output_segment::maximum_alignment): Likewise.
5784 (Output_segment::has_dynamic_reloc): New function replacing
5785 dynamic_reloc_count. Change all callers.
5786 (Output_segment::has_dynamic_reloc_list): New function replacing
5787 dynamic_reloc_count_list. Change all callers.
5788 (Output_segment::set_section_addresses): Rewrite.
5789 (Output_segment::set_offset): Rewrite.
5790 (Output_segment::find_first_and_last_list): Remove.
5791 (Output_segment::set_tls_offsets): Rewrite.
5792 (Output_segment::first_section_load_address): Likewise.
5793 (Output_segment::output_section_count): Likewise.
5794 (Output_segment::section_with_lowest_load_address): Likewise.
5795 (Output_segment::write_section_headers): Likewise.
5796 (Output_segment::print_sections_to_map): Likewise.
5797 * output.h (class Output_data): Remove dynamic_reloc_count_
5798 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5799 (Output_data::add_dynamic_reloc): Rewrite.
5800 (Output_data::has_dynamic_reloc): New function.
5801 (Output_data::dynamic_reloc_count): Remove.
5802 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5803 is_last_relro_, is_first_non_relro_, is_interp_,
5804 is_dynamic_linker_section_ fields. Add order and set_order
5805 functions. Remove is_relro_local, set_is_relro_local,
5806 is_last_relro, set_is_last_relro, is_first_non_relro,
5807 set_is_first_non_relro functions, is_interp, set_is_interp,
5808 is_dynamic_linker_section, and set_is_dynamic_linker_section
5809 functions.
5810 (class Output_segment): Change Output_data_list from std::list to
5811 std:;vector. Add output_lists_ field. Remove output_data_ and
5812 output_bss_ fields. Update declarations.
5813
5814 2010-08-02 Ian Lance Taylor <iant@google.com>
5815
5816 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5817 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5818 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5819
5820 2010-08-02 Ian Lance Taylor <iant@google.com>
5821
5822 PR 11855
5823 * script.cc (Script_options::Script_options): Initialize
5824 symbol_definitions_ and symbol_references_.
5825 (Script_options::add_symbol_assignment): Update
5826 symbol_definitions_ and symbol_references_.
5827 (Script_options::add_symbol_reference): New function.
5828 (script_symbol): New function.
5829 * script.h (class Script_options): Add symbol_definitions_ and
5830 symbol_references_ fields.
5831 (Script_options::referenced_const_iterator): New type.
5832 (Script_options::referenced_begin): New function.
5833 (Script_options::referenced_end): New function.
5834 (Script_options::is_referenced): New function.
5835 (Script_options::any_unreferenced): New function.
5836 * script-c.h (script_symbol): Declare.
5837 * yyscript.y (exp): Call script_symbol.
5838 * symtab.cc: Include "script.h".
5839 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5840 Change all callers. Check symbols referenced by scripts.
5841 (Symbol_table::add_undefined_symbols_from_command_line): Add
5842 layout parameter. Change all callers.
5843 (Symbol_table::do_add_undefined_symbols_from_command_line):
5844 Likewise. Break out loop body. Check symbols referenced by
5845 scripts.
5846 (Symbol_table::add_undefined_symbol_from_command_line): New
5847 function broken out of
5848 do_add_undefined_symbols_from_command_line.
5849 * symtab.h (class Symbol_table): Update declarations.
5850 * archive.cc: Include "layout.h".
5851 (Archive::should_include_member): Add layout parameter. Change
5852 all callers. Check for symbol mentioned in expression.
5853 * archive.h (class Archive): Update declaration.
5854 * object.cc (Sized_relobj::do_should_include_member): Add layout
5855 parameter.
5856 * object.h (Object::should_include_member): Add layout parameter.
5857 Change all callers.
5858 (Object::do_should_include_member): Add layout parameter.
5859 (class Sized_relobj): Update declaration.
5860 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5861 parameter.
5862 * dynobj.h (class Sized_dynobj): Update declaration.
5863 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5864 layout parameter.
5865 * plugin.h (class Sized_pluginobj): Update declaration.
5866
5867 2010-08-02 Ian Lance Taylor <iant@google.com>
5868
5869 PR 11866
5870 * output.cc (Output_segment::set_offset): Search for the first and
5871 last sections rather than assuming that the list is in order.
5872 (Output_segment::find_first_and_last_list): New function.
5873 * output.h (class Output_segment): Update declarations.
5874 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5875 (relro_strip_test_SOURCES): New variable.
5876 (relro_strip_test_DEPENDENCIES): New variable.
5877 (relro_strip_test_LDFLAGS): New variable.
5878 (relro_strip_test_LDADD): New variable.
5879 (relro_strip_test.so): New target.
5880
5881 2010-08-02 Ian Lance Taylor <iant@google.com>
5882
5883 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5884 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5885 (Target_i386::got_tlsdesc_section): New function.
5886 (Target_i386::got_section): Create space for GOT entries for
5887 TLSDESC relocations.
5888 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5889 R_386_TLS_GOTDESC.
5890 (Target_i386::Scan::global): Likewise.
5891 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5892 using TLSDESC GOT.
5893 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5894 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5895 (Target_x86_64::got_tlsdesc_section): New function.
5896 (Target_x86_64::got_section): Create space for GOT entries for
5897 TLSDESC relocations.
5898 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5899 R_386_TLS_GOTDESC.
5900 (Target_x86_64::Scan::global): Likewise.
5901 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5902 using TLSDESC GOT.
5903
5904 2010-08-02 Ian Lance Taylor <iant@google.com>
5905
5906 * testsuite/final_layout.sh: Use dc to convert from hex to
5907 decimal.
5908
5909 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5910
5911 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5912 paramter to the call to gold::gc_process_relocs.
5913 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5914 paramter to the call to gold::gc_process_relocs.
5915 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5916 parameter to the call to gold::gc_process_relocs.
5917 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5918 template parameter to the call to gold::gc_process_relocs.
5919 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5920 paramter to the call to gold::gc_process_relocs.
5921 * gc.h (get_embedded_addend_size): New function.
5922 (gc_process_relocs): Save the size of the reloc for use by ICF.
5923 * icf.cc (get_section_contents): Get the addend from the text section
5924 for SHT_REL relocation sections.
5925 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5926 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5927 * int_encoding.h (read_from_pointer): New overloaded function.
5928 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5929 * testsuite/icf_sht_rel_addend_test.sh: New file.
5930 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5931 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5932
5933 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5934
5935 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5936 * Makefile.in: Regenerate.
5937 * testsuite/Makefile.in: Regenerate.
5938
5939 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5940
5941 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5942 * gold/testsuite/debug_msg.cc: Likewise.
5943 * gold/testsuite/odr_violation1.cc
5944 * gold/testsuite/odr_violation2.cc
5945
5946 2010-07-21 Cary Coutant <ccoutant@google.com>
5947
5948 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5949 string, and length fields.
5950 (Output_merge_string::Merged_strings_list): New type.
5951 (Output_merge_string::Merged_strings_lists): New typedef.
5952 (Output_merge_string): Replace merged_strings_ with
5953 merged_strings_lists_.
5954 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5955 Merged_strings_list per input object and section. Don't store pointer
5956 to the string. Don't store length with each merged string entry.
5957 (Output_merge_string::finalize_merged_data): Loop over list of merged
5958 strings lists. Recompute length of each merged string.
5959
5960 2010-07-15 Cary Coutant <ccoutant@google.com>
5961
5962 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5963 here.
5964
5965 2010-07-14 Ian Lance Taylor <iant@google.com>
5966
5967 * descriptors.cc (Descriptors::open): Report correct name in error
5968 message.
5969
5970 2010-07-13 Doug Kwan <dougkwan@google.com>
5971
5972 * arm.cc (Arm_input_section::Arm_input_section): For a
5973 SHT_ARM_EXIDX section, always keeps the input sections.
5974 (Arm_input_section::set_exidx_section_link): New method.
5975 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5976 has_errors_ to false.
5977 (Arm_exidx_input_section::has_errors,
5978 Arm_exidx_input_section::set_has_errors): New methods.
5979 (Arm_exidx_input_section::has_errors_): New data member.
5980 (Arm_relobj::get_exidx_shndx_list): New method.
5981 (Arm_output_section::append_text_sections_to_list): Do not skip
5982 section without SHF_EXECINSTR.
5983 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5984 errors.
5985 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5986 section header. Make error messages more verbose. Check for
5987 a non-executable section linked to an EXIDX section.
5988 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5989 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5990 check that there is no deferred EXIDX section if we exit early.
5991 Instead of not making an EXIDX section in case of an error, make one
5992 and set the has_errors flag of it.
5993 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5994 in a relocatable link.
5995 (Target_arm::do_relax): Look for the EXIDX output section instead of
5996 assuming that it is called .ARM.exidx.
5997 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5998 section list. Do not check for SHF_EXECINSTR section flags but
5999 skip any input section with errors.
6000 * output.cc (Output_section::Output_section): Initialize
6001 always_keeps_input_sections_ to false.
6002 (Output_section::add_input_section): Check for
6003 always_keeps_input_sections_.
6004 * output.h (Output_section::always_keeps_input_sections,
6005 Output_section::set_always_keeps_input_sections): New methods.
6006 (Output_section::always_keeps_input_sections): New data member.
6007
6008 2010-07-13 Rafael Espindola <espindola@google.com>
6009
6010 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6011 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6012
6013 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6014 Ian Lance Taylor <iant@google.com>
6015
6016 * output.h (Output_section_lookup_maps::add_merge_section):
6017 Correct check of whether value was inserted.
6018 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6019 (Output_section_lookup_maps::add_relaxed_input_section):
6020 Likewise.
6021 * arm.cc (Target_arm::got_section): Remove used local os.
6022 * i386.cc (Target_i386::got_section): Likewise.
6023 * x86_64.cc (Target_x86_64::got_section): Likewise.
6024 * sparc.cc (Target_sparc::got_section): Likewise.
6025 (Target_sparc::relocate): Remove unused local have_got_offset.
6026 * powerpc.cc (Target_powerpc::relocate): Likewise.
6027
6028 2010-07-13 Ian Lance Taylor <iant@google.com>
6029
6030 * compressed_output.cc (zlib_decompress): Fix signature in
6031 !HAVE_ZLIB_H case.
6032
6033 * archive.cc (Archive::include_member): Unlock an external member
6034 of a thin archive. Don't bother to delete an object we know is
6035 NULL.
6036
6037 2010-07-12 Cary Coutant <ccoutant@google.com>
6038
6039 * compressed_output.cc (zlib_decompress): New function.
6040 (get_uncompressed_size): New function.
6041 (decompress_input_section): New function.
6042 * compressed_output.h (get_uncompressed_size): New function.
6043 (decompress_input_section): New function.
6044 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6045 Handle compressed debug sections.
6046 * layout.cc (is_compressed_debug_section): New function.
6047 (Layout::output_section_name): Map compressed section names to
6048 canonical names.
6049 * layout.h (is_compressed_debug_section): New function.
6050 (is_debug_info_section): Recognize compressed debug sections.
6051 * merge.cc: Include compressed_output.h.
6052 (Output_merge_data::do_add_input_section): Handle compressed
6053 debug sections.
6054 (Output_merge_string::do_add_input_section): Handle compressed
6055 debug sections.
6056 * object.cc: Include compressed_output.h.
6057 (Sized_relobj::Sized_relobj): Initialize new data members.
6058 (build_compressed_section_map): New function.
6059 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6060 * object.h (Object::section_is_compressed): New method.
6061 (Object::do_section_is_compressed): New method.
6062 (Sized_relobj::Compressed_section_map): New type.
6063 (Sized_relobj::do_section_is_compressed): New method.
6064 (Sized_relobj::compressed_sections_): New data member.
6065 * output.cc (Output_section::add_input_section): Handle compressed
6066 debug sections.
6067 * reloc.cc: Include compressed_output.h.
6068 (Sized_relobj::write_sections): Handle compressed debug sections.
6069
6070 2010-07-08 Cary Coutant <ccoutant@google.com>
6071
6072 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6073 weak when resolving to a dynamic def.
6074 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6075 for weak undef/dynamic def cases. Adjust callers.
6076 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6077 undef_binding_weak_.
6078 (Symbol_table::sized_write_globals): Adjust symbol binding.
6079 (Symbol_table::sized_write_symbol): Add binding parameter.
6080 * symtab.h (Symbol::set_undef_binding): New method.
6081 (Symbol::is_undef_binding_weak): New method.
6082 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6083 (Symbol_table::should_override): Add new parameter.
6084 (Symbol_table::sized_write_symbol): Add new parameter.
6085
6086 * testsuite/weak_undef_file1.cc: Add new test case.
6087 * testsuite/weak_undef_file2.cc: Fix header comment.
6088 * testsuite/weak_undef_test.cc: Add new test case.
6089
6090 2010-06-29 Doug Kwan <dougkwan@google.com>
6091
6092 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6093 Initialize USE_SYMBOL_.
6094 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6095 definition.
6096 (Arm_reloc_property::uses_symbol_): New data member declaration.
6097 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6098 uses symbol value and symbol is undefined but not weakly undefined.
6099
6100 2010-06-28 Rafael Espindola <espindola@google.com>
6101
6102 * plugin.cc (Plugin::load): Use dlerror.
6103
6104 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6105
6106 * symtab.cc (detect_odr_violations): When reporting an ODR
6107 violation, report an object where the symbol is defined.
6108
6109 2010-06-25 Doug Kwan <dougkwan@google.com>
6110
6111 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6112 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6113 definition.
6114 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6115 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6116 target hook to detect function points.
6117 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6118 * icf.h (Icf::check_section_for_function_pointers): Change type of
6119 parameter SECTION_NAME to const reference to std::string. Use
6120 target hook to determine if section may have unsafe pointers.
6121 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6122 method definition.
6123
6124 2010-06-21 Rafael Espindola <espindola@google.com>
6125
6126 * fileread.cc (Input_file::find_fie): New
6127 (Input_file::open): Use Input_file::find_fie.
6128 * fileread.h (Input_file::find_fie): New
6129 * plugin.cc (set_extra_library_path): New.
6130 (Plugin::load): Add set_extra_library_path to the transfer vector.
6131 (Plugin_manager::set_extra_library_path): New.
6132 (Plugin_manager::add_input_file): Use the extra search path if set.
6133 (set_extra_library_path(): New.
6134 * plugin.h (Plugin_manager): Add set_extra_library_path and
6135 extra_search_path_.
6136
6137 2010-06-19 Cary Coutant <ccoutant@google.com>
6138
6139 * layout.cc (gdb_sections): Add .debug_types.
6140 (lines_only_debug_sections): Likewise.
6141
6142 2010-06-18 Rafael Espindola <espindola@google.com>
6143
6144 * plugin.cc (add_input_file,add_input_library)
6145 (Plugin_manager::add_input_file): Make filename arguments const.
6146 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6147 const.
6148
6149 2010-06-16 Doug Kwan <dougkwan@google.com>
6150
6151 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6152 .ARM.attributes section if we have not merged any input
6153 attributes sections.
6154
6155 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6156
6157 * arm.cc: Allow combining objects with no EABI version
6158 information.
6159
6160 2010-06-15 Rafael Espindola <espindola@google.com>
6161
6162 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6163
6164 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6165
6166 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6167 (struct iovec): Correct !HAVE_READV definition.
6168
6169 2010-06-10 Cary Coutant <ccoutant@google.com>
6170
6171 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6172 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6173 reloc sections.
6174 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6175
6176 PR 11683
6177 * symtab.h (Symbol::is_placeholder): New member function.
6178 * target-reloc.h (relocate_section): Check for placeholder symbols.
6179
6180 * testsuite/Makefile.am (plugin_test_8): New test.
6181 (plugin_test_9): New test.
6182 * testsuite/Makefile.in: Regenerate.
6183
6184 2010-06-09 Nick Clifton <nickc@redhat.com>
6185
6186 * yyscript.y (input_list_element): Allow strings prefixed with
6187 the '-' character. Treat these as libraries.
6188 * script.cc (script_add_library): New function. Adds a library
6189 specified by "-l<name>" found in an input script.
6190 * script-c.h: Add prototype for script_add_library.
6191
6192 2010-06-07 Doug Kwan <dougkwan@google.com>
6193
6194 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6195 Restrict stub-group size to be within long conditional branch
6196 range when working around cortex-A8 erratum.
6197
6198 2010-06-07 Damien Diederen <dd@crosstwine.com>
6199
6200 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6201 #ifdef typo.
6202
6203 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6204
6205 PR gold/11658
6206 * output.cc
6207 (Output_section::Input_section_sort_entry::compare_section_ordering):
6208 Change to return non-zero correctly.
6209 (Output_section::Input_section_sort_section_order_index_compare
6210 ::operator()): Change to fix ambiguity in comparisons.
6211
6212 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6213
6214 * gold.h (is_wildcard_string): New function.
6215 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6216 (Layout::layout_eh_frame): Ditto.
6217 (Layout::find_section_order_index): New method.
6218 (Layout::read_layout_from_file): New method.
6219 * layout.h (Layout::find_section_order_index): New method.
6220 (Layout::read_layout_from_file): New method.
6221 (Layout::input_section_position_): New private member.
6222 (Layout::input_section_glob_): New private member.
6223 * main.cc (main): Call read_layout_from_file here.
6224 * options.h (--section-ordering-file): New option.
6225 * output.cc (Output_section::input_section_order_specified_): New
6226 member.
6227 (Output_section::Output_section): Initialize new member.
6228 (Output_section::add_input_section): Add new parameter.
6229 Keep input sections when --section-ordering-file is used.
6230 (Output_section::set_final_data_size): Sort input sections when
6231 section ordering file is specified.
6232 (Output_section::Input_section_sort_entry): Add new parameter.
6233 Check sorting type.
6234 (Output_section::Input_section_sort_entry::compare_section_ordering):
6235 New method.
6236 (Output_section::Input_section_sort_compare::operator()): Change to
6237 consider section_order_index.
6238 (Output_section::Input_section_sort_init_fini_compare::operator()):
6239 Change to consider section_order_index.
6240 (Output_section::Input_section_sort_section_order_index_compare
6241 ::operator()): New method.
6242 (Output_section::sort_attached_input_sections): Change to sort
6243 according to section order when specified.
6244 (Output_section::add_input_section<32, true>): Add new parameter.
6245 (Output_section::add_input_section<64, true>): Add new parameter.
6246 (Output_section::add_input_section<32, false>): Add new parameter.
6247 (Output_section::add_input_section<64, false>): Add new parameter.
6248 * output.h (Output_section::add_input_section): Add new parameter.
6249 (Output_section::input_section_order_specified): New
6250 method.
6251 (Output_section::set_input_section_order_specified): New method.
6252 (Input_section::Input_section): Initialize section_order_index_.
6253 (Input_section::section_order_index): New method.
6254 (Input_section::set_section_order_index): New method.
6255 (Input_section::section_order_index_): New member.
6256 (Input_section::Input_section_sort_section_order_index_compare): New
6257 struct.
6258 (Output_section::input_section_order_specified_): New member.
6259 * script-sections.cc (is_wildcard_string): Delete and move modified
6260 method to gold.h.
6261 (Output_section_element_input::Output_section_element_input): Modify
6262 call to is_wildcard_string.
6263 (Output_section_element_input::Input_section_pattern
6264 ::Input_section_pattern): Ditto.
6265 (Output_section_element_input::Output_section_element_input): Ditto.
6266 * testsuite/Makefile.am (final_layout): New test case.
6267 * testsuite/Makefile.in: Regenerate.
6268 * testsuite/final_layout.cc: New file.
6269 * testsuite/final_layout.sh: New file.
6270
6271 2010-06-01 Rafael Espindola <espindola@google.com>
6272
6273 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6274
6275 2010-06-01 Rafael Espindola <espindola@google.com>
6276
6277 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6278 visibility of symbols.
6279
6280 2010-05-27 Doug Kwan <dougkwan@google.com>
6281
6282 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6283 from start of output section instead of address for a local symbol
6284 in a merged or relaxed section when doing a relocatable link.
6285
6286 2010-05-26 Rafael Espindola <espindola@google.com>
6287
6288 PR 11604
6289 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6290 adding sections the garbage collector removed.
6291 * gold/testsuite/Makefile.am: Add test.
6292 * gold/testsuite/Makefile.in: Regenerate.
6293 * gold/testsuite/plugin_test_7.sh: New.
6294 * gold/testsuite/plugin_test_7_1.c: New.
6295 * gold/testsuite/plugin_test_7_2.c: New.
6296
6297 2010-05-26 Rafael Espindola <espindola@google.com>
6298
6299 * script-sections.cc (Output_section_definition::set_section_addresses):
6300 Check for --section-start.
6301
6302 2010-05-26 Doug Kwan <dougkwan@google.com>
6303
6304 * arm.cc (Arm_scan_relocatable_relocs): New class.
6305 (Target_arm::relocate_special_relocatable): New method.
6306 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6307 (Arm_relocate_functions::thumb_branch_common): Same.
6308 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6309 instead of Default_scan_relocatable_relocs.
6310 * target-reloc.h (relocate_for_relocatable): Let target handle
6311 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6312 * target.h (Sized_target::relocate_special_relocatable): New method.
6313
6314 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6315
6316 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6317
6318 2010-05-23 Doug Kwan <dougkwan@google.com>
6319
6320 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6321 instead of a cast.
6322 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6323 with a direct branch, not a conditional branch, to a stub.
6324 * merge.cc (Output_merge_base::record_input_section): New method
6325 defintion.
6326 (Output_merge_data::do_add_input_section): Record input section if
6327 keeps-input-sections flag is set.
6328 (Output_merge_string::do_add_input_section): Ditto.
6329 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6330 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6331 INPUT_SECTIONS_.
6332 (Output_merge_base::keeps_input_sections,
6333 Output_merge_base::set_keeps_input_sections,
6334 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6335 method definitions.
6336 (Output_merge_base::Input_sections): New type declaration.
6337 (Output_merge_base::input_sections_begin,
6338 Output_merge_base::input_sections_end,
6339 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6340 (Output_merge_base::bool keeps_input_sections_,
6341 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6342 Output_merge_base::input_sections_): New data members.
6343 (Output_merge_data::do_set_keeps_input_sections): New method
6344 defintion.
6345 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6346 * output.cc (Output_section::Input_section::relobj): Move method
6347 defintion from class declaration to here and handle merge sections.
6348 (Output_section::Input_section::shndx): Ditto.
6349 (Output_section::Output_section): Remove initializations of removed
6350 data members and initialize new data member LOOKUP_MAPS_.
6351 (Output_section::add_input_section): Set keeps-input-sections flag
6352 for a newly created merge output section as appropriate. Adjust code
6353 to use Output_section_lookup_maps class.
6354 (Output_section::add_relaxed_input_section): Adjst code for lookup
6355 maps code refactoring.
6356 (Output_section::add_merge_input_section): Add a new parameter
6357 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6358 class. If adding input section to a newly created merge output
6359 section fails, remove the new merge section.
6360 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6361 Adjust code for use of the Output_section_lookup_maps class.
6362 (Output_section::find_merge_section): Ditto.
6363 (Output_section::build_lookup_maps): New method defintion.
6364 (Output_section::find_relaxed_input_section): Adjust code to use
6365 Output_section_lookup_maps class.
6366 (Output_section::get_input_sections): Export merge sections. Adjust
6367 code to use Output_section_lookup_maps class.
6368 (Output_section:::add_script_input_section): Adjust code to use
6369 Output_section_lookup_maps class. Update lookup maps for merge
6370 sections also.
6371 (Output_section::discard_states): Use Output_section_lookup_maps.
6372 (Output_section::restore_states): Same.
6373 * output.h (Merge_section_properties): Move class defintion out of
6374 Output_section.
6375 (Output_section_lookup_maps): New class.
6376 (Output_section::Input_section::is_merge_section): New method
6377 defintion.
6378 (Output_section::Input_section::relobj): Move defintion out of class
6379 defintion. Declare method only.
6380 (Output_section::Input_section::shndx): Ditto.
6381 (Output_section::Input_section::output_merge_base): New method defintion.
6382 (Output_section::Input_section::u2_.pomb): New union field.
6383 (Output_section::Merge_section_by_properties_map,
6384 Output_section::Output_section_data_by_input_section_map,
6385 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6386 Remove types.
6387 (Output_section::add_merge_input_section): Add new parameter
6388 KEEPS_INPUT_SECTIONS.
6389 (Output_section::build_lookup_maps): New method declaration.
6390 (Output_section::merge_section_map_,
6391 Output_section::merge_section_by_properties_map_,
6392 Output_section::relaxed_input_section_map_,
6393 Output_section::is_relaxed_input_section_map_valid_): Remove data
6394 members.
6395 (Output_section::lookup_maps_): New data member.
6396
6397 2010-05-21 Doug Kwan <dougkwan@google.com>
6398
6399 PR gold/11619
6400 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6401 avoid a compilation error.
6402
6403 2010-05-19 Rafael Espindola <espindola@google.com>
6404
6405 * script-sections.cc (Output_section_definition::allocate_to_segment):
6406 Update the phdrs_list even when the output section is NULL.
6407 * testsuite/Makefile.am: Add test.
6408 * testsuite/Makefile.in: Regenerate.
6409 * testsuite/script_test_9.cc: New.
6410 * testsuite/script_test_9.sh: New.
6411 * testsuite/script_test_9.t: New.
6412
6413 2010-05-19 Doug Kwan <dougkwan@google.com>
6414
6415 * arm.cc (Arm_input_section::original_size): New method.
6416 (Arm_input_section::do_addralign): Add a cast.
6417 (Arm_input_section::do_output_offset): Remove static cast.
6418 (Arm_input_section::original_addralign,
6419 Arm_input_section::original_size_): Change type to uint32_t.
6420 (Arm_input_section::init): Add safe casts for section alignment
6421 and size.
6422 (Arm_input_section::set_final_data_size): Do not set address and
6423 offset of stub table.
6424 (Arm_output_section::fix_exidx_coverage): Change use of of
6425 Output_section::Simple_input_section to that of
6426 Output_section::Input_section.
6427 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6428 except for the first pass.
6429 * output.cc (Output_section::get_input_sections): Change type of
6430 input_sections to std::list<Input_section>.
6431 (Output_section::add_script_input_section): Rename from
6432 Output_section::add_simple_input_section. Change type of SIS
6433 parameter from Simple_input_section to Input_section.
6434 * output.h (Output_section::Simple_input_section): Remove class.
6435 (Output_section::Input_section): Change class visibility to public.
6436 (Output_section::Input_section::addralign): Use stored alignments
6437 for special input sections if set.
6438 (Output_section::Input_section::set_addralign): New method.
6439 (Output_section::get_input_sections): Change parameter type from
6440 list of Simple_input_section to list of Input_section.
6441 (Output_section::add_script_input_section): Rename from
6442 Output_section::add_simple_input_section. Change first parameter's
6443 type from Simple_input_section to Input_section and remove the
6444 second and third parameters.
6445 * script-sections.cc (Input_section::Input_section_list): Change
6446 type to list of Output_section::Input_section/
6447 (Input_section_info::Input_section_info): Change parameter type of
6448 INPUT_SECTION to Output_section::Input_section.
6449 (Input_section_info::input_section): Change return type.
6450 (Input_section_info::input_section_): Change type to
6451 Output_section::Input_section.
6452 (Output_section_element_input::set_section_addresses): Adjust code
6453 to use Output_section::Input_section instead of
6454 Output_section::Simple_input_section. Adjust code for renaming
6455 of Output_section::add_simple_input_section.
6456 (Orphan_output_section::set_section_addresses): Ditto.
6457
6458 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6459
6460 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6461 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6462
6463 2010-05-18 Rafael Espindola <espindola@google.com>
6464
6465 * options.cc (General_options::finalize): Handle -nostdlib.
6466 * options.h (nostdlib): New option.
6467 * script.cc (script_add_search_dir): Handle -nostdlib.
6468
6469 2010-05-12 Doug Kwan <dougkwan@google.com>
6470
6471 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6472 attributes section only if there no attributes section after merging.
6473 (Target_arm::merge_object_attributes): Move value of
6474 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6475 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6476 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6477 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6478 and arm_attr_merge_7.stdout.
6479 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6480 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6481 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6482 arm_attr_merge_7b.o): New rules.
6483 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6484 arm_attr_merge_7
6485 * testsuite/Makefile.in: Regenerate.
6486 * testsuite/arm_attr_merge.sh: New file.
6487 * testsuite/arm_attr_merge_[67][ab].s: Same.
6488
6489 2010-05-05 Nick Clifton <nickc@redhat.com>
6490
6491 * po/es.po: Updated Spanish translation.
6492
6493 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6494
6495 * Makefile.am (install-exec-local): Properly install gold as
6496 default cross linker.
6497 * Makefile.in: Regenerated.
6498
6499 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6500 Nick Clifton <nickc@redhat.com>
6501
6502 * configure.ac (install_as_default): Define and set to false
6503 unless --enable-gold or --enable-gold=both/gold has been
6504 specified.
6505 * configure: Regenerate.
6506
6507 * Makefile.am (install-exec-local): Install the executable as
6508 'ld.gold'. If install_as_default is true then also install it as
6509 'ld'.
6510 * Makefile.in: Regenerated.
6511
6512 2010-04-24 Ian Lance Taylor <iant@google.com>
6513
6514 * layout.cc (Layout::layout_reloc): In relocatable link don't
6515 combine reloc sections for grouped sections.
6516
6517 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6518
6519 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6520 sections that are not ordinary to icf.
6521 * icf.cc (get_section_contents): Handle relocation pointing to section
6522 with no object or shndx information.
6523 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6524 * testsuite/Makefile.in: Regenerate.
6525 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6526 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6527
6528 2010-04-22 Ian Lance Taylor <iant@google.com>
6529
6530 * expression.cc (Expression::Expression_eval_info): Add
6531 result_alignment_pointer field.
6532 (Expression::eval_with_dot): Add result_alignment_pointer
6533 parameter. Change all callers.
6534 (Expression::eval_maybe_dot): Likewise.
6535 (class Binary_expression): Add alignment_pointer parameter to
6536 left_value and right_value. Change all callers.
6537 (BINARY_EXPRESSION): Set result alignment.
6538 (class Trinary_expression): Add alignment_pointer parameter to
6539 arg2_value and arg3_value. Change all callers.
6540 (Trinary_cond::value): Set result alignment.
6541 (Max_expression::value, Min_expression::value): Likewise.
6542 (Align_expression::value): Likewise.
6543 * script-sections.cc (class Sections_element): Add dot_alignment
6544 parameter to set_section_addresses virtual function. Update
6545 instantiations.
6546 (class Output_section_element): Likewise.
6547 (Script_sections::create_segments): Add dot_alignment parameter.
6548 Change all callers.
6549 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6550 (Script_sections::set_phdrs_clause_addresses): Likewise.
6551 * script-sections.h: Update declarations.
6552 * script.h: Update declarations.
6553 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6554 min_p_align.
6555 * testsuite/script_test_3.t: Set large alignment.
6556 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6557 segment has expected alignment.
6558
6559 2010-04-22 Nick Clifton <nickc@redhat.com>
6560
6561 * po/gold.pot: Updated by the Translation project.
6562 * po/vi.po: Updated Vietnamese translation.
6563
6564 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6565
6566 * testsuite/Makefile.am (check_PROGRAMS): Add
6567 icf_virtual_function_folding_test.
6568 * testsuite/Makefile.in: Regenerated.
6569
6570 2010-04-15 Andrew Haley <aph@redhat.com>
6571
6572 * options.h (merge_exidx_entries): New option.
6573 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6574 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6575 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6576 (Target_arm::merge_exidx_entries): New function.
6577 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6578 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6579 to Arm_exidx_fixup constructor.
6580 Add new arg, merge_exidx_entries.
6581 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6582 Arm_output_section::fix_exidx_coverage.
6583
6584 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6585
6586 * icf.cc (get_section_contents): Check for preemptible functions.
6587 Ignore addend when appropriate.
6588 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6589 section folded.
6590 (add_from_relobj): Check for section folded.
6591 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6592 * symtab.h (should_add_dynsym_entry): Add new parameter.
6593 * target-reloc.h (scan_relocs): Check for section folded.
6594 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6595 Check reloc types for function pointers in shared objects.
6596 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6597 case.
6598 (icf_preemptible_functions_test): New test case.
6599 (icf_string_merge_test): New test case.
6600 * testsuite.Makefile.in: Regenerate.
6601 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6602 bar_glob. Refactor code.
6603 * testsuite/icf_preemptible_functions_test.cc: New file.
6604 * testsuite/icf_preemptible_functions_test.sh: New file.
6605 * testsuite/icf_string_merge_test.cc: New file.
6606 * testsuite/icf_string_merge_test.sh: New file.
6607 * testsuite/icf_virtual_function_folding_test.cc: New file.
6608 * testsuite/icf_virtual_function_folding_test.sh: New file.
6609
6610 2010-04-14 Doug Kwan <dougkwan@google.com>
6611
6612 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6613 for local symbol recounting if we remove a section due to ICF.
6614 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6615 there are no regular objects in input.
6616
6617 2010-04-13 Doug Kwan <dougkwan@google.com>
6618
6619 * arm.cc (Arm_input_section::set_final_data_size): Compute
6620 accurate final data size instead of using current data size.
6621
6622 2010-04-09 Doug Kwan <dougkwan@google.com>
6623
6624 * layout.cc (Layout::choose_output_section): Handle script section
6625 types.
6626 (Layout::make_output_section_for_script): Add section type parameter.
6627 Handle script section types.
6628 * layout.h (Layout::make_output_section_for_script): Add section
6629 type parameter.
6630 * output.cc (Output_section::Output_section): Initialize data member
6631 is_noload_.
6632 (Output_section::do_reset_address_and_file_offset): Do not set address
6633 to 0 if section is a NOLOAD section.
6634 * output.h (Output_section::is_noload): New method.
6635 (Output_section::set_is_noload): Ditto.
6636 (Output_section::is_noload_): New data member.
6637 * script-c.h (Script_section_type): New enum type.
6638 (struct Parser_output_section_header): Add new file section_type.
6639 * script-sections.cc (Sections_element::output_section_name): Add
6640 parameter for returning script section type.
6641 (Output_section_definition::output_section_name): Ditto.
6642 (Output_section_definition::section_type)P; New method.
6643 (Output_section_definiton::script_section_type_name): Ditto.
6644 (Output_section_definition::script_section_type_): New data member.
6645 (Output_section_definition::Output_section_definition): Initialize
6646 data member Output_section_definition::script_section_type_.
6647 (Output_section_definition::create_sections): Pass script section type
6648 to Layout::make_output_section_for_script.
6649 (Output_section_definition::output_section_name): Return script
6650 section type to caller.
6651 (Output_section_definition::set_section_address): Do not advance
6652 dot value and load address if section type is NOLOAD. Set address
6653 of NOLOAD sections regardless of section flags.
6654 (Output_section_definition::print): Print section type if it is
6655 not SCRIPT_SECTION_TYPE_NONE.
6656 (Output_section_definition::section_type): New method.
6657 (Output_section_definition::script_section_type_name): Ditto.
6658 (Script_sections::output_section_name): Add new parameter
6659 PSECTION_TYPE for returning script section type. Pass it to
6660 section elements. Handle discard sections.
6661 (Sort_output_sections::operator()): Handle NOLOAD sections.
6662 * script-sections.h (Script_sections::Section_type): New enum type.
6663 (Script_sections::output_section_name): Add a new parameter for
6664 returning script section type.
6665 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6666 INFO and NOLOAD.
6667 * yyscript.y (union): Add new field SECTION_TYPE.
6668 (COPY, DSECT, INFO, NOLOAD): New tokens.
6669 (opt_address_and_section_type): Change type to output_section_header.
6670 (section_type): New non-terminal
6671 (section_header): Handle section type.
6672 (opt_address_and_section_type): Return section type value.
6673
6674 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6675
6676 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6677 * testsuite/plugin_common_test_2.c (foo): Likewise.
6678
6679 2010-04-08 Doug Kwan <dougkwan@google.com>
6680
6681 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6682 Output_merge_data.
6683 * output.cc (Output_section::add_merge_input_section): Simplify
6684 code and return status of Output_merge_base::add_input_section.
6685 Update merge section map only if Output_merge_base::add_input_section
6686 returns true.
6687
6688 2010-04-07 Doug Kwan <dougkwan@google.com>
6689
6690 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6691 if section is marked as containing instructions but has no mapping
6692 symbols.
6693 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6694 correct section index.
6695 (Arm_relobj::find_linked_text_section): Ditto.
6696
6697 2010-04-07 Cary Coutant <ccoutant@google.com>
6698
6699 * archive.cc (include_member): Destroy Read_symbols_data object before
6700 releasing file.
6701 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6702 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6703 (Read_symbols_data::~Read_symbols_data) New destructor.
6704 (Section_relocs::Section_relocs) New constructor.
6705 (Section_relocs::~Section_relocs) New destructor.
6706 (Read_relocs_data::Read_relocs_data) New constructor.
6707 (Read_relocs_data::~Read_relocs_data) New destructor.
6708 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6709 pointers to NULL after deleting.
6710
6711 2010-04-07 Doug Kwan <dougkwan@google.com>
6712
6713 * arm.cc: Replace "endianity" with "endianness" in comments.
6714 (Arm_exidx_cantunwind): Ditto.
6715 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6716 (Arm_relobj::merge_flags_and_attributes): New method.
6717 (Arm_relobj::merge_flags_and_attributes_): New data member.
6718 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6719 (Arm_relobj::scan_sections_for_stubs): Ditto.
6720 (Arm_relobj::do_read_symbols): Check to see if we really want to
6721 merge processor-specific flags and attributes. Exit early if
6722 an object is empty except for section names and the undefined symbol.
6723 (Target_arm::do_finalize_sections): Move check for ELF format to
6724 Arm_relobj::do_read_symbols. Merge processor specific flags and
6725 attributes from a regular object only when we have determined that
6726 it is aapropriate. Do not create an .ARM.attributes section in
6727 output if there is no regular input object.
6728 (Target_arm::merge_processor_specific_flags): Check
6729 --warn-mismatch before printing any error.
6730 (Target_arm::merge_object_attributes): Ditto.
6731 * gold.cc (queue_middle_tasks): Handle the case in which there is
6732 no regular object in input.
6733 * options.cc (General_options::parse_EB): New method.
6734 (General_options::parse_EL): Same.
6735 (General_options::General_options): Initialize endianness_.
6736 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6737 New options.
6738 (General_options::Endianness): New enum.
6739 (General_options::endianness): New method.
6740 (General_options::endianness_): New data member.
6741 * parameters.cc (Parameters::set_options): Check target endianness.
6742 (Parameters::set_target_once): Ditto.
6743 (Parameters::check_target_endianness): New method.
6744 (parameters_force_valid_target): If either -EL or -EB is specified,
6745 use it to define endianness of default target.
6746 * parameters.h (Parameters::check_target_endianness): New method
6747 declaration.
6748 * target.h (class Target): Change "endianity" to "endianness"
6749 in comments.
6750
6751 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6752
6753 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6754 * configure: Regenerate.
6755 * Makefile.in: Regenerate.
6756 * testsuite/Makefile.in: Regenerate.
6757
6758 2010-04-06 Cary Coutant <ccoutant@google.com>
6759
6760 gcc PR lto/42757
6761 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6762 prevailing definitions of common symbols.
6763 * testsuite/plugin_test_6.sh: New test case.
6764 * testsuite/plugin_common_test_1.c: New test case.
6765 * testsuite/plugin_common_test_2.c: New test case.
6766 * testsuite/Makefile.am (plugin_test_6): New test case.
6767 * testsuite/Makefile.in: Regenerate.
6768
6769 2010-04-06 Nick Clifton <nickc@redhat.com>
6770
6771 * po/vi.po: New Vietnamese translation.
6772
6773 2010-03-30 Doug Kwan <dougkwan@google.com>
6774
6775 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6776
6777 2010-03-25 Doug Kwan <dougkwan@google.com>
6778
6779 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6780 to avoid a conversion warning on a 32-bit host.
6781
6782 2010-03-24 Ian Lance Taylor <iant@google.com>
6783
6784 * testsuite/script_test_3.t: Add a TLS segment.
6785 * testsuite/Makefile.am (check_PROGRAMS): Add
6786 tls_phdrs_script_test.
6787 (tls_phdrs_script_test_SOURCES): Define.
6788 (tls_phdrs_script_test_DEPENDENCIES): Define.
6789 (tls_phdrs_script_test_LDFLAGS): Define.
6790 (tls_phdrs_script_test_LDADD): Define.
6791 * testsuite/Makefile.in: Rebuild.
6792
6793 2010-03-23 Cary Coutant <ccoutant@google.com>
6794
6795 * fileread.cc (find_or_make_view): Fix comment.
6796
6797 2010-03-23 Ian Lance Taylor <iant@google.com>
6798
6799 * script-sections.cc (class Orphan_section_placement): Define
6800 PLACE_TLS and PLACE_TLS_BSS.
6801 (Orphan_section_placement::Orphan_section_placement): Initialize
6802 new places.
6803 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6804 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6805 (tls_script_test_SOURCES): Define.
6806 (tls_script_test_DEPENDENCIES): Define.
6807 (tls_script_test_LDFLAGS): Define.
6808 (tls_script_test_LDADD): Define.
6809 * testsuite/Makefile.in: Rebuild.
6810
6811 2010-03-22 Doug Kwan <dougkwan@google.com>
6812
6813 * arm.cc (Arm_relocate_functions::abs8,
6814 Arm_relocate_functions::abs16): Use correct check for overflow
6815 specified in the ARM ELF specs.
6816 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6817 target of a BLX instruction specially.
6818 (Reloc_stub::stub_type_for_reloc): Ditto.
6819 (Relocate::relocate): Use symbolic names instead of numeric relocation
6820 codes to report error.
6821 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6822 workaround.
6823 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6824 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6825 thumb2_blx_out_of_range.stdout
6826 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6827 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6828 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6829 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6830 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6831 thumb2_blx_in_range, thumb2_blx_in_range.o,
6832 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6833 thumb2_blx_out_of_range.o): New rules.
6834 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6835 thumb2_blx_in_range and thumb2_blx_out_of_range.
6836 * testsuite/Makefile.in: Regenerate.
6837 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6838 * testsuite/thumb_blx_in_range.s: New file.
6839 * testsuite/thumb_blx_out_of_range.s: New file.
6840
6841 2010-03-22 Rafael Espindola <espindola@google.com>
6842
6843 * archive.cc (Should_include): Move to archive.h.
6844 (should_include_member): Make it a member of Archive.
6845 (Lib_group): New.
6846 (Add_lib_group_symbols): New.
6847 * archive.h: Include options.h.
6848 (Archive_member): Moved from Archive.
6849 (Should_include): Moved from archive.cc.
6850 (Lib_group): New.
6851 (Add_lib_group_symbols): New.
6852 * dynobj.cc (do_should_include_member): New.
6853 * dynobj.h (do_should_include_member): New.
6854 * gold.cc (queue_initial_tasks): Update call to queue.
6855 * main.cc (main): Print lib group stats.
6856 * object.cc (do_should_include_member): New.
6857 * object.h: Include archive.h.
6858 (Object::should_include_member): New.
6859 (Object::do_should_include_member): New.
6860 (Sized_relobj::do_should_include_member): New.
6861 * options.cc (General_options::parse_start_lib): New.
6862 (General_options::parse_end_lib): New.
6863 (Input_arguments::add_file): Handle lib groups.
6864 (Input_arguments::start_group): Check we are not in a lib.
6865 (Input_arguments::start_lib): New.
6866 (Input_arguments::end_lib): New.
6867 * options.h (General_options): Add start_lib and end_lib.
6868 (Input_argument::lib_): New.
6869 (Input_argument::lib): New.
6870 (Input_argument::is_lib): New.
6871 (Input_file_lib): New.
6872 (Input_arguments::in_lib_): New.
6873 (Input_arguments::in_lib): New.
6874 (Input_arguments::start_lib): New.
6875 (Input_arguments::end_lib_): New.
6876 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6877 in unused members as preempted.
6878 (Sized_pluginobj::do_should_include_member): New.
6879 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6880 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6881 return the blocker.
6882 (Read_symbols::do_whole_lib_group): New.
6883 (Read_symbols::do_lib_group): New.
6884 (Read_symbols::do_read_symbols): Handle lib groups.
6885 (Read_symbols::get_name): Handle lib groups.
6886 * readsyms.h (Read_symbols): Add an archive member pointer.
6887 (Read_symbols::do_whole_lib_group): New.
6888 (Read_symbols::do_lib_group): New.
6889 (Read_symbols::member_): New.
6890 * script.cc (read_input_script): Update call to queue_soon.
6891
6892 2010-03-19 Doug Kwan <dougkwan@google.com>
6893
6894 * arm.cc (Stub_table::Stub_table): Initialize new data members
6895 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6896 (Stub_table::add_reloc_stub): Assign stub offset and update
6897 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6898 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6899 New data members.
6900 (Stub_table::update_data_size_and_addralign): Use
6901 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6902 instead of going over all reloc stubs.
6903 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6904 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6905 Stringpool_template::offset_ to size of Stringpool_char.
6906 (Stringpool_template::new_key_offset): Remove code to initialize
6907 Stringpool_template::offset_.
6908 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6909 Stringpool_template::offset_ to zero.
6910
6911 2010-03-15 Doug Kwan <dougkwan@google.com>
6912
6913 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6914 offset_.
6915 (Stringpool_template::new_key_offset): New method.
6916 (Stringpool_template::add_string): Assign offsets when adding new
6917 strings.
6918 (Stringpool_template::set_string_offsets): Do not set string offsets
6919 when not optimizing.
6920 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6921 member size_.
6922 (Chunked_vector::clear): Clear size_.
6923 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6924 (Chunked_vector::size): Return size_.
6925 (Chunked_vector::push_back): Use size_ to find insert position.
6926 (Chunked_vector::size_): New data member.
6927 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6928 (Stringpool_template::new_key_offset): New method declaration.
6929 (Stringpool_template::offset_): New data member.
6930
6931 2010-03-15 Rafael Espindola <espindola@google.com>
6932
6933 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6934 Add_symbols' constructor.
6935 * readsyms.h (Add_symbols): Remove the input_group member.
6936
6937 2010-03-10 Ian Lance Taylor <iant@google.com>
6938
6939 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6940 target to ask whether a reference to a symbol requires a stack
6941 split.
6942 * target.h (Target::is_call_to_non_split): New function.
6943 (Target::do_is_call_to_non_split): Declare virtual function.
6944 * target.cc: Include "symtab.h".
6945 (Target::do_is_call_to_non_split): New function.
6946 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6947
6948 2010-03-10 Cary Coutant <ccoutant@google.com>
6949
6950 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6951 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6952 (File_read::open[2]): Add whole_file_view_ to list of views.
6953 (File_read::make_view): Remove test of whole_file_view_.
6954 (File_read::find_or_make_view): Create whole_file_view_ if
6955 necessary.
6956 (File_read::clear_views): Replace bool parameter with enum;
6957 adjust all callers. Don't delete views with permanent data;
6958 do delete cached views and views from archives if
6959 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6960 if clearing the corresponding view.
6961 * fileread.h (File_read::Clear_views_mode): New enum.
6962 (File_read::View::is_permanent_view): New method.
6963 (File_read::clear_views): Replace bool parameter
6964 with enum; adjust all callers.
6965 * options.h (General_options): Change keep_files_mapped option;
6966 add map_whole_files.
6967 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6968 releasing the file.
6969 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6970 the file.
6971
6972 2010-03-10 David S. Miller <davem@davemloft.net>
6973
6974 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6975
6976 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6977
6978 * icf.cc (get_section_contents): Add '@' marker after processing the
6979 merge reloc.
6980
6981 2010-03-08 Doug Kwan <dougkwan@google.com>
6982
6983 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6984 due to a conversion warning.
6985 (Arm_relobj::update_output_local_symbol_count): Check for local
6986 symbol with unset output index.
6987
6988 2010-03-05 Ian Lance Taylor <iant@google.com>
6989
6990 * options.h (class General_options): Add --spare-dynamic-tags.
6991 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6992 --spare-dynamic-tags.
6993
6994 2010-03-05 Ian Lance Taylor <iant@google.com>
6995
6996 * incremental.cc: Include "libiberty.h".
6997
6998 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6999
7000 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7001 function, is_info_ member.
7002 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7003 (Versions::Versions): Update caller.
7004 (Versions::define_base_version): Likewise.
7005 (Versions::add_def): Likewise.
7006
7007 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7008
7009 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7010 (Scan::possible_function_pointer_reloc): New function.
7011 (Scan::local_reloc_may_be_function_pointer): Change to call
7012 possible_function_pointer_reloc.
7013 (Scan::global_reloc_may_be_function_pointer): Ditto.
7014 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7015 relocations in ".data.rel.ro._ZTV" section.
7016 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7017 * testsuite/icf_safe_so_test.cc: Ditto.
7018 * testsuite/icf_safe_test.cc: Ditto.
7019 * testsuite/icf_safe_test.sh: Ditto.
7020
7021 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7022 Ian Lance Taylor <iant@google.com>
7023
7024 * target-reloc.h (relocate_section): Check the symbol table index
7025 for -1U before setting the local symbol index.
7026 (scan_relocatable_relocs): If copying the relocation, record that
7027 the local symbol is required.
7028 * object.h (Symbol_value::is_output_symtab_index_set): New
7029 function.
7030 (Symbol_value::may_be_discarded_from_output_symtab): New
7031 function.
7032 (Symbol_value::has_output_symtab_entry): New function.
7033 (Symbol_value::needs_output_symtab_entry): Remove.
7034 (Symbol_value::output_symtab_index): Make sure the symbol index is
7035 set.
7036 (Symbol_value::set_output_symtab_index): Make sure the symbol
7037 index is not set. Make sure the new index is valid.
7038 (Symbol_value::set_must_have_output_symtab_entry): New function.
7039 (Symbol_value::has_output_dynsym_entry): New function.
7040 (Symbol_value::set_output_dynsym_index): Make sure the new index
7041 is valid.
7042 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7043 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7044 local symbol if permitted.
7045 (Sized_relobj::do_finalize_local_symbols): Call
7046 is_output_symtab_index_set rather than needs_output_symtab_entry.
7047 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7048 rather than needs_output_symtab_entry. Call
7049 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7050 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7051 is_output_symtab_index_set rather than needs_output_symtab_entry.
7052 * testsuite/discard_locals_relocatable_test.c: New file.
7053 * testsuite/discard_locals_test.sh: Test -r.
7054 * testsuite/Makefile.am (check_DATA): Add
7055 discard_locals_relocatable_test1.syms,
7056 discard_local_relocatable_test2.syms.
7057 (MOSTLYCLEANFILES): Likewise. Also add
7058 discard_locals_relocatable_test1.lout and
7059 discard_locals_relocatable_test2.out.
7060 (discard_locals_relocatable_test1.syms): New target.
7061 (discard_locals_relocatable_test.o): New target.
7062 (discard_locals_relocatable_test1.out): New target.
7063 (discard_locals_relocatable_test2.syms): New target.
7064 (discard_locals_relocatable_test2.out): New target.
7065 (various): Add missing ../ld-new dependencies.
7066 * testsuite/Makefile.in: Rebuild.
7067
7068 2010-03-03 Nick Clifton <nickc@redhat.com>
7069
7070 * po/fi.po: New Finnish translation.
7071
7072 2010-03-01 Doug Kwan <dougkwan@google.com>
7073
7074 * layout.cc (Layout::Layout): Force section types of .init_array*,
7075 .preinit_array* and .fini_array* sections.
7076 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7077 Fix check of return value of std::string::find.().
7078 (Output_section::Input_section_sort_compare::operator()): Remove
7079 comment about .init_array.
7080 (Output_section::Input_section_sort_init_fini_compare::operator()):
7081 New method.
7082 (Output_section::sort_attached_input_sections): Handle .init_array
7083 and .fini_array specially.
7084 * output.h (Output_section::Inut_section_sort_compare): Update
7085 comment.
7086 (Output_section::Input_section_sort_init_fini_compare): New struct.
7087
7088 2010-02-26 Doug Kwan <dougkwan@google.com>
7089
7090 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7091 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7092 * testsuite/debug_msg.sh: Avoid matching source line number for
7093 use of global variable undef_int.
7094
7095 2010-02-26 Doug Kwan <dougkwan@google.com>
7096
7097 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7098 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7099 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7100 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7101 * options.cc (General_options::General_options): Initialize member
7102 fix_v4bx_.
7103 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7104 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7105 and rm_no_fix_v4bx.stdout
7106 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7107 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7108 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7109 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7110 and arm_no_fix_v4bx.
7111 * Makefile.in: Regenerate.
7112 * testsuite/arm_fix_v4bx.s: New file.
7113 * testsuite/arm_fix_v4bx.sh: Ditto.
7114
7115 2010-02-24 Doug Kwan <dougkwan@google.com>
7116
7117 * arm.cc (Target_arm::got_section): Make the .got section the first
7118 non RELRO section in the data segment.
7119 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7120 suffixes of section names.
7121
7122 2010-02-24 Doug Kwan <dougkwan@google.com>
7123
7124 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7125 flags and attributes merging if an input file is a binary file.
7126 * fileread.cc (Input_file::open): Record format of original file.
7127 * fileread.h (Input_file::Format): New enum type.
7128 (Input_file::Input_file): Initialize data member format_.
7129 (Input_file::format): New method definition.
7130 (Input_file::format_):: New data member.
7131
7132 2010-02-24 Doug Kwan <dougkwan@google.com>
7133
7134 * arm.cc (Arm_output_data_got): New class.
7135 (ARM_TCB_SIZE): New constant
7136 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7137 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7138 If user uses a script with a SECTIONS clause, issue only a warning
7139 for a misplaced EXIDX input section. Otherwise, issue an error.
7140 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7141 garbage collection.
7142 (Target_arm::got_mode_index_entry): Handle static linking.
7143 (Target_arm::Scan::local): Ditto.
7144 (Target_arm::Scan::global): Ditto.
7145 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7146 all incorrectly implemented relocations.
7147 (Target_arm::fix_exidx_coverage): Pass layout to
7148 Arm_output_section::fix_exidx_coverage.
7149 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7150 from ".ARM.exidx." and ".ARM.extab.".
7151
7152 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7153
7154 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7155 section if it does not already exist.
7156 * attributes.cc (Attributes_section_data::Attributes_section_data):
7157 Don't crash if size is zero.
7158
7159 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7160 Ian Lance Taylor <iant@google.com>
7161
7162 * gold.cc (queue_middle_tasks): If no input files were opened,
7163 exit.
7164 * workqueue.h (Task_function::Task_function): Assert that there is
7165 a blocker.
7166
7167 2010-02-22 Doug Kwan <dougkwan@google.com>
7168
7169 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7170 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7171 types to avoid warnings due to different uint64_t implementations
7172 on different hosts.
7173
7174 2010-02-21 Doug Kwan <dougkwan@google.com>
7175
7176 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7177 handling of the maximum backward branch offset.
7178 (Arm_relocate_functions::thumb_branch_common): Ditto.
7179 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7180 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7181 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7182 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7183 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7184 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7185 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7186 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7187 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7188 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7189 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7190 thumb2_bl_out_of_range.o): New rules.
7191 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7192 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7193 thumb2_bl_out_of_range
7194 * testsuite/Makefile.in: Regenerate.
7195 * testsuite/arm_bl_in_range.s: New file.
7196 * testsuite/arm_bl_out_of_range.s: Ditto.
7197 * testsuite/arm_branch_in_range.sh: Ditto.
7198 * testsuite/arm_branch_range.t: Ditto.
7199 * testsuite/thumb2_branch_range.t: Ditto.
7200 * testsuite/thumb_bl_in_range.s: Ditto.
7201 * testsuite/thumb_bl_out_of_range.s: Ditto.
7202 * testsuite/thumb_branch_range.t: Ditto.
7203
7204 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7205
7206 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7207 Add reloc offset information.
7208 * icf.cc (get_section_contents): Change iterators to point to the new
7209 vectors. Add reloc offset information to the contents.
7210 * icf.h (Icf::Sections_reachable_info): New typedef.
7211 (Icf::Sections_reachable_list): New typedef.
7212 (Icf::Offset_info): New typedef.
7213 (Icf::Reloc_info): New struct typedef.
7214 (Icf::Reloc_info_list): New typedef.
7215 (Icf::symbol_reloc_list): Delete method.
7216 (Icf::addend_reloc_list): Delete method.
7217 (Icf::section_reloc_list): Delete method.
7218 (Icf::reloc_info_list): New method.
7219 (Icf::reloc_info_list_): New member.
7220
7221 2010-02-19 Doug Kwan <dougkwan@google.com>
7222
7223 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7224 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7225 * arm.cc (Arm_relocation_functions): New forward declaration.
7226 (Target_arm::Target_arm): Initialize new data members
7227 got_mod_index_offset_ and tls_base_symbol_defined_.
7228 (Target_arm::Relocate::relocate_tls): New method.
7229 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7230 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7231 New methods.
7232 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7233 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7234 (Target_arm::got_mod_index_offset_,
7235 Target_arm::tls_base_symbol_defined_): New data members.
7236 (Target_arm::Scan::local, Target::Scan::global,
7237 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7238 relocations.
7239
7240 2010-02-18 Doug Kwan <dougkwan@google.com>
7241
7242 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7243 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7244 text section as a parameter becuase some broken tools may not set
7245 the link in section header.
7246 (Target_arm::has_got_section): New method.
7247 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7248 without any mapping symbol as data only. Remove warning.
7249 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7250 link in its section header, try to discover the link by inspecting the
7251 REL31 relocation at the beginning of the section.
7252 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7253 in error message.
7254 (Target_arm::Scan::global): Treat any reference to the symbol
7255 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7256
7257 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7258
7259 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7260 (Scan::global_reloc_may_be_function_pointer): New function.
7261 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7262 (Scan::global_reloc_may_be_function_pointer): New function.
7263 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7264 (Scan::global_reloc_may_be_function_pointer): New function.
7265 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7266 (Scan::global_reloc_may_be_function_pointer): New function.
7267 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7268 (Scan::global_reloc_may_be_function_pointer): New function.
7269 (Scan::possible_function_pointer_reloc): New function.
7270 (Target_x86_64::can_check_for_function_pointers): New function.
7271 * gc.h (gc_process_relocs): Scan relocation types to determine if
7272 function pointers were taken for targets that support it.
7273 * icf.cc (Icf::find_identical_sections): Include functions for
7274 folding in safe ICF whose pointer is not taken.
7275 * icf.h (Secn_fptr_taken_set): New typedef.
7276 (fptr_section_id_): New member.
7277 (section_has_function_pointers): New function.
7278 (set_section_has_function_pointers): New function.
7279 (check_section_for_function_pointers): New function.
7280 * options.h: Fix comment for safe ICF option.
7281 * target.h (can_check_for_function_pointers): New function.
7282 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7283 Modify icf_safe_test for X86-64.
7284 * testsuite/Makefile.in: Regenerate.
7285 * testsuite/icf_safe_so_test.cc: New file.
7286 * testsuite/icf_safe_so_test.sh: New file.
7287 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7288 (main): Change to take pointer to function kept_func_3.
7289 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7290 folding is done correctly for X86-64.
7291
7292 2010-02-12 David S. Miller <davem@davemloft.net>
7293
7294 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7295 is_symbolless parameter.
7296 (Output_reloc<SHT_REL>::is_symbolless): New.
7297 (Output_reloc<SHT_REL>::is_symbolless_): New.
7298 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7299 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7300 (Output_reloc<SHT_RELA>::is_symbolless): New.
7301 (Output_data_reloc::add_global): Handle is_symbolless.
7302 (Output_data_reloc::add_global_relative): Likewise.
7303 (Output_data_reloc::add_local): Likewise.
7304 (Output_data_reloc::add_local_relative): Likewise.
7305 (Output_data_reloc::add_symbolless_global_addend): New.
7306 (Output_data_reloc::add_symbolless_local_addend): New.
7307 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7308 is_symbolless.
7309 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7310 instead of ->is_relative_
7311 (Output_reloc::write): Likewise.
7312 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7313 (Output_reloc::write_rel): Simplify.
7314
7315 * sparc.cc (Target_sparc::Scan::local): Use
7316 ->add_symbolless_local_addend as needed.
7317 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7318 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7319 based upon relocation offset.
7320
7321 2010-02-11 Doug Kwan <dougkwan@google.com>
7322
7323 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7324 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7325 beginning of function.
7326 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7327 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7328 parameter is_32bit in calls to should_apply_static_reloc.
7329 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7330 (check_DATA): Add arm_abs_global.stdout.
7331 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7332 arm_abs_global.stdout): New rules.
7333 (MOSTLLYCLEANFILES): Add arm_abs_global
7334 * Makefile.in: Regenerate.
7335 * testsuite/arm_abs_global.s: New file.
7336 * testsuite/arm_abs_global.sh: Ditto.
7337 * testsuite/arm_abs_lib.s: Ditto.
7338
7339 2010-02-11 Ian Lance Taylor <iant@google.com>
7340
7341 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7342 Read_relocs task.
7343 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7344 Allocate_commons_task first.
7345 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7346 task, rather than symtab_lock_.
7347 (Gc_process_relocs::~Gc_process_relocs): New function.
7348 (Gc_process_relocs::is_runnable): Check this_blocker_.
7349 (Gc_process_relocs::locks): Use next_blocker_ rather than
7350 blocker_.
7351 (Scan_relocs::~Scan_relocs): New function.
7352 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7353 symtab_lock_.
7354 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7355 next_blocker_.
7356 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7357 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7358 constructor accordingly.
7359 (class Gc_process_relocs): Likewise.
7360 (class Scan_relocs): Likewise.
7361 * common.h (class Allocate_commons_task): Remove symtab_lock_
7362 field, and corresponding constructor parameter.
7363 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7364 symtab_lock_.
7365 (Allocate_commons_task::locks): Likewise.
7366
7367 2010-02-11 Ian Lance Taylor <iant@google.com>
7368
7369 * gold-threads.h (class Once): Define.
7370 (class Initialize_lock): Rewrite as child of Once.
7371 * gold-threads.cc (class Once_initialize): Define.
7372 (once_pointer_control): New static variable.
7373 (once_pointer, once_arg): New static variables.
7374 (c_run_once): New static function.
7375 (Once::Once, Once::run_once, Once::internal_run): New functions.
7376 (class Initialize_lock_once): Remove.
7377 (initialize_lock_control): Remove.
7378 (initialize_lock_pointer): Remove.
7379 (initialize_lock_once): Remove.
7380 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7381 (Initialize_lock::initialize): Rewrite.
7382 (Initialize_lock::do_run_once): New function.
7383 * archive.cc (Archive::interpret_header): Only clear name if it is
7384 not already empty.
7385 * fileread.cc: Include "gold-threads.h"
7386 (file_counts_lock): New static variable.
7387 (file_counts_initialize_lock): Likewise.
7388 (File_read::release): Only increment counts when using --stats.
7389 Use a lock around the increment.
7390 * parameters.cc (class Set_parameters_target_once): Define.
7391 (set_parameters_target_once): New static variable.
7392 (Parameters::Parameters): Move here from parameters.h.
7393 (Parameters::set_target): Rewrite.
7394 (Parameters::set_target_once): New function.
7395 (Parameters::clear_target): Move here and rewrite.
7396 * parameters.h (class Parameters): Update declarations. Add
7397 set_parameters_target_once_ field.
7398 (Parameters::Parameters): Move to parameters.cc.
7399 (Parameters::clear_target): Likewise.
7400 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7401 task.
7402 (Start_group::~Start_group): New function.
7403 (Start_group::is_runnable): New function.
7404 (Start_group::locks, Start_group::run): New functions.
7405 (Finish_group::run): Change saw_undefined to size_t.
7406 * readsyms.h (class Start_group): Define.
7407 (class Finish_group): Change saw_undefined_ field to size_t.
7408 (Finish_group::Finish_group): Remove saw_undefined and
7409 this_blocker parameters. Change all callers.
7410 (Finish_group::set_saw_undefined): New function.
7411 (Finish_group::set_blocker): New function.
7412 * symtab.h (class Symbol_table): Change saw_undefined to return
7413 size_t. Change saw_undefined_ field to size_t.
7414 * target-select.cc (Set_target_once::do_run_once): New function.
7415 (Target_selector::Target_selector): Initialize set_target_once_
7416 field. Don't initialize lock_ and initialize_lock_ fields.
7417 (Target_selector::instantiate_target): Rewrite.
7418 (Target_selector::set_target): New function.
7419 * target-select.h (class Set_target_once): Define.
7420 (class Target_selector): Update declarations. Make
7421 Set_target_once a friend. Remove lock_ and initialize_lock_
7422 fields. Add set_target_once_ field.
7423
7424 2010-02-10 Ian Lance Taylor <iant@google.com>
7425
7426 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7427 queueing any tasks.
7428 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7429 (queue_middle_tasks): Add all blockers before queueing any tasks.
7430 (queue_final_tasks): Likewise.
7431 * token.h (Task_token::add_blockers): New function.
7432 * object.h (Input_objects::number_of_relobjs): New function.
7433
7434 2010-02-10 Ian Lance Taylor <iant@google.com>
7435
7436 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7437 shared, not if not position independent.
7438 * x86_64.cc (Relocate::relocate_tls): Likewise.
7439 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7440 (tls_pie_pic_test): New target.
7441 * testsuite/Makefile.in: Rebuild.
7442
7443 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7444 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7445 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7446 * testsuite/Makefile.in: Rebuild.
7447
7448 2010-02-09 David S. Miller <davem@davemloft.net>
7449
7450 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7451 R_SPARC_RELATIVE using ->add_local_relative().
7452 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7453
7454 * output.h (Output_data_dynamic::add_section_size): New method
7455 that takes two Output_data objects.
7456 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7457 entry param. Handle it in initializers.
7458 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7459 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7460 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7461 arg.
7462 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7463 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7464 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7465 for dynrel_includes_plt.
7466 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7467 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7468 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7469 before .rela.plt
7470 (Target_sparc::do_finalize_sections): Update to pass true for
7471 dynrel_includes_plt.
7472 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7473 output before .rela.plt
7474 (Target_powerpc::do_finalize_sections): Update to pass true for
7475 dynrel_includes_plt when 32-bit.
7476
7477 2010-02-08 Doug Kwan <dougkwan@google.com>
7478
7479 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7480 method.
7481 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7482 Arm_relobj::scan_section_for_cortex_a8_stubs,
7483 Arm_relobj::do_relocation_section): Instead of calling
7484 Output_section::output_address, use faster
7485 Arm_relobj::simple_input_section_output_address.
7486
7487 2010-02-08 David S. Miller <davem@davemloft.net>
7488
7489 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7490 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7491 relocation helper function.
7492
7493 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7494 just like R_SPARC_GOT{10,13,22}.
7495 (Target_sparc::Scan::local): Likewise.
7496 (Target_sparc::Relocate:relocate): Likewise.
7497
7498 2010-02-06 Ian Lance Taylor <iant@google.com>
7499
7500 * configure.ac: Rewrite targetobjs duplicate removal code to use
7501 only shell constructs.
7502 * configure: Rebuild.
7503
7504 2010-02-05 Doug Kwan <dougkwan@google.com>
7505
7506 PR 11247
7507 * arm.cc (Arm_relobj::section_is_scannable): New method.
7508 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7509 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7510
7511 2010-02-04 Doug Kwan <dougkwan@google.com>
7512
7513 PR 11247
7514 * arm-reloc-property.cc (cstdio): Include.
7515 * configure.ac (targetobjs): Remove duplicates.
7516 * configure: Regenerate.
7517 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7518 big and little endian version for a given address size.
7519
7520 2010-02-03 Doug Kwan <dougkwan@google.com>
7521
7522 * arm-reloc-property.cc
7523 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7524 definition.
7525 * arm-reloc-property.h
7526 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7527 New method definition.
7528 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7529 declaration.
7530 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7531 overflow to N.
7532 (GOT_PREL): Change implemented to Y.
7533 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7534 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7535 (Arm_relocate_functions::movw_abs_nc): Remove method.
7536 (Arm_relocate_functions::movt_abs): Ditto.
7537 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7538 (Arm_relocate_functions::thm_movt_abs): Ditto.
7539 (Arm_relocate_functions::movw_rel_nc): Ditto.
7540 (Arm_relocate_functions::movw_rel): Ditto.
7541 (Arm_relocate_functions::movt_rel): Ditto.
7542 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7543 (Arm_relocate_functions:thm_movw_rel): Ditto.
7544 (Arm_relocate_functions:thm_movt_rel): Ditto.
7545 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7546 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7547 New method definitions.
7548 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7549 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7550 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7551 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7552 (Target_arm::Relocate::relocate): Check for non-static or
7553 unimplemented relocation code and exit early. Change calls to
7554 Target_arm::reloc_uses_thumb_bit and
7555 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7556 instead. Refactor code to handle similar relocations to increase
7557 code sharing. Remove check for unsupported relocation code in switch
7558 statement.
7559 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7560 relocation property table to find out size. Change error message to
7561 print out the name of a relocation code instead of the numeric value.
7562 (Target_arm::scan_reloc_for_stub): Use relocation property table
7563 instead of calling Target_arm::reloc_uses_thumb_bit().
7564
7565 2010-02-02 Doug Kwan <dougkwan@google.com>
7566
7567 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7568 types of relaxed input section.
7569
7570 2010-02-02 Doug Kwan <dougkwan@google.com>
7571
7572 * Makefile.am (HFILES): Add arm-reloc-property.h.
7573 (DEFFILES): New.
7574 (TARGETSOURCES): Add arm-reloc-property.cc
7575 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7576 (libgold_a_SOURCES): $(DEFFILES)
7577 * Makefile.in: Regenerate.
7578 * arm-reloc-property.cc: New file.
7579 * arm-reloc-property.h: New file.
7580 * arm-reloc.def: New file.
7581 * arm.cc: Update comments.
7582 (arm-reloc-property.h): New included header.
7583 (arm_reloc_property_table): New global variable.
7584 (Target_arm::do_select_as_default_target): New method definition.
7585 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7586 arm-reloc-property to targ_extra_obj.
7587 * parameters.cc (set_parameters_target): Call
7588 Target::select_as_default_target().
7589 * target.h (Target::select_as_default_target): New method definition.
7590 (Target::do_select_as_default_target): Same.
7591
7592 2010-02-01 Doug Kwan <dougkwan@google.com>
7593
7594 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7595 first_output_text_section_.
7596 (Arm_exidx_fixup::first_output_text_section): New method definition.
7597 (Arm_exidx_fixup::first_output_text_section_): New data member.
7598 (Arm_exidx_fixup::process_exidx_section): Record the first text
7599 output section seen.
7600 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7601 and entsize in output section header.
7602
7603 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7604
7605 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7606 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7607 (Arm_relocate_functions::thm_alu11): New Method.
7608 (Arm_relocate_functions::thm_pc8): New Method.
7609 (Arm_relocate_functions::thm_pc12): New Method.
7610 (Target_arm::Scan::local): Handle the relocations.
7611 (Target_arm::Scan::global): Likewise.
7612 (Target_arm::Relocate::relocate): Likewise.
7613 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7614
7615 2010-01-29 Doug Kwan <dougkwan@google.com>
7616
7617 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7618 of relocation types as ld.
7619
7620 2010-01-29 Doug Kwan <dougkwan@google.com>
7621
7622 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7623 to public.
7624 (Arm_relocate_functions::thumb_branch_common): Ditto.
7625 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7626 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7627 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7628 Arm_relocate_functions::jump24): Remove.
7629 (Target_arm::Relocate::relocate): Adjust code to call
7630 Arm_relocation_functions::arm_branch_common and
7631 Arm_relocation_functions::thumb_branch_common instead of their removed
7632 wrappers. Merge switch-cases together to reduce source code size.
7633
7634 2010-01-29 Doug Kwan <dougkwan@google.com>
7635
7636 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7637 output_local_symbol_count_needs_update_.
7638 (Arm_relobj::output_local_symbol_count_needs_update,
7639 Arm_relobj::set_output_local_symbol_count_needs_update,
7640 Arm_relobj::update_output_local_symbol_count): New methods.
7641 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7642 member.
7643 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7644 of pointed function as in a R_ARM_PREL31 relocation.
7645 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7646 for output local symbol count updating.
7647 (Target_arm::do_relax): Update output local symbol counts in objects
7648 if necessary.
7649 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7650
7651 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7652
7653 * arm.cc: Added support for the ARM relocations:
7654 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7655 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7656 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7657 movw_prel_nc).
7658 (Arm_relocate_functions::movw_rel): New method.
7659 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7660 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7661 thm_movw_prel_nc).
7662 (Arm_relocate_functions::thm_movw_rel): New method.
7663 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7664 thm_movt_prel).
7665 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7666 relocations.
7667 (Target_arm::Scan::global): Likewise.
7668 (Target_arm::Relocate::relocate): Likewise.
7669 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7670 Likewise.
7671
7672 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7673
7674 * arm.cc: Added support for ARM group relocations.
7675 (Target_arm::reloc_needs_sym_origin): New method.
7676 (Arm_relocate_functions::calc_grp_kn): New method.
7677 (Arm_relocate_functions::calc_grp_residual): New method.
7678 (Arm_relocate_functions::calc_grp_gn): New method.
7679 (Arm_relocate_functions::arm_grp_alu): New Method.
7680 (Arm_relocate_functions::arm_grp_ldr): New Method.
7681 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7682 (Arm_relocate_functions::arm_grp_ldc): New Method.
7683 (Target_arm::Scan::local): Handle the ARM group relocations.
7684 (Target_arm::Scan::global): Likewise.
7685 (Target_arm::Relocate::relocate): Likewise.
7686 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7687 Likewise.
7688
7689 2010-01-26 Doug Kwan <dougkwan@google.com>
7690
7691 * arm.cc (set): Include.
7692 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7693 pointer type.
7694 (Arm_output_section::Text_section_list): New type.
7695 (Arm_output_section::append_text_sections_to_list): New method.
7696 (Arm_output_section::fix_exidx_coverage): Ditto.
7697 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7698 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7699 Relobj::set_section_offset() instead of
7700 Sized_relobj::invalidate_section_offset().
7701 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7702 parameter for section headers. Ignore relocation sections for
7703 unallocated sections and EXIDX sections.
7704 (Target_arm::fix_exidx_coverage): New method.
7705 (Target_arm::output_section_address_less_than): New type.
7706 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7707 linked text section instead of the EXIDX section.
7708 (Arm_output_section::create_stub_group): Add an assertion to check
7709 that this is not an EXIDX output section.
7710 (Arm_output_section::append_text_sections_to_list): New method.
7711 (Arm_output_section::fix_exidx_coverage): Ditto.
7712 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7713 Arm_relobj::section_needs_reloc_stub_scanning.
7714 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7715 first pass.
7716 (Target_arm::fix_exidx_coverage): New method.
7717 * object.h (Relobj::set_output_section): New method.
7718 (Sized_relobj::invalidate_section_offset): Remove method.
7719 (Sized_relobj::do_invalidate_section_offset): Remove method.
7720 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7721
7722 2010-01-25 Doug Kwan <dougkwan@google.com>
7723
7724 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7725 Fix warning due to signed and unsigned comparison on a 32-bit host.
7726
7727 2010-01-22 Doug Kwan <dougkwan@google.com>
7728
7729 * arm.cc (Target_arm::do_relax): Record an output section for section
7730 offset adjustment it contains any stub table that has changed.
7731 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7732 offsets in an output section if necessary.
7733 * output.cc (Output_section::Output_section): Initialize
7734 section_offsets_need_adjustments_.
7735 (Output_section::add_input_section_for_script): Renamed to
7736 Output_section::add_simple_input_section.
7737 (Output_section::save_states): Add a comment.
7738 (Output_section::discard_states): New method defintion.
7739 (Output_section::adjust_section_offsets): Same.
7740 * output.h (Output_section::add_input_section_for_script): Renamed to
7741 Output_section::add_simple_input_section.
7742 (Output_section::discard_states): New method declaration.
7743 (Output_section::adjust_section_offsets): Same.
7744 (Output_section::section_offsets_need_adjustment,
7745 Output_section::set_section_offsets_need_adjustment): New method
7746 definitions.
7747 (Output_section::section_offsets_need_adjustment_): New data member.
7748 * script-sections.cc
7749 (Output_section_element_input::set_section_address): Adjust code for
7750 renaming of Output_section::add_input_section_for_script.
7751 (Orphan_output_section::set_section_address): Same.
7752
7753 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7754
7755 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7756 Fix_v4bx enum values .
7757 * gold/options.h (General_options): New option definitions.
7758 (General_options::fix_v4bx): New method.
7759 (General_options::Fix_v4bx): New enum.
7760 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7761 (General_options::parse_fix_v4bx_interworking): New method.
7762
7763 2010-01-22 Doug Kwan <dougkwan@google.com>
7764
7765 * arm.cc (Arm_exidx_fixup): New class.
7766
7767 2010-01-21 Doug Kwan <dougkwan@google.com>
7768
7769 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7770 classes.
7771 (Arm_exidx_section_offset_map): New type.
7772
7773 2010-01-21 Doug Kwan <dougkwan@google.com>
7774
7775 * arm.cc (Arm_exidx_input_section): New class.
7776 (Arm_relobj::exidx_input_section_by_link,
7777 Arm_relobj::exidx_input_section_by_shndx,
7778 Arm_relobj::make_exidx_input_section): New methods.
7779 (read_arm_attributes_section): Remove.
7780 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7781 information about them.
7782 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7783 to here.
7784
7785 2010-01-20 Doug Kwan <dougkwan@google.com>
7786
7787 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7788 Input_section_specifier to Section_id.
7789 (Target_arm::new_arm_input_section: Adjust code for change of key
7790 type.
7791 (Target_arm::find_arm_input_section): Ditto.
7792 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7793 (Section_id): Remove.
7794 (Garbage_collection::Section_id_hash): Remove.
7795 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7796 (Section_id): Remove.
7797 (Icf::Section_id_hash): Remove.
7798 * object.h (Section_id, Const_section_id, Section_id_hash,
7799 Const_section_id_hash): New type definitions.
7800 * output.cc (Output_section::add_relaxed_input_section): Change to
7801 use Const_section_id instead of Input_section_specifier as key type.
7802 (Output_section::add_merge_input_section): Ditto.
7803 (Output_section::build_relaxation_map): Change to use Section_id
7804 instead of Input_section_specifier as key type.
7805 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7806 Ditto.
7807 (Output_section::convert_input_sections_to_relaxed_sections): Change
7808 to use Const_section_id instead of Input_section_specifier as key type.
7809 (Output_section::find_merge_section): Ditto.
7810 (Output_section::find_relaxed_input_section): Ditto.
7811 * output.h (Input_section_specifier): Remove class.
7812 (Output_section::Output_section_data_by_input_section_map): Change
7813 key type to Const_section_id.
7814 (Output_section::Output_relaxed_input_section_by_input_section_map):
7815 Ditto.
7816 (Output_section::Relaxation_map): Change key type to Section_id.
7817
7818 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7819
7820 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7821 (class Arm_v4bx_stub): New class.
7822 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7823 (Stub_factory::make_arm_v4bx_stub): New method.
7824 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7825 (Stub_table::empty): Handle v4bx stubs.
7826 (Stub_table::add_arm_v4bx_stub): New method.
7827 (Stub_table::find_arm_v4bx_stub): New method.
7828 (Arm_relocate_functions::v4bx): New method.
7829 (Target_arm::fix_v4bx): New method.
7830 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7831 (Stub_table::relocate_stubs): Likewise.
7832 (Stub_table::do_write): Likewise.
7833 (Stub_table::update_data_size_and_addralign): Likewise.
7834 (Stub_table::finalize_stubs): Likewise.
7835 (Target_arm::Scan::local): Likewise.
7836 (Target_arm::Scan::global): Likewise.
7837 (Target_arm::do_finalize_sections): Likewise.
7838 (Target_arm::Relocate::relocate): Likewise.
7839 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7840 Likewise.
7841 (Target_arm::scan_reloc_for_stub): Likewise.
7842 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7843
7844 2010-01-19 Ian Lance Taylor <iant@google.com>
7845
7846 * output.cc (Output_section_headers::do_sized_write): Write large
7847 segment count to sh_info field.
7848 (Output_file_header::do_sized_write): For large segment count,
7849 write PN_XNUM to e_phnum field.
7850
7851 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7852
7853 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7854 (Arm_relocate_functions::thm_jump8): New function.
7855 (Arm_relocate_functions::thm_jump11): New function.
7856 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7857 R_ARM_THM_JUMP11.
7858 (Target_arm::Scan::global): Likewise.
7859 (Target_arm::Relocate::relocate): Likewise.
7860 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7861 Likewise.
7862
7863 2010-01-14 Doug Kwan <dougkwan@google.com>
7864
7865 * arm.cc (map, utility): Include headers.
7866 (Target_arm::apply_cortex_a8_workaround): New method.
7867 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7868 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7869 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7870 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7871 the --[no-]fix-cortex-a8 command line options.
7872 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7873 (Target_arm::relocate_stub): Use addend in instruction template.
7874 * options.h (DEFINE_bool): Set the user-set flag.
7875 (General_options): Add --[no-]-fix-cortex options.
7876 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7877 : Update fast look-up map after conversion.
7878
7879 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7880
7881 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7882 in the first pass of do_layout.
7883
7884 2010-01-13 Doug Kwan <dougkwan@google.com>
7885
7886 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7887 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7888 apparent compiler problem of not folding static constant integral
7889 data members of elfcpp::Elf_sizes<32>.
7890
7891 2010-01-13 Doug Kwan <dougkwan@google.com>
7892
7893 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7894 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7895 Arm_relobj::scan_section_for_cortex_a8_erratum,
7896 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7897 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7898 sections to scan for relocation stubs into a new method
7899 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7900 relocation and Cortex-A8 stub scanning.
7901 (Target_arm::do_relax): Force stubs to be after stubbed sections
7902 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7903 the beginning of a new relaxation pass. Update a comment.
7904 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7905
7906 2010-01-12 Ian Lance Taylor <iant@google.com>
7907
7908 * target-reloc.h (visibility_error): New inline function.
7909 (relocate_section): Call visibility_error.
7910 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7911 (MOSTLYCLEANFILES): Likewise.
7912 (protected_4_pic.o, protected_3.err): New targets.
7913 * testsuite/protected_4.cc: New file.
7914
7915 2010-01-12 Doug Kwan <dougkwan@google.com>
7916
7917 * arm.cc (Cortex_a8_reloc): New class.
7918 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7919 and cortex_a8_relocs_info_.
7920 (Target_arm::fix_cortex_a8): New method definition.
7921 (Target_arm::Cortex_a8_relocs_info): New type.
7922 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7923 New data member declarations.
7924 (Target_arm::scan_reloc_for_stub): Record information about
7925 relocations for THUMB branches that might be exempted from the
7926 Cortex-A8 workaround.
7927 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7928 at the beginning of a relaxation pass.
7929
7930 2010-01-12 Doug Kwan <dougkwan@google.com>
7931
7932 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7933 (Arm_relobj::Mapping_symbol_position,
7934 Arm_reloj::Mapping_symbol_position_less,
7935 Arm_relobj::Mapping_symbols_info): New types.
7936 (Target_arm::is_mapping_symbol_name): New method definition.
7937 (Arm_relobj::do_count_local_symbols): Save information about mapping
7938 symbols.
7939
7940 2010-01-11 Doug Kwan <dougkwan@google.com>
7941
7942 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7943 Arm_relocate_functions::thumb32_branch_upper,
7944 Arm_relocate_functions::thumb32_branch_lower,
7945 Arm_relocate_functions::thumb32_cond_branch_offset,
7946 Arm_relocate_functions::thumb32_cond_branch_upper,
7947 Arm_relocate_functions::thumb32_cond_branch_lower,
7948 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7949 branch offset encoding.
7950 (Arm_relocate_functions::thumb_branch_common): Use new branch
7951 offset encoding methods to avoid code duplication.
7952 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7953 (Stub_addend_reader::operator()): Use new branch encoding method
7954 to avoid code duplication.
7955
7956 2010-01-11 Doug Kwan <dougkwan@google.com>
7957
7958 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7959 (Target_arm::do_finalize_sections): Define special EXIDX section
7960 symbols only if referenced.
7961 * gc.h (Garbage_collection::add_reference): New method.
7962 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7963 code duplication.
7964
7965 2010-01-11 Ian Lance Taylor <iant@google.com>
7966
7967 * script.cc (Version_script_info::build_expression_list_lookup):
7968 Change complaing about duplicate wildcard match from error to
7969 warning.
7970
7971 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7972 of 2009-12-30.
7973 (Version_script_info::Version_script_info): Initialize globs_,
7974 default_version_, default_is_global_, and exact_. Don't
7975 initialize globals_ or locals_.
7976 (Version_script_info::build_lookup_tables): Build local symbols
7977 first.
7978 (Version_script_info::unquote): New function.
7979 (Version_script_info::add_exact_match): New function.
7980 (Version_script_info::build_expression_list_lookup): Remove lookup
7981 parameter. Add is_global parameter. Change all callers. Handle
7982 wildcard pattern specially. Unquote pattern. Call
7983 add_exact_match.
7984 (Version_script_info::get_name_to_match): New function.
7985 (Version_script_info::get_symbol_version): New function.
7986 (Version_script_info::get_symbol_version_helper): Remove.
7987 (Version_script_info::check_unmatched_names): Call unquote.
7988 * script.h (class Version_script_info): Change get_symbol_version
7989 to be non-inline and add is_global parameter; change all callers.
7990 Rewrite symbol_is_local. Update declarations. Define struct
7991 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7992 Remove globals_ and locals_ members. Add exact_, globs_,
7993 default_version_, is_global_.
7994 (Version_script_info::Glob): Remove pattern, add expression and
7995 is_global. Update constructor. Change all callers.
7996 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7997 default version.
7998 (Versions::symbol_section_contents): If a symbol is undefined, or
7999 defined in a dynamic object, set the version index to
8000 VER_NDX_LOCAL.
8001 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8002 symbol_is_local.
8003 (Symbol_table::add_from_pluginobj): Likewise.
8004 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8005
8006 2010-01-11 Doug Kwan <dougkwan@google.com>
8007
8008 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8009 (incremental_dump_LDADD): Add linking option for libintl.
8010 * Makefile.in: Regenerate.
8011
8012 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8013
8014 PR gold/11144
8015 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8016 instead of -Ds.
8017 * testsuite/Makefile.in: Regenerated.
8018
8019 2010-01-10 Doug Kwan <dougkwan@google.com>
8020
8021 * options.h (DEFINE_var): Use parentheses around argument varname__
8022 in macro body to avoid any unintended subsequent substitutions.
8023
8024 2010-01-10 Ian Lance Taylor <iant@google.com>
8025
8026 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8027 candidates before doing symbol resolution.
8028
8029 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8030 ODR candidates if only one is weak.
8031
8032 2010-01-08 Ian Lance Taylor <iant@google.com>
8033
8034 * script.cc (Version_script_info::build_expression_list_lookup):
8035 Don't warn about ambiguous version, just record the ambiguity.
8036 (Version_script_info::get_symbol_version_helper): Give error if
8037 version is ambiguous.
8038
8039 2010-01-08 Doug Kwan <dougkwan@google.com>
8040
8041 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8042 prev_data_size_ and prev_addralign_. Remove initializer for
8043 deleted data member has_been_changed_.
8044 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8045 to determine if the table is empty.
8046 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8047 Remove.
8048 (Stub_table::add_reloc_stub): Define method in class definition
8049 instead of just declaring it there.
8050 (Stub_table::add_cortex_a8_stub): New method definition.
8051 (Stub_table::update_data_size_and_addralign): Ditto.
8052 (Stub_table::finalize_stubs): Ditto.
8053 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8054 (Stub_table::do_addralign_): Return address alignment in the
8055 (Stub_table::do_reset_address_and_file_offset): Define method in
8056 class definition instead of declaring it there. Set current data
8057 size to be the data size of the previous pass.
8058 (Stub_table::set_final_data_size): Use current data size as the
8059 final data size.
8060 (Stub_table::relocate_stub): Change parameter type of stub from
8061 Reloc_stub pointer to Stub pointer.
8062 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8063 (Stub_table::Cortex_a8_stub_list): New typedef.
8064 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8065 Stub_table::prev_addralign_): New data member.
8066 (Arm_relobj::Arm_relobj): Initialize data member
8067 section_has_cortex_a8_workaround_.
8068 (Arm_relobj::section_has_cortex_a8_workaround,
8069 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8070 definitions.
8071 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8072 declarations.
8073 (Target_arm::relocate_stub): Change parameter type of stub from
8074 Reloc_stub pointer to Stub pointer.
8075 (Insn_template::size, Insn_template::alignment): Handle
8076 THUMB16_SPECIAL_TYPE.
8077 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8078 Stub_table::update_data_size_and_addralign,
8079 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8080 definitions.
8081 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8082 (Stub_table::do_write): Ditto.
8083 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8084
8085 2010-01-08 Ian Lance Taylor <iant@google.com>
8086
8087 PR 11108
8088 * symtab.h (class Symbol): Remove fields is_target_special_ and
8089 has_plt_offset_. Add field is_defined_in_discarded_section_.
8090 (Symbol::is_defined_in_discarded_section): New function.
8091 (Symbol::set_is_defined_in_discarded_section): New function.
8092 (Symbol::has_plt_offset): Rewrite.
8093 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8094 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8095 Don't initialize is_target_special_ or has_plt_offset_.
8096 Initialize is_defined_in_discarded_section_.
8097 (Symbol_table::add_from_relobj): If appropriate, set
8098 is_defined_in_discarded_section.
8099 * resolve.cc (Symbol::override_base_with_special): Don't test
8100 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8101 * target-reloc.h (relocate_section): Do special handling for
8102 symbols defined in discarded sections for global symbols as well
8103 as local symbols.
8104
8105 2010-01-08 Ian Lance Taylor <iant@google.com>
8106
8107 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8108 the SHT_SYMTAB case.
8109
8110 2010-01-08 Ian Lance Taylor <iant@google.com>
8111
8112 * object.cc (Sized_relobj::do_layout): Don't get confused if
8113 layout_eh_frame returns NULL.
8114
8115 2010-01-08 Ian Lance Taylor <iant@google.com>
8116
8117 PR 11084
8118 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8119 dynamic symbol table, use the normal symbol table.
8120 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8121 symbol table.
8122
8123 2010-01-08 Ian Lance Taylor <iant@google.com>
8124
8125 PR 11072
8126 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8127 sections.
8128
8129 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8130
8131 * version.cc (print_version): Change to "Copyright 2010".
8132
8133 2010-01-08 Ian Lance Taylor <iant@google.com>
8134
8135 PR 10287
8136 PR 11063
8137 * i386.cc (class Target_i386): Change return type of plt_section
8138 to be non-const.
8139 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8140 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8141 tls_desc_rel_ field.
8142 (Output_data_plt_i386::rel_tls_desc): New function.
8143 (Target_i386::rel_tls_desc_section): New function.
8144 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8145 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8146 R_386_TLS_DESC reloc in rel_tls_desc_section.
8147 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8148 Define struct Tlsdesc_info.
8149 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8150 (Target_x86_64::do_reloc_symbol_index): New function.
8151 (Target_x86_64::add_tlsdesc_info): New function.
8152 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8153 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8154 tlsdesc_rel_ field.
8155 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8156 all callers.
8157 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8158 (Target_x86_64::rela_tlsdesc_section): New function.
8159 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8160 handling.
8161 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8162 (Target_x86_64::do_reloc_addend): New function.
8163 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8164 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8165 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8166 (Output_reloc::type): New function.
8167 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8168 (Output_reloc::is_target_specific): New function.
8169 (Output_reloc::target_arg): New function.
8170 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8171 absolute relocs and target specific relocs.
8172 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8173 add_target_specific.
8174 (class Output_data_reloc) [SHT_RELA]: Likewise.
8175 * output.cc (Output_reloc::Output_reloc): Add four new versions
8176 for absolute relocs and target specific relocs.
8177 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8178 (Output_reloc::get_symbol_index): Likewise.
8179 (Output_reloc::local_section_offset): Check that local_sym_index_
8180 is not TARGET_CODE or 0.
8181 (Output_reloc::symbol_value): Likewise.
8182 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8183 reloc.
8184 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8185 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8186 functions.
8187 * layout.cc (add_target_dynamic_tags): Use output section for
8188 DT_PLTRELSZ and DT_JMPREL.
8189
8190 2010-01-07 Ian Lance Taylor <iant@google.com>
8191
8192 PR 11061
8193 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8194 function.
8195 (class Output_data_reloc_generic): Define.
8196 (class Output_data_reloc_base): Change base class to
8197 Output_data_reloc_generic. Change add() method to call
8198 bump_relative_reloc_count for a relative reloc. Remove
8199 sort_relocs_ field.
8200 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8201 to sort_relocs().
8202 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8203 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8204 appropriate.
8205 * layout.h (class Layout): Update declaration.
8206
8207 2010-01-07 Ian Lance Taylor <iant@google.com>
8208
8209 * output.h (class Output_data): Add const version of
8210 output_section and do_output_section.
8211 (class Output_section_data): Add const version of
8212 do_output_section.
8213 (class Output_section): Likewise.
8214 * layout.cc (Layout::add_target_dynamic_tags): New function.
8215 * layout.h (class Layout): Update declarations.
8216 * arm.cc (Target_arm::do_finalize_sections): Use
8217 add_target_dynamic_tags.
8218 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8219 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8220 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8221 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8222
8223 2010-01-07 Ian Lance Taylor <iant@google.com>
8224
8225 PR 11042
8226 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8227 object as needed.
8228
8229 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8230 Ian Lance Taylor <iant@google.com>
8231
8232 PR 11019
8233 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8234 Xindex::read_symtab_xindex.
8235
8236 2010-01-07 Doug Kwan <dougkwan@google.com>
8237
8238 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8239 (Insn_template::thumb16_bcond_insn): New method declaration.
8240 (Insn_template): Fix spelling.
8241 (Stub::thumb16_special): New method declaration.
8242 (Stub::do_write): Define virtual method which was previously pure
8243 virtual.
8244 (Stub::do_thumb16_special): New method declaration.
8245 (Stub::do_fixed_endian_write): New template member.
8246 (Reloc_stub::do_write): Remove.
8247 (Reloc_stub::do_fixed_endian_write): Remove.
8248 (Cortex_a8_stub): New class definition.
8249 (Stub_factory::make_cortex_a8_stub): New method definition.
8250 (Stub_factory::Stub_factory): Add missing static storage class
8251 qualifier for elf32_arm_stub_a8_veneer_blx.
8252
8253 2010-01-07 Ian Lance Taylor <iant@google.com>
8254
8255 PR 10980
8256 * options.h (class General_options): Add --warn-unresolved-symbols
8257 and --error-unresolved-symbols.
8258 * errors.cc (Errors::undefined_symbol): Implement
8259 --warn-unresolved-symbols.
8260
8261 * options.h (class General_options): Add -z text and -z textoff.
8262 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8263
8264 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8265
8266 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8267 (Garbage_collection::cident_sections): New function.
8268 (Garbage_collection::add_cident_section): New function.
8269 (Garbage_collection::cident_sections_): New member.
8270 (gc_process_relocs): Add references to sections whose names are C
8271 identifiers.
8272 * gold.h (cident_section_start_prefix): New constant.
8273 (cident_section_stop_prefix): New constant.
8274 (is_cident): New function.
8275 * layout.cc (Layout::define_section_symbols): Replace string constants
8276 with the newly defined constants.
8277 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8278 C identifiers.
8279 * testsuite/Makefile.am: Add gc_orphan_section_test.
8280 * testsuite/Makefile.in: Regenerate.
8281 * testsuite/gc_orphan_section_test.cc: New file.
8282 * testsuite/gc_orphan_section_test.sh: New file.
8283
8284 2010-01-06 Ian Lance Taylor <iant@google.com>
8285
8286 PR 10980
8287 * options.h (class General_options): Add --warn-shared-textrel.
8288 * layout.cc (Layout::finish_dynamic_section): Implement
8289 --warn-shared-textrel.
8290
8291 PR 10980
8292 * options.h (class General_options): Add --warn-multiple-gp.
8293
8294 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8295
8296 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8297 $(THREADSLIB) and $(LIBDL).
8298 * Makefile.in: Rebuild.
8299
8300 2010-01-06 Ian Lance Taylor <iant@google.com>
8301
8302 PR 10980
8303 * options.cc (General_options::parse_section_start): New function.
8304 (General_options::section_start): New function.
8305 (General_options::General_options): Initialize all members.
8306 * options.h: Include <map>
8307 (class General_options): Add --section-start. Add section_starts_
8308 member.
8309 * layout.cc (Layout::attach_allocated_section_to_segment): If
8310 --section-start was used, set the address of the segment. Remove
8311 local sort_sections.
8312 (Layout::relaxation_loop_body): If the address of the load segment
8313 has been set by --section-start, don't use it.
8314 * output.h (Output_segment::update_flags_for_output_section): New
8315 function.
8316 * output.cc (Output_segment::add_output_section): Call
8317 update_flags_for_output_section.
8318
8319 2010-01-05 Ian Lance Taylor <iant@google.com>
8320
8321 PR 10980
8322 * options.h (class General_options): Add --undefined-version.
8323 * script.cc (struct Version_expression): Add was_matched_by_symbol
8324 field.
8325 (Version_script_info::matched_symbol): New function.
8326 (Version_script_info::get_symbol_version_helper): Call
8327 matched_symbol.
8328 (Version_script_info::check_unmatched_names): New function.
8329 * script.h (class Version_script_info): Update declarations.
8330 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8331
8332 * options.h (class General_options): Use DEFINE_bool_alias for
8333 allow_multiple_definition.
8334 * resolve.cc (Symbol_table::should_override): Don't test
8335 allow_multiple_definition.
8336
8337 PR 10980
8338 * options.h (class General_options): Add --cref.
8339 * main.cc (main): Print cref table if --cref. Don't close mapfile
8340 until after printing cref table.
8341 * cref.cc: Include "symtab.h".
8342 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8343 (Cref_table_compare::operator()): New function.
8344 (Cref_inputs::gather_cref): New function.
8345 (filecol): New static const.
8346 (Cref_inputs::print_cref): New function.
8347 (Cref::print_cref): New function.
8348 * cref.h: Include <cstdio>.
8349 (class Cref): Update declarations.
8350 * mapfile.h (Mapfile::file): New function.
8351 * object.h (class Object): Define Symbols. Declare virtual
8352 do_get_global_symbols.
8353 (Object::get_global_symbols): New function.
8354 * object.cc (Input_objects::add_object): Pass object to cref_ if
8355 --cref.
8356 (Input_objects::archive_start): Likewise.
8357 (Input_objects::archive_stop): Likewise.
8358 (Input_objects::print_cref): New function.
8359 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8360 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8361 --cref.
8362 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8363 function.
8364 * plugin.h (class Sized_pluginobj): Update declarations.
8365
8366 2010-01-05 Ian Lance Taylor <iant@google.com>
8367
8368 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8369 to is_default_version. Rename insdef to insdefault.
8370 (Symbol_table::add_from_relobj): Rename def to is_default_version
8371 and local to is_forced_local.
8372 (Symbol_table::add_from_pluginobj): Likewise.
8373 (Symbol_table::add_from_dynobj): Likewise.
8374 (Symbol_table::define_special_symbol): Rename insdef to
8375 insdefault.
8376
8377 2010-01-04 Ian Lance Taylor <iant@google.com>
8378
8379 PR 10980
8380 * options.h (class General_options): Add
8381 --allow-multiple-definition and -z muldefs.
8382 * resolve.cc (Symbol_table::should_override): Don't warn about a
8383 multiple symbol definition if --allow-multiple-definition or -z
8384 muldefs.
8385
8386 PR 10980
8387 * options.h (class General_options): Add --add-needed and
8388 --copy-dt-needed-entries. Tweak --as-needed help entry.
8389 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8390 error if --copy-dt-needed-entries aka --add-needed is used and
8391 would cause a change in behaviour.
8392
8393 PR 10980
8394 * options.h (class General_options): Add -G as a short version of
8395 --shared. Add no-op options -assert, -g, and -i.
8396
8397 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8398
8399 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8400 check for .text or .gnu.linkonce.t sections.
8401 * icf.cc (Icf::find_identical_sections): Ditto.
8402 Change the detection for mangled function name within the section
8403 name.
8404 * icf.h (is_section_foldable_candidate): New function.
8405
8406 2009-12-30 Ian Lance Taylor <iant@google.com>
8407
8408 PR 10980
8409 * options.h (class General_options): Permit two dashes with
8410 --retain-symbols-file.
8411
8412 2009-12-30 Ian Lance Taylor <iant@google.com>
8413
8414 PR 10979
8415 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8416 don't put the file header and segment headers in the text
8417 segment.
8418
8419 PR 10979
8420 * common.cc (Sort_commons::operator()): Stabilize sort when both
8421 entries are NULL.
8422 (Symbol_table::do_allocate_commons_list): When allocating common
8423 symbols, skip a symbol which is no longer common.
8424 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8425 an object before checking its type.
8426 * testsuite/common_test_2.c: New file.
8427 * testsuite/common_test_3.c: New file.
8428 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8429 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8430 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8431 (common_test_2_pic.o, common_test_2.so): New targets.
8432 (common_test_3_pic.o, common_test_3.so): New targets.
8433 * testsuite/Makefile.in: Rebuild.
8434
8435 PR 10979
8436 * script.cc (read_input_script): If we see a new SECTIONS clause,
8437 and we have added an input section, give an error.
8438 * layout.h (class Layout): Add have_added_input_section function.
8439 Add have_added_input_section_ field.
8440 * layout.cc (Layout::Layout): Initialize
8441 have_added_input_section_.
8442 (Layout::layout): Set have_added_input_section_.
8443 (Layout::layout_eh_frame): Likewise.
8444
8445 2009-12-30 Ian Lance Taylor <iant@google.com>
8446
8447 PR 10931
8448 * options.h (class General_options): Add --sort-common option.
8449 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8450 * common.cc (Sort_common): Add sort_order parameter to
8451 constructor. Add sort_order_ field.
8452 (Sort_commons::operator): Check sort_order_.
8453 (Symbol_table::allocate_commons): Determine the sort order.
8454 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8455 Change all callers.
8456 (Symbol_table::do_allocate_commons_list): Likewise.
8457
8458 2009-12-30 Ian Lance Taylor <iant@google.com>
8459
8460 PR 10916
8461 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8462 symbols from this object, don't change the visibility of an
8463 undefined symbol.
8464 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8465
8466 2009-12-30 Ian Lance Taylor <iant@google.com>
8467
8468 PR 10861
8469 * script.h (class Version_script_info): Define Language enum.
8470 Update declarations. Define Glob, Exact, and Lookup types. Add
8471 new fields globals_, locals_, and is_finalized_.
8472 * script.cc: Various formatting fixes.
8473 (class Parser_closure): Change language_stack_ from a vector of
8474 std::string to one of Version_script_info::Language. Adjust all
8475 uses accordingly.
8476 (class Lazy_demangler): Remove.
8477 (struct Version_expression): Change language from std::string to
8478 Version_script_info::Language.
8479 (Version_script_info::Version_script_info): New function.
8480 (Version_script_info::~Version_script_info): Don't call clear.
8481 (Version_script_info::finalize): New function.
8482 (Version_script_info::build_lookup_tables): New function.
8483 (Version_script_info::build_expression_list_lookup): New
8484 function.
8485 (Version_script_info::get_symbol_version_helper): Rewrite to use
8486 lookup tables.
8487 (Version_script_info::print_expression_list): Adjust to use
8488 Version_script_info::Language.
8489 (script_push_lex_into_version_mode): Check that the version script
8490 has not been finalized.
8491 (version_script_push_lang): Change language string to
8492 Version_script_info::Language.
8493 * options.cc (Command_line::version_script): New function.
8494 * options.h (class General_options): Add finalize_dynamic_list
8495 function. Change version_script from declaration to definition.
8496 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8497 * testsuite/version_script.map: Remove duplicate def of foo.
8498 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8499 version_script.map.
8500 * testsuite/Makefile.in: Rebuild.
8501
8502 2009-12-30 Ian Lance Taylor <iant@google.com>
8503
8504 PR 10843
8505 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8506 if the input symbol index is 0, make the output symbol index 0.
8507
8508 2009-12-30 Ian Lance Taylor <iant@google.com>
8509
8510 PR 10670
8511 * options.h (class General_options): Add -x/--discard-all.
8512 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8513 --discard-all. If the local symbol needs a dynamic entry, check
8514 that before handling --discard-locals.
8515
8516 2009-12-30 Ian Lance Taylor <iant@google.com>
8517
8518 PR 10450
8519 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8520 flags to PF_R.
8521 (Output_segment::add_output_section): Don't change the flags if
8522 the type is PT_TLS.
8523
8524 PR 10450
8525 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8526 GNU hash table if they need a dynamic value. Otherwise, don't add
8527 them if they are defined in a dynamic object or are forced local.
8528
8529 2009-12-29 Ian Lance Taylor <iant@google.com>
8530
8531 PR 10450
8532 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8533 .gnu.hash table for a 32-bit target.
8534
8535 PR 10450
8536 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8537 regular and a dynamic object only needs a dynamic symbol table
8538 entry if it is externally visible.
8539
8540 PR 10450
8541 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8542 constructor. Add global_offset_table_ field.
8543 (Target_i386::got_section): Set global_offset_table_.
8544 (Target_i386::do_finalize_sections): Set global_offset_table_
8545 size.
8546 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8547 in constructor. Add global_offset_table_ field.
8548 (Target_x86_64::got_section): Set global_offset_table_.
8549 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8550 size.
8551
8552 * layout.cc (Layout::Layout): Initialize increase_relro_.
8553 (Layout::get_output_section): Add is_relro, is_last_relro, and
8554 is_first_non_relro parameters. Change all callers.
8555 (Layout::choose_output_section): Likewise.
8556 (Layout::add_output_section_data): Likewise.
8557 (Layout::make_output_section): Likewise.
8558 (Layout::set_segment_offsets): Clear increase_relro when using a
8559 linker script.
8560 * layout.h (class Layout): Add increase_relro method. Add
8561 increase_relro_ field. Update declarations.
8562 * output.cc (Output_section::Output_section): Initialize
8563 is_last_relro_ and is_first_non_relro_.
8564 (Output_segment::add_output_section): Group relro sections is
8565 do_sort is true. Handle is_last_relro and is_first_non_relro.
8566 (Output_segment::maximum_alignment): Remove relro handling.
8567 (Output_segment::set_section_addresses): Add increase_relro
8568 parameter. Change all callers. Add initial alignment to align
8569 relro sections on separate page. Remove old relro handling.
8570 (Output_segment::set_section_list_addresses): Remove in_relro
8571 parameter. Change all callers.
8572 (Output_segment::set_offset): Add increase parameter. Change all
8573 callers. Remove old relro handling.
8574 * output.h (class Output_section): Add new methods: is_last_relro,
8575 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8576 Add is_last_relro_ and is_first_non_relro_ fields.
8577 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8578 Create separate .got.plt section. Call increase_relro.
8579 * x86_64.cc (Target_x86_64::got_section): Likewise.
8580 * testsuite/relro_script_test.t: Add .got.plt.
8581
8582 PR 10450
8583 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8584 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8585 (Layout::finalize): Call set_dynamic_symbol_size.
8586 (Layout::set_dynamic_symbol_size): New function.
8587 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8588 set_dynamic_symbol_size.
8589
8590 PR 10450
8591 * output.h (class Output_section): Add is_entsize_zero_ field.
8592 * output.cc (Output_section::Output_section): Initialize
8593 is_entsize_zero_.
8594 (Output_section::set_entsize): If two different entsizes are
8595 requested, force it to zero.
8596 (Output_section::add_input_section): Set flags for .debug_str
8597 before updating section flags. Set entsize.
8598 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8599 and SHF_STRING if all input sections have those flags.
8600
8601 2009-12-29 Rafael Espindola <espindola@google.com>
8602
8603 * main.cc (main): Fix the sys time reporting.
8604 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8605 reporting.
8606
8607 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8608
8609 * options.cc (General_options::parse_version): Allow -v to exit
8610 without an error if there is nothing to link.
8611
8612 2009-12-29 Ian Lance Taylor <iant@google.com>
8613
8614 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8615 using a version of gcc before 4.1.
8616 * configure: Rebuild.
8617
8618 2009-12-28 Chris Demetriou <cgd@google.com>
8619
8620 * attributes.cc (Output_attributes_section_data::do_write): Use
8621 std::vector::front rather than std::vector::data.
8622
8623 2009-12-28 Ian Lance Taylor <iant@google.com>
8624
8625 * symtab.h (class Symbol_table): Add enum Defined.
8626 * resolve.cc (Symbol_table::should_override): Add defined
8627 parameter. Change all callers. Test whether object is NULL
8628 before calling a method on it.
8629 (Symbol_table::report_resolve_problem): Add defined parameter.
8630 Change all callers.
8631 (Symbol_table::should_override_with_special): Likewise.
8632 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8633 parameter. Change all callers.
8634 (Symbol_table::do_define_in_output_data): Likewise.
8635 (Symbol_table::define_in_output_segment): Likewise.
8636 (Symbol_table::do_define_in_output_segment): Likewise.
8637 (Symbol_table::define_as_constant): Likewise.
8638 (Symbol_table::do_define_as_constant): Likewise.
8639 * script.h (class Symbol_assignment): Add is_defsym parameter to
8640 constructor; change all callers.
8641 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8642 parameter. Change all callers. Add is_defsym_ field.
8643 (class Parser_closure): Add parsing_defsym parameter to
8644 constructor; change all callers. Add parsing_defsym accessor
8645 function. Add parsing_defsym_ field.
8646
8647 2009-12-28 Ian Lance Taylor <iant@google.com>
8648
8649 * gold.cc (queue_middle_tasks): Fix formatting.
8650 * object.cc (Relobj::is_section_name_included): Likewise.
8651
8652 2009-12-23 Ian Lance Taylor <iant@google.com>
8653
8654 * i386.cc (Target_i386::do_calls_non_split): Recognize
8655 -fsplit-stack prologue for a function with a static chain.
8656 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8657 -fsplit-stack prologue when using %r11.
8658
8659 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8660
8661 * options.cc (General_options::parse_version): Make -v continue and do
8662 the link like GNU ld does.
8663
8664 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8665
8666 * Makefile.am (CCFILES): Add timer.cc.
8667 (HFILES): Add timer.h.
8668 * configure.ac: Check for sysconf and times.
8669 * main.cc: include timer.h.
8670 (main): Use Timer instead of get_run_time.
8671 * timer.cc: New.
8672 * timer.h: New.
8673 * workqueue.cc: include timer.h.
8674 (Workqueue::find_and_run_task):
8675 Report user, sys and wall time.
8676 * Makefile.in: Regenerate.
8677 * config.in: Regenerate.
8678 * configure: Regenerate.
8679
8680 2009-12-16 Doug Kwan <dougkwan@google.com>
8681
8682 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8683 sections.
8684 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8685 relaxed input sections.
8686 * output.cc (Output_section::find_relaxed_input_section): Change
8687 return type to Output_relaxed_input_section pointer. Adjust code
8688 for new type of relaxed_input_section_map_.
8689 * output.h (Output_section::find_relaxed_input_section): Change
8690 return type to Output_relaxed_input_section pointer.
8691 (Output_section::Output_relaxed_input_section_by_input_section_map):
8692 New type.
8693 (Output_section::relaxed_input_section_map_): Change type to
8694 Output_section::Output_relaxed_input_section_by_input_section_map.
8695 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8696 input section.
8697
8698 2009-12-15 Ian Lance Taylor <iant@google.com>
8699
8700 * layout.cc (Layout::create_shstrtab): Only write out after input
8701 sections if we are compressing debug sections.
8702
8703 2009-12-15 Ian Lance Taylor <iant@google.com>
8704
8705 * archive.cc (Archive::add_symbols): Only look up a symbol without
8706 a version if there is, in fact, a version.
8707
8708 2009-12-14 Ian Lance Taylor <iant@google.com>
8709
8710 Revert -Wshadow changes, all changes from:
8711 2009-12-11 Doug Kwan <dougkwan@google.com>
8712 2009-12-11 Nick Clifton <nickc@redhat.com>
8713 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8714
8715 2009-12-11 Doug Kwan <dougkwan@google.com>
8716
8717 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8718 due to -Wshadow.
8719 * attributes.cc (Object_attribute::size): Ditto.
8720 (Attributes_section_data::size): Ditto.
8721 (Attributes_section_data::Attributes_section_data): Ditto.
8722 (Output_attributes_section_data::do_write): Ditto.
8723 * attributes.h (Object_attribute::set_type): Ditto.
8724 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8725
8726 2009-12-11 Nick Clifton <nickc@redhat.com>
8727
8728 * archive.cc: Fix shadowed variable warnings.
8729 * arm.cc: Likewise.
8730 * compressed_output.cc: Likewise.
8731 * compressed_output.h: Likewise.
8732 * configure: Likewise.
8733 * dwarf_reader.cc: Likewise.
8734 * dynobj.cc: Likewise.
8735 * dynobj.h: Likewise.
8736 * ehframe.cc: Likewise.
8737 * ehframe.h: Likewise.
8738 * errors.cc: Likewise.
8739 * expression.cc: Likewise.
8740 * fileread.cc: Likewise.
8741 * fileread.h: Likewise.
8742 * freebsd.h: Likewise.
8743 * i386.cc: Likewise.
8744 * icf.cc: Likewise.
8745 * incremental.h: Likewise.
8746 * layout.cc: Likewise.
8747 * layout.h: Likewise.
8748 * mapfile.cc: Likewise.
8749 * merge.cc: Likewise.
8750 * merge.h: Likewise.
8751 * object.cc: Likewise.
8752 * object.h: Likewise.
8753 * options.h: Likewise.
8754 * output.cc: Likewise.
8755 * output.h: Likewise.
8756 * parameters.cc: Likewise.
8757 * plugin.cc: Likewise.
8758 * powerpc.cc: Likewise.
8759 * reduced_debug_output.cc: Likewise.
8760 * reduced_debug_output.h: Likewise.
8761 * reloc.cc: Likewise.
8762 * reloc.h: Likewise.
8763 * resolve.cc: Likewise.
8764 * script-sections.cc: Likewise.
8765 * script.cc: Likewise.
8766 * script.h: Likewise.
8767 * sparc.cc: Likewise.
8768 * symtab.cc: Likewise.
8769 * symtab.h: Likewise.
8770 * target-select.cc: Likewise.
8771 * target-select.h: Likewise.
8772 * token.h: Likewise.
8773 * workqueue.cc: Likewise.
8774 * workqueue.h: Likewise.
8775 * x86_64.cc: Likewise.
8776
8777 2009-12-10 Doug Kwan <dougkwan@google.com>
8778
8779 * arm.cc (attributes.h): New include.
8780 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8781 (Arm_relobj::~Arm_relobj): Delete object pointed by
8782 attributes_section_data_.
8783 (Arm_relobj::attributes_section_data): New method definition.
8784 (Arm_relobj::attributes_section_data_): New data member declaration.
8785 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8786 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8787 attributes_section_data_.
8788 (Arm_dynobj::attributes_section_data): New method definition.
8789 (Arm_dynobj::attributes_section_data_): New data member declaration.
8790 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8791 initialization value of may_use_blx_ to false.
8792 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8793 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8794 object attributes to compute results instead of hard-coding.
8795 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8796 Target_arm::get_secondary_compatible_arch,
8797 Target_arm::set_secondary_compatible_arch
8798 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8799 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8800 New method declarations.
8801 (Target_arm::get_aeabi_object_attribute): New method definition.
8802 (Target_arm::attributes_section_data_): New data member declaration.
8803 (read_arm_attributes_section): New template definition.
8804 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8805 (Arm_dynobj::do_read_symbols): Ditto.
8806 (Target_arm::do_finalize_sections): Merge attributes sections from
8807 input. Check for BLX use after attributes section merging.
8808 Fix __exidx_start and __exidx_end visibility. Create an
8809 .ARM.attributes section if necessary.
8810 (Target_arm::get_secondary_compatible_arch,
8811 Target_arm::set_secondary_compatible_arch,
8812 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8813 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8814 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8815 New method definitions.
8816
8817 2009-12-09 Ian Lance Taylor <iant@google.com>
8818
8819 * plugin.cc (Plugin::load): Don't cast from void* to a function
8820 pointer.
8821
8822 2009-12-09 Ian Lance Taylor <iant@google.com>
8823
8824 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8825 information fields.
8826
8827 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8828
8829 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8830 Replace two_file_shared_1.so with two_file_shared_2.so.
8831 * testsuite/Makefile.in: Regenerated.
8832
8833 2009-12-08 Doug Kwan <dougkwan@google.com>
8834
8835 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8836 (HFILES): Add attributes.h and int_encoding.h.
8837 * Makefile.in: Regenerate.
8838 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8839 function definitions to int_encoding.cc
8840 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8841 prototypes to int_encoding.h
8842 * reduced_debug_output.cc (int_encoding.h): New include.
8843 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8844 function definitions to int_encoding.cc
8845 (insert_into_vector, read_from_pointer): Move template definitions to
8846 int_encoding.h
8847 * attributes.cc: New file.
8848 * attributes.h: New file.
8849 * int_encoding.cc: New file.
8850 * int_encoding.h: New file.
8851
8852 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8853
8854 PR gold/11055
8855 * incremental-dump.cc (dump_incremental_inputs): New.
8856 (main): Use dump_incremental_inputs.
8857
8858 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8859
8860 PR gold/10893
8861 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8862 checking elfcpp::STT_FUNC.
8863 (Target_i386::Relocate::relocate): Likewise.
8864 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8865
8866 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8867 symbols from shared libraries into normal FUNC symbols.
8868
8869 * symtab.h (Symbol): Add is_func and use it.
8870
8871 2009-12-05 Doug Kwan <dougkwan@google.com>
8872
8873 * arm.cc (Target_arm::arm_info): Initialize new fields
8874 attributes_section and attributes_vendor.
8875 * i386.cc (Target_i386::i386_info): Same.
8876 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8877 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8878 fields attributes_section and attributes_vendor.
8879 * sparc.cc (Target_sparc::sparc_info): Same.
8880 * target.h (Target::attributes_section, Target::attributes_vendor,
8881 Target::is_attributes_section, Target::attribute_arg_type,
8882 Target::attributes_order): New method definitions.
8883 (Target::Target_info::attributes_section,
8884 Target::Target_info::attributes_vendor): New fields.
8885 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8886 virtual method definitions.
8887 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8888 attributes_section and attributes_vendor.
8889 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8890
8891 2009-12-05 Doug Kwan <dougkwan@google.com>
8892
8893 * arm.cc: Update comments about interworking and stub generation.
8894 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8895 considered as non-PIC.
8896 (Arm_relocate_functions::base_abs): Fix formatting.
8897 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8898 of function to use GOT entry address instead of offset.
8899 (Target_arm::Scan::global): Issue an error if a symbol would need a
8900 PLT does not get one because it is untyped. Remove code to create
8901 dynamic symbols for relative branches.
8902 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8903 takes unsigned integer instead of boolean.
8904
8905 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8906
8907 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8908 (two_file_test_LDADD): Likewise.
8909 (common_test_1_LDADD): Likewise.
8910 (exception_test_LDADD) Likewise.
8911 (weak_test_LDADD): Likewise.
8912 (many_sections_test_LDADD): Likewise.
8913 (initpri1_LDADD): Likewise.
8914 (script_test_1_LDADD): Likewise.
8915 (script_test_2_LDADD): Likewise.
8916 (justsyms_LDADD): Likewise.
8917 (binary_test_LDADD): Likewise.
8918 (large_LDADD): Likewise.
8919 * testsuite/Makefile.in: Regenerated.
8920
8921 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8922
8923 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8924 (Symbol_table::override_with_special): Likewise.
8925 (Symbol_table::add_from_object): Likewise.
8926
8927 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8928
8929 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8930 Don't set the data_offset twice.
8931
8932 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8933
8934 * testsuite/Makefile.in: Regenerate.
8935
8936 2009-12-03 Doug Kwan <dougkwan@google.com>
8937
8938 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8939 (Target_arm::do_finalize_sections): Add parameter for symbol table
8940 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8941 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8942 parameter for symbol table pointer.
8943 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8944 an additional parameter for a pointer to symbol table.
8945 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8946 parameter for a symbol table pointer.
8947 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8948 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8949 Ditto.
8950 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8951 parameter for a symbol table pointer.
8952
8953 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8954
8955 * incremental.cc (Incremental_inputs_header)
8956 (Incremental_inputs_header_write, Incremental_inputs_entry)
8957 (Incremental_inputs_entry_write): Move ...
8958 * incremental.h (Incremental_inputs_header)
8959 (Incremental_inputs_header_write, Incremental_inputs_entry)
8960 (Incremental_inputs_entry_write): here.
8961
8962 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8963
8964 * incremental.cc (make_sized_incremental_binary): Set the target.
8965 Error if it is incompatible.
8966 * output.h (Output_file): Add filename method.
8967
8968 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8969
8970 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8971 from the get_* methods.
8972
8973 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8974
8975 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8976 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8977 Write 0 for the data_offset of scripts.
8978
8979 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8980
8981 * testsuite/Makefile.am: Add the incremental_test.sh test.
8982 * testsuite/incremental_test.sh: New.
8983 * testsuite/incremental_test_1.c: New.
8984 * testsuite/incremental_test_2.c: New.
8985
8986 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8987
8988 * incremental-dump.cc (main): Fix typos.
8989
8990 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8991
8992 PR gold/11025
8993 * incremental-dump.cc (main): Use llu to print 64 bit values.
8994
8995 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8996 H.J. Lu <hongjiu.lu@intel.com>
8997
8998 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8999 $(LIBDL).
9000 (incremental_dump_LDADD): Likewise.
9001 * Makefile.in: Regenerated.
9002
9003 2009-11-25 Doug Kwan <dougkwan@google.com>
9004
9005 Revert:
9006
9007 2009-11-25 Doug Kwan <dougkwan@google.com>
9008
9009 * arm.cc (Target_arm::Target_arm): Move method definition
9010 outside of class definition. Add code to handle
9011 --target1-rel, --target1-abs and --target2= options.
9012 (Target_arm::get_reloc_reloc_type): Change method to be
9013 non-static and const.
9014 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9015 New data member declaration.
9016 (Target_arm::Scan::local, Target_arm::Scan::global,
9017 Target_arm::Relocate::relocate,
9018 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9019 Adjust call to Target_arm::get_real_reloc_type.
9020 (Target_arm::get_real_reloc_type): Use command line options
9021 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9022 * options.h (--target1-rel, --target1-abs, --target2): New
9023 ARM-only options.
9024
9025 2009-11-25 Doug Kwan <dougkwan@google.com>
9026
9027 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9028 class definition. Add code to handle --target1-rel, --target1-abs
9029 and --target2= options.
9030 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9031 and const.
9032 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9033 member declaration.
9034 (Target_arm::Scan::local, Target_arm::Scan::global,
9035 Target_arm::Relocate::relocate,
9036 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9037 call to Target_arm::get_real_reloc_type.
9038 (Target_arm::get_real_reloc_type): Use command line options to
9039 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9040 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9041 options.
9042
9043 2009-11-25 Doug Kwan <dougkwan@google.com>
9044
9045 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9046 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9047 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9048 formatting.
9049 (Arm_relocate_functions::thm_call): Replace body with a call to
9050 Arm_relocate_functions::thumb_branch_common.
9051 (Arm_relocate_functions::thm_jump24,
9052 Arm_relocate_functions::thm_xpc22): New method definitions.
9053 (Arm_relocate_functions::thumb_branch_common): New method definition.
9054 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9055 operator.
9056 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9057 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9058
9059 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9060
9061 * Makefile.am: Build incremental-dump
9062 * Makefile.in: Regenerate.
9063 * incremental-dump.cc: New.
9064 * incremental.cc (Incremental_inputs_header_data,
9065 Incremental_inputs_entry_data): Move to incremental.h
9066 * incremental.h: (Incremental_inputs_header_data,
9067 Incremental_inputs_entry_data): Move from incremental.cc
9068
9069 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9070
9071 * incremental.cc (Incremental_inputs_header,
9072 Incremental_inputs_header_write, Incremental_inputs_entry,
9073 Incremental_inputs_entry_write): Add a typedef with the data type.
9074
9075 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9076
9077 * incremental.cc (Incremental_inputs_header,
9078 Incremental_inputs_header_write, Incremental_inputs_entry,
9079 Incremental_inputs_entry_write): Update comment about which
9080 type has the filed descriptions.
9081
9082 2009-11-15 Doug Kwan <dougkwan@google.com>
9083
9084 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9085 (Arm_relocate_functions::arm_branch_common): Change method defintion
9086 in class definition to a method declaration and update list of formal
9087 parameters.
9088 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9089 Arm_relocation_functions::jump24): Adjust call to
9090 Arm_relocate_functions::arm_branch_common. Update list of formal
9091 parameters.
9092 (Arm_relocate_functions::xpc25): New method definition.
9093 (Arm_relocate_functions::arm_branch_common): Move method defintion
9094 out from class definition. Use stubs for mode-switching and extending
9095 branch ranges.
9096 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9097 specially. Change code to enable use of stubs in ARM branches.
9098
9099 2009-11-10 Doug Kwan <dougkwan@google.com>
9100
9101 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9102 in method declaration.
9103 (Target_arm::relocate_stub): New method declaration.
9104 (Target_arm::default_target): Change to return a pointer instead of
9105 a const reference.
9106 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9107 Target_arm::default_target.
9108 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9109 method definition.
9110 (Target_arm::relocate_section): Adjust view.
9111 (Target_arm::relocate_stub): New method definition.
9112
9113 2009-11-10 Doug Kwan <dougkwan@google.com>
9114
9115 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9116 a format warning.
9117 * incremental.cc (open_incremental_binary): Initialized local
9118 variables to avoid warnings.
9119 * object.cc (make_elf_object): Ditto.
9120 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9121 a format warning.
9122
9123 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9124
9125 PR gold/10930
9126 * testsuite/plugin_test.c: Include "config.h".
9127
9128 2009-11-09 Doug Kwan <dougkwan@google.com>
9129
9130 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9131 (arm_symbol_value): Remove.
9132 (Arm_relocate_functions::arm_branch_common,
9133 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9134 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9135 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9136 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9137 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9138 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9139 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9140 Arm_relocate_functions::thm_mobw_abs_nc,
9141 Arm_relocate_functions::thm_mov_abs,
9142 Arm_relocate_functions::movw_prel_nc,
9143 Arm_relocate_functions::thm_movt_abs,
9144 Arm_relocate_functions::movt_prel,
9145 Arm_relocate_functions::thm_movw_prel_nc,
9146 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9147 (Target_arm::Relocate::relocate): Only decompose address into two
9148 parts if relocation type uses the thumb-bit and pass the actual
9149 bit instead of a flag indicating that the thumb-bit is used. Adjust
9150 calls to methods in Arm_relocate_functions for this change.
9151
9152 2009-11-08 Ian Lance Taylor <iant@google.com>
9153
9154 PR 10925
9155 * reloc.cc: Instantiate
9156 Sized_relobj::initialize_input_to_output_maps and
9157 Sized_relobj:free_input_to_output_maps.
9158
9159 2009-11-06 Ian Lance Taylor <iant@google.com>
9160
9161 PR 10876
9162 * defstd.cc (in_segment): Set only_if_ref true for "end".
9163
9164 2009-11-06 Doug Kwan <dougkwan@google.com>
9165
9166 * arm.cc (class Reloc_stub): Correct a comment.
9167 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9168 (Target_arm::scan_section_for_stubs): New method declaration.
9169 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9170 Change methods from private to protected.
9171 (Target_arm::do_may_relax): New method definition.
9172 (Target_arm::do_relax, Target_arm::group_sections,
9173 Target_arm::scan_reloc_for_stub,
9174 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9175 (Target_arm::arm_input_section_map_): New data member declaration.
9176 (Target_arm::scan_reloc_for_stub,
9177 Target_arm::scan_reloc_section_for_stubs,
9178 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9179 Target_arm::do_relax): New method definitions.
9180
9181 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9182
9183 * configure.ac: Check for (struct stat)::st_mtim
9184 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9185 * config.in: Regenerate.
9186 * configure: Regenerate.
9187
9188 2009-11-05 Ian Lance Taylor <iant@google.com>
9189
9190 PR 10910
9191 * output.cc (Output_segment::add_output_section): Add missing
9192 return statement.
9193
9194 2009-11-04 Ian Lance Taylor <iant@google.com>
9195
9196 PR 10880
9197 * object.h (class Object): Add is_needed and set_is_needed
9198 methods. Add is_needed_ field. Make bool fields into bitfields.
9199 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9200 defined in a dynamic object and referenced by a regular object,
9201 set is_needed for the dynamic object.
9202 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9203 if the file is marked with as_needed and it is not needed.
9204
9205 2009-11-04 Ian Lance Taylor <iant@google.com>
9206
9207 PR 10887
9208 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9209 tags if data is discarded by linker script.
9210 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9211 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9212 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9213 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9214
9215 2009-11-04 Ian Lance Taylor <iant@google.com>
9216
9217 * layout.cc (Layout::get_output_section): Add is_interp and
9218 is_dynamic_linker_section parameters. Change all callers.
9219 (Layout::choose_output_section): Likewise.
9220 (Layout::make_output_section): Likewise.
9221 (Layout::add_output_section_data): Add is_dynamic_linker_section
9222 parameter. Change all callers.
9223 * layout.h (class Layout): Update declarations.
9224 * output.h (class Output_section): Add is_interp, set_is_interp,
9225 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9226 Add is_interp_, is_dynamic_linker_section_ fields. Change
9227 generate_code_fills_at_write_ to a bitfield.
9228 * output.cc (Output_section::Output_sections): Initialize new
9229 fields.
9230 (Output_segment::add_output_section): Add do_sort parameter.
9231 Change all callers.
9232
9233 2009-11-03 Ian Lance Taylor <iant@google.com>
9234
9235 PR 10860
9236 * options.h (class General_options): Add --warn-common.
9237 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9238 merging two common symbols.
9239 (Symbol_table::should_override): Handle --warn-common when merging
9240 a common symbol with a defined symbol. Use report_resolve_problem
9241 for multiple definitions.
9242 (Symbol_table::report_resolve_problem): New function.
9243 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9244
9245 2009-11-03 Doug Kwan <dougkwan@google.com>
9246
9247 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9248 stub_factory_.
9249 (Target_arm::stub_factory): New method definition.
9250 (Target_arm::new_arm_input_section,
9251 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9252 Target_arm::reloc_uses_thumb_bit): New method declarations.
9253 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9254 New type definitions.
9255 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9256 member declarations.
9257 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9258 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9259 New method definitions.
9260
9261 2009-11-03 Ian Lance Taylor <iant@google.com>
9262
9263 * options.h (class General_options): Add --warn_constructors.
9264
9265 2009-11-03 Ian Lance Taylor <iant@google.com>
9266
9267 PR 10893
9268 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9269 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9270
9271 2009-11-03 Ian Lance Taylor <iant@google.com>
9272
9273 PR 10895
9274 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9275 --msgid-bugs-address.
9276 (install-pdf): New target.
9277 (install-data_yes): Look up one directory to find mkinstalldirs.
9278
9279 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9280
9281 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9282 tree.
9283
9284 2009-10-30 Doug Kwan <dougkwan@google.com>
9285
9286 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9287
9288 2009-10-30 Doug Kwan <dougkwan@google.com>
9289
9290 * arm.cc (Stub_addend_reader): New struct template definition
9291 and partial specializations.
9292 (Stub_addend_reader::operator()): New method definition for a
9293 partially specialized template.
9294
9295 2009-10-30 Doug Kwan <dougkwan@google.com>
9296
9297 * arm.cc (Arm_relobj::processor_specific_flags): New method
9298 definition.
9299 (Arm_relobj::do_read_symbols): New method declaration.
9300 (Arm_relobj::processor_specific_flags_): New data member declaration.
9301 (Arm_dynobj): New class definition.
9302 (Target_arm::do_finalize_sections): Add input_objects parameter.
9303 (Target_arm::do_adjust_elf_header): New method declaration.
9304 (Target_arm::are_eabi_versions_compatible,
9305 (Target_arm::merge_processor_specific_flags): New method declaration.
9306 (Target_arm::do_make_elf_object): New overloaded method definitions
9307 and declaration.
9308 (Arm_relobj::do_read_symbols): New method definition.
9309 (Arm_dynobj::do_read_symbols): Ditto.
9310 (Target_arm::do_finalize_sections): Add input_objects parameters.
9311 Merge processor-specific flags from all input objects.
9312 (Target_arm::are_eabi_versions_compatible,
9313 Target_arm::merge_processor_specific_flags,
9314 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9315 New method definitions.
9316 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9317 Input_objects pointer type parameter.
9318 * layout.cc (Layout::finalize): Pass input objects to target's.
9319 finalize_sections function.
9320 * output.cc (Output_file_header::do_sized_write): Set ELF file
9321 header's processor-specific flags.
9322 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9323 Input_objects pointer type parameter.
9324 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9325 * target.h (Input_objects): New forward class declaration.
9326 (Target::processor_specific_flags,
9327 Target::are_processor_specific_flags_sect): New method definitions.
9328 (Target::finalize_sections): Add input_objects parameter.
9329 (Target::Target): Initialize processor_specific_flags_ and
9330 are_processor_specific_flags_set_.
9331 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9332 parameter.
9333 (Target::set_processor_specific_flags): New method definition.
9334 (Target::processor_specific_flags_,
9335 Target::are_processor_specific_flags_set_): New data member
9336 declarations.
9337 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9338 Input_objects pointer type parameter.
9339
9340 2009-10-30 Doug Kwan <dougkwan@google.com>
9341
9342 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9343
9344 2009-10-28 Ian Lance Taylor <iant@google.com>
9345
9346 * object.h (class Relobj): Drop options parameter from
9347 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9348 do_scan_relocs, do_relocate. Change all callers.
9349 (class Sized_relobj): Drop options parameters from
9350 do_gc_process_relocs, do_scan_relocs, do_relocate,
9351 do_relocate_sections, relocate_sections, emit_relocs_scan,
9352 emit_relocs_scan_reltype. Change all callers.
9353 (struct Relocate_info): Remove options field and all references to
9354 it.
9355 * reloc.h (class Read_relocs): Remove options constructor
9356 parameter and options_ field. Change all callers.
9357 (class Gc_process_relocs, class Scan_relocs): Likewise.
9358 (class Relocate_task): Likewise.
9359 * target-reloc.h (scan_relocs): Remove options parameter. Change
9360 all callers.
9361 (scan_relocatable_relocs): Likewise.
9362 * target.h (class Sized_target): Remove options parameter from
9363 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9364 all callers.
9365 * gc.h (gc_process_relocs): Remove options parameter. Change all
9366 callers.
9367 * arm.cc: Update functions to remove options parameters.
9368 * i386.cc: Likewise.
9369 * powerpc.cc: Likewise.
9370 * sparc.cc: Likewise.
9371 * x86_64.cc: Likewise.
9372 * testsuite/testfile.cc: Likewise.
9373
9374 2009-10-28 Doug Kwan <dougkwan@google.com>
9375
9376 * arm.cc (Arm_relobj): New class definition.
9377 (Arm_relobj::scan_sections_for_stubs,
9378 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9379 New method definitions.
9380
9381 2009-10-28 Cary Coutant <ccoutant@google.com>
9382
9383 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9384 (Plugin::cleanup_done_): New member.
9385 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9386 (Plugin_manager::cleanup_done_): Remove.
9387 (Plugin_manager::add_input_file): Edit error message.
9388 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9389 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9390
9391 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9392
9393 * fileread.cc: (File_read::View::~View): Use the new
9394 data_ownership_ filed.
9395 (File_read::~File_read): Dispose the new whole_file_view_.
9396 (File_read::open): Mmap the whole file if needed.
9397 (File_read::open): Use whole_file_view_ instead of contents_.
9398 (File_read::find_view): Use whole_file_view_ if applicable.
9399 (File_read::do_read): Use whole_file_view_ instead of contents_.
9400 (File_read::make_view): Use whole_file_view_ instead of contents_,
9401 update File_read::View::View call.
9402 (File_read::find_or_make_view): Update File_read::View::View
9403 call.
9404 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9405 remove contents_
9406 (File_read::View::Data_ownership): New enum.
9407 (File_read::View::View): Replace bool mapped_ with Data_ownership
9408 argument.
9409 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9410 (File_read::View::data_ownership_): New field.
9411 (File_read::contents_): Remove (replaced by whole_file_view_).
9412 (File_read::whole_file_view_): New field.
9413 * options.h (class General_options): Add --keep-files-mapped.
9414
9415 2009-10-27 Cary Coutant <ccoutant@google.com>
9416
9417 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9418 * testsuite/Makefile.am (plugin_test_5): New test case.
9419 * testsuite/Makefile.in: Regenerate.
9420
9421 2009-10-25 Doug Kwan <dougkwan@google.com>
9422
9423 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9424 from private to protected to allow access by child class.
9425 (Sized_relobj::do_relocate_sections): New method declaration.
9426 (Sized_relobj::relocate_sections): Virtualize.
9427 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9428 Sized_relobj::relocate_sections. Instantiate template explicitly
9429 for different target sizes and endianity.
9430
9431 2009-10-24 Doug Kwan <dougkwan@google.com>
9432
9433 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9434 (Arm_input_section::as_arm_input_section): New method.
9435 (Arm_output_section): New class definition.
9436 (Arm_output_section::create_stub_group,
9437 Arm_output_section::group_sections): New method definitions.
9438
9439 2009-10-22 Doug Kwan <dougkwan@google.com>
9440
9441 * arm.cc (Arm_input_section): New class definition.
9442 (Arm_input_section::init, Arm_input_section:do_write,
9443 Arm_input_section::set_final_data_size,
9444 Arm_input_section::do_reset_address_and_file_offset): New method
9445 definitions.
9446
9447 2009-10-21 Doug Kwan <dougkwan@google.com>
9448
9449 * arm.cc (Stub_table, Arm_input_section): New forward class
9450 declarations.
9451 (Stub_table): New class defintion.
9452 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9453 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9454 New method definition.
9455
9456 2009-10-21 Doug Kwan <dougkwan@google.com>
9457
9458 * arm.cc: Update copyright comments.
9459 (Target_arm): New forward class template declaration.
9460 (Arm_address): New type.
9461 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9462 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9463 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9464 constants.
9465 (Insn_template): Same.
9466 (DEF_STUBS): New macro.
9467 (Stub_type): New enum type.
9468 (Stub_template): New class definition.
9469 (Stub): Same.
9470 (Reloc_stub): Same.
9471 (Stub_factory): Same.
9472 (Target_arm::Target_arm): Initialize may_use_blx_ and
9473 should_force_pic_veneer_.
9474 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9475 Target_arm::should_force_pic_veneer,
9476 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9477 Target_arm::using_thumb_only, Target_arm:;default_target): New
9478 method defintions.
9479 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9480 New data member declarations.
9481 (Insn_template::size, Insn_template::alignment): New method defintions.
9482 (Stub_template::Stub_template): New method definition.
9483 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9484 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9485 (Stub_factory::Stub_factory): New method definition.
9486 * gold.h (string_hash): New template.
9487 * output.h (Input_section_specifier::hash_value): Use
9488 gold::string_hash.
9489 (Input_section_specifier::string_hash): Remove.
9490 * stringpool.cc (Stringpool_template::string_hash): Use
9491 gold::string_hash.
9492
9493 2009-10-20 Doug Kwan <dougkwan@google.com>
9494
9495 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9496 symbols of relaxed input sections.
9497 * output.h (Output_section::find_relaxed_input_section): Make
9498 method public.
9499
9500 2009-10-16 Doug Kwan <dougkwan@google.com>
9501
9502 * dynobj.cc (Versions::Versions): Initialize version_script_.
9503 Only insert base version symbol definition for a shared object
9504 if version script defines any version versions.
9505 (Versions::define_base_version): New method definition.
9506 (Versions::add_def): Check that base version is not needed.
9507 (Versions::add_need): Define base version lazily.
9508 * dynobj.h (Versions::define_base_version): New method declaration.
9509 (Versions::needs_base_version_): New data member declaration.
9510 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9511 (check_DATA): Add no_version_test.stdout.
9512 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9513 New make rules.
9514 * testsuite/Makefile.in: Regenerate.
9515 * testsuite/no_version_test.c: New file.
9516 * testsuite/no_version_test.sh: Ditto.
9517
9518 2009-10-16 Doug Kwan <dougkwan@google.com>
9519
9520 * expression.cc (class Segment_start_expression): New class definition.
9521 (Segment_start_expression::value): New method definition.
9522 (script_exp_function_segment_start): Return a new
9523 Segment_start_expression.
9524 * gold/script-c.h (script_saw_segment_start_expression): New function
9525 prototype.
9526 * script-sections.cc (Script_sections::Script_sections): Initialize
9527 SAW_SEGMENT_START_EXPRESSION_ to false.
9528 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9529 and -Tbbs options to specify section addresses if given in
9530 command line and no SEGMENT_START expression is seen in a script.
9531 * script-sections.h (Script_sections::saw_segment_start_expression,
9532 Script_sections::set_saw_segment_start_expression): New method
9533 definition.
9534 (Script_sections::saw_segment_start_expression_): New data member
9535 declaration.
9536 * script.cc (script_saw_segment_start_expression): New function.
9537 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9538 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9539 script_test_7.sh and script_test_8.sh.
9540 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9541 script_test_8.stdout.
9542 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9543 (script_test_6, script_test_6.stdout, script_test_7,
9544 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9545 * Makefile.in: Regenerate.
9546 * testsuite/script_test_6.sh: New file.
9547 * testsuite/script_test_6.t: Same.
9548 * testsuite/script_test_7.sh: Same.
9549 * testsuite/script_test_7.t: Same.
9550 * testsuite/script_test_8.sh: Same.
9551
9552 2009-10-16 Doug Kwan <dougkwan@google.com>
9553
9554 * output.cc (Output_segment::set_section_list_address): Cast
9555 expressions to unsigned long long type to avoid format warnings.
9556
9557 2009-10-15 Ian Lance Taylor <iant@google.com>
9558
9559 * script.cc (Script_options::add_symbol_assignment): Always add a
9560 dot assignment to script_sections_.
9561 * script-sections.cc (Script_sections::add_dot_assignment):
9562 Initialize if necessary.
9563
9564 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9565 program headers with no load segment if there is a linker script.
9566
9567 * layout.cc (Layout::set_segment_offsets): Align the file offset
9568 to the segment aligment for -N or -n with no load segment.
9569 * output.cc (Output_segment::add_output_section): Don't crash if
9570 the first section is a TLS section.
9571 (Output_segment::set_section_list_addresses): Print an error
9572 message if the address moves backward in a linker script.
9573 * script-sections.cc
9574 (Output_section_element_input::set_section_addresses): Don't
9575 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9576 (Orphan_output_section::set_section_addresses): Likewise.
9577
9578 2009-10-15 Doug Kwan <dougkwan@google.com>
9579
9580 * layout.cc (Layout::finish_dynamic_section): Generate tags
9581 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9582 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9583 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9584
9585 2009-10-14 Ian Lance Taylor <iant@google.com>
9586
9587 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9588 fields.
9589 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9590 data_shdr fields of relinfo.
9591 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9592 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9593 R_386_TLS_LDO_32, adjust based on section flags.
9594 (Target_i386::Relocate::fix_up_ldo): Remove.
9595
9596 2009-10-13 Ian Lance Taylor <iant@google.com>
9597
9598 Add support for -pie.
9599 * options.h (class General_options): Add -pie and
9600 --pic-executable.
9601 (General_options::output_is_position_independent): Test -pie.
9602 (General_options::output_is_executable): Return true if not shared
9603 and not relocatable.
9604 (General_options::output_is_pie): Remove.
9605 * options.cc (General_options::finalize): Reject incompatible uses
9606 of -pie.
9607 * gold.cc (queue_middle_tasks): A -pie link is not static.
9608 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9609 * symtab.cc (Symbol::final_value_is_known): Return false if
9610 output_is_position_independent.
9611 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9612 output_is_position_independent.
9613 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9614 output_is_position_independent.
9615 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9616 output_is_position_independent.
9617 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9618 two_file_pie_test.
9619 (basic_pie_test.o, basic_pie_test): New targets.
9620 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9621 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9622 (two_file_pie_test): New target.
9623 * testsuite/Makefile.in: Rebuild.
9624 * README: Remove note saying that -pie is not supported.
9625
9626 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9627
9628 * options.h (class General_options): Add -init and -fini.
9629 * layout.cc (Layout::finish_dynamic_section): Emit
9630 given init and fini functions.
9631
9632 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9633
9634 * gc.h (gc_process_relocs): Check if icf is enabled using new
9635 function.
9636 * gold.cc (queue_initial_tasks): Likewise.
9637 (queue_middle_tasks): Likewise.
9638 * object.cc (do_layout): Likewise.
9639 * symtab.cc (is_section_folded): Likewise.
9640 * main.cc (main): Likewise.
9641 * reloc.cc (Read_relocs::run): Likewise.
9642 (Sized_relobj::do_scan_relocs): Likewise.
9643 * icf.cc (is_function_ctor_or_dtor): New function.
9644 (Icf::find_identical_sections): Check if function is ctor or dtor when
9645 safe icf is chosen.
9646 * options.h (General_options::icf): Change option to be an enum.
9647 (Icf_status): New enum.
9648 (icf_enabled): New method.
9649 (icf_safe_folding): New method.
9650 (set_icf_status): New method.
9651 (icf_status_): New variable.
9652 * (options.cc) (General_options::finalize): Set icf_status_.
9653 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9654 icf_test and icf_keep_unique_test to use the --icf enum flag.
9655 * testsuite/icf_safe_test.sh: New file.
9656 * testsuite/icf_safe_test.cc: New file.
9657
9658 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9659
9660 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9661 includes to gc.h and icf.h.
9662 * arm.cc: Include gc.h.
9663 * gold.cc: Likewise.
9664 * i386.cc: Likewise.
9665 * powerpc.cc: Likewise.
9666 * sparc.cc: Likewise.
9667 * x86_64.cc: Likewise.
9668 * gc.h: Include icf.h.
9669
9670 2009-10-11 Ian Lance Taylor <iant@google.com>
9671
9672 * plugin.cc: Include "gold.h" before other header files.
9673
9674 2009-10-10 Chris Demetriou <cgd@google.com>
9675
9676 * options.h (Input_file_argument::Input_file_type): New enum.
9677 (Input_file_argument::is_lib_): Replace with...
9678 (Input_file_argument::type_): New member.
9679 (Input_file_argument::Input_file_argument): Take Input_file_type
9680 'type' rather than boolean 'is_lib' as second argument.
9681 (Input_file_argument::is_lib): Use type_.
9682 (Input_file_argument::is_searched_file): New function.
9683 (Input_file_argument::may_need_search): Handle is_searched_file.
9684 * options.cc (General_options::parse_library): Support -l:filename.
9685 (General_options::parse_just_symbols): Update for Input_file_argument
9686 changes.
9687 (Command_line::process): Likewise.
9688 * archive.cc (Archive::get_file_and_offset): Likewise.
9689 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9690 * script.cc (read_script_file, script_add_file): Likewise.
9691 * fileread.cc (Input_file::Input_file): Likewise.
9692 (Input_file::will_search_for): Handle is_searched_file.
9693 (Input_file::open): Likewise.
9694 * readsyms.cc (Read_symbols::get_name): Likewise.
9695 * testsuite/Makefile.am (searched_file_test): New test.
9696 * testsuite/Makefile.in: Regenerate.
9697 * testsuite/searched_file_test.cc: New file.
9698 * testsuite/searched_file_test_lib.cc: New file.
9699
9700 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9701 Ian Lance Taylor <iant@google.com>
9702
9703 * descriptor.cc: Include <cstdio> and "binary-io.h".
9704 (Descriptors::open): Open the files in binary mode always.
9705 * script.cc (Lex::get_token): Treat \r as whitespace.
9706
9707 2009-10-09 Ian Lance Taylor <iant@google.com>
9708
9709 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9710
9711 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9712 Ian Lance Taylor <iant@google.com>
9713
9714 * configure.ac: Check for readv function also.
9715 * fileread.cc (readv): Define if not HAVE_READV.
9716 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9717 does not exist.
9718 * config.in: Regenerate.
9719 * configure: Regenerate.
9720
9721 2009-10-09 Doug Kwan <dougkwan@google.com>
9722
9723 * layout.cc (Layout::make_output_section): Call target hook to make
9724 ordinary output section.
9725 (Layout::finalize): Adjust parameter list of call the
9726 Target::may_relax().
9727 * layout.h (class Layout::section_list): New method.
9728 * merge.h (Output_merge_base::entsize): Change visibility to public.
9729 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9730 New methods.
9731 (Output_merge_string::do_is_string): New method.
9732 * object.cc (Sized_relobj::do_setup): renamed from
9733 Sized_relobj::set_up.
9734 * object.h (Sized_relobj::adjust_shndx,
9735 Sized_relobj::initializ_input_to_output_maps,
9736 Sized_relobj::free_input_to_output_maps): Change visibilities to
9737 protected.
9738 (Sized_relobj::setup): Virtualize.
9739 (Sized_relobj::do_setup): New method declaration.
9740 (Sized_relobj::invalidate_section_offset,
9741 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9742 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9743 * options.cc (parse_int): New function.
9744 * options.h (parse_int): New declaration.
9745 (DEFINE_int): New macro.
9746 (stub_group_size): New option.
9747 * output.cc (Output_section::Output_section): Initialize memebers
9748 merge_section_map_, merge_section_by_properties_map_,
9749 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9750 (Output_section::add_input_section): Handled deferred code-fill
9751 generation and remove an old comment.
9752 (Output_section::add_relaxed_input_section): New method definition.
9753 (Output_section::add_merge_input_section): Use merge section by
9754 properties map to speed to search. Update merge section maps
9755 as appropriate.
9756 (Output_section::build_relaxation_map): New method definition.
9757 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9758 Same.
9759 (Output_section::relax_input_section): Renamed to
9760 Output_section::convert_input_sections_to_relaxed_sections and change
9761 interface to take a vector of pointers to relaxed sections.
9762 (Output_section::find_merge_section,
9763 Output_section::find_relaxed_input_section): New method definitions.
9764 (Output_section::is_input_address_mapped,
9765 Output_section::output_offset, Output_section::output_address):
9766 Use output section data maps to speed up searching.
9767 (Output_section::find_starting_output_address): Add comments.
9768 (Output_section::do_write,
9769 Output_section::write_to_postprocessing_buffer): Do code-fill
9770 generation as appropriate.
9771 (Output_section::get_input_sections): Invalidate relaxed input section
9772 map.
9773 (Output_section::restore_states): Adjust type of checkpoint .
9774 Invalidate relaxed input section map.
9775 * output.h (Output_merge_base): New class declaration.
9776 (Input_section_specifier): New class defintion.
9777 (class Output_relaxed_input_section) Change base class to
9778 Output_section_data_build.
9779 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9780 base class initializer.
9781 (Output_section::add_relaxed_input_section): New method declaration.
9782 (Output_section::Input_section): Change visibility to protected.
9783 (Output_section::Input_section::relobj,
9784 Output_section::Input_section::shndx): Handle relaxed input sections.
9785 Output_section::input_sections) Change visibility to protected. Also
9786 define overload to return a non-const pointer.
9787 (Output_section::Merge_section_properties): New class defintion.
9788 (Output_section::Merge_section_by_properties_map,
9789 Output_section::Output_section_data_by_input_section_map,
9790 Output_section::Relaxation_map): New types.
9791 (Output_section::relax_input_section): Rename method to
9792 Output_section::convert_input_sections_to_relaxed_sections and change
9793 interface to take a vector of relaxed section pointers.
9794 (Output_section::find_merge_section,
9795 Output_section::find_relaxed_input_section,
9796 Output_section::build_relaxation_map,
9797 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9798 New method declarations.
9799 (Output_section::merge_section_map_
9800 Output_section::merge_section_by_properties_map_,
9801 Output_section::relaxed_input_section_map_,
9802 Output_section::is_relaxed_input_section_map_valid_,
9803 Output_section::generate_code_fills_at_write_): New data members.
9804 * script-sections.cc
9805 (Output_section_element_input::set_section_addresses): Call
9806 current_data_size and addralign methods of relaxed input sections.
9807 (Orphan_output_section::set_section_addresses): Call current_data_size
9808 and addralign methods of relaxed input sections.
9809 * symtab.cc (Symbol_table::compute_final_value): Extract template
9810 from the body of Symbol_table::sized_finalize_symbol.
9811 (Symbol_table::sized_finalized_symbol): Call
9812 Symbol_table::compute_final_value.
9813 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9814 (Symbol_table::compute_final_value): New templated method declaration.
9815 * target.cc (Target::do_make_output_section): New method defintion.
9816 * target.h (Target::make_output_section): New method declaration.
9817 (Target::relax): Add more parameters for input objects, symbol table
9818 and layout. Adjust call to do_relax.
9819 (Target::do_make_output_section): New method declaration.
9820 (Target::do_relax): Add parameters for input objects, symbol table
9821 and layout.
9822
9823 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9824
9825 * pread.c: Include stdio.h.
9826
9827 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9828
9829 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9830 defined.
9831
9832 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9833
9834 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9835 Change read_shndx type to unsigned int.
9836 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9837 int.
9838 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9839 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9840 Change read_shndx type to unsigned int.
9841 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9842 int.
9843 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9844 * layout.cc (Layout::create_symtab_sections): Cast the result of
9845 local_symcount * symsize to off_t in the gold_assert.
9846
9847 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9848
9849 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9850 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9851 R_ARM_BASE_ABS.
9852 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9853 (Arm_relocate_functions::thm_abs5): New function.
9854 (Arm_relocate_functions::abs12): New function.
9855 (Arm_relocate_functions::abs16): New function.
9856 (Arm_relocate_functions::base_abs): New function.
9857 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9858 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9859 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9860 R_ARM_BASE_ABS.
9861 (Scan::global): Likewise.
9862 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9863 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9864 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9865 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9866 R_ARM_BASE_ABS.
9867
9868 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9869
9870 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9871 (Arm_relocate_functions::movt_prel): New function.
9872 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9873 (Arm_relocate_functions::thm_movt_prel): New function.
9874 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9875 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9876 (Scan::global, Relocate::relocate): Likewise.
9877 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9878
9879 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9880
9881 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9882 Incremental_checker.
9883 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9884 unsigned int.
9885 (class Incremental_inputs_header): New class.
9886 (Incremental_inputs_header_writer): Edit comment.
9887 (Incremental_inputs_entry): New class.
9888 (Incremental_inputs_entry_writer): Edit comment.
9889 (Sized_incremental_binary::do_find_incremental_inputs_section):
9890 Add *strtab_shndx parameter, fill it.
9891 (Sized_incremental_binary::do_check_inputs): New method.
9892 (Incremental_checker::can_incrementally_link_output_file): Use
9893 Sized_incremental_binary::check_inputs.
9894 (Incremental_inputs::report_command_line): Save command line in
9895 command_line_.
9896 * incremental.h:
9897 (Incremental_binary::find_incremental_inputs_section): New
9898 method.
9899 (Incremental_binary::do_find_incremental_inputs_section): Add
9900 strtab_shndx parameter.
9901 (Incremental_binary::do_check_inputs): New pure virtual method.
9902 (Sized_incremental_binary::do_check_inputs): Declare.
9903 (Incremental_checker::Incremental_checker): Add incremental_inputs
9904 parameter, use it to initialize incremental_inputs_.
9905 (Incremental_checker::incremental_inputs_): New field.
9906 (Incremental_checker::command_line): New method.
9907 (Incremental_checker::inputs): New method.
9908 (Incremental_checker::command_line_): New field.
9909
9910 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9911
9912 * incremental.cc: Include <cstdarg> and "target-select.h".
9913 (vexplain_no_incremental): New function.
9914 (explain_no_incremental): New function.
9915 (Incremental_binary::error): New method.
9916 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9917 method.
9918 (make_sized_incremental_binary): New function.
9919 (open_incremental_binary): New function.
9920 (can_incrementally_link_file): Add checks if output is ELF and has
9921 inputs section.
9922 * incremental.h: Include "elfcpp_file.h" and "output.h".
9923 (Incremental_binary): New class.
9924 (Sized_incremental_binary): New class.
9925 (open_incremental_binary): Declare.
9926 * object.cc (is_elf_object): Use
9927 elfcpp::Elf_recognizer::is_elf_file.
9928 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9929 * output.h (Output_file::filesize): New method.
9930
9931 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9932
9933 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9934 New function.
9935 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9936 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9937 function.
9938 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9939 function.
9940 (Arm_relocate_functions::movw_abs_nc): New function.
9941 (Arm_relocate_functions::movt_abs): New function.
9942 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9943 (Arm_relocate_functions::thm_movt_abs): New function.
9944 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9945 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9946 (Scan::global): Likewise.
9947 (Relocate::relocate): Likewise.
9948 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9949
9950 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9951
9952 * arm.cc (Arm_relocate_functions::got_prel) New function.
9953 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9954 (Relocate::relocate): Likewise.
9955 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9956
9957 2009-10-06 Ian Lance Taylor <iant@google.com>
9958
9959 * options.h (class General_options): Define
9960 split_stack_adjust_size parameter.
9961 * object.h (class Object): Add uses_split_stack_ and
9962 has_no_split_stack_ fields. Add uses_split_stack and
9963 has_no_split_stack accessor functions. Declare
9964 handle_split_stack_section.
9965 (class Reloc_symbol_changes): Define.
9966 (class Sized_relobj): Define Function_offsets. Declare
9967 split_stack_adjust, split_stack_adjust_reltype, and
9968 find_functions.
9969 * object.cc (Object::handle_split_stack_section): New function.
9970 (Sized_relobj::do_layout): Call handle_split_stack_section.
9971 * dynobj.cc (Sized_dynobj::do_layout): Call
9972 handle_split_stack_section.
9973 * reloc.cc (Sized_relobj::relocate_sections): Call
9974 split_stack_adjust for executable sections in split_stack
9975 objects. Pass reloc_map to relocate_section.
9976 (Sized_relobj::split_stack_adjust): New function.
9977 (Sized_relobj::split_stack_adjust_reltype): New function.
9978 (Sized_relobj::find_functions): New function.
9979 * target-reloc.h: Include "object.h".
9980 (relocate_section): Add reloc_symbol_changes parameter. Change
9981 all callers.
9982 * target.h (class Target): Add calls_non_split method. Declare
9983 do_calls_non_split virtual method. Declare match_view and
9984 set_view_to_nop.
9985 * target.cc: Include "elfcpp.h".
9986 (Target::do_calls_non_split): New function.
9987 (Target::match_view): New function.
9988 (Target::set_view_to_nop): New function.
9989 * gold.cc (queue_middle_tasks): Give an error if mixing
9990 split-stack and non-split-stack objects with -r.
9991 * i386.cc (Target_i386::relocate_section): Add
9992 reloc_symbol_changes parameter.
9993 (Target_i386::do_calls_non_split): New function.
9994 * x86_64.cc (Target_x86_64::relocate_section): Add
9995 reloc_symbol_changes parameter.
9996 (Target_x86_64::do_calls_non_split): New function.
9997 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9998 parameter.
9999 * powerpc.cc (Target_powerpc::relocate_section): Add
10000 reloc_symbol_changes parameter.
10001 * sparc.cc (Target_sparc::relocate_section): Add
10002 reloc_symbol_changes parameter.
10003 * configure.ac: Call AM_CONDITIONAL for the default target.
10004 * configure: Rebuild.
10005 * testsuite/Makefile.am (TEST_AS): New variable.
10006 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10007 (check_DATA): Add split_i386 and split_x86_64 files.
10008 (SPLIT_DEFSYMS): Define.
10009 (split_i386_[1234n].o): New targets.
10010 (split_i386_[124]): New targets.
10011 (split_i386_[1234r].stdout): New targets.
10012 (split_x86_64_[1234n].o): New targets.
10013 (split_x86_64_[124]): New targets.
10014 (split_x86_64_[1234r].stdout): New targets.
10015 (MOSTLYCLEANFILES): Add new executables.
10016 * testsuite/split_i386.sh: New file.
10017 * testsuite/split_x86_64.sh: New file.
10018 * testsuite/split_i386_1.s: New file.
10019 * testsuite/split_i386_2.s: New file.
10020 * testsuite/split_i386_3.s: New file.
10021 * testsuite/split_i386_4.s: New file.
10022 * testsuite/split_i386_n.s: New file.
10023 * testsuite/split_x86_64_1.s: New file.
10024 * testsuite/split_x86_64_2.s: New file.
10025 * testsuite/split_x86_64_3.s: New file.
10026 * testsuite/split_x86_64_4.s: New file.
10027 * testsuite/split_x86_64_n.s: New file.
10028 * testsuite/testfile.cc (Target_test): Update relocation_section
10029 function.
10030 * testsuite/Makefile.in: Rebuild.
10031
10032 2009-10-06 Ian Lance Taylor <iant@google.com>
10033
10034 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10035 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10036 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10037 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10038 the address on ldo_addrs_.
10039 (Target_i386::Relocate::fix_up_ldo): New function.
10040
10041 2009-10-06 Rafael Espindola <espindola@google.com>
10042
10043 * plugin.cc (add_input_library): New.
10044 (Plugin::load): Add add_input_library to tv.
10045 (Plugin_manager::add_input_file): Add the is_lib argument.
10046 (add_input_file): Update call to Plugin_manager::add_input_file.
10047 (add_input_library): New.
10048 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10049
10050 2009-09-30 Doug Kwan <dougkwan@google.com>
10051
10052 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10053 symbol and call Symbol::may_need_copy_reloc to determine if
10054 a copy reloc is needed.
10055 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10056 nocopyreloc is given in command line.
10057 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10058 given in command line.
10059 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10060 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10061 of the removed Target_i386::may_need_copy_reloc.
10062 * options.h (copyreloc): New option with default value false.
10063 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10064 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10065 instead of the removed Target_powerpc::may_need_copy_reloc.
10066 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10067 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10068 instead of the removed Target_sparc::may_need_copy_reloc.
10069 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10070 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10071 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10072 instead of the removed Target_x86_64::may_need_copy_reloc.
10073
10074 2009-09-30 Ian Lance Taylor <iant@google.com>
10075
10076 * object.h (class Object): Remove target_ field, and target,
10077 sized_target, and set_target methods.
10078 (Object::sized_target): Remove.
10079 (class Sized_relobj): Update declarations. Remove sized_target.
10080 * object.cc (Sized_relobj::setup): Remove target parameter.
10081 Change all callers.
10082 (Input_objects::add_object): Don't do anything with the target.
10083 (make_elf_sized_object): Add punconfigured parameter. Change all
10084 callers. Set or test parameter target.
10085 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10086 Change all callers.
10087 * parameters.cc (Parameters::set_target): Change parameter type to
10088 be non-const.
10089 (Parameters::default_target): Remove.
10090 (set_parameters_target): Change parameter type to be non-const.
10091 (parameters_force_valid_target): New function.
10092 (parameters_clear_target): New function.
10093 * parameters.h (class Parameters): Update declarations. Remove
10094 default_target method. Add sized_target and clear_target
10095 methods. Change target_ to be non-const.
10096 (set_parameters_target): Update declaration.
10097 (parameters_force_valid_target): Declare.
10098 (parameters_clear_target): Declare.
10099 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10100 as NULL if we aren't searching.
10101 (Add_symbols::run): Don't check for compatible target.
10102 * fileread.cc (Input_file::open_binary): Call
10103 parameters_force_valid_target.
10104 * gold.cc (queue_middle_tasks): Likewise.
10105 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10106 set_target on object.
10107 * dynobj.h (class Sized_dynobj): Update declarations.
10108 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10109 make_elf_object returns NULL.
10110 (Archive::include_member): Don't check whether object target is
10111 compatible.
10112 * output.cc (Output_section::add_input_section): Get target from
10113 parameters.
10114 (Output_section::relax_input_section): Likewise.
10115 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10116 parameters.
10117 (Sized_relobj::do_scan_relocs): Likewise.
10118 (Sized_relobj::relocate_sections): Likewise.
10119 * resolve.cc (Symbol_table::resolve): Likewise.
10120 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10121 parameter. Change all callers.
10122 (Symbol_table::add_from_object): Get target from parameters.
10123 (Symbol_table::add_from_relobj): Don't check object target.
10124 (Symbol_table::add_from_dynobj): Likewise.
10125 (Symbol_table::define_special_symbol): Get target from
10126 parameters.
10127 * symtab.h (class Symbol_table): Update declaration.
10128 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10129 parameter. Change all callers. Clear parameter target.
10130 (Binary_test): Test target here.
10131 * testsuite/object_unittest.cc (gold_testsuite): Remove
10132 target_test_pointer parameter. Change all callers.
10133 (Object_test): Test target here.
10134
10135 2009-09-26 Ian Lance Taylor <iant@google.com>
10136
10137 * testsuite/initpri1.c: Don't try to use constructor priorities if
10138 compiling with gcc before 4.3.
10139
10140 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10141
10142 * testsuite/retain_symbols_file_test.sh (check_present): Change
10143 output file name to retain_symbols_file_test.stdout.
10144 (check_absent): Likewise.
10145
10146 2009-09-18 Craig Silverstein <csilvers@google.com>
10147
10148 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10149 * options.cc: Include <cerrno> and <fstream>.
10150 (General_options::finalize): Parse -retain-symbols-file tag.
10151 * options.h: New flag.
10152 (General_options): New method should_retain_symbol, new
10153 variable symbols_to_retain.
10154 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10155 should_retain_symbol map.
10156 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10157 * testsuite/Makefile.in: Regenerate.
10158 * testsuite/retain_symbols_file_test.sh: New file.
10159
10160 2009-09-18 Nick Clifton <nickc@redhat.com>
10161
10162 * po/es.po: Updated Spanish translation.
10163
10164 2009-09-17 Doug Kwan <dougkwan@google.com>
10165
10166 * debug.h (DEBUG_RELAXATION): New constant.
10167 (DEBUG_ALL): Add DEBUG_RELAXATION.
10168 (debug_string_to_enum): Add relaxation debug option.
10169 * layout.cc
10170 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10171 Layout::Relaxation_debug_check::read_sections,
10172 Layout::Relaxation_debug_check::read_sections): New method definitions.
10173 (Layout::Layout): Initialize data members
10174 record_output_section_data_from_scrips_,
10175 script_output_section_data_list_ and relaxation_debug_check_.
10176 (Layout::save_segments, Layout::restore_segments,
10177 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10178 Layout::relaxation_loop_body): New method definitions.
10179 (Layout::finalize): Support relaxation. Move section layout code to
10180 Layout::relaxation_loop_body.
10181 (Layout::set_asection_address_from_script): Move code for orphan
10182 section placement out.
10183 (Layout::place_orphan_sections_in_script): New method definition.
10184 * layout.h (Output_segment_headers, Output_file_header):
10185 New forward class declarations.
10186 (Layout::~Layout): Define.
10187 (Layout::new_output_section_data_from_script): New method definition.
10188 (Layout::place_orphan_sections_in_script): New method declaration.
10189 (Layout::Segment_states): New type declaration.
10190 (Layout::save_segments, Layout::restore_segments,
10191 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10192 Layout::relaxation_loop_body): New method declarations.
10193 (Layout::Output_section_data_list): New type declaration.
10194 (Layout::Relaxation_debug_check): New class definition.
10195 (Layout::record_output_section_data_from_script_,
10196 Layout::script_output_section_data_list_, Layout::segment_states_,
10197 Layout::relaxation_debug_check_): New data members.
10198 * output.cc: (Output_section_headers::do_size): New method definition.
10199 (Output_section_headers::Output_section_headers): Move size
10200 computation to Output_section_headers::do_size.
10201 (Output_segment_headers::do_size): New method definition.
10202 (Output_file_header::Output_file_header): Move size computation to
10203 Output_file_header::do_size and call it.
10204 (Output_file_header::do_size): New method definition.
10205 (Output_data_group::Output_data_group): Adjust call to
10206 Output_section_data.
10207 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10208 (Output_symtab_xindex::do_write): Add array bound check.
10209 (Output_section::Input_section::print_to_mapfile): Handle
10210 RELAXED_INPUT_SECTION_CODE.
10211 (Output_section::Output_section): Initialize data member checkpoint_.
10212 (Output_section::~Output_section): Delete checkpoint object pointed
10213 by checkpoint_.
10214 (Output_section::add_input_section): Always add an Input_section if
10215 relaxing.
10216 (Output_section::add_merge_input_section): Add assert.
10217 (Output_section::relax_input_section): New method definition.
10218 (Output_section::set_final_data_size): Set load address to zero for
10219 an unallocated section.
10220 (Output_section::do_address_and_file_offset_have_reset_values):
10221 New method definition.
10222 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10223 Handle relaxed input section.
10224 (Output_section::sort_attached_input_sections): Checkpoint input
10225 section list lazily.
10226 (Output_section::get_input_sections): Change type of input_sections to
10227 list of Simple_input_section pointers. Checkpoint input section list
10228 lazily. Also handle relaxed input sections.
10229 (Output_section::add_input_section_for_script): Take a reference to
10230 a Simple_input_section object instead of Relobj pointer and section
10231 index as parameter. Handle relaxed input sections.
10232 (Output_section::save_states, Output_section::restore_states): New
10233 method definitions.
10234 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10235 (Output_data::is_data_size_fixed): New method definition.
10236 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10237 if it is fixed.
10238 (Output_data::address_and_file_offset_have_reset_values): New method
10239 definition.
10240 (Output_data::do_address_and_file_offset_have_reset_values): New method
10241 definition.
10242 (Output_data::set_data_size): Check that data size is not fixed.
10243 (Output_data::fix_data_size): New method definition.
10244 (Output_data::is_data_size_fixed_): New data member.
10245 (Output_section_headers::set_final_data_size): New method definition.
10246 (Output_section_headers::do_size): New method declaration.
10247 (Output_segment_headers::set_final_data_size): New method definition.
10248 (Output_segment_headers::do_size): New method declaration.
10249 (Output_file_header::set_final_data_size)::New method definition.
10250 (Output_file_header::do_size)::New method declaration.
10251 (Output_section_data::Output_section_data): Add new parameter
10252 is_data_size_fixed and use it to fix data size.
10253 (Output_data_const::Output_data_const): Adjust call to base class
10254 constructor and fix data size.
10255 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10256 base class constructor and fix data size.
10257 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10258 base class constructor and fix data size.
10259 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10260 class constructor and fix data size.
10261 (Output_data_group::set_final_data_size): New method definition.
10262 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10263 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10264 class constructor and fix data size.
10265 (Output_relaxed_input_section): New class definition.
10266 (Output_section::Simple_input_section): New class definition.
10267 (Output_section::get_input_sections): Adjust parameter list.
10268 (Output_section::add_input_section_for_script): Same.
10269 (Output_section::save_states, Output_section::restore_states,
10270 Output_section::do_address_and_file_offset_have_reset_values,
10271 (Output_section::Input_section::Input_section): Handle
10272 RELAXED_INPUT_SECTION_CODE. Add new overload for
10273 Output_relaxed_input_section.
10274 (Output_section::Input_section::is_input_section,
10275 Output_section::Input_section::set_output_section): Handle relaxed
10276 input section.
10277 (Output_section::Input_section::is_relaxed_input_section,
10278 Output_section::Input_section::output_section_data,
10279 Output_section::Input_section::relaxed_input_section): New method
10280 definitions.
10281 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10282 value.
10283 (Output_section::Input_section::u1_): Update comments.
10284 (Output_section::Input_section::u2_): Add new union member poris.
10285 (Output_section::Checkpoint_output_section): New classs definition.
10286 (Output_section::relax_input_section): New method declaration.
10287 (Output_section::checkpoint_): New data member.
10288 (Output_segment): Update comments.
10289 (Output_segment::Output_segment): Un-privatize copy constructor.
10290 (Output_segment::operator=): Un-privatize.
10291 * script-sections.cc (Output_section_element::Input_section_list):
10292 Change element type to Output_section::Simple_input_section.
10293 (Output_section_element_dot_assignment::set_section_addresses):
10294 Register output section data for relaxation clean up.
10295 (Output_data_exression::Output_data_expression): Adjust call to base
10296 constructor to fix data size.
10297 (Output_section_element_data::set_section_addresses): Register
10298 Output_data_expression object for relaxation clean up.
10299 (struct Input_section_info): Replace Relobj pointer and section index
10300 pair with Output_section::Simple_input_section and Convert struct to a
10301 class.
10302 (Input_section_sorter::operator()): Adjust access to
10303 Input_section_info data member to use accessors.
10304 (Output_section_element_input::set_section_addresses): Use layout
10305 parameter. Adjust code to use Output_section::Simple_input_section
10306 and Input_secction_info classes. Register filler for relaxation
10307 clean up.
10308 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10309 and section index pair with Output_section::Simple_input_section
10310 class. Adjust code accordingly.
10311 (Phdrs_element::release_segment): New method definition.
10312 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10313 segment list.
10314 (Script_sections::release_segments): New method definition.
10315 * gold/script-sections.h (Script_sections::release_segments): New
10316 method declaration.
10317 * gold/target.h (Target::may_relax, Target::relax,
10318 Target::do_may_relax, Target::do_relax): New method definitions.
10319
10320 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10321
10322 * arm.cc (has_signed_unsigned_overflow): New function.
10323 (Arm_relocate_functions::abs8): New function.
10324 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10325 (Target_arm::Scan::global): Likewise.
10326 (Target_arm::relocate::relocate): Likewise.
10327 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10328 Likewise.
10329
10330 2009-09-16 Cary Coutant <ccoutant@google.com>
10331
10332 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10333 * testsuite/Makefile.in: Regenerate.
10334
10335 2009-09-11 Nick Clifton <nickc@redhat.com>
10336
10337 * po/gold.pot: Updated by the Translation project.
10338
10339 2009-09-08 Cary Coutant <ccoutant@google.com>
10340
10341 * output.cc (Output_file::open): Add execute permission to empty file.
10342 * testsuite/Makefile.am (permission_test): New test.
10343 * testsuite/Makefile.in: Regenerate.
10344
10345 2009-09-02 Ian Lance Taylor <iant@google.com>
10346
10347 * output.cc (Output_file::resize): Call map_no_anonymous rather
10348 than map.
10349
10350 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10351
10352 * gold.cc: Include "incremental.h".
10353 (queue_initial_tasks): Call Incremental_checker methods.
10354 * incremental.cc: Include "output.h".
10355 (Incremental_checker::can_incrementally_link_output_file): New
10356 method.
10357 * incremental.h (Incremental_checker): New class.
10358
10359 * output.cc (Output_file::open_for_modification): New method.
10360 (Output_file::map_anonymous): Changed return type to bool. Record
10361 map in base_ field.
10362 (Output_file::map_no_anonymous): New method, broken out of map.
10363 (Output_file::map): Use map_no_anonymous and map_anonymous.
10364 * output.h (class Output_file): Update declarations.
10365
10366 2009-08-24 Cary Coutant <ccoutant@google.com>
10367
10368 * options.h (Command_line::Pre_options): New class.
10369 (Command_line::pre_options): New member.
10370 * options.cc (gold::options::ready_to_register): New variable.
10371 (One_option::register_option): Do nothing if not registering options.
10372 Assert if same short option registered twice.
10373 (General_options::General_options): Turn off option registration when
10374 done constructing.
10375 (Command_line::Pre_options::Pre_options): New constructor.
10376
10377 2009-08-24 Cary Coutant <ccoutant@google.com>
10378
10379 * options.h (General_options::no_keep_memory): Remove incorrect
10380 short option.
10381
10382 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10383
10384 * Makefile.am (am__skiplex, am__skipyacc): New.
10385 * Makefile.in: Regenerate.
10386
10387 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10388
10389 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10390 (INCLUDES): ... this.
10391 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10392 (AM_CPPFLAGS): Renamed from ...
10393 (INCLUDE): ... this.
10394 * Makefile.in, testsuite/Makefile.in: Regenerate.
10395
10396 * Makefile.in: Regenerate.
10397 * aclocal.m4: Likewise.
10398 * config.in: Likewise.
10399 * configure: Likewise.
10400 * testsuite/Makefile.in: Likewise.
10401
10402 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10403 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10404 * Makefile.in: Regenerate.
10405 * testsuite/Makefile.in: Regenerate.
10406
10407 2009-08-19 Cary Coutant <ccoutant@google.com>
10408
10409 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10410 symbols in shared libraries overridden by hidden or internal symbols
10411 in the main program.
10412
10413 2009-08-19 Chris Demetriou <cgd@google.com>
10414
10415 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10416 checking source file names in error messages.
10417
10418 2009-08-18 Doug Kwan <dougkwan@google.com>
10419
10420 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10421 an elcpp::Ehdr as parameter. Adjust call to set_target.
10422 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10423 an elfcpp::Ehdr as parameter.
10424 * object.cc (Object::set_target): Remove the version that looks up
10425 a target and sets it.
10426 (Sized_relobj::setup): Take a Target object instead of
10427 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10428 (make_elf_sized_object): Find target and ask target to
10429 make an ELF object.
10430 * object.h: (Object::set_target): Remove the version that looks up
10431 a target and sets it.
10432 (Sized_relobj::setup): Take a Target object instead of
10433 an elfcpp:Ehdr as parameter.
10434 * target.cc: Include dynobj.h.
10435 (Target::do_make_elf_object_implementation): New.
10436 (Target::do_make_elf_object): New.
10437 * target.h (Target::make_elf_object): New template declaration.
10438 (Target::do_make_elf_object): New method declarations.
10439 (Target::do_make_elf_object_implementation): New template declaration.
10440
10441 2009-08-14 Ian Lance Taylor <iant@google.com>
10442
10443 * gold.h (FUNCTION_NAME): Define.
10444 (gold_unreachable): Use FUNCTION_NAME.
10445
10446 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10447
10448 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10449 symbol in the --keep-unique list is not found.
10450
10451 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10452
10453 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10454 been maked as --keep-unique.
10455 (Icf::unfold_section): New function.
10456 * icf.h (Icf::unfold_section): New function.
10457 * options.h (General_options::keep_unique): New option.
10458 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10459 * testsuite/Makefile.in: Regenerate.
10460 * testsuite/icf_keep_unique_test.sh: New file.
10461 * testsuite/icf_keep_unique_test.cc: New file.
10462
10463 2009-08-12 Cary Coutant <ccoutant@google.com>
10464
10465 PR 10471
10466 * resolve.cc (Symbol_table::resolve): Check for references from
10467 dynamic objects to hidden and internal symbols.
10468 * testsuite/Makefile.am (hidden_test.sh): New test.
10469 * testsuite/Makefile.in: Regenerate.
10470 * testsuite/hidden_test.sh: New script.
10471 * testsuite/hidden_test_1.c: New test source.
10472 * testsuite/hidden_test_main.c: New test source.
10473
10474 2009-08-11 Doug Kwan <dougkwan@google.com>
10475
10476 * arm.cc: Update comments.
10477 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10478 segment to locate the .ARM.exidx section if present.
10479
10480 2009-08-09 Doug Kwan <dougkwan@google.com>
10481
10482 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10483 patch.
10484
10485 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10486 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10487 compiler warnings.
10488
10489 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10490
10491 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10492 valid tls_segment only for non-debug-section relocations.
10493 * testsuite/Makefile.am: Add gc_tls_test.
10494 * testsuite/Makefile.in: Regenerate.
10495 * testsuite/gc_tls_test.cc: New file.
10496 * testsuite/gc_tls_test.sh: New file.
10497
10498 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10499
10500 * icf.cc: New file.
10501 * icf.h: New file.
10502 * Makefile.am (CCFILES): Add icf.cc.
10503 (HFILES): Add icf.h
10504 * Makefile.in: Regenerate.
10505 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10506 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10507 section, symbol and addend information for the relocs.
10508 * gold.cc (queue_middle_tasks): Call identical code folding.
10509 * gold.h: Add defines for multimap.
10510 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10511 to the call of finalize_local_symbols.
10512 * main.cc (main): Create object of class Icf.
10513 * object.cc (Sized_relobj::do_layout): Allow this function to be
10514 called twice during icf.
10515 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10516 to sections marked as identical by icf.
10517 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10518 when available.
10519 (Sized_relobj::do_section_entsize): New function.
10520 * object.h (Object::section_entsize): New function.
10521 (Object::do_section_entsize): New pure virtual function.
10522 (Relobj::finalize_local_symbols): Add new parameter.
10523 (Relobj::do_section_entsize): New function.
10524 * options.h (General_options::icf): New option.
10525 (General_options::icf_iterations): New option.
10526 (General_options::print_icf_sections): New option.
10527 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10528 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10529 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10530 icf.
10531 * symtab.cc (Symbol_table::is_section_folded): New function.
10532 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10533 to sections marked as identical by icf.
10534 * symtab.h (Symbol_table::set_icf): New function.
10535 (Symbol_table::icf): New function.
10536 (Symbol_table::is_section_folded): New function.
10537 (Symbol_table::icf_): New data member.
10538 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10539 * testsuite/Makefile.am: Add commands to build icf_test.
10540 * testsuite/Makefile.in: Regenerate.
10541 * testsuite/icf_test.sh: New file.
10542 * testsuite/icf_test.cc: New file.
10543
10544 2009-07-24 Chris Demetriou <cgd@google.com>
10545
10546 * layout.cc (is_compressible_debug_section): Fix incorrect
10547 comment about compressed section names.
10548
10549 2009-07-20 Ian Lance Taylor <ian@airs.com>
10550
10551 PR 10419
10552 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10553
10554 2009-07-16 Ian Lance Taylor <iant@google.com>
10555
10556 PR 10400
10557 * layout.h: #include <map>.
10558 (class Kept_section): Change from struct to class. Add accessors
10559 and setters. Add section size to Comdat_group mapping. Change
10560 Comdat_group to std::map. Add is_comdat_ field. Add
10561 linkonce_size field in union.
10562 (class Layout): Update declaration of find_or_add_kept_section.
10563 Don't declare find_kept_object.
10564 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10565 parameter. Add object, shndx, is_comdat, and is_group_name
10566 parameters. Change all callers. Adjust for new Kept_section.
10567 (Layout::find_kept_object): Remove.
10568 * object.cc (Sized_relobj::include_section_group): Update use of
10569 Kept_section. Rename secnum to shndx. Only record
10570 Kept_comdat_section if sections are the same size.
10571 (Sized_relobj::include_linkonce_section): Update use of
10572 Kept_section. Only record Kept_comdat_section if sections are the
10573 same size. Set size of linkonce section.
10574 (Sized_relobj::map_to_kept_section): Update call to
10575 get_kept_comdat_section.
10576 * object.h (class Sized_relobj): Rename fields in
10577 Kept_comdat_section to drop trailing underscores; change object
10578 field to Relobj*. Change Kept_comdat_section_table to store
10579 struct rather than pointer.
10580 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10581 Add kept_object and kept_shndx parameters. Change all callers.
10582 (Sized_relobj::get_kept_comdat_section): Change return type to
10583 bool. Add kept_object and kept_shndx parameters. Change all
10584 callers.
10585 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10586 Layout::find_or_add_kept_section.
10587
10588 2009-07-09 Ian Lance Taylor <iant@google.com>
10589
10590 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10591 Reserve space in the hash table.
10592
10593 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10594
10595 * fileread.cc (File_read::get_mtime): New method.
10596 * fileread.h (Timespec): New structure.
10597 (File_read::get_mtime): New method.
10598 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10599 Renamed from timestamp_nsec.
10600 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10601 Elf_Xword.
10602 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10603 timestamp_nsec.
10604 (Incremental_inputs::report_archive): Save mtime; style fix.
10605 (Incremental_inputs::report_obejct): Save mtime; style fix.
10606 (Incremental_inputs::report_script): Save mtime; style fix.
10607 (Incremental_inputs::finalize_inputs): Style fix.
10608 (Incremental_inputs::finalize): Style fix.
10609 (Incremental_inputs::create_input_section_data): Store inputs
10610 mtime.
10611 * incremental.h (Incremental_inputs::report_script): Add mtime
10612 argument.
10613 (Incremental_inputs::Input_info::Input_info): Intialize only one
10614 union member.
10615 (Incremental_inputs::Input_info::archive): Move to nameless
10616 union.
10617 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10618 (Incremental_inputs::Input_info::script): Move to nameless union.
10619 (Incremental_inputs::mtime): New field.
10620 * script.cc (read_input_script): Pass file mtime to
10621 Incremental_input.
10622 * script.h (Script_info::inputs): Style fix.
10623
10624 2009-07-01 Ian Lance Taylor <ian@airs.com>
10625
10626 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10627 instead of 32.
10628
10629 2009-06-24 Ian Lance Taylor <iant@google.com>
10630
10631 PR 10156
10632 * layout.cc (Layout::choose_output_section): If we find an
10633 existing section, update the flags.
10634 (Layout::create_notes): New function, broken out of
10635 Layout::finalize.
10636 (Layout::finalize): Don't create note sections.
10637 (Layout::create_note): Don't crash if linker script discards
10638 section.
10639 (Layout::create_gold_note): Likewise.
10640 (Layout::create_build_id): Likewise. Don't set
10641 after_input_sections on the section.
10642 (Layout::create_executable_stack_info): Remove target parameter.
10643 Change caller.
10644 * layout.h (class Layout): Declare create_notes. Update
10645 declaration of create_executable_stack_info.
10646 * gold.cc (queue_middle_tasks): Call create_notes.
10647 * output.cc (Output_section::update_flags_for_input_section): Move
10648 here from output.h. If SHF_ALLOC flag is newly set, mark address
10649 invalid.
10650 * output.h (Output_data::mark_address_invalid): New function.
10651 (class Output_section): Only declare, not define,
10652 update_flags_for_input_section. Remove set_flags.
10653
10654 2009-06-24 Ian Lance Taylor <iant@google.com>
10655
10656 * script-sections.cc (Output_section_definition::
10657 set_section_addresses): Rename shadowing local load_address to
10658 laddr.
10659
10660 2009-06-24 Ian Lance Taylor <iant@google.com>
10661
10662 PR 10244
10663 * reloc.cc (relocate_sections): Skip empty relocation sections.
10664
10665 2009-06-23 Ian Lance Taylor <iant@google.com>
10666
10667 PR 10156
10668 * layout.cc (Layout::create_note): Use choose_output_section
10669 rather than make_output_section.
10670
10671 2009-06-23 Ian Lance Taylor <iant@google.com>
10672
10673 PR 10237
10674 * options.cc (General_options::parse_V): Set printed_version_.
10675 (General_options::General_options): Initialize printed_version_.
10676 * options.h (class General_options): Add printed_version_ field.
10677 * gold.cc (queue_initial_tasks): If there are no input files,
10678 don't give a fatal error if we printed the version information.
10679 (queue_middle_tasks): If using -r with a shared object, give a
10680 fatal error rather than an ordinary error.
10681
10682 2009-06-23 Ian Lance Taylor <iant@google.com>
10683
10684 PR 10219
10685 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10686 (Layout::make_output_section): Set have_stabstr_section_ if we see
10687 a .stab*str section.
10688 (Layout::finalize): Call link_stabs_sections.
10689 (Layout::link_stabs_sections): New file.
10690 * layout.h (class Layout): Add have_stabstr_section_ field.
10691 Declare link_stabs_sections.
10692
10693 2009-06-23 Doug Kwan <dougkwan@google.com>
10694
10695 * Makefile.am (libgold_a_LIBADD): New.
10696 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10697 * Makefile.in: Regenerate.
10698 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10699 * configure: Regenerate.
10700 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10701 * fileread.cc: Include sys/state.h
10702 * gold.h: Declare memmem and strndup if found missing.
10703 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10704
10705 2009-06-23 Ian Lance Taylor <iant@google.com>
10706
10707 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10708 * configure: Rebuild.
10709
10710 2009-06-23 Ian Lance Taylor <iant@google.com>
10711
10712 PR 10147
10713 * object.cc (Object::section_contents): Don't try to get a view if
10714 the section has length zero.
10715 (Object::handle_gnu_warning_section): If the section is empty, use
10716 the name of the section as the warning.
10717
10718 2009-06-23 Ian Lance Taylor <iant@google.com>
10719
10720 PR 10133
10721 * stringpool.h (class Stringpool_template): Add optimize_ field.
10722 (Stringpool_template::set_optimize): New function.
10723 * stringpool.cc (Stringpool_template::Stringpool_template):
10724 Initialize optimize_ field.
10725 (Stringpool_template::set_string_offsets): Test local optimize
10726 fild rather than parameter.
10727 * layout.cc (Layout::Layout): Call set_optimize on the section
10728 name stringpool.
10729
10730 2009-06-22 Ian Lance Taylor <iant@google.com>
10731
10732 PR 10030
10733 * yyscript.y: Parse TARGET.
10734 * script.cc (script_set_target): New function.
10735 * script-c.h (script_set_target): Declare.
10736 * options.cc (General_options::string_to_object_format): Rename
10737 from string_to_object_format in anonymous namespace. Change
10738 callers.
10739 * options.h (class General_options): Declare
10740 string_to_object_format.
10741
10742 2009-06-22 Ian Lance Taylor <iant@google.com>
10743
10744 * script-sections.cc (Script_sections::create_segments): Don't put
10745 program headers in a PT_LOAD segment if -n or -N.
10746
10747 2009-06-22 Ian Lance Taylor <iant@google.com>
10748
10749 PR 10141
10750 * options.h (class General_options): Add -z lazy and -z now. Sort
10751 -z options into alphabetical order.
10752 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10753
10754 2009-06-21 Ian Lance Taylor <iant@google.com>
10755
10756 * layout.cc (Layout::make_output_section): Call
10757 Target::new_output_section.
10758 (Layout::attach_allocated_section_to_segment): Put large section
10759 sections in a separate load segment with the large segment flag
10760 set.
10761 (Layout::segment_precedes): Sort large data segments after other
10762 load segments.
10763 (align_file_offset): New static function.
10764 (Layout::set_segment_offsets): Use align_file_offset.
10765 * output.h (class Output_section): Add is_small_section_ and
10766 is_large_section_ fields.
10767 (Output_section::is_small_section): New function.
10768 (Output_section::set_is_small_section): New function.
10769 (Output_section::is_large_section): New function.
10770 (Output_section::set_is_large_section): New function.
10771 (Output_section::is_large_data_section): New function.
10772 (class Output_segment): Add is_large_data_segment_ field.
10773 (Output_segment::is_large_data_segment): New function.
10774 (Output_segment::set_is_large_data_segment): New function.
10775 * output.cc (Output_section::Output_section): Initialize new
10776 fields.
10777 (Output_segment::Output_segment): Likewise.
10778 (Output_segment::add_output_section): Add assertion that large
10779 data sections always go in large data segments. Force small data
10780 sections to the end of the list of data sections. Force small BSS
10781 sections to the start of the list of BSS sections. For large BSS
10782 sections to the end of the list of BSS sections.
10783 * symtab.h (class Symbol): Declare is_common_shndx.
10784 (Symbol::is_defined): Check Symbol::is_common_shndx.
10785 (Symbol::is_common): Likewise.
10786 (class Symbol_table): Define enum Commons_section_type. Update
10787 declarations. Add small_commons_ and large_commons_ fields.
10788 * symtab.cc (Symbol::is_common_shndx): New function.
10789 (Symbol_table::Symbol_table): Initialize new fields.
10790 (Symbol_table::add_from_object): Put small and large common
10791 symbols in the right list.
10792 (Symbol_table::sized_finalized_symbol): Check
10793 Symbol::is_common_shndx.
10794 (Symbol_table::sized_write_globals): Likewise.
10795 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10796 common symbol lists. Don't call do_allocate_commons_list if the
10797 list is empty.
10798 (Symbol_table::do_allocate_commons_list): Remove is_tls
10799 parameter. Add comons_section_type parameter. Change all
10800 callers. Handle small and large common symbols.
10801 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10802 Symbol::is_common_shndx.
10803 * resolve.cc (symbol_to_bits): Likewise.
10804 * target.h (Target::small_common_shndx): New function.
10805 (Target::small_common_section_flags): New function.
10806 (Target::large_common_shndx): New function.
10807 (Target::large_common_section_flags): New function.
10808 (Target::new_output_section): New function.
10809 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10810 small_common_section_flags, and large_common_section_flags
10811 fields.
10812 (Target::do_new_output_section): New virtual function.
10813 * arm.cc (Target_arm::arm_info): Initialize new fields.
10814 * i386.cc (Target_i386::i386_info): Likewise.
10815 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10816 Likewise.
10817 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10818 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10819 (Target_x86_64::do_new_output_section): New function.
10820 * configure.ac: Define conditional MCMODEL_MEDIUM.
10821 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10822 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10823 (large_LDFLAGS): Define.
10824 * testsuite/large.c: New file.
10825 * testsuite/testfile.cc (Target_test::test_target_info):
10826 Initialize new fields.
10827 * configure, testsuite/Makefile.in: Rebuild.
10828
10829 2009-06-05 Doug Kwan <dougkwan@google.com>
10830
10831 * Makefile.am (CCFILES): Add target.cc.
10832 * Makefile.in: Regenerate.
10833 * i386.cc (class Target_i386): Define new virtual method to
10834 override do_is_local_label_name in parent.
10835 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10836 local symbols if --discard-locals or -X is given.
10837 * options.h (class General_options): Declare new options
10838 '--discard-locals' and '-X' for discarding locals.
10839 * target.h (class Target): Define new methods is_local_label_name.
10840 Declare new virtual method do_is_local_label_name.
10841 * target.cc: New file.
10842 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10843 (check_SCRIPTS): Add discard_locals_test.sh.
10844 (check_DATA): Add discard_local_tests.syms.
10845 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10846 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10847 * testsuite/Makefile.in: Regenerate.
10848 * testsuite/discard_locals_test.c: New file.
10849 * testsuite/discard_locals_test.sh: Same.
10850
10851 2009-06-05 Doug Kwan <dougkwan@google.com>
10852
10853 * object.cc (Sized_relobj::Sized_relobj): Initialize
10854 discarded_eh_frame_shndx_ to -1U.
10855 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10856 section.
10857 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10858 a discarded .eh_frame section.
10859 (Sized_relobj::do_finalize_local_symbols): Ditto.
10860 * object.h (class Sized_relobj): Declare new member
10861 discarded_eh_frame_shndx_.
10862 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10863 (local_labels_test.o, local_labels_test): New rules.
10864 * testsuite/Makefile.in: Regenerate.
10865
10866 2009-06-04 Doug Kwan <dougkwan@google.com>
10867
10868 * layout.cc (Layout::section_name_mapping): Add mapping for
10869 special ARM sections.
10870
10871 2009-06-03 Doug Kwan <dougkwan@google.com>
10872
10873 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10874 (utils::has_overflow): Same.
10875
10876 2009-06-03 Ian Lance Taylor <iant@google.com>
10877
10878 * layout.cc (Layout::section_name_mapping): New array, replacing
10879 Layout::linkonce_mapping.
10880 (Layout::section_name_mapping_count): New variable, replacing
10881 Layout::linkonce_mapping_count.
10882 (Layout::linkonce_output_name): Remove.
10883 (Layout::output_section_name): Rewrite.
10884 * layout.h (class Layout): Rename Linkonce_mapping to
10885 Section_name_mapping, linkonce_mapping to section_name_mapping,
10886 linkonce_mapping_count to section_name_mapping_count. Don't
10887 declare linkonce_output_name.
10888
10889 2009-06-03 Doug Kwan <dougkwan@google.com>
10890
10891 * gold/arm.cc (namespace utils): New.
10892 (Target_arm::reloc_is_non_pic): Define new method.
10893 (class Arm_relocate_functions): New.
10894 (Target_arm::Relocate::relocate): Handle relocation types used by
10895 Android.
10896
10897 2009-06-03 Ian Lance Taylor <iant@google.com>
10898
10899 * arm.cc (Target_arm::scan::global): Use || instead of |.
10900
10901 2009-06-02 Doug Kwan <dougkwan@google.com>
10902
10903 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10904 issued_non_pic_error_.
10905 (class Target_arm::Scan): Declare new method check_non_pic.
10906 Define new method symbol_needs_plt_entry.
10907 Declare new data member issued_non_pic_error_.
10908 (class Target_arm::Relocate): Declare new method
10909 should_apply_static_reloc.
10910 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10911 (Target_arm::Scan::check_non_pic): Define new method.
10912 (Target_arm::Scan::local): Handle a small subset of reloc types used
10913 by Android.
10914 (Target_arm::Scan::local): Same.
10915 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10916
10917 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10918
10919 * incremental.cc (Incremental_inputs::report_command_line): Filter
10920 out --incremental-* options.
10921
10922 2009-05-29 Doug Kwan <dougkwan@google.com>
10923
10924 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10925 template class.
10926 (class Target_arm): Update comment.
10927 (Target_arm::Target_arm): Initialize new data members GOT_,
10928 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10929 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10930 and Target_arm::rel_dyn_section.
10931 Declare new_enum Target_arm::Got_type.
10932 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10933 and DYNBSS_.
10934 Update commments for member do_dynsym_value.
10935 (Target_arm::got_size, Target_arm::plt_section,
10936 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10937 new methods inside class defintion.
10938 (Target_arm::got_section): Define new method.
10939 (Target_arm::rel_dyn_section): Same.
10940 (Output_data_plt_arm): New template class.
10941 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10942 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10943 (Output_data_plt_arm::add_entry): Same.
10944 (Output_data_plt_arm::first_plt_entry): Define new
10945 static data member for PLT instruction template.
10946 (Output_data_plt_arm::plt_entry): Same.
10947 (Output_data_plt_arm::do_write): Define new method.
10948 (Target_arm::make_plt_entry): Same.
10949 (Target_arm::do_finalize_sections): Same.
10950 (Target_arm::do_dynsym_value): Same.
10951
10952 2009-05-28 Doug Kwan <dougkwan@google.com>
10953
10954 * Makefile.am (TARGETSOURCES): Add arm.cc.
10955 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10956 * Makefile.in: Regenerate.
10957 * arm.cc: New file.
10958 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10959
10960 2009-05-26 Doug Kwan <dougkwan@google.com>
10961
10962 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10963 (General_options::check_excluded_libs): Strip off directories in
10964 archive name before matching like GNU ld does.
10965 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10966 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10967 (exclude_libs_test_LDFLAGS): Add linker option
10968 -Wl,--exclude-libs,libexclude_libs_test_3
10969 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10970 an explicit archive without using -l.
10971 (alt/libexclude_libs_test_3.a): New make rule.
10972 * testsuite/Makefile.in: Regenerate.
10973 * testsuite/exclude_libs_test.c : Declare lib3_default().
10974 (main): Call it.
10975 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10976 * exclude_libs_test_3.c: New file.
10977
10978 2009-05-26 Nick Clifton <nickc@redhat.com>
10979
10980 * po/id.po: New Indonesian translation.
10981 * po/gold.pot: Updated template file.
10982
10983 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10984
10985 * testsuite/Makefile.am: Add -ffunction-sections to compile
10986 gc_comdat_test files. Add -Wl,--gc-sections to build
10987 gc_comdat_test.
10988 * testsuite/Makefile.in: Regenerate.
10989 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10990
10991 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10992
10993 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10994 kept comdat section was garbage collected.
10995 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10996 * testsuite/Makefile.in: Regenerate.
10997 * testsuite/gc_comdat_test.sh: New file.
10998 * testsuite/gc_comdat_test_1.cc: New file.
10999 * testsuite/gc_comdat_test_2.cc: New file.
11000
11001 2009-05-19 Doug Kwan <dougkwan@google.com>
11002
11003 * archive.cc (Archive::Archive): Move constructor from archive.h
11004 to here. Initialize no_export_.
11005 (Archive::get_elf_object_for_member): Set no_export flag of object.
11006 * archive.h (Archive::Archive): Move constructor body to
11007 archive.cc.
11008 (Archive::no_export): New method.
11009 (Archive::no_export_): New field.
11010 * object.h (Object::Object): Initialize no_export_ to false.
11011 (Object::no_export, Object::set_no_export): New methods.
11012 (Object::no_export_): New field.
11013 * options.cc (General_options::parse_exclude_libs): New method.
11014 (General_options::check_excluded_libs) Same.
11015 * options.h (exclude_libs): New option.
11016 (General_options::check_excluded_libs): New method declaration.
11017 (General_options::excluded_libs_): New field.
11018 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11019 default or protected visibility if an object has no-export flag set.
11020 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11021 (check_SCRIPTS): Add exclude_libs_test.sh.
11022 (check_DATA): Add exclude_libs_test.syms.
11023 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11024 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11025 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11026 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11027 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11028 libexclude_libs_test_2.a): New rules.
11029 * testsuite/Makefile.in: Regenerate.
11030 * testsuite/exclude_libs_test.c: New file.
11031 * testsuite/exclude_libs_test.sh: Ditto.
11032 * testsuite/exclude_libs_test_1.c: Ditto.
11033 * testsuite/exclude_libs_test_2.c: Ditto.
11034
11035 2009-05-15 Ian Lance Taylor <iant@google.com>
11036
11037 * configure.ac: Check for declarations for cases where libiberty.h
11038 checks HAVE_DECL_xxx.
11039 * configure, config.in: Rebuild.
11040
11041 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11042
11043 * gold.h (Incremental_argument_list): Remove (invalid) forward
11044 declaration.
11045 * incremental.cc (Incremental_inputs::report_achive): New method.
11046 (Incremental_inputs::report_object): New method.
11047 (Incremental_inputs::report_script): New method.
11048 (Incremental_inputs::finalize_inputs): New method.
11049 (Incremental_inputs::finalize): Call finalize_inputs().
11050 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11051 Create inputs entries.
11052 * incremental.h (Incremental_input_type): New enum.
11053 (Incremental_inputs::Incremental_input): Initialize new fields.
11054 (Incremental_inputs::report_inputs): New method.
11055 (Incremental_inputs::report_achive): New method.
11056 (Incremental_inputs::report_object): New method.
11057 (Incremental_inputs::report_script): New method.
11058 (Incremental_inputs::finalize_inputs): New method.
11059 (Incremental_inputs::Input_info): New struct.
11060 (Incremental_inputs::Input_info_map): New typedef.
11061 (Incremental_inputs::lock_): New field.
11062 (Incremental_inputs::Inputs_): New field.
11063 (Incremental_inputs::Inputs_map): New field.
11064 * main.cc (main): Call Incremental_input::report_inputs.
11065 * options.h (Input_argument_list): Typedef moved from
11066 Input_arguments.
11067 (Input_file_group::Files): Remove, use ::Input_argument_list.
11068 (Input_file_group::Input_argument_list): Remove, use
11069 ::Input_argument_list.
11070 * plugin.cc (Plugin_manager::add_input_file): Add error in
11071 incremental build.
11072 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11073 functions.
11074 * script.cc (read_input_script): Call
11075 Incremental_input::report_script.
11076 * script.h (Script_info): New class.
11077
11078 2009-04-27 Ian Lance Taylor <iant@google.com>
11079
11080 * x86_64.cc (do_adjust_output_section): Set entsize to
11081 plt_entry_size.
11082
11083 2009-04-23 Elliott Hughes <enh@google.com>
11084
11085 * output.cc (Output_file::close): After short writes, continue
11086 writing from the correct offset in the buffer being written.
11087
11088 2009-04-23 Chris Demetriou <cgd@google.com>
11089
11090 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11091 * configure: Regenerate.
11092 * config.in: Regenerate.
11093 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11094 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11095
11096 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11097
11098 * incremental.cc (Incremental_inputs_header_data): Renamed from
11099 Incremental_input_header_data.
11100 (Incremental_inputs_header_data::data_size): New field.
11101 (Incremental_inputs_header_data::put_input_file_count): Renamed
11102 from input_file_count.
11103 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11104 from command_line_offset.
11105 (Incremental_inputs_header_data::put_reserved): Renamed from
11106 put_reserved.
11107 (Incremental_inputs_entry_data): Renamed from
11108 Incremental_input_entry_data.
11109 (Incremental_inputs_entry_data::data_size): New field.
11110 (Incremental_inputs::report_command_line): New method.
11111 (Incremental_inputs::finalize): New method.
11112 (Incremental_inputs::create_incremental_inputs_data): New method.
11113 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11114 * incremental.h: New file.
11115 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11116 (Layout::finalize): Create incremental inputs section in
11117 incremental builds.
11118 (Layout::create_incremental_info_sections): New method.
11119 * layout.h (Layout::incremental_inputs): New method.
11120 (Layout::create_incremental_info_sections): New method.
11121 (Layout::incremental_inputs_): New field.
11122 * main.cc (main): Notify Incremental_input of the command line.
11123
11124 2009-04-01 Ian Lance Taylor <iant@google.com>
11125 Mikolaj Zalewski <mikolajz@google.com>
11126
11127 * gold.h (reserve_unordered_map): Define, three versions, one for
11128 each version of Unordered_map.
11129 * layout.cc (Layout::Layout): Remove options parameter. Add
11130 number_of_input_files parameter. Don't initialize options_.
11131 Initialize number_of_input_files_ and resized_signatures_. Move
11132 sections_are_attached_.
11133 (Layout::layout_group): Reserve space for group_signatures_.
11134 (Layout::find_or_add_kept_section): Change name parameter to be a
11135 reference. Resize signatures_ map when it gets large enough.
11136 (Layout::layout_eh_frame): Use parameters->options() instead of
11137 this->options_.
11138 (Layout::make_output_section): Likewise.
11139 (Layout::attach_allocated_section_to_segment): Likewise.
11140 (Layout::finalize, Layout::create_executable_stack): Likewise.
11141 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11142 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11143 * layout.h (class Layout): Update declarations. Remove options_
11144 field. Add number_of_input_files_ and resized_signatures_
11145 fields. Move sections_are_attached_ field.
11146 * main.cc (main): Pass number of input files to Layout
11147 constructor. Don't pass options.
11148
11149 2009-03-30 Ian Lance Taylor <iant@google.com>
11150
11151 * ffsll.c (ffsll): Correct implementation.
11152
11153 2009-03-27 Ian Lance Taylor <iant@google.com>
11154
11155 * ffsll.c: New file.
11156 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11157 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11158 * ftruncate.c (ftruncate): Declare before definition.
11159 * mremap.c (mremap): Likewise.
11160 * pread.c (pread): Likewise.
11161 * configure, Makefile.in, config.in: Rebuild.
11162
11163 * mremap.c: New file.
11164 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11165 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11166 (mremap): Declare if HAVE_MREMAP is not defined.
11167 * configure, Makefile.in, config.in: Rebuild.
11168
11169 2009-03-27 Cary Coutant <ccoutant@google.com>
11170
11171 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11172 position independent.
11173 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11174 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11175
11176 2009-03-24 Cary Coutant <ccoutant@google.com>
11177
11178 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11179 an executable.
11180 (needs_dynamic_reloc): Likewise.
11181
11182 2009-03-24 Ian Lance Taylor <iant@google.com>
11183
11184 * yyscript.y (file_cmd): Recognize EXTERN.
11185 (extern_name_list, extern_name_list_body): New nonterminals.
11186 * script.cc (script_add_extern): Define.
11187 * script-c.h (script_add_extern): Declare.
11188
11189 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11190
11191 * object.cc (is_elf_object): Define.
11192 * object.h (is_elf_object): Declare.
11193 * archive.cc (Archive::get_elf_object_for_member): Call
11194 is_elf_object.
11195 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11196
11197 2009-03-24 Elliott Hughes <enh@google.com>
11198
11199 * output.cc (Output_file::map_anonymous): Define.
11200 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11201 try an anonymous one. Report the size if the mmap fails.
11202 * output.h (class Output_file): Declare map_anonymous.
11203
11204 2009-03-24 Ian Lance Taylor <iant@google.com>
11205
11206 * target-select.cc (instantiate_target): Don't acquire the lock if
11207 the instantiated_target_ field has already been set.
11208
11209 2009-03-23 Ian Lance Taylor <iant@google.com>
11210
11211 * gold-threads.h (class Initialize_lock): Define.
11212 * gold-threads.cc (class Initialize_lock_once): Define.
11213 (initialize_lock_control): New static variable.
11214 (initialize_lock_pointer): New static variable.
11215 (initialize_lock_once): New static function.
11216 (Initialize_lock::Initialize_lock): Define.
11217 (Initialize_lock::initialize): Define.
11218 * target-select.h: Include "gold-threads.h".
11219 (class Target_selector): Add lock_ and initialize_lock_ fields.
11220 Don't define instantiate_target, just declare it.
11221 * target-select.cc (Target_selector::Target_selector): Initialize
11222 new fields.
11223 (Target_selector::instantiate_target): Define.
11224 * descriptors.h: Include "gold-threads.h".
11225 (class Descriptors): Add initialize_lock_ field.
11226 * descriptors.cc (Descriptors::Descriptors): Initialize new
11227 field.
11228 (Descriptors::open): Use initialize_lock_ field
11229 * errors.h (class Errors): Add initialize_lock_ field.
11230 * errors.cc (Errors::Errors): Initialize new field.
11231 (Errors::initialize_lock): Use initialize_lock_ field.
11232 * powerpc.cc (class Target_selector_powerpc): Remove
11233 instantiated_target_ field. In do_recognize call
11234 instantiate_target rather than do_instantiate_target. In
11235 do_instantiate_target just allocate a new target.
11236 * sparc.cc (class Target_selector_sparc): Likewise.
11237
11238 * freebsd.h: New file.
11239 * i386.cc: Include "freebsd.h".
11240 (Target_i386): Derive from Target_freebsd rather than
11241 Sized_target.
11242 (Target_selector_i386): Derive from Target_selector_freebsd rather
11243 than Target_selector.
11244 * x86_64.cc: Include "freebsd.h".
11245 (Target_x86_64): Derive from Target_freebsd rather than
11246 Sized_target.
11247 (Target_selector_x86_64): Derive from Target_selector_freebsd
11248 rather than Target_selector.
11249 * target.h (class Target): Add adjust_elf_header and
11250 do_adjust_elf_header.
11251 * output.cc (Output_file_header:: do_sized_write): Call target
11252 adjust_elf_header routine.
11253 * configure.tgt: Set targ_osabi.
11254 * configure.ac: Define GOLD_DEFAULT_OSABI.
11255 * parameters.cc (Parameters::default_target): Pass
11256 GOLD_DEFAULT_OSABI to select_target.
11257 * target-select.h (class Target_selector): Make instantiate_target
11258 protected rather than private.
11259 * Makefile.am (HFILES): Add freebsd.h.
11260 * configure, Makefile.in, config.in: Rebuild.
11261
11262 * merge.cc (do_add_input_section): Correct pend value. Change
11263 message about last entry not being null terminated from error to
11264 warning.
11265
11266 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11267
11268 * incremental.cc: New file.
11269 * Makefile.am (CCFILES): Add incremental.cc.
11270 * Makefile.in: Rebuild.
11271
11272 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11273
11274 * layout.cc (Layout::output_section_name): Preserve names
11275 of '.note.' sections.
11276
11277 2009-03-19 Ian Lance Taylor <iant@google.com>
11278
11279 * descriptors.cc (Descriptors::open): Check that the options are
11280 valid before using them.
11281
11282 2009-03-18 Ian Lance Taylor <iant@google.com>
11283
11284 * script-sections.h: Include <list>.
11285 (class Script_sections): Change Sections_elements from std::vector
11286 to std::list. Typedef public Elements_iterator. Add
11287 orphan_section_placement_, data_segment_align_start_, and
11288 saw_data_segment_align_ fields. Remove data_segment_align_index_
11289 field.
11290 * script-sections.cc (class Orphan_section_placement): New class.
11291 (class Sections_element): Add virtual functions is_relro and
11292 orphan_section_init. Remove virtual function place_orphan_here.
11293 (class Output_section_definition): Add is_relro and
11294 orphan_section_init. Remove place_orphan_here.
11295 (class Orphan_output_section): Likewise.
11296 (Script_sections::Script_sections): Update for field changes.
11297 (Script_sections::data_segment_align): Set saw_data_segment_align_
11298 and data_segment_align_start_, not data_segment_align_index.
11299 (Script_sections::data_segment_relro_end): Check
11300 saw_data_segment_align_. Use data_segment_align_start_ rather
11301 than data_segment_align_index_.
11302 (Script_sections::place_orphan): Rewrite to use
11303 Orphan_section_placement.
11304
11305 2009-03-17 Ian Lance Taylor <iant@google.com>
11306
11307 * archive.cc (Archive::add_symbols): Check for a version attached
11308 to the symbol name in the archive map.
11309 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11310 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11311 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11312 (ver_test_11.a): New target.
11313 * testsuite/Makefile.in: Rebuild.
11314
11315 * configure.ac: Check for chsize and posix_fallocate. Replace
11316 ftruncate.
11317 * ftruncate.c: New file, from gnulib.
11318 * output.cc (posix_fallocate): Define dummy version if not
11319 HAVE_POSIX_FALLOCATE.
11320 (Output_file::map): Call posix_fallocate rather than lseek and
11321 write.
11322 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11323 * configure, Makefile.in, config.in: Rebuild.
11324
11325 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11326
11327 * layout.h (Layout::create_note): Add section_name parameter.
11328 * layout.cc (Layout::create_note): Likewise.
11329 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11330
11331 2009-03-17 Ian Lance Taylor <iant@google.com>
11332
11333 * descriptors.cc: Include "options.h".
11334 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11335 (Descriptors::open): Always use O_CLOEXEC when opening a new
11336 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11337 then set FD_CLOEXEC.
11338
11339 * sparc.cc (class Target_sparc): Add has_got_section.
11340 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11341 make sure we have a GOT section.
11342
11343 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11344 (Target_sparc::Scan::local): Likewise.
11345 (Target_sparc::Scan::global): Likewise.
11346 (Target_sparc::Relocate::relocate): Likewise.
11347 (Target_sparc::Relocate::relocate_tls): Likewise.
11348
11349 * symtab.cc (Symbol_table::define_default_version): New function,
11350 broken out of add_from_object.
11351 (Symbol_table::add_from_object): Call define_default_version.
11352 (Symbol_table::define_special_symbol): Add resolve_oldsym
11353 parameter. Change all callers. If the version for a symbol comes
11354 from a version script, resolve it with the symbol with the same
11355 name with no version. Also add the symbol without a version if
11356 appropriate.
11357 (do_define_in_output_data): If resolving with oldsym, don't delete
11358 sym.
11359 (do_define_in_output_segment): Likewise.
11360 (do_define_as_constant): Likewise.
11361 * symtab.h (class Symbol_table): Update declarations.
11362
11363 2009-03-13 Ian Lance Taylor <iant@google.com>
11364
11365 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11366 (Read_symbols::requeue): New function.
11367 (Read_symbols::do_read_symbols): If make_elf_object fails because
11368 the target type is not configured, and the file was searched for,
11369 issue a warning and retry with the next directory.
11370 (Add_symbols::run): If the file has an incompatible format, and
11371 it was searched for, requeue the Read_symbols task. On error,
11372 release the object.
11373 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11374 dirindex parameter to constructor. Change all callers. Declare
11375 incompatible_warning and requeue.
11376 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11377 input_argument_ and input_group_ fields. Add them to
11378 constructor. Change all callers.
11379 (class Read_script): Add dirindex_ field. Add it to constructor.
11380 Change all callers.
11381 * archive.cc (Archive::setup): Remove input_objects parameter.
11382 Change all callers.
11383 (Archive::get_file_and_offset): Likewise.
11384 (Archive::read_all_symbols): Likewise.
11385 (Archive::read_symbols): Likewise.
11386 (Archive::get_elf_object_for_member): Remove input_objects
11387 parameter. Add punconfigured parameter. Change all callers.
11388 (Archive::add_symbols): Change return type to bool. Check return
11389 value of include_member.
11390 (Archive::include_all_members): Likewise.
11391 (Archive::include_member): Change return type to bool. Return
11392 false if first included object has incompatible target. Set
11393 included_member_ field.
11394 (Add_archive_symbols::run): If add_symbols returns false, requeue
11395 Read_symbols task.
11396 * archive.h (class Archive): Add included_member_ field.
11397 Initialize it in constructor. Add input_file and searched_for
11398 methods. Update declarations.
11399 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11400 input_argument_ fields. Add them to constructor. Change all
11401 callers.
11402 * script.cc: Include "target-select.h".
11403 (class Parser_closure): Add skip_on_incompatible_target_ and
11404 found_incompatible_target_ fields. Add
11405 skip_on_incompatible_target parameter to constructor. Change all
11406 callers. Add methods skip_on_incompatible_target,
11407 clear_skip_on_incompatible_target, found_incompatible_target, and
11408 set_found_incompatible_target.
11409 (read_input_script): Add dirindex parameter. Change all callers.
11410 If parser finds an incompatible target, requeue Read_symbols
11411 task.
11412 (script_set_symbol): Clear skip_on_incompatible_target in
11413 closure.
11414 (script_add_assertion, script_parse_option): Likewise.
11415 (script_start_sections, script_add_phdr): Likewise.
11416 (script_check_output_format): New function.
11417 * script.h (read_input_script): Update declaration.
11418 * script-c.h (script_check_output_format): Declare.
11419 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11420 (ignore_cmd): Remove OUTPUT_FORMAT.
11421 * fileread.cc (Input_file::Input_file): Add explicit this.
11422 (Input_file::will_search_for): New function.
11423 (Input_file::open): Add pindex parameter. Change all callers.
11424 * fileread.h (class Input_file): Add input_file_argument method.
11425 Declare will_search_for. Update declarations.
11426 * object.cc (make_elf_object): Add punconfigured parameter.
11427 Change all callers.
11428 * object.h (class Object): Make input_file public. Add
11429 searched_for method.
11430 (make_elf_object): Update declaration.
11431 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11432 restart search.
11433 * dirsearch.h (class Dirsearch): Update declaration.
11434 * options.h (class General_options): Add --warn-search-mismatch.
11435 * parameters.cc (Parameters::is_compatible_target): New function.
11436 * parameters.h (class Parameters): Declare is_compatible_target.
11437 * workqueue.cc (Workqueue::add_blocker): New function.
11438 * workqueue.h (class Workqueue): Declare add_blocker.
11439
11440 * fileread.cc (Input_file::open): Remove options parameter.
11441 Change all callers.
11442 (Input_file::open_binary): Likewise.
11443 * script.cc (read_input_script): Likewise.
11444 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11445 options parameter from constructor. Change all callers.
11446 (class Read_script): Likewise.
11447 * fileread.h (class Input_file): Update declarations.
11448 * script.h (read_input_script): Update declaration.
11449
11450 2009-03-10 Nick Clifton <nickc@redhat.com>
11451
11452 * po/es.po: New Spanish translation.
11453
11454 2009-03-06 Cary Coutant <ccoutant@google.com>
11455
11456 * options.cc (parse_short_option): Keep dash_z from registering itself.
11457
11458 2009-03-03 Ian Lance Taylor <iant@google.com>
11459
11460 PR 9918
11461 * target-reloc.h (relocate_section): Pass output_section to
11462 relocate.
11463 * i386.cc (Target_i386::should_apply_static_reloc): Add
11464 output_section parameter. Change all callers.
11465 (Target_i386::Relocate::relocate): Add output_section parameter.
11466 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11467 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11468 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11469 * testsuite/two_file_shared.sh: New script.
11470 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11471 (check_DATA): Add two_file_shared.dbg.
11472 (two_file_shared.dbg): New target.
11473 * testsuite/Makefile.in: Rebuild.
11474
11475 2009-03-01 Ian Lance Taylor <iant@google.com>
11476
11477 * configure.ac: Check for byteswap.h.
11478 * configure: Rebuild.
11479 * config.in: Rebuild.
11480
11481 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11482
11483 * layout.cc (Layout::find_or_add_kept_section): New function.
11484 (Layout::add_comdat): Removed.
11485 * layout.h (struct Kept_section): Move out of class Layout.
11486 Remove trailing underscores from field names. Add group_sections
11487 field. Rename group_ field to is_group. Change all uses.
11488 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11489 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11490 comdat_groups_ field.
11491 (Sized_relobj::include_section_group): Use
11492 find_or_add_kept_section and Kept_section::group_sections.
11493 (Sized_relobj::include_linkonce_section): Likewise.
11494 * object.cc (class Sized_relobj): Don't define Comdat_group or
11495 Comdat_group_table. Remove find_comdat_group and
11496 add_comdat_group. Remove comdat_groups_ field.
11497 * plugin.cc (include_comdat_group): Use
11498 Layout::find_or_add_kept_section.
11499
11500 2009-02-28 Ian Lance Taylor <iant@google.com>
11501
11502 * README: --gc-sections and map files are now supported. Document
11503 some build requirements.
11504
11505 PR 6992
11506 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11507 relocatable link set the value of the section symbol to zero.
11508 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11509 relocatable link don't include the section address in the local
11510 symbol value.
11511
11512 2009-02-27 Ian Lance Taylor <iant@google.com>
11513
11514 PR 6811
11515 * options.h (class Search_directory): Add is_system_directory.
11516 (class General_options): Declare is_in_system_directory.
11517 * options.cc (get_relative_sysroot): Make static.
11518 (get_default_sysroot): Make static.
11519 (General_optoins::is_in_system_directory): New function.
11520 * fileread.cc (Input_file::is_in_system_directory): New function.
11521 * fileread.h (class Input_file): Declare is_in_system_directory.
11522 * object.h (class Object): Add is_in_system_directory.
11523 (class Input_objects): Remove system_library_directory_ field.
11524 * object.cc (Input_objects::add_object): Don't set
11525 system_library_directory_.
11526 (input_objects::found_in_system_library_directory): Remove.
11527 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11528 parameter. Change all callers.
11529 (Symbol_table::sized_write_globals): Likewise.
11530 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11531 Call Object::is_in_system_directory.
11532 * symtab.h (class Symbol_table): Update declarations.
11533
11534 PR 5990
11535 * descriptors.h (Open_descriptor): Add is_on_stack field.
11536 * descriptors.cc (Descriptors::open): If the descriptor is on the
11537 top of the stack, remove it. Initialize is_on_stack field.
11538 (Descriptors::release): Only add pod to stack if it is not on the
11539 stack already.
11540 (Descriptors::close_some_descriptor): Clear stack_next and
11541 is_on_stack fields.
11542
11543 PR 7091
11544 * output.cc (Output_section::find_starting_output_address): Rename
11545 from starting_output_address; add PADDR parameter; change return
11546 type.
11547 * output.h (class Output_section): Declare
11548 find_starting_output_address instead of starting_output_address.
11549 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11550 section symbol for which we can't find a merge section.
11551
11552 PR 9836
11553 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11554 hidden or internal, force the symbol to be local.
11555 * resolve.cc (Symbol::override_visibility): Define.
11556 (Symbol::override_base): Use override_visibility.
11557 (Symbol_table::resolve): Likewise.
11558 (Symbol::override_base_with_special): Likewise.
11559 (Symbol_table::override_with_special): If the visibility is hidden
11560 or internal, force the symbol to be local.
11561 * symtab.h (class Symbol): Add set_visibility and
11562 override_visibility.
11563 * testsuite/ver_test_1.sh: New file.
11564 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11565 (check_DATA): Add ver_test_1.syms.
11566 (ver_test_1.syms): New target.
11567 * testsuite/Makefile.in: Rebuild.
11568
11569 2009-02-25 Cary Coutant <ccoutant@google.com>
11570
11571 * layout.cc (Layout::choose_output_section): Don't rename sections
11572 when using a linker script that has a SECTIONS clause.
11573 * Makefile.in: Regenerate.
11574
11575 * testsuite/Makefile.am (script_test_5.sh): New test case.
11576 * testsuite/Makefile.in: Regenerate.
11577 * testsuite/script_test_5.cc: New file.
11578 * testsuite/script_test_5.sh: New file.
11579 * testsuite/script_test_5.t: New file.
11580
11581 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11582
11583 * archive.cc (Archive::include_member): Update calls to add_symbols.
11584 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11585 the Layout argument.
11586 * dynobj.h (do_add_symbols): Add the Layout argument.
11587 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11588 Layout argument.
11589 * object.h (Object::add_symbols): Add the Layout argument.
11590 (Object::do_add_symbols): Add the Layout argument.
11591 (Sized_relobj::do_add_symbols): Add the Layout argument.
11592 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11593 Unify the two versions.
11594 (Add_plugin_symbols): Remove.
11595 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11596 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11597 (Add_plugin_symbols): Remove.
11598 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11599 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11600 (Add_symbols::run): Make it work with Pulginobj.
11601
11602 2009-02-06 Ian Lance Taylor <iant@google.com>
11603
11604 * object.cc (Sized_relobj::do_layout): Make info message start
11605 with lower case letter.
11606
11607 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11608
11609 * binary.cc: Fix file comment.
11610
11611 * options.h (enum Incremental_disposition): Define.
11612 (class General_options): Add new options: --incremental,
11613 --incremental_changed, --incremental_unchanged,
11614 --incremental_unknown. Add incremental_disposition_ and
11615 implicit_incremental_ fields.
11616 (General_options::incremental_disposition): New function.
11617 (class Position_dependent_options): Add incremental_disposition
11618 option.
11619 (Position_dependent_options::copy_from_options): Set incremental
11620 dispositions.
11621 * options.cc (General_options::parse_incremental_changed): New
11622 function.
11623 (General_options::parse_incremental_unchanged): New function.
11624 (General_options::parse_incremental_unknown): New function.
11625 (General_options::General_options): Initialize new fields
11626 incremental_disposition_ and implicit_incremental_.
11627 (General_options::finalize): Check for uasge of --incremental-*
11628 without --incremental.
11629
11630 2009-02-06 Chris Demetriou <cgd@google.com>
11631
11632 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11633 pointer and to report location as the file name associated with
11634 the symbol.
11635 (gold_undefined_symbol_at_location): New function to replace the
11636 old gold_undefined_symbol functionality.
11637 * target-reloc.h (relocate_section): Update to use
11638 gold_undefined_symbol_at_location.
11639 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11640 Call gold_undefined_symbol function rather than gold_error.
11641 * errors.h (Errors::undefined_symbol): Take location as a
11642 string, rather than calculating it from a relocation.
11643 * errors.cc (Errors::fatal): Print "fatal error:" before the
11644 formatted message.
11645 (Errors::error, Errors::error_at_location): Print "error: "
11646 before the formatted message.
11647 (Errors::undefined_symbol): Take location as a string, rather
11648 than calculating it from a relocation.
11649 (gold_undefined_symbol_at_location): New function akin to
11650 old gold_undefined_symbol, calculates location from relocation.
11651 (gold_undefined_symbol): Change to take only a Symbol pointer
11652 and to report location as the file name associated with the symbol.
11653 * testsuite/debug_msg.sh: Update for changed error messages.
11654 * testsuite/undef_symbol.sh: Likewise.
11655
11656 2009-02-04 Duncan Sands <baldrick@free.fr>
11657
11658 PR 9812
11659 * reduced_debug_output.h
11660 (Output_reduced_debug_abbrev_section::failed): Use format for
11661 gold_warning.
11662 (Output_reduced_debug_info_section::faild): Likewise.
11663
11664 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11665
11666 * script.cc (Lazy_demangler): New class.
11667 (Version_script_info::get_symbol_version_helper): Demangle a
11668 symbol only once.
11669
11670 2009-01-29 Cary Coutant <ccoutant@google.com>
11671
11672 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11673 to __tls_get_addr.
11674 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11675
11676 2009-01-28 Ian Lance Taylor <iant@google.com>
11677
11678 * version.cc (version_string): Bump to 1.9.
11679
11680 * gold.h: Include <cstring> and <stdint.h>.
11681 * version.cc: Include <cstdio>.
11682 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11683 warning.
11684 * reduced_debug_output.cc (insert_into_vector): Rename from
11685 Insert_into_vector; change all callers. Use Swap_unaligned to
11686 avoid aliasing issue; remove union since it is unnecessary.
11687
11688 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11689
11690 * Makefile.am (CCFILES): Add gc.cc.
11691 (HFILES): Add gc.h.
11692 * Makefile.in: Regenerate.
11693 * gold.cc (Gc_runner): New class.
11694 (queue_initial_tasks): Call garbage collection related tasks
11695 when corresponding options are invoked.
11696 (queue_middle_gc_tasks): New function.
11697 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11698 processed early before laying out sections during garbage collection.
11699 * gold.h (queue_middle_gc_tasks): New function.
11700 (is_prefix_of): Move from "layout.cc".
11701 * i386.cc (Target_i386::gc_process_relocs): New function.
11702 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11703 * main.cc (main): Create object of class "Garbage_collection".
11704 * object.cc (Relobj::copy_symbols_data): New function.
11705 (Relobj::is_section_name_included): New function.
11706 (Sized_relobj::do_layout): Allow this function to be called twice
11707 during garbage collection and defer layout of section during the
11708 first call.
11709 * object.h (Relobj::get_symbols_data): New function.
11710 (Relobj::is_section_name_included): New function.
11711 (Relobj::copy_symbols_data): New function.
11712 (Relobj::set_symbols_data): New function.
11713 (Relobj::get_relocs_data): New function.
11714 (Relobj::set_relocs_data): New function.
11715 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11716 (Relobj::gc_process_relocs): New function.
11717 (Relobj::do_gc_process_relocs): New pure virtual function.
11718 (Relobj::sd_): New data member.
11719 (Sized_relobj::is_output_section_offset_invalid): New function.
11720 (Sized_relobj::do_gc_process_relocs): New function.
11721 * options.h (General_options::gc_sections): Modify to not be a no-op.
11722 (General_options::print_gc_sections): New option.
11723 * plugin.cc (Plugin_finish::run): Remove function call to
11724 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11725 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11726 * reloc.cc (Read_relocs::run): Add task to process relocs and
11727 determine unreferenced sections when doing garbage collection.
11728 (Gc_process_relocs): New class.
11729 (Sized_relobj::do_gc_process_relocs): New function.
11730 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11731 sections that are garbage collected.
11732 * reloc.h (Gc_process_relocs): New class.
11733 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11734 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11735 symbols whose corresponding sections are garbage collected.
11736 (Symbol_table::Symbol_table): Add new parameter for the garbage
11737 collection object.
11738 (Symbol_table::gc_mark_undef_symbols): New function.
11739 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11740 (Symbol_table::gc_mark_dyn_syms): New function.
11741 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11742 as garbage.
11743 (Symbol_table::add_from_object): Likewise.
11744 (Symbol_table::add_from_relobj): When building shared objects, do not
11745 treat externally visible symbols as garbage.
11746 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11747 table information for static and relocatable links.
11748 * symtab.h (Symbol_table::set_gc): New function.
11749 (Symbol_table::gc): New function.
11750 (Symbol_table::gc_mark_undef_symbols): New function.
11751 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11752 (Symbol_table::gc_mark_dyn_syms): New function.
11753 (Symbol_table::gc_): New data member.
11754 * target.h (Sized_target::gc_process_relocs): New pure virtual
11755 function.
11756 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11757 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11758
11759 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11760
11761 * options.h (General_options::gc_sections): Define as a no-op for now.
11762 (General_options::no_keep_memory): Ditto.
11763 (General_options::Bshareable): Define.
11764 * options.cc (General_options::finalize): Honor -Bshareable.
11765
11766 2009-01-20 Andreas Schwab <schwab@suse.de>
11767
11768 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11769 read the value in the contents, since we don't use it. Use the
11770 template endianness when writing.
11771 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11772
11773 2009-01-19 Andreas Schwab <schwab@suse.de>
11774
11775 * configure.tgt (powerpc64-*): Fix targ_obj.
11776
11777 2009-01-15 Ian Lance Taylor <iant@google.com>
11778
11779 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11780 local symbols when stripping all symbols.
11781
11782 2009-01-14 Cary Coutant <ccoutant@google.com>
11783
11784 * output.cc (Output_reloc): Add explicit instantiations.
11785
11786 2009-01-14 Cary Coutant <ccoutant@google.com>
11787
11788 * archive.cc (Archive::get_elf_object_for_member): Remove call
11789 to File_read::claim_for_plugin.
11790 * descriptors.cc (Descriptors::open): Remove reference to
11791 is_claimed.
11792 (Descriptors::claim_for_plugin): Remove.
11793 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11794 (Descriptors::is_claimed): Remove.
11795 (claim_descriptor_for_plugin): Remove.
11796 * fileread.cc (File_read::claim_for_plugin): Remove.
11797 * fileread.h (File_read::claim_for_plugin): Remove.
11798 (File_read::descriptor): Reopen descriptor if necessary.
11799 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11800 (Plugin_manager::all_symbols_read): Add task parameter. Change
11801 all callers.
11802 (Plugin_manager::get_input_file): New function.
11803 (Plugin_manager::release_input_file): New function.
11804 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11805 corresponding data member.
11806 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11807 and pass to base constructor. Change all callers.
11808 (get_input_file, release_input_file): New functions.
11809 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11810 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11811 (Plugin_manager::all_symbols_read): Add task parameter.
11812 (Plugin_manager::get_input_file): New function.
11813 (Plugin_manager::release_input_file): New function.
11814 (Plugin_manager::task_): New data member.
11815 (Pluginobj::Pluginobj): Add filesize parameter.
11816 (Pluginobj::filename): New function.
11817 (Pluginobj::descriptor): New function.
11818 (Pluginobj::filesize): New function.
11819 (Pluginobj::filesize_): New data member.
11820 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11821 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11822 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11823
11824 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11825 with archive libraries.
11826 * testsuite/Makefile.in: Regenerate.
11827 * testsuite/plugin_test.c (struct sym_info): New type.
11828 (get_input_file, release_input_file): New static variables.
11829 (onload): Capture new transfer vector entries.
11830 (claim_file_hook): Stop reading at end of file according to filesize.
11831 Factor out parsing of readelf output into separate function.
11832 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11833 APIs and get the source file name from the symbol table. Convert
11834 source file name to corresponding object file name. Print info
11835 message when adding new input files.
11836 (parse_readelf_line): New function.
11837 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11838 * testsuite/plugin_test_2.sh: Likewise.
11839 * testsuite/plugin_test_3.sh: Likewise.
11840 * testsuite/plugin_test_4.sh: New test case.
11841
11842 2009-01-07 Ian Lance Taylor <iant@google.com>
11843
11844 * version.cc (version_string): Bump to 1.8.
11845
11846 2008-12-23 Cary Coutant <ccoutant@google.com>
11847
11848 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11849 * plugin.cc (Plugin_manager::finish): Rename as
11850 layout_deferred_objects. Move cleanup to separate function.
11851 (Plugin_manager::cleanup): New function.
11852 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11853 separately.
11854 * plugin.h (Plugin_manager::finish): Rename as
11855 layout_deferred_objects.
11856 (Plugin_manager::cleanup): New function.
11857 (Plugin_manager::cleanup_done): New field.
11858
11859 2008-12-23 Cary Coutant <ccoutant@google.com>
11860
11861 * plugin.cc (is_visible_from_outside): New function.
11862 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11863 so we don't return "IR only" status for exported symbols or -r links.
11864
11865 * testsuite/Makefile.am (plugin_test_3): New test case.
11866 * testsuite/Makefile.in: Regenerate.
11867 * testsuite/plugin_test_3.sh: New file.
11868
11869 2008-12-22 Cary Coutant <ccoutant@google.com>
11870
11871 * object.cc (Sized_relobj::layout_section): New function.
11872 (Sized_relobj::do_layout): Defer layout of input sections until after
11873 plugin has provided replacement files.
11874 (Sized_relobj::do_layout_deferred_sections): New function.
11875 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11876 (Relobj::layout_deferred_sections): New function.
11877 (Relobj::do_layout_deferred_sections): New function.
11878 (Sized_relobj::do_layout_deferred_sections): New function.
11879 (Sized_relobj::layout_section): New function.
11880 (Sized_relobj::Deferred_layout): New structure.
11881 (Sized_relobj::deferred_layout_): New field.
11882 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11883 Change all callers. Layout deferred sections.
11884 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11885 references.
11886 (Plugin_hook::run): Move code from do_plugin_hook inline.
11887 (Plugin_hook::do_plugin_hook): Remove.
11888 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11889 (Plugin_manager::finish): Renamed, was cleanup.
11890 (Plugin_manager::should_defer_layout): New function.
11891 (Plugin_manager::add_deferred_layout_object): New function.
11892 (Plugin_manager::Deferred_layout_list): New type.
11893 (Plugin_manager::deferred_layout_objects_): New field.
11894 (Plugin_hook::do_plugin_hook): Remove.
11895
11896 2008-12-17 Ian Lance Taylor <iant@google.com>
11897
11898 * options.h (class General_options): Add --no case for
11899 --export-dynamic.
11900
11901 2008-12-16 Cary Coutant <ccoutant@google.com>
11902
11903 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11904 vector.
11905 (Plugin_manager::claim_file): Create plugin object even if
11906 plugin did not call the add_symbols callback.
11907 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11908 asking for more symbols than were added.
11909 * testsuite/Makefile.am (plugin_test_1): Add test case with
11910 no global symbols.
11911 (empty.syms): New target.
11912 * testsuite/Makefile.in: Regenerate.
11913 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11914 message. Don't call add_symbols if no globals.
11915 (all_symbols_read_hook): Don't provide replacement for empty
11916 claimed file.
11917
11918 2008-12-12 Ian Lance Taylor <iant@google.com>
11919
11920 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11921 r_type == 0 for a local symbol with r_sym == 0.
11922 (scan_relocatable_relocs): Pass r_sym to
11923 local_non_section_strategy.
11924 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11925 r_sym parameter.
11926
11927 * configure.ac: Update test for TLS descriptors: they are
11928 supported as of glibc 2.9.
11929 * configure: Rebuild.
11930
11931 2008-12-11 Ian Lance Taylor <iant@google.com>
11932
11933 PR 7091
11934 * target-reloc.h (Default_scan_relocatable_relocs): For each
11935 function, map r_type == 0 to RELOC_DISCARD.
11936
11937 2008-12-10 Cary Coutant <ccoutant@google.com>
11938
11939 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11940 object to override a kept COMDAT group from a plugin object.
11941
11942 2008-12-09 Ian Lance Taylor <iant@google.com>
11943
11944 PR 7088
11945 * yyscript.y (file_cmd): Handle INPUT.
11946
11947 * testsuite/initpri1.c: Change all declarations to be full
11948 prototypes by adding void, to avoid compiler warnings.
11949
11950 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11951
11952 * options.cc (General_options::parse_plugin_opt): New.
11953 (General_options::add_plugin): The argument now is just the filename.
11954 (General_options::add_plugin_option): New.
11955 * options.h (plugin_opt): New.
11956 (add_plugin): Change argument name.
11957 (add_plugin_option): New.
11958 * plugin.cc (Plugin::load): Don't parse the plugin option.
11959 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11960 (Plugin::add_option): New.
11961 (Plugin::args_): Change type.
11962 (Plugin::filename_): New.
11963 (Plugin_manager::add_plugin_option): New.
11964 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11965 * testsuite/Makefile.in: Regenerate.
11966
11967 2008-12-05 Cary Coutant <ccoutant@google.com>
11968
11969 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11970 Handle --strip-lto-sections option.
11971 * options.h (strip_lto_sections): New option.
11972
11973 2008-12-01 Cary Coutant <ccoutant@google.com>
11974
11975 * plugin.cc (ld_plugin_message): Change format parameter to const.
11976 Fix mismatch between new[] and delete.
11977
11978 2008-11-14 Cary Coutant <ccoutant@google.com>
11979
11980 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11981 instead of -1U.
11982
11983 2008-11-05 Craig Silverstein <csilvers@google.com>
11984
11985 * options.cc (General_options::parse_dynamic_list): New function.
11986 * options.h (General_options): New flags dynamic_list,
11987 dynamic_list_data, dynamic_list_cpp_new, and
11988 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11989 (General_options::in_dynamic_list): New function.
11990 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11991 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11992 (Lex::can_continue_name): Likewise.
11993 (yylex): Likewise.
11994 (read_script_file): New parameter script_options.
11995 (read_dynamic_list): New function.
11996 (Script_options::define_dynamic_list): New function.
11997 (dynamic_list_keyword_parsecodes): New variable.
11998 (dynamic_list_keywords): New variable.
11999 * script.h (Script_options::define_dynamic_list): New function
12000 prototype.
12001 (read_dynamic_list): New function prototype.
12002 * symtab.cc (strprefix): New macro.
12003 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12004 dynamic_list_data, dynamic_list_cpp_new, and
12005 dynamic_list_cpp_typeinfo.
12006 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12007 (dynamic_list_expr): New rule.
12008 (dynamic_list_nodes): Likewise.
12009 (dynamic_list_node): Likewise.
12010 * testsuite/Makefile.am (dynamic_list): New test.
12011 * testsuite/Makefile.in: Regenerated.
12012 * testsuite/dynamic_list.t: New file.
12013 * testsuite/dynamic_list.sh: New file.
12014
12015 2008-11-05 Craig Silverstein <csilvers@google.com>
12016
12017 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12018 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12019 (t11_last): Likewise.
12020 * testsuite/ver_test_6.c (main): Likewise.
12021
12022 2008-10-07 Cary Coutant <ccoutant@google.com>
12023
12024 * options.c (General_options::finalize): Add check for -static and
12025 -shared.
12026 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12027 is not empty.
12028
12029 2008-10-02 Cary Coutant <ccoutant@google.com>
12030
12031 * plugin.cc (make_sized_plugin_object): Fix conditional
12032 compilation to work when not all targets are enabled.
12033
12034 2008-09-29 Cary Coutant <ccoutant@google.com>
12035
12036 * archive.cc (Archive::get_file_and_offset): Use filename instead
12037 of name to get library path.
12038 (Archive::include_member): Unlock external member of a thin archive.
12039
12040 * testsuite/Makefile.am (TEST_AR): New variable.
12041 (thin_archive_test_1): New test.
12042 (thin_archive_test_2): New test.
12043 * testsuite/Makefile.in: Regenerate.
12044 * testsuite/thin_archive_main.cc: New file.
12045 * testsuite/thin_archive_test_1.cc: New file.
12046 * testsuite/thin_archive_test_2.cc: New file.
12047 * testsuite/thin_archive_test_3.cc: New file.
12048 * testsuite/thin_archive_test_4.cc: New file.
12049
12050 2008-09-29 Cary Coutant <ccoutant@google.com>
12051
12052 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12053 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12054 instead of -1U.
12055 (Sized_relobj::do_finalize_local_symbols): Likewise.
12056 (Sized_relobj::map_to_kept_section): Likewise.
12057 * object.h (Sized_relobj::invalid_address): New constant.
12058 (Sized_relobj::do_output_section_offset): Check for invalid_address
12059 and return -1ULL.
12060 * output.cc (Output_reloc::local_section_offset): Use constant
12061 invalid_address instead of -1U.
12062 (Output_reloc::get_address): Likewise.
12063 (Output_section::output_address): Change -1U to -1ULL.
12064 * output.h (Output_reloc::invalid_address): New constant.
12065 * reloc.cc (Sized_relobj::write_sections): Use constant
12066 invalid_address instead of -1U.
12067 (Sized_relobj::relocate_sections): Likewise.
12068 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12069 values for merge sections.
12070 * target-reloc.h (relocate_for_relocatable): Use constant
12071 invalid_address instead of -1U.
12072
12073 2008-09-19 Cary Coutant <ccoutant@google.com>
12074
12075 Add plugin functionality for link-time optimization (LTO).
12076 * configure.ac (plugins): Add --enable-plugins option.
12077 * configure: Regenerate.
12078 * config.in: Regenerate.
12079 * Makefile.am (LIBDL): New variable.
12080 (CCFILES): Add plugin.cc.
12081 (HFILES): Add plugin.h.
12082 (ldadd_var): Add LIBDL.
12083 * Makefile.in: Regenerate.
12084
12085 * archive.cc: Include "plugin.h".
12086 (Archive::setup): Don't preread archive symbols when using a plugin.
12087 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12088 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12089 files.
12090 (Archive::include_member): Add symbols from plugin objects.
12091 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12092 * descriptors.cc (Descriptors::open): Check for file descriptors
12093 abandoned by plugins.
12094 (Descriptors::claim_for_plugin): New function.
12095 * descriptors.h (Descriptors::claim_for_plugin): New function.
12096 (Open_descriptor::is_claimed): New field.
12097 (claim_descriptor_for_plugin): New function.
12098 * fileread.cc (File_read::claim_for_plugin): New function.
12099 * fileread.h (File_read::claim_for_plugin): New function.
12100 (File_read::descriptor): New function.
12101 * gold.cc: Include "plugin.h".
12102 (queue_initial_tasks): Add task to call plugin hooks for generating
12103 new object files.
12104 * main.cc: Include "plugin.h".
12105 (main): Load plugin libraries.
12106 * object.h (Pluginobj): Declare.
12107 (Object::pluginobj): New function.
12108 (Object::do_pluginobj): New function.
12109 (Object::set_target): New function.
12110 * options.cc: Include "plugin.h".
12111 (General_options::parse_plugin): New function.
12112 (General_options::General_options): Initialize plugins_ field.
12113 (General_options::add_plugin): New function.
12114 * options.h (Plugin_manager): Declare.
12115 (General_options): Add --plugin option.
12116 (General_options::has_plugins): New function.
12117 (General_options::plugins): New function.
12118 (General_options::add_plugin): New function.
12119 (General_options::plugins_): New field.
12120 * plugin.cc: New file.
12121 * plugin.h: New file.
12122 * readsyms.cc: Include "plugin.h".
12123 (Read_symbols::do_read_symbols): Check for archive before checking
12124 for ELF file. Call plugin hooks to claim files.
12125 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12126 from a real object file; force override when processing replacement
12127 files.
12128 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12129 (Symbol::init_base_object): Likewise.
12130 (Symbol::init_base_output_data): Likewise.
12131 (Symbol::init_base_output_segment): Likewise.
12132 (Symbol::init_base_constant): Likewise.
12133 (Symbol::init_base_undefined): Likewise.
12134 (Symbol::output_section): Assert that object is not a plugin.
12135 (Symbol_table::add_from_pluginobj): New function.
12136 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12137 undefined.
12138 (Symbol_table::sized_write_globals): Likewise.
12139 (Symbol_table::add_from_pluginobj): Instantiate template.
12140 * symtab.h (Sized_pluginobj): Declare.
12141 (Symbol::in_real_elf): New function.
12142 (Symbol::set_in_real_elf): New function.
12143 (Symbol::in_real_elf_): New field.
12144 (Symbol_table::add_from_pluginobj): New function.
12145
12146 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12147 (LIBDL): New variable.
12148 (LDADD): Add LIBDL.
12149 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12150 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12151 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12152 (MOSTLYCLEANFILES): Likewise.
12153 * testsuite/Makefile.in: Regenerate.
12154 * testsuite/plugin_test.c: New file.
12155 * testsuite/plugin_test_1.sh: New file.
12156 * testsuite/plugin_test_2.sh: New file.
12157
12158 2008-09-16 Ian Lance Taylor <iant@google.com>
12159
12160 * target-reloc.h (relocate_section): Check whether a symbol is
12161 defined by the ABI before reporting an undefined symbol error.
12162 * target.h (Target::is_defined_by_abi): Make parameter const.
12163 (Target::do_is_defined_by_abi): Likewise.
12164 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12165 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12166 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12167 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12168 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12169 * testsuite/Makefile.in: Rebuild.
12170
12171 * fileread.cc (make_view): Add casts to avoid warning.
12172
12173 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12174
12175 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12176 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12177
12178 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12179
12180 * options.h (General_options::output_is_executable): New.
12181 (General_options::output_is_pie): New.
12182 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12183 for shared libraries.
12184 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12185
12186 2008-09-11 Chris Demetriou <cgd@google.com>
12187
12188 * options.h (origin): New -z option.
12189 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12190 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12191 in DT_FLAGS_1.
12192
12193 2008-09-05 Cary Coutant <ccoutant@google.com>
12194
12195 * fileread.cc (File_read::make_view): Add check for attempt to map
12196 beyond end of file.
12197
12198 2008-09-05 Cary Coutant <ccoutant@google.com>
12199
12200 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12201 explicit instantiations.
12202
12203 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12204
12205 PR gold/6858
12206 * options.cc (General_options::finalize): Allow undefined symbols
12207 in shlibs if linking -shared.
12208
12209 PR gold/6859
12210 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12211 symbols as not needing a dynsym entry.
12212
12213 2008-08-20 Craig Silverstein <csilvers@google.com>
12214
12215 * fileread.cc (File_read::open): Do not lock the file unless it
12216 was successfully opened.
12217
12218 2008-08-14 Cary Coutant <ccoutant@google.com>
12219
12220 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12221 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12222 * testsuite/tls_test.cc (struct int128): 128-bit struct
12223 for testing TLS relocs with non-zero addend.
12224 (v12): New TLS variable.
12225 (t12): New test.
12226 (t_last): Add check for v12.
12227 * testsuite/tls_test.h (t12): New function.
12228 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12229
12230 2008-08-13 Ian Lance Taylor <iant@google.com>
12231
12232 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12233 set tls_segment_ or relro_segment_.
12234 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12235 when appropriate.
12236 * output.h (Output_section::clear_is_relro): New function.
12237 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12238 sections specially even when output_data_ is empty.
12239 (Output_segment::maximum_alignment): When first section is relro,
12240 only force alignment for PT_LOAD segments.
12241 * script.cc (script_data_segment_align): New function.
12242 (script_data_segment_relro_end): New function.
12243 * script-c.h (script_data_segment_align): Declare.
12244 (script_data_segment_relro_end): Declare.
12245 * script-sections.h (class Script_sections): Declare
12246 data_segment_align and data_segment_relro_end. Add fields
12247 segment_align_index_ and saw_relro_end_.
12248 * script-sections.cc (class Sections_element): Add set_is_relro
12249 virtual function. Add new bool* parameter to place_orphan_here.
12250 Add get_output_section virtual function.
12251 (class Output_section_definition): Add set_is_relro. Add new
12252 bool* parameter to place_orphan_here. Add get_output_section.
12253 Add is_relro_ field.
12254 (Output_section_definition::Output_section_definition): Initialize
12255 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12256 and is_relro_ fields.
12257 (Output_section_definition::place_orphan_here): Add is_relro
12258 parameter.
12259 (Output_section_definition::set_section_addresses): Set relro for
12260 output section.
12261 (Output_section_definition::alternate_constraint): Likewise.
12262 (class Orphan_output_section): Add new bool* parameter to
12263 place_orphan_here. Add get_output_section.
12264 (Orphan_output_section::place_orphan_here): Add is_relro
12265 parameter.
12266 (Script_sections::Script_sections): Initialize
12267 data_segment_align_index_ and saw_relro_end_.
12268 (Script_sections::data_segment_align): New function.
12269 (Script_sections::data_segment_relro_end): New function.
12270 (Script_sections::place_orphan): Set or clear is_relro.
12271 (Script_sections::set_section_addresses): Force alignment of first
12272 TLS section.
12273 * yyscript.y (exp): Call script_data_segment_align and
12274 script_data_segment_relro_end.
12275 * testsuite/relro_script_test.t: New file.
12276 * testsuite/relro_test.cc (using_script): Declare.
12277 (t1, t2): Test using_script.
12278 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12279 (relro_script_test_SOURCES): Define.
12280 (relro_script_test_DEPENDENCIES): Define.
12281 (relro_script_test_LDFLAGS): Define.
12282 (relro_script_test_LDADD): Define.
12283 (relro_script_test.so): New target.
12284 * testsuite/Makefile.in: Rebuild.
12285
12286 2008-08-06 Cary Coutant <ccoutant@google.com>
12287
12288 * archive.cc (Archive::total_archives, Archive::total_members)
12289 (Archive::total_members_loaded): New variables.
12290 (Archive::setup): Add parameter. Add option to preread
12291 archive symbols.
12292 (Archive::read_armap): Add counter.
12293 (Archive::get_file_and_offset): New function.
12294 (Archive::get_elf_object_for_member): New function.
12295 (Archive::read_all_symbols): New function.
12296 (Archive::read_symbols): New function.
12297 (Archive::add_symbols): Add counters.
12298 (Archive::include_all_members): Use armap to find members if it's
12299 already built.
12300 (Archive::include_member): Skip reading symbols if already read.
12301 Factored code into Archive::get_file_and_offset and
12302 Archive::get_elf_object_for_member. Changed call to
12303 Mapfile::report_include_archive_member.
12304 (Archive::print_stats): New function.
12305 * archive.h: Declare Object and Read_symbols_data classes.
12306 (Archive::Archive): Add initializers for new members.
12307 (Archive::setup): Add parameter.
12308 (Archive::print_stats): New function.
12309 (Archive::total_archives, Archive::total_members)
12310 (Archive::total_members_loaded): New variables.
12311 (Archive::get_file_and_offset): New function.
12312 (Archive::get_elf_object_for_member): New function.
12313 (Archive::read_all_symbols): New function.
12314 (Archive::read_symbols): New function.
12315 (Archive::Archive_member): New class.
12316 (Archive::members_): New member.
12317 (Archive::num_members_): New member.
12318 * main.cc: Include archive.h.
12319 (main): Call Archive::print_stats.
12320 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12321 archive parameter; member_name is now the fully-decorated name.
12322 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12323 * options.h: (General_options): Add --preread-archive-symbols option.
12324 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12325 Archive::setup.
12326
12327 2008-08-04 Ian Lance Taylor <iant@google.com>
12328
12329 * symtab.h (Symbol::use_plt_offset): New function.
12330 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12331 * powerpc.cc (Relocate::relocate): Likewise.
12332 * sparc.cc (Relocate::relocate): Likewise.
12333 * x86_64.cc (Relocate::relocate): Likewise.
12334 * testsuite/weak_plt.sh: New test.
12335 * testsuite/weak_plt_main.cc: New test.
12336 * testsuite/weak_plt_shared.cc: New test.
12337 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12338 (check_PROGRAMS): Add weak_plt.
12339 (check_DATA): Add weak_plt_shared.so.
12340 (weak_plt_main_pic.o, weak_plt): New targets.
12341 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12342 * testsuite/Makefile.in: Rebuild.
12343
12344 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12345 gcctestdir/ld.
12346 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12347 * testsuite/Makefile.in: Rebuild.
12348
12349 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12350
12351 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12352 * Makefile.in: Regenerate.
12353 * po/POTFILES.in: Regenerate.
12354
12355 2008-07-29 Ian Lance Taylor <iant@google.com>
12356
12357 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12358 symbols before other symbols.
12359 * testsuite/script_test_2.cc (test_addr): Declare.
12360 (test_addr_alias): Declare.
12361 (main): Check that test_addr and test_addr_alias have the right
12362 values.
12363 * testsuite/script_test_2.t: Define test_addr_alias and
12364 test_addr.
12365
12366 2008-07-24 Ian Lance Taylor <iant@google.com>
12367
12368 PR 5990
12369 * descriptors.cc: New file.
12370 * descriptors.h: New file.
12371 * gold-threads.h (class Hold_optional_lock): New class.
12372 * fileread.cc: Include "descriptors.h".
12373 (File_read::~File_read): Release descriptor rather than closing
12374 it.
12375 (File_read::open) [file]: Call open_descriptor rather than open.
12376 Set is_descriptor_opened_.
12377 (File_read::open) [memory]: Assert that descriptor is not open.
12378 (File_read::reopen_descriptor): New function.
12379 (File_read::release): Release descriptor.
12380 (File_read::do_read): Make non-const. Reopen descriptor.
12381 (File_read::read): Make non-const.
12382 (File_read::make_view): Reopen descriptor.
12383 (File_read::do_readv): Likewise.
12384 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12385 Update declarations.
12386 * layout.cc: Include "descriptors.h".
12387 (Layout::create_build_id): Use open_descriptor rather than open.
12388 * output.cc: Include "descriptors.h".
12389 (Output_file::open): Use open_descriptor rather than open.
12390 * archive.cc (Archive::const_iterator): Change Archive to be
12391 non-const.
12392 (Archive::begin, Archive::end): Make non-const.
12393 (Archive::count_members): Likewise.
12394 * archive.h (class Archive): Update declarations.
12395 * object.h (Object::read): Make non-const.
12396 * Makefile.am (CCFILES): Add descriptors.cc.
12397 (HFILES): Add descriptors.h.
12398 * Makefile.in: Rebuild.
12399
12400 PR 6716
12401 * gold.h: Always include <clocale>. Add Solaris workarounds
12402 following code in binutils/sysdep.h.
12403
12404 PR 6048
12405 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12406 this->eh_frame_hdr_ is NULL before using it.
12407
12408 * dynobj.cc (Versions::Versions): Update comment.
12409
12410 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12411 the base version name.
12412
12413 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12414 array size plus one.
12415 (Stringpool_template::set_string_offsets): Subtract one from key
12416 before using it as an array index.
12417 (Stringpool_template::get_offset_with_length): Likewise.
12418 (Stringpool_template::write_to_buffer): Likewise.
12419 * stringpool.h (Stringpool_template::get_offset_from_key):
12420 Likewise.
12421
12422 2008-07-23 Ian Lance Taylor <iant@google.com>
12423
12424 PR 6658
12425 * object.h (Merged_symbol_value::value): Do our best to handle a
12426 negative addend.
12427
12428 PR 6647
12429 * script.cc (Version_script_info::get_versions): Don't add empty
12430 version tag to return value.
12431 (Version_script_info::get_symbol_version_helper): Change return
12432 type to bool. Add pversion parameter. Change all callers.
12433 (script_register_vers_node): Don't require a non-NULL tag.
12434 * script.h (class Version_script_info): Update declarations.
12435 (Version_script_info::get_symbol_version): Change return type to
12436 bool. Add version parameter. Change all callers.
12437 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12438 handling. Handle an empty version from a version script.
12439 (Symbol_table::define_special_symbol): Likewise.
12440 * testsuite/ver_test_10.script: New file.
12441 * testsuite/ver_test_10.sh: New file.
12442 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12443 (check_DATA): Add ver_test_10.syms.
12444 (ver_test_10.syms, ver_test_10.so): New target.
12445 * testsuite/Makefile.in: Rebuild.
12446
12447 2008-07-23 Simon Baldwin <simonb@google.com>
12448
12449 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12450 to zero for undefined symbols from dynamic libraries.
12451
12452 2008-07-23 Ian Lance Taylor <iant@google.com>
12453
12454 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12455 Change all callers.
12456 * symtab.h (class Symbol_table): Update declaration.
12457 * testsuite/ver_test_9.cc: New file.
12458 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12459 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12460 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12461 (ver_test_9.so, ver_test_9.o): New targets.
12462 * testsuite/Makefile.in: Rebuild.
12463
12464 2008-07-22 Ian Lance Taylor <iant@google.com>
12465
12466 * options.h (class General_options): Define --check-sections.
12467 * layout.cc (Layout::set_segment_offsets): Handle
12468 --check-sections.
12469
12470 * options.h (class General_options): Define -n/--nmagic and
12471 -N/--omagic.
12472 * options.cc (General_options::finalize): For -n/--nmagic or
12473 -N/--omagic, set -static.
12474 * layout.cc (Layout::attach_allocated_section_to_segment): If
12475 -N/--omagic, don't put read-only and read-write sections in
12476 different segments.
12477 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12478 finding a read-only segment.
12479 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12480 don't set the minimum segment alignment to the common page size,
12481 and don't set the file offset to the address modulo the page size.
12482 * script-sections.cc (Script_sections::create_segments): If
12483 -n/--omagic, don't put read-only and read-write sections in
12484 different segments.
12485
12486 * cref.cc: New file.
12487 * cref.h: New file.
12488 * options.h (class General_options): Add --print-symbol-counts.
12489 * main.cc (main): Issue defined symbol report if requested.
12490 * archive.cc (Archive::interpret_header): Make into a const member
12491 function.
12492 (Archive::add_symbols): Call Input_objects::archive_start and
12493 archive_stop.
12494 (Archive::const_iterator): Define new class.
12495 (Archive::begin, Archive::end): New functions.
12496 (Archive::include_all_members): Rewrite to use iterator.
12497 (Archive::count_members): New function.
12498 * archive.h (class Archive): Update declarations.
12499 (Archive::filename): New function.
12500 * object.cc: Include "cref.h".
12501 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12502 (Sized_relobj::do_get_global_symbol_counts): New function.
12503 (Input_objects::add_object): Add object to cross-referencer.
12504 (Input_objects::archive_start): New function.
12505 (Input_objects::archive_stop): New function.
12506 (Input_objects::print_symbol_counts): New function.
12507 * object.h: Declare Cref and Archive.
12508 (Object::get_global_symbol_counts): New function.
12509 (Object::do_get_global_symbol_counts): New pure virtual function.
12510 (class Sized_relobj): Add defined_count_ field. Update
12511 declarations.
12512 (class Input_objects): Add cref_ field. Update constructor.
12513 Update declarations.
12514 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12515 defined_count_.
12516 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12517 symbol counts.
12518 (Sized_dynobj::do_get_global_symbol_counts): New function.
12519 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12520 defined_count_. Update declarations. Define Symbols typedef.
12521 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12522 parameter. Change all callers.
12523 (Symbol_table::add_from_dynobj): Add sympointers and defined
12524 parameters. Change all callers.
12525 * symtab.h (class Symbol_table): Update declarations.
12526 * Makefile.am (CCFILES): Add cref.cc.
12527 (HFILES): Add cref.h.
12528 * Makefile.in: Rebuild.
12529
12530 2008-07-22 Simon Baldwin <simonb@google.com>
12531
12532 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12533 to zero when writing undefined symbols.
12534
12535 2008-07-22 Ian Lance Taylor <iant@google.com>
12536
12537 * output.cc (Output_section::add_input_section): Don't try to
12538 merge empty merge sections.
12539
12540 2008-07-21 Craig Silverstein <csilvers@google.com>
12541
12542 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12543 Include symbol version in error message.
12544
12545 2008-07-20 Chris Demetriou <cgd@google.com>
12546
12547 * configure.ac (gold_cv_c_random_seed): New configured variable.
12548 (RANDOM_SEED_CFLAGS): New substituted variable.
12549 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12550 * configure: Rebuild.
12551 * Makefile.in: Likewise.
12552 * testsuite/Makefile.in: Likewise.
12553
12554 2008-07-18 Ian Lance Taylor <iant@google.com>
12555
12556 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12557 where we see NAME/NULL and NAME/VERSION as separate symbols.
12558 * testsuite/ver_test_main.cc (main): Call t4.
12559 (t4, t4_2a): Define.
12560 * testsuite/ver_test_2.cc (t4_2): Define.
12561 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12562 * testsuite/ver_test_4.cc (t4_2a): Define.
12563 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12564 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12565
12566 2008-07-17 Ian Lance Taylor <iant@google.com>
12567
12568 * dynobj.cc (Versions::add_def): If we give an error about a
12569 missing version, go ahead and create the version anyhow.
12570
12571 2008-07-10 Ian Lance Taylor <iant@google.com>
12572
12573 Handle output sections with more than 0x7fffffff bytes.
12574 * object.h (class Relobj): Change map_to_output_ to
12575 output_sections_, and just keep a section pointer. Change all
12576 uses. Move comdat group support to Sized_relobj.
12577 (Relobj::is_section_specially_mapped): Remove.
12578 (Relobj::output_section): Remove poff parameter. Change all
12579 callers.
12580 (Relobj::output_section_offset): New function.
12581 (Relobj::set_section_offset): Rewrite.
12582 (Relobj::map_to_output): Remove.
12583 (Relobj::output_sections): New function.
12584 (Relobj::do_output_section_offset): New pure virtual function.
12585 (Relobj::do_set_section_offset): Likewise.
12586 (class Sized_relobj): Add section_offsets_ field. Add comdat
12587 group support from Relobj. Update declarations.
12588 (Sized_relobj::get_output_section_offset): New function.
12589 (Sized_relobj::do_output_section_offset): New function.
12590 (Sized_relobj::do_set_section_offset): New function.
12591 * object.cc (Relobj::output_section_address): Remove.
12592 (Sized_relobj::Sized_relobj): Initialize new fields.
12593 (Sized_relobj::include_section_group): Cast find_kept_object to
12594 Sized_relobj.
12595 (Sized_relobj::include_linkonce_section): Likewise.
12596 (Sized_relobj::do_layout): Use separate arrays for output section
12597 and output offset.
12598 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12599 output_sections.
12600 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12601 output_sections and section_offsets.
12602 (Sized_relobj::write_local_symbols): Likewise.
12603 (map_to_kept_section): Compute output address directly.
12604 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12605 output_sections and section_offsets.
12606 (Sized_relobj::write_sections): Likewise.
12607 (Sized_relobj::relocate_sections): Likewise.
12608 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12609 * output.h (class Output_reloc): Update declarations. Change
12610 u2_.relobj to Sized_relobj*.
12611 (class Output_data_reloc): Change add functions to use
12612 Sized_relobj*.
12613 * output.cc (Output_reloc::Output_reloc): Change relobj to
12614 Sized_relobj*.
12615 (Output_reloc::local_section_offset): Change return type to
12616 Elf_Addr. Use get_output_section_offset.
12617 (Output_reloc::get_address): Likewise.
12618 (Output_section::is_input_address_mapped): Don't call
12619 is_section_specially_mapped.
12620 (Output_section::output_offset): Likewise.
12621 (Output_section::output_address): Likewise.
12622 (Output_section::starting_output_address): Likewise.
12623 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12624 parameter to Sized_relobj*.
12625 (Copy_relocs::need_copy_reloc): Likewise.
12626 (Copy_relocs::save): Likewise.
12627 * copy-relocs.h (class Copy_relocs): Update declarations.
12628 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12629 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12630 * target-reloc.h (relocate_for_relocatable): Change
12631 offset_in_output_section type to Elf_Addr. Change code that uses
12632 it as well.
12633 * layout.cc (Layout::layout): Always set *off.
12634 * mapfile.cc (Mapfile::print_input_section): Use
12635 output_section_offset.
12636 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12637 Sized_relobj*.
12638 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12639 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12640 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12641
12642 2008-07-03 Ian Lance Taylor <iant@google.com>
12643
12644 * layout.cc (Layout::include_section): Do not discard unrecognized
12645 SHT_STRTAB sections.
12646
12647 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12648
12649 * script.cc (Lex::can_continue_name): Make '?' allowable in
12650 version-script names.
12651 * testsuite/version_script.map: Change glob pattern to use '?'
12652
12653 2008-06-30 Manish Singh <yosh@gimp.org>
12654
12655 PR 6585
12656 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12657 Correct typo.
12658
12659 2008-06-30 Ian Lance Taylor <iant@google.com>
12660
12661 PR 6660
12662 PR 6682
12663 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12664 versions]: Don't try to read the value in the contents, since we
12665 don't use it. Use the template endianness when writing.
12666
12667 2008-06-25 Cary Coutant <ccoutant@google.com>
12668
12669 * fileread.cc (File_read::make_view): Assert on zero-length view.
12670 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12671 symbol table when there are no symbols to read.
12672
12673 2008-06-23 Craig Silverstein <csilvers@google.com>
12674
12675 * version.cc (version_string): Bump to 1.7
12676
12677 2008-06-18 Craig Silverstein <csilvers@google.com>
12678
12679 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12680 constant 0xFFFF to type Valtype.
12681 (Powerpc_relocate_functions::rel16_ha): Likewise.
12682
12683 2008-06-17 Ian Lance Taylor <iant@google.com>
12684
12685 * output.h (Output_section::Input_section): Initialize p2align_ to
12686 zero for Output_section_data constructors.
12687 (Output_section::Input_section::addralign): If not an input
12688 section, return the alignment of the Output_section_data.
12689 * testsuite/copy_test.cc: New file.
12690 * testsuite/copy_test_1.cc: New file.
12691 * testsuite/copy_test_2.cc: New file.
12692 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12693 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12694 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12695 (copy_test_1_pic.o, copy_test_1.so): New targets.
12696 (copy_test_2_pic.o, copy_test_2.so): New targets.
12697 * testsuite/Makefile.in: Rebuild.
12698
12699 * script-sections.cc (Script_sections::place_orphan): Initialize
12700 local variable exact.
12701
12702 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12703
12704 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12705
12706 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12707 David S. Miller <davem@davemloft.net>
12708
12709 * powerpc.cc: New file.
12710 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12711 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12712 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12713 * Makefile.in: Rebuild.
12714
12715 2008-06-09 Ian Lance Taylor <iant@google.com>
12716
12717 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12718 <exception>.
12719 (throwing, orig_terminate): New static variables.
12720 (terminate_handler): New static function.
12721 (t2): Set terminate handler.
12722
12723 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12724
12725 PR 6584
12726 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12727 alignment.
12728
12729 2008-05-30 Cary Coutant <ccoutant@google.com>
12730
12731 * archive.cc (Archive::include_all_members) Correct to step
12732 over symbol table and extended name table in thin archives.
12733
12734 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12735
12736 PR 6407
12737 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12738 calculation.
12739
12740 2008-05-28 Caleb Howe <cshowe@google.com>
12741
12742 * reduced_debug_output.cc: New file.
12743 * reduced_debug_output.h: New file.
12744 * options.h (class General_options): Add --strip-debug-non-line.
12745 * options.cc (General_options::finalize): Add strip_debug_non_line
12746 to the strip heirarchy.
12747 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12748 fields.
12749 * layout.cc: Include "reduced_debug_output.h".
12750 (Layout::Layout): Initialize new fields.
12751 (line_only_debug_sections): New static array.
12752 (is_lines_only_debug_sections): New static inline function.
12753 (Layout::include_section): Handle --strip-debug-non-line.
12754 (Layout::make_output_section): If --strip-debug-non-line, build
12755 new output sections for .debug_abbrev and .debug_info.
12756 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12757 gold. Warn about possible overflow.
12758 (read_signed_LEB_128): Likewise.
12759 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12760 (read_signed_LEB_128): Declare.
12761 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12762 (HFILES): Add reduced_debug_output.h.
12763 * Makefile.in: Rebuild.
12764
12765 2008-05-21 Ian Lance Taylor <iant@google.com>
12766
12767 * mapfile.cc: New file.
12768 * mapfile.h: New file.
12769 * options.h (class General_options): Add -M/--print-map and -Map.
12770 * options.cc (General_options::finalize): Make -M equivalent to
12771 -Map -.
12772 * main.cc: Include <cstdio> and "mapfile.h".
12773 (main): Open mapfile if requested.
12774 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12775 constructor. Change caller.
12776 (queue_initial_tasks): Add mapfile parameter. Change caller.
12777 (queue_middle_tasks): Likewise.
12778 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12779 declarations.
12780 * archive.cc: Include "mapfile.h".
12781 (Archive::add_symbols): Add mapfile parameter. Change all
12782 callers. Pass mapfile, symbol, and reason to include_member.
12783 (Archive::include_all_members): Add mapfile parameter. Change all
12784 callers.
12785 (Archive::include_member): Add mapfile, sym, and why parameters.
12786 Change all callers. Report inclusion to map file.
12787 * archive.h: Include "fileread.h".
12788 (class Archive): Update declarations.
12789 (Archive::file): New const method.
12790 (class Add_archive_symbols): Add mapfile_ field. Update
12791 constructor. Change all callers.
12792 * readsyms.h (class Read_symbols): Likewise.
12793 (class Finish_group): Likewise.
12794 (class Read_script): Likewise.
12795 * common.cc: Include "mapfile.h".
12796 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12797 all callers.
12798 (Symbol_table::do_allocate_commons): Likewise.
12799 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12800 symbol allocation to mapfile.
12801 * common.h (class Allocate_commons_task): Add mapfile_ field.
12802 Update constructor. Change all callers.
12803 * symtab.h (class Symbol_table): Update declarations.
12804 * layout.cc: Include "mapfile.h".
12805 (Layout_task_runner::run): Print information to mapfile.
12806 (Layout::create_gold_note): Change Output_data_fixed_space to
12807 Output_data_zero_fill.
12808 (Layout::create_build_id): Likewise.
12809 (Layout::print_to_mapfile): New function.
12810 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12811 constructor. Change caller.
12812 (class Layout): Declare print_to_mapfile.
12813 * output.cc (Output_section::Input_section::print_to_mapfile): New
12814 function.
12815 (Output_section::add_input_section): If producing a map, always
12816 add to input_sections_ list.
12817 (Output_section::do_print_to_mapfile): New function.
12818 (Output_segment::print_sections_to_mapfile): New function.
12819 (Output_segment::print_section_list_to_mapfile): New function.
12820 * output.h: Include "mapfile.h".
12821 (Output_data::print_to_mapfile): New function.
12822 (Output_data::do_print_to_mapfile): New virtual function.
12823 (Output_segment_headers::do_print_to_mapfile): New function.
12824 (Output_file_header::do_print_to_mapfile): New function.
12825 (Output_data_const::do_print_to_mapfile): New function.
12826 (class Output_data_const_buffer): Add map_name_ field. Update
12827 constructor. Change all callers. Add do_print_to_mapfile
12828 function.
12829 (class Output_data_fixed_space): Likewise.
12830 (class Output_data_space): Likewise.
12831 (class Output_data_zero_fill): New class.
12832 (Output_data_strtab::do_print_to_mapfile): New function.
12833 (Output_data_reloc_base::do_print_to_mapfile): New function.
12834 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12835 (Output_data_group::do_print_to_mapfile): New function.
12836 (Output_data_got::do_print_to_mapfile): New function.
12837 (Output_data_dynamic::do_print_to_mapfile): New function.
12838 (Output_symtab_xindex::do_print_to_mapfile): New function.
12839 (class Output_section): Declare do_print_to_mapflie. Declare
12840 print_to_mapfile in Input_section.
12841 (class Output_segment): Declare new functions.
12842 * object.h (Sized_relobj::symbol_count): New function.
12843 * script-sections.cc
12844 (Output_section_element_dot_assignment::set_section_addresses):
12845 Change Output_data_fixed_space to Output_data_zero_fill.
12846 (Output_data_expression::do_print_to_mapfile): New function.
12847 * script.cc (read_input_script): Add mapfile parameter. Change
12848 all callers.
12849 * script.h (read_input_script): Update declaration.
12850 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12851 (Eh_frame::do_print_to_mapfile): New function.
12852 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12853 (Output_merge_string::do_print_to_mapfile): New function.
12854 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12855 function.
12856 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12857 function.
12858 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12859 function.
12860 * Makefile.am (CCFILES): Add mapfile.cc.
12861 (HFILES): Add mapfile.h.
12862 * Makefile.in: Rebuild.
12863
12864 2008-05-19 Ian Lance Taylor <iant@google.com>
12865
12866 * options.h (class General_options): Add -z relro.
12867 * layout.cc (Layout::Layout): Initialize relro_segment_.
12868 (Layout::add_output_section_data): Return the output section.
12869 (Layout::make_output_section): Rcognize relro sections and mark
12870 them appropriately.
12871 (Layout::attach_allocated_section_to_segment): Put relro sections
12872 in a PT_GNU_RELRO segment.
12873 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12874 section as relro.
12875 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12876 PT_TLS segments.
12877 (Layout::linkonce_mapping): Map d.rel.ro.local to
12878 .data.rel.ro.local.
12879 (Layout::output_section_name): Us .data.rel.ro.local for any
12880 section which begins with that.
12881 * layout.h (class Layout): Update add_output_section_data
12882 declaration. Add relro_segment_ field.
12883 * output.cc (Output_section::Output_section): Initialize is_relro_
12884 and is_relro_local_ fields.
12885 (Output_segment::add_output_section): Group relro sections.
12886 (Output_segment::is_first_section_relro): New function.
12887 (Output_segment::maximum_alignment): If there is a relro section,
12888 align the segment to the common page size.
12889 (Output_segment::set_section_addresses): Track whether we are
12890 looking at relro sections. If the last section is a relro
12891 section, align to the common page size.
12892 (Output_segment::set_section_list_addresses): Add in_relro
12893 parameter. Change all callers. Align to the page size when
12894 moving from relro to non-relro section.
12895 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12896 segment.
12897 * output.h (class Output_section): Add is_relro_ and
12898 is_relro_local_ fields.
12899 (Output_section::is_relro): New function.
12900 (Output_section::set_is_relro): New function.
12901 (Output_section::is_relro_local): New function.
12902 (Output_section::set_is_relro_local): New function.
12903 (class Output_segment): Update declarations.
12904 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12905 * sparc.cc (Target_sparc::got_section): Likewise.
12906 * x86_64.cc (Target_x86_64::got_section): Likewise.
12907 * testsuite/relro_test_main.cc: New file.
12908 * testsuite/relro_test.cc: New file.
12909 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12910 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12911 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12912 (relro_test.so, relro_test_pic.o): New targets.
12913 * testsuite/Makefile.in: Rebuild.
12914
12915 2008-05-16 Ian Lance Taylor <iant@google.com>
12916
12917 * output.cc (Output_segment::add_output_section): Remove front
12918 parameter.
12919 * output.h (class Output_segment): Remove
12920 add_initial_output_section and overloaded add_output_section.
12921 Update declaration of remaining add_output_section.
12922 * layout.cc (Layout::create_interp): Call add_output_section
12923 rather than add_initial_output_section.
12924 (Layout::finish_dynamic_section): Likewise.
12925
12926 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12927 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12928 know the dynamic type.
12929 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12930 field. Initialize it in constructor.
12931 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12932 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12933 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12934 reloc.
12935
12936 * output.cc (Output_reloc::get_address): Change return type to
12937 Elf_Addr.
12938 * output.h (class Output_reloc): Update get_address declaration.
12939 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12940 for section addresses.
12941
12942 2008-05-09 Ian Lance Taylor <iant@google.com>
12943
12944 PR 6493
12945 * gold.cc (gold_nomem): Use return value of write.
12946
12947 2008-05-08 Ian Lance Taylor <iant@google.com>
12948
12949 * symtab.c (Symbol::init_base_output_data): Add version
12950 parameter. Change all callers.
12951 (Symbol::init_base_output_segment): Likewise.
12952 (Symbol::init_base_constant): Likewise.
12953 (Symbol::init_base_undefined): Likewise.
12954 (Sized_symbol::init_output_data): Likewise.
12955 (Sized_symbol::init_output_segment): Likewise.
12956 (Sized_symbol::init_constant): Likewise.
12957 (Sized_symbol::init_undefined): Likewise.
12958 (Symbol_table::do_define_in_output_data): If the new symbol has a
12959 version, mark it as the default.
12960 (Symbol_table::do_define_in_output_segment): Likewise.
12961 (Symbol_table::do_define_as_constant): Likewise.
12962 * symtab.h (class Symbol): Update declarations.
12963 (class Sized_symbol): Likewise.
12964 * resolve.cc (Symbol::override_version): New function.
12965 (Symbol::override_base): Call override_version.
12966 (Symbol::override_base_with_special): Likewise.
12967 * testsuite/ver_script_8.script: New file.
12968 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12969 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12970 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12971 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12972
12973 2008-05-06 Ian Lance Taylor <iant@google.com>
12974
12975 PR 6049
12976 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12977 functions.
12978 (class General_options): Remove existing --undefined, and add
12979 --no-undefined instead. Add new --undefined as synonym for -u.
12980 * archive.cc (Archive::add_symbols): Check whether symbol was
12981 named with -u.
12982 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12983 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12984 all uses. Add IS_UNDEFINED. Update declarations to split
12985 different versions of init_base. Declare init_base_undefined.
12986 (Symbol::is_defined): Handle IS_UNDEFINED.
12987 (Symbol::is_undefined): Likewise.
12988 (Symbol::is_weak_undefined): Call is_undefined.
12989 (Symbol::is_absolute): Handle IS_CONSTANT.
12990 (class Sized_symbol): Update declarations to split different
12991 versions of init. Declare init_undefined.
12992 (class Symbol_table): Declare new functions.
12993 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12994 Change all callers.
12995 (Symbol::init_base_output_data): Likewise.
12996 (Symbol::init_base_output_segment): Likewise.
12997 (Symbol::init_base_constant): Likewise.
12998 (Symbol::init_base_undefined): New function.
12999 (Sized_symbol::init_object): Rename from init. Change all
13000 callers.
13001 (Sized_symbol::init_output_data): Likewise.
13002 (Sized_symbol::init_output_segment): Likewise.
13003 (Sized_symbol::init_constant): Likewise.
13004 (Sized_symbol::init_undefined): New function.
13005 (Symbol_table::add_undefined_symbols_from_command_line): New
13006 function.
13007 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13008 function.
13009 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13010 (Symbol::output_section): Likewise.
13011 (Symbol::set_output_section): Likewise.
13012 (Symbol_table::sized_finalize_symbol): Likewise.
13013 (Symbol_table::sized_write_globals): Likewise.
13014 * resolve.cc (Symbol_table::should_override): Likewise.
13015 (Symbol::override_base_with_special): Likewise.
13016
13017 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13018 symbol, change it to have default visibility.
13019 * testsuite/protected_1.cc: New file.
13020 * testsuite/protected_2.cc: New file.
13021 * testsuite/protected_3.cc: New file.
13022 * testsuite/protected_main_1.cc: New file.
13023 * testsuite/protected_main_2.cc: New file.
13024 * testsuite/protected_main_3.cc: New file.
13025 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13026 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13027 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13028 (protected_1.so): New target.
13029 (protected_1_pic.o, protected_2_pic.o): New targets.
13030 (protected_3_pic.o): New target.
13031 (check_PROGRAMS): Add protected_2.
13032 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13033 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13034 * testsuite/Makefile.in: Rebuild.
13035
13036 * options.h (DEFINE_var): Add set_user_set_##varname__.
13037 (DEFINE_bool_alias): New macro.
13038 (class General_options): Define -Bstatic using DEFINE_bool_alias
13039 rather than DEFINE_special. Add --undefined as an alias for -z
13040 defs.
13041 * options.cc (General_options::parse_Bstatic): Remove.
13042
13043 * options.h (class General_options): Add --fatal-warnings.
13044 * main.cc (main): Implement --fatal-warnings.
13045 * errors.h (Errors::warning_count): New function.
13046
13047 * options.h (class General_options): Add -Bsymbolic-functions.
13048 * symtab.h (Symbol::is_preemptible): Check for
13049 -Bsymbolic-functions.
13050
13051 2008-05-05 Ian Lance Taylor <iant@google.com>
13052
13053 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13054 as noVARNAME rather than no-VARNAME.
13055 (class General_options): Add option -z combreloc.
13056 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13057 get_address.
13058 (Output_reloc::sort_before) [SHT_REL]: New function.
13059 (Output_reloc::sort_before) [SHT_RELA]: New function.
13060 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13061 Sort_relocs_comparison.
13062 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13063 parameter. Change all callers.
13064 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13065 sort_relocs parameter. Change all callers.
13066 * output.cc (Output_reloc::get_address): New function, broken out
13067 of write_rel.
13068 (Output_reloc::write_rel): Call it.
13069 (Output_reloc::compare): New function.
13070 (Output_data_reloc_base::do_write): Optionally sort relocs.
13071
13072 * configure.ac: If targ_extra_obj is set, link it in.
13073 * configure.tgt: Initialize all variables.
13074 (x86_64*): Set targ_extra_obj and targ_extra_size.
13075 * configure: Rebuild.
13076
13077 * object.cc (Sized_relobj::include_section_group): Adjust section
13078 indexes read from group data. Build vector to pass to
13079 layout_group.
13080 * layout.cc (Layout::layout_group): Add flags and shndxes
13081 parameters. Remove contents parameter. Change caller. Update
13082 explicit instantiations.
13083 * layout.h (class Layout): Update layout_group declaration.
13084 * output.cc (Output_data_group::Output_data_group): Add flags and
13085 input_shndxes parameters. Remove contents parameter. Change
13086 caller.
13087 (Output_data_group::do_write): Change input_sections_ to
13088 input_shndxes_.
13089 * output.h (class Output_data_group): Update constructor
13090 declaration. Rename input_sections_ to input_shndxes_.
13091 * testsuite/many_sections_test.cc: Add template.
13092
13093 2008-04-30 Cary Coutant <ccoutant@google.com>
13094
13095 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13096
13097 * layout.cc (Layout::include_section): Refactored check for debug
13098 info section.
13099 (Layout::add_comdat): Add new parameters. Change type
13100 of signature parameter. Add object and shndx to signatures table.
13101 (Layout::find_kept_object): New function.
13102 * layout.h: Include <cstring>.
13103 (Layout::is_debug_info_section): New function.
13104 (Layout::add_comdat): Add new parameters.
13105 (Layout::find_kept_object): New function.
13106 (Layout::Kept_section): New struct.
13107 (Layout::Signatures): Change type of map range.
13108 * object.cc (Relobj::output_section_address): New function.
13109 (Sized_relobj::include_section_group): Add new parameters. Change
13110 calls to Layout::add_comdat. Change to build table of kept comdat
13111 groups and table mapping discarded sections to kept sections.
13112 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13113 (Sized_relobj::do_layout): Change calls to include_section_group and
13114 include_linkonce_section.
13115 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13116 value to zero when section is discarded.
13117 (Sized_relobj::map_to_kept_section): New function.
13118 * object.h (Relobj::output_section_address): New function.
13119 (Relobj::Comdat_group): New type.
13120 (Relobj::find_comdat_group): New function.
13121 (Relobj::Comdat_group_table): New type.
13122 (Relobj::Kept_comdat_section): New type.
13123 (Relobj::Kept_comdat_section_table): New type.
13124 (Relobj::add_comdat_group): New function.
13125 (Relobj::set_kept_comdat_section): New function.
13126 (Relobj::get_kept_comdat_section): New function.
13127 (Relobj::comdat_groups_): New field.
13128 (Relobj::kept_comdat_sections_): New field.
13129 (Symbol_value::input_value): Update comment.
13130 (Sized_relobj::map_to_kept_section) New function.
13131 (Sized_relobj::include_linkonce_section): Add new parameter.
13132 * target-reloc.h (Comdat_behavior): New type.
13133 (get_comdat_behavior): New function.
13134 (relocate_section): Add code to map a discarded section to the
13135 corresponding kept section when applying a relocation.
13136
13137 2008-04-30 Craig Silverstein <csilvers@google.com>
13138
13139 * dwarf_reader.cc (next_generation_count): New static var.
13140 (Addr2line_cache_entry): New struct.
13141 (addr2line_cache): New static var.
13142 (Dwarf_line_info::one_addr2line): Added caching.
13143 (Dwarf_line_info::clear_addr2line_cache): New function.
13144 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13145 cache-size parameter.
13146 (Dwarf_line_info::one_addr2line_cache): New function.
13147 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13148 new cache-size argument to one_addr2line(), and clear cache.
13149
13150 2008-04-28 Cary Coutant <ccoutant@google.com>
13151
13152 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13153 R_386_PC8 relocations.
13154
13155 2008-04-23 Ian Lance Taylor <iant@google.com>
13156
13157 * object.cc (Sized_relobj::include_section_group): Check for
13158 invalid section group.
13159
13160 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13161 header size.
13162
13163 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13164 than read for file header.
13165 * archive.cc (Archive::include_member): Likewise.
13166
13167 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13168
13169 * aclocal.m4: Regenerate.
13170 * configure: Regenerate.
13171
13172 2008-04-19 Ian Lance Taylor <iant@google.com>
13173
13174 * version.cc (version_string): Bump to 1.6.
13175
13176 * testsuite/Makefile.am (many_sections_r_test): New target.
13177 (many_sections_r_test_SOURCES): Remove.
13178 (many_sections_r_test_DEPENDENCIES): Remove.
13179 (many_sections_r_test_LDFLAGS): Remove.
13180 (many_sections_r_test_LDADD): Remove.
13181
13182 * object.cc (Sized_relobj::do_add_symbols): Always pass
13183 local_symbol_count_ to add_from_relobj.
13184
13185 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13186 every thousand variables.
13187 * testsuite/Makefile.in: Rebuild.
13188
13189 * object.cc (Xindex::initialize_symtab_xindex): New function.
13190 (Xindex::read_symtab_xindex): New function.
13191 (Xindex::sym_xindex_to_shndx): New function.
13192 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13193 available.
13194 (Sized_relobj::do_initialize_xindex): New function.
13195 (Sized_relobj::do_read_symbols): Adjust section links.
13196 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13197 parameter. Change all callers.
13198 (Sized_relobj::include_section_group): Adjust section links and
13199 symbol section indexes.
13200 (Sized_relobj::do_layout): Adjust section links.
13201 (Sized_relobj::do_count_local_symbols): Adjust section links and
13202 symbol section indexes.
13203 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13204 ordinary and special symbols.
13205 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13206 dynsym_xindex parameters. Change all callers. Adjust section
13207 links. Use SHN_XINDEX when needed.
13208 (Sized_relobj::get_symbol_location_info): Adjust section links.
13209 Don't get fooled by special symbols.
13210 * object.h (class Xindex): Define.
13211 (class Object): Add xindex_ parameter. Declare virtual functoin
13212 do_initialize_xindex.
13213 (Object::adjust_sym_shndx): New function.
13214 (Object::set_xindex): New protected function.
13215 (class Symbol_value): Add is_ordinary_shndx_ field.
13216 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13217 (Symbol_value::value): Assert ordinary section.
13218 (Symbol_value::initialize_input_to_output_map): Likewise.
13219 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13220 Change all callers.
13221 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13222 all callers.
13223 (class Sized_relobj): Update declarations.
13224 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13225 parameter. Change all callers.
13226 (Sized_relobj::adjust_shndx): New function.
13227 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13228 field.
13229 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13230 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13231 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13232 (Sized_dynobj::read_dynsym_section): Adjust section links.
13233 (Sized_dynobj::read_dynamic): Likewise.
13234 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13235 section links.
13236 (Sized_dynobj::do_initialize_xindex): New function.
13237 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13238 do_initialize_xindex.
13239 (Sized_dynobj::adjust_shndx): New function.
13240 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13241 dynsym_xindex_ fields.
13242 (Layout::finalize): Add a call to set_section_indexes before
13243 creating the symtab sections.
13244 (Layout::set_section_indexes): Don't do anything if the section
13245 already has a section index.
13246 (Layout::create_symtab_sections): Add shnum parameter. Change
13247 caller. Create .symtab_shndx section if needed.
13248 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13249 caller.
13250 (Layout::allocated_output_section_count): New function.
13251 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13252 needed.
13253 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13254 fields. Update declarations.
13255 (Layout::symtab_xindex): New function.
13256 (Layout::dynsym_xindex): New function.
13257 (class Write_symbols_task): Add layout_ field.
13258 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13259 Change caller.
13260 * output.cc (Output_section_headers::Output_section_headers): Add
13261 shstrtab_section parameter. Change all callers.
13262 (Output_section_headers::do_sized_write): Store overflow values
13263 for section count and section string table section index in
13264 section header zero.
13265 (Output_file_header::do_sized_write): Check for overflow of
13266 section count and section string table section index.
13267 (Output_symtab_xindex::do_write): New function.
13268 (Output_symtab_xindex::endian_do_write): New function.
13269 * output.h (class Output_section_headers): Add shstrtab_section_.
13270 Update declarations.
13271 (class Output_symtab_xindex): Define.
13272 (Output_section::has_out_shndx): New function.
13273 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13274 field.
13275 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13276 Change all callers.
13277 (Sized_symbol::init): Likewise.
13278 (Symbol::output_section): Check for ordinary symbol.
13279 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13280 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13281 callers.
13282 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13283 Change all callers. Simplify handling of symbols from sections
13284 not included in the link.
13285 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13286 distinction.
13287 (Weak_alias_sorter::operator()): Assert that symbols are
13288 ordinary.
13289 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13290 distinction.
13291 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13292 parameters. Change all callers.
13293 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13294 symbol distinction. Use SHN_XINDEX when needed.
13295 (Symbol_table::write_section_symbol): Add symtab_xindex
13296 parameter. Change all callers.
13297 (Symbol_table::sized_write_section_symbol): Likewise. Use
13298 SHN_XINDEX when needed.
13299 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13300 declarations.
13301 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13302 (Symbol::is_defined): Check is_ordinary.
13303 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13304 (Symbol::is_absolute, Symbol::is_common): Likewise.
13305 (class Sized_symbol): Update declarations.
13306 (class Symbol_table): Update declarations.
13307 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13308 parameters. Change all callers.
13309 (Sized_symbol::override): Likewise.
13310 (Symbol_table::override): Likewise.
13311 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13312 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13313 is_ordinary, and orig_st_shndx parameters. Change all callers.
13314 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13315 to be in an ordinary section.
13316 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13317 object and is_ordinary parameters. Change all callers.
13318 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13319 Change all callers. Don't add undefined or non-ordinary symbols
13320 to reloc_map_.
13321 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13322 Change all callers.
13323 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13324 declarations.
13325 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13326 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13327 (Sized_relobj::relocate_sections): Likewise.
13328 * target-reloc.h (scan_relocs): Adjust section symbol index.
13329 (scan_relocatable_relocs): Likewise.
13330 * i386.cc (Scan::local): Check for ordinary symbols.
13331 * sparc.cc (Scan::local): Likewise.
13332 * x86_64.cc (Scan::local): Likewise.
13333 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13334 to symbol_section_and_value.
13335 * testsuite/many_sections_test.cc: New file.
13336 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13337 (check_PROGRAMS): Add many_sections_test.
13338 (many_sections_test_SOURCES): Define.
13339 (many_sections_test_DEPENDENCIES): Define.
13340 (many_sections_test_LDFLAGS): Define.
13341 (BUILT_SOURCES): Add many_sections_define.h.
13342 (many_sections_define.h): New target.
13343 (BUILT_SOURCES): Add many_sections_check.h.
13344 (many_sections_check.h): New target.
13345 (check_PROGRAMS): Add many_sections_r_test.
13346 (many_sections_r_test_SOURCES): Define.
13347 (many_sections_r_test_DEPENDENCIES): Define.
13348 (many_sections_r_test_LDFLAGS): Define.
13349 (many_sections_r_test_LDADD): Define.
13350 (many_sections_r_test.o): New target.
13351 * testsuite/Makefile.in: Rebuild.
13352
13353 2008-04-17 Cary Coutant <ccoutant@google.com>
13354
13355 * errors.cc (Errors::info): New function.
13356 (gold_info): New function.
13357 * errors.h (Errors::info): New function.
13358 * gold.h (gold_info): New function.
13359 * object.cc (Input_objects::add_object): Print trace output.
13360 * options.cc (options::parse_set): New function.
13361 (General_options::parse_wrap): Deleted.
13362 (General_options::General_options): Deleted initializer.
13363 * options.h (options::String_set): New typedef.
13364 (options::parse_set): New function.
13365 (DEFINE_set): New macro.
13366 (General_options::wrap): Changed to use DEFINE_set. Changed
13367 callers of any_wrap_symbols and is_wrap_symbol.
13368 (General_options::trace, General_options::trace_symbol):
13369 New options.
13370 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13371 (General_options::wrap_symbols_): Deleted.
13372 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13373
13374 2008-04-17 David S. Miller <davem@davemloft.net>
13375
13376 * options.cc (General_options::parse_V): New function.
13377 * options.h: Add entries for -V and -Qy.
13378
13379 2008-04-17 Ian Lance Taylor <iant@google.com>
13380
13381 * common.cc (Symbol_table::allocate_commons): Remove options
13382 parameter. Change caller.
13383 (Symbol_table::do_allocate_commons): Remove options parameter.
13384 Change caller. Just call do_allocate_commons_list twice.
13385 (Symbol_table::do_allocate_commons_list): New function, broken out
13386 of do_allocate_commons.
13387 * common.h (class Allocate_commons_task): Remove options_ field.
13388 Update constructor.
13389 * symtab.cc (Symbol_table::Symbol_table): Initialize
13390 tls_commons_.
13391 (Symbol_table::add_from_object): Put TLS common symbols on
13392 tls_commons_ list.
13393 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13394 which are IN_OUTPUT_DATA.
13395 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13396 allocate_commons and do_allocate_commons declarations. Declare
13397 do_allocate_commons_list.
13398 * gold.cc (queue_middle_tasks): Update creation of
13399 Allocate_commons_task to not pass options.
13400 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13401 (TLS_TEST_C_FLAGS): New variable.
13402 (tls_test_c_pic.o): New target.
13403 (tls_test_shared.so): Link in tls_test_c_pic.o.
13404 (tls_test_c_pic_ie.o): New target.
13405 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13406 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13407 (tls_test_c.o): New target.
13408 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13409 (tls_pic_test_LDADD): Likewise.
13410 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13411 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13412 (tls_test_c_gnu2.o): New target.
13413 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13414 tls_test_c_gnu2.o.
13415 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13416 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13417 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13418 * testsuite/tls_test.cc: Include "config.h".
13419 (t_last): Call t11_last.
13420 * testsuite/tls_test.h (t11, t11_last): Declare.
13421 * testsuite/tls_test_c.c: New file.
13422 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13423 * configure.ac: Check for OpenMP support.
13424 * configure, config.in, Makefile.in: Rebuild.
13425 * testsuite/Makefile.in: Rebuild.
13426
13427 2008-04-16 Cary Coutant <ccoutant@google.com>
13428
13429 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13430 (Target_i386::tls_base_symbol_defined_): New field.
13431 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13432 (Target_i386::Scan::global): Likewise.
13433 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13434 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13435 (Target_x86_64::tls_base_symbol_defined_): New field.
13436 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13437 (Target_x86_64::Scan::global): Likewise.
13438
13439 2008-04-16 Cary Coutant <ccoutant@google.com>
13440
13441 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13442 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13443 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13444 building shared libraries.
13445 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13446 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13447 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13448 * testsuite/Makefile.in: Rebuild.
13449 * testsuite/weak_undef.h: New file.
13450 * testsuite/weak_undef_file1.cc: Add extra test cases.
13451 * testsuite/weak_undef_file2.cc: Likewise.
13452 * testsuite/weak_undef_test.cc: Likewise.
13453
13454 2008-04-16 David S. Miller <davem@davemloft.net>
13455
13456 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13457 Add issued_non_pic_error_ field. Declare check_non_pic.
13458 (Target_sparc::Scan::check_non_pic): New function.
13459 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13460 (Target_sparc::Scan::global): Likewise.
13461
13462 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13463 * configure: Rebuild.
13464
13465 * options.h (DEFINE_enable): New macro.
13466 (new_dtags): New enable option.
13467 (initfirst, interpose, loadfltr, nodefaultlib,
13468 nodelete, nodlopen, nodump): New -z options.
13469 * layout.cc (Layout:finish_dynamic_section): If new
13470 dtags enabled, emit DT_RUNPATH. Also, emit a
13471 DT_FLAGS_1 containing any specified -z flags.
13472
13473 2008-04-16 Ian Lance Taylor <iant@google.com>
13474
13475 * copy-relocs.cc: New file.
13476 * copy-relocs.h: New file.
13477 * reloc.cc: Remove Copy_relocs code.
13478 * reloc.h: Likewise.
13479 * reloc-types.h (struct Reloc_types) [both versions]: Add
13480 get_reloc_addend_noerror.
13481 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13482 variants of add_global which take an addend which must be zero.
13483 * i386.cc: Include "copy-relocs.h".
13484 (class Target_i386): Change type of copy_relocs_ to variable,
13485 update initializer.
13486 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13487 Change all callers.
13488 (Target_i386::do_finalize_sections): Change handling of
13489 copy_relocs_.
13490 * sparc.cc: Include "copy-relocs.h".
13491 (class Target_sparc): Change type of copy_relocs_ to variable,
13492 update initializer.
13493 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13494 Change all callers.
13495 (Target_sparc::do_finalize_sections): Change handling of
13496 copy_relocs_.
13497 * x86_64.cc: Include "copy-relocs.h".
13498 (class Target_x86_64): Change type of copy_relocs_ to variable,
13499 update initializer.
13500 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13501 class. Change all callers.
13502 (Target_x86_64::do_finalize_sections): Change handling of
13503 copy_relocs_.
13504 * Makefile.am (CCFILES): Add copy-relocs.cc.
13505 (HFILES): Add copy-relocs.h.
13506
13507 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13508
13509 * testsuite/script_test_4.sh: Permit leading zeroes.
13510
13511 2008-04-15 Ian Lance Taylor <iant@google.com>
13512
13513 * script-sections.cc (Script_sections::create_segments): Use
13514 header_size_adjustment even when there is enough room for the
13515 headers.
13516 * testsuite/script_test_4.sh: New file.
13517 * testsuite/script_test_4.t: New file.
13518 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13519 (check_DATA): Add script_test_4.stdout.
13520 (MOSTLYCLEANFILES): Likewise.
13521 (script_test_4): New target.
13522 (script_test_4.stdout): New target.
13523 * testsuite/Makefile.in: Rebuild.
13524
13525 * sparc.cc: Add definitions for Output_data_plt_sparc class
13526 constants.
13527
13528 2008-04-14 David S. Miller <davem@davemloft.net>
13529
13530 * sparc.cc: New file.
13531 * Makefile.am (TARGETSOURCES): Add sparc.cc
13532 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13533 * configure.tgt: Document targ_extra_size and
13534 targ_extra_big_endian. Add entries for sparc-* and
13535 sparc64-*.
13536 * configure.ac: Handle targ_extra_size and
13537 targ_extra_big_endian.
13538 * Makefile.in: Rebuild.
13539 * configure: Likewise.
13540 * po/POTFILES.in: Likewise.
13541 * po/gold.pot: Likewise.
13542
13543 2008-04-14 Ian Lance Taylor <iant@google.com>
13544
13545 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13546 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13547 in the name/type/flags to section mapping. Don't call
13548 allocate_output_section.
13549 (Layout::choose_output_section): Change parameter from adjust_name
13550 to is_input_section. Don't permit input sections after sections
13551 are attached to segments. Don't call allocate_output_section.
13552 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13553 not write_enable_output_section.
13554 (Layout::make_output_section): Don't push to
13555 unattached_section_list_ nor call attach_to_segment. Call
13556 attach_section_to_segment if sections are attached.
13557 (Layout::attach_sections_to_segments): New function.
13558 (Layout::attach_section_to_segment): New function.
13559 (Layout::attach_allocated_section_to_segment): Rename from
13560 attach_to_segment. Remove flags parameter.
13561 (Layout::allocate_output_section): Remove function.
13562 (Layout::write_enable_output_section): Remove function.
13563 * layout.h (class Layout): Update for above changes. Add new
13564 field sections_are_attached_.
13565 * output.h (Output_section::update_flags_for_input_section): New
13566 function.
13567 * output.cc (Output_section::add_input_section): Call
13568 update_flags_for_input_section.
13569 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13570
13571 2008-04-11 Cary Coutant <ccoutant@google.com>
13572
13573 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13574 thought unnecessary.
13575 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13576
13577 2008-04-11 Ian Lance Taylor <iant@google.com>
13578
13579 * output.h (class Output_section_data): Remove inline definition
13580 of set_addralign.
13581 * output.cc (Output_section_data::set_addralign): New function.
13582
13583 2008-04-11 Cary Coutant <ccoutant@google.com>
13584
13585 Add support for TLS descriptors for i386 and x86_64.
13586 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13587 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13588 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13589 GOT_TYPE_TLS_DESC.
13590 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13591 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13592 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13593 relocations.
13594 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13595 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13596 Fix problem with initial-exec relocations.
13597 (Target_i386::Relocate::relocate_tls): Likewise.
13598 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13599 relaxation.
13600 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13601 support for section-plus-offset dynamic table entries.
13602 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13603 (Output_data_dynamic::Dynamic_entry): Add support for
13604 section-plus-offset dynamic table entries.
13605 (Output_data_dynamic::Classification): Likewise.
13606 (Output_data_dynamic::classification_): Renamed offset_.
13607 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13608 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13609 (Target_x86_64::make_plt_section): New function.
13610 (Target_x86_64::reserve_tlsdesc_entries): New function.
13611 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13612 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13613 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13614 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13615 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13616 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13617 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13618 add extra PLT entry for TLS descriptors.
13619 (Output_data_plt_x86_64::got_): New field.
13620 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13621 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13622 fields.
13623 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13624 descriptors.
13625 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13626 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13627 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13628 R_386_TLS_DESC_CALL relocations.
13629 (Target_x86_64::Scan::global): Likewise.
13630 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13631 for TLS descriptors.
13632 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13633 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13634 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13635 GD-to-IE relaxation.
13636 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13637 and TLS_DESCRIPTORS.
13638 * Makefile.in: Rebuild.
13639 * configure: Rebuild.
13640 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13641 (tls_test_shared2.so): New target.
13642 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13643 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13644 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13645 (tls_shared_gd_to_ie_test_LDADD): New variable.
13646 (tls_shared_gnu2_gd_to_ie_test): New target.
13647 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13648 New targets.
13649 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13650 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13651 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13652 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13653 (tls_shared_gnu2_test): New target.
13654 (tls_test_gnu2_shared.so): New target.
13655 (tls_shared_gnu2_test_SOURCES): New variable.
13656 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13657 (tls_shared_gnu2_test_LDFLAGS): New variable.
13658 (tls_shared_gnu2_test_LDADD): New variable.
13659 * testsuite/Makefile.in: Rebuild.
13660 * testsuite/Makefile.
13661
13662 2008-04-11 Ian Lance Taylor <iant@google.com>
13663
13664 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13665 justsyms.t.
13666 * testsuite/Makefile.in: Rebuild.
13667
13668 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13669 long.
13670 * testsuite/script_test_2.cc (main): Adjust test.
13671
13672 2008-04-11 David S. Miller <davem@davemloft.net>
13673 Ian Lance Taylor <iant@google.com>
13674
13675 * options.h (General_options): Add entries for '-Y' and
13676 '-relax'.
13677 * options.cc (General_options:finalize): If -Y was used, add those
13678 entries to the library path instead of the default "/lib" and
13679 "/usr/lib".
13680
13681 2008-04-11 David S. Miller <davem@davemloft.net>
13682
13683 * testsuite/justsyms.t: Start at 0x100.
13684 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13685 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13686 long.
13687 * testsuite/script_test_2.cc: Adjust string and section length
13688 checks.
13689
13690 2008-04-09 Ian Lance Taylor <iant@google.com>
13691
13692 PR gold/5996
13693 * script-sections.cc (Sections_element::allocate_to_segment): Add
13694 orphan parameter.
13695 (Output_section_definition::allocate_to_segment): Likewise.
13696 (Orphan_output_section::allocate_to_segment): Likewise.
13697 (Script_sections::attach_sections_using_phdrs_clause): Don't
13698 propagate non-PT_LOAD segments to orphan sections.
13699 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13700 readelf rather than objdump.
13701 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13702 .interp section and PT_INTERP segment are the same size.
13703 * testsuite/Makefile.in: Rebuild.
13704
13705 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13706 aliases for symbols defined in the same object.
13707 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13708 (weak_alias_test_SOURCES): New variable.
13709 (weak_alias_test_DEPENDENCIES): New variable.
13710 (weak_alias_test_LDFLAGS): New variable.
13711 (weak_alias_test_LDADD): New variable.
13712 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13713 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13714 (weak_alias_test_3.o): New target.
13715 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13716 * testsuite/weak_alias_test_main.cc: New file.
13717 * testsuite/weak_alias_test_1.cc: New file.
13718 * testsuite/weak_alias_test_2.cc: New file.
13719 * testsuite/weak_alias_test_3.cc: New file.
13720
13721 2008-04-08 Ian Lance Taylor <iant@google.com>
13722
13723 * options.h (class General_options): Add --noinhibit-exec option.
13724 * main.cc (main): Check --noinhibit-exec.
13725
13726 * options.h (class General_options): Define --wrap as a special
13727 option. Add wrap_symbols_ field.
13728 (General_options::any_wrap_symbols): New function.
13729 (General_options::is_wrap_symbol): New function.
13730 * options.cc (General_options::parse_wrap): New function.
13731 (General_options::General_options): Initialize wrap_symbols_.
13732 * symtab.cc (Symbol_table::wrap_symbol): New function.
13733 (Symbol_table::add_from_object): Handle --wrap.
13734 * symtab.h (class Symbol_table): Declare wrap_symbol.
13735 * target.h (Target::wrap_char): New function.
13736 (Target::Target_info): Add wrap_char field.
13737 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13738 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13739 * testsuite/testfile.cc (Target_test::test_target_info):
13740 Likewise.
13741
13742 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13743 there is one.
13744
13745 * layout.h (class Layout): Add added_eh_frame_data_ field.
13746 * layout.cc (Layout::Layout): Initialize new field.
13747 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13748 output section until we find a section we merged successfully.
13749 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13750 that the size be non-zero.
13751
13752 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13753 qualifier.
13754
13755 2008-04-08 Craig Silverstein <csilvers@google.com>
13756
13757 * configure.ac: Export new conditional variable HAVE_ZLIB.
13758 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13759 on HAVE_ZLIB.
13760 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13761 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13762
13763 2008-04-07 Ian Lance Taylor <iant@google.com>
13764
13765 * version.cc (version_string): Set to "1.5".
13766
13767 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13768 Add issued_non_pic_error_ field. Declare check_non_pic.
13769 (Target_x86_64::Scan::check_non_pic): New function.
13770 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13771 (Target_x86_64::Scan::global): Likewise.
13772
13773 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13774 addend parameter. Change caller. Handle merge sections.
13775 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13776 Address to Addend. Don't add in the result of
13777 local_section_offset, pass down the addend and use the returned
13778 value.
13779 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13780 Update declarations of local_section_offset and symbol_value.
13781 * testsuite/two_file_test_1.cc (t18): New function.
13782 * testsuite/two_file_test_2.cc (f18): New function.
13783 * testsuite/two_file_test_main.cc (main): Call t18.
13784 * testsuite/two_file_test.h (t18, f18): Declare.
13785
13786 * configure.ac: Don't test for objdump, c++filt, or readelf.
13787 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13788 conditionals.
13789 (TEST_READELF): New variable.
13790 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13791 (check_PROGRAMS): Add two_file_strip_test.
13792 (two_file_strip_test): New target.
13793 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13794 (two_file_same_shared_strip_test_SOURCES): New variable.
13795 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13796 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13797 (two_file_same_shared_strip_test_LDADD): New variable.
13798 (two_file_shared_strip.so): New target.
13799 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13800 (ver_test_5.syms, ver_test_7.syms): Likewise.
13801 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13802 (strip_test_3.stdout): Use TEST_OBJDUMP.
13803 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13804
13805 2008-04-04 Cary Coutant <ccoutant@google.com>
13806
13807 * symtab.h (Symbol::is_weak_undefined): New function.
13808 (Symbol::is_strong_undefined): New function.
13809 (Symbol::is_absolute): New function.
13810 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13811 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13812 absolute symbols.
13813 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13814 (weak_undef_test): New target.
13815 * testsuite/Makefile.in: Rebuild.
13816 * testsuite/weak_undef_file1.cc: New file.
13817 * testsuite/weak_undef_file2.cc: New file.
13818 * testsuite/weak_undef_test.cc: New file.
13819
13820 2008-04-03 Craig Silverstein <csilvers@google.com>
13821
13822 * compressed_output.h (class Output_compressed_section): Use
13823 unsigned buffer.
13824 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13825 add zlib header.
13826 (zlib_compressed_suffix): Removed.
13827 (Output_compressed_section::set_final_data_size): Use unsigned
13828 buffers.
13829 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13830 Fix linker invocation.
13831 (flagstest_o_specialfile_and_compress_debug_sections):
13832 Likewise.
13833 * testsuite/Makefile.in: Regenerated.
13834
13835 2008-04-02 David S. Miller <davem@davemloft.net>
13836
13837 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13838 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13839
13840 2008-04-02 Craig Silverstein <csilvers@google.com>
13841
13842 * TODO: New file.
13843
13844 2008-04-02 Ian Lance Taylor <iant@google.com>
13845
13846 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13847 parameters. Update for new key type to views_. Change all
13848 callers.
13849 (File_read::read): Adjust for byteshift in returned view.
13850 (File_read::add_view): New function, broken out of
13851 find_and_make_view.
13852 (File_read::make_view): New function, broken out of
13853 find_and_make_view.
13854 (File_read::find_or_make_view): Add offset and aligned
13855 parameters. Rewrite accordingly. Change all callers.
13856 (File_read::get_view): Add offset and aligned parameters. Adjust
13857 for byteshift in return value.
13858 (File_read::get_lasting_view): Likewise.
13859 * fileread.h (class File_read): Update declarations.
13860 (class File_read::View): Add byteshift_ field. Add byteshift to
13861 constructor. Add byteshift method.
13862 * archive.h (Archive::clear_uncached_views): New function.
13863 (Archive::get_view): Add aligned parameter. Change all callers.
13864 * object.h (Object::get_view): Add aligned parameter. Change all
13865 callers.
13866 (Object::get_lasting_view): Likewise.
13867
13868 * fileread.cc (File_read::release): Don't call clear_views if
13869 there are multiple objects.
13870 * fileread.h (File_read::clear_uncached_views): New function.
13871 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13872 on the archive.
13873
13874 2008-03-31 Cary Coutant <ccoutant@google.com>
13875
13876 Add thin archive support.
13877 * archive.cc (Archive::armagt): New const.
13878 (Archive::setup): Remove task parameter and calls to unlock.
13879 (Archive::unlock_nested_archives): New function.
13880 (Archive::read_header): Add nested_off parameter. Change
13881 all callers.
13882 (Archive::interpret_header): Likewise.
13883 (Archive::include_all_members): Change to handle thin
13884 archives.
13885 (Archive::include_member): Likewise.
13886 * archive.h (Archive::Archive): Add new parameters and
13887 initializers.
13888 (Archive::armagt): New const.
13889 (Archive::setup): Remove task parameter.
13890 (Archive::unlock_nested_archives): New function.
13891 (Archive::read_header): Add nested_off parameter.
13892 (Archive::interpret_header): Likewise.
13893 (Archive::Nested_archive_table): New typedef.
13894 (Archive::is_thin_archive_): New field.
13895 (Archive::nested_archives_): New field.
13896 (Archive::options_): New field.
13897 (Archive::dirpath_): New field.
13898 (Archive::task_): New field.
13899 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13900 for thin archives. Pass additional parameters to
13901 Archive::Archive. Unlock the archive file after calling
13902 Archive::setup.
13903
13904 2008-03-29 Ian Lance Taylor <iant@google.com>
13905
13906 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13907 version symbol to be local.
13908 * testsuite/ver_test_4.sh: New file.
13909 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13910 (check_DATA): Add ver_test_4.syms.
13911 (ver_test_4.syms): New target.
13912 * testsuite/Makefile.in: Rebuild.
13913
13914 * output.cc
13915 (Output_section::Input_section_sort_entry::has_priority): New
13916 function.
13917 (Output_section::Input_section_sort_entry::match_file_name): New
13918 function.
13919 (Output_section::Input_section_sort_entry::match_section_name):
13920 Remove.
13921 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13922 Remove.
13923 (Output_section::Input_section_sort_entry::match_section_file):
13924 Remove.
13925 (Output_section::Input_section_sort_compare::operator()): Rewrite
13926 using new Input_section_sort_entry functions. Sort crtbegin and
13927 crtend first. Sort sections with no priority before sections with
13928 a priority.
13929 * testsuite/initpri1.c (d3): Check j != 4.
13930 (cd5): New constructor/destructor function.
13931 (main): Check j != 2.
13932
13933 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13934 new symbol when resolving, don't call set_is_default.
13935 * testsuite/ver_test_7.cc: New file.
13936 * testsuite/ver_test_7.sh: New file.
13937 * testsuite/Makefile.am (ver_test_7.so): New target.
13938 (ver_test_7.o): New target.
13939 (check_SCRIPTS): Add ver_test_7.sh.
13940 (check_DATA): Add ver_test_7.syms.
13941 (ver_test_7.syms): New target.
13942
13943 2008-03-28 Ian Lance Taylor <iant@google.com>
13944
13945 * layout.cc (Layout::layout): If we see an input section with a
13946 name that needs sorting, set the must_sort flag for the output
13947 section.
13948 (Layout::make_output_section): If the name of the output section
13949 indicates that it might require sorting, set the may_sort flag.
13950 * output.h (Output_section::may_sort_attached_input_sections): New
13951 function.
13952 (Output_section::set_may_sort_attached_input_sections): New
13953 function.
13954 (Output_section::must_sort_attached_input_sections): New
13955 function.
13956 (Output_section::set_must_sort_attached_input_sections): New
13957 function.
13958 (class Output_section): Declare Input_section_sort_entry. Define
13959 Input_section_sort_compare. Declare
13960 sort_attached_input_sections. Add new fields:
13961 may_sort_attached_input_sections_,
13962 must_sort_attached_input_sections_,
13963 attached_input_sections_are_sorted_.
13964 * output.cc (Output_section::Output_section): Initialize new
13965 fields.
13966 (Output_section::add_input_section): Add an entry to
13967 input_sections_ if may_sort or must_sort are true.
13968 (Output_section::set_final_data_size): Call
13969 sort_attached_input_sections if necessary.
13970 (Output_section::Input_section_sort_entry): Define new class.
13971 (Output_section::Input_section_sort_compare::operator()): New
13972 function.
13973 (Output_section::sort_attached_input_sections): New function.
13974 * configure.ac: Check whether the compiler supports constructor
13975 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13976 * testsuite/initpri1.c: New file.
13977 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13978 CONSTRUCTOR_PRIORITY.
13979 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13980 (initpri1_LDFLAGS): New variable.
13981 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13982
13983 2008-03-27 Ian Lance Taylor <iant@google.com>
13984
13985 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13986 * testsuite/common_test_1.c: New file.
13987 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13988 (common_test_1_SOURCES): New variable.
13989 (common_test_1_DEPENDENCIES): New variable.
13990 (common_test_1_LDFLAGS): New variable.
13991
13992 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13993 and commons_ correctly when NAME/VERSION does not override
13994 NAME/NULL.
13995 * testsuite/ver_test_6.c: New file.
13996 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13997 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13998 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13999
14000 2008-03-26 Ian Lance Taylor <iant@google.com>
14001
14002 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14003 of an undefined symbol from a version script.
14004 * testsuite/Makefile.am (ver_test_5.so): New target.
14005 (ver_test_5.o): New target.
14006 (check_SCRIPTS): Add ver_test_5.sh.
14007 (check_DATA): Add ver_test_5.syms.
14008 (ver_test_5.syms): New target.
14009 * testsuite/ver_test_5.cc: New file.
14010 * testsuite/ver_test_5.script: New file.
14011 * testsuite/ver_test_5.sh: New file.
14012 * Makefile.in, testsuite/Makefile.in: Rebuild.
14013
14014 PR gold/5986
14015 Fix problems building gold with gcc 4.3.0.
14016 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14017 (gold_error_at_location, gold_warning_at_location): Use it.
14018 * configure.ac: Check whether we can compile and use a template
14019 function with a printf attribute.
14020 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14021 when jumping over bytes.
14022 * object.cc: Instantiate Object::read_section_data.
14023 * debug.h: Include <cstring>
14024 * dwarf_reader.cc: Include <algorithm>
14025 * main.cc: Include <cstring>.
14026 * options.cc: Include <cstring>.
14027 * output.cc: Include <cstring>.
14028 * script.cc: Include <cstring>.
14029 * script.h: Include <string>.
14030 * symtab.cc: Include <cstring> and <algorithm>.
14031 * target-select.cc: Include <cstring>.
14032 * version.cc: Include <string>.
14033 * testsuite/testmain.cc: Include <cstdlib>.
14034 * configure, config.in: Rebuild.
14035
14036 2008-03-25 Ian Lance Taylor <iant@google.com>
14037
14038 * options.cc: Include "../bfd/bfdver.h".
14039 (options::help): Print bug reporting address.
14040
14041 * version.cc (print_version): Adjust output for current value of
14042 BFD_VERSION_STRING.
14043
14044 * NEWS: New file.
14045
14046 * options.cc (options::help): Print list of supported targets.
14047 * target-select.h: Include <vector>.
14048 (class Target_selector): Make machine_, size_, and is_big_endian_
14049 fields const. Add bfd_name_ and instantiated_target_ fields.
14050 (Target_selector::Target_selector): Add bfd_name parameter.
14051 (Target_selector::recognize): Make non-virtual, call
14052 do_recognize.
14053 (Target_selector::recognize_by_name): Make non-virtual, call
14054 do_recognize_by_name.
14055 (Target_selector::supported_names): New function.
14056 (Target_selector::bfd_name): New function.
14057 (Target_selector::do_instantiate_target): New pure virtual
14058 function.
14059 (Target_selector::do_recognize): New virtual function.
14060 (Target_selector::do_recognize_by_name): New virtual function.
14061 (Target_selector::instantiate_target): New private function.
14062 (supported_target_names): Declare.
14063 * target-select.cc (Target_selector::Target_selector): Update for
14064 new parameter and fields.
14065 (select_target_by_name): Check that the name matches before
14066 calling recognize_by_name.
14067 (supported_target_names): New function.
14068 * i386.cc (class Target_selector_i386): Update Target_selector
14069 constructor call. Remove recognize and recognize_by_name. Add
14070 do_instantiate_target.
14071 * x86_64.cc (class Target_selector_x86_64): Likewise.
14072 * testsuite/testfile.cc (class Target_selector_test): Update for
14073 changes to Target_selector.
14074
14075 * README: Rewrite, with some notes on unsupported features.
14076
14077 2008-03-24 Cary Coutant <ccoutant@google.com>
14078
14079 * i386.cc (Target_i386::Got_type): New enum declaration.
14080 (Target_i386::Scan::local): Updated callers of Output_data_got
14081 member functions.
14082 (Target_i386::Scan::global): Likewise.
14083 (Target_i386::Relocate::relocate): Likewise.
14084 (Target_i386::Relocate::relocate_tls): Likewise.
14085 * object.h (Got_offset_list): New class.
14086 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14087 (Sized_relobj::local_got_offset): Likewise.
14088 (Sized_relobj::set_local_got_offset): Likewise.
14089 (Sized_relobj::local_has_tls_got_offset): Removed.
14090 (Sized_relobj::local_tls_got_offset): Removed.
14091 (Sized_relobj::set_local_tls_got_offset): Removed.
14092 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14093 * output.cc (Output_data_got::add_global): Added got_type parameter.
14094 (Output_data_got::add_global_with_rel): Likewise.
14095 (Output_data_got::add_global_with_rela): Likewise.
14096 (Output_data_got::add_global_pair_with_rel): New function.
14097 (Output_data_got::add_global_pair_with_rela): New function.
14098 (Output_data_got::add_local): Added got_type parameter.
14099 (Output_data_got::add_local_with_rel): Likewise.
14100 (Output_data_got::add_local_with_rela): Likewise.
14101 (Output_data_got::add_local_pair_with_rel): New function.
14102 (Output_data_got::add_local_pair_with_rela): New function.
14103 (Output_data_got::add_global_tls): Removed.
14104 (Output_data_got::add_global_tls_with_rel): Removed.
14105 (Output_data_got::add_global_tls_with_rela): Removed.
14106 (Output_data_got::add_local_tls): Removed.
14107 (Output_data_got::add_local_tls_with_rel): Removed.
14108 (Output_data_got::add_local_tls_with_rela): Removed.
14109 * output.h (Output_data_got::add_global): Added got_type parameter.
14110 (Output_data_got::add_global_with_rel): Likewise.
14111 (Output_data_got::add_global_with_rela): Likewise.
14112 (Output_data_got::add_global_pair_with_rel): New function.
14113 (Output_data_got::add_global_pair_with_rela): New function.
14114 (Output_data_got::add_local): Added got_type parameter.
14115 (Output_data_got::add_local_with_rel): Likewise.
14116 (Output_data_got::add_local_with_rela): Likewise.
14117 (Output_data_got::add_local_pair_with_rel): New function.
14118 (Output_data_got::add_local_pair_with_rela): New function.
14119 (Output_data_got::add_global_tls): Removed.
14120 (Output_data_got::add_global_tls_with_rel): Removed.
14121 (Output_data_got::add_global_tls_with_rela): Removed.
14122 (Output_data_got::add_local_tls): Removed.
14123 (Output_data_got::add_local_tls_with_rel): Removed.
14124 (Output_data_got::add_local_tls_with_rela): Removed.
14125 * resolve.cc (Symbol::override_base_with_special): Removed
14126 reference to has_got_offset_ field.
14127 * symtab.cc (Symbol::init_fields): Replaced initialization
14128 of got_offset_ with got_offsets_. Removed initialization
14129 of has_got_offset_
14130 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14131 (Symbol::got_offset): Likewise.
14132 (Symbol::set_got_offset): Likewise.
14133 (Symbol::has_tls_got_offset): Removed.
14134 (Symbol::tls_got_offset): Removed.
14135 (Symbol::set_tls_got_offset): Removed.
14136 (Symbol::got_offset_): Removed.
14137 (Symbol::tls_mod_got_offset_): Removed.
14138 (Symbol::tls_pair_got_offset_): Removed.
14139 (Symbol::got_offsets_): New field.
14140 (Symbol::has_got_offset): Removed.
14141 (Symbol::has_tls_mod_got_offset): Removed.
14142 (Symbol::has_tls_pair_got_offset): Removed.
14143 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14144 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14145 member functions.
14146 (Target_x86_64::Scan::global): Likewise.
14147 (Target_x86_64::Relocate::relocate): Likewise.
14148 (Target_x86_64::Relocate::relocate_tls): Likewise.
14149
14150 2008-03-25 Ben Elliston <bje@au.ibm.com>
14151
14152 * yyscript.y: Fix spelling error in comment.
14153
14154 2008-03-24 Ian Lance Taylor <iant@google.com>
14155
14156 * options.h (class General_options): Define build_id option.
14157 * layout.h (class Layout): Declare write_build_id, create_note,
14158 create_build_id. Add build_id_note_ member.
14159 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14160 "libiberty.h", "md5.h", "sha1.h".
14161 (Layout::Layout): Initialize eh_frame_data_,
14162 eh_frame_hdr_section_, and build_id_note_.
14163 (Layout::finalize): Call create_build_id.
14164 (Layout::create_note): New function, broken out of
14165 Layout::create_gold_note.
14166 (Layout::create_gold_note): Call create_note.
14167 (Layout::create_build_id): New function.
14168 (Layout::write_build_id): New function.
14169 (Close_task_runner::run): Call write_build_id.
14170
14171 * x86_64.cc: Correct license to GPLv3.
14172
14173 2008-03-23 Ian Lance Taylor <iant@google.com>
14174
14175 * options.cc: Include "demangle.h".
14176 (parse_optional_string): New function.
14177 (parse_long_option): Handle takes_optional_argument.
14178 (parse_short_option): Update dash_z initializer. Handle
14179 takes_optional_argument.
14180 (General_options::General_options): Initialize do_demangle_.
14181 (General_options::finalize): Set do_demangle_. Handle demangling
14182 style.
14183 * options.h (parse_optional_string): Declare.
14184 (struct One_option): Add optional_arg field. Update constructor.
14185 Update call constructor calls. Add takes_optional_argument
14186 function.
14187 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14188 (DEFINE_optional_string): Define.
14189 (General_options::demangle): Change from DEFINE_bool to
14190 DEFINE_optional_string.
14191 (General_options::no_demangle): New function.
14192 (General_options::do_demangle): New function.
14193 (General_options::set_do_demangle): New function.
14194 (General_options::execstack_status_): Move definition to end of
14195 class definition.
14196 (General_options::static_): Likewise.
14197 (General_options::do_demangle_): New field.
14198 * object.cc (big_endian>::get_symbol_location_info): Call
14199 Options::do_demangle, not Options::demangle.
14200 * symtab.cc (demangle): Likewise.
14201
14202 2008-03-22 Ian Lance Taylor <iant@google.com>
14203
14204 * gold.h: Include <cstddef> and <sys/types.h>
14205 * options.h: Include <cstring>.
14206
14207 2008-03-21 Ian Lance Taylor <iant@google.com>
14208
14209 * Added source code to GNU binutils.
14210 \f
14211 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14212
14213 Copying and distribution of this file, with or without modification,
14214 are permitted in any medium without royalty provided the copyright
14215 notice and this notice are preserved.
14216
14217 Local Variables:
14218 mode: change-log
14219 left-margin: 8
14220 fill-column: 74
14221 version-control: never
14222 End:
This page took 0.338709 seconds and 4 git commands to generate.