2012-08-22 Cary Coutant <ccoutant@google.com>
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-08-22 Cary Coutant <ccoutant@google.com>
2
3 * layout.cc (Layout::include_section): Don't assert on GROUP
4 sections with --emit-relocs.
5
6 2012-08-21 Cary Coutant <ccoutant@google.com>
7
8 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
9 if --export-dynamic-symbol names an undef symbol.
10
11 2012-08-18 Alan Modra <amodra@gmail.com>
12
13 * powerpc.cc: Formatting and white space.
14 (Powerpc_relobj): Rename got2_section_ to special_.
15 Add opd_ent_shndx_ and opd_ent_off_ vectors.
16 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
17 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
18 (Target_powerpc): Add Address typedef and invalid_address. Use
19 throughout.
20 (Target_powerpc::is_branch_reloc): New function.
21 (Powerpc_relocate_functions): Add Address typedef, use throughout.
22 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
23 for dst_mask, value and addend.
24 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
25 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
26 (Output_data_glink::do_write): Correct toc base. Don't try to use
27 uint16_t for 24-bit offset. Use get_output_section_offset and
28 check return.
29 (Target_powerpc::Scan::local): Handle more relocs.
30 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
31 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
32 Plug in toc restoring insn after plt calls. Translate branches
33 to function descriptor symbols to corresponding entry point.
34 (Target_powerpc::relocate_for_relocatable): Check return from
35 get_output_section_offset.
36 * symtab.h: Comment typo.
37
38 2012-08-14 Ian Lance Taylor <iant@google.com>
39
40 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
41 unsupported_relocal_local to call unsupported_reloc_global.
42
43 2012-08-14 Nick Clifton <nickc@redhat.com>
44
45 PR ld/14265
46 * script-sections.cc (Sections_element::output_section_name): Add
47 keep return parameter.
48 (Output_section_element::match_name): Add keep return parameter.
49 Return the value of the keep_ member.
50 * script-sections.h (class Output_section): Update
51 output_section_name prototype.
52 * layout.cc (Layout::keep_input_section): New public member
53 function.
54 (Layout::choose_output_section): Pass keep parameter to
55 output_section_name.
56 * layout.h (class Layout): Add keep_input_section.
57 * object.cc (Sized_relobj_file::do_layout): Check for kept input
58 sections.
59 * testsuite/Makefile.am: Add a test.
60 * testsuite/Makefile.in: Regenerate.
61 * testsuite/pr14265.c: Source file for the test.
62 * testsuite/pr14265.t: Linker script for the test.
63 * testsuite/pr14265.sh: Shell script for the test.
64
65 2012-08-14 Alan Modra <amodra@gmail.com>
66
67 * target.h (Target::output_section_name): New function.
68 (Target::do_output_section_name): New function.
69 * layout.cc (Layout::choose_output_section): Call the above.
70 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
71
72 2012-08-14 Alan Modra <amodra@gmail.com>
73
74 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
75 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
76 for replace_constant call.
77 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
78 (Output_data_glink::do_print_to_mapfile): New function.
79 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
80 (Target_powerpc::Relocate::relocate): Likewise.
81
82 2012-08-14 Alan Modra <amodra@gmail.com>
83
84 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
85 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
86 (Output_data_glink::add_entry,find_entry): Remove shndx param.
87 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
88 all references to shndx_. Handle special case for R_PPC_PLTREL24
89 here.
90 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
91 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
92 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
93 here.
94 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
95 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
96
97 2012-08-12 Alan Modra <amodra@gmail.com>
98
99 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
100 (glink insn constants): Use uint32_t.
101 (Output_data_glink::add_entry): Use insert, not [] operator.
102
103 2012-08-11 Alan Modra <amodra@gmail.com>
104
105 * object.h (Sized_relobj_file::find_shdr): New function.
106 (Sized_relobj_file::find_special_sections): New function.
107 * object.cc (Sized_relobj_file::find_shdr): New function.
108 (Sized_relobj_file::find_eh_frame): Use find_shdr.
109 (Sized_relobj_file::find_special_sections): New function, split out..
110 (Sized_relobj_file::do_read_symbols): ..from here.
111 * output.h (Output_data_got::replace_constant): New function.
112 (Output_data_got::num_entries): New function.
113 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
114 (Output_data_got::got_offset): Protected rather than private.
115 (Output_data_got::replace_got_entry): New function.
116 * output.cc (Output_data_got::replace_got_entry): New function.
117 * powerpc.cc (class Powerpc_relobj): New.
118 (class Powerpc_relocate_functions): Delete all psymval variants or
119 convert to value,addend type. Delete pcrela, pcrela_unaligned.
120 Implement _ha functions using corresponding _hi function.
121 (Powerpc_relobj::find_special_sections): New function.
122 (Target_powerpc::do_make_elf_object): New function.
123 (class Output_data_got_powerpc): New.
124 (class Output_data_glink): New.
125 (class Powerpc_scan_relocatable_reloc): New.
126 Many more changes througout file.
127
128 2012-08-09 Nick Clifton <nickc@redhat.com>
129
130 * po/vi.po: Updated Vietnamese translation.
131
132 2012-08-07 Ian Lance Taylor <iant@google.com>
133
134 * layout.cc (Layout::add_target_dynamic_tags): If
135 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
136 plt_rel.
137
138 2012-07-30 Nick Clifton <nickc@redhat.com>
139
140 * po/gold.pot: Updated template.
141 * po/es.po: Updated Spanish translation.
142
143 2012-07-18 Cary Coutant <ccoutant@google.com>
144
145 PR gold/14344
146 * configure.ac: Add check for -gpubnames support.
147 * configure: Regenerate.
148 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
149 support; force -gno-pubnames.
150 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
151 support.
152 (gdb_index_test_4): New test.
153 * testsuite/Makefile.in: Regenerate.
154 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
155 * testsuite/gdb_index_test_2.sh: Likewise.
156 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
157 * testsuite/gdb_index_test_4.sh: New script.
158 * testsuite/gdb_index_test_comm.sh: New script with common code;
159 don't look for space after colon.
160
161 2012-07-16 Sriraman Tallam <tmsriram@google.com>
162
163 * gold.cc (queue_middle_tasks): Update function order only after
164 deferred objects due to plugins are processed.
165
166 2012-07-11 Ian Lance Taylor <iant@google.com>
167
168 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
169 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
170 (Target_arm::scan_reloc_for_stub): Likewise.
171 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
172 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
173 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
174 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
175 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
176
177 2012-07-10 Dodji Seketeli <dodji@redhat.com>
178 Ian Lance Taylor <iant@google.com>
179
180 PR gold/14309
181 * configure.ac: Test whether std::tr1::hash<off_t> works.
182 * gold.h: Add a specialization for std::tr1::hash<off_t> if
183 needed.
184 * output.h (class Output_fill): Add virtual destructor.
185 * configure, config.in: Rebuild.
186
187 2012-06-22 Roland McGrath <mcgrathr@google.com>
188
189 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
190
191 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
192
193 * plugin.cc (Plugin::load): Handle position independent executables.
194
195 2012-06-06 Cary Coutant <ccoutant@google.com>
196
197 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
198 add .debug_macro.
199 (lines_only_debug_sections): Likewise.
200 (gdb_fast_lookup_sections): New static array.
201 (is_gdb_debug_section): Rename formal parameter.
202 (is_lines_only_debug_section): Likewise.
203 (is_gdb_fast_lookup_section): New function.
204 (Layout::include_section): Check for ".zdebug_" prefix; pass
205 section name suffix to is_gdb_debug_section, et al.; check for
206 fast-lookup sections when building .gdb_index.
207 * options.h (--strip-debug-gdb): Update GDB version number.
208
209 2012-06-06 Cary Coutant <ccoutant@google.com>
210
211 * configure.ac: Add check for fallocate.
212 * configure: Regenerate.
213 * config.in: Regenerate.
214
215 * options.h (class General_options): Add --mmap-output-file and
216 --posix-fallocate options.
217 * output.cc: (posix_fallocate): Remove; replace with...
218 (gold_fallocate): New function.
219 (Output_file::map_no_anonymous): Call gold_fallocate.
220 (Output_file::map): Check --mmap-output-file option.
221
222 2012-06-05 Jing Yu <jingyu@google.com>
223
224 * gold.h (textdomain): Add do {} to empty while(0).
225 (bindtextdomain): Likewise.
226
227 2012-06-04 Cary Coutant <ccoutant@google.com>
228
229 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
230 has_dynsym_index.
231
232 2012-05-25 Sriraman Tallam <tmsriram@google.com>
233
234 * symtab.cc (Symbol_table::define_special_symbol):
235 Initialize *poldsym to prevent uninitialized variable errors.
236
237 2012-05-23 Cary Coutant <ccoutant@google.com>
238
239 * layout.cc (Layout::section_name_mapping): Add rules to handle
240 exact match on .data.rel.ro.local or .data.rel.ro.
241 (Layout::output_section_name): Check for exact matches.
242
243 2012-05-23 Cary Coutant <ccoutant@google.com>
244
245 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
246 more carefully.
247
248 2012-05-22 Cary Coutant <ccoutant@google.com>
249
250 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
251 object before exporting symbol.
252
253 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
254
255 * testsuite/tls_test.cc: Include "config.h" first.
256 * testsuite/tls_test_c.c: Likewise.
257
258 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
259 Nick Clifton <nickc@redhat.com>
260
261 PR 14072
262 * configure.in: Add check that sysdep.h has been included before
263 any system header files.
264 * configure: Regenerate.
265 * config.in: Regenerate.
266
267 2012-05-14 Cary Coutant <ccoutant@google.com>
268
269 * layout.cc (Layout::make_output_section): Mark .tdata section
270 as RELRO.
271 * testsuite/relro_test.cc: Add a TLS variable.
272
273 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
274
275 PR gold/14091
276 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
277 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
278 R_X86_64_64.
279
280 2012-05-08 Cary Coutant <ccoutant@google.com>
281
282 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
283 (lines_only_debug_sections): Likewise.
284
285 2012-05-02 Roland McGrath <mcgrathr@google.com>
286
287 * nacl.cc: New file.
288 * nacl.h: New file.
289 * Makefile.am (CCFILES, HFILES): Add them.
290 * Makefile.in: Regenerate.
291 * i386.cc (Output_data_plt_i386_nacl): New class.
292 (Output_data_plt_i386_nacl_exec): New class.
293 (Output_data_plt_i386_nacl_dyn): New class.
294 (Target_i386_nacl): New class.
295 (Target_selector_i386_nacl): New class.
296 (target_selector_i386): Use it instead of Target_selector_i386.
297 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
298 (Target_x86_64_nacl): New class.
299 (Target_selector_x86_64_nacl): New class.
300 (target_selector_x86_64, target_selector_x32): Use it instead of
301 Target_selector_x86_64.
302 * arm.cc (Output_data_plt_arm_nacl): New class.
303 (Target_arm_nacl): New class.
304 (Target_selector_arm_nacl): New class.
305 (target_selector_arm, target_selector_armbe): Use it instead of
306 Target_selector_arm.
307
308 * target-select.cc (select_target): Take new Input_file* and off_t
309 arguments, pass them on to recognize method of selector.
310 * object.cc (make_elf_sized_object): Update caller.
311 * parameters.cc (parameters_force_valid_target): Likewise.
312 * incremental.cc (make_sized_incremental_binary): Likewise.
313 * target-select.h: Update decl.
314 (Target_selector::recognize): Take new Input_file* argument,
315 pass it on to do_recognize.
316 (Target_selector::do_recognize): Take new Input_file* argument.
317 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
318 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
319 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
320 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
321
322 * target.h (Target::Target_info): New members isolate_execinstr
323 and rosegment_gap.
324 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
325 * arm.cc (Target_arm::arm_info): Update initializer.
326 * i386.cc (Target_i386::i386_info): Likewise.
327 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
328 * sparc.cc (Target_sparc::sparc_info): Likewise.
329 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
330 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
331 * layout.cc (Layout::attach_allocated_section_to_segment):
332 Take new const Target* argument. If target->isolate_execinstr(), act
333 like --rosegment.
334 (Layout::find_first_load_seg): Take new const Target* argument;
335 if target->isolate_execinstr(), reject PF_X segments.
336 (Layout::relaxation_loop_body): Update caller.
337 (Layout::set_segment_offsets): If target->isolate_execinstr(),
338 reset file offset to zero when we hit LOAD_SEG, and then do a second
339 loop over the segments before LOAD_SEG to reassign offsets after
340 addresses have been determined. Handle target->rosegment_gap().
341 (Layout::attach_section_to_segment): Take new const Target* argument;
342 pass it to attach_allocated_section_to_segment.
343 (Layout::make_output_section): Update caller.
344 (Layout::attach_sections_to_segments): Take new const Target* argument;
345 pass it to attach_section_to_segment.
346 * gold.cc (queue_middle_tasks): Update caller.
347 * layout.h (Layout): Update method decls with new arguments.
348
349 * arm.cc (Target_arm::Target_arm): Take optional argument for the
350 Target_info pointer to use.
351 (Target_arm::do_make_data_plt): New virtual method.
352 (Target_arm::make_data_plt): New method that calls it.
353 (Target_arm::make_plt_entry): Use it.
354 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
355 for the section alignment.
356 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
357 method.
358 (Output_data_plt_arm::first_plt_entry_offset): Call it.
359 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
360 method.
361 (Output_data_plt_arm::get_plt_entry_size): Call it.
362 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
363 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
364 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
365 method.
366 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
367 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
368 method instead of sizeof(plt_entry).
369 (Output_data_plt_arm::add_entry): Likewise.
370 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
371 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
372 than static method.
373 (Target_arm::plt_entry_size): Likewise.
374 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
375 Move to ...
376 (Output_data_plt_arm_standard): ... here, new class.
377 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
378 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
379 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
380
381 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
382 Take additional argument for the PLT entry size.
383 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
384 Use get_plt_entry_size method rather than plt_entry_size variable.
385 (Output_data_plt_x86_64::reserve_slot): Likewise.
386 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
387 (Output_data_plt_x86_64::add_entry): Likewise.
388 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
389 (Output_data_plt_x86_64::address_for_global): Likewise.
390 (Output_data_plt_x86_64::address_for_local): Likewise.
391 (Output_data_plt_x86_64::set_final_data_size): Likewise.
392 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
393 Make method non-static.
394 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
395 method.
396 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
397 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
398 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
399 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
400 virtual method.
401 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
402 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
403 virtual method.
404 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
405 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
406 virtual method.
407 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
408 (Output_data_plt_x86_64::plt_entry_size)
409 (Output_data_plt_x86_64::first_plt_entry)
410 (Output_data_plt_x86_64::plt_entry)
411 (Output_data_plt_x86_64::tlsdesc_plt_entry)
412 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
413 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
414 (Output_data_plt_x86_64_standard): ... here, new class.
415 (Target_x86_64::Target_x86_64): Take optional argument for the
416 Target_info pointer to use.
417 (Target_x86_64::do_make_data_plt): New virtual method.
418 (Target_x86_64::make_data_plt): New method to call it.
419 (Target_x86_64::init_got_plt_for_update): Use that.
420 Call this->plt_->add_eh_frame method here.
421 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
422 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
423 rather than static method.
424 (Target_x86_64::plt_entry_size): Likewise.
425 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
426 rather than plt_entry_size variable. Move guts of PLT filling to...
427 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
428 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
429 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
430
431 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
432 additional argument for the section alignment.
433 Don't do add_eh_frame_for_plt here.
434 (Output_data_plt_i386::first_plt_entry_offset): Make the method
435 non-static. Use get_plt_entry_size method rather than plt_entry_size
436 variable.
437 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
438 method.
439 (Output_data_plt_i386::get_plt_entry_size): Call it.
440 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
441 (Output_data_plt_i386::add_eh_frame): New method to call it.
442 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
443 method.
444 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
445 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
446 method.
447 (Output_data_plt_i386::fill_plt_entry): New method to call it.
448 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
449 method instead of plt_entry_size.
450 (Output_data_plt_i386::plt_entry_size)
451 (Output_data_plt_i386::plt_eh_frame_fde_size)
452 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
453 (Output_data_plt_i386_standard): ... here, new class.
454 (Output_data_plt_i386_exec): New class.
455 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
456 (Output_data_plt_i386_exec::first_plt_entry): ... here.
457 (Output_data_plt_i386::exec_plt_entry): Move to ...
458 (Output_data_plt_i386_exec::plt_entry): ... here.
459 (Output_data_plt_i386_dyn): New class.
460 (Output_data_plt_i386::first_plt_entry): Move to ...
461 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
462 (Output_data_plt_i386::dyn_plt_entry): Move to ...
463 (Output_data_plt_i386_dyn::plt_entry): ... here.
464 (Target_i386::Target_i386): Take optional argument for the Target_info
465 pointer to use.
466 (Target_i386::do_make_data_plt): New virtual method.
467 (Target_i386::make_data_plt): New method to call it.
468 (Target_i386::make_plt_section): Use that.
469 Call this->plt_->add_eh_frame method here.
470 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
471 rather than plt_entry_size variable.
472 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
473 (Output_data_plt_i386::address_for_local): Likewise.
474 (Output_data_plt_i386::do_write): Likewise.
475 Move guts of PLT filling to...
476 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
477 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
478 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
479 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
480
481 2012-05-01 Cary Coutant <ccoutant@google.com>
482
483 * dwarf_reader.cc (Dwarf_die::read_attributes)
484 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
485 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
486 * reduced_debug_output.cc
487 (Output_reduced_debug_info_section::get_die_end): Remove
488 DW_FORM_GNU_ref_index. Add default case.
489
490 2012-04-26 Mark Wielaard <mjw@redhat.com>
491
492 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
493 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
494 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
495 DW_AT_high_pc as offset from DW_AT_low_pc.
496
497 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
498 * testsuite/Makefile.in: Regenerate.
499 * testsuite/gdb_index_test_3.c: New test source file.
500 * testsuite/gdb_index_test_3.sh: New test source file.
501
502 2012-04-25 Ian Lance Taylor <iant@google.com>
503
504 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
505 pointer.
506 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
507 as a class, not a struct.
508 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
509 (Target_arm::apply_cortex_a8_workaround): Likewise.
510 * gc.h: Declare Reloc_types as a struct, not a class.
511 * object.h: Declare Symbols_data as a struct.
512 * reloc.h: Declare Read_relocs_data as a struct.
513 * target.h: Declare Relocate_info as a struct.
514
515 2012-04-24 David S. Miller <davem@davemloft.net>
516
517 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
518 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
519 and R_SPARC_WPLT30.
520
521 2012-04-24 Cary Coutant <ccoutant@google.com>
522
523 * incremental-dump.cc (find_input_containing_global): Replace
524 magic number with symbolic constant.
525 (dump_incremental_inputs): Update version number.
526 * incremental.cc (Output_section_incremental_inputs): Update version
527 number; import symbolic constants from Incremental_inputs_reader.
528 (Incremental_inputs::create_data_sections): Align relocations
529 section correctly for 64-bit targets.
530 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
531 constants; add padding.
532 (Output_section_incremental_inputs::write_header): Add assert for
533 header_size.
534 (Output_section_incremental_inputs::write_input_files): Add assert
535 for input_entry_size.
536 (Output_section_incremental_inputs::write_info_blocks): Add padding;
537 add assert for object_info_size, input_section_entry_size,
538 global_sym_entry_size.
539 * incremental.h (Incremental_inputs_reader): Add symbolic constants
540 for data structure sizes; use them.
541 (Incremental_input_entry_reader): Import symbolic constants from
542 Incremental_inputs_reader; use them.
543
544 2012-04-23 David S. Miller <davem@davemloft.net>
545
546 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
547 and elf_flags_set_.
548 (Target_sparc::Target_sparc): Initialize new fields.
549 (Target_sparc::do_make_elf_object): New function.
550 (Target_sparc::do_adjust_elf_header): New function.
551
552 2012-04-23 Cary Coutant <ccoutant@google.com>
553
554 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
555 CU range table of gdb index.
556
557 2012-04-20 David S. Miller <davem@davemloft.net>
558
559 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
560 instead of false.
561
562 2012-04-16 David S. Miller <davem@davemloft.net>
563
564 * sparc.cc (Target_sparc::got_address): New function.
565 (Sparc_relocate_functions::gdop_hix22): New function.
566 (Sparc_relocate_functions::gdop_lox10): New function.
567 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
568 relocs.
569 (Target_sparc::Scan::local): Likewise if the global symbol is not
570 preemptible and is not IFUNC.
571 (Target_sparc::Relocate::relocate): Perform GOTDATA code
572 transformations for local and non-preemptible non-IFUNC global
573 symbols.
574
575 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
576 writing out 64-bit part of ranges.
577
578 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
579 -fpic and -fpie respectively.
580 * Makefile.in: Regenerate.
581
582 * sparc.cc (class Target_sparc): Add rela_ifunc_.
583 (Target_sparc::Target_sparc): Initialize new field.
584 (Target_sparc::do_plt_section_for_global): New function.
585 (Target_sparc::do_plt_section_for_local): New function.
586 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
587 (Target_sparc::make_plt_section): New function, broken out of
588 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
589 (Target_sparc::make_plt_entry): Call make_plt_section.
590 (Target_sparc::make_local_ifunc_plt_entry): New function.
591 (Target_sparc::rela_ifunc_section): New function.
592 (Target_sparc::plt_section): Remove const.
593 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
594 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
595 and ifunc_count_ fields.
596 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
597 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
598 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
599 (Output_data_plt_sparc::rela_ifunc): New function.
600 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
601 (Output_data_plt_sparc::has_ifunc_section): New function.
602 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
603 (Output_data_plt_sparc::address_for_global): New function.
604 (Output_data_plt_sparc::address_for_local): New function.
605 (Output_data_plt_sparc::plt_index_to_offset): New function.
606 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
607 and entry_count.
608 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
609 entry_count.
610 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
611 R_SPARC_JMP_IREL to switch.
612 (Target_sparc::Scan::check_non_pic): Likewise.
613 (Target_sparc::Scan::local): Handle IFUNC symbols.
614 (Target_sparc::Scan::local): Likewise.
615 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
616 and plt_address_for_local.
617 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
618 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
619
620 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
621 (class Output_data_reloc): Adjust calls to Output_reloc_type.
622 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
623 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
624 global relocs too.
625 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
626 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
627 calls.
628 * sparc.cc (Target_sparc::Scan::global): Likewise.
629 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
630
631 2012-04-16 Cary Coutant <ccoutant@google.com>
632
633 * archive.cc (Library_base::should_include_member): Check for
634 --export-dynamic-symbol.
635 * options.h (class General_options): Add --export-dynamic-symbol.
636 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
637 --export-dynamic-symbol.
638 (Symbol_table::gc_mark_undef_symbols): Likewise.
639 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
640
641 2012-04-12 David S. Miller <davem@davemloft.net>
642
643 * sparc.cc (Reloc::wdisp10): New relocation method.
644 (Reloc::h34): Likewise.
645 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
646 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
647 R_SPARC_WDISP10.
648 (Target_sparc::Scan::local): Likewise.
649 (Target_sparc::Scan::global): Likewise.
650 (Target_sparc::Relocate::relocate): Likewise.
651
652 2012-04-09 Cary Coutant <ccoutant@google.com>
653
654 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
655 low_pc == 0.
656
657 2012-04-06 Ian Lance Taylor <iant@google.com>
658
659 * timer.cc: #include <unistd.h>.
660
661 2012-04-06 Roland McGrath <mcgrathr@google.com>
662
663 * configure.in (AC_CHECK_HEADERS): Add locale.h.
664 * config.in: Regenerate.
665 * configure: Regenerate.
666
667 2012-04-05 Nick Clifton <nickc@redhat.com>
668
669 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
670 (AM_LC_MESSAGES): Add.
671 * aclocal.m4: Regenerate.
672 * config.in: Regenerate.
673 * configure: Regenerate.
674
675 2012-03-21 Cary Coutant <ccoutant@google.com>
676
677 * Makefile.am: Add gdb-index.cc, gdb-index.h.
678 * Makefile.in: Regenerate.
679 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
680 (Sized_elf_reloc_mapper::symbol_section): New function.
681 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
682 (make_elf_reloc_mapper): New function.
683 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
684 (Dwarf_abbrev_table::do_read_abbrevs): New function.
685 (Dwarf_abbrev_table::do_get_abbrev): New function.
686 (Dwarf_ranges_table::read_ranges_table): New function.
687 (Dwarf_ranges_table::read_range_list): New function.
688 (Dwarf_pubnames_table::read_section): New function.
689 (Dwarf_pubnames_table::read_header): New function.
690 (Dwarf_pubnames_table::next_name): New function.
691 (Dwarf_die::Dwarf_die): New function.
692 (Dwarf_die::read_attributes): New function.
693 (Dwarf_die::skip_attributes): New function.
694 (Dwarf_die::set_name): New function.
695 (Dwarf_die::set_linkage_name): New function.
696 (Dwarf_die::attribute): New function.
697 (Dwarf_die::string_attribute): New function.
698 (Dwarf_die::int_attribute): New function.
699 (Dwarf_die::uint_attribute): New function.
700 (Dwarf_die::ref_attribute): New function.
701 (Dwarf_die::child_offset): New function.
702 (Dwarf_die::sibling_offset): New function.
703 (Dwarf_info_reader::check_buffer): New function.
704 (Dwarf_info_reader::parse): New function.
705 (Dwarf_info_reader::do_parse): New function.
706 (Dwarf_info_reader::do_read_string_table): New function.
707 (Dwarf_info_reader::lookup_reloc): New function.
708 (Dwarf_info_reader::get_string): New function.
709 (Dwarf_info_reader::visit_compilation_unit): New function.
710 (Dwarf_info_reader::visit_type_unit): New function.
711 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
712 Sized_elf_reloc_mapper.
713 (Sized_dwarf_line_info::symbol_section): Remove function.
714 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
715 (Sized_dwarf_line_info::read_line_mappings): Remove object
716 parameter, adjust callers.
717 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
718 * dwarf_reader.h: Include <sys/types.h>.
719 (class Track_relocs): Remove forward declaration.
720 (class Elf_reloc_mapper): New class.
721 (class Sized_elf_reloc_mapper): New class.
722 (class Dwarf_abbrev_table): New class.
723 (class Dwarf_range_list): New class.
724 (class Dwarf_ranges_table): New class.
725 (class Dwarf_pubnames_table): New class.
726 (class Dwarf_die): New class.
727 (class Dwarf_info_reader): New class.
728 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
729 (Sized_dwarf_line_info::symbol_section): Remove member function.
730 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
731 base class.
732 * gdb-index.cc: New source file.
733 * gdb-index.h: New source file.
734 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
735 and .debug_types sections, call Layout::add_to_gdb_index.
736 (Sized_relobj_incr::do_section_name): Implement.
737 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
738 return type; Implement.
739 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
740 return type.
741 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
742 parameter list and return type.
743 (Sized_incr_dynobj::do_section_contents): Likewise.
744 * layout.cc: Include gdb-index.h.
745 (Layout::Layout): Initialize gdb_index_data_.
746 (Layout::init_fixed_output_section): Check for .gdb_index section.
747 (Layout::add_to_gdb_index): New function. Instantiate.
748 * layout.h: Add forward declaration for class Gdb_index.
749 (Layout::add_to_gdb_index): New member function.
750 (Layout::gdb_index_data_): New data member.
751 * main.cc: Include gdb-index.h.
752 (main): Print statistics for gdb index.
753 * object.cc (Object::section_contents): Move code into
754 do_section_contents.
755 (need_decompressed_section): Check for sections needed when building
756 gdb index.
757 (build_compressed_section_map): Likewise.
758 (Sized_relobj_file::do_read_symbols): Need local symbols when building
759 gdb index.
760 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
761 sections; call Layout::add_to_gdb_index.
762 (Sized_relobj_file::do_decompressed_section_contents): Call
763 do_section_contents directly.
764 * object.h (Object::do_section_contents): Adjust parameter list and
765 return type.
766 (Object::do_decompressed_section_contents): Call do_section_contents
767 directly.
768 (Sized_relobj_file::do_section_contents): Adjust parameter list and
769 return type.
770 * options.h (class General_options): Add --gdb-index option.
771 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
772 list and return type.
773 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
774 * reloc.h (Track_relocs::checkpoint): New function.
775 (Track_relocs::reset): New function.
776
777 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
778 New test cases.
779 * testsuite/Makefile.in: Regenerate.
780 * testsuite/gdb_index_test.cc: New test source file.
781 * testsuite/gdb_index_test_1.sh: New test source file.
782 * testsuite/gdb_index_test_2.sh: New test source file.
783
784 2012-03-19 Doug Kwan <dougkwan@google.com>
785
786 * arm.cc (Target_arm::do_define_standard_symbols): New method.
787 (Target_arm::do_finalize_sections): Remove code which defines
788 __exidx_start and __exidx_end. Make symbol table parameter
789 anonymous as it is not used.
790 * gold.cc (queue_middle_tasks): Call target hook to define any
791 target-specific symbols.
792 * target.h (Target::define_standard_symbols): New method.
793 (Target::do_define_standard_symbols): Same.
794 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
795 * testsuite/Makefile.in: Regenerate.
796 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
797 and __exidx_end.
798 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
799 relocations are generated for __exidx_start and __exidx_end.
800
801 2012-03-16 Doug Kwan <dougkwan@google.com>
802
803 * testsuite/Makefile.am: Disable test initpri3b.
804 * testsuite/Makefile.in: Regenerate.
805
806 2012-03-15 Doug Kwan <dougkwan@google.com>
807
808 * arm.cc (Target_arm::got_section): Make .got section read-only
809 if -z now is given.
810
811 2012-03-15 Ian Lance Taylor <iant@google.com>
812
813 PR gold/13850
814 * layout.cc (Layout::make_output_section): Correctly mark
815 SHT_INIT_ARRAY, et. al., as relro.
816
817 2012-03-14 Doug Kwan <dougkwan@google.com>
818
819 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
820 dynamic relocations for protected symbols in shared objects.
821
822 2012-03-13 Ian Lance Taylor <iant@google.com>
823
824 * resolve.cc (Symbol_table::resolve): When merging common symbols,
825 keep the larger alignment.
826
827 2012-03-12 Cary Coutant <ccoutant@google.com>
828
829 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
830 handling of DW_LNE_define_file.
831
832 2012-03-12 Cary Coutant <ccoutant@google.com>
833
834 * reduced_debug_output.cc
835 (Output_reduced_debug_info_section::get_die_end): Add new FORM
836 codes to switch.
837
838 2012-02-29 Cary Coutant <ccoutant@google.com>
839
840 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
841
842 2012-02-29 Cary Coutant <ccoutant@google.com>
843
844 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
845 Call Object::decompressed_section_contents.
846 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
847 New dtor.
848 (Sized_dwarf_line_info::buffer_start_): New data member.
849 * merge.cc (Output_merge_data::do_add_input_section): Call
850 Object::decompressed_section_contents.
851 (Output_merge_string::do_add_input_section): Likewise.
852 * object.cc (need_decompressed_section): New function.
853 (build_compressed_section_map): Decompress sections needed later.
854 (Sized_relobj_file::do_decompressed_section_contents): New function.
855 (Sized_relobj_file::do_discard_decompressed_sections): New function.
856 * object.h (Object::decompressed_section_contents): New function.
857 (Object::discard_decompressed_sections): New function.
858 (Object::do_decompressed_section_contents): New function.
859 (Object::do_discard_decompressed_sections): New function.
860 (Compressed_section_info): New type.
861 (Compressed_section_map): Include decompressed section contents.
862 (Sized_relobj_file::do_decompressed_section_contents): New function.
863 (Sized_relobj_file::do_discard_decompressed_sections): New function.
864
865 2012-02-16 Cary Coutant <ccoutant@google.com>
866
867 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
868 * testsuite/Makefile.in: Regenerate.
869
870 2012-02-14 Cary Coutant <ccoutant@google.com>
871
872 * options.cc (General_options::finalize): Disallow -pie and -static.
873
874 2012-02-03 Doug Kwan <dougkwan@google.com>
875
876 * arm.cc (Arm_relocate_functions::abs8,
877 Arm_relocate_functions::abs16): Use
878 Bits::has_signed_unsigned_overflow32.
879 (Arm_relocate_functions::thm_abs8): Correct range of
880 overflow check.
881 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
882 in assertions.
883
884 2012-02-02 Doug Kwan <dougkwan@google.com>
885
886 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
887 position independent outputs, not just shared objects.
888
889 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
890
891 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
892 * configure: Regenerated.
893
894 2012-01-27 Ian Lance Taylor <iant@google.com>
895
896 * reloc.h (Bits): New class with static functions, copied from
897 namespace utils in arm.cc.
898 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
899 instead.
900
901 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
902
903 * incremental.cc (write_info_blocks): Correct relocation offset.
904
905 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
906
907 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
908 (Relocate::tls_gd_to_le): Likewise.
909
910 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
911
912 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
913
914 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
915
916 * configure.ac: Check if -mcmodel=medium works.
917 * configure: Regenerated.
918
919 2012-01-24 Cary Coutant <ccoutant@google.com>
920
921 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
922 definition and ...
923 (read_unsigned_LEB_128_x): ... this new function.
924 (read_signed_LEB_128): Replaced with inline definition and ...
925 (read_signed_LEB_128_x): ... this new function.
926 * int_encoding.h (read_unsigned_LEB_128_x): New function.
927 (read_unsigned_LEB_128): Add inline definition.
928 (read_signed_LEB_128_x): New function.
929 (read_signed_LEB_128): Add inline definition.
930 * testsuite/Makefile.am (leb128_unittest): New unit test.
931 * testsuite/Makefile.in: Regenerate.
932 * testsuite/leb128_unittest.cc: New unit test.
933
934 2012-01-23 Ian Lance Taylor <iant@google.com>
935
936 PR gold/13617
937 * i386.cc (Target_i386::do_code_fill): When using a jmp
938 instruction, pad with nop instructions.
939 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
940
941 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
942
943 * x86_64.cc (gc_process_relocs): Add typename on types used in
944 template.
945 (scan_relocs): Likewise.
946 (relocate_section): Likewise.
947 (apply_relocation): Likewise.
948
949 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
950
951 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
952 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
953 under x32.
954
955 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
956
957 * x86_64.cc: Initial support for x32.
958
959 2012-01-03 Cary Coutant <ccoutant@google.com>
960
961 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
962 Use abstract base class for GOT.
963 * gold/output.h (class Output_data_got_base): New abstract base class.
964 (class Output_data_got): Derive from new base class, adjust ctors.
965 (Output_data_got::reserve_slot): Make virtual; rename to
966 do_reserve_slot; Adjust callers.
967 * gold/target.h (Sized_target::init_got_plt_for_update): Return
968 pointer to abstract base class.
969 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
970
971 2011-12-18 Ian Lance Taylor <iant@google.com>
972
973 * object.h (Relobj::local_symbol_value): New function.
974 (Relobj::local_plt_offset): New function.
975 (Relobj::local_has_got_offset): New function.
976 (Relobj::local_got_offset): New function.
977 (Relobj::set_local_got_offset): New function.
978 (Relobj::do_local_symbol_value): New pure virtual function.
979 (Relobj::do_local_plt_offset): Likewise.
980 (Relobj::do_local_has_got_offset): Likewise.
981 (Relobj::do_local_got_offset): Likewise.
982 (Relobj::do_set_local_got_offset): Likewise.
983 (Sized_relobj::do_local_has_got_offset): Rename from
984 local_has_got_offset.
985 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
986 (Sized_relobj::do_set_local_got_offset): Rename from
987 set_local_got_offset.
988 (Sized_relobj_file::do_local_plt_offset): Rename from
989 local_plt_offset.
990 (Sized_relobj_file::do_local_symbol_value): New function.
991 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
992 local_plt_offset.
993 * output.cc (Output_data_got::Got_entry::write): Change object to
994 Relobj. Use local_symbol_value.
995 (Output_data_got::add_global_with_rel): Change rel_dyn to
996 Output_data_reloc_generic*. Use add_global_generic.
997 (Output_data_got::add_global_with_rela): Remove. Change all
998 callers to use add_global_with_rel.
999 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1000 Output_data_reloc_generic*. Use add_global_generic.
1001 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1002 callers to use add_global_pair_with_rel.
1003 (Output_data_got::add_local): Change object to Relobj*.
1004 (Output_data_got::add_local_plt): Likewise.
1005 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1006 change rel_dyn to Output_data_reloc_generic*. Use
1007 add_local_generic.
1008 (Output_data_got::add_local_with_rela): Remove. Change all
1009 callers to use all_local_with_rel.
1010 (Output_data_got::add_local_pair_with_rel): Change object to
1011 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1012 add_output_section_generic.
1013 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1014 callers to use add_local_pair_with_rel.
1015 (Output_data_got::reserve_local): Change object to Relobj*.
1016 * output.h: (class Output_data_reloc_generic): Add pure virtual
1017 declarations for add_global_generic, add_local_generic,
1018 add_output_section_generic.
1019 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1020 functions for Output_data_reloc_generic. Update declarations for
1021 changes listed in output.cc.
1022 (class Output_data_got): Change template parameter to got_size.
1023 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1024 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1025 function.
1026 (Sized_relobj_incr::do_local_plt_offset): New function.
1027 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1028 add_global_generic.
1029
1030 2011-12-17 Cary Coutant <ccoutant@google.com>
1031
1032 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1033 * resolve.cc (Symbol_table::resolve): Likewise.
1034 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1035 arrays.
1036 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1037
1038 2011-12-16 Ian Lance Taylor <iant@google.com>
1039
1040 * output.h (Output_data_reloc_generic::add): Only call
1041 add_dynamic_reloc if this is a dynamic reloc section.
1042
1043 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1044
1045 PR gold/13505
1046 * target-reloc.h (apply_relocation): Replace <64, false> with
1047 <size, big_endian>.
1048
1049 2011-11-25 Nick Clifton <nickc@redhat.com>
1050
1051 * po/it.po: New Italian translation.
1052
1053 2011-11-17 Sterling Augustine <saugustine@google.com>
1054
1055 * script.cc (script_include_directive): Implement.
1056 (read_script_file): New local variables name and search_path. Update
1057 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1058 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1059 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1060
1061 2011-11-11 Sterling Augustine <saugustine@google.com>
1062
1063 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1064 (file_or_sections_cmd): Likewise.
1065
1066 2011-11-11 Doug Kwan <dougkwan@google.com>
1067
1068 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1069 if --just-symbols is given.
1070
1071 2011-11-10 Doug Kwan <dougkwan@google.com>
1072
1073 PR gold/13362
1074 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1075 when processing data relocs.
1076 * reloc.h (Relocate_functions::rel_unaligned): New method.
1077 (Relocate_functions::pcrel_unaligned): Ditto.
1078 (Relocate_functions::rel32_unaligned): Ditto.
1079 (Relocate_functions::pcrel32_unaligned): Ditto.
1080
1081 2011-11-09 Doug Kwan <dougkwan@google.com>
1082
1083 PR gold/13362
1084 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1085 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1086 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1087 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1088 (Relocate_functions::rel_unaligned): New.
1089 (Relocate_functions::rel32_unaligned): New.
1090 * target-reloc.h (relocate_for_relocatable): Add code to handle
1091 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1092 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1093 arm_unaligned_reloc_r): New targets.
1094 * testsuite/Makefile.in: Regenerate.
1095 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1096 linking.
1097
1098 2011-11-02 Ian Lance Taylor <iant@google.com>
1099
1100 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1101 NATIVE_LINKER.
1102 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1103 * options.cc (General_options::finalize): Use library search path
1104 from configure script if specified. If not native and no sysroot,
1105 only search TOOLLIBDIR.
1106 * options.h (Search_directory::Search_directory): Change name to
1107 const std::string&.
1108 (General_options::add_to_library_path_with_sysroot): Change arg to
1109 const std::string&.
1110 * configure, Makefile.in, config.in: Rebuild.
1111
1112 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1113
1114 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1115 we are working around the ARM1176 Erratum.
1116 * options.h (General_options::fix_arm1176): Add option.
1117 * testsuite/Makefile.am: Add testcases, and keep current ones
1118 working.
1119 * testsuite/Makefile.in: Regenerate.
1120 * testsuite/arm_fix_1176.s: New file.
1121 * testsuite/arm_fix_1176.sh: Likewise.
1122
1123 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1124
1125 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1126 may_use_blx_.
1127 (Target_arm::may_use_blx): Remove method.
1128 (Target_arm::set_may_use_blx): Likewise.
1129 (Target_arm::may_use_v4t_interworking): New method.
1130 (Target_arm::may_use_v5t_interworking): Likewise.
1131 (Target_arm::may_use_blx_): Remove member variable.
1132 (Arm_relocate_functions::arm_branch_common): Check for v5T
1133 interworking.
1134 (Arm_relocate_functions::thumb_branch_common): Likewise.
1135 (Reloc_stub::stub_type_for_reloc): Likewise.
1136 (Target_arm::do_finalize_sections): Correct interworking checks.
1137 * testsuite/Makefile.am: Add new tests.
1138 * testsuite/Makefile.in: Regenerate.
1139 * testsuite/arm_farcall_arm_arm.s: New test.
1140 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1141 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1142 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1143 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1144 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1145 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1146 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1147
1148 2011-10-31 Cary Coutant <ccoutant@google.com>
1149
1150 PR gold/13023
1151 * expression.cc (Expression::eval_with_dot): Add
1152 is_section_dot_assignment parameter.
1153 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1154 absolute and assigning to dot within a section.
1155 * script-sections.cc
1156 (Output_section_element_assignment::set_section_addresses): Pass
1157 dot_section to set_if_absolute.
1158 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1159 as is_section_dot_assignment flag to eval_with_dot.
1160 (Output_section_element_dot_assignment::set_section_addresses):
1161 Likewise.
1162 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1163 parameter. Also set value if relative to dot_section; set the
1164 symbol's output_section.
1165 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1166 parameter. Adjust all callers.
1167 (Expression::eval_maybe_dot): Likewise.
1168 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1169 Adjust all callers.
1170 * testsuite/script_test_2.t: Test assignment of an absolute value
1171 to dot within an output section element.
1172
1173 2011-10-31 Cary Coutant <ccoutant@google.com>
1174
1175 * options.h (class General_options): Add --[no-]gnu-unique options.
1176 * symtab.cc (Symbol_table::sized_write_globals): Convert
1177 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1178
1179 2011-10-31 Cary Coutant <ccoutant@google.com>
1180
1181 PR gold/13359
1182 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1183 unnecessary assertion.
1184 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1185
1186 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1187
1188 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1189 gc_mark_symbol.
1190 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1191 gc_mark_symbol.
1192 Change to just keep the section associated with symbol.
1193 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1194 they are externally visible and --export-dynamic is turned on.
1195 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1196
1197 2011-10-19 Ian Lance Taylor <iant@google.com>
1198
1199 PR gold/13163
1200 * script-sections.cc
1201 (Output_section_element_dot_assignment::needs_output_section): New
1202 function.
1203
1204 2011-10-19 Ian Lance Taylor <iant@google.com>
1205
1206 PR gold/13204
1207 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1208 --section-start option was seen.
1209 * options.h (General_options::any_section_start): New function.
1210
1211 2011-10-18 David S. Miller <davem@davemloft.net>
1212
1213 PR binutils/13301
1214 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1215 member to track relocation locations that have moved during TLS
1216 reloc optimizations.
1217 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1218 (Target_sparc::Relocate::relocate): Adjust view down by 4
1219 bytes if it matches reloc_adjust_addr_.
1220 (Target_sparc::Relocate::relocate_tls): Always move the
1221 __tls_get_addr call delay slot instruction forward 4 bytes when
1222 performing relaxation.
1223
1224 2011-10-18 Cary Coutant <ccoutant@google.com>
1225
1226 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1227 (Output_file::map_no_anonymous): Check for non-zero
1228 return code from posix_fallocate.
1229
1230 2011-10-17 Cary Coutant <ccoutant@google.com>
1231
1232 PR gold/13245
1233 * plugin.cc (is_visible_from_outside): Check for symbols
1234 referenced from dynamic objects.
1235 * resolve.cc (Symbol_table::resolve): Don't count references
1236 from dynamic objects as references from real ELF files.
1237 * testsuite/plugin_test_2.sh: Adjust expected result.
1238
1239 2011-10-17 Cary Coutant <ccoutant@google.com>
1240
1241 * gold.cc: Include timer.h.
1242 (queue_middle_tasks): Stamp time.
1243 (queue_final_tasks): Likewise.
1244 * main.cc (main): Store timer in parameters. Print timers
1245 for each pass.
1246 * parameters.cc (Parameters::Parameters): Initialize timer_.
1247 (Parameters::set_timer): New function.
1248 (set_parameters_timer): New function.
1249 * parameters.h (Parameters::set_timer): New function.
1250 (Parameters::timer): New function.
1251 (Parameters::timer_): New data member.
1252 (set_parameters_timer): New function.
1253 * timer.cc (Timer::stamp): New function.
1254 (Timer::get_pass_time): New function.
1255 * timer.h (Timer::stamp): New function.
1256 (Timer::get_pass_time): New function.
1257 (Timer::pass_times_): New data member.
1258
1259 2011-10-17 Cary Coutant <ccoutant@google.com>
1260
1261 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1262 task for members of lib groups.
1263
1264 2011-10-17 Cary Coutant <ccoutant@google.com>
1265
1266 PR gold/13288
1267 * fileread.cc (File_read::find_view): Add assert.
1268 (File_read::make_view): Move bounds check (replace with assert)...
1269 (File_read::find_or_make_view): ... to here.
1270
1271 2011-10-12 Cary Coutant <ccoutant@google.com>
1272
1273 * output.cc (Output_file::open_base_file): Handle case where
1274 ::read returns less than requested size.
1275
1276 2011-10-10 Cary Coutant <ccoutant@google.com>
1277
1278 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1279 Initialize defined_count_.
1280 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1281 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1282 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1283 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1284 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1285 * incremental.h (Sized_relobj_incr::defined_count_): New data
1286 member.
1287 (Sized_incr_dynobj::defined_count_): New data member.
1288 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1289 Return zeroes instead of internal error.
1290
1291 2011-10-10 Cary Coutant <ccoutant@google.com>
1292
1293 PR gold/13249
1294 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1295 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1296 * output.h (class Output_reloc): Add use_plt_offset flag.
1297 (Output_reloc::type_): Adjust size of bit field.
1298 (Output_reloc::use_plt_offset_): New bit field.
1299 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1300 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1301 flag. Adjust all callers.
1302 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1303 creating RELATIVE relocations.
1304
1305 2011-10-10 Nick Clifton <nickc@redhat.com>
1306
1307 * po/es.po: Updated Spanish translation.
1308 * po/fi.po: Updated Finnish translation.
1309
1310 2011-10-03 Diego Novillo <dnovillo@google.com>
1311
1312 * options.cc (parse_uint): Fix dereference of RETVAL.
1313
1314 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1315
1316 * layout.h (section_order_map_): New member.
1317 (get_section_order_map): New member function.
1318 * output.cc (Output_section::add_input_section): Check for patterns
1319 only when --section-ordering-file is specified.
1320 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1321 output_sections have been formed.
1322 * layout.cc (Layout_Layout): Initialize section_order_map_.
1323 * plugin.cc (update_section_order): Store order in order_map. Do not
1324 update the order.
1325 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1326 * testsuite/Makefile.in: Regenerate.
1327 * testsuite/plugin_section_order.c: New file.
1328 * testsuite/plugin_final_layout.cc: New file.
1329 * testsuite/plugin_final_layout.sh: New file.
1330
1331 2011-09-29 Cary Coutant <ccoutant@google.com>
1332
1333 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1334 Check for NULL.
1335 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1336 symbols during incremental update.
1337 (Symbol_table::add_from_dynobj): Likewise.
1338
1339 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1340 Ian Lance Taylor <iant@google.com>
1341
1342 * symtab.cc (Symbol_table::define_special_symbol): Always
1343 canonicalize version string.
1344
1345 2011-09-26 Cary Coutant <ccoutant@google.com>
1346
1347 * gold.cc (queue_initial_tasks): Move option checks ...
1348 * options.cc (General_options::finalize): ... to here. Disable
1349 some options; make others fatal.
1350
1351 2011-09-26 Cary Coutant <ccoutant@google.com>
1352
1353 gcc PR lto/47247
1354 * plugin.cc (get_symbols_v2): New function.
1355 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1356 (is_referenced_from_outside): New function.
1357 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1358 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1359 (get_symbols): Pass version parameter.
1360 (get_symbols_v2): New function.
1361 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1362 parameter.
1363 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1364 (onload): Add LDPT_GET_SYMBOLS_V2.
1365 (all_symbols_read_hook): Use get_symbols_v2; check for
1366 LDPR_PREVAILING_DEF_IRONLY_EXP.
1367 * testsuite/plugin_test_3.sh: Update expected results.
1368
1369 2011-09-23 Simon Baldwin <simonb@google.com>
1370
1371 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1372 configuration options.
1373 * configure: Regenerate.
1374 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1375 * Makefile.in: Regenerate.
1376 * testsuite/Makefile.in: Regenerate.
1377
1378 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1379
1380 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1381
1382 2011-09-19 Cary Coutant <ccoutant@google.com>
1383
1384 * incremental.cc (can_incremental_update): Fix typo in comment.
1385 * incremental.h (can_incremental_update): Likewise.
1386
1387 2011-09-18 Cary Coutant <ccoutant@google.com>
1388
1389 * incremental.cc (can_incremental_update): New function.
1390 * incremental.h (can_incremental_update): New function.
1391 * layout.cc (Layout::init_fixed_output_section): Call it.
1392 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1393 * object.cc (Sized_relobj_file::do_layout): Call
1394 can_incremental_update.
1395
1396 2011-09-13 Cary Coutant <ccoutant@google.com>
1397
1398 * configure.ac: Check for glibc support for gnu_indirect_function
1399 support with static linking, setting automake conditional
1400 IFUNC_STATIC.
1401 * Makefile.in: Regenerate.
1402 * configure: Regenerate.
1403
1404 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1405 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1406 for IFUNC_STATIC.
1407 * testsuite/Makefile.in: Regenerate.
1408
1409 2011-09-13 Cary Coutant <ccoutant@google.com>
1410
1411 * incremental.cc (Sized_relobj_incr::do_layout): Call
1412 report_comdat_group for kept comdat sections.
1413 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1414 * testsuite/Makefile.in: Regenerate.
1415 * testsuite/incr_comdat_test_1.cc: New source file.
1416 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1417 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1418 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1419
1420 2011-09-13 Ian Lance Taylor <iant@google.com>
1421
1422 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1423 variable external_symbols_offset.
1424
1425 2011-09-12 Ian Lance Taylor <iant@google.com>
1426
1427 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1428 triggered if object has no symbols.
1429
1430 2011-09-09 David S. Miller <davem@davemloft.net>
1431
1432 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1433 (Output_fill_debug_line::do_write): Likewise.
1434
1435 2011-08-29 Cary Coutant <ccoutant@google.com>
1436
1437 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1438 casts to match formatting specs.
1439 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1440
1441 2011-08-26 Cary Coutant <ccoutant@google.com>
1442
1443 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1444 remaining hole size when allocating.
1445 (Layout::make_output_section): Set fill methods for debug sections.
1446 * layout.h (Free_list::Free_list_node): Move from private to
1447 public.
1448 (Free_list::set_min_hole_size): New function.
1449 (Free_list::begin, Free_list::end): New functions.
1450 (Free_list::min_hole_): New data member.
1451 * output.cc: Include dwarf.h.
1452 (Output_fill_debug_info::do_minimum_hole_size): New function.
1453 (Output_fill_debug_info::do_write): New function.
1454 (Output_fill_debug_line::do_minimum_hole_size): New function.
1455 (Output_fill_debug_line::do_write): New function.
1456 (Output_section::Output_section): Initialize new data member.
1457 (Output_section::set_final_data_size): Ensure patch space is larger
1458 than minimum hole size.
1459 (Output_section::do_write): Fill holes in debug sections.
1460 * output.h (Output_fill): New class.
1461 (Output_fill_debug_info): New class.
1462 (Output_fill_debug_line): New class.
1463 (Output_section::set_free_space_fill): New function.
1464 (Output_section::free_space_fill_): New data member.
1465 * testsuite/Makefile.am (incremental_test_3): Add
1466 --incremental-patch option.
1467 (incremental_test_4): Likewise.
1468 (incremental_test_5): Likewise.
1469 (incremental_test_6): Likewise.
1470 (incremental_copy_test): Likewise.
1471 (incremental_common_test_1): Likewise.
1472 * testsuite/Makefile.in: Regenerate.
1473
1474 2011-08-26 Nick Clifton <nickc@redhat.com>
1475
1476 * po/es.po: Updated Spanish translation.
1477
1478 2011-08-01 Cary Coutant <ccoutant@google.com>
1479
1480 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1481 * gold/testsuite/Makefile.in: Regenerate.
1482 * gold/testsuite/justsyms_exec.c: New source file.
1483 * gold/testsuite/justsyms_lib.c: New source file.
1484
1485 2011-08-01 Cary Coutant <ccoutant@google.com>
1486
1487 * layout.cc (Layout::set_segment_offsets): Don't realign text
1488 segment if -Ttext was specified.
1489 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1490 file type.
1491 * object.h (Sized_relobj_file::e_type): New function.
1492 (Sized_relobj_file::e_type_): New data member.
1493 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1494 base address for ET_EXEC files.
1495 * target.cc (Target::do_make_elf_object_implementation): Allow
1496 ET_EXEC files with --just-symbols option.
1497
1498 2011-07-28 Cary Coutant <ccoutant@google.com>
1499
1500 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1501 Add thread_number parameter.
1502 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1503 * workqueue-threads.cc
1504 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1505 current thread if its thread number is greater than desired thread
1506 count.
1507 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1508 Add thread_number parameter.
1509 (Workqueue::should_cancel_thread): Likewise.
1510 (Workqueue::find_runnable_or_wait): Pass thread_number to
1511 should_cancel_thread.
1512 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1513 parameter.
1514
1515 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1516
1517 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1518 only after checking if it cannot be forced local.
1519 * symtab.h (is_externally_visible): Check if the symbol is not forced
1520 local.
1521
1522 2011-07-15 Ian Lance Taylor <iant@google.com>
1523
1524 * options.h (class General_options): Add --print-output-format.
1525 Move -EL next to -EB, for better --help output.
1526 * target-select.cc: Include <cstdio>, "options.h", and
1527 "parameters.h".
1528 (Target_selector::do_target_bfd_name): New function.
1529 (print_output_format): New function.
1530 * target-select.h (class Target_selector): Update declarations.
1531 (Target_selector::target_bfd_name): New function.
1532 (print_output_format): Declare.
1533 * main.cc: Include "target-select.h".
1534 (main): Handle --print-output-format.
1535 * gold.cc: Include "target-select.h".
1536 (queue_initial_tasks): Handle --print-output-format when there are
1537 no input files.
1538 * parameters.cc (parameters_force_valid_target): Give a better
1539 error message if -EB/-EL does not match target.
1540 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1541 function.
1542
1543 2011-07-15 Ian Lance Taylor <iant@google.com>
1544
1545 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1546 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1547 (Output_data_plt_i386::do_write): Write address of .dynamic
1548 section to first entry in .got.plt section.
1549 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1550 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1551 Initialize layout_.
1552 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1553 section to first entry in .got.plt section.
1554 * layout.h (Layout::dynamic_section): New function.
1555
1556 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1557
1558 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1559 to claim_file call.
1560 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1561 input_section_position_, and input_section_glob_.
1562 (read_layout_from_file): Call function section_ordering_specified.
1563 * layout.h (is_section_ordering_specified): New function.
1564 (section_ordering_specified): New function.
1565 (section_ordering_specified_): New boolean member.
1566 * main.cc(main): Call load_plugins after layout object is defined.
1567 * output.cc (Output_section::add_input_section): Use
1568 function section_ordering_specified to check if section ordering is
1569 needed.
1570 * output.cc (Output_section::add_relaxed_input_section): Use
1571 function section_ordering_specified to check if section ordering is
1572 needed.
1573 (Output_section::update_section_layout): New function.
1574 (Output_section::sort_attached_input_sections): Check if input section
1575 must be reordered.
1576 * output.h (Output_section::update_section_layout): New function.
1577 * plugin.cc (get_section_count): New function.
1578 (get_section_type): New function.
1579 (get_section_name): New function.
1580 (get_section_contents): New function.
1581 (update_section_order): New function.
1582 (allow_section_ordering): New function.
1583 (Plugin::load): Add the new interfaces to the transfer vector.
1584 (Plugin_manager::load_plugins): New parameter.
1585 (Plugin_manager::all_symbols_read): New parameter.
1586 (Plugin_manager::claim_file): New parameter. Save the elf object for
1587 unclaimed objects.
1588 (Plugin_manager::get_elf_object): New function.
1589 (Plugin_manager::get_view): Change to directly use the bool to check
1590 if get_view is called from claim_file_hook.
1591 * plugin.h (input_objects): New function
1592 (Plugin__manager::load_plugins): New parameter.
1593 (Plugin_manager::claim_file): New parameter.
1594 (Plugin_manager::get_elf_object): New function.
1595 (Plugin_manager::in_claim_file_handler): New function.
1596 (Plugin_manager::in_claim_file_handler_): New member.
1597 (layout): New function.
1598 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1599 handler with an extra parameter. Make the elf object before calling
1600 claim_file handler.
1601 * testsuite/plugin_test.c (get_section_count): New function pointer.
1602 (get_section_type): New function pointer.
1603 (get_section_name): New function pointer.
1604 (get_section_contents): New function pointer.
1605 (update_section_order): New function pointer.
1606 (allow_section_ordering): New function pointer.
1607 (onload): Check if the new interfaces exist.
1608
1609 2011-07-13 Ian Lance Taylor <iant@google.com>
1610
1611 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1612 relro section.
1613 * x86_64.cc (Target_x86_64::got_section): Likewise.
1614 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1615 (relro_now_test_SOURCES): New variable.
1616 (relro_now_test_DEPENDENCIES): New variable.
1617 (relro_now_test_LDFLAGS): New variable.
1618 (relro_now_test_LDADD): New variable.
1619 (relro_now_test.so): New target.
1620 * testsuite/Makefile.in: Rebuild.
1621
1622 2011-07-12 Ian Lance Taylor <iant@google.com>
1623
1624 PR gold/12980
1625 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1626 GLOB_DAT relocation rather than a RELATIVE relocation for a
1627 protected symbol when creating a shared library.
1628 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1629 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1630 * testsuite/protected_main_1.cc (main): Test that protected
1631 function has same address.
1632
1633 2011-07-11 Ian Lance Taylor <iant@google.com>
1634
1635 PR gold/12979
1636 * options.h (class General_options): Add -Bgroup.
1637 * options.cc (General_options::finalize): If -Bgroup is set,
1638 default to --unresolved-symbols=report-all.
1639 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1640 * target-reloc.h (issue_undefined_symbol_error): Handle
1641 --unresolved-symbols=report-all.
1642
1643 2011-07-08 Ian Lance Taylor <iant@google.com>
1644
1645 PR gold/11985
1646 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1647 if linker script discards key sections.
1648 (Layout::create_dynamic_symtab): Likewise.
1649 (Layout::assign_local_dynsym_offsets): Likewise.
1650 (Layout::sized_create_version_sections): Likewise.
1651 (Layout::create_interp): Likewise.
1652 (Layout::finish_dynamic_section): Likewise.
1653 (Layout::set_dynamic_symbol_size): Likewise.
1654
1655 2011-07-08 Ian Lance Taylor <iant@google.com>
1656
1657 PR gold/12386
1658 * options.h (class General_options): Add --unresolved-symbols.
1659 * target-reloc.h (issue_undefined_symbol_error): Check
1660 --unresolved-symbols. Add comments.
1661
1662 2011-07-08 Ian Lance Taylor <iant@google.com>
1663
1664 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1665 expression more complex.
1666
1667 2011-07-08 Ian Lance Taylor <iant@google.com>
1668
1669 PR gold/11317
1670 * target-reloc.h (issue_undefined_symbol_error): New inline
1671 function, broken out of relocate_section.
1672 (relocate_section): Call issue_undefined_symbol_error.
1673 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1674 there is no TLS segment if we are about to issue an undefined
1675 symbol error.
1676 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1677
1678 2011-07-08 Ian Lance Taylor <iant@google.com>
1679
1680 PR gold/12279
1681 * resolve.cc (Symbol_table::should_override): Add fromtype
1682 parameter. Change all callers. Give error when linking together
1683 TLS and non-TLS symbol.
1684 (Symbol_table::should_override_with_special): Add fromtype
1685 parameter. Change all callers.
1686 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1687 there is no TLS segment if we have reported some errors.
1688 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1689
1690 2011-07-08 Ian Lance Taylor <iant@google.com>
1691
1692 PR gold/12372
1693 * target.h (Target::plt_address_for_global): New function.
1694 (Target::plt_address_for_local): New function.
1695 (Target::plt_section_for_global): Remove.
1696 (Target::plt_section_for_local): Remove.
1697 (Target::do_plt_address_for_global): New virtual function.
1698 (Target::do_plt_address_for_local): New virtual function.
1699 (Target::do_plt_section_for_global): Remove.
1700 (Target::do_plt_section_for_local): Remove.
1701 (Target::register_global_plt_entry): Add Symbol_table and Layout
1702 parameters.
1703 * output.cc (Output_data_got::Got_entry::write): Use
1704 plt_address_for_global and plt_address_for_local.
1705 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1706 address of output section.
1707 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1708 got_irelative_, and irelative_count_ fields. Update
1709 declarations.
1710 (Output_data_plt_i386::has_irelative_section): New function.
1711 (Output_data_plt_i386::entry_count): Add irelative_count_.
1712 (Output_data_plt_i386::set_final_data_size): Likewise.
1713 (class Target_i386): Add got_irelative_ and rel_irelative_
1714 fields. Update declarations.
1715 (Target_i386::Target_i386): Initialize new fields.
1716 (Target_i386::do_plt_address_for_global): New function replacing
1717 do_plt_section_for_global.
1718 (Target_i386::do_plt_address_for_local): New function replacing
1719 do_plt_section_for_local.
1720 (Target_i386::got_section): Create got_irelative_.
1721 (Target_i386::rel_irelative_section): New function.
1722 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1723 fields. Don't define __rel_iplt_{start,end}.
1724 (Output_data_plt_i386::add_entry): Add symtab and layout
1725 parameters. Change all callers. Use different PLT and GOT for
1726 IFUNC symbols.
1727 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1728 layout parameters. Change all callers. Use different PLT and
1729 GOT.
1730 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1731 (Output_data_plt_i386::rel_irelative): New function.
1732 (Output_data_plt_i386::address_for_global): New function.
1733 (Output_data_plt_i386::address_for_local): New function.
1734 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1735 IRELATIVE GOT when changing IFUNC GOT entries.
1736 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1737 reloc.
1738 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1739 if we didn't create an IRELATIVE GOT.
1740 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1741 plt_address_for_local.
1742 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1743 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1744 got_irelative_, and irelative_count_ fields. Update
1745 declarations.
1746 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1747 Initialize new fields. Remove symtab parameter. Change all
1748 callers.
1749 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1750 irelative_count_.
1751 (Output_data_plt_x86_64::has_irelative_section): New function.
1752 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1753 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1754 fields. Update declarations.
1755 (Target_x86_64::Target_x86_64): Initialize new fields.
1756 (Target_x86_64::do_plt_address_for_global): New function replacing
1757 do_plt_section_for_global.
1758 (Target_x86_64::do_plt_address_for_local): New function replacing
1759 do_plt_section_for_local.
1760 (Target_x86_64::got_section): Create got_irelative_.
1761 (Target_x86_64::rela_irelative_section): New function.
1762 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1763 all callers. Don't create __rel_iplt_{start,end}.
1764 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1765 parameters. Change all callers. Use different PLT and GOT for
1766 IFUNC symbols.
1767 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1768 layout parameters. Change all callers. Use different PLT and
1769 GOT.
1770 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1771 parameters. Change all callers. Use different PLT and GOT for
1772 IFUNC symbols.
1773 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1774 (Output_data_plt_x86_64::rela_irelative): New function.
1775 (Output_data_plt_x86_64::address_for_global): New function.
1776 (Output_data_plt_x86_64::address_for_local): New function.
1777 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1778 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1779 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1780 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1781 parameters.
1782 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1783 reloc.
1784 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1785 symbols if we didn't create an IRELATIVE GOT.
1786 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1787 plt_address_for_local.
1788 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1789 * testsuite/ifuncvar1.c: New test file.
1790 * testsuite/ifuncvar2.c: New test file.
1791 * testsuite/ifuncvar3.c: New test file.
1792 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1793 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1794 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1795 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1796 * testsuite/Makefile.in: Rebuild.
1797
1798 2011-07-07 Cary Coutant <ccoutant@google.com>
1799
1800 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1801 (two_file_test_1_ndebug.o): Likewise.
1802 (two_file_test_1b_ndebug.o): Likewise.
1803 (two_file_test_2_ndebug.o): Likewise.
1804 (two_file_test_main_ndebug.o): Likewise.
1805 (incremental_test_2): Link with no-debug versions.
1806
1807 2011-07-06 Cary Coutant <ccoutant@google.com>
1808
1809 * gold/incremental.cc
1810 (Output_section_incremental_inputs::write_info_blocks): Check for
1811 hidden and internal symbols.
1812
1813 2011-07-06 Cary Coutant <ccoutant@google.com>
1814
1815 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1816 Check disposition for startup file.
1817 (Incremental_inputs::report_command_line): Ignore
1818 --incremental-startup-unchanged option.
1819 * options.cc (General_options::parse_incremental_startup_unchanged):
1820 New function.
1821 (General_options::General_options): Initialize new data member.
1822 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1823 (General_options): Add --incremental-startup-unchanged option.
1824 (General_options::incremental_startup_disposition): New function.
1825 (General_options::incremental_startup_disposition_): New data member.
1826
1827 2011-07-06 Cary Coutant <ccoutant@google.com>
1828
1829 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1830 input file index to Script_info ctor.
1831 (Sized_incremental_binary::do_file_has_changed): Find the
1832 command-line argument for files named in scripts.
1833 * incremental.h (Script_info::Script_info): New ctor
1834 with input file index.
1835 (Script_info::input_file_index): New function.
1836 (Script_info::input_file_index_): New data member.
1837 (Incremental_binary::get_library): Add const.
1838 (Incremental_binary::get_script_info): Add const.
1839 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1840 * testsuite/Makefile.am (incremental_test_5): New test case.
1841 (incremental_test_6): New test case.
1842 * testsuite/Makefile.in: Regenerate.
1843
1844 2011-07-06 Cary Coutant <ccoutant@google.com>
1845
1846 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1847 debug output when command lines differ.
1848
1849 2011-07-06 Cary Coutant <ccoutant@google.com>
1850
1851 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1852 --incremental-patch option.
1853 * layout.cc (Free_list::allocate): Extend allocation beyond original
1854 end if enabled.
1855 (Layout::make_output_section): Mark sections that should get
1856 patch space.
1857 * options.cc (parse_percent): New function.
1858 * options.h (parse_percent): New function.
1859 (DEFINE_percent): New macro.
1860 (General_options): Add --incremental-patch option.
1861 * output.cc (Output_section::Output_section): Initialize new data
1862 members.
1863 (Output_section::add_input_section): Print section name when out
1864 of patch space.
1865 (Output_section::add_output_section_data): Likewise.
1866 (Output_section::set_final_data_size): Add patch space when
1867 doing --incremental-full.
1868 (Output_section::do_reset_address_and_file_offset): Remove patch
1869 space.
1870 (Output_segment::set_section_list_addresses): Print debug output
1871 only if --incremental-update.
1872 * output.h (Output_section::set_is_patch_space_allowed): New function.
1873 (Output_section::is_patch_space_allowed_): New data member.
1874 (Output_section::patch_space_): New data member.
1875 * parameters.cc (Parameters::incremental_full): New function.
1876 * parameters.h (Parameters::incremental_full): New function
1877 * testsuite/Makefile.am (incremental_test_2): Add test for
1878 --incremental-patch option.
1879 * testsuite/Makefile.in: Regenerate.
1880 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1881 (t18): Remove function body.
1882
1883 2011-07-05 Doug Kwan <dougkwan@google.com>
1884
1885 PR gold/12771
1886 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1887 Arm_Address type for relocation result.
1888 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1889 overflow check.
1890 (Arm_relocate_functions::abs32): Use unaligned access.
1891 (Arm_relocate_functions::rel32): Ditto.
1892 (Arm_relocate_functions::prel31): Ditto.
1893 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1894 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1895 static data relocations.
1896 * testsuite/Makefile.in: Regnerate.
1897 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1898
1899 2011-07-05 Ian Lance Taylor <iant@google.com>
1900
1901 PR gold/12392
1902 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1903 symbols if necessary.
1904 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1905
1906 2011-07-05 Ian Lance Taylor <iant@google.com>
1907
1908 PR gold/12952
1909 * resolve.cc (Symbol::override_base_with_special): Simply override
1910 version with special symbol version, ignoring previous version.
1911
1912 2011-07-05 Ian Lance Taylor <iant@google.com>
1913
1914 * object.cc (Sized_relobj_file::include_section_group): Add
1915 information to comment about signature location.
1916
1917 2011-07-02 Ian Lance Taylor <iant@google.com>
1918
1919 PR gold/12957
1920 * options.h (class General_options): Add -f and -F.
1921 * options.cc (General_options::finalize): Fatal error if -f/-F
1922 are used without -shared.
1923 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1924
1925 2011-07-02 Ian Lance Taylor <iant@google.com>
1926
1927 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1928
1929 2011-07-01 Ian Lance Taylor <iant@google.com>
1930
1931 PR gold/12525
1932 PR gold/12952
1933 * resolve.cc (Symbol::override_base_with_special): Don't override
1934 the version if the overriding symbol has a different name.
1935 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1936 all callers. If we give an error about an undefined version,
1937 define the base version if necessary.
1938 * dynobj.h (class Versions): Update declaration.
1939 * testsuite/weak_alias_test_5.cc: New file.
1940 * testsuite/weak_alias_test.script: New file.
1941 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1942 and versioned_alias have the right value, and call t2.
1943 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1944 weak_alias_test_5.so.
1945 (weak_alias_test_LDADD): Likewise.
1946 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1947 * testsuite/Makefile.in: Rebuild.
1948
1949 2011-07-01 Ian Lance Taylor <iant@google.com>
1950
1951 PR gold/12525
1952 * options.h (class General_options): Support -z notext.
1953 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1954 -Wl,-z,notext.
1955 (two_file_shared_nonpic.so): Likewise.
1956 (two_file_shared_mixed.so): Likewise.
1957 (two_file_shared_mixed_1.so): Likewise.
1958 (weak_undef_lib_nonpic.so): Likewise.
1959 (alt/weak_undef_lib_nonpic.so): Likewise.
1960 (tls_test_shared_nonpic.so): Likewise.
1961 * testsuite/Makefile.in: Rebuild.
1962
1963 2011-07-01 Ian Lance Taylor <iant@google.com>
1964
1965 PR gold/12525
1966 * configure.ac: Test whether static linking works, setting
1967 the automake conditional HAVE_STATIC.
1968 * testsuite/Makefile.am: Disable tests using -static if
1969 HAVE_STATIC is not true.
1970 * configure, testsuite/Makefile.in: Rebuild.
1971
1972 2011-07-01 Ian Lance Taylor <iant@google.com>
1973
1974 PR gold/12525
1975 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1976 Assert if we see DW_EH_PE_indirect.
1977 * target.h (Target::ehframe_datarel_base): New function.
1978 (Target::do_ehframe_datarel_base): New target function.
1979 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1980 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1981 function.
1982
1983 2011-07-01 Ian Lance Taylor <iant@google.com>
1984
1985 PR gold/12571
1986 * options.h (class General_options): Add
1987 --ld-generated-unwind-info.
1988 * ehframe.cc (Fde::write): Add address parameter. Change all
1989 callers. If associated with PLT, fill in address and size.
1990 (Cie::set_output_offset): Only add merge mapping if there is an
1991 object.
1992 (Cie::write): Add address parameter. Change all callers.
1993 (Eh_frame::add_ehframe_for_plt): New function.
1994 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1995 input_offset_ fields into union u_, with new plt field.
1996 (Fde::Fde): Adjust for new union field.
1997 (Fde::Fde) [Output_data version]: New constructor.
1998 (Fde::add_mapping): Only add merge mapping if there is an object.
1999 (class Cie): Update declarations.
2000 (class Eh_frame): Declare add_ehframe_for_plt.
2001 * layout.cc (Layout::layout_eh_frame): Break out code into
2002 make_eh_frame_section, and call it.
2003 (Layout::make_eh_frame_section): New function.
2004 (Layout::add_eh_frame_for_plt): New function.
2005 * layout.h (class Layout): Update declarations.
2006 * merge.cc (Merge_map::add_mapping): Add assertion.
2007 * i386.cc: Include "dwarf.h".
2008 (class Output_data_plt_i386): Make first_plt_entry,
2009 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2010 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2011 and plt_eh_frame_fde.
2012 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2013 boundary. Call add_eh_frame_for_plt if appropriate.
2014 * x86_64.cc: Include "dwarf.h".
2015 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2016 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2017 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2018 and plt_eh_frame_fde.
2019 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2020 appropriate.
2021
2022 2011-06-29 Ian Lance Taylor <iant@google.com>
2023
2024 PR gold/12629
2025 * object.cc (Sized_relobj_file::layout_section): Change shdr
2026 parameter to be const.
2027 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2028 out of do_layout.
2029 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2030 appropriate. Call layout_eh_frame_section.
2031 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2032 sections.
2033 * object.h (class Sized_relobj_file): Update declarations.
2034
2035 2011-06-29 Ian Lance Taylor <iant@google.com>
2036
2037 PR gold/12652
2038 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2039 modifier.
2040 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2041
2042 2011-06-29 Ian Lance Taylor <iant@google.com>
2043
2044 PR gold/12675
2045 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2046 SHT_X86_64_UNWIND.
2047 * layout.cc (Layout::layout_eh_frame): Likewise.
2048
2049 2011-06-29 Ian Lance Taylor <iant@google.com>
2050
2051 PR gold/12695
2052 * layout.cc (Layout::symtab_section_shndx): New function.
2053 * layout.h (class Layout): Declare symtab_section_shndx.
2054 * output.cc (Output_section::write_header): Call it.
2055
2056 2011-06-29 Ian Lance Taylor <iant@google.com>
2057
2058 PR gold/12818
2059 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2060 symbols which are not used in a relocation.
2061
2062 2011-06-28 Ian Lance Taylor <iant@google.com>
2063
2064 PR gold/12898
2065 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2066 script create indistinguishable segments.
2067 (Layout::set_segment_offsets): Use stable_sort when sorting
2068 segments. Pass this to Compare_segments constructor.
2069 * layout.h (class Layout): Make segment_precedes non-static.
2070 (class Compare_segments): Change from struct to class. Add
2071 layout_ field. Add constructor.
2072 * script-sections.cc
2073 (Script_sections::attach_sections_using_phdrs_clause): Rename
2074 local orphan to is_orphan. Don't report failure to put empty
2075 section in segment. On attachment failure, report name of
2076 section, and attach to first PT_LOAD segment.
2077
2078 2011-06-28 Ian Lance Taylor <iant@google.com>
2079
2080 PR gold/12934
2081 * target-select.cc (Target_selector::Target_selector): Add
2082 emulation parameter. Change all callers.
2083 (select_target_by_bfd_name): Rename from select_target_by_name.
2084 Change all callers.
2085 (select_target_by_emulation): New function.
2086 (supported_emulation_names): New function.
2087 * target-select.h (class Target_selector): Add emulation_ field.
2088 Update declarations.
2089 (Target_selector::recognize_by_bfd_name): Rename from
2090 recognize_by_name. Change all callers.
2091 (Target_selector::supported_bfd_names): Rename from
2092 supported_names. Change all callers.
2093 (Target_selector::recognize_by_emulation): New function.
2094 (Target_selector::supported_emulations): New function.
2095 (Target_selector::emulation): New function.
2096 (Target_selector::do_recognize_by_bfd_name): Rename from
2097 do_recognize_by_name. Change all callers.
2098 (Target_selector::do_supported_bfd_names): Rename from
2099 do_supported_names. Change all callers.
2100 (Target_selector::do_recognize_by_emulation): New function.
2101 (Target_selector::do_supported_emulations): New function.
2102 (select_target_by_bfd_name): Change name in declaration.
2103 (select_target_by_emulation): Declare.
2104 (supported_emulation_names): Declare.
2105 * parameters.cc (parameters_force_valid_target): Try to find
2106 target based on emulation from -m option.
2107 * options.h (class General_options): Change doc string for -m.
2108 * options.cc (help): Print emulations.
2109 (General_options::parse_V): Likewise.
2110 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2111 Add emulation parameter. Change all callers.
2112
2113 2011-06-28 Ian Lance Taylor <iant@google.com>
2114
2115 * target.h (class Target): Add osabi_ field.
2116 (Target::osabi): New function.
2117 (Target::set_osabi): New function.
2118 (Target::Target): Initialize osabi_.
2119 (Target::do_adjust_elf_header): Make pure virtual.
2120 (Sized_target::do_adjust_elf_header): Declare.
2121 * target.cc (Sized_target::do_adjust_elf_header): New function.
2122 (class Sized_target): Instantiate all versions.
2123 * freebsd.h (class Target_freebsd): Remove.
2124 (Target_selector_freebsd::do_recognize): Call set_osabi on
2125 Target.
2126 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2127 (Target_selector_freebsd::set_osabi): Remove.
2128 * i386.cc (class Target_i386): Inherit from Sized_target rather
2129 than Target_freebsd.
2130 * x86_64.cc (class Target_x86_64): Likewise.
2131
2132 2011-06-28 Ian Lance Taylor <iant@google.com>
2133
2134 * target.h (Target::can_check_for_function_pointers): Rewrite.
2135 Make non-virtual.
2136 (Target::can_icf_inline_merge_sections): Likewise.
2137 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2138 (Target::Target_info): Add can_icf_inline_merge_sections field.
2139 (Target::do_can_check_for_function_pointers): New virtual
2140 function.
2141 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2142 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2143 from can_check_for_function_pointers, move in file.
2144 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2145 section_may_have_icf_unsafe_poineters, move in file.
2146 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2147 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2148 Rename from can_check_for_function_pointers, move in file.
2149 (Target_i386::can_icf_inline_merge_sections): Remove.
2150 (Target_i386::i386_info): Initialize
2151 can_icf_inline_merge_sections.
2152 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2153 Initialize can_icf_inline_merge_sections.
2154 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2155 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2156 Rename from can_check_for_function_pointers, move in file.
2157 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2158 (Target_x86_64::x86_64_info): Initialize
2159 can_icf_inline_merge_sections.
2160 * testsuite/testfile.cc (Target_test::test_target_info):
2161 Likewise.
2162 * icf.cc (get_section_contents): Correct formatting.
2163
2164 2011-06-27 Ian Lance Taylor <iant@google.com>
2165
2166 * symtab.cc (Symbol::versioned_name): New function.
2167 (Symbol_table::add_to_final_symtab): Use versioned_name when
2168 appropriate.
2169 (Symbol_table::sized_write_symbol): Likewise.
2170 * symtab.h (class Symbol): Declare versioned_name.
2171 * stringpool.h (class Stringpool_template): Add variant of add
2172 which takes a std::basic_string.
2173 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2174 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2175 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2176 (ver_test_12.o): New target.
2177 * testsuite/Makefile.in: Rebuild.
2178
2179 2011-06-27 Doug Kwan <dougkwan@google.com>
2180
2181 * arm.cc (Arm_relocate_functions::thm_jump8,
2182 Arm_relocate_functions::thm_jump11): Use a wider signed
2183 type to compute offset.
2184 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2185 arm_thm_jump8.
2186 * testsuite/Makefile.in: Regenerate.
2187 * testsuite/arm_branch_in_range.sh: Check test results of
2188 arm_thm_jump11 and arm_thm_jump8.
2189 * testsuite/arm_thm_jump11.s: New test source file.
2190 * testsuite/arm_thm_jump11.t: New linker script.
2191 * testsuite/arm_thm_jump8.s: New test source file.
2192 * testsuite/arm_thm_jump8.t: New linker script.
2193
2194 2011-06-24 Ian Lance Taylor <iant@google.com>
2195
2196 * layout.cc: Include "object.h".
2197 (ctors_sections_in_init_array): New static variable.
2198 (Layout::is_ctors_in_init_array): New function.
2199 (Layout::layout): Add entry to ctors_sections_in_init_array if
2200 appropriate.
2201 * layout.h (class Layout): Declare is_ctors_in_init_array.
2202 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2203 is_ctors_reverse_view is set.
2204 (Sized_relobj_file::write_sections): Add layout parameter. Change
2205 all callers. Set is_ctors_reverse_view field of View_size.
2206 (Sized_relobj_file::reverse_words): New function.
2207 * object.h (Sized_relobj_file::View_size): Add
2208 is_ctors_reverse_view field.
2209 (class Sized_relobj_file): Update declarations.
2210 * testsuite/initpri3.c: New test.
2211 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2212 initpri3b.
2213 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2214 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2215 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2216 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2217 * testsuite/Makefile.in: Rebuild.
2218
2219 2011-06-24 Cary Coutant <ccoutant@google.com>
2220
2221 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2222 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2223 (debug_msg_cdebug.err): New targets.
2224 * testsuite/Makefile.in: Regenerate.
2225 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2226 Fix checks for link with shared library.
2227
2228 2011-06-24 Doug Kwan <dougkwan@google.com>
2229
2230 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2231 skip empty text sections.
2232 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2233
2234 2011-06-22 Ian Lance Taylor <iant@google.com>
2235
2236 PR gold/12910
2237 * options.h (class General_options): Add --ctors-in-init-array.
2238 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2239 friends as SHT_PROGBITS for merging sections.
2240 (Layout::layout): Remove special handling of .init_array and
2241 friends. Don't sort if doing relocatable link. Sort for .ctors
2242 and .dtors if ctors_in_init_array.
2243 (Layout::make_output_section): Force correct section types for
2244 .init_array and friends. Don't sort if doing relocatable link,
2245 Don't sort .ctors and .dtors if ctors_in_init_array.
2246 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2247 (Layout::output_section_name): Add relobj parameter. Change all
2248 callers. Handle .ctors. and .dtors. in code rather than table.
2249 Handle .ctors and .dtors if ctors_in_init_array.
2250 (Layout::match_file_name): New function, moved from output.cc.
2251 * layout.h (class Layout): Update declarations.
2252 * output.cc: Include "layout.h".
2253 (Input_section_sort_entry::get_priority): New function.
2254 (Input_section_sort_entry::match_file_name): Just call
2255 Layout::match_file_name.
2256 (Output_section::Input_section_sort_init_fini_compare::operator()):
2257 Handle .ctors and .dtors. Sort by explicit priority rather than
2258 by name.
2259 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2260 * testsuite/initpri2.c: New test.
2261 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2262 (check_PROGRAMS): Add initpri2.
2263 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2264 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2265 * configure, testsuite/Makefile.in: Rebuild.
2266
2267 2011-06-19 Ian Lance Taylor <iant@google.com>
2268
2269 PR gold/12880
2270 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2271 .interp section to a PT_INTERP segment even if we have seen a
2272 --dynamic-linker option. Don't do it if we have seen a PHDRS
2273 clause in a linker script.
2274 (Layout::finalize): Don't create a .interp section if we've
2275 already create a PT_INTERP segment.
2276 (Layout::create_interp): Always call choose_output_section (revert
2277 patch of 2011-06-17). Don't create PT_INTERP segment.
2278 * script-sections.cc
2279 (Script_sections::create_note_and_tls_segments): Add a .interp
2280 section to a PT_INTERP segment even if we have seen a
2281 --dynamic-linker option.
2282
2283 2011-06-18 Ian Lance Taylor <iant@google.com>
2284
2285 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2286 merely because a non-PT_LOAD segment has a dynamic reloc.
2287
2288 2011-06-18 Ian Lance Taylor <iant@google.com>
2289
2290 * layout.cc (Layout::finish_dynamic_section): Don't create
2291 DT_FLAGS entry if not needed.
2292
2293 2011-06-18 Ian Lance Taylor <iant@google.com>
2294
2295 PR gold/12745
2296 * layout.cc (Layout::layout_eh_frame): Correct handling of
2297 writable .eh_frame section.
2298
2299 2011-06-17 Ian Lance Taylor <iant@google.com>
2300
2301 PR gold/12893
2302 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2303 symbol is redefined with the exact same object and value.
2304
2305 2011-06-17 Ian Lance Taylor <iant@google.com>
2306
2307 PR gold/12880
2308 * layout.h (class Layout): Add interp_segment_ field.
2309 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2310 (Layout::attach_allocated_section_to_segment): If making shared
2311 library, put .interp section in PT_INTERP segment.
2312 (Layout::finalize): Also call create_interp if -dynamic-linker
2313 option was used.
2314 (Layout::create_interp): Assert that there is no PT_INTERP
2315 segment. If not using a SECTIONS clause, use make_output_section.
2316 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2317 * script-sections.cc
2318 (Script_sections::create_note_and_tls_segments): If making shared
2319 library, put .interp section in PT_INTERP segment.
2320
2321 2011-06-17 Ian Lance Taylor <iant@google.com>
2322
2323 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2324 when making a shared library.
2325
2326 2011-06-17 Ian Lance Taylor <iant@google.com>
2327
2328 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2329 parameter. Change all callers. Don't issue warning about PC32
2330 against locally defined symbol.
2331
2332 2011-06-16 Ian Lance Taylor <iant@google.com>
2333
2334 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2335 occurs in same object.
2336
2337 2011-06-14 Alan Modra <amodra@gmail.com>
2338
2339 * po/POTFILES.in: Regenerate.
2340
2341 2011-06-09 Ian Lance Taylor <iant@google.com>
2342
2343 * script-sections.cc
2344 (Orphan_output_section::set_section_addresses): For a relocatable
2345 link set address to 0.
2346
2347 2011-06-09 Cary Coutant <ccoutant@google.com>
2348
2349 PR gold/12804
2350 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2351 used with --compress-debug-sections.
2352 * gold/object.cc (Sized_relobj_file::do_layout): Report
2353 uncompressed size of compressed input sections.
2354
2355 2011-06-08 Cary Coutant <ccoutant@google.com>
2356
2357 PR gold/12804
2358 * testsuite/two_file_test_2_v1.cc: Change initialization of
2359 v2 to keep it in .data.
2360
2361 2011-06-07 Cary Coutant <ccoutant@google.com>
2362
2363 * common.cc (Symbol_table::do_allocate_commons_list): Call
2364 gold_fallback.
2365 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2366 (Errors::fallback): New function.
2367 (gold_fallback): New function.
2368 * errors.h (Errors::fallback): New function.
2369 * gold.cc (gold_exit): Change status parameter to enum; adjust
2370 all callers.
2371 (queue_initial_tasks): Call gold_fallback.
2372 * gold.h: Include cstdlib.
2373 (Exit_status): New enum type.
2374 (gold_exit): Change status parameter to enum.
2375 (gold_fallback): New function.
2376 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2377 (Layout::create_symtab_sections): Likewise.
2378 (Layout::create_shdrs): Likewise.
2379 * main.cc (main): Adjust call to gold_exit.
2380 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2381 (Output_data_got::add_got_entry_pair): Likewise.
2382 (Output_section::add_input_section): Likewise.
2383 (Output_section::add_output_section_data): Likewise.
2384 (Output_segment::set_section_list_addresses): Likewise.
2385 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2386
2387 2011-06-07 Cary Coutant <ccoutant@google.com>
2388
2389 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2390 for incremental links.
2391 * output.cc (Output_segment::set_section_list_addresses): Remove
2392 FIXME and test for TLS or BSS.
2393
2394 2011-06-07 Cary Coutant <ccoutant@google.com>
2395
2396 * testsuite/Makefile.am: Add incremental_copy_test,
2397 incremental_common_test_1.
2398 * testsuite/Makefile.in: Regenerate.
2399 * testsuite/common_test_1_v1.c: New source file.
2400 * testsuite/common_test_1_v2.c: New source file.
2401 * testsuite/copy_test_v1.cc: New source file.
2402
2403 2011-06-07 Cary Coutant <ccoutant@google.com>
2404
2405 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2406 update, allocate common from bss section's free list.
2407 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2408 linker-defined symbols.
2409 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2410 Skip GOT and PLT entries that are no longer referenced.
2411 (Output_section_incremental_inputs::write_info_blocks): Mark
2412 linker-defined symbols.
2413 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2414 * output.cc (Output_section::allocate): New function.
2415 * output.h (Output_section::allocate): New function.
2416 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2417 linker-defined symbols.
2418 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2419 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2420 (Symbol::init_base_output_data): Likewise.
2421 (Symbol::init_base_output_segment): Likewise.
2422 (Symbol::init_base_constant): Likewise.
2423 (Sized_symbol::init_output_data): Likewise.
2424 (Sized_symbol::init_output_segment): Likewise.
2425 (Sized_symbol::init_constant): Likewise.
2426 (Symbol_table::do_define_in_output_data): Likewise.
2427 (Symbol_table::do_define_in_output_segment): Likewise.
2428 (Symbol_table::do_define_as_constant): Likewise.
2429 * symtab.h (Symbol::is_predefined): New function.
2430 (Symbol::init_base_output_data): Add is_predefined parameter.
2431 (Symbol::init_base_output_segment): Likewise.
2432 (Symbol::init_base_constant): Likewise.
2433 (Symbol::is_predefined_): New data member.
2434 (Sized_symbol::init_output_data): Add is_predefined parameter.
2435 (Sized_symbol::init_output_segment): Likewise.
2436 (Sized_symbol::init_constant): Likewise.
2437 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2438
2439 2011-06-07 Cary Coutant <ccoutant@google.com>
2440
2441 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2442 instead of emit_copy_reloc.
2443 (Copy_relocs::emit_copy_reloc): Refactor.
2444 (Copy_relocs::make_copy_reloc): New function.
2445 (Copy_relocs::add_copy_reloc): Remove.
2446 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2447 section.
2448 (Copy_relocs::make_copy_reloc): New function.
2449 (Copy_relocs::add_copy_reloc): Remove.
2450 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2451 unchanged input files.
2452 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2453 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2454 Reserve BSS space for COPY relocations.
2455 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2456 (Output_section_incremental_inputs::write_info_blocks): Record
2457 whether a symbol is copied from a shared object.
2458 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2459 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2460 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2461 (Incremental_input_entry_reader::get_output_symbol_index): Add
2462 is_copy parameter.
2463 (Incremental_binary::emit_copy_relocs): New function.
2464 (Incremental_binary::do_emit_copy_relocs): New function.
2465 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2466 new data member.
2467 (Sized_incremental_binary::add_copy_reloc): New function.
2468 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2469 (Sized_incremental_binary::Copy_reloc): New struct.
2470 (Sized_incremental_binary::Copy_relocs): New typedef.
2471 (Sized_incremental_binary::copy_relocs_): New data member.
2472 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2473 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2474 * target.h (Sized_target::emit_copy_reloc): New function.
2475 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2476
2477 2011-06-02 Cary Coutant <ccoutant@google.com>
2478
2479 PR gold/12163
2480 * gold/archive.cc (Archive::Archive): Initialize new data member.
2481 (Archive::include_all_members): Return if archive has already been
2482 included.
2483 * gold/archive.h (Archive::include_all_members_): New data member.
2484
2485 2011-06-02 Nick Clifton <nickc@redhat.com>
2486
2487 * dynobj.h: Fix spelling mistake in comment.
2488 * output.cc: Likewise.
2489
2490 2011-05-31 Doug Kwan <dougkwan@google.com>
2491 Asier Llano
2492
2493 PR gold/12826
2494 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2495 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2496 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2497 redundant arm_exidx_test.so.
2498 * testsuite/Makefile.in: Regenerate.
2499 (check_SCRIPTS): Add pr12826.sh
2500 (check_DATA): Add pr12826.stdout
2501 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2502 * testsuite/pr12826.sh: New file.
2503 * testsuite/pr12826_1.s: Ditto.
2504 * testsuite/pr12826_1.s: Ditto.
2505
2506 2011-05-30 Ian Lance Taylor <iant@google.com>
2507
2508 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2509 sections.
2510
2511 2011-05-29 Ian Lance Taylor <iant@google.com>
2512
2513 PR gold/12804
2514 * testsuite/Makefile.am: Use different file name for two_file_test
2515 temporary file for each incremental test.
2516 * testsuite/Makefile.in: Rebuild.
2517
2518 2011-05-29 Ian Lance Taylor <iant@google.com>
2519
2520 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2521 binary input file is empty.
2522
2523 2011-05-27 Ian Lance Taylor <iant@google.com>
2524
2525 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2526 (ver_test_9.so): Likewise.
2527 * testsuite/Makefile.in: Rebuild.
2528
2529 2011-05-26 Cary Coutant <ccoutant@google.com>
2530
2531 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2532 * incremental.cc (Incremental_inputs::report_input_section): Fix
2533 comment, indentation.
2534 (Incremental_inputs::report_comdat_group): New function.
2535 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2536 of data for incremental input file entry.
2537 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2538 group count, COMDAT group signatures.
2539 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2540 an unchanged input file.
2541 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2542 Initialize new data member.
2543 (Incremental_object_entry::add_comdat_group): New function.
2544 (Incremental_object_entry::get_comdat_group_count): New function.
2545 (Incremental_object_entry::get_comdat_signature_key): New function.
2546 (Incremental_object_entry::groups_): New data member.
2547 (Incremental_inputs::report_comdat_group): New function.
2548 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2549 data for incremental input file entry.
2550 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2551 (Incremental_input_entry_reader::get_input_section): Adjust size of
2552 data for incremental input file entry.
2553 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2554 (Incremental_input_entry_reader::get_comdat_group_signature): New
2555 function.
2556 * object.cc (Sized_relobj::include_section_group): Report kept
2557 COMDAT groups for incremental links.
2558
2559 2011-05-24 David Meyer <pdox@google.com>
2560
2561 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2562 with name parameter. Add found_name parameter.
2563 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2564 * dirsearch.h (class Dirsearch): Update declaration.
2565
2566 2011-05-24 Ian Lance Taylor <iant@google.com>
2567
2568 * archive.cc (Library_base::should_include_member): Pull in object
2569 from archive if it defines the entry symbol.
2570 * parameters.cc (Parameters::entry): New function.
2571 * parameters.h (class Parameters): Declare entry.
2572 * output.h (class Output_file_header): Remove entry_ field.
2573 * output.cc (Output_file_header::Output_file_header): Remove entry
2574 parameter. Change all callers.
2575 (Output_file_header::entry): Use parameters->entry.
2576 * gold.cc (queue_middle_tasks): Likewise.
2577 * plugin.cc (Plugin_hook::run): Likewise.
2578
2579 2011-05-24 Cary Coutant <ccoutant@google.com>
2580
2581 * gold.cc (queue_initial_tasks): Pass incremental base filename
2582 to Output_file::open_base_file; don't print error message.
2583 * incremental-dump.cc (main): Adjust call to
2584 Output_file::open_for_modification.
2585 * incremental-dump.cc (main): Likewise.
2586 * incremental.cc (Incremental_inputs::report_command_line):
2587 Ignore --incremental-base option when comparing command lines.
2588 Ignore parameter when given as separate argument.
2589 * options.h (class General_options): Add --incremental-base.
2590 * output.cc (Output_file::Output_file):
2591 (Output_file::open_base_file): Add base_name and writable parameters;
2592 read base file into new file; print error message here.
2593 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2594 callers.
2595 * output.h (Output_file::open_for_modification): Rename to...
2596 (Output_file::open_base_file): ...this; add base_name and
2597 writable parameters; adjust all callers.
2598 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2599 callers.
2600 * testsuite/Makefile.am (incremental_test_4): Test
2601 --incremental-base.
2602 * testsuite/Makefile.in: Regenerate.
2603
2604 2011-05-24 Cary Coutant <ccoutant@google.com>
2605
2606 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2607 incremental_test_4.
2608 * testsuite/Makefile.in: Regenerate.
2609 * testsuite/two_file_test_1_v1.cc: New test source file.
2610 * testsuite/two_file_test_1b_v1.cc: New test source file.
2611 * testsuite/two_file_test_2_v1.cc: New test source file.
2612
2613 2011-05-24 Cary Coutant <ccoutant@google.com>
2614
2615 * dynobj.h (Dynobj::do_dynobj): New function.
2616 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2617 flag and soname for shared objects.
2618 * incremental.cc (Incremental_inputs::report_object): Make
2619 either Incremental_object_entry or Incremental_dynobj_entry; add
2620 soname to string table.
2621 (Incremental_inputs::report_input_section): Add assertion.
2622 (Output_section_incremental_inputs::set_final_data_size): Adjust
2623 type of input file entry for shared libraries; adjust size of
2624 shared library info entry.
2625 (Output_section_incremental_inputs::write_input_files): Write
2626 as_needed flag for shared libraries.
2627 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2628 of input file entry for shared libraries; write soname.
2629 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2630 soname from incremental info.
2631 * incremental.h (enum Incremental_input_flags): Add
2632 INCREMENTAL_INPUT_AS_NEEDED.
2633 (Incremental_input_entry::Incremental_input_entry): Initialize new
2634 data member.
2635 (Incremental_input_entry::set_as_needed): New function.
2636 (Incremental_input_entry::as_needed): New function.
2637 (Incremental_input_entry::do_dynobj_entry): New function.
2638 (Incremental_input_entry::as_needed_): New data member.
2639 (Incremental_object_entry::Incremental_object_entry): Don't check
2640 for shared library.
2641 (Incremental_object_entry::do_type): Likewise.
2642 (class Incremental_dynobj_entry): New class.
2643 (Incremental_input_entry_reader::as_needed): New function.
2644 (Incremental_input_entry_reader::get_soname): New function.
2645 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2646 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2647 size of shared library info entry.
2648 * layout.cc (Layout::finish_dynamic_section): Don't test for
2649 incremental link when adding DT_NEEDED entries.
2650 * object.h (Object::Object): Initialize new data member.
2651 (Object::dynobj): New function.
2652 (Object::set_as_needed): New function.
2653 (Object::as_needed): New function.
2654 (Object::do_dynobj): New function.
2655 (Object::as_needed_): New data member.
2656
2657 2011-05-24 Cary Coutant <ccoutant@google.com>
2658
2659 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2660 info; adjust display of GOT entries.
2661 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2662 vector of input objects; remove file_status_.
2663 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2664 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2665 got_plt reader; call target hooks to reserve GOT entries.
2666 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2667 of input file info header and GOT info entry.
2668 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2669 relocation info.
2670 (Got_plt_view_info::got_descriptor): Remove.
2671 (Got_plt_view_info::sym_index): New data member.
2672 (Got_plt_view_info::input_index): New data member.
2673 (Local_got_offset_visitor::visit): Write input file index.
2674 (Global_got_offset_visitor::visit): Write 0 for input file index.
2675 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2676 with sym_index and input_index.
2677 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2678 incremental info GOT entry; replace got_descriptor with input_index.
2679 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2680 map from input file index to object.
2681 (Sized_relobj_incr::do_layout): Replace direct data member reference
2682 with accessor function.
2683 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2684 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2685 Adjust size of input file info header.
2686 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2687 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2688 (Incremental_input_entry_reader::get_input_section): Adjust size of
2689 input file info header.
2690 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2691 of incremental info GOT entry.
2692 (Incremental_got_plt_reader::get_got_desc): Remove.
2693 (Incremental_got_plt_reader::get_got_symndx): New function.
2694 (Incremental_got_plt_reader::get_got_input_index): New function.
2695 (Sized_incremental_binary::Sized_incremental_binary): Remove
2696 file_status_; add input_objects_.
2697 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2698 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2699 (Sized_incremental_binary::file_is_unchanged): Remove.
2700 (Sized_incremental_binary::set_input_object): New function.
2701 (Sized_incremental_binary::input_object): New function.
2702 (Sized_incremental_binary::file_status_): Remove.
2703 (Sized_incremental_binary::input_objects_): New data member.
2704 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2705 references.
2706 (Sized_relobj_incr::invalid_address): Move to base class.
2707 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2708 class.
2709 (Sized_relobj_incr::do_output_section_offset): Likewise.
2710 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2711 (Sized_relobj_incr::section_offsets_): Likewise.
2712 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2713 function.
2714 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2715 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2716 with accessor function.
2717 (Sized_relobj_file::do_layout): Likewise.
2718 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2719 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2720 (Sized_relobj_file::compute_final_local_value): Replace refs to
2721 section_offsets_ with accessor function.
2722 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2723 * object.h (Relobj::Relobj): Initialize new data members.
2724 (Relobj::add_dyn_reloc): New function.
2725 (Relobj::first_dyn_reloc): New function.
2726 (Relobj::dyn_reloc_count): New function.
2727 (Relobj::first_dyn_reloc_): New data member.
2728 (Relobj::dyn_reloc_count_): New data member.
2729 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2730 references.
2731 (Sized_relobj::Address): New typedef.
2732 (Sized_relobj::invalid_address): Move here from child class.
2733 (Sized_relobj::Sized_relobj): Initialize new data members.
2734 (Sized_relobj::sized_relobj): New function.
2735 (Sized_relobj::is_output_section_offset_invalid): Move here from
2736 child class.
2737 (Sized_relobj::get_output_section_offset): Likewise.
2738 (Sized_relobj::local_has_got_offset): Likewise.
2739 (Sized_relobj::local_got_offset): Likewise.
2740 (Sized_relobj::set_local_got_offset): Likewise.
2741 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2742 (Sized_relobj::clear_got_offsets): New function.
2743 (Sized_relobj::section_offsets): Move here from child class.
2744 (Sized_relobj::do_output_section_offset): Likewise.
2745 (Sized_relobj::do_set_section_offset): Likewise.
2746 (Sized_relobj::Local_got_offsets): Likewise.
2747 (Sized_relobj::local_got_offsets_): Likewise.
2748 (Sized_relobj::section_offsets_): Likewise.
2749 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2750 references.
2751 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2752 class.
2753 (Sized_relobj_file::sized_relobj): New function
2754 (Sized_relobj_file::local_has_got_offset): Move to base class.
2755 (Sized_relobj_file::local_got_offset): Likewise.
2756 (Sized_relobj_file::set_local_got_offset): Likewise.
2757 (Sized_relobj_file::get_output_section_offset): Likewise.
2758 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2759 (Sized_relobj_file::do_output_section_offset): Likewise.
2760 (Sized_relobj_file::do_set_section_offset): Likewise.
2761 (Sized_relobj_file::Local_got_offsets): Likewise.
2762 (Sized_relobj_file::local_got_offsets_): Likewise.
2763 (Sized_relobj_file::section_offsets_): Likewise.
2764 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2765 (all constructors).
2766 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2767 (Output_reloc::get_symbol_index): Likewise.
2768 (Output_reloc::local_section_offset): Likewise.
2769 (Output_reloc::get_address): Likewise.
2770 (Output_reloc::symbol_value): Likewise.
2771 (Output_data_got::reserve_slot): Move to class definition.
2772 (Output_data_got::reserve_local): New function.
2773 (Output_data_got::reserve_slot_for_global): Remove.
2774 (Output_data_got::reserve_global): New function.
2775 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2776 (all constructors, two instantiations).
2777 (Output_reloc::get_relobj): New function (two instantiations).
2778 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2779 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2780 (Output_data_reloc::add_global): Adjust type of relobj.
2781 (Output_data_reloc::add_global_relative): Likewise.
2782 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2783 (Output_data_reloc::add_local): Likewise.
2784 (Output_data_reloc::add_local_relative): Likewise.
2785 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2786 (Output_data_reloc::add_local_section): Likewise.
2787 (Output_data_reloc::add_output_section): Likewise.
2788 (Output_data_reloc::add_absolute): Likewise.
2789 (Output_data_reloc::add_target_specific): Likewise.
2790 (Output_data_got::reserve_slot): Move definition here.
2791 (Output_data_got::reserve_local): New function.
2792 (Output_data_got::reserve_global): New function.
2793 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2794 section_offsets_ with accessor function.
2795 (Sized_relobj_file::write_sections): Likewise.
2796 (Sized_relobj_file::do_relocate_sections): Likewise.
2797 * target.h (Sized_target::reserve_local_got_entry): New function.
2798 (Sized_target::reserve_global_got_entry): New function.
2799 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2800 (Target_x86_64::reserve_global_got_entry): New function.
2801 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2802
2803 2011-05-23 Cary Coutant <ccoutant@google.com>
2804
2805 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2806 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2807 bit when checking got_type.
2808 * incremental.cc (Sized_incremental_binary::setup_readers):
2809 Store symbol table and string table locations; initialize bit vector
2810 of file status flags.
2811 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2812 unchanged files.
2813 (Sized_incremental_binary::do_process_got_plt): New function.
2814 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2815 (Output_section_incremental_inputs::set_final_data_size): Record
2816 file index for each input file.
2817 (Output_section_incremental_inputs::write_got_plt): Store file index
2818 instead of input entry offset for each GOT entry.
2819 * incremental.h
2820 (Incremental_input_entry::Incremental_input_entry): Initialize new
2821 data member.
2822 (Incremental_input_entry::set_offset): Store file index.
2823 (Incremental_input_entry::get_file_index): New function.
2824 (Incremental_input_entry::file_index_): New data member.
2825 (Incremental_binary::process_got_plt): New function.
2826 (Incremental_binary::do_process_got_plt): New function.
2827 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2828 data members.
2829 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2830 (Sized_incremental_binary::set_file_is_unchanged): New function.
2831 (Sized_incremental_binary::file_is_unchanged): New function.
2832 (Sized_incremental_binary::do_process_got_plt): New function.
2833 (Sized_incremental_binary::file_status_): New data member.
2834 (Sized_incremental_binary::main_symtab_loc_): New data member.
2835 (Sized_incremental_binary::main_strtab_loc_): New data member.
2836 * output.cc (Output_data_got::Got_entry::write): Add case
2837 RESERVED_CODE.
2838 (Output_data_got::add_global): Call add_got_entry.
2839 (Output_data_got::add_global_plt): Likewise.
2840 (Output_data_got::add_global_with_rel): Likewise.
2841 (Output_data_got::add_global_with_rela): Likewise.
2842 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2843 (Output_data_got::add_global_pair_with_rela): Likewise.
2844 (Output_data_got::add_local): Call add_got_entry.
2845 (Output_data_got::add_local_plt): Likewise.
2846 (Output_data_got::add_local_with_rel): Likewise.
2847 (Output_data_got::add_local_with_rela): Likewise.
2848 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2849 (Output_data_got::add_local_pair_with_rela): Likewise.
2850 (Output_data_got::reserve_slot): New function.
2851 (Output_data_got::reserve_slot_for_global): New function.
2852 (Output_data_got::add_got_entry): New function.
2853 (Output_data_got::add_got_entry_pair): New function.
2854 (Output_section::add_output_section_data): Edit FIXME.
2855 * output.h
2856 (Output_section_data_build::Output_section_data_build): New
2857 constructor with size parameter.
2858 (Output_data_space::Output_data_space): Likewise.
2859 (Output_data_got::Output_data_got): Initialize new data member; new
2860 constructor with size parameter.
2861 (Output_data_got::add_constant): Call add_got_entry.
2862 (Output_data_got::reserve_slot): New function.
2863 (Output_data_got::reserve_slot_for_global): New function.
2864 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2865 (Output_data_got::add_got_entry): New function.
2866 (Output_data_got::add_got_entry_pair): New function.
2867 (Output_data_got::free_list_): New data member.
2868 * target.h (Sized_target::init_got_plt_for_update): New function.
2869 (Sized_target::register_global_plt_entry): New function.
2870 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2871 Initialize new data member; call init; add constructor with PLT count.
2872 (Output_data_plt_x86_64::init): New function.
2873 (Output_data_plt_x86_64::add_relocation): New function.
2874 (Output_data_plt_x86_64::reserve_slot): New function.
2875 (Output_data_plt_x86_64::free_list_): New data member.
2876 (Target_x86_64::init_got_plt_for_update): New function.
2877 (Target_x86_64::register_global_plt_entry): New function.
2878 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2879 incremental updates.
2880 (Output_data_plt_x86_64::add_relocation): New function.
2881 * testsuite/object_unittest.cc (Object_test): Set default options.
2882
2883 2011-05-16 Ian Lance Taylor <iant@google.com>
2884
2885 * options.h (class General_options): Make -i a synonym for -r.
2886
2887 2011-05-16 Ian Lance Taylor <iant@google.com>
2888
2889 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2890
2891 2011-05-10 Cary Coutant <ccoutant@google.com>
2892
2893 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2894 strip_all (-s).
2895
2896 2011-05-06 Ian Lance Taylor <iant@google.com>
2897
2898 * layout.cc (Layout::layout): If the output section flags change,
2899 update the ordering.
2900
2901 2011-04-25 Cary Coutant <ccoutant@google.com>
2902
2903 * incremental-dump.cc (dump_incremental_inputs): Print local
2904 symbol info for each input file.
2905 * incremental.cc
2906 (Output_section_incremental_inputs::set_final_data_size): Add local
2907 symbol info to input file entries in incremental info.
2908 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2909 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2910 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2911 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2912 implementation.
2913 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2914 (Sized_incr_relobj::do_relocate): Write the local symbols.
2915 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2916 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2917 Adjust size of input file header.
2918 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2919 (Incremental_inputs_reader::get_local_symbol_count): New function.
2920 (Incremental_inputs_reader::get_input_section): Adjust size of input
2921 file header.
2922 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2923 (Sized_incr_relobj::This): New typedef.
2924 (Sized_incr_relobj::sym_size): New const data member.
2925 (Sized_incr_relobj::Local_symbol): New struct.
2926 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2927 (Sized_incr_relobj::do_local_symbol_offset): New function.
2928 (Sized_incr_relobj::local_symbol_count_): New data member.
2929 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2930 (Sized_incr_relobj::local_symbol_index_): New data member.
2931 (Sized_incr_relobj::local_symbol_offset_): New data member.
2932 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2933 (Sized_incr_relobj::local_symbols_): New data member.
2934 * object.h (Relobj::output_local_symbol_count): New function.
2935 (Relobj::local_symbol_offset): New function.
2936 (Relobj::do_output_local_symbol_count): New function.
2937 (Relobj::do_local_symbol_offset): New function.
2938 (Sized_relobj::do_output_local_symbol_count): New function.
2939 (Sized_relobj::do_local_symbol_offset): New function.
2940
2941 2011-04-22 Vladimir Simonov <sv@sw.ru>
2942
2943 * descriptors.cc (set_close_on_exec): New function.
2944 (Descriptors::open): Use set_close_on_exec.
2945 * output.cc (S_ISLNK): Define if not defined.
2946
2947 2011-04-22 Cary Coutant <ccoutant@google.com>
2948
2949 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2950 global symbol map.
2951 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2952 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2953 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2954 relocations.
2955 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2956 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2957 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2958 * incremental.h
2959 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2960 function.
2961 (Incremental_binary::apply_incremental_relocs): New function.
2962 (Incremental_binary::do_apply_incremental_relocs): New function.
2963 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2964 data member.
2965 (Sized_incremental_binary::add_global_symbol): New function.
2966 (Sized_incremental_binary::global_symbol): New function.
2967 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2968 (Sized_incremental_binary::symbol_map_): New data member.
2969 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2970 * target.h (Sized_target::apply_relocation): New function.
2971 * target-reloc.h (apply_relocation): New function.
2972 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2973
2974 2011-04-22 Doug Kwan <dougkwan@google.com>
2975
2976 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2977 flag of a SHT_ARM_EXIDX section.
2978 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2979 * testsuite/Makefile.in: Regenerate.
2980 * testsuite/arm_exidx_test.s: New file.
2981 * testsuite/arm_exidx_test.sh: Same.
2982
2983 2011-04-20 Cary Coutant <ccoutant@google.com>
2984
2985 PR gold/12689
2986 * archive.h (Incremental_archive_entry::Archive_member):
2987 Initialize arg_serial_ (second constructor).
2988
2989 2011-04-17 Ian Lance Taylor <iant@google.com>
2990
2991 * object.cc (Relocate_info::location): Simplify location string.
2992 * errors.cc (Errors::error_at_location): Don't print program
2993 name.
2994 (Errors::warning_at_location): Likewise.
2995 (Errors::undefined_symbol): Likewise.
2996 * testsuite/debug_msg.sh: Update accordingly.
2997
2998 2011-04-14 Cary Coutant <ccoutant@google.com>
2999
3000 * gold/layout.cc (Layout::symtab_section_offset): New function.
3001 * gold/layout.h (Layout::symtab_section_offset): New function.
3002 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3003
3004 2011-04-12 Ian Lance Taylor <iant@google.com>
3005
3006 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3007 with MREMAP_MAYMOVE.
3008 * output.h (class Output_file): Add map_is_allocated_ field.
3009 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3010 not available, provide stubs. If mremap is not available, #define
3011 it to gold_mremap.
3012 (MREMAP_MAYMOVE): Define if not defined.
3013 (Output_file::Output_file): Initialize map_is_allocated_.
3014 (Output_file::resize): Check map_is_allocated_.
3015 (Output_file::map_anonymous): If mmap fails, use malloc.
3016 (Output_file::unmap): Don't do anything for an anonymous map.
3017 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3018 is not available, provide stubs.
3019 (File_read::View::~View): Use free rather than delete[].
3020 (File_read::make_view): Use malloc rather than new[]. If mmap
3021 fails, use malloc.
3022 (File_read::find_or_make_view): Use malloc rather than new[].
3023 * gold.h: Remove HAVE_REMAP code.
3024 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3025 exists. Rename mremap to gold_mremap. If mmap is not available
3026 don't do anything.
3027 * configure, config.in: Rebuild.
3028
3029 2011-04-11 Ian Lance Taylor <iant@google.com>
3030
3031 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3032 initialize local variable v.
3033
3034 2011-04-11 Cary Coutant <ccoutant@google.com>
3035
3036 * archive.cc (Archive::include_member): Adjust call to
3037 report_object.
3038 (Add_archive_symbols::run): Track argument serial numbers.
3039 (Lib_group::include_member): Likewise.
3040 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3041 * archive.h (Incremental_archive_entry::Archive_member):
3042 Initialize arg_serial_.
3043 (Archive_member::arg_serial_): New data member.
3044 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3045 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3046 incremental link.
3047 (Sized_dynobj::do_for_all_local_got_entries): New function.
3048 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3049 function.
3050 * fileread.cc (get_mtime): New function.
3051 * fileread.h (get_mtime): New function.
3052 * gold.cc (queue_initial_tasks): Check for incremental update.
3053 (process_incremental_input): New function.
3054 (queue_middle_tasks): Don't force valid target for incremental
3055 update.
3056 * incremental-dump.cc (find_input_containing_global): Adjust
3057 size of symbol info entry.
3058 (dump_incremental_inputs): Dump argument serial number and
3059 in_system_directory flag; bias shndx by 1; print symbol names
3060 when dumping per-file symbol lists; use new symbol info readers.
3061 * incremental.cc
3062 (Output_section_incremental_inputs:update_data_size): New function.
3063 (Sized_incremental_binary::setup_readers): Setup input readers
3064 for each input file; build maps for files added from libraries
3065 and scripts.
3066 (Sized_incremental_binary::check_input_args): New function.
3067 (Sized_incremental_binary::do_check_inputs): Build map of argument
3068 serial numbers to input arguments.
3069 (Sized_incremental_binary::do_file_has_changed): Rename
3070 do_file_is_unchanged to this; compare file modification times.
3071 (Sized_incremental_binary::do_init_layout): New function.
3072 (Sized_incremental_binary::do_reserve_layout): New function.
3073 (Sized_incremental_binary::do_get_input_reader): Remove.
3074 (Sized_incremental_binary::get_symtab_view): New function.
3075 (Incremental_checker::can_incrementally_link_output_file): Remove.
3076 (Incremental_inputs::report_command_line): Exclude --debug options.
3077 (Incremental_inputs::report_archive_begin): Add parameter; track
3078 argument serial numbers; don't put input file entry for archive
3079 before archive members.
3080 (Incremental_inputs::report_archive_end): Put input file entry
3081 for archive after archive members.
3082 (Incremental_inputs::report_object): Add parameter; track argument
3083 serial numbers and in_system_directory flag.
3084 (Incremental_inputs::report_script): Add parameter; track argument
3085 serial numbers.
3086 (Output_section_incremental_inputs::set_final_data_size): Adjust
3087 size of symbol info entry; check for forwarding symbols.
3088 (Output_section_incremental_inputs::write_input_files): Write
3089 in_system_directory flag and argument serial number.
3090 (Output_section_incremental_inputs::write_info_blocks): Map section
3091 indices between incremental info and original input file; store
3092 input section index for each symbol.
3093 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3094 change operator() to visit().
3095 (class Global_got_offset_visitor): Likewise.
3096 (class Global_symbol_visitor_got_plt):
3097 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3098 classes.
3099 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3100 (Sized_incr_relobj::do_read_symbols): New function.
3101 (Sized_incr_relobj::do_layout): New function.
3102 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3103 (Sized_incr_relobj::do_add_symbols): New function.
3104 (Sized_incr_relobj::do_should_include_member): New function.
3105 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3106 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3107 (Sized_incr_relobj::do_section_size): New function.
3108 (Sized_incr_relobj::do_section_name): New function.
3109 (Sized_incr_relobj::do_section_contents): New function.
3110 (Sized_incr_relobj::do_section_flags): New function.
3111 (Sized_incr_relobj::do_section_entsize): New function.
3112 (Sized_incr_relobj::do_section_address): New function.
3113 (Sized_incr_relobj::do_section_type): New function.
3114 (Sized_incr_relobj::do_section_link): New function.
3115 (Sized_incr_relobj::do_section_info): New function.
3116 (Sized_incr_relobj::do_section_addralign): New function.
3117 (Sized_incr_relobj::do_initialize_xindex): New function.
3118 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3119 (Sized_incr_relobj::do_read_relocs): New function.
3120 (Sized_incr_relobj::do_gc_process_relocs): New function.
3121 (Sized_incr_relobj::do_scan_relocs): New function.
3122 (Sized_incr_relobj::do_count_local_symbols): New function.
3123 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3124 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3125 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3126 (Sized_incr_relobj::do_relocate): New function.
3127 (Sized_incr_relobj::do_set_section_offset): New function.
3128 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3129 (Sized_incr_dynobj::do_read_symbols): New function.
3130 (Sized_incr_dynobj::do_layout): New function.
3131 (Sized_incr_dynobj::do_add_symbols): New function.
3132 (Sized_incr_dynobj::do_should_include_member): New function.
3133 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3134 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3135 (Sized_incr_dynobj::do_section_size): New function.
3136 (Sized_incr_dynobj::do_section_name): New function.
3137 (Sized_incr_dynobj::do_section_contents): New function.
3138 (Sized_incr_dynobj::do_section_flags): New function.
3139 (Sized_incr_dynobj::do_section_entsize): New function.
3140 (Sized_incr_dynobj::do_section_address): New function.
3141 (Sized_incr_dynobj::do_section_type): New function.
3142 (Sized_incr_dynobj::do_section_link): New function.
3143 (Sized_incr_dynobj::do_section_info): New function.
3144 (Sized_incr_dynobj::do_section_addralign): New function.
3145 (Sized_incr_dynobj::do_initialize_xindex): New function.
3146 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3147 (make_sized_incremental_object): New function.
3148 (Incremental_library::copy_unused_symbols): New function.
3149 (Incremental_library::do_for_all_unused_symbols): New function.
3150 * incremental.h (enum Incremental_input_flags): New type.
3151 (class Incremental_checker): Remove.
3152 (Incremental_input_entry::Incremental_input_entry): Add argument
3153 serial number.
3154 (Incremental_input_entry::arg_serial): New function.
3155 (Incremental_input_entry::set_is_in_system_directory): New function.
3156 (Incremental_input_entry::is_in_system_directory): New function.
3157 (Incremental_input_entry::arg_serial_): New data member.
3158 (Incremental_input_entry::is_in_system_directory_): New data member.
3159 (class Script_info): Move here from script.h.
3160 (Script_info::Script_info): Add filename parameter.
3161 (Script_info::filename): New function.
3162 (Script_info::filename_): New data member.
3163 (Incremental_script_entry::Incremental_script_entry): Add argument
3164 serial number.
3165 (Incremental_object_entry::Incremental_object_entry): Likewise.
3166 (Incremental_object_entry::add_input_section): Build list of input
3167 sections with map to original shndx.
3168 (Incremental_object_entry::get_input_section_index): New function.
3169 (Incremental_object_entry::shndx_): New data member.
3170 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3171 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3172 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3173 serial number.
3174 (Incremental_inputs::report_archive_begin): Likewise.
3175 (Incremental_inputs::report_object): Likewise.
3176 (Incremental_inputs::report_script): Likewise.
3177 (class Incremental_global_symbol_reader): New class.
3178 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3179 and store flags and input file type.
3180 (Incremental_input_entry_reader::arg_serial): New function.
3181 (Incremental_input_entry_reader::type): Extract type from flags.
3182 (Incremental_input_entry_reader::is_in_system_directory): New function.
3183 (Incremental_input_entry_reader::get_input_section_count): Call
3184 accessor function for type.
3185 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3186 function for type; adjust size of global symbol entry.
3187 (Incremental_input_entry_reader::get_global_symbol_count): Call
3188 accessor function for type.
3189 (Incremental_input_entry_reader::get_object_count): Likewise.
3190 (Incremental_input_entry_reader::get_object_offset): Likewise.
3191 (Incremental_input_entry_reader::get_member_count): Likewise.
3192 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3193 (Incremental_input_entry_reader::get_member_offset): Likewise.
3194 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3195 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3196 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3197 (Incremental_input_entry_reader::get_global_symbol_reader): New
3198 function.
3199 (Incremental_input_entry_reader::get_output_symbol_index): New
3200 function.
3201 (Incremental_input_entry_reader::type_): Remove.
3202 (Incremental_input_entry_reader::flags_): New data member.
3203 (Incremental_inputs_reader::input_file_offset): New function.
3204 (Incremental_inputs_reader::input_file_index): New function.
3205 (Incremental_inputs_reader::input_file): Call input_file_offset.
3206 (Incremental_inputs_reader::input_file_at_offset): New function.
3207 (Incremental_relocs_reader::get_r_type): Reformat.
3208 (Incremental_relocs_reader::get_r_shndx): Reformat.
3209 (Incremental_relocs_reader::get_r_offset): Reformat.
3210 (Incremental_relocs_reader::data): New function.
3211 (Incremental_binary::Incremental_binary): Initialize new data members.
3212 (Incremental_binary::check_inputs): Add cmdline parameter.
3213 (Incremental_binary::file_is_unchanged): Remove.
3214 (Input_reader::arg_serial): New function.
3215 (Input_reader::get_unused_symbol_count): New function.
3216 (Input_reader::get_unused_symbol): New function.
3217 (Input_reader::do_arg_serial): New function.
3218 (Input_reader::do_get_unused_symbol_count): New function.
3219 (Input_reader::do_get_unused_symbol): New function.
3220 (Incremental_binary::input_file_count): New function.
3221 (Incremental_binary::get_input_reader): Change signature to use
3222 index instead of filename.
3223 (Incremental_binary::file_has_changed): New function.
3224 (Incremental_binary::get_input_argument): New function.
3225 (Incremental_binary::get_library): New function.
3226 (Incremental_binary::get_script_info): New function.
3227 (Incremental_binary::init_layout): New function.
3228 (Incremental_binary::reserve_layout): New function.
3229 (Incremental_binary::output_file): New function.
3230 (Incremental_binary::do_check_inputs): New function.
3231 (Incremental_binary::do_file_is_unchanged): Remove.
3232 (Incremental_binary::do_file_has_changed): New function.
3233 (Incremental_binary::do_init_layout): New function.
3234 (Incremental_binary::do_reserve_layout): New function.
3235 (Incremental_binary::do_input_file_count): New function.
3236 (Incremental_binary::do_get_input_reader): Change signature.
3237 (Incremental_binary::input_args_map_): New data member.
3238 (Incremental_binary::library_map_): New data member.
3239 (Incremental_binary::script_map_): New data member.
3240 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3241 new data members.
3242 (Sized_incremental_binary::output_section): New function.
3243 (Sized_incremental_binary::inputs_reader): Add const.
3244 (Sized_incremental_binary::symtab_reader): Add const.
3245 (Sized_incremental_binary::relocs_reader): Add const.
3246 (Sized_incremental_binary::got_plt_reader): Add const.
3247 (Sized_incremental_binary::get_symtab_view): New function.
3248 (Sized_incremental_binary::Inputs_reader): New typedef.
3249 (Sized_incremental_binary::Input_entry_reader): New typedef.
3250 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3251 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3252 (Sized_incremental_binary::do_file_has_changed): New function.
3253 (Sized_incremental_binary::do_init_layout): New function.
3254 (Sized_incremental_binary::do_reserve_layout): New function.
3255 (Sized_input_reader::Inputs_reader): Remove.
3256 (Sized_input_reader::Input_entry_reader): Remove.
3257 (Sized_input_reader::do_arg_serial): New function.
3258 (Sized_input_reader::do_get_unused_symbol_count): New function.
3259 (Sized_input_reader::do_get_unused_symbol): New function.
3260 (Sized_incremental_binary::do_input_file_count): New function.
3261 (Sized_incremental_binary::do_get_input_reader): Change signature;
3262 use index instead of filename.
3263 (Sized_incremental_binary::section_map_): New data member.
3264 (Sized_incremental_binary::input_entry_readers_): New data member.
3265 (class Sized_incr_relobj): New class.
3266 (class Sized_incr_dynobj): New class.
3267 (make_sized_incremental_object): New function.
3268 (class Incremental_library): New class.
3269 * layout.cc (Free_list::num_lists): New static data member.
3270 (Free_list::num_nodes): New static data member.
3271 (Free_list::num_removes): New static data member.
3272 (Free_list::num_remove_visits): New static data member.
3273 (Free_list::num_allocates): New static data member.
3274 (Free_list::num_allocate_visits): New static data member.
3275 (Free_list::init): New function.
3276 (Free_list::remove): New function.
3277 (Free_list::allocate): New function.
3278 (Free_list::dump): New function.
3279 (Free_list::print_stats): New function.
3280 (Layout_task_runner::run): Resize output file for incremental updates.
3281 (Layout::Layout): Initialize new data members.
3282 (Layout::set_incremental_base): New function.
3283 (Layout::init_fixed_output_section): New function.
3284 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3285 incremental updates.
3286 (Layout::create_gold_note): Do not create gold note section for
3287 incremental updates.
3288 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3289 for incremental updates.
3290 (Layout::set_section_offsets): For incremental updates, allocate space
3291 from free list.
3292 (Layout::create_symtab_sections): Layout with offsets relative to
3293 start of section; for incremental updates, allocate space from free
3294 list.
3295 (Layout::create_shdrs): For incremental updates, allocate space from
3296 free list.
3297 (Layout::finish_dynamic_section): For incremental updates, do not
3298 check --as-needed (fixed in subsequent patch).
3299 * layout.h (class Free_list): New class.
3300 (Layout::set_incremental_base): New function.
3301 (Layout::incremental_base): New function.
3302 (Layout::init_fixed_output_section): New function.
3303 (Layout::allocate): New function.
3304 (Layout::incremental_base_): New data member.
3305 (Layout::free_list_): New data member.
3306 * main.cc (main): Print Free_list statistics.
3307 * object.cc (Relobj::finalize_incremental_relocs): Add
3308 clear_counts parameter; clear counts only when clear_counts is set.
3309 (Sized_relobj::Sized_relobj): Initialize new base class.
3310 (Sized_relobj::do_layout): Don't report special sections.
3311 (Sized_relobj::do_for_all_local_got_entries): New function.
3312 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3313 symtab_off to all symbol table offsets.
3314 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3315 * object.h (class Got_offset_list): Move to top of file.
3316 (Object::Object): Allow case where input_file == NULL.
3317 (Object::~Object): Likewise.
3318 (Object::input_file): Assert that input_file != NULL.
3319 (Object::lock): Allow case where input_file == NULL.
3320 (Object::unlock): Likewise.
3321 (Object::is_locked): Likewise.
3322 (Object::token): Likewise.
3323 (Object::release): Likewise.
3324 (Object::is_incremental): New function.
3325 (Object::get_mtime): New function.
3326 (Object::for_all_local_got_entries): New function.
3327 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3328 (Object::set_is_in_system_directory): New function.
3329 (Object::is_in_system_directory): New function.
3330 (Object::do_is_incremental): New function.
3331 (Object::do_get_mtime): New function.
3332 (Object::do_for_all_local_got_entries): New function.
3333 (Object::is_in_system_directory_): New data member.
3334 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3335 (class Sized_relobj_base): New class.
3336 (class Sized_relobj): Derive from Sized_relobj_base.
3337 (class Sized_relobj::Symbols): Redeclare from base class.
3338 (class Sized_relobj::local_got_offset_list): Remove.
3339 (class Sized_relobj::Output_sections): Redeclare from base class.
3340 (class Sized_relobj::do_for_all_local_got_entries): New function.
3341 (class Sized_relobj::write_local_symbols): Add offset parameter.
3342 (class Sized_relobj::local_symbol_offset_): Update comment.
3343 (class Sized_relobj::local_dynsym_offset_): Update comment.
3344 * options.cc (Input_arguments::add_file): Remove const.
3345 * options.h (Input_file_argument::Input_file_argument):
3346 Initialize arg_serial_ (all constructors).
3347 (Input_file_argument::set_arg_serial): New function.
3348 (Input_file_argument::arg_serial): New function.
3349 (Input_file_argument::arg_serial_): New data member.
3350 (Input_arguments::Input_arguments): Initialize file_count_.
3351 (Input_arguments::add_file): Remove const.
3352 (Input_arguments::number_of_input_files): New function.
3353 (Input_arguments::file_count_): New data member.
3354 (Command_line::number_of_input_files): Call
3355 Input_arguments::number_of_input_files.
3356 * output.cc (Output_segment_headers::Output_segment_headers):
3357 Set current size.
3358 (Output_section::Input_section::current_data_size): New function.
3359 (Output_section::Output_section): Initialize new data members.
3360 (Output_section::add_input_section): Don't do merge sections for
3361 an incremental link; allocate space from free list for an
3362 incremental update.
3363 (Output_section::add_output_section_data): Allocate space from
3364 free list for an incremental update.
3365 (Output_section::update_data_size): New function.
3366 (Output_section::set_fixed_layout): New function.
3367 (Output_section::reserve): New function.
3368 (Output_segment::set_section_addresses): Remove const.
3369 (Output_segment::set_section_list_addresses): Remove const; allocate
3370 space from free list for an incremental update.
3371 (Output_segment::set_offset): Adjust size of RELRO segment for an
3372 incremental update.
3373 * output.h (Output_data::current_data_size): Move here from
3374 child classes.
3375 (Output_data::pre_finalize_data_size): New function.
3376 (Output_data::update_data_size): New function.
3377 (Output_section_headers::update_data_size): new function.
3378 (Output_section_data_build::current_data_size): Move to Output_data.
3379 (Output_data_strtab::update_data_size): New function.
3380 (Output_section::current_data_size): Move to Output_data.
3381 (Output_section::set_fixed_layout): New function.
3382 (Output_section::has_fixed_layout): New function.
3383 (Output_section::reserve): New function.
3384 (Output_section::update_data_size): New function.
3385 (Output_section::has_fixed_layout_): New data member.
3386 (Output_section::free_list_): New data member.
3387 (Output_segment::set_section_addresses): Remove const.
3388 (Output_segment::set_section_list_addresses): Remove const.
3389 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3390 New function.
3391 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3392 New function.
3393 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3394 parameter when calling Add_symbols constructor; store argument
3395 serial number for members of a lib group.
3396 (Add_symbols::locks): Allow case where token == NULL.
3397 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3398 (Read_member::~Read_member): New function.
3399 (Read_member::is_runnable): New function.
3400 (Read_member::locks): New function.
3401 (Read_member::run): New function.
3402 (Check_script::~Check_script): New function.
3403 (Check_script::is_runnable): New function.
3404 (Check_script::locks): New function.
3405 (Check_script::run): New function.
3406 (Check_library::~Check_library): New function.
3407 (Check_library::is_runnable): New function.
3408 (Check_library::locks): New function.
3409 (Check_library::run): New function.
3410 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3411 (Add_symbols::library_): New data member.
3412 (class Read_member): New class.
3413 (class Check_script): New class.
3414 (class Check_library): New class.
3415 * reloc.cc (Read_relocs::is_runnable): Allow case where
3416 token == NULL.
3417 (Read_relocs::locks): Likewise.
3418 (Scan_relocs::locks): Likewise.
3419 (Relocate_task::locks): Likewise.
3420 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3421 to clear counters.
3422 (Sized_relobj::incremental_relocs_scan): Fix comment.
3423 (Sized_relobj::do_relocate): Pass output file offset to
3424 write_local_symbols.
3425 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3426 from class declaration.
3427 * script.cc (read_input_script): Allocate Script_info; pass
3428 argument serial number to report_script.
3429 * script.h (class Script_info): Move to incremental.h.
3430 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3431 * symtab.h (Symbol_table::add_from_incrobj): New function.
3432 (Symbol_table::set_file_offset): New function.
3433
3434 2011-04-05 Cary Coutant <ccoutant@google.com>
3435
3436 * incremental-dump.cc (dump_incremental_inputs): Change signature
3437 to take a Sized_incremental_binary; change caller. Use readers
3438 in Sized_incremental_binary.
3439 * incremental.cc
3440 (Sized_incremental_binary::find_incremental_inputs_sections):
3441 Rename do_find_incremental_inputs_sections to this.
3442 (Sized_incremental_binary::setup_readers): New function.
3443 (Sized_incremental_binary::do_check_inputs): Check
3444 has_incremental_info_ flag; move setup code to setup_readers;
3445 use input readers.
3446 (Sized_incremental_binary::do_file_is_unchanged): New function.
3447 (Sized_incremental_binary::do_get_input_reader): New function.
3448 * incremental.h (class Incremental_binary): Move to end of file.
3449 (Incremental_binary::file_is_unchanged): New function.
3450 (Incremental_binary::do_file_is_unchanged): New function.
3451 (Incremental_binary::Input_reader): New class.
3452 (Incremental_binary::get_input_reader): New function.
3453 (class Sized_incremental_binary): Move to end of file.
3454 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3455 input section reader classes.
3456 (Sized_incremental_binary::has_incremental_info): New function.
3457 (Sized_incremental_binary::inputs_reader): New function.
3458 (Sized_incremental_binary::symtab_reader): New function.
3459 (Sized_incremental_binary::relocs_reader): New function.
3460 (Sized_incremental_binary::got_plt_reader): New function.
3461 (Sized_incremental_binary::do_file_is_unchanged): New function.
3462 (Sized_incremental_binary::Sized_input_reader): New class.
3463 (Sized_incremental_binary::get_input_reader): New function.
3464 (Sized_incremental_binary::find_incremental_inputs_sections):
3465 Rename do_find_incremental_inputs_sections to this.
3466 (Sized_incremental_binary::setup_readers): New function.
3467 (Sized_incremental_binary::has_incremental_info_): New data member.
3468 (Sized_incremental_binary::inputs_reader_): New data member.
3469 (Sized_incremental_binary::symtab_reader_): New data member.
3470 (Sized_incremental_binary::relocs_reader_): New data member.
3471 (Sized_incremental_binary::got_plt_reader_): New data member.
3472 (Sized_incremental_binary::current_input_file_): New data member.
3473
3474 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3475
3476 PR gold/12640
3477 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3478 violation.
3479
3480 2011-03-30 Cary Coutant <ccoutant@google.com>
3481
3482 * archive.cc (Archive::include_member): Adjust call to report_object.
3483 (Add_archive_symbols::run): Add script_info to call to
3484 report_archive_begin.
3485 (Lib_group::include_member): Adjust call to report_object.
3486 (Add_lib_group_symbols::run): Adjust call to report_object.
3487 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3488 blocks. Add object count for script input files.
3489 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3490 script_info parameter; change all callers.
3491 (Incremental_inputs::report_object): Add script_info parameter;
3492 change all callers.
3493 (Incremental_inputs::report_script): Store backpointer to
3494 incremental info entry.
3495 (Output_section_incremental_inputs::set_final_data_size): Record
3496 additional information for scripts.
3497 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3498 * incremental.h (Incremental_script_entry::add_object): New function.
3499 (Incremental_script_entry::get_object_count): New function.
3500 (Incremental_script_entry::get_object): New function.
3501 (Incremental_script_entry::objects_): New data member; adjust
3502 constructor.
3503 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3504 (Incremental_inputs::report_object): Add script_info parameter.
3505 (Incremental_inputs_reader::get_object_count): New function.
3506 (Incremental_inputs_reader::get_object_offset): New function.
3507 * options.cc (Input_arguments::add_file): Return reference to
3508 new input argument.
3509 * options.h (Input_argument::set_script_info): New function.
3510 (Input_argument::script_info): New function.
3511 (Input_argument::script_info_): New data member; adjust all
3512 constructors.
3513 (Input_file_group::add_file): Return reference to new input argument.
3514 (Input_file_lib::add_file): Likewise.
3515 (Input_arguments::add_file): Likewise.
3516 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3517 * script.cc (Parser_closure::Parser_closure): Add script_info
3518 parameter; adjust all callers.
3519 (Parser_closure::script_info): New function.
3520 (Parser_closure::script_info_): New data member.
3521 (read_input_script): Report scripts earlier to incremental info.
3522 (script_add_file): Set script_info in Input_argument.
3523 (script_add_library): Likewise.
3524 * script.h (Script_options::Script_info): Rewrite class.
3525
3526 2011-03-29 Cary Coutant <ccoutant@google.com>
3527
3528 * archive.cc (Library_base::should_include_member): Move
3529 method here from class Archive.
3530 (Archive::Archive): Initialize base class.
3531 (Archive::should_include_member): Move to base class.
3532 (Archive::do_for_all_unused_symbols): New function.
3533 (Add_archive_symbols::run): Remove redundant access to
3534 incremental_inputs.
3535 (Lib_group::Lib_group): Initialize base class.
3536 (Lib_group::do_filename): New function.
3537 (Lib_group::include_member): Pass pointer to Lib_group to
3538 report_object.
3539 (Lib_group::do_for_all_unused_symbols): New function.
3540 (Add_lib_group_symbols::run): Report archive information for
3541 incremental links.
3542 * archive.h (class Library_base): New base class.
3543 (class Archive): Derive from Library_base.
3544 (Archive::filename): Move to base class.
3545 (Archive::set_incremental_info): Likewise.
3546 (Archive::incremental_info): Likewise.
3547 (Archive::Should_include): Likewise.
3548 (Archive::should_include_member): Likewise.
3549 (Archive::Armap_entry): Remove.
3550 (Archive::Unused_symbol_iterator): Remove.
3551 (Archive::unused_symbols_begin): Remove.
3552 (Archive::unused_symbols_end): Remove.
3553 (Archive::do_filename): New function.
3554 (Archive::do_get_mtime): New function.
3555 (Archive::do_for_all_unused_symbols): New function.
3556 (Archive::task_): Move to base class.
3557 (Archive::incremental_info_): Likewise.
3558 (class Lib_group): Derive from Library_base.
3559 (Lib_group::do_filename): New function.
3560 (Lib_group::do_get_mtime): New function.
3561 (Lib_group::do_for_all_unused_symbols): New function.
3562 (Lib_group::task_): Move to base class.
3563 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3564 function.
3565 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3566 function.
3567 * incremental.cc (Incremental_inputs::report_archive_begin):
3568 Use Library_base; call library's get_mtime; add incremental inputs
3569 entry before members.
3570 (class Unused_symbol_visitor): New class.
3571 (Incremental_inputs::report_archive_end): Use Library_base; use
3572 visitor class to record unused symbols; don't add incremental inputs
3573 entry after members.
3574 (Incremental_inputs::report_object): Use Library_base.
3575 * incremental.h
3576 (Incremental_archive_entry::Incremental_archive_entry): Remove
3577 unused Archive parameter.
3578 (Incremental_inputs::report_archive_begin): Use Library_base.
3579 (Incremental_inputs::report_archive_end): Likewise.
3580 (Incremental_inputs::report_object): Likewise.
3581 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3582 function.
3583 * object.h (Object::for_all_global_symbols): New function.
3584 (Object::do_for_all_global_symbols): New function.
3585 (Sized_relobj::do_for_all_global_symbols): New function.
3586 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3587 function.
3588 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3589 function.
3590
3591 2011-03-27 Ian Lance Taylor <iant@google.com>
3592
3593 * archive.cc (Archive::interpret_header): Return -1 if something
3594 goes wrong. Change callers accordingly.
3595
3596 2011-03-25 Cary Coutant <ccoutant@google.com>
3597
3598 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3599 * testsuite/Makefile.in: Regenerate.
3600
3601 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3602
3603 * plugin.cc (get_view): New.
3604 (Plugin::load): Pass get_view to the plugin.
3605 (Plugin_manager::get_view): New.
3606
3607 2011-03-21 Ian Lance Taylor <iant@google.com>
3608
3609 * testsuite/final_layout.sh: Rewrite to not use dc.
3610 * testsuite/relro_test.sh: Fail if dc is not present.
3611
3612 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3613
3614 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3615 Change == to -eq.
3616 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3617 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3618 Change == to -eq.
3619 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3620 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3621
3622 2011-03-14 Ian Lance Taylor <iant@google.com>
3623
3624 * script-sections.cc (Sort_output_sections::script_compare):
3625 Rename from is_before, change return type.
3626 (Sort_output_sections::operator()): Adjust accordingly.
3627
3628 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3629
3630 PR gold/12572
3631 * testsuite/odr_violation2.cc: Add comment to make all error line
3632 numbers double digits.
3633 * testsuite/debug_msg.sh: Adjust expected errors.
3634
3635 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3636
3637 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3638 but mark earlier ones as non-canonical
3639 (offset_to_iterator): Update search target and example
3640 (do_addr2line): Return extra lines in a vector*
3641 (format_file_lineno): Extract from do_addr2line
3642 (one_addr2line): Add vector* out-param
3643 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3644 when a lineno entry appeared last for its instruction
3645 (Dwarf_line_info): Add vector* out-param
3646 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3647 * symtab.cc (Odr_violation_compare): Include the lineno in the
3648 comparison again.
3649 (linenos_from_loc): New. Combine the canonical line for an
3650 address with its other lines.
3651 (True_if_intersect): New. Helper functor to make
3652 std::set_intersection a query.
3653 (detect_odr_violations): Compare sets of lines instead of just
3654 one line for each function. This became less deterministic, but
3655 has fewer false positives.
3656 * symtab.h: Declarations.
3657 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3658 mix an optimized and non-optimized object in the same binary
3659 (odr_violation2.so): Same.
3660 * testsuite/Makefile.in: Regenerate from Makefile.am.
3661 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3662 * testsuite/debug_msg.sh: Update line numbers and add
3663 assertions.
3664 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3665 non-optimized context.
3666 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3667 isn't inlined, and use OdrDerived in an optimized context.
3668 * testsuite/odr_header1.h: Defines OdrDerived, where
3669 optimization will change the
3670 first-instruction-in-the-destructor's file and line number.
3671 * testsuite/odr_header2.h: Defines OdrBase.
3672
3673 2011-03-09 Ian Lance Taylor <iant@google.com>
3674
3675 * fileread.cc (File_read::clear_views): Don't delete the whole
3676 file view.
3677
3678 2011-03-08 Ian Lance Taylor <iant@google.com>
3679
3680 PR gold/12525
3681 * fileread.cc: #include <climits>.
3682 (GOLD_IOV_MAX): Define.
3683 (File_read::read_multiple): Limit number of entries by iov_max.
3684 * fileread.h (class File_read): Always set max_readv_entries to
3685 128.
3686
3687 2011-03-07 Ian Lance Taylor <iant@google.com>
3688
3689 PR gold/12525
3690 * options.h (class General_options): Add -dy and -dn.
3691
3692 2011-03-02 Cary Coutant <ccoutant@google.com>
3693
3694 * testsuite/script_test_9.t: Add TLS segment.
3695
3696 2011-03-02 Simon Baldwin <simonb@google.com>
3697
3698 * configure.ac: Add check for gnu_indirect_function support in
3699 the toolchain building binutils.
3700 * configure: Rebuild.
3701
3702 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3703
3704 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3705 plugin only symbols.
3706 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3707 in plugin files as not needed in the symbol table.
3708
3709 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3710
3711 * output.cc (Output_section::add_input_section): Delay fill
3712 generation for section ordering.
3713
3714 2011-02-09 Ian Lance Taylor <iant@google.com>
3715
3716 PR gold/12316
3717 * object.h (class Sized_relobj): Remove clear_local_symbols.
3718 * reloc.cc (Sized_relobj::do_relocate): Don't call
3719 clear_local_symbols.
3720
3721 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3722
3723 * plugin.cc (is_visible_from_outside): Return true for symbols
3724 in the -u option.
3725
3726 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3727
3728 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3729 filename.
3730
3731 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3732
3733 * icf.h (is_section_foldable_candidate): Change type of parameter
3734 to std::string.
3735 * icf.cc (Icf::find_identical_sections): Change type of local variable
3736 section_name to be std::string.
3737 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3738
3739 2011-01-25 Ian Lance Taylor <iant@google.com>
3740
3741 * script.cc (script_add_extern): Rewrite to use
3742 add_symbol_reference.
3743
3744 2011-01-25 Doug Kwan <dougkwan@google.com>
3745
3746 * icf.cc (get_section_contents): Always lock section's object.
3747
3748 2011-01-24 Ian Lance Taylor <iant@google.com>
3749
3750 * options.h (class General_options): Accept
3751 --no-detect-odr-violations.
3752
3753 2011-01-24 Ian Lance Taylor <iant@google.com>
3754
3755 * version.cc (version_string): Bump to 1.11.
3756
3757 2011-01-24 Ian Lance Taylor <iant@google.com>
3758
3759 * plugin.cc (class Plugin_rescan): Define new class.
3760 (Plugin_manager::claim_file): Set any_claimed_.
3761 (Plugin_manager::save_archive): New function.
3762 (Plugin_manager::save_input_group): New function.
3763 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3764 necessary.
3765 (Plugin_manager::new_undefined_symbol): New function.
3766 (Plugin_manager::rescan): New function.
3767 (Plugin_manager::rescannable_defines): New function.
3768 (Plugin_manager::add_input_file): Set any_added_.
3769 * plugin.h (class Plugin_manager): define new fields rescannable_,
3770 undefined_symbols_, any_claimed_, and any_added_. Declare
3771 Plugin_rescan as friend. Declare new functions.
3772 (Plugin_manager::Rescannable): Define type.
3773 (Plugin_manager::Rescannable_list): Define type.
3774 (Plugin_manager::Undefined_symbol_list): Define type.
3775 (Plugin_manager::Plugin_manager): Initialize new fields.
3776 * archive.cc (Archive::defines_symbol): New function.
3777 (Add_archive_symbols::run): Pass archive to plugins if any.
3778 * archive.h (class Archive): Declare defines_symbol.
3779 * readsyms.cc (Input_group::~Input_group): New function.
3780 (Finish_group::run): Pass input_group to plugins if any.
3781 * readsyms.h (class Input_group): Declare destructor.
3782 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3783 any.
3784
3785 2011-01-10 Ian Lance Taylor <iant@google.com>
3786
3787 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3788 section as relro.
3789 (Layout::set_segment_offsets): Reset increase_relro before calling
3790 set_section_addresses a second time.
3791
3792 2011-01-04 Cary Coutant <ccoutant@google.com>
3793
3794 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3795 sections before NOBITS sections.
3796
3797 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3798
3799 * version.cc (print_version): Update copyright to 2011.
3800
3801 2010-12-23 Cary Coutant <ccoutant@google.com>
3802
3803 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3804 of OS to this->add. Add OD parameter to second form of the function.
3805
3806 2010-12-20 Ian Lance Taylor <iant@google.com>
3807
3808 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3809 second of two consecutive entries with same offset.
3810
3811 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3812
3813 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3814 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3815 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3816 to avoid unneeded links against $(LDADD).
3817 * testsuite/Makefile.in: Regenerate.
3818
3819 2010-12-15 Ian Lance Taylor <iant@google.com>
3820
3821 PR gold/12324
3822 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3823 for R_X86_64_32 and R_X86_64_PC32.
3824 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3825 ver_matching_def_pic.o.
3826 (ver_matching_def_pic.o): New target.
3827
3828 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3829
3830 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3831 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3832 Move definition before File_read::View member definitions.
3833 (File_read::View::~View): Initialize and hold lock before
3834 updating current_mapped_bytes.
3835
3836 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3837
3838 * dwarf_reader.cc: Remove outdated comment.
3839 * gold-threads.cc: Fix typo in error message.
3840 * archive.cc: Fix typos in comments.
3841 * archive.h: Likewise.
3842 * arm-reloc-property.cc: Likewise.
3843 * arm-reloc-property.h: Likewise.
3844 * arm-reloc.def: Likewise.
3845 * arm.cc: Likewise.
3846 * attributes.h: Likewise.
3847 * cref.cc: Likewise.
3848 * ehframe.cc: Likewise.
3849 * fileread.h: Likewise.
3850 * gold.h: Likewise.
3851 * i386.cc: Likewise.
3852 * icf.cc: Likewise.
3853 * incremental.h: Likewise.
3854 * int_encoding.cc: Likewise.
3855 * layout.h: Likewise.
3856 * main.cc: Likewise.
3857 * merge.h: Likewise.
3858 * object.cc: Likewise.
3859 * object.h: Likewise.
3860 * options.cc: Likewise.
3861 * readsyms.cc: Likewise.
3862 * reduced_debug_output.cc: Likewise.
3863 * reloc.cc: Likewise.
3864 * script-sections.cc: Likewise.
3865 * sparc.cc: Likewise.
3866 * symtab.h: Likewise.
3867 * target-reloc.h: Likewise.
3868 * target.cc: Likewise.
3869 * target.h: Likewise.
3870 * timer.cc: Likewise.
3871 * timer.h: Likewise.
3872 * x86_64.cc: Likewise.
3873
3874 2010-12-09 Cary Coutant <ccoutant@google.com>
3875
3876 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3877 stack.
3878 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3879 parameter; change all callers.
3880 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3881 * options.h (warn_execstack): New option.
3882
3883 2010-12-07 Doug Kwan <dougkwan@google.com>
3884
3885 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3886 like function call relocations.
3887
3888 2010-12-07 Ian Lance Taylor <iant@google.com>
3889
3890 * archive.cc (Archive::get_elf_object_for_member): Permit
3891 punconfigured to be NULL.
3892 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3893 (Archive::include_member): Pass NULL to get_elf_object_for_member
3894 if we searched for the archive and this is the first included
3895 object.
3896
3897 2010-12-01 Ian Lance Taylor <iant@google.com>
3898
3899 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3900 track_relocs_type_ field.
3901 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3902 Set track_relocs_type_.
3903 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3904 contents when using RELA relocs.
3905 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3906 reloc_map_.
3907 * reloc.cc (Track_relocs::next_addend): New function.
3908 * reloc.h (class Track_relocs): Declare next_addend.
3909
3910 2010-12-01 Ian Lance Taylor <iant@google.com>
3911
3912 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3913 virtual destructor.
3914
3915 2010-12-01 Ian Lance Taylor <iant@google.com>
3916
3917 * README: Update compilers known to work and fail.
3918
3919 2010-11-23 Matthias Klose <doko@ubuntu.com>
3920
3921 * configure.in: For --enable-gold, handle value `default' instead of
3922 `both*'. Always install ld as ld.bfd, install as ld if gold is
3923 not the default.
3924 * configure: Regenerate.
3925
3926 2010-11-18 Doug Kwan <dougkwan@google.com>
3927
3928 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3929 and right_alignment to be zero. Store result alignment only if it is
3930 greater than existing alignment.
3931
3932 2010-11-16 Cary Coutant <ccoutant@google.com>
3933
3934 PR gold/12220
3935 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3936 Check for ".zdebug_line".
3937
3938 2010-11-16 Doug Kwan <dougkwan@google.com>
3939 Cary Coutant <ccoutant@google.com>
3940
3941 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3942 by reference; adjust all callers.
3943 * output.cc (Output_segment::set_section_addresses): Adjust references
3944 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3945 list is empty.
3946 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3947 end at page boundary.
3948
3949 2010-11-16 Cary Coutant <ccoutant@google.com>
3950
3951 PR gold/12220
3952 * layout.cc (Layout::choose_output_section): Transform names of
3953 compressed sections even when using a script with a SECTIONS clause.
3954 (Layout::output_section_name): Remove code to transform
3955 compressed debug section names.
3956 * output.cc (Output_section::add_input_section): Use uncompressed
3957 section size when tracking input sections.
3958
3959 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3960
3961 * symtab.h (Symbol::NON_PIC_REF): Remove.
3962 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3963 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3964 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3965 (Symbol::use_plt_offset): Take a flags argument and pass it
3966 directly to needs_dynamic_reloc. Restrict check for undefined
3967 weak symbols to function calls.
3968 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3969 (Target_arm::Scan::global): Use it.
3970 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3971 (Target_arm::Relocate::relocate): Likewise.
3972 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3973 parameter with an r_type parameter. Use get_reference_flags
3974 to get the flags.
3975 (Target_arm::Relocate::relocate): Update accordingly.
3976 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3977 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3978 (Target_i386::Scan::global): Likewise.
3979 (Target_i386::Relocate::relocate): Likewise.
3980 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3981 parameter with an r_type parameter. Use get_reference_flags
3982 to get the flags.
3983 (Target_i386::Relocate::relocate): Update accordingly.
3984 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3985 (Target_powerpc::Scan::global): Use it.
3986 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3987 (Target_powerpc::Relocate::relocate): Likewise.
3988 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3989 (Target_sparc::Scan::global): Use it.
3990 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3991 (Target_sparc::Relocate::relocate): Likewise.
3992 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3993 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3994 (Target_x86_64::Scan::global): Likewise.
3995 (Target_x86_64::Relocate::relocate): Likewise.
3996
3997 2010-11-08 Doug Kwan <dougkwan@google.com>
3998 Cary Coutant <ccoutant@google.com>
3999
4000 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4001 (Arm_exidx_merge_section::section_contents_): New data member.
4002 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4003 (Arm_input_section::~Arm_input_section): De-allocate memory.
4004 (Arm_input_section::original_contents_): New data member.
4005 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4006 in parameters instead of calling Object::section_contents without
4007 locking.
4008 (Arm_output_section::group_section): New parameter TASK. Pass it
4009 to callees that need locking objects.
4010 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4011 to lock EXIDX input sections. Fix a formatting issue. Call
4012 Arm_exidx_merged_section::build_contents to create merged section
4013 contents.
4014 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4015 to lock object of stub table owner.
4016 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4017 TEXT_SIZE to initialize data member TEXT_SIZE_.
4018 (Arm_exidx_input_section::addralign): Fix typo in comment.
4019 (Arm_exidx_input_section::text_size): New method.
4020 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4021 that require locking objects. Lock objects before scanning for stubs
4022 and updating local symbols.
4023 (Arm_input_section<big_endian>::init): Copy contents of original
4024 input section.
4025 (Arm_input_section<big_endian>::do_write): Use saved contents of
4026 original input section instead of calling Object::section_contents
4027 without locking.
4028 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4029 size without calling Object::section_size().
4030 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4031 for size. Allocate a buffer for merged EXIDX entries.
4032 (Arm_exidx_merged_section::build_contents): New method.
4033 (Arm_exidx_merged_section::do_write): Move merge section contents
4034 building code to Arm_exidx_merged_section::build_contetns. Write
4035 out contetns in buffer instead of building it on the fly.
4036 (Arm_relobj::make_exidx_input_section): Also pass text section size
4037 to Arm_exidx_input_section constructor.
4038 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4039 (Arm_dynobj::do_read_symbols): Fix memory leak.
4040 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4041 * target.h: (class Task): Add forward declaration.
4042 (Target::relax): Add new parameter TASK and pass it to
4043 Target::do_relax().
4044 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4045
4046 2010-11-05 Cary Coutant <ccoutant@google.com>
4047
4048 PR gold/10708
4049 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4050 object when reading from the file.
4051 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4052 second layout pass.
4053 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4054 when reading section contents.
4055 (get_section_contents): Likewise.
4056 (icf::find_identical_sections): Likewise.
4057 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4058 object when reading from the file.
4059 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4060 the object when doing deferred section layout.
4061
4062 2010-11-03 Nick Clifton <nickc@redhat.com>
4063
4064 PR gold/12001
4065 * script.h (class Symbol_assignment: name): New member. Returns
4066 the name of the symbol.
4067 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4068 Returns true if the given symbol name is on the list of
4069 assignments wating to be processed.
4070 * archive.cc (should_incldue_member): If the symbol is undefined,
4071 check to see if it is on the list of symbols pending assignment.
4072
4073 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4074
4075 * script-sections.cc (Script_sections::find_memory_region): Check
4076 for a NULL output section pointer.
4077
4078 2010-10-29 Doug Kwan <dougkwan@google.com>
4079
4080 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4081 Output_section::add_relaxed_input_section.
4082 * output.cc (Output_section::add_relaxed_input_section): Add new
4083 arguments LAYOUT and NAME. Set section order index.
4084 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4085 Copy section order index.
4086 * output.h (Output_section::add_relaxed_input_section): Add new
4087 arguments LAYOUT and NAME.
4088
4089 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4090
4091 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4092 NATIVE_OR_CROSS_LINKER.
4093 * testsuite/Makefile.in: Regenerate.
4094
4095 2010-10-20 Doug Kwan <dougkwan@google.com>
4096
4097 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4098 without SHF_LINK_ORDER flags.
4099 * layout.cc (Layout::choose_output_section): Do not filter
4100 SHF_LINK_ORDER flag in a relocatable link.
4101
4102 2010-10-17 Cary Coutant <ccoutant@google.com>
4103
4104 * output.h (Output_segment::set_section_addresses): Change function
4105 signature. Update all callers.
4106 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4107 sections.
4108 (Output_segment::set_section_addresses): Align after last TLS
4109 section. Add padding before last relro section instead of after.
4110
4111 2010-10-17 Doug Kwan <dougkwan@google.com>
4112
4113 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4114 GOT output section to be writable.
4115
4116 2010-10-14 Cary Coutant <ccoutant@google.com>
4117
4118 * debug.h (DEBUG_INCREMENTAL): New flag.
4119 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4120 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4121 mode.
4122 * incremental.cc (report_command_line): Ignore all forms of
4123 --incremental.
4124 * layout.cc (Layout::Layout): Check parameters for incremental link
4125 mode.
4126 * options.cc (General_options::parse_incremental): New function.
4127 (General_options::parse_no_incremental): New function.
4128 (General_options::parse_incremental_full): New function.
4129 (General_options::parse_incremental_update): New function.
4130 (General_options::incremental_mode_): New data member.
4131 (General_options::finalize): Check incremental_mode_.
4132 * options.h (General_options): Update help text for --incremental.
4133 Add --no-incremental, --incremental-full, --incremental-update.
4134 (General_options::Incremental_mode): New enum type.
4135 (General_options::incremental_mode): New function.
4136 (General_options::incremental_mode_): New data member.
4137 * parameters.cc (Parameters::incremental_mode_): New data member.
4138 (Parameters::set_options): Set incremental_mode_.
4139 (Parameters::set_incremental_full): New function.
4140 (Parameters::incremental): New function.
4141 (Parameters::incremental_update): New function.
4142 (set_parameters_incremental_full): New function.
4143 * parameters.h (Parameters::set_incremental_full): New function.
4144 (Parameters::incremental): New function.
4145 (Parameters::incremental_update): New function.
4146 (Parameters::incremental_mode_): New data member.
4147 (set_parameters_incremental_full): New function.
4148 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4149 incremental link mode.
4150 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4151 (Sized_relobj::do_relocate_sections): Likewise.
4152 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4153 option.
4154 * testsuite/Makefile.in: Regenerate.
4155 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4156
4157 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4158
4159 * script-sections.h (class Script_sections): Make
4160 Sections_elements typedef public.
4161 * script-sections.cc (class Sort_output_sections): Add elements_
4162 field. Add constructor which sets it; change all callers.
4163 (Sort_output_sections::is_before): New function.
4164 (Sort_output_sections::operator()): Call is_before.
4165 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4166 conditional.
4167 * testsuite/script_test_10.sh: New test. Test script section
4168 order.
4169 * testsuite/script_test_10.t: Likewise.
4170 * testsuite/script_test_10.s: Likewise.
4171 * testsuite/Makefile.am: Wrap the cross linker tests and the
4172 common tests into NATIVE_OR_CROSS_LINKER.
4173 (check_SCRIPTS): Add script_test_10.sh.
4174 (check_DATA): Add script_test_10.stdout.
4175 (script_test_10.o, script_test_10): New targets.
4176 (script_test_10.stdout): New target.
4177 * configure, testsuite/Makefile.in: Regenerate.
4178
4179 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4180
4181 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4182 error for the deprecated relocations.
4183 (Target_arm::Scan::global): Likewise.
4184 (Target_arm::Relocate::relocate): Likewise.
4185
4186 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4187
4188 * fileread.cc (Input_file::find_file): Initialize *found_name
4189 and *namep when using the fallback search for case 4.
4190
4191 2010-10-11 Cary Coutant <ccoutant@google.com>
4192
4193 * options.h (class General_options): Redefine -z lazy as an alias for
4194 the negation of -z now.
4195
4196 2010-10-11 Ian Lance Taylor <iant@google.com>
4197
4198 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4199 binding.
4200
4201 2010-10-06 Nick Clifton <nickc@redhat.com>
4202
4203 * script-sections.cc(class Memory_region): Remove
4204 current_lma_offset_ field. Rename current_vma_offset_ to
4205 current_offset_. Add last_section_ field.
4206 (Memory_region::get_current_vma_address): Rename to
4207 get_current_address.
4208 (Memory_region::get_current_lma_address): Delete.
4209 (Memory_region::increment_vma_offset): Rename to
4210 increment_offset.
4211 (Memory_region::increment_lma_offset): Delete.
4212 (Memory_region::attributes_compatible): New method. Returns
4213 true if the provided section is compatible with the region.
4214 (Memory_region::get_last_section): New method. Returns the last
4215 section to use the region.
4216 (Memory_region::set_last_section): New method. Stores the last
4217 section to use the region.
4218 (Script_sections::block_in_region): New method. Returns true if
4219 a block of memory is contained within a region.
4220 (Script_sections::find_memory_region): New method. Locates a
4221 memory region to be used to set a VMA or LMA address.
4222 (Output_section_definition::set_section_addresses): Add code to
4223 check for addresses set by memory regions.
4224 (Output_segment::set_section_addresses): Remove memory region
4225 walking code.
4226 (Script_sections::create_segment): Add a warning if a header
4227 segment is created outside of any region.
4228 * script-sections.h (class Script_sections): Add prototypes for
4229 find_memory_region and block_in_region methods.
4230 * testsuite/memory_test.s: Use .long instead of .word.
4231 * testsuite/memory_test.t: Add some more output sections.
4232 * testsuite/memory_test.sh: Update expected output.
4233
4234 2010-10-02 Doug Kwan <dougkwan@google.com>
4235
4236 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4237 defintion to symtab.h
4238 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4239 declaration to defintion.
4240
4241 2010-10-01 Nick Clifton <nickc@redhat.com>
4242
4243 * expression.cc (eval): Replace dummy argument with NULL.
4244 (eval_maybe_dot): Check for a NULL result section pointer.
4245 (Symbol_expression::value): Likewise.
4246 (Dot_expression::value): Likewise.
4247 (BINARY_EXPRESSION): Likewise.
4248 (Max_expression::value): Likewise.
4249 (Min_expression::value): Likewise.
4250 (Absolute_expression::value): Likewise.
4251 (Addr_expression::value_from_output_section): Likewise.
4252 (Loaddddr_expression::value_from_output_section): Likewise.
4253 (Segment_start_expression::value): Likewise.
4254 * script-sections.cc
4255 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4256 argument with NULL.
4257 (Sections_elememt_dot_assignment::set_section_addresses):
4258 Likewise.
4259 (Output_data_expression::do_write_to_buffer): Likewise.
4260 (Output_section_definition::finalize_symbols): Likewise.
4261 (Output_section_definition::set_section_addresses): Likewise.
4262
4263 2010-09-30 Doug Kwan <dougkwan@google.com>
4264
4265 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4266
4267 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4268
4269 * target.h (Target::can_icf_inline_merge_sections): New virtual
4270 function.
4271 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4272 virtual function.
4273 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4274 virtual function.
4275 * icf.cc (get_section_contents): Inline merge sections only when
4276 target allows it.
4277
4278 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4279
4280 * configure: Regenerate.
4281
4282 2010-09-17 Ian Lance Taylor <iant@google.com>
4283
4284 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4285 * testsuite/Makefile.am (memory_test.o): New target.
4286 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4287 memory_test.t.
4288 * testsuite/Makefile.in: Rebuild.
4289
4290 2010-09-17 Doug Kwan <dougkwan@google.com>
4291
4292 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4293 defintion if relocation uses GOT entries of the symbol.
4294 * testsuite/icf_safe_test.sh: Fix test.
4295 * testsuite/icf_safe_so_test.sh: Fix test.
4296
4297 2010-09-16 Cary Coutant <ccoutant@google.com>
4298
4299 * script_sections.cc (class Memory_region): Remove "NULL" from
4300 vector initializations.
4301
4302 2010-09-15 Cary Coutant <ccoutant@google.com>
4303
4304 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4305 Resolve forwarding symbols.
4306
4307 2010-09-15 Doug Kwan <dougkwan@google.com>
4308
4309 * gold/testsuite/script_test_3.t: Add ARM special sections.
4310 * gold/testsuite/script_test_4.t: Same.
4311 * gold/testsuite/script_test_5.t: Same.
4312 * gold/testsuite/script_test_6.t: Same.
4313 * gold/testsuite/script_test_7.t: Same.
4314 * gold/testsuite/script_test_7.t: Same.
4315 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4316
4317 2010-09-14 Cary Coutant <ccoutant@google.com>
4318
4319 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4320 (Target_x86_64::Relocate::relocate_tls): Replace check for
4321 saw_tls_block_reloc_ with test for executable section.
4322
4323 2010-09-12 Cary Coutant <ccoutant@google.com>
4324
4325 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4326 position-independent executables to shared libraries need dynamic
4327 relocations.
4328 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4329 position-independent executables.
4330 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4331 * testsuite/Makefile.in: Regenerate.
4332
4333 2010-09-10 Nick Clifton <nickc@redhat.com>
4334
4335 PR gold/11997
4336 * testsuite/memory_test.t: Discard any sections that are not
4337 needed.
4338
4339 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4340
4341 PR gold/11996
4342 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4343 "This::" to work around a bug in gcc 4.2.
4344
4345 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4346
4347 2010-09-09 Rafael Espindola <espindola@google.com>
4348
4349 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4350 sections with different PF_X flags in the same segment.
4351 (Layout::find_first_load_seg): Search all segments to find the first
4352 one.
4353 * options.h (rosegment): New.
4354
4355 2010-09-08 Rafael Espindola <espindola@google.com>
4356
4357 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4358
4359 2010-09-08 Doug Kwan <dougkwan@google.com>
4360
4361 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4362 (Arm_relobj::do_relocate_sections): Add new parameter for output
4363 file to match the parent.
4364 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4365 of local symbols instead of input values. Update code to track
4366 changes in gold::relocate_section.
4367 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4368 (Sized_relobj::compute_final_local_value_internal): New methods.
4369 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4370 body into private version of Sized_relobj::compute_final_local_value.
4371 Call the inline method.
4372 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4373 merged symbol value if there is one.
4374 (Symbol_value::has_output_value): New method defintiion.
4375 (Sized_relobj::Compute_final_local_value_status): New enum type.
4376 (Sized_relobj::compute_final_local_value): New methods.
4377 (Sized_relobj::compute_final_local_value_internal): New methods.
4378 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4379 and arm_cortex_a8.sh.
4380 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4381 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4382 New tests.
4383 * Makefile.in: Regenerate.
4384 * testsuite/arm_bl_out_of_range.s: Update test.
4385 * testsuite/thumb_bl_out_of_range.s: Ditto.
4386 * testsuite/thumb_blx_out_of_range.s: Ditto.
4387 * testsuite/arm_branch_out_of_range.sh: New file.
4388 * testsuite/arm_cortex_a8.sh: Ditto.
4389 * testsuite/arm_cortex_a8_b.s: Ditto.
4390 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4391 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4392 * testsuite/arm_cortex_a8_bl.s: Ditto.
4393 * testsuite/arm_cortex_a8_blx.s: Ditto.
4394 * testsuite/arm_cortex_a8_local.s: Ditto.
4395 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4396 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4397
4398 2010-09-08 Rafael Espindola <espindola@google.com>
4399
4400 * Makefile.am (memory_test.stdout): Run readelf with -W.
4401 * Makefile.in: Regenerate.
4402 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4403 64 bit output.
4404
4405 2010-09-08 Rafael Espindola <espindola@google.com>
4406
4407 * script-sections.cc (Script_sections::add_memory_region): Convert
4408 field precision to int.
4409 * script.cc (script_set_section_region, script_set_section_region):
4410 Convert field precision to int.
4411
4412 2010-09-08 Rafael Espindola <espindola@google.com>
4413
4414 * arm.cc (do_finalize_sections): Create the __exidx_start and
4415 __exdix_end symbols even when the section is missing.
4416
4417 2010-09-08 Nick Clifton <nickc@redhat.com>
4418
4419 * README: Remove claim that MEMORY is not supported.
4420 * expression.cc (script_exp_function_origin)
4421 (script_exp_function_length): Move from here to ...
4422 * script.cc: ... here.
4423 (script_set_section_region, script_add_memory)
4424 (script_parse_memory_attr, script_include_directive): New
4425 functions.
4426 * script-sections.cc
4427 (class Memory_region): New class.
4428 (class Output_section_definition): Add set_memory_region,
4429 set_section_vma, set_section_lma and get_section_name methods.
4430 (class Script_Sections): Add add_memory_region,
4431 find_memory_region, find_memory_region_origin,
4432 find_memory_region_length and set_memory_region methods.
4433 Have set_section_addresses method walk the list of set memory
4434 regions.
4435 Extend the print methos to display memory regions.
4436 * script-sections.h: Add prototypes for new methods.
4437 Add enum for MEMORY region attributes.
4438 * yyscript.y: Add support for parsing MEMORY regions.
4439 * script-c.h: Add prototypes for new functions.
4440 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4441 * testsuite/Makefile.in: Regenerate.
4442 * testsuite/memory_test.sh: New script.
4443 * testsuite/memory_test.s: New assembler source file.
4444 * testsuite/memory_test.t: New linker script.
4445
4446 2010-08-27 Doug Kwan <dougkwan@google.com>
4447
4448 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4449 reference override an existing dynamic weak reference.
4450 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4451 * testsuite/Makefile.in: Regenerate.
4452 * testsuite/dyn_weak_ref.sh: New file.
4453 * testsuite/dyn_weak_ref_1.c: Ditto.
4454 * testsuite/dyn_weak_ref_2.c: Ditto.
4455
4456 2010-08-27 Ian Lance Taylor <iant@google.com>
4457
4458 * incremental.h (class Incremental_input_entry): Add virtual
4459 destructor.
4460
4461 2010-08-27 Ian Lance Taylor <iant@google.com>
4462
4463 * testsuite/start_lib_test_3.c: Mark t3 as used.
4464
4465 2010-08-27 Nick Clifton <nickc@redhat.com>
4466
4467 * options.cc (version_script): Fix small typo in previous
4468 whitespace tidyup.
4469
4470 2010-08-25 Nick Clifton <nickc@redhat.com>
4471
4472 * archive.cc: Formatting fixes: Remove whitespace between
4473 typename and following asterisk. Remove whitespace between
4474 function name and opening parenthesis.
4475 * archive.h: Likewise.
4476 * arm.cc: Likewise.
4477 * attributes.cc: Likewise.
4478 * attributes.h: Likewise.
4479 * common.cc: Likewise.
4480 * copy-relocs.cc: Likewise.
4481 * dirsearch.h: Likewise.
4482 * dynobj.cc: Likewise.
4483 * ehframe.cc: Likewise.
4484 * ehframe.h: Likewise.
4485 * expression.cc: Likewise.
4486 * fileread.cc: Likewise.
4487 * fileread.h: Likewise.
4488 * gc.h: Likewise.
4489 * gold-threads.cc: Likewise.
4490 * gold.cc: Likewise.
4491 * i386.cc: Likewise.
4492 * icf.h: Likewise.
4493 * incremental-dump.cc: Likewise.
4494 * incremental.cc: Likewise.
4495 * layout.cc: Likewise.
4496 * layout.h: Likewise.
4497 * main.cc: Likewise.
4498 * merge.cc: Likewise.
4499 * merge.h: Likewise.
4500 * object.cc: Likewise.
4501 * object.h: Likewise.
4502 * options.cc: Likewise.
4503 * options.h: Likewise.
4504 * output.cc: Likewise.
4505 * output.h: Likewise.
4506 * plugin.cc: Likewise.
4507 * plugin.h: Likewise.
4508 * powerpc.cc: Likewise.
4509 * reloc.cc: Likewise.
4510 * script-c.h: Likewise.
4511 * script-sections.cc: Likewise.
4512 * script.cc: Likewise.
4513 * stringpool.cc: Likewise.
4514 * symtab.cc: Likewise.
4515 * symtab.h: Likewise.
4516 * target.cc: Likewise.
4517 * timer.cc: Likewise.
4518 * timer.h: Likewise.
4519 * version.cc: Likewise.
4520 * x86_64.cc: Likewise.
4521
4522 2010-08-24 Nick Clifton <nickc@redhat.com>
4523
4524 PR 11899
4525 * layout.cc (segment_precedes): Sort segments by their physical
4526 addresses, if they have been set.
4527
4528 2010-08-23 Cary Coutant <ccoutant@google.com>
4529
4530 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4531 symbols data.
4532 (Lib_group::include_member): Unlock object after deleting its
4533 symbols data.
4534 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4535 the bug fixed here.
4536
4537 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4538 Cary Coutant <ccoutant@google.com>
4539
4540 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4541 constructor, and set_blocker.
4542 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4543 readsyms_blocker_.
4544 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4545 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4546 * testsuite/Makefile.am (start_lib_test): New test case.
4547 * testsuite/Makefile.in: Regenerate.
4548 * testsuite/start_lib_test_main.c: New file.
4549 * testsuite/start_lib_test_1.c: New file.
4550 * testsuite/start_lib_test_2.c: New file.
4551 * testsuite/start_lib_test_3.c: New file.
4552
4553 2010-08-19 Ian Lance Taylor <iant@google.com>
4554
4555 * Makefile.in: Rebuild with automake 1.11.1.
4556 * aclocal.m4: Likewise.
4557 * testsuite/Makefile.in: Likewise.
4558
4559 2010-08-19 Ian Lance Taylor <iant@google.com>
4560
4561 PR 10893
4562 * i386.cc (class Output_data_plt_i386): Update declarations.
4563 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4564 local_ifuncs_ fields.
4565 (Target_i386::do_plt_section_for_global): New function.
4566 (Target_i386::do_plt_section_for_local): New function.
4567 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4568 parameter; change all callers. Initialize global_ifuncs_ and
4569 local_ifuncs_. If doing a static link define __rel_iplt_start and
4570 __rel_iplt_end.
4571 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4572 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4573 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4574 symbols.
4575 (Target_i386::make_plt_section): New function, broken out of
4576 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4577 (Target_i386::make_plt_entry): Call make_plt_section.
4578 (Target_i386::make_local_ifunc_plt_entry): New function.
4579 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4580 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4581 R_386_IRELATIVE to switch.
4582 (Target_i386::Scan::global): Likewise.
4583 (Target_i386::Relocate::relocate): Likewise.
4584 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4585 switch.
4586 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4587 (Target_x86_64::do_plt_section_for_global): New function.
4588 (Target_x86_64::do_plt_section_for_local): New function.
4589 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4590 parameter; change all callers. If doing a static link define
4591 __rela_iplt_start and __rela_iplt_end.
4592 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4593 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4594 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4595 to point to .plt.
4596 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4597 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4598 switch.
4599 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4600 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4601 R_X86_64_IRELATIVE to switch.
4602 (Target_x86_64::Scan::global): Likewise.
4603 (Target_x86_64::Relocate::relocate): Likewise.
4604 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4605 switch.
4606 * target.h (class Target): Add plt_section_for_global and
4607 plt_section_for_local functions. Add do_plt_section_for_global
4608 and do_plt_section_for_local virtual functions.
4609 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4610 clarifying comments.
4611 (Symbol::use_plt_offset): Handle IFUNC symbol.
4612 * object.cc (Sized_relobj::Sized_relobj): Initialize
4613 local_plt_offsets_.
4614 (Sized_relobj::local_has_plt_offset): New function.
4615 (Sized_relobj::local_plt_offset): New function.
4616 (Sized_relobj::set_local_plt_offset): New function.
4617 (Sized_relobj::do_count): Handle IFUNC symbol.
4618 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4619 a bit away from input_shndx_ field. Add set_is_func_symbol and
4620 is_ifunc_symbol functions.
4621 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4622 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4623 local_plt_offsets_ field.
4624 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4625 * output.h (class Output_section_data): Add non-const
4626 output_section function.
4627 (class Output_data_got): Update declarations.
4628 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4629 Add use_plt_offset parameter to global and local constructors.
4630 Change all callers. Change local_sym_index_ field to 31 bits.
4631 Change GSYM_CODE and CONSTANT_CODE accordingly.
4632 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4633 doing a static link don't set sh_link field.
4634 (Output_data_got::Got_entry::write): Use PLT offset if
4635 appropriate.
4636 (Output_data_got::add_global_plt): New function.
4637 (Output_data_got::add_local_plt): New function.
4638 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4639 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4640 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4641 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4642 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4643 IFUNC conditional.
4644 * testsuite/ifunc-sel.h: New file.
4645 * testsuite/ifuncmain1.c: New file.
4646 * testsuite/ifuncmain1vis.c: New file.
4647 * testsuite/ifuncmod1.c: New file.
4648 * testsuite/ifuncdep2.c: New file.
4649 * testsuite/ifuncmain2.c: New file.
4650 * testsuite/ifuncmain3.c: New file.
4651 * testsuite/ifuncmod3.c: New file.
4652 * testsuite/ifuncmain4.c: New file.
4653 * testsuite/ifuncmain5.c: New file.
4654 * testsuite/ifuncmod5.c: New file.
4655 * testsuite/ifuncmain6pie.c: New file.
4656 * testsuite/ifuncmod6.c: New file.
4657 * testsuite/ifuncmain7.c: New file.
4658 * configure, testsuite/Makefile.in: Rebuild.
4659
4660 2010-08-18 Ian Lance Taylor <iant@google.com>
4661
4662 * incremental.cc
4663 (Output_section_incremental_inputs::write_input_files): Add cast
4664 to avoid signed/unsigned comparison warning.
4665 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4666
4667 2010-08-12 Cary Coutant <ccoutant@google.com>
4668
4669 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4670
4671 2010-08-13 Ian Lance Taylor <iant@google.com>
4672
4673 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4674
4675 2010-08-12 Cary Coutant <ccoutant@google.com>
4676 Doug Kwan <dougkwan@google.com>
4677
4678 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4679 defintion overrides non-weak undef, remember that the original undef
4680 is not weak.
4681 * symtab.cc (Symbol_table::sized_write_global): For undef without
4682 an original weak binding, set binding to global in output.
4683 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4684 * testsuite/Makefile.in: Regenerate.
4685 * testsuite/strong_ref_weak_def.sh: New file.
4686 * testsuite/strong_ref_weak_def_1.c: Ditto.
4687 * testsuite/strong_ref_weak_def_2.c: Ditto.
4688
4689 2010-08-12 Cary Coutant <ccoutant@google.com>
4690
4691 * testsuite/incremental_test.sh: Rewrite.
4692 * testsuite/incremental_test_1.c: Rewrite.
4693 * testsuite/incremental_test_2.c: Rewrite.
4694
4695 2010-08-12 Cary Coutant <ccoutant@google.com>
4696
4697 * arm.cc (Target_arm::got_size): Add const.
4698 (Target_arm::got_entry_count): New function.
4699 (Target_arm::plt_entry_count): New function.
4700 (Target_arm::first_plt_entry_offset): New function.
4701 (Target_arm::plt_entry_size): New function.
4702 (Output_data_plt_arm::entry_count): New function.
4703 (Output_data_plt_arm::first_plt_entry_offset): New function.
4704 (Output_data_plt_arm::get_plt_entry_size): New function.
4705 * i386.cc (Target_i386::got_size): Add const.
4706 (Target_i386::got_entry_count): New function.
4707 (Target_i386::plt_entry_count): New function.
4708 (Target_i386::first_plt_entry_offset): New function.
4709 (Target_i386::plt_entry_size): New function.
4710 (Output_data_plt_i386::entry_count): New function.
4711 (Output_data_plt_i386::first_plt_entry_offset): New function.
4712 (Output_data_plt_i386::get_plt_entry_size): New function.
4713 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4714 find_incremental_inputs_sections. Dump incremental_got_plt section.
4715 * incremental.cc: Include target.h.
4716 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4717 parameter. Adjust all callers. Find incremental_got_plt section.
4718 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4719 section.
4720 (Output_section_incremental_inputs::set_final_data_size): Calculate
4721 size of incremental_got_plt section.
4722 (Output_section_incremental_inputs::do_write): Write the
4723 incremental_got_plt section.
4724 (Got_plt_view_info): New struct.
4725 (Local_got_offset_visitor): New class.
4726 (Global_got_offset_visitor): New class.
4727 (Global_symbol_visitor_got_plt): New class.
4728 (Output_section_incremental_inputs::write_got_plt): New function.
4729 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4730 Add parameter. Adjust all callers.
4731 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4732 (Incremental_inputs::got_plt_section): New function.
4733 (Incremental_inputs::got_plt_section_): New data member.
4734 (Incremental_got_plt_reader): New class.
4735 * layout.cc (Layout::create_incremental_info_sections): Add the
4736 incremental_got_plt section.
4737 * object.h (Got_offset_list::get_list): New function.
4738 (Got offset_list::for_all_got_offsets): New function.
4739 (Sized_relobj::local_got_offset_list): New function.
4740 * powerpc.cc (Target_powerpc::got_size): Add const.
4741 (Target_powerpc::got_entry_count): New function.
4742 (Target_powerpc::plt_entry_count): New function.
4743 (Target_powerpc::first_plt_entry_offset): New function.
4744 (Target_powerpc::plt_entry_size): New function.
4745 (Output_data_plt_powerpc::entry_count): New function.
4746 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4747 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4748 * sparc.cc (Target_sparc::got_size): Add const.
4749 (Target_sparc::got_entry_count): New function.
4750 (Target_sparc::plt_entry_count): New function.
4751 (Target_sparc::first_plt_entry_offset): New function.
4752 (Target_sparc::plt_entry_size): New function.
4753 (Output_data_plt_sparc::entry_count): New function.
4754 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4755 (Output_data_plt_sparc::get_plt_entry_size): New function.
4756 * symtab.h (Symbol::got_offset_list): New function.
4757 (Symbol_table::for_all_symbols): New function.
4758 * target.h (Sized_target::got_entry_count): New function.
4759 (Sized_target::plt_entry_count): New function.
4760 (Sized_target::plt_entry_size): New function.
4761 * x86_64.cc (Target_x86_64::got_size): Add const.
4762 (Target_x86_64::got_entry_count): New function.
4763 (Target_x86_64::plt_entry_count): New function.
4764 (Target_x86_64::first_plt_entry_offset): New function.
4765 (Target_x86_64::plt_entry_size): New function.
4766 (Output_data_plt_x86_64::entry_count): New function.
4767 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4768 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4769
4770 2010-08-12 Cary Coutant <ccoutant@google.com>
4771
4772 * archive.cc: Include incremental.h.
4773 (Archive::Archive): Initialize incremental_info_.
4774 (Archive::include_member): Record archive members in incremental info.
4775 (Add_archive_symbols::run): Record begin and end of an archive in
4776 incremental info.
4777 (Lib_group::include_member): Record objects in incremental info.
4778 * archive.h (Incremental_archive_entry): Forward declaration.
4779 (Archive::set_incremental_info): New member function.
4780 (Archive::incremental_info): New member function.
4781 (Archive::Unused_symbol_iterator): New class.
4782 (Archive::unused_symbols_begin): New member function.
4783 (Archive::unused_symbols_end): New member function.
4784 (Archive::incremental_info_): New data member.
4785 * incremental-dump.cc (find_input_containing_global): New function.
4786 (dump_incremental_inputs): Dump new incremental info sections.
4787 * incremental.cc: Include symtab.h.
4788 (Output_section_incremental_inputs): New class.
4789 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4790 new incremental info sections.
4791 (Sized_incremental_binary::do_check_inputs): Likewise.
4792 (Incremental_inputs::report_archive): Remove.
4793 (Incremental_inputs::report_archive_begin): New function.
4794 (Incremental_inputs::report_archive_end): New function.
4795 (Incremental_inputs::report_object): New function.
4796 (Incremental_inputs::finalize_inputs): Remove.
4797 (Incremental_inputs::report_input_section): New function.
4798 (Incremental_inputs::report_script): Rewrite.
4799 (Incremental_inputs::finalize): Do nothing but finalize string table.
4800 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4801 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4802 (Incremental_inputs::create_data_sections): New function.
4803 (Incremental_inputs::relocs_entsize): New function.
4804 (Output_section_incremental_inputs::set_final_data_size): New function.
4805 (Output_section_incremental_inputs::do_write): New function.
4806 (Output_section_incremental_inputs::write_header): New function.
4807 (Output_section_incremental_inputs::write_input_files): New function.
4808 (Output_section_incremental_inputs::write_info_blocks): New function.
4809 (Output_section_incremental_inputs::write_symtab): New function.
4810 * incremental.h (Incremental_script_entry): Forward declaration.
4811 (Incremental_object_entry): Forward declaration.
4812 (Incremental_archive_entry): Forward declaration.
4813 (Incremental_inputs): Forward declaration.
4814 (Incremental_inputs_header_data): Remove.
4815 (Incremental_inputs_header): Remove.
4816 (Incremental_inputs_header_write): Remove.
4817 (Incremental_inputs_entry_data): Remove.
4818 (Incremental_inputs_entry): Remove.
4819 (Incremental_inputs_entry_write): Remove.
4820 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4821 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4822 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4823 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4824 Likewise.
4825 (Incremental_input_entry): New class.
4826 (Incremental_script_entry): New class.
4827 (Incremental_object_entry): New class.
4828 (Incremental_archive_entry): New class.
4829 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4830 (Incremental_inputs::report_inputs): Remove.
4831 (Incremental_inputs::report_archive): Remove.
4832 (Incremental_inputs::report_archive_begin): New function.
4833 (Incremental_inputs::report_archive_end): New function.
4834 (Incremental_inputs::report_object): Change prototype.
4835 (Incremental_inputs::report_input_section): New function.
4836 (Incremental_inputs::report_script): Change prototype.
4837 (Incremental_inputs::get_reloc_count): New function.
4838 (Incremental_inputs::set_reloc_count): New function.
4839 (Incremental_inputs::create_data_sections): New function.
4840 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4841 (Incremental_inputs::inputs_section): New function.
4842 (Incremental_inputs::symtab_section): New function.
4843 (Incremental_inputs::relocs_section): New function.
4844 (Incremental_inputs::get_stringpool): Add const.
4845 (Incremental_inputs::command_line): Add const.
4846 (Incremental_inputs::inputs): Remove.
4847 (Incremental_inputs::command_line_key): New function.
4848 (Incremental_inputs::input_file_count): New function.
4849 (Incremental_inputs::input_files): New function.
4850 (Incremental_inputs::relocs_entsize): New function.
4851 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4852 (Incremental_inputs::finalize_inputs): Remove.
4853 (Incremental_inputs::Input_info): Remove.
4854 (Incremental_inputs::lock_): Remove.
4855 (Incremental_inputs::inputs_): Change type.
4856 (Incremental_inputs::inputs_map_): Remove.
4857 (Incremental_inputs::current_object_entry_): New data member.
4858 (Incremental_inputs::inputs_section_): New data member.
4859 (Incremental_inputs::symtab_section_): New data member.
4860 (Incremental_inputs::relocs_section_): New data member.
4861 (Incremental_inputs::reloc_count_): New data member.
4862 (Incremental_inputs_reader): New class.
4863 (Incremental_symtab_reader): New class.
4864 (Incremental_relocs_reader): New class.
4865 * layout.cc (Layout::finalize): Move finalization of incremental info
4866 and creation of incremental info sections to follow finalization of
4867 symbol table. Set offsets for postprocessing sections.
4868 (Layout::create_incremental_info_sections): Call
4869 Incremental_inputs::create_data_sections. Add incremental symtab
4870 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4871 sections to layout after input sections.
4872 * layout.h (struct Timespec): Forward declaration.
4873 (Layout::incremental_inputs): Add const.
4874 (Layout::create_incremental_info_sections): Add parameter.
4875 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4876 * object.cc: Include incremental.h.
4877 (Relobj::finalize_incremental_relocs): New function.
4878 (Sized_relobj::do_layout): Record input sections in incremental info.
4879 * object.h (Object::output_section): New function.
4880 (Object::output_section_offset): Moved from Relobj.
4881 (Object::get_incremental_reloc_base): New function.
4882 (Object::get_incremental_reloc_count): New function.
4883 (Object::do_output_section): New function.
4884 (Object::do_output_section_offset): Moved from Relobj.
4885 (Object::do_get_incremental_reloc_base): New function.
4886 (Object::do_get_incremental_reloc_count): New function.
4887 (Object::Object): Initialize new data members.
4888 (Relobj::output_section): Renamed do_output_section and moved to
4889 protected.
4890 (Relobj::output_section_offset): Moved to Object.
4891 (Relobj::do_get_incremental_reloc_base): New function.
4892 (Relobj::do_get_incremental_reloc_count): New function.
4893 (Relobj::allocate_incremental_reloc_counts): New function.
4894 (Relobj::count_incremental_reloc): New function.
4895 (Relobj::finalize_incremental_relocs): New function.
4896 (Relobj::next_incremental_reloc_index): New function.
4897 (Relobj::reloc_counts_): New data member.
4898 (Relobj::reloc_bases_): New data member.
4899 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4900 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4901 (Sized_relobj::incremental_relocs_scan): New function.
4902 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4903 (Sized_relobj::incremental_relocs_write): New function.
4904 (Sized_relobj::incremental_relocs_write_reltype): New function.
4905 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4906 incremental link.
4907 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4908 archives and object files elsewhere.
4909 (Add_symbols::run): Report object files here.
4910 (Finish_group::run): Report end of archive at end of group.
4911 * reloc.cc: Include layout.h, incremental.h.
4912 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4913 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4914 (Sized_relobj::incremental_relocs_scan): New function.
4915 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4916 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4917 (Sized_relobj::incremental_relocs_write): New function.
4918 (Sized_relobj::incremental_relocs_write_reltype): New function.
4919 * script.cc (read_input_script): Rewrite test for incremental link.
4920 Change call to Incremental_inputs::report_script.
4921 * symtab.h (Symbol_table::first_global_index): New function.
4922 (Symbol_table::output_count): New function.
4923
4924 2010-08-12 Doug Kwan <dougkwan@google.com>
4925
4926 * arm.cc (Target_arm::merge_object_attributes): Check command line
4927 options --no-wchar-size-warning and --no-enum-size-warning.
4928 * options.h (General_options): Add ld-compatible options
4929 --no-enum-size-warning and --no-wchar-size-warning.
4930
4931 2010-08-04 Ian Lance Taylor <iant@google.com>
4932
4933 * x86_64.cc (Target_x86_64::Scan::local): Use
4934 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4935 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4936 (Target_x86_64::Scan::global): Likewise.
4937 (Target_x86_64::Relocate::relocate): Likewise.
4938 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4939 Likewise.
4940
4941 2010-08-03 Cary Coutant <ccoutant@google.com>
4942
4943 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4944 to reserve space in merged_strings vector. Keep total input size
4945 for stats.
4946 (Output_merge_string::do_print_merge_stats): Print total input size.
4947 * merge.h (Output_merge_string): Add input_size_ field.
4948 * stringpool.cc (Stringpool_template::string_length): Move
4949 implementations out of Stringpool_template class and place in
4950 stringpool.h.
4951 * stringpool.h (string_length): Move out of Stringpool_template.
4952
4953 2010-08-03 Ian Lance Taylor <iant@google.com>
4954
4955 PR 11712
4956 * layout.cc (relaxation_loop_body): If address of load segment is
4957 set, adjust address to include headers if possible.
4958
4959 2010-08-03 Ian Lance Taylor <iant@google.com>
4960
4961 * version.cc (version_string): Bump to 1.10.
4962
4963 2010-08-03 Ian Lance Taylor <iant@google.com>
4964
4965 PR 11805
4966 * layout.h (enum Output_section_order): Define.
4967 (class Layout): Update declarations.
4968 * layout.cc (Layout::get_output_section): Add order parameter.
4969 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4970 is_first_non_relro parameters. Change all callers.
4971 (Layout::choose_output_section): Likewise.
4972 (Layout::add_output_section_data): Likewise.
4973 (Layout::make_output_section): Likewise. Set order.
4974 (Layout::default_section_order): New function.
4975 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4976 * output.cc (Output_section::Output_section): Initialize order_.
4977 Don't initialize deleted fields.
4978 (Output_segment::Output_segment): Don't initialize deleted
4979 fields.
4980 (Output_segment::add_output_section_to_load): New function
4981 replacing add_output_section. Change all callers to call this or
4982 add_output_section_to_nonload.
4983 (Output_segment::add_output_section_to_nonload): New function.
4984 (Output_segment::remove_output_section): Rewrite.
4985 (Output_segment::add_initial_output_data): Likewise.
4986 (Output_segment::has_any_data_sections): Likewise.
4987 (Output_segment::is_first_section_relro): Likewise.
4988 (Output_segment::maximum_alignment): Likewise.
4989 (Output_segment::has_dynamic_reloc): New function replacing
4990 dynamic_reloc_count. Change all callers.
4991 (Output_segment::has_dynamic_reloc_list): New function replacing
4992 dynamic_reloc_count_list. Change all callers.
4993 (Output_segment::set_section_addresses): Rewrite.
4994 (Output_segment::set_offset): Rewrite.
4995 (Output_segment::find_first_and_last_list): Remove.
4996 (Output_segment::set_tls_offsets): Rewrite.
4997 (Output_segment::first_section_load_address): Likewise.
4998 (Output_segment::output_section_count): Likewise.
4999 (Output_segment::section_with_lowest_load_address): Likewise.
5000 (Output_segment::write_section_headers): Likewise.
5001 (Output_segment::print_sections_to_map): Likewise.
5002 * output.h (class Output_data): Remove dynamic_reloc_count_
5003 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5004 (Output_data::add_dynamic_reloc): Rewrite.
5005 (Output_data::has_dynamic_reloc): New function.
5006 (Output_data::dynamic_reloc_count): Remove.
5007 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5008 is_last_relro_, is_first_non_relro_, is_interp_,
5009 is_dynamic_linker_section_ fields. Add order and set_order
5010 functions. Remove is_relro_local, set_is_relro_local,
5011 is_last_relro, set_is_last_relro, is_first_non_relro,
5012 set_is_first_non_relro functions, is_interp, set_is_interp,
5013 is_dynamic_linker_section, and set_is_dynamic_linker_section
5014 functions.
5015 (class Output_segment): Change Output_data_list from std::list to
5016 std:;vector. Add output_lists_ field. Remove output_data_ and
5017 output_bss_ fields. Update declarations.
5018
5019 2010-08-02 Ian Lance Taylor <iant@google.com>
5020
5021 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5022 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5023 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5024
5025 2010-08-02 Ian Lance Taylor <iant@google.com>
5026
5027 PR 11855
5028 * script.cc (Script_options::Script_options): Initialize
5029 symbol_definitions_ and symbol_references_.
5030 (Script_options::add_symbol_assignment): Update
5031 symbol_definitions_ and symbol_references_.
5032 (Script_options::add_symbol_reference): New function.
5033 (script_symbol): New function.
5034 * script.h (class Script_options): Add symbol_definitions_ and
5035 symbol_references_ fields.
5036 (Script_options::referenced_const_iterator): New type.
5037 (Script_options::referenced_begin): New function.
5038 (Script_options::referenced_end): New function.
5039 (Script_options::is_referenced): New function.
5040 (Script_options::any_unreferenced): New function.
5041 * script-c.h (script_symbol): Declare.
5042 * yyscript.y (exp): Call script_symbol.
5043 * symtab.cc: Include "script.h".
5044 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5045 Change all callers. Check symbols referenced by scripts.
5046 (Symbol_table::add_undefined_symbols_from_command_line): Add
5047 layout parameter. Change all callers.
5048 (Symbol_table::do_add_undefined_symbols_from_command_line):
5049 Likewise. Break out loop body. Check symbols referenced by
5050 scripts.
5051 (Symbol_table::add_undefined_symbol_from_command_line): New
5052 function broken out of
5053 do_add_undefined_symbols_from_command_line.
5054 * symtab.h (class Symbol_table): Update declarations.
5055 * archive.cc: Include "layout.h".
5056 (Archive::should_include_member): Add layout parameter. Change
5057 all callers. Check for symbol mentioned in expression.
5058 * archive.h (class Archive): Update declaration.
5059 * object.cc (Sized_relobj::do_should_include_member): Add layout
5060 parameter.
5061 * object.h (Object::should_include_member): Add layout parameter.
5062 Change all callers.
5063 (Object::do_should_include_member): Add layout parameter.
5064 (class Sized_relobj): Update declaration.
5065 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5066 parameter.
5067 * dynobj.h (class Sized_dynobj): Update declaration.
5068 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5069 layout parameter.
5070 * plugin.h (class Sized_pluginobj): Update declaration.
5071
5072 2010-08-02 Ian Lance Taylor <iant@google.com>
5073
5074 PR 11866
5075 * output.cc (Output_segment::set_offset): Search for the first and
5076 last sections rather than assuming that the list is in order.
5077 (Output_segment::find_first_and_last_list): New function.
5078 * output.h (class Output_segment): Update declarations.
5079 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5080 (relro_strip_test_SOURCES): New variable.
5081 (relro_strip_test_DEPENDENCIES): New variable.
5082 (relro_strip_test_LDFLAGS): New variable.
5083 (relro_strip_test_LDADD): New variable.
5084 (relro_strip_test.so): New target.
5085
5086 2010-08-02 Ian Lance Taylor <iant@google.com>
5087
5088 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5089 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5090 (Target_i386::got_tlsdesc_section): New function.
5091 (Target_i386::got_section): Create space for GOT entries for
5092 TLSDESC relocations.
5093 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5094 R_386_TLS_GOTDESC.
5095 (Target_i386::Scan::global): Likewise.
5096 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5097 using TLSDESC GOT.
5098 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5099 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5100 (Target_x86_64::got_tlsdesc_section): New function.
5101 (Target_x86_64::got_section): Create space for GOT entries for
5102 TLSDESC relocations.
5103 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5104 R_386_TLS_GOTDESC.
5105 (Target_x86_64::Scan::global): Likewise.
5106 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5107 using TLSDESC GOT.
5108
5109 2010-08-02 Ian Lance Taylor <iant@google.com>
5110
5111 * testsuite/final_layout.sh: Use dc to convert from hex to
5112 decimal.
5113
5114 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5115
5116 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5117 paramter to the call to gold::gc_process_relocs.
5118 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5119 paramter to the call to gold::gc_process_relocs.
5120 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5121 parameter to the call to gold::gc_process_relocs.
5122 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5123 template parameter to the call to gold::gc_process_relocs.
5124 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5125 paramter to the call to gold::gc_process_relocs.
5126 * gc.h (get_embedded_addend_size): New function.
5127 (gc_process_relocs): Save the size of the reloc for use by ICF.
5128 * icf.cc (get_section_contents): Get the addend from the text section
5129 for SHT_REL relocation sections.
5130 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5131 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5132 * int_encoding.h (read_from_pointer): New overloaded function.
5133 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5134 * testsuite/icf_sht_rel_addend_test.sh: New file.
5135 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5136 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5137
5138 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5139
5140 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5141 * Makefile.in: Regenerate.
5142 * testsuite/Makefile.in: Regenerate.
5143
5144 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5145
5146 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5147 * gold/testsuite/debug_msg.cc: Likewise.
5148 * gold/testsuite/odr_violation1.cc
5149 * gold/testsuite/odr_violation2.cc
5150
5151 2010-07-21 Cary Coutant <ccoutant@google.com>
5152
5153 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5154 string, and length fields.
5155 (Output_merge_string::Merged_strings_list): New type.
5156 (Output_merge_string::Merged_strings_lists): New typedef.
5157 (Output_merge_string): Replace merged_strings_ with
5158 merged_strings_lists_.
5159 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5160 Merged_strings_list per input object and section. Don't store pointer
5161 to the string. Don't store length with each merged string entry.
5162 (Output_merge_string::finalize_merged_data): Loop over list of merged
5163 strings lists. Recompute length of each merged string.
5164
5165 2010-07-15 Cary Coutant <ccoutant@google.com>
5166
5167 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5168 here.
5169
5170 2010-07-14 Ian Lance Taylor <iant@google.com>
5171
5172 * descriptors.cc (Descriptors::open): Report correct name in error
5173 message.
5174
5175 2010-07-13 Doug Kwan <dougkwan@google.com>
5176
5177 * arm.cc (Arm_input_section::Arm_input_section): For a
5178 SHT_ARM_EXIDX section, always keeps the input sections.
5179 (Arm_input_section::set_exidx_section_link): New method.
5180 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5181 has_errors_ to false.
5182 (Arm_exidx_input_section::has_errors,
5183 Arm_exidx_input_section::set_has_errors): New methods.
5184 (Arm_exidx_input_section::has_errors_): New data member.
5185 (Arm_relobj::get_exidx_shndx_list): New method.
5186 (Arm_output_section::append_text_sections_to_list): Do not skip
5187 section without SHF_EXECINSTR.
5188 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5189 errors.
5190 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5191 section header. Make error messages more verbose. Check for
5192 a non-executable section linked to an EXIDX section.
5193 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5194 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5195 check that there is no deferred EXIDX section if we exit early.
5196 Instead of not making an EXIDX section in case of an error, make one
5197 and set the has_errors flag of it.
5198 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5199 in a relocatable link.
5200 (Target_arm::do_relax): Look for the EXIDX output section instead of
5201 assuming that it is called .ARM.exidx.
5202 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5203 section list. Do not check for SHF_EXECINSTR section flags but
5204 skip any input section with errors.
5205 * output.cc (Output_section::Output_section): Initialize
5206 always_keeps_input_sections_ to false.
5207 (Output_section::add_input_section): Check for
5208 always_keeps_input_sections_.
5209 * output.h (Output_section::always_keeps_input_sections,
5210 Output_section::set_always_keeps_input_sections): New methods.
5211 (Output_section::always_keeps_input_sections): New data member.
5212
5213 2010-07-13 Rafael Espindola <espindola@google.com>
5214
5215 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5216 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5217
5218 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5219 Ian Lance Taylor <iant@google.com>
5220
5221 * output.h (Output_section_lookup_maps::add_merge_section):
5222 Correct check of whether value was inserted.
5223 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5224 (Output_section_lookup_maps::add_relaxed_input_section):
5225 Likewise.
5226 * arm.cc (Target_arm::got_section): Remove used local os.
5227 * i386.cc (Target_i386::got_section): Likewise.
5228 * x86_64.cc (Target_x86_64::got_section): Likewise.
5229 * sparc.cc (Target_sparc::got_section): Likewise.
5230 (Target_sparc::relocate): Remove unused local have_got_offset.
5231 * powerpc.cc (Target_powerpc::relocate): Likewise.
5232
5233 2010-07-13 Ian Lance Taylor <iant@google.com>
5234
5235 * compressed_output.cc (zlib_decompress): Fix signature in
5236 !HAVE_ZLIB_H case.
5237
5238 * archive.cc (Archive::include_member): Unlock an external member
5239 of a thin archive. Don't bother to delete an object we know is
5240 NULL.
5241
5242 2010-07-12 Cary Coutant <ccoutant@google.com>
5243
5244 * compressed_output.cc (zlib_decompress): New function.
5245 (get_uncompressed_size): New function.
5246 (decompress_input_section): New function.
5247 * compressed_output.h (get_uncompressed_size): New function.
5248 (decompress_input_section): New function.
5249 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5250 Handle compressed debug sections.
5251 * layout.cc (is_compressed_debug_section): New function.
5252 (Layout::output_section_name): Map compressed section names to
5253 canonical names.
5254 * layout.h (is_compressed_debug_section): New function.
5255 (is_debug_info_section): Recognize compressed debug sections.
5256 * merge.cc: Include compressed_output.h.
5257 (Output_merge_data::do_add_input_section): Handle compressed
5258 debug sections.
5259 (Output_merge_string::do_add_input_section): Handle compressed
5260 debug sections.
5261 * object.cc: Include compressed_output.h.
5262 (Sized_relobj::Sized_relobj): Initialize new data members.
5263 (build_compressed_section_map): New function.
5264 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5265 * object.h (Object::section_is_compressed): New method.
5266 (Object::do_section_is_compressed): New method.
5267 (Sized_relobj::Compressed_section_map): New type.
5268 (Sized_relobj::do_section_is_compressed): New method.
5269 (Sized_relobj::compressed_sections_): New data member.
5270 * output.cc (Output_section::add_input_section): Handle compressed
5271 debug sections.
5272 * reloc.cc: Include compressed_output.h.
5273 (Sized_relobj::write_sections): Handle compressed debug sections.
5274
5275 2010-07-08 Cary Coutant <ccoutant@google.com>
5276
5277 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5278 weak when resolving to a dynamic def.
5279 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5280 for weak undef/dynamic def cases. Adjust callers.
5281 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5282 undef_binding_weak_.
5283 (Symbol_table::sized_write_globals): Adjust symbol binding.
5284 (Symbol_table::sized_write_symbol): Add binding parameter.
5285 * symtab.h (Symbol::set_undef_binding): New method.
5286 (Symbol::is_undef_binding_weak): New method.
5287 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5288 (Symbol_table::should_override): Add new parameter.
5289 (Symbol_table::sized_write_symbol): Add new parameter.
5290
5291 * testsuite/weak_undef_file1.cc: Add new test case.
5292 * testsuite/weak_undef_file2.cc: Fix header comment.
5293 * testsuite/weak_undef_test.cc: Add new test case.
5294
5295 2010-06-29 Doug Kwan <dougkwan@google.com>
5296
5297 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5298 Initialize USE_SYMBOL_.
5299 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5300 definition.
5301 (Arm_reloc_property::uses_symbol_): New data member declaration.
5302 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5303 uses symbol value and symbol is undefined but not weakly undefined.
5304
5305 2010-06-28 Rafael Espindola <espindola@google.com>
5306
5307 * plugin.cc (Plugin::load): Use dlerror.
5308
5309 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5310
5311 * symtab.cc (detect_odr_violations): When reporting an ODR
5312 violation, report an object where the symbol is defined.
5313
5314 2010-06-25 Doug Kwan <dougkwan@google.com>
5315
5316 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5317 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5318 definition.
5319 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5320 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5321 target hook to detect function points.
5322 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5323 * icf.h (Icf::check_section_for_function_pointers): Change type of
5324 parameter SECTION_NAME to const reference to std::string. Use
5325 target hook to determine if section may have unsafe pointers.
5326 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5327 method definition.
5328
5329 2010-06-21 Rafael Espindola <espindola@google.com>
5330
5331 * fileread.cc (Input_file::find_fie): New
5332 (Input_file::open): Use Input_file::find_fie.
5333 * fileread.h (Input_file::find_fie): New
5334 * plugin.cc (set_extra_library_path): New.
5335 (Plugin::load): Add set_extra_library_path to the transfer vector.
5336 (Plugin_manager::set_extra_library_path): New.
5337 (Plugin_manager::add_input_file): Use the extra search path if set.
5338 (set_extra_library_path(): New.
5339 * plugin.h (Plugin_manager): Add set_extra_library_path and
5340 extra_search_path_.
5341
5342 2010-06-19 Cary Coutant <ccoutant@google.com>
5343
5344 * layout.cc (gdb_sections): Add .debug_types.
5345 (lines_only_debug_sections): Likewise.
5346
5347 2010-06-18 Rafael Espindola <espindola@google.com>
5348
5349 * plugin.cc (add_input_file,add_input_library)
5350 (Plugin_manager::add_input_file): Make filename arguments const.
5351 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5352 const.
5353
5354 2010-06-16 Doug Kwan <dougkwan@google.com>
5355
5356 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5357 .ARM.attributes section if we have not merged any input
5358 attributes sections.
5359
5360 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5361
5362 * arm.cc: Allow combining objects with no EABI version
5363 information.
5364
5365 2010-06-15 Rafael Espindola <espindola@google.com>
5366
5367 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5368
5369 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5370
5371 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5372 (struct iovec): Correct !HAVE_READV definition.
5373
5374 2010-06-10 Cary Coutant <ccoutant@google.com>
5375
5376 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5377 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5378 reloc sections.
5379 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5380
5381 PR 11683
5382 * symtab.h (Symbol::is_placeholder): New member function.
5383 * target-reloc.h (relocate_section): Check for placeholder symbols.
5384
5385 * testsuite/Makefile.am (plugin_test_8): New test.
5386 (plugin_test_9): New test.
5387 * testsuite/Makefile.in: Regenerate.
5388
5389 2010-06-09 Nick Clifton <nickc@redhat.com>
5390
5391 * yyscript.y (input_list_element): Allow strings prefixed with
5392 the '-' character. Treat these as libraries.
5393 * script.cc (script_add_library): New function. Adds a library
5394 specified by "-l<name>" found in an input script.
5395 * script-c.h: Add prototype for script_add_library.
5396
5397 2010-06-07 Doug Kwan <dougkwan@google.com>
5398
5399 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5400 Restrict stub-group size to be within long conditional branch
5401 range when working around cortex-A8 erratum.
5402
5403 2010-06-07 Damien Diederen <dd@crosstwine.com>
5404
5405 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5406 #ifdef typo.
5407
5408 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5409
5410 PR gold/11658
5411 * output.cc
5412 (Output_section::Input_section_sort_entry::compare_section_ordering):
5413 Change to return non-zero correctly.
5414 (Output_section::Input_section_sort_section_order_index_compare
5415 ::operator()): Change to fix ambiguity in comparisons.
5416
5417 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5418
5419 * gold.h (is_wildcard_string): New function.
5420 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5421 (Layout::layout_eh_frame): Ditto.
5422 (Layout::find_section_order_index): New method.
5423 (Layout::read_layout_from_file): New method.
5424 * layout.h (Layout::find_section_order_index): New method.
5425 (Layout::read_layout_from_file): New method.
5426 (Layout::input_section_position_): New private member.
5427 (Layout::input_section_glob_): New private member.
5428 * main.cc (main): Call read_layout_from_file here.
5429 * options.h (--section-ordering-file): New option.
5430 * output.cc (Output_section::input_section_order_specified_): New
5431 member.
5432 (Output_section::Output_section): Initialize new member.
5433 (Output_section::add_input_section): Add new parameter.
5434 Keep input sections when --section-ordering-file is used.
5435 (Output_section::set_final_data_size): Sort input sections when
5436 section ordering file is specified.
5437 (Output_section::Input_section_sort_entry): Add new parameter.
5438 Check sorting type.
5439 (Output_section::Input_section_sort_entry::compare_section_ordering):
5440 New method.
5441 (Output_section::Input_section_sort_compare::operator()): Change to
5442 consider section_order_index.
5443 (Output_section::Input_section_sort_init_fini_compare::operator()):
5444 Change to consider section_order_index.
5445 (Output_section::Input_section_sort_section_order_index_compare
5446 ::operator()): New method.
5447 (Output_section::sort_attached_input_sections): Change to sort
5448 according to section order when specified.
5449 (Output_section::add_input_section<32, true>): Add new parameter.
5450 (Output_section::add_input_section<64, true>): Add new parameter.
5451 (Output_section::add_input_section<32, false>): Add new parameter.
5452 (Output_section::add_input_section<64, false>): Add new parameter.
5453 * output.h (Output_section::add_input_section): Add new parameter.
5454 (Output_section::input_section_order_specified): New
5455 method.
5456 (Output_section::set_input_section_order_specified): New method.
5457 (Input_section::Input_section): Initialize section_order_index_.
5458 (Input_section::section_order_index): New method.
5459 (Input_section::set_section_order_index): New method.
5460 (Input_section::section_order_index_): New member.
5461 (Input_section::Input_section_sort_section_order_index_compare): New
5462 struct.
5463 (Output_section::input_section_order_specified_): New member.
5464 * script-sections.cc (is_wildcard_string): Delete and move modified
5465 method to gold.h.
5466 (Output_section_element_input::Output_section_element_input): Modify
5467 call to is_wildcard_string.
5468 (Output_section_element_input::Input_section_pattern
5469 ::Input_section_pattern): Ditto.
5470 (Output_section_element_input::Output_section_element_input): Ditto.
5471 * testsuite/Makefile.am (final_layout): New test case.
5472 * testsuite/Makefile.in: Regenerate.
5473 * testsuite/final_layout.cc: New file.
5474 * testsuite/final_layout.sh: New file.
5475
5476 2010-06-01 Rafael Espindola <espindola@google.com>
5477
5478 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5479
5480 2010-06-01 Rafael Espindola <espindola@google.com>
5481
5482 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5483 visibility of symbols.
5484
5485 2010-05-27 Doug Kwan <dougkwan@google.com>
5486
5487 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5488 from start of output section instead of address for a local symbol
5489 in a merged or relaxed section when doing a relocatable link.
5490
5491 2010-05-26 Rafael Espindola <espindola@google.com>
5492
5493 PR 11604
5494 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5495 adding sections the garbage collector removed.
5496 * gold/testsuite/Makefile.am: Add test.
5497 * gold/testsuite/Makefile.in: Regenerate.
5498 * gold/testsuite/plugin_test_7.sh: New.
5499 * gold/testsuite/plugin_test_7_1.c: New.
5500 * gold/testsuite/plugin_test_7_2.c: New.
5501
5502 2010-05-26 Rafael Espindola <espindola@google.com>
5503
5504 * script-sections.cc (Output_section_definition::set_section_addresses):
5505 Check for --section-start.
5506
5507 2010-05-26 Doug Kwan <dougkwan@google.com>
5508
5509 * arm.cc (Arm_scan_relocatable_relocs): New class.
5510 (Target_arm::relocate_special_relocatable): New method.
5511 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5512 (Arm_relocate_functions::thumb_branch_common): Same.
5513 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5514 instead of Default_scan_relocatable_relocs.
5515 * target-reloc.h (relocate_for_relocatable): Let target handle
5516 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5517 * target.h (Sized_target::relocate_special_relocatable): New method.
5518
5519 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5520
5521 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5522
5523 2010-05-23 Doug Kwan <dougkwan@google.com>
5524
5525 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5526 instead of a cast.
5527 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5528 with a direct branch, not a conditional branch, to a stub.
5529 * merge.cc (Output_merge_base::record_input_section): New method
5530 defintion.
5531 (Output_merge_data::do_add_input_section): Record input section if
5532 keeps-input-sections flag is set.
5533 (Output_merge_string::do_add_input_section): Ditto.
5534 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5535 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5536 INPUT_SECTIONS_.
5537 (Output_merge_base::keeps_input_sections,
5538 Output_merge_base::set_keeps_input_sections,
5539 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5540 method definitions.
5541 (Output_merge_base::Input_sections): New type declaration.
5542 (Output_merge_base::input_sections_begin,
5543 Output_merge_base::input_sections_end,
5544 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5545 (Output_merge_base::bool keeps_input_sections_,
5546 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5547 Output_merge_base::input_sections_): New data members.
5548 (Output_merge_data::do_set_keeps_input_sections): New method
5549 defintion.
5550 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5551 * output.cc (Output_section::Input_section::relobj): Move method
5552 defintion from class declaration to here and handle merge sections.
5553 (Output_section::Input_section::shndx): Ditto.
5554 (Output_section::Output_section): Remove initializations of removed
5555 data members and initialize new data member LOOKUP_MAPS_.
5556 (Output_section::add_input_section): Set keeps-input-sections flag
5557 for a newly created merge output section as appropriate. Adjust code
5558 to use Output_section_lookup_maps class.
5559 (Output_section::add_relaxed_input_section): Adjst code for lookup
5560 maps code refactoring.
5561 (Output_section::add_merge_input_section): Add a new parameter
5562 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5563 class. If adding input section to a newly created merge output
5564 section fails, remove the new merge section.
5565 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5566 Adjust code for use of the Output_section_lookup_maps class.
5567 (Output_section::find_merge_section): Ditto.
5568 (Output_section::build_lookup_maps): New method defintion.
5569 (Output_section::find_relaxed_input_section): Adjust code to use
5570 Output_section_lookup_maps class.
5571 (Output_section::get_input_sections): Export merge sections. Adjust
5572 code to use Output_section_lookup_maps class.
5573 (Output_section:::add_script_input_section): Adjust code to use
5574 Output_section_lookup_maps class. Update lookup maps for merge
5575 sections also.
5576 (Output_section::discard_states): Use Output_section_lookup_maps.
5577 (Output_section::restore_states): Same.
5578 * output.h (Merge_section_properties): Move class defintion out of
5579 Output_section.
5580 (Output_section_lookup_maps): New class.
5581 (Output_section::Input_section::is_merge_section): New method
5582 defintion.
5583 (Output_section::Input_section::relobj): Move defintion out of class
5584 defintion. Declare method only.
5585 (Output_section::Input_section::shndx): Ditto.
5586 (Output_section::Input_section::output_merge_base): New method defintion.
5587 (Output_section::Input_section::u2_.pomb): New union field.
5588 (Output_section::Merge_section_by_properties_map,
5589 Output_section::Output_section_data_by_input_section_map,
5590 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5591 Remove types.
5592 (Output_section::add_merge_input_section): Add new parameter
5593 KEEPS_INPUT_SECTIONS.
5594 (Output_section::build_lookup_maps): New method declaration.
5595 (Output_section::merge_section_map_,
5596 Output_section::merge_section_by_properties_map_,
5597 Output_section::relaxed_input_section_map_,
5598 Output_section::is_relaxed_input_section_map_valid_): Remove data
5599 members.
5600 (Output_section::lookup_maps_): New data member.
5601
5602 2010-05-21 Doug Kwan <dougkwan@google.com>
5603
5604 PR gold/11619
5605 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5606 avoid a compilation error.
5607
5608 2010-05-19 Rafael Espindola <espindola@google.com>
5609
5610 * script-sections.cc (Output_section_definition::allocate_to_segment):
5611 Update the phdrs_list even when the output section is NULL.
5612 * testsuite/Makefile.am: Add test.
5613 * testsuite/Makefile.in: Regenerate.
5614 * testsuite/script_test_9.cc: New.
5615 * testsuite/script_test_9.sh: New.
5616 * testsuite/script_test_9.t: New.
5617
5618 2010-05-19 Doug Kwan <dougkwan@google.com>
5619
5620 * arm.cc (Arm_input_section::original_size): New method.
5621 (Arm_input_section::do_addralign): Add a cast.
5622 (Arm_input_section::do_output_offset): Remove static cast.
5623 (Arm_input_section::original_addralign,
5624 Arm_input_section::original_size_): Change type to uint32_t.
5625 (Arm_input_section::init): Add safe casts for section alignment
5626 and size.
5627 (Arm_input_section::set_final_data_size): Do not set address and
5628 offset of stub table.
5629 (Arm_output_section::fix_exidx_coverage): Change use of of
5630 Output_section::Simple_input_section to that of
5631 Output_section::Input_section.
5632 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5633 except for the first pass.
5634 * output.cc (Output_section::get_input_sections): Change type of
5635 input_sections to std::list<Input_section>.
5636 (Output_section::add_script_input_section): Rename from
5637 Output_section::add_simple_input_section. Change type of SIS
5638 parameter from Simple_input_section to Input_section.
5639 * output.h (Output_section::Simple_input_section): Remove class.
5640 (Output_section::Input_section): Change class visibility to public.
5641 (Output_section::Input_section::addralign): Use stored alignments
5642 for special input sections if set.
5643 (Output_section::Input_section::set_addralign): New method.
5644 (Output_section::get_input_sections): Change parameter type from
5645 list of Simple_input_section to list of Input_section.
5646 (Output_section::add_script_input_section): Rename from
5647 Output_section::add_simple_input_section. Change first parameter's
5648 type from Simple_input_section to Input_section and remove the
5649 second and third parameters.
5650 * script-sections.cc (Input_section::Input_section_list): Change
5651 type to list of Output_section::Input_section/
5652 (Input_section_info::Input_section_info): Change parameter type of
5653 INPUT_SECTION to Output_section::Input_section.
5654 (Input_section_info::input_section): Change return type.
5655 (Input_section_info::input_section_): Change type to
5656 Output_section::Input_section.
5657 (Output_section_element_input::set_section_addresses): Adjust code
5658 to use Output_section::Input_section instead of
5659 Output_section::Simple_input_section. Adjust code for renaming
5660 of Output_section::add_simple_input_section.
5661 (Orphan_output_section::set_section_addresses): Ditto.
5662
5663 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5664
5665 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5666 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5667
5668 2010-05-18 Rafael Espindola <espindola@google.com>
5669
5670 * options.cc (General_options::finalize): Handle -nostdlib.
5671 * options.h (nostdlib): New option.
5672 * script.cc (script_add_search_dir): Handle -nostdlib.
5673
5674 2010-05-12 Doug Kwan <dougkwan@google.com>
5675
5676 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5677 attributes section only if there no attributes section after merging.
5678 (Target_arm::merge_object_attributes): Move value of
5679 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5680 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5681 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5682 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5683 and arm_attr_merge_7.stdout.
5684 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5685 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5686 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5687 arm_attr_merge_7b.o): New rules.
5688 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5689 arm_attr_merge_7
5690 * testsuite/Makefile.in: Regenerate.
5691 * testsuite/arm_attr_merge.sh: New file.
5692 * testsuite/arm_attr_merge_[67][ab].s: Same.
5693
5694 2010-05-05 Nick Clifton <nickc@redhat.com>
5695
5696 * po/es.po: Updated Spanish translation.
5697
5698 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5699
5700 * Makefile.am (install-exec-local): Properly install gold as
5701 default cross linker.
5702 * Makefile.in: Regenerated.
5703
5704 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5705 Nick Clifton <nickc@redhat.com>
5706
5707 * configure.ac (install_as_default): Define and set to false
5708 unless --enable-gold or --enable-gold=both/gold has been
5709 specified.
5710 * configure: Regenerate.
5711
5712 * Makefile.am (install-exec-local): Install the executable as
5713 'ld.gold'. If install_as_default is true then also install it as
5714 'ld'.
5715 * Makefile.in: Regenerated.
5716
5717 2010-04-24 Ian Lance Taylor <iant@google.com>
5718
5719 * layout.cc (Layout::layout_reloc): In relocatable link don't
5720 combine reloc sections for grouped sections.
5721
5722 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5723
5724 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5725 sections that are not ordinary to icf.
5726 * icf.cc (get_section_contents): Handle relocation pointing to section
5727 with no object or shndx information.
5728 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5729 * testsuite/Makefile.in: Regenerate.
5730 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5731 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5732
5733 2010-04-22 Ian Lance Taylor <iant@google.com>
5734
5735 * expression.cc (Expression::Expression_eval_info): Add
5736 result_alignment_pointer field.
5737 (Expression::eval_with_dot): Add result_alignment_pointer
5738 parameter. Change all callers.
5739 (Expression::eval_maybe_dot): Likewise.
5740 (class Binary_expression): Add alignment_pointer parameter to
5741 left_value and right_value. Change all callers.
5742 (BINARY_EXPRESSION): Set result alignment.
5743 (class Trinary_expression): Add alignment_pointer parameter to
5744 arg2_value and arg3_value. Change all callers.
5745 (Trinary_cond::value): Set result alignment.
5746 (Max_expression::value, Min_expression::value): Likewise.
5747 (Align_expression::value): Likewise.
5748 * script-sections.cc (class Sections_element): Add dot_alignment
5749 parameter to set_section_addresses virtual function. Update
5750 instantiations.
5751 (class Output_section_element): Likewise.
5752 (Script_sections::create_segments): Add dot_alignment parameter.
5753 Change all callers.
5754 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5755 (Script_sections::set_phdrs_clause_addresses): Likewise.
5756 * script-sections.h: Update declarations.
5757 * script.h: Update declarations.
5758 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5759 min_p_align.
5760 * testsuite/script_test_3.t: Set large alignment.
5761 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5762 segment has expected alignment.
5763
5764 2010-04-22 Nick Clifton <nickc@redhat.com>
5765
5766 * po/gold.pot: Updated by the Translation project.
5767 * po/vi.po: Updated Vietnamese translation.
5768
5769 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5770
5771 * testsuite/Makefile.am (check_PROGRAMS): Add
5772 icf_virtual_function_folding_test.
5773 * testsuite/Makefile.in: Regenerated.
5774
5775 2010-04-15 Andrew Haley <aph@redhat.com>
5776
5777 * options.h (merge_exidx_entries): New option.
5778 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5779 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5780 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5781 (Target_arm::merge_exidx_entries): New function.
5782 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5783 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5784 to Arm_exidx_fixup constructor.
5785 Add new arg, merge_exidx_entries.
5786 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5787 Arm_output_section::fix_exidx_coverage.
5788
5789 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5790
5791 * icf.cc (get_section_contents): Check for preemptible functions.
5792 Ignore addend when appropriate.
5793 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5794 section folded.
5795 (add_from_relobj): Check for section folded.
5796 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5797 * symtab.h (should_add_dynsym_entry): Add new parameter.
5798 * target-reloc.h (scan_relocs): Check for section folded.
5799 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5800 Check reloc types for function pointers in shared objects.
5801 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5802 case.
5803 (icf_preemptible_functions_test): New test case.
5804 (icf_string_merge_test): New test case.
5805 * testsuite.Makefile.in: Regenerate.
5806 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5807 bar_glob. Refactor code.
5808 * testsuite/icf_preemptible_functions_test.cc: New file.
5809 * testsuite/icf_preemptible_functions_test.sh: New file.
5810 * testsuite/icf_string_merge_test.cc: New file.
5811 * testsuite/icf_string_merge_test.sh: New file.
5812 * testsuite/icf_virtual_function_folding_test.cc: New file.
5813 * testsuite/icf_virtual_function_folding_test.sh: New file.
5814
5815 2010-04-14 Doug Kwan <dougkwan@google.com>
5816
5817 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5818 for local symbol recounting if we remove a section due to ICF.
5819 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5820 there are no regular objects in input.
5821
5822 2010-04-13 Doug Kwan <dougkwan@google.com>
5823
5824 * arm.cc (Arm_input_section::set_final_data_size): Compute
5825 accurate final data size instead of using current data size.
5826
5827 2010-04-09 Doug Kwan <dougkwan@google.com>
5828
5829 * layout.cc (Layout::choose_output_section): Handle script section
5830 types.
5831 (Layout::make_output_section_for_script): Add section type parameter.
5832 Handle script section types.
5833 * layout.h (Layout::make_output_section_for_script): Add section
5834 type parameter.
5835 * output.cc (Output_section::Output_section): Initialize data member
5836 is_noload_.
5837 (Output_section::do_reset_address_and_file_offset): Do not set address
5838 to 0 if section is a NOLOAD section.
5839 * output.h (Output_section::is_noload): New method.
5840 (Output_section::set_is_noload): Ditto.
5841 (Output_section::is_noload_): New data member.
5842 * script-c.h (Script_section_type): New enum type.
5843 (struct Parser_output_section_header): Add new file section_type.
5844 * script-sections.cc (Sections_element::output_section_name): Add
5845 parameter for returning script section type.
5846 (Output_section_definition::output_section_name): Ditto.
5847 (Output_section_definition::section_type)P; New method.
5848 (Output_section_definiton::script_section_type_name): Ditto.
5849 (Output_section_definition::script_section_type_): New data member.
5850 (Output_section_definition::Output_section_definition): Initialize
5851 data member Output_section_definition::script_section_type_.
5852 (Output_section_definition::create_sections): Pass script section type
5853 to Layout::make_output_section_for_script.
5854 (Output_section_definition::output_section_name): Return script
5855 section type to caller.
5856 (Output_section_definition::set_section_address): Do not advance
5857 dot value and load address if section type is NOLOAD. Set address
5858 of NOLOAD sections regardless of section flags.
5859 (Output_section_definition::print): Print section type if it is
5860 not SCRIPT_SECTION_TYPE_NONE.
5861 (Output_section_definition::section_type): New method.
5862 (Output_section_definition::script_section_type_name): Ditto.
5863 (Script_sections::output_section_name): Add new parameter
5864 PSECTION_TYPE for returning script section type. Pass it to
5865 section elements. Handle discard sections.
5866 (Sort_output_sections::operator()): Handle NOLOAD sections.
5867 * script-sections.h (Script_sections::Section_type): New enum type.
5868 (Script_sections::output_section_name): Add a new parameter for
5869 returning script section type.
5870 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5871 INFO and NOLOAD.
5872 * yyscript.y (union): Add new field SECTION_TYPE.
5873 (COPY, DSECT, INFO, NOLOAD): New tokens.
5874 (opt_address_and_section_type): Change type to output_section_header.
5875 (section_type): New non-terminal
5876 (section_header): Handle section type.
5877 (opt_address_and_section_type): Return section type value.
5878
5879 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5880
5881 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5882 * testsuite/plugin_common_test_2.c (foo): Likewise.
5883
5884 2010-04-08 Doug Kwan <dougkwan@google.com>
5885
5886 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5887 Output_merge_data.
5888 * output.cc (Output_section::add_merge_input_section): Simplify
5889 code and return status of Output_merge_base::add_input_section.
5890 Update merge section map only if Output_merge_base::add_input_section
5891 returns true.
5892
5893 2010-04-07 Doug Kwan <dougkwan@google.com>
5894
5895 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5896 if section is marked as containing instructions but has no mapping
5897 symbols.
5898 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5899 correct section index.
5900 (Arm_relobj::find_linked_text_section): Ditto.
5901
5902 2010-04-07 Cary Coutant <ccoutant@google.com>
5903
5904 * archive.cc (include_member): Destroy Read_symbols_data object before
5905 releasing file.
5906 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5907 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5908 (Read_symbols_data::~Read_symbols_data) New destructor.
5909 (Section_relocs::Section_relocs) New constructor.
5910 (Section_relocs::~Section_relocs) New destructor.
5911 (Read_relocs_data::Read_relocs_data) New constructor.
5912 (Read_relocs_data::~Read_relocs_data) New destructor.
5913 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5914 pointers to NULL after deleting.
5915
5916 2010-04-07 Doug Kwan <dougkwan@google.com>
5917
5918 * arm.cc: Replace "endianity" with "endianness" in comments.
5919 (Arm_exidx_cantunwind): Ditto.
5920 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5921 (Arm_relobj::merge_flags_and_attributes): New method.
5922 (Arm_relobj::merge_flags_and_attributes_): New data member.
5923 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5924 (Arm_relobj::scan_sections_for_stubs): Ditto.
5925 (Arm_relobj::do_read_symbols): Check to see if we really want to
5926 merge processor-specific flags and attributes. Exit early if
5927 an object is empty except for section names and the undefined symbol.
5928 (Target_arm::do_finalize_sections): Move check for ELF format to
5929 Arm_relobj::do_read_symbols. Merge processor specific flags and
5930 attributes from a regular object only when we have determined that
5931 it is aapropriate. Do not create an .ARM.attributes section in
5932 output if there is no regular input object.
5933 (Target_arm::merge_processor_specific_flags): Check
5934 --warn-mismatch before printing any error.
5935 (Target_arm::merge_object_attributes): Ditto.
5936 * gold.cc (queue_middle_tasks): Handle the case in which there is
5937 no regular object in input.
5938 * options.cc (General_options::parse_EB): New method.
5939 (General_options::parse_EL): Same.
5940 (General_options::General_options): Initialize endianness_.
5941 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5942 New options.
5943 (General_options::Endianness): New enum.
5944 (General_options::endianness): New method.
5945 (General_options::endianness_): New data member.
5946 * parameters.cc (Parameters::set_options): Check target endianness.
5947 (Parameters::set_target_once): Ditto.
5948 (Parameters::check_target_endianness): New method.
5949 (parameters_force_valid_target): If either -EL or -EB is specified,
5950 use it to define endianness of default target.
5951 * parameters.h (Parameters::check_target_endianness): New method
5952 declaration.
5953 * target.h (class Target): Change "endianity" to "endianness"
5954 in comments.
5955
5956 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5957
5958 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5959 * configure: Regenerate.
5960 * Makefile.in: Regenerate.
5961 * testsuite/Makefile.in: Regenerate.
5962
5963 2010-04-06 Cary Coutant <ccoutant@google.com>
5964
5965 gcc PR lto/42757
5966 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5967 prevailing definitions of common symbols.
5968 * testsuite/plugin_test_6.sh: New test case.
5969 * testsuite/plugin_common_test_1.c: New test case.
5970 * testsuite/plugin_common_test_2.c: New test case.
5971 * testsuite/Makefile.am (plugin_test_6): New test case.
5972 * testsuite/Makefile.in: Regenerate.
5973
5974 2010-04-06 Nick Clifton <nickc@redhat.com>
5975
5976 * po/vi.po: New Vietnamese translation.
5977
5978 2010-03-30 Doug Kwan <dougkwan@google.com>
5979
5980 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5981
5982 2010-03-25 Doug Kwan <dougkwan@google.com>
5983
5984 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5985 to avoid a conversion warning on a 32-bit host.
5986
5987 2010-03-24 Ian Lance Taylor <iant@google.com>
5988
5989 * testsuite/script_test_3.t: Add a TLS segment.
5990 * testsuite/Makefile.am (check_PROGRAMS): Add
5991 tls_phdrs_script_test.
5992 (tls_phdrs_script_test_SOURCES): Define.
5993 (tls_phdrs_script_test_DEPENDENCIES): Define.
5994 (tls_phdrs_script_test_LDFLAGS): Define.
5995 (tls_phdrs_script_test_LDADD): Define.
5996 * testsuite/Makefile.in: Rebuild.
5997
5998 2010-03-23 Cary Coutant <ccoutant@google.com>
5999
6000 * fileread.cc (find_or_make_view): Fix comment.
6001
6002 2010-03-23 Ian Lance Taylor <iant@google.com>
6003
6004 * script-sections.cc (class Orphan_section_placement): Define
6005 PLACE_TLS and PLACE_TLS_BSS.
6006 (Orphan_section_placement::Orphan_section_placement): Initialize
6007 new places.
6008 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6009 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6010 (tls_script_test_SOURCES): Define.
6011 (tls_script_test_DEPENDENCIES): Define.
6012 (tls_script_test_LDFLAGS): Define.
6013 (tls_script_test_LDADD): Define.
6014 * testsuite/Makefile.in: Rebuild.
6015
6016 2010-03-22 Doug Kwan <dougkwan@google.com>
6017
6018 * arm.cc (Arm_relocate_functions::abs8,
6019 Arm_relocate_functions::abs16): Use correct check for overflow
6020 specified in the ARM ELF specs.
6021 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6022 target of a BLX instruction specially.
6023 (Reloc_stub::stub_type_for_reloc): Ditto.
6024 (Relocate::relocate): Use symbolic names instead of numeric relocation
6025 codes to report error.
6026 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6027 workaround.
6028 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6029 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6030 thumb2_blx_out_of_range.stdout
6031 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6032 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6033 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6034 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6035 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6036 thumb2_blx_in_range, thumb2_blx_in_range.o,
6037 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6038 thumb2_blx_out_of_range.o): New rules.
6039 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6040 thumb2_blx_in_range and thumb2_blx_out_of_range.
6041 * testsuite/Makefile.in: Regenerate.
6042 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6043 * testsuite/thumb_blx_in_range.s: New file.
6044 * testsuite/thumb_blx_out_of_range.s: New file.
6045
6046 2010-03-22 Rafael Espindola <espindola@google.com>
6047
6048 * archive.cc (Should_include): Move to archive.h.
6049 (should_include_member): Make it a member of Archive.
6050 (Lib_group): New.
6051 (Add_lib_group_symbols): New.
6052 * archive.h: Include options.h.
6053 (Archive_member): Moved from Archive.
6054 (Should_include): Moved from archive.cc.
6055 (Lib_group): New.
6056 (Add_lib_group_symbols): New.
6057 * dynobj.cc (do_should_include_member): New.
6058 * dynobj.h (do_should_include_member): New.
6059 * gold.cc (queue_initial_tasks): Update call to queue.
6060 * main.cc (main): Print lib group stats.
6061 * object.cc (do_should_include_member): New.
6062 * object.h: Include archive.h.
6063 (Object::should_include_member): New.
6064 (Object::do_should_include_member): New.
6065 (Sized_relobj::do_should_include_member): New.
6066 * options.cc (General_options::parse_start_lib): New.
6067 (General_options::parse_end_lib): New.
6068 (Input_arguments::add_file): Handle lib groups.
6069 (Input_arguments::start_group): Check we are not in a lib.
6070 (Input_arguments::start_lib): New.
6071 (Input_arguments::end_lib): New.
6072 * options.h (General_options): Add start_lib and end_lib.
6073 (Input_argument::lib_): New.
6074 (Input_argument::lib): New.
6075 (Input_argument::is_lib): New.
6076 (Input_file_lib): New.
6077 (Input_arguments::in_lib_): New.
6078 (Input_arguments::in_lib): New.
6079 (Input_arguments::start_lib): New.
6080 (Input_arguments::end_lib_): New.
6081 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6082 in unused members as preempted.
6083 (Sized_pluginobj::do_should_include_member): New.
6084 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6085 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6086 return the blocker.
6087 (Read_symbols::do_whole_lib_group): New.
6088 (Read_symbols::do_lib_group): New.
6089 (Read_symbols::do_read_symbols): Handle lib groups.
6090 (Read_symbols::get_name): Handle lib groups.
6091 * readsyms.h (Read_symbols): Add an archive member pointer.
6092 (Read_symbols::do_whole_lib_group): New.
6093 (Read_symbols::do_lib_group): New.
6094 (Read_symbols::member_): New.
6095 * script.cc (read_input_script): Update call to queue_soon.
6096
6097 2010-03-19 Doug Kwan <dougkwan@google.com>
6098
6099 * arm.cc (Stub_table::Stub_table): Initialize new data members
6100 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6101 (Stub_table::add_reloc_stub): Assign stub offset and update
6102 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6103 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6104 New data members.
6105 (Stub_table::update_data_size_and_addralign): Use
6106 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6107 instead of going over all reloc stubs.
6108 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6109 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6110 Stringpool_template::offset_ to size of Stringpool_char.
6111 (Stringpool_template::new_key_offset): Remove code to initialize
6112 Stringpool_template::offset_.
6113 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6114 Stringpool_template::offset_ to zero.
6115
6116 2010-03-15 Doug Kwan <dougkwan@google.com>
6117
6118 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6119 offset_.
6120 (Stringpool_template::new_key_offset): New method.
6121 (Stringpool_template::add_string): Assign offsets when adding new
6122 strings.
6123 (Stringpool_template::set_string_offsets): Do not set string offsets
6124 when not optimizing.
6125 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6126 member size_.
6127 (Chunked_vector::clear): Clear size_.
6128 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6129 (Chunked_vector::size): Return size_.
6130 (Chunked_vector::push_back): Use size_ to find insert position.
6131 (Chunked_vector::size_): New data member.
6132 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6133 (Stringpool_template::new_key_offset): New method declaration.
6134 (Stringpool_template::offset_): New data member.
6135
6136 2010-03-15 Rafael Espindola <espindola@google.com>
6137
6138 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6139 Add_symbols' constructor.
6140 * readsyms.h (Add_symbols): Remove the input_group member.
6141
6142 2010-03-10 Ian Lance Taylor <iant@google.com>
6143
6144 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6145 target to ask whether a reference to a symbol requires a stack
6146 split.
6147 * target.h (Target::is_call_to_non_split): New function.
6148 (Target::do_is_call_to_non_split): Declare virtual function.
6149 * target.cc: Include "symtab.h".
6150 (Target::do_is_call_to_non_split): New function.
6151 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6152
6153 2010-03-10 Cary Coutant <ccoutant@google.com>
6154
6155 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6156 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6157 (File_read::open[2]): Add whole_file_view_ to list of views.
6158 (File_read::make_view): Remove test of whole_file_view_.
6159 (File_read::find_or_make_view): Create whole_file_view_ if
6160 necessary.
6161 (File_read::clear_views): Replace bool parameter with enum;
6162 adjust all callers. Don't delete views with permanent data;
6163 do delete cached views and views from archives if
6164 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6165 if clearing the corresponding view.
6166 * fileread.h (File_read::Clear_views_mode): New enum.
6167 (File_read::View::is_permanent_view): New method.
6168 (File_read::clear_views): Replace bool parameter
6169 with enum; adjust all callers.
6170 * options.h (General_options): Change keep_files_mapped option;
6171 add map_whole_files.
6172 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6173 releasing the file.
6174 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6175 the file.
6176
6177 2010-03-10 David S. Miller <davem@davemloft.net>
6178
6179 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6180
6181 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6182
6183 * icf.cc (get_section_contents): Add '@' marker after processing the
6184 merge reloc.
6185
6186 2010-03-08 Doug Kwan <dougkwan@google.com>
6187
6188 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6189 due to a conversion warning.
6190 (Arm_relobj::update_output_local_symbol_count): Check for local
6191 symbol with unset output index.
6192
6193 2010-03-05 Ian Lance Taylor <iant@google.com>
6194
6195 * options.h (class General_options): Add --spare-dynamic-tags.
6196 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6197 --spare-dynamic-tags.
6198
6199 2010-03-05 Ian Lance Taylor <iant@google.com>
6200
6201 * incremental.cc: Include "libiberty.h".
6202
6203 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6204
6205 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6206 function, is_info_ member.
6207 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6208 (Versions::Versions): Update caller.
6209 (Versions::define_base_version): Likewise.
6210 (Versions::add_def): Likewise.
6211
6212 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6213
6214 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6215 (Scan::possible_function_pointer_reloc): New function.
6216 (Scan::local_reloc_may_be_function_pointer): Change to call
6217 possible_function_pointer_reloc.
6218 (Scan::global_reloc_may_be_function_pointer): Ditto.
6219 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6220 relocations in ".data.rel.ro._ZTV" section.
6221 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6222 * testsuite/icf_safe_so_test.cc: Ditto.
6223 * testsuite/icf_safe_test.cc: Ditto.
6224 * testsuite/icf_safe_test.sh: Ditto.
6225
6226 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6227 Ian Lance Taylor <iant@google.com>
6228
6229 * target-reloc.h (relocate_section): Check the symbol table index
6230 for -1U before setting the local symbol index.
6231 (scan_relocatable_relocs): If copying the relocation, record that
6232 the local symbol is required.
6233 * object.h (Symbol_value::is_output_symtab_index_set): New
6234 function.
6235 (Symbol_value::may_be_discarded_from_output_symtab): New
6236 function.
6237 (Symbol_value::has_output_symtab_entry): New function.
6238 (Symbol_value::needs_output_symtab_entry): Remove.
6239 (Symbol_value::output_symtab_index): Make sure the symbol index is
6240 set.
6241 (Symbol_value::set_output_symtab_index): Make sure the symbol
6242 index is not set. Make sure the new index is valid.
6243 (Symbol_value::set_must_have_output_symtab_entry): New function.
6244 (Symbol_value::has_output_dynsym_entry): New function.
6245 (Symbol_value::set_output_dynsym_index): Make sure the new index
6246 is valid.
6247 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6248 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6249 local symbol if permitted.
6250 (Sized_relobj::do_finalize_local_symbols): Call
6251 is_output_symtab_index_set rather than needs_output_symtab_entry.
6252 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6253 rather than needs_output_symtab_entry. Call
6254 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6255 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6256 is_output_symtab_index_set rather than needs_output_symtab_entry.
6257 * testsuite/discard_locals_relocatable_test.c: New file.
6258 * testsuite/discard_locals_test.sh: Test -r.
6259 * testsuite/Makefile.am (check_DATA): Add
6260 discard_locals_relocatable_test1.syms,
6261 discard_local_relocatable_test2.syms.
6262 (MOSTLYCLEANFILES): Likewise. Also add
6263 discard_locals_relocatable_test1.lout and
6264 discard_locals_relocatable_test2.out.
6265 (discard_locals_relocatable_test1.syms): New target.
6266 (discard_locals_relocatable_test.o): New target.
6267 (discard_locals_relocatable_test1.out): New target.
6268 (discard_locals_relocatable_test2.syms): New target.
6269 (discard_locals_relocatable_test2.out): New target.
6270 (various): Add missing ../ld-new dependencies.
6271 * testsuite/Makefile.in: Rebuild.
6272
6273 2010-03-03 Nick Clifton <nickc@redhat.com>
6274
6275 * po/fi.po: New Finnish translation.
6276
6277 2010-03-01 Doug Kwan <dougkwan@google.com>
6278
6279 * layout.cc (Layout::Layout): Force section types of .init_array*,
6280 .preinit_array* and .fini_array* sections.
6281 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6282 Fix check of return value of std::string::find.().
6283 (Output_section::Input_section_sort_compare::operator()): Remove
6284 comment about .init_array.
6285 (Output_section::Input_section_sort_init_fini_compare::operator()):
6286 New method.
6287 (Output_section::sort_attached_input_sections): Handle .init_array
6288 and .fini_array specially.
6289 * output.h (Output_section::Inut_section_sort_compare): Update
6290 comment.
6291 (Output_section::Input_section_sort_init_fini_compare): New struct.
6292
6293 2010-02-26 Doug Kwan <dougkwan@google.com>
6294
6295 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6296 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6297 * testsuite/debug_msg.sh: Avoid matching source line number for
6298 use of global variable undef_int.
6299
6300 2010-02-26 Doug Kwan <dougkwan@google.com>
6301
6302 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6303 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6304 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6305 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6306 * options.cc (General_options::General_options): Initialize member
6307 fix_v4bx_.
6308 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6309 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6310 and rm_no_fix_v4bx.stdout
6311 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6312 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6313 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6314 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6315 and arm_no_fix_v4bx.
6316 * Makefile.in: Regenerate.
6317 * testsuite/arm_fix_v4bx.s: New file.
6318 * testsuite/arm_fix_v4bx.sh: Ditto.
6319
6320 2010-02-24 Doug Kwan <dougkwan@google.com>
6321
6322 * arm.cc (Target_arm::got_section): Make the .got section the first
6323 non RELRO section in the data segment.
6324 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6325 suffixes of section names.
6326
6327 2010-02-24 Doug Kwan <dougkwan@google.com>
6328
6329 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6330 flags and attributes merging if an input file is a binary file.
6331 * fileread.cc (Input_file::open): Record format of original file.
6332 * fileread.h (Input_file::Format): New enum type.
6333 (Input_file::Input_file): Initialize data member format_.
6334 (Input_file::format): New method definition.
6335 (Input_file::format_):: New data member.
6336
6337 2010-02-24 Doug Kwan <dougkwan@google.com>
6338
6339 * arm.cc (Arm_output_data_got): New class.
6340 (ARM_TCB_SIZE): New constant
6341 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6342 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6343 If user uses a script with a SECTIONS clause, issue only a warning
6344 for a misplaced EXIDX input section. Otherwise, issue an error.
6345 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6346 garbage collection.
6347 (Target_arm::got_mode_index_entry): Handle static linking.
6348 (Target_arm::Scan::local): Ditto.
6349 (Target_arm::Scan::global): Ditto.
6350 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6351 all incorrectly implemented relocations.
6352 (Target_arm::fix_exidx_coverage): Pass layout to
6353 Arm_output_section::fix_exidx_coverage.
6354 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6355 from ".ARM.exidx." and ".ARM.extab.".
6356
6357 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6358
6359 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6360 section if it does not already exist.
6361 * attributes.cc (Attributes_section_data::Attributes_section_data):
6362 Don't crash if size is zero.
6363
6364 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6365 Ian Lance Taylor <iant@google.com>
6366
6367 * gold.cc (queue_middle_tasks): If no input files were opened,
6368 exit.
6369 * workqueue.h (Task_function::Task_function): Assert that there is
6370 a blocker.
6371
6372 2010-02-22 Doug Kwan <dougkwan@google.com>
6373
6374 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6375 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6376 types to avoid warnings due to different uint64_t implementations
6377 on different hosts.
6378
6379 2010-02-21 Doug Kwan <dougkwan@google.com>
6380
6381 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6382 handling of the maximum backward branch offset.
6383 (Arm_relocate_functions::thumb_branch_common): Ditto.
6384 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6385 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6386 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6387 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6388 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6389 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6390 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6391 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6392 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6393 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6394 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6395 thumb2_bl_out_of_range.o): New rules.
6396 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6397 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6398 thumb2_bl_out_of_range
6399 * testsuite/Makefile.in: Regenerate.
6400 * testsuite/arm_bl_in_range.s: New file.
6401 * testsuite/arm_bl_out_of_range.s: Ditto.
6402 * testsuite/arm_branch_in_range.sh: Ditto.
6403 * testsuite/arm_branch_range.t: Ditto.
6404 * testsuite/thumb2_branch_range.t: Ditto.
6405 * testsuite/thumb_bl_in_range.s: Ditto.
6406 * testsuite/thumb_bl_out_of_range.s: Ditto.
6407 * testsuite/thumb_branch_range.t: Ditto.
6408
6409 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6410
6411 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6412 Add reloc offset information.
6413 * icf.cc (get_section_contents): Change iterators to point to the new
6414 vectors. Add reloc offset information to the contents.
6415 * icf.h (Icf::Sections_reachable_info): New typedef.
6416 (Icf::Sections_reachable_list): New typedef.
6417 (Icf::Offset_info): New typedef.
6418 (Icf::Reloc_info): New struct typedef.
6419 (Icf::Reloc_info_list): New typedef.
6420 (Icf::symbol_reloc_list): Delete method.
6421 (Icf::addend_reloc_list): Delete method.
6422 (Icf::section_reloc_list): Delete method.
6423 (Icf::reloc_info_list): New method.
6424 (Icf::reloc_info_list_): New member.
6425
6426 2010-02-19 Doug Kwan <dougkwan@google.com>
6427
6428 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6429 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6430 * arm.cc (Arm_relocation_functions): New forward declaration.
6431 (Target_arm::Target_arm): Initialize new data members
6432 got_mod_index_offset_ and tls_base_symbol_defined_.
6433 (Target_arm::Relocate::relocate_tls): New method.
6434 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6435 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6436 New methods.
6437 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6438 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6439 (Target_arm::got_mod_index_offset_,
6440 Target_arm::tls_base_symbol_defined_): New data members.
6441 (Target_arm::Scan::local, Target::Scan::global,
6442 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6443 relocations.
6444
6445 2010-02-18 Doug Kwan <dougkwan@google.com>
6446
6447 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6448 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6449 text section as a parameter becuase some broken tools may not set
6450 the link in section header.
6451 (Target_arm::has_got_section): New method.
6452 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6453 without any mapping symbol as data only. Remove warning.
6454 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6455 link in its section header, try to discover the link by inspecting the
6456 REL31 relocation at the beginning of the section.
6457 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6458 in error message.
6459 (Target_arm::Scan::global): Treat any reference to the symbol
6460 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6461
6462 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6463
6464 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6465 (Scan::global_reloc_may_be_function_pointer): New function.
6466 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6467 (Scan::global_reloc_may_be_function_pointer): New function.
6468 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6469 (Scan::global_reloc_may_be_function_pointer): New function.
6470 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6471 (Scan::global_reloc_may_be_function_pointer): New function.
6472 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6473 (Scan::global_reloc_may_be_function_pointer): New function.
6474 (Scan::possible_function_pointer_reloc): New function.
6475 (Target_x86_64::can_check_for_function_pointers): New function.
6476 * gc.h (gc_process_relocs): Scan relocation types to determine if
6477 function pointers were taken for targets that support it.
6478 * icf.cc (Icf::find_identical_sections): Include functions for
6479 folding in safe ICF whose pointer is not taken.
6480 * icf.h (Secn_fptr_taken_set): New typedef.
6481 (fptr_section_id_): New member.
6482 (section_has_function_pointers): New function.
6483 (set_section_has_function_pointers): New function.
6484 (check_section_for_function_pointers): New function.
6485 * options.h: Fix comment for safe ICF option.
6486 * target.h (can_check_for_function_pointers): New function.
6487 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6488 Modify icf_safe_test for X86-64.
6489 * testsuite/Makefile.in: Regenerate.
6490 * testsuite/icf_safe_so_test.cc: New file.
6491 * testsuite/icf_safe_so_test.sh: New file.
6492 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6493 (main): Change to take pointer to function kept_func_3.
6494 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6495 folding is done correctly for X86-64.
6496
6497 2010-02-12 David S. Miller <davem@davemloft.net>
6498
6499 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6500 is_symbolless parameter.
6501 (Output_reloc<SHT_REL>::is_symbolless): New.
6502 (Output_reloc<SHT_REL>::is_symbolless_): New.
6503 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6504 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6505 (Output_reloc<SHT_RELA>::is_symbolless): New.
6506 (Output_data_reloc::add_global): Handle is_symbolless.
6507 (Output_data_reloc::add_global_relative): Likewise.
6508 (Output_data_reloc::add_local): Likewise.
6509 (Output_data_reloc::add_local_relative): Likewise.
6510 (Output_data_reloc::add_symbolless_global_addend): New.
6511 (Output_data_reloc::add_symbolless_local_addend): New.
6512 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6513 is_symbolless.
6514 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6515 instead of ->is_relative_
6516 (Output_reloc::write): Likewise.
6517 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6518 (Output_reloc::write_rel): Simplify.
6519
6520 * sparc.cc (Target_sparc::Scan::local): Use
6521 ->add_symbolless_local_addend as needed.
6522 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6523 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6524 based upon relocation offset.
6525
6526 2010-02-11 Doug Kwan <dougkwan@google.com>
6527
6528 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6529 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6530 beginning of function.
6531 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6532 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6533 parameter is_32bit in calls to should_apply_static_reloc.
6534 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6535 (check_DATA): Add arm_abs_global.stdout.
6536 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6537 arm_abs_global.stdout): New rules.
6538 (MOSTLLYCLEANFILES): Add arm_abs_global
6539 * Makefile.in: Regenerate.
6540 * testsuite/arm_abs_global.s: New file.
6541 * testsuite/arm_abs_global.sh: Ditto.
6542 * testsuite/arm_abs_lib.s: Ditto.
6543
6544 2010-02-11 Ian Lance Taylor <iant@google.com>
6545
6546 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6547 Read_relocs task.
6548 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6549 Allocate_commons_task first.
6550 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6551 task, rather than symtab_lock_.
6552 (Gc_process_relocs::~Gc_process_relocs): New function.
6553 (Gc_process_relocs::is_runnable): Check this_blocker_.
6554 (Gc_process_relocs::locks): Use next_blocker_ rather than
6555 blocker_.
6556 (Scan_relocs::~Scan_relocs): New function.
6557 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6558 symtab_lock_.
6559 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6560 next_blocker_.
6561 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6562 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6563 constructor accordingly.
6564 (class Gc_process_relocs): Likewise.
6565 (class Scan_relocs): Likewise.
6566 * common.h (class Allocate_commons_task): Remove symtab_lock_
6567 field, and corresponding constructor parameter.
6568 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6569 symtab_lock_.
6570 (Allocate_commons_task::locks): Likewise.
6571
6572 2010-02-11 Ian Lance Taylor <iant@google.com>
6573
6574 * gold-threads.h (class Once): Define.
6575 (class Initialize_lock): Rewrite as child of Once.
6576 * gold-threads.cc (class Once_initialize): Define.
6577 (once_pointer_control): New static variable.
6578 (once_pointer, once_arg): New static variables.
6579 (c_run_once): New static function.
6580 (Once::Once, Once::run_once, Once::internal_run): New functions.
6581 (class Initialize_lock_once): Remove.
6582 (initialize_lock_control): Remove.
6583 (initialize_lock_pointer): Remove.
6584 (initialize_lock_once): Remove.
6585 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6586 (Initialize_lock::initialize): Rewrite.
6587 (Initialize_lock::do_run_once): New function.
6588 * archive.cc (Archive::interpret_header): Only clear name if it is
6589 not already empty.
6590 * fileread.cc: Include "gold-threads.h"
6591 (file_counts_lock): New static variable.
6592 (file_counts_initialize_lock): Likewise.
6593 (File_read::release): Only increment counts when using --stats.
6594 Use a lock around the increment.
6595 * parameters.cc (class Set_parameters_target_once): Define.
6596 (set_parameters_target_once): New static variable.
6597 (Parameters::Parameters): Move here from parameters.h.
6598 (Parameters::set_target): Rewrite.
6599 (Parameters::set_target_once): New function.
6600 (Parameters::clear_target): Move here and rewrite.
6601 * parameters.h (class Parameters): Update declarations. Add
6602 set_parameters_target_once_ field.
6603 (Parameters::Parameters): Move to parameters.cc.
6604 (Parameters::clear_target): Likewise.
6605 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6606 task.
6607 (Start_group::~Start_group): New function.
6608 (Start_group::is_runnable): New function.
6609 (Start_group::locks, Start_group::run): New functions.
6610 (Finish_group::run): Change saw_undefined to size_t.
6611 * readsyms.h (class Start_group): Define.
6612 (class Finish_group): Change saw_undefined_ field to size_t.
6613 (Finish_group::Finish_group): Remove saw_undefined and
6614 this_blocker parameters. Change all callers.
6615 (Finish_group::set_saw_undefined): New function.
6616 (Finish_group::set_blocker): New function.
6617 * symtab.h (class Symbol_table): Change saw_undefined to return
6618 size_t. Change saw_undefined_ field to size_t.
6619 * target-select.cc (Set_target_once::do_run_once): New function.
6620 (Target_selector::Target_selector): Initialize set_target_once_
6621 field. Don't initialize lock_ and initialize_lock_ fields.
6622 (Target_selector::instantiate_target): Rewrite.
6623 (Target_selector::set_target): New function.
6624 * target-select.h (class Set_target_once): Define.
6625 (class Target_selector): Update declarations. Make
6626 Set_target_once a friend. Remove lock_ and initialize_lock_
6627 fields. Add set_target_once_ field.
6628
6629 2010-02-10 Ian Lance Taylor <iant@google.com>
6630
6631 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6632 queueing any tasks.
6633 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6634 (queue_middle_tasks): Add all blockers before queueing any tasks.
6635 (queue_final_tasks): Likewise.
6636 * token.h (Task_token::add_blockers): New function.
6637 * object.h (Input_objects::number_of_relobjs): New function.
6638
6639 2010-02-10 Ian Lance Taylor <iant@google.com>
6640
6641 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6642 shared, not if not position independent.
6643 * x86_64.cc (Relocate::relocate_tls): Likewise.
6644 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6645 (tls_pie_pic_test): New target.
6646 * testsuite/Makefile.in: Rebuild.
6647
6648 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6649 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6650 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6651 * testsuite/Makefile.in: Rebuild.
6652
6653 2010-02-09 David S. Miller <davem@davemloft.net>
6654
6655 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6656 R_SPARC_RELATIVE using ->add_local_relative().
6657 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6658
6659 * output.h (Output_data_dynamic::add_section_size): New method
6660 that takes two Output_data objects.
6661 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6662 entry param. Handle it in initializers.
6663 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6664 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6665 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6666 arg.
6667 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6668 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6669 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6670 for dynrel_includes_plt.
6671 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6672 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6673 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6674 before .rela.plt
6675 (Target_sparc::do_finalize_sections): Update to pass true for
6676 dynrel_includes_plt.
6677 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6678 output before .rela.plt
6679 (Target_powerpc::do_finalize_sections): Update to pass true for
6680 dynrel_includes_plt when 32-bit.
6681
6682 2010-02-08 Doug Kwan <dougkwan@google.com>
6683
6684 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6685 method.
6686 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6687 Arm_relobj::scan_section_for_cortex_a8_stubs,
6688 Arm_relobj::do_relocation_section): Instead of calling
6689 Output_section::output_address, use faster
6690 Arm_relobj::simple_input_section_output_address.
6691
6692 2010-02-08 David S. Miller <davem@davemloft.net>
6693
6694 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6695 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6696 relocation helper function.
6697
6698 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6699 just like R_SPARC_GOT{10,13,22}.
6700 (Target_sparc::Scan::local): Likewise.
6701 (Target_sparc::Relocate:relocate): Likewise.
6702
6703 2010-02-06 Ian Lance Taylor <iant@google.com>
6704
6705 * configure.ac: Rewrite targetobjs duplicate removal code to use
6706 only shell constructs.
6707 * configure: Rebuild.
6708
6709 2010-02-05 Doug Kwan <dougkwan@google.com>
6710
6711 PR 11247
6712 * arm.cc (Arm_relobj::section_is_scannable): New method.
6713 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6714 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6715
6716 2010-02-04 Doug Kwan <dougkwan@google.com>
6717
6718 PR 11247
6719 * arm-reloc-property.cc (cstdio): Include.
6720 * configure.ac (targetobjs): Remove duplicates.
6721 * configure: Regenerate.
6722 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6723 big and little endian version for a given address size.
6724
6725 2010-02-03 Doug Kwan <dougkwan@google.com>
6726
6727 * arm-reloc-property.cc
6728 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6729 definition.
6730 * arm-reloc-property.h
6731 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6732 New method definition.
6733 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6734 declaration.
6735 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6736 overflow to N.
6737 (GOT_PREL): Change implemented to Y.
6738 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6739 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6740 (Arm_relocate_functions::movw_abs_nc): Remove method.
6741 (Arm_relocate_functions::movt_abs): Ditto.
6742 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6743 (Arm_relocate_functions::thm_movt_abs): Ditto.
6744 (Arm_relocate_functions::movw_rel_nc): Ditto.
6745 (Arm_relocate_functions::movw_rel): Ditto.
6746 (Arm_relocate_functions::movt_rel): Ditto.
6747 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6748 (Arm_relocate_functions:thm_movw_rel): Ditto.
6749 (Arm_relocate_functions:thm_movt_rel): Ditto.
6750 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6751 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6752 New method definitions.
6753 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6754 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6755 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6756 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6757 (Target_arm::Relocate::relocate): Check for non-static or
6758 unimplemented relocation code and exit early. Change calls to
6759 Target_arm::reloc_uses_thumb_bit and
6760 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6761 instead. Refactor code to handle similar relocations to increase
6762 code sharing. Remove check for unsupported relocation code in switch
6763 statement.
6764 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6765 relocation property table to find out size. Change error message to
6766 print out the name of a relocation code instead of the numeric value.
6767 (Target_arm::scan_reloc_for_stub): Use relocation property table
6768 instead of calling Target_arm::reloc_uses_thumb_bit().
6769
6770 2010-02-02 Doug Kwan <dougkwan@google.com>
6771
6772 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6773 types of relaxed input section.
6774
6775 2010-02-02 Doug Kwan <dougkwan@google.com>
6776
6777 * Makefile.am (HFILES): Add arm-reloc-property.h.
6778 (DEFFILES): New.
6779 (TARGETSOURCES): Add arm-reloc-property.cc
6780 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6781 (libgold_a_SOURCES): $(DEFFILES)
6782 * Makefile.in: Regenerate.
6783 * arm-reloc-property.cc: New file.
6784 * arm-reloc-property.h: New file.
6785 * arm-reloc.def: New file.
6786 * arm.cc: Update comments.
6787 (arm-reloc-property.h): New included header.
6788 (arm_reloc_property_table): New global variable.
6789 (Target_arm::do_select_as_default_target): New method definition.
6790 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6791 arm-reloc-property to targ_extra_obj.
6792 * parameters.cc (set_parameters_target): Call
6793 Target::select_as_default_target().
6794 * target.h (Target::select_as_default_target): New method definition.
6795 (Target::do_select_as_default_target): Same.
6796
6797 2010-02-01 Doug Kwan <dougkwan@google.com>
6798
6799 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6800 first_output_text_section_.
6801 (Arm_exidx_fixup::first_output_text_section): New method definition.
6802 (Arm_exidx_fixup::first_output_text_section_): New data member.
6803 (Arm_exidx_fixup::process_exidx_section): Record the first text
6804 output section seen.
6805 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6806 and entsize in output section header.
6807
6808 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6809
6810 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6811 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6812 (Arm_relocate_functions::thm_alu11): New Method.
6813 (Arm_relocate_functions::thm_pc8): New Method.
6814 (Arm_relocate_functions::thm_pc12): New Method.
6815 (Target_arm::Scan::local): Handle the relocations.
6816 (Target_arm::Scan::global): Likewise.
6817 (Target_arm::Relocate::relocate): Likewise.
6818 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6819
6820 2010-01-29 Doug Kwan <dougkwan@google.com>
6821
6822 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6823 of relocation types as ld.
6824
6825 2010-01-29 Doug Kwan <dougkwan@google.com>
6826
6827 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6828 to public.
6829 (Arm_relocate_functions::thumb_branch_common): Ditto.
6830 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6831 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6832 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6833 Arm_relocate_functions::jump24): Remove.
6834 (Target_arm::Relocate::relocate): Adjust code to call
6835 Arm_relocation_functions::arm_branch_common and
6836 Arm_relocation_functions::thumb_branch_common instead of their removed
6837 wrappers. Merge switch-cases together to reduce source code size.
6838
6839 2010-01-29 Doug Kwan <dougkwan@google.com>
6840
6841 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6842 output_local_symbol_count_needs_update_.
6843 (Arm_relobj::output_local_symbol_count_needs_update,
6844 Arm_relobj::set_output_local_symbol_count_needs_update,
6845 Arm_relobj::update_output_local_symbol_count): New methods.
6846 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6847 member.
6848 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6849 of pointed function as in a R_ARM_PREL31 relocation.
6850 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6851 for output local symbol count updating.
6852 (Target_arm::do_relax): Update output local symbol counts in objects
6853 if necessary.
6854 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6855
6856 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6857
6858 * arm.cc: Added support for the ARM relocations:
6859 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6860 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6861 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6862 movw_prel_nc).
6863 (Arm_relocate_functions::movw_rel): New method.
6864 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6865 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6866 thm_movw_prel_nc).
6867 (Arm_relocate_functions::thm_movw_rel): New method.
6868 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6869 thm_movt_prel).
6870 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6871 relocations.
6872 (Target_arm::Scan::global): Likewise.
6873 (Target_arm::Relocate::relocate): Likewise.
6874 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6875 Likewise.
6876
6877 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6878
6879 * arm.cc: Added support for ARM group relocations.
6880 (Target_arm::reloc_needs_sym_origin): New method.
6881 (Arm_relocate_functions::calc_grp_kn): New method.
6882 (Arm_relocate_functions::calc_grp_residual): New method.
6883 (Arm_relocate_functions::calc_grp_gn): New method.
6884 (Arm_relocate_functions::arm_grp_alu): New Method.
6885 (Arm_relocate_functions::arm_grp_ldr): New Method.
6886 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6887 (Arm_relocate_functions::arm_grp_ldc): New Method.
6888 (Target_arm::Scan::local): Handle the ARM group relocations.
6889 (Target_arm::Scan::global): Likewise.
6890 (Target_arm::Relocate::relocate): Likewise.
6891 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6892 Likewise.
6893
6894 2010-01-26 Doug Kwan <dougkwan@google.com>
6895
6896 * arm.cc (set): Include.
6897 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6898 pointer type.
6899 (Arm_output_section::Text_section_list): New type.
6900 (Arm_output_section::append_text_sections_to_list): New method.
6901 (Arm_output_section::fix_exidx_coverage): Ditto.
6902 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6903 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6904 Relobj::set_section_offset() instead of
6905 Sized_relobj::invalidate_section_offset().
6906 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6907 parameter for section headers. Ignore relocation sections for
6908 unallocated sections and EXIDX sections.
6909 (Target_arm::fix_exidx_coverage): New method.
6910 (Target_arm::output_section_address_less_than): New type.
6911 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6912 linked text section instead of the EXIDX section.
6913 (Arm_output_section::create_stub_group): Add an assertion to check
6914 that this is not an EXIDX output section.
6915 (Arm_output_section::append_text_sections_to_list): New method.
6916 (Arm_output_section::fix_exidx_coverage): Ditto.
6917 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6918 Arm_relobj::section_needs_reloc_stub_scanning.
6919 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6920 first pass.
6921 (Target_arm::fix_exidx_coverage): New method.
6922 * object.h (Relobj::set_output_section): New method.
6923 (Sized_relobj::invalidate_section_offset): Remove method.
6924 (Sized_relobj::do_invalidate_section_offset): Remove method.
6925 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6926
6927 2010-01-25 Doug Kwan <dougkwan@google.com>
6928
6929 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6930 Fix warning due to signed and unsigned comparison on a 32-bit host.
6931
6932 2010-01-22 Doug Kwan <dougkwan@google.com>
6933
6934 * arm.cc (Target_arm::do_relax): Record an output section for section
6935 offset adjustment it contains any stub table that has changed.
6936 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6937 offsets in an output section if necessary.
6938 * output.cc (Output_section::Output_section): Initialize
6939 section_offsets_need_adjustments_.
6940 (Output_section::add_input_section_for_script): Renamed to
6941 Output_section::add_simple_input_section.
6942 (Output_section::save_states): Add a comment.
6943 (Output_section::discard_states): New method defintion.
6944 (Output_section::adjust_section_offsets): Same.
6945 * output.h (Output_section::add_input_section_for_script): Renamed to
6946 Output_section::add_simple_input_section.
6947 (Output_section::discard_states): New method declaration.
6948 (Output_section::adjust_section_offsets): Same.
6949 (Output_section::section_offsets_need_adjustment,
6950 Output_section::set_section_offsets_need_adjustment): New method
6951 definitions.
6952 (Output_section::section_offsets_need_adjustment_): New data member.
6953 * script-sections.cc
6954 (Output_section_element_input::set_section_address): Adjust code for
6955 renaming of Output_section::add_input_section_for_script.
6956 (Orphan_output_section::set_section_address): Same.
6957
6958 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6959
6960 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6961 Fix_v4bx enum values .
6962 * gold/options.h (General_options): New option definitions.
6963 (General_options::fix_v4bx): New method.
6964 (General_options::Fix_v4bx): New enum.
6965 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6966 (General_options::parse_fix_v4bx_interworking): New method.
6967
6968 2010-01-22 Doug Kwan <dougkwan@google.com>
6969
6970 * arm.cc (Arm_exidx_fixup): New class.
6971
6972 2010-01-21 Doug Kwan <dougkwan@google.com>
6973
6974 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6975 classes.
6976 (Arm_exidx_section_offset_map): New type.
6977
6978 2010-01-21 Doug Kwan <dougkwan@google.com>
6979
6980 * arm.cc (Arm_exidx_input_section): New class.
6981 (Arm_relobj::exidx_input_section_by_link,
6982 Arm_relobj::exidx_input_section_by_shndx,
6983 Arm_relobj::make_exidx_input_section): New methods.
6984 (read_arm_attributes_section): Remove.
6985 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6986 information about them.
6987 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6988 to here.
6989
6990 2010-01-20 Doug Kwan <dougkwan@google.com>
6991
6992 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6993 Input_section_specifier to Section_id.
6994 (Target_arm::new_arm_input_section: Adjust code for change of key
6995 type.
6996 (Target_arm::find_arm_input_section): Ditto.
6997 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6998 (Section_id): Remove.
6999 (Garbage_collection::Section_id_hash): Remove.
7000 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7001 (Section_id): Remove.
7002 (Icf::Section_id_hash): Remove.
7003 * object.h (Section_id, Const_section_id, Section_id_hash,
7004 Const_section_id_hash): New type definitions.
7005 * output.cc (Output_section::add_relaxed_input_section): Change to
7006 use Const_section_id instead of Input_section_specifier as key type.
7007 (Output_section::add_merge_input_section): Ditto.
7008 (Output_section::build_relaxation_map): Change to use Section_id
7009 instead of Input_section_specifier as key type.
7010 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7011 Ditto.
7012 (Output_section::convert_input_sections_to_relaxed_sections): Change
7013 to use Const_section_id instead of Input_section_specifier as key type.
7014 (Output_section::find_merge_section): Ditto.
7015 (Output_section::find_relaxed_input_section): Ditto.
7016 * output.h (Input_section_specifier): Remove class.
7017 (Output_section::Output_section_data_by_input_section_map): Change
7018 key type to Const_section_id.
7019 (Output_section::Output_relaxed_input_section_by_input_section_map):
7020 Ditto.
7021 (Output_section::Relaxation_map): Change key type to Section_id.
7022
7023 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7024
7025 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7026 (class Arm_v4bx_stub): New class.
7027 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7028 (Stub_factory::make_arm_v4bx_stub): New method.
7029 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7030 (Stub_table::empty): Handle v4bx stubs.
7031 (Stub_table::add_arm_v4bx_stub): New method.
7032 (Stub_table::find_arm_v4bx_stub): New method.
7033 (Arm_relocate_functions::v4bx): New method.
7034 (Target_arm::fix_v4bx): New method.
7035 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7036 (Stub_table::relocate_stubs): Likewise.
7037 (Stub_table::do_write): Likewise.
7038 (Stub_table::update_data_size_and_addralign): Likewise.
7039 (Stub_table::finalize_stubs): Likewise.
7040 (Target_arm::Scan::local): Likewise.
7041 (Target_arm::Scan::global): Likewise.
7042 (Target_arm::do_finalize_sections): Likewise.
7043 (Target_arm::Relocate::relocate): Likewise.
7044 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7045 Likewise.
7046 (Target_arm::scan_reloc_for_stub): Likewise.
7047 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7048
7049 2010-01-19 Ian Lance Taylor <iant@google.com>
7050
7051 * output.cc (Output_section_headers::do_sized_write): Write large
7052 segment count to sh_info field.
7053 (Output_file_header::do_sized_write): For large segment count,
7054 write PN_XNUM to e_phnum field.
7055
7056 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7057
7058 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7059 (Arm_relocate_functions::thm_jump8): New function.
7060 (Arm_relocate_functions::thm_jump11): New function.
7061 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7062 R_ARM_THM_JUMP11.
7063 (Target_arm::Scan::global): Likewise.
7064 (Target_arm::Relocate::relocate): Likewise.
7065 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7066 Likewise.
7067
7068 2010-01-14 Doug Kwan <dougkwan@google.com>
7069
7070 * arm.cc (map, utility): Include headers.
7071 (Target_arm::apply_cortex_a8_workaround): New method.
7072 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7073 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7074 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7075 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7076 the --[no-]fix-cortex-a8 command line options.
7077 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7078 (Target_arm::relocate_stub): Use addend in instruction template.
7079 * options.h (DEFINE_bool): Set the user-set flag.
7080 (General_options): Add --[no-]-fix-cortex options.
7081 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7082 : Update fast look-up map after conversion.
7083
7084 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7085
7086 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7087 in the first pass of do_layout.
7088
7089 2010-01-13 Doug Kwan <dougkwan@google.com>
7090
7091 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7092 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7093 apparent compiler problem of not folding static constant integral
7094 data members of elfcpp::Elf_sizes<32>.
7095
7096 2010-01-13 Doug Kwan <dougkwan@google.com>
7097
7098 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7099 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7100 Arm_relobj::scan_section_for_cortex_a8_erratum,
7101 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7102 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7103 sections to scan for relocation stubs into a new method
7104 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7105 relocation and Cortex-A8 stub scanning.
7106 (Target_arm::do_relax): Force stubs to be after stubbed sections
7107 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7108 the beginning of a new relaxation pass. Update a comment.
7109 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7110
7111 2010-01-12 Ian Lance Taylor <iant@google.com>
7112
7113 * target-reloc.h (visibility_error): New inline function.
7114 (relocate_section): Call visibility_error.
7115 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7116 (MOSTLYCLEANFILES): Likewise.
7117 (protected_4_pic.o, protected_3.err): New targets.
7118 * testsuite/protected_4.cc: New file.
7119
7120 2010-01-12 Doug Kwan <dougkwan@google.com>
7121
7122 * arm.cc (Cortex_a8_reloc): New class.
7123 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7124 and cortex_a8_relocs_info_.
7125 (Target_arm::fix_cortex_a8): New method definition.
7126 (Target_arm::Cortex_a8_relocs_info): New type.
7127 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7128 New data member declarations.
7129 (Target_arm::scan_reloc_for_stub): Record information about
7130 relocations for THUMB branches that might be exempted from the
7131 Cortex-A8 workaround.
7132 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7133 at the beginning of a relaxation pass.
7134
7135 2010-01-12 Doug Kwan <dougkwan@google.com>
7136
7137 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7138 (Arm_relobj::Mapping_symbol_position,
7139 Arm_reloj::Mapping_symbol_position_less,
7140 Arm_relobj::Mapping_symbols_info): New types.
7141 (Target_arm::is_mapping_symbol_name): New method definition.
7142 (Arm_relobj::do_count_local_symbols): Save information about mapping
7143 symbols.
7144
7145 2010-01-11 Doug Kwan <dougkwan@google.com>
7146
7147 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7148 Arm_relocate_functions::thumb32_branch_upper,
7149 Arm_relocate_functions::thumb32_branch_lower,
7150 Arm_relocate_functions::thumb32_cond_branch_offset,
7151 Arm_relocate_functions::thumb32_cond_branch_upper,
7152 Arm_relocate_functions::thumb32_cond_branch_lower,
7153 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7154 branch offset encoding.
7155 (Arm_relocate_functions::thumb_branch_common): Use new branch
7156 offset encoding methods to avoid code duplication.
7157 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7158 (Stub_addend_reader::operator()): Use new branch encoding method
7159 to avoid code duplication.
7160
7161 2010-01-11 Doug Kwan <dougkwan@google.com>
7162
7163 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7164 (Target_arm::do_finalize_sections): Define special EXIDX section
7165 symbols only if referenced.
7166 * gc.h (Garbage_collection::add_reference): New method.
7167 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7168 code duplication.
7169
7170 2010-01-11 Ian Lance Taylor <iant@google.com>
7171
7172 * script.cc (Version_script_info::build_expression_list_lookup):
7173 Change complaing about duplicate wildcard match from error to
7174 warning.
7175
7176 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7177 of 2009-12-30.
7178 (Version_script_info::Version_script_info): Initialize globs_,
7179 default_version_, default_is_global_, and exact_. Don't
7180 initialize globals_ or locals_.
7181 (Version_script_info::build_lookup_tables): Build local symbols
7182 first.
7183 (Version_script_info::unquote): New function.
7184 (Version_script_info::add_exact_match): New function.
7185 (Version_script_info::build_expression_list_lookup): Remove lookup
7186 parameter. Add is_global parameter. Change all callers. Handle
7187 wildcard pattern specially. Unquote pattern. Call
7188 add_exact_match.
7189 (Version_script_info::get_name_to_match): New function.
7190 (Version_script_info::get_symbol_version): New function.
7191 (Version_script_info::get_symbol_version_helper): Remove.
7192 (Version_script_info::check_unmatched_names): Call unquote.
7193 * script.h (class Version_script_info): Change get_symbol_version
7194 to be non-inline and add is_global parameter; change all callers.
7195 Rewrite symbol_is_local. Update declarations. Define struct
7196 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7197 Remove globals_ and locals_ members. Add exact_, globs_,
7198 default_version_, is_global_.
7199 (Version_script_info::Glob): Remove pattern, add expression and
7200 is_global. Update constructor. Change all callers.
7201 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7202 default version.
7203 (Versions::symbol_section_contents): If a symbol is undefined, or
7204 defined in a dynamic object, set the version index to
7205 VER_NDX_LOCAL.
7206 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7207 symbol_is_local.
7208 (Symbol_table::add_from_pluginobj): Likewise.
7209 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7210
7211 2010-01-11 Doug Kwan <dougkwan@google.com>
7212
7213 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7214 (incremental_dump_LDADD): Add linking option for libintl.
7215 * Makefile.in: Regenerate.
7216
7217 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7218
7219 PR gold/11144
7220 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7221 instead of -Ds.
7222 * testsuite/Makefile.in: Regenerated.
7223
7224 2010-01-10 Doug Kwan <dougkwan@google.com>
7225
7226 * options.h (DEFINE_var): Use parentheses around argument varname__
7227 in macro body to avoid any unintended subsequent substitutions.
7228
7229 2010-01-10 Ian Lance Taylor <iant@google.com>
7230
7231 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7232 candidates before doing symbol resolution.
7233
7234 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7235 ODR candidates if only one is weak.
7236
7237 2010-01-08 Ian Lance Taylor <iant@google.com>
7238
7239 * script.cc (Version_script_info::build_expression_list_lookup):
7240 Don't warn about ambiguous version, just record the ambiguity.
7241 (Version_script_info::get_symbol_version_helper): Give error if
7242 version is ambiguous.
7243
7244 2010-01-08 Doug Kwan <dougkwan@google.com>
7245
7246 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7247 prev_data_size_ and prev_addralign_. Remove initializer for
7248 deleted data member has_been_changed_.
7249 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7250 to determine if the table is empty.
7251 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7252 Remove.
7253 (Stub_table::add_reloc_stub): Define method in class definition
7254 instead of just declaring it there.
7255 (Stub_table::add_cortex_a8_stub): New method definition.
7256 (Stub_table::update_data_size_and_addralign): Ditto.
7257 (Stub_table::finalize_stubs): Ditto.
7258 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7259 (Stub_table::do_addralign_): Return address alignment in the
7260 (Stub_table::do_reset_address_and_file_offset): Define method in
7261 class definition instead of declaring it there. Set current data
7262 size to be the data size of the previous pass.
7263 (Stub_table::set_final_data_size): Use current data size as the
7264 final data size.
7265 (Stub_table::relocate_stub): Change parameter type of stub from
7266 Reloc_stub pointer to Stub pointer.
7267 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7268 (Stub_table::Cortex_a8_stub_list): New typedef.
7269 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7270 Stub_table::prev_addralign_): New data member.
7271 (Arm_relobj::Arm_relobj): Initialize data member
7272 section_has_cortex_a8_workaround_.
7273 (Arm_relobj::section_has_cortex_a8_workaround,
7274 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7275 definitions.
7276 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7277 declarations.
7278 (Target_arm::relocate_stub): Change parameter type of stub from
7279 Reloc_stub pointer to Stub pointer.
7280 (Insn_template::size, Insn_template::alignment): Handle
7281 THUMB16_SPECIAL_TYPE.
7282 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7283 Stub_table::update_data_size_and_addralign,
7284 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7285 definitions.
7286 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7287 (Stub_table::do_write): Ditto.
7288 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7289
7290 2010-01-08 Ian Lance Taylor <iant@google.com>
7291
7292 PR 11108
7293 * symtab.h (class Symbol): Remove fields is_target_special_ and
7294 has_plt_offset_. Add field is_defined_in_discarded_section_.
7295 (Symbol::is_defined_in_discarded_section): New function.
7296 (Symbol::set_is_defined_in_discarded_section): New function.
7297 (Symbol::has_plt_offset): Rewrite.
7298 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7299 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7300 Don't initialize is_target_special_ or has_plt_offset_.
7301 Initialize is_defined_in_discarded_section_.
7302 (Symbol_table::add_from_relobj): If appropriate, set
7303 is_defined_in_discarded_section.
7304 * resolve.cc (Symbol::override_base_with_special): Don't test
7305 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7306 * target-reloc.h (relocate_section): Do special handling for
7307 symbols defined in discarded sections for global symbols as well
7308 as local symbols.
7309
7310 2010-01-08 Ian Lance Taylor <iant@google.com>
7311
7312 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7313 the SHT_SYMTAB case.
7314
7315 2010-01-08 Ian Lance Taylor <iant@google.com>
7316
7317 * object.cc (Sized_relobj::do_layout): Don't get confused if
7318 layout_eh_frame returns NULL.
7319
7320 2010-01-08 Ian Lance Taylor <iant@google.com>
7321
7322 PR 11084
7323 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7324 dynamic symbol table, use the normal symbol table.
7325 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7326 symbol table.
7327
7328 2010-01-08 Ian Lance Taylor <iant@google.com>
7329
7330 PR 11072
7331 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7332 sections.
7333
7334 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7335
7336 * version.cc (print_version): Change to "Copyright 2010".
7337
7338 2010-01-08 Ian Lance Taylor <iant@google.com>
7339
7340 PR 10287
7341 PR 11063
7342 * i386.cc (class Target_i386): Change return type of plt_section
7343 to be non-const.
7344 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7345 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7346 tls_desc_rel_ field.
7347 (Output_data_plt_i386::rel_tls_desc): New function.
7348 (Target_i386::rel_tls_desc_section): New function.
7349 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7350 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7351 R_386_TLS_DESC reloc in rel_tls_desc_section.
7352 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7353 Define struct Tlsdesc_info.
7354 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7355 (Target_x86_64::do_reloc_symbol_index): New function.
7356 (Target_x86_64::add_tlsdesc_info): New function.
7357 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7358 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7359 tlsdesc_rel_ field.
7360 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7361 all callers.
7362 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7363 (Target_x86_64::rela_tlsdesc_section): New function.
7364 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7365 handling.
7366 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7367 (Target_x86_64::do_reloc_addend): New function.
7368 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7369 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7370 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7371 (Output_reloc::type): New function.
7372 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7373 (Output_reloc::is_target_specific): New function.
7374 (Output_reloc::target_arg): New function.
7375 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7376 absolute relocs and target specific relocs.
7377 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7378 add_target_specific.
7379 (class Output_data_reloc) [SHT_RELA]: Likewise.
7380 * output.cc (Output_reloc::Output_reloc): Add four new versions
7381 for absolute relocs and target specific relocs.
7382 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7383 (Output_reloc::get_symbol_index): Likewise.
7384 (Output_reloc::local_section_offset): Check that local_sym_index_
7385 is not TARGET_CODE or 0.
7386 (Output_reloc::symbol_value): Likewise.
7387 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7388 reloc.
7389 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7390 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7391 functions.
7392 * layout.cc (add_target_dynamic_tags): Use output section for
7393 DT_PLTRELSZ and DT_JMPREL.
7394
7395 2010-01-07 Ian Lance Taylor <iant@google.com>
7396
7397 PR 11061
7398 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7399 function.
7400 (class Output_data_reloc_generic): Define.
7401 (class Output_data_reloc_base): Change base class to
7402 Output_data_reloc_generic. Change add() method to call
7403 bump_relative_reloc_count for a relative reloc. Remove
7404 sort_relocs_ field.
7405 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7406 to sort_relocs().
7407 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7408 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7409 appropriate.
7410 * layout.h (class Layout): Update declaration.
7411
7412 2010-01-07 Ian Lance Taylor <iant@google.com>
7413
7414 * output.h (class Output_data): Add const version of
7415 output_section and do_output_section.
7416 (class Output_section_data): Add const version of
7417 do_output_section.
7418 (class Output_section): Likewise.
7419 * layout.cc (Layout::add_target_dynamic_tags): New function.
7420 * layout.h (class Layout): Update declarations.
7421 * arm.cc (Target_arm::do_finalize_sections): Use
7422 add_target_dynamic_tags.
7423 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7424 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7425 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7426 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7427
7428 2010-01-07 Ian Lance Taylor <iant@google.com>
7429
7430 PR 11042
7431 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7432 object as needed.
7433
7434 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7435 Ian Lance Taylor <iant@google.com>
7436
7437 PR 11019
7438 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7439 Xindex::read_symtab_xindex.
7440
7441 2010-01-07 Doug Kwan <dougkwan@google.com>
7442
7443 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7444 (Insn_template::thumb16_bcond_insn): New method declaration.
7445 (Insn_template): Fix spelling.
7446 (Stub::thumb16_special): New method declaration.
7447 (Stub::do_write): Define virtual method which was previously pure
7448 virtual.
7449 (Stub::do_thumb16_special): New method declaration.
7450 (Stub::do_fixed_endian_write): New template member.
7451 (Reloc_stub::do_write): Remove.
7452 (Reloc_stub::do_fixed_endian_write): Remove.
7453 (Cortex_a8_stub): New class definition.
7454 (Stub_factory::make_cortex_a8_stub): New method definition.
7455 (Stub_factory::Stub_factory): Add missing static storage class
7456 qualifier for elf32_arm_stub_a8_veneer_blx.
7457
7458 2010-01-07 Ian Lance Taylor <iant@google.com>
7459
7460 PR 10980
7461 * options.h (class General_options): Add --warn-unresolved-symbols
7462 and --error-unresolved-symbols.
7463 * errors.cc (Errors::undefined_symbol): Implement
7464 --warn-unresolved-symbols.
7465
7466 * options.h (class General_options): Add -z text and -z textoff.
7467 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7468
7469 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7470
7471 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7472 (Garbage_collection::cident_sections): New function.
7473 (Garbage_collection::add_cident_section): New function.
7474 (Garbage_collection::cident_sections_): New member.
7475 (gc_process_relocs): Add references to sections whose names are C
7476 identifiers.
7477 * gold.h (cident_section_start_prefix): New constant.
7478 (cident_section_stop_prefix): New constant.
7479 (is_cident): New function.
7480 * layout.cc (Layout::define_section_symbols): Replace string constants
7481 with the newly defined constants.
7482 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7483 C identifiers.
7484 * testsuite/Makefile.am: Add gc_orphan_section_test.
7485 * testsuite/Makefile.in: Regenerate.
7486 * testsuite/gc_orphan_section_test.cc: New file.
7487 * testsuite/gc_orphan_section_test.sh: New file.
7488
7489 2010-01-06 Ian Lance Taylor <iant@google.com>
7490
7491 PR 10980
7492 * options.h (class General_options): Add --warn-shared-textrel.
7493 * layout.cc (Layout::finish_dynamic_section): Implement
7494 --warn-shared-textrel.
7495
7496 PR 10980
7497 * options.h (class General_options): Add --warn-multiple-gp.
7498
7499 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7500
7501 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7502 $(THREADSLIB) and $(LIBDL).
7503 * Makefile.in: Rebuild.
7504
7505 2010-01-06 Ian Lance Taylor <iant@google.com>
7506
7507 PR 10980
7508 * options.cc (General_options::parse_section_start): New function.
7509 (General_options::section_start): New function.
7510 (General_options::General_options): Initialize all members.
7511 * options.h: Include <map>
7512 (class General_options): Add --section-start. Add section_starts_
7513 member.
7514 * layout.cc (Layout::attach_allocated_section_to_segment): If
7515 --section-start was used, set the address of the segment. Remove
7516 local sort_sections.
7517 (Layout::relaxation_loop_body): If the address of the load segment
7518 has been set by --section-start, don't use it.
7519 * output.h (Output_segment::update_flags_for_output_section): New
7520 function.
7521 * output.cc (Output_segment::add_output_section): Call
7522 update_flags_for_output_section.
7523
7524 2010-01-05 Ian Lance Taylor <iant@google.com>
7525
7526 PR 10980
7527 * options.h (class General_options): Add --undefined-version.
7528 * script.cc (struct Version_expression): Add was_matched_by_symbol
7529 field.
7530 (Version_script_info::matched_symbol): New function.
7531 (Version_script_info::get_symbol_version_helper): Call
7532 matched_symbol.
7533 (Version_script_info::check_unmatched_names): New function.
7534 * script.h (class Version_script_info): Update declarations.
7535 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7536
7537 * options.h (class General_options): Use DEFINE_bool_alias for
7538 allow_multiple_definition.
7539 * resolve.cc (Symbol_table::should_override): Don't test
7540 allow_multiple_definition.
7541
7542 PR 10980
7543 * options.h (class General_options): Add --cref.
7544 * main.cc (main): Print cref table if --cref. Don't close mapfile
7545 until after printing cref table.
7546 * cref.cc: Include "symtab.h".
7547 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7548 (Cref_table_compare::operator()): New function.
7549 (Cref_inputs::gather_cref): New function.
7550 (filecol): New static const.
7551 (Cref_inputs::print_cref): New function.
7552 (Cref::print_cref): New function.
7553 * cref.h: Include <cstdio>.
7554 (class Cref): Update declarations.
7555 * mapfile.h (Mapfile::file): New function.
7556 * object.h (class Object): Define Symbols. Declare virtual
7557 do_get_global_symbols.
7558 (Object::get_global_symbols): New function.
7559 * object.cc (Input_objects::add_object): Pass object to cref_ if
7560 --cref.
7561 (Input_objects::archive_start): Likewise.
7562 (Input_objects::archive_stop): Likewise.
7563 (Input_objects::print_cref): New function.
7564 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7565 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7566 --cref.
7567 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7568 function.
7569 * plugin.h (class Sized_pluginobj): Update declarations.
7570
7571 2010-01-05 Ian Lance Taylor <iant@google.com>
7572
7573 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7574 to is_default_version. Rename insdef to insdefault.
7575 (Symbol_table::add_from_relobj): Rename def to is_default_version
7576 and local to is_forced_local.
7577 (Symbol_table::add_from_pluginobj): Likewise.
7578 (Symbol_table::add_from_dynobj): Likewise.
7579 (Symbol_table::define_special_symbol): Rename insdef to
7580 insdefault.
7581
7582 2010-01-04 Ian Lance Taylor <iant@google.com>
7583
7584 PR 10980
7585 * options.h (class General_options): Add
7586 --allow-multiple-definition and -z muldefs.
7587 * resolve.cc (Symbol_table::should_override): Don't warn about a
7588 multiple symbol definition if --allow-multiple-definition or -z
7589 muldefs.
7590
7591 PR 10980
7592 * options.h (class General_options): Add --add-needed and
7593 --copy-dt-needed-entries. Tweak --as-needed help entry.
7594 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7595 error if --copy-dt-needed-entries aka --add-needed is used and
7596 would cause a change in behaviour.
7597
7598 PR 10980
7599 * options.h (class General_options): Add -G as a short version of
7600 --shared. Add no-op options -assert, -g, and -i.
7601
7602 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7603
7604 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7605 check for .text or .gnu.linkonce.t sections.
7606 * icf.cc (Icf::find_identical_sections): Ditto.
7607 Change the detection for mangled function name within the section
7608 name.
7609 * icf.h (is_section_foldable_candidate): New function.
7610
7611 2009-12-30 Ian Lance Taylor <iant@google.com>
7612
7613 PR 10980
7614 * options.h (class General_options): Permit two dashes with
7615 --retain-symbols-file.
7616
7617 2009-12-30 Ian Lance Taylor <iant@google.com>
7618
7619 PR 10979
7620 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7621 don't put the file header and segment headers in the text
7622 segment.
7623
7624 PR 10979
7625 * common.cc (Sort_commons::operator()): Stabilize sort when both
7626 entries are NULL.
7627 (Symbol_table::do_allocate_commons_list): When allocating common
7628 symbols, skip a symbol which is no longer common.
7629 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7630 an object before checking its type.
7631 * testsuite/common_test_2.c: New file.
7632 * testsuite/common_test_3.c: New file.
7633 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7634 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7635 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7636 (common_test_2_pic.o, common_test_2.so): New targets.
7637 (common_test_3_pic.o, common_test_3.so): New targets.
7638 * testsuite/Makefile.in: Rebuild.
7639
7640 PR 10979
7641 * script.cc (read_input_script): If we see a new SECTIONS clause,
7642 and we have added an input section, give an error.
7643 * layout.h (class Layout): Add have_added_input_section function.
7644 Add have_added_input_section_ field.
7645 * layout.cc (Layout::Layout): Initialize
7646 have_added_input_section_.
7647 (Layout::layout): Set have_added_input_section_.
7648 (Layout::layout_eh_frame): Likewise.
7649
7650 2009-12-30 Ian Lance Taylor <iant@google.com>
7651
7652 PR 10931
7653 * options.h (class General_options): Add --sort-common option.
7654 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7655 * common.cc (Sort_common): Add sort_order parameter to
7656 constructor. Add sort_order_ field.
7657 (Sort_commons::operator): Check sort_order_.
7658 (Symbol_table::allocate_commons): Determine the sort order.
7659 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7660 Change all callers.
7661 (Symbol_table::do_allocate_commons_list): Likewise.
7662
7663 2009-12-30 Ian Lance Taylor <iant@google.com>
7664
7665 PR 10916
7666 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7667 symbols from this object, don't change the visibility of an
7668 undefined symbol.
7669 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7670
7671 2009-12-30 Ian Lance Taylor <iant@google.com>
7672
7673 PR 10861
7674 * script.h (class Version_script_info): Define Language enum.
7675 Update declarations. Define Glob, Exact, and Lookup types. Add
7676 new fields globals_, locals_, and is_finalized_.
7677 * script.cc: Various formatting fixes.
7678 (class Parser_closure): Change language_stack_ from a vector of
7679 std::string to one of Version_script_info::Language. Adjust all
7680 uses accordingly.
7681 (class Lazy_demangler): Remove.
7682 (struct Version_expression): Change language from std::string to
7683 Version_script_info::Language.
7684 (Version_script_info::Version_script_info): New function.
7685 (Version_script_info::~Version_script_info): Don't call clear.
7686 (Version_script_info::finalize): New function.
7687 (Version_script_info::build_lookup_tables): New function.
7688 (Version_script_info::build_expression_list_lookup): New
7689 function.
7690 (Version_script_info::get_symbol_version_helper): Rewrite to use
7691 lookup tables.
7692 (Version_script_info::print_expression_list): Adjust to use
7693 Version_script_info::Language.
7694 (script_push_lex_into_version_mode): Check that the version script
7695 has not been finalized.
7696 (version_script_push_lang): Change language string to
7697 Version_script_info::Language.
7698 * options.cc (Command_line::version_script): New function.
7699 * options.h (class General_options): Add finalize_dynamic_list
7700 function. Change version_script from declaration to definition.
7701 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7702 * testsuite/version_script.map: Remove duplicate def of foo.
7703 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7704 version_script.map.
7705 * testsuite/Makefile.in: Rebuild.
7706
7707 2009-12-30 Ian Lance Taylor <iant@google.com>
7708
7709 PR 10843
7710 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7711 if the input symbol index is 0, make the output symbol index 0.
7712
7713 2009-12-30 Ian Lance Taylor <iant@google.com>
7714
7715 PR 10670
7716 * options.h (class General_options): Add -x/--discard-all.
7717 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7718 --discard-all. If the local symbol needs a dynamic entry, check
7719 that before handling --discard-locals.
7720
7721 2009-12-30 Ian Lance Taylor <iant@google.com>
7722
7723 PR 10450
7724 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7725 flags to PF_R.
7726 (Output_segment::add_output_section): Don't change the flags if
7727 the type is PT_TLS.
7728
7729 PR 10450
7730 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7731 GNU hash table if they need a dynamic value. Otherwise, don't add
7732 them if they are defined in a dynamic object or are forced local.
7733
7734 2009-12-29 Ian Lance Taylor <iant@google.com>
7735
7736 PR 10450
7737 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7738 .gnu.hash table for a 32-bit target.
7739
7740 PR 10450
7741 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7742 regular and a dynamic object only needs a dynamic symbol table
7743 entry if it is externally visible.
7744
7745 PR 10450
7746 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7747 constructor. Add global_offset_table_ field.
7748 (Target_i386::got_section): Set global_offset_table_.
7749 (Target_i386::do_finalize_sections): Set global_offset_table_
7750 size.
7751 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7752 in constructor. Add global_offset_table_ field.
7753 (Target_x86_64::got_section): Set global_offset_table_.
7754 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7755 size.
7756
7757 * layout.cc (Layout::Layout): Initialize increase_relro_.
7758 (Layout::get_output_section): Add is_relro, is_last_relro, and
7759 is_first_non_relro parameters. Change all callers.
7760 (Layout::choose_output_section): Likewise.
7761 (Layout::add_output_section_data): Likewise.
7762 (Layout::make_output_section): Likewise.
7763 (Layout::set_segment_offsets): Clear increase_relro when using a
7764 linker script.
7765 * layout.h (class Layout): Add increase_relro method. Add
7766 increase_relro_ field. Update declarations.
7767 * output.cc (Output_section::Output_section): Initialize
7768 is_last_relro_ and is_first_non_relro_.
7769 (Output_segment::add_output_section): Group relro sections is
7770 do_sort is true. Handle is_last_relro and is_first_non_relro.
7771 (Output_segment::maximum_alignment): Remove relro handling.
7772 (Output_segment::set_section_addresses): Add increase_relro
7773 parameter. Change all callers. Add initial alignment to align
7774 relro sections on separate page. Remove old relro handling.
7775 (Output_segment::set_section_list_addresses): Remove in_relro
7776 parameter. Change all callers.
7777 (Output_segment::set_offset): Add increase parameter. Change all
7778 callers. Remove old relro handling.
7779 * output.h (class Output_section): Add new methods: is_last_relro,
7780 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7781 Add is_last_relro_ and is_first_non_relro_ fields.
7782 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7783 Create separate .got.plt section. Call increase_relro.
7784 * x86_64.cc (Target_x86_64::got_section): Likewise.
7785 * testsuite/relro_script_test.t: Add .got.plt.
7786
7787 PR 10450
7788 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7789 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7790 (Layout::finalize): Call set_dynamic_symbol_size.
7791 (Layout::set_dynamic_symbol_size): New function.
7792 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7793 set_dynamic_symbol_size.
7794
7795 PR 10450
7796 * output.h (class Output_section): Add is_entsize_zero_ field.
7797 * output.cc (Output_section::Output_section): Initialize
7798 is_entsize_zero_.
7799 (Output_section::set_entsize): If two different entsizes are
7800 requested, force it to zero.
7801 (Output_section::add_input_section): Set flags for .debug_str
7802 before updating section flags. Set entsize.
7803 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7804 and SHF_STRING if all input sections have those flags.
7805
7806 2009-12-29 Rafael Espindola <espindola@google.com>
7807
7808 * main.cc (main): Fix the sys time reporting.
7809 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7810 reporting.
7811
7812 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7813
7814 * options.cc (General_options::parse_version): Allow -v to exit
7815 without an error if there is nothing to link.
7816
7817 2009-12-29 Ian Lance Taylor <iant@google.com>
7818
7819 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7820 using a version of gcc before 4.1.
7821 * configure: Rebuild.
7822
7823 2009-12-28 Chris Demetriou <cgd@google.com>
7824
7825 * attributes.cc (Output_attributes_section_data::do_write): Use
7826 std::vector::front rather than std::vector::data.
7827
7828 2009-12-28 Ian Lance Taylor <iant@google.com>
7829
7830 * symtab.h (class Symbol_table): Add enum Defined.
7831 * resolve.cc (Symbol_table::should_override): Add defined
7832 parameter. Change all callers. Test whether object is NULL
7833 before calling a method on it.
7834 (Symbol_table::report_resolve_problem): Add defined parameter.
7835 Change all callers.
7836 (Symbol_table::should_override_with_special): Likewise.
7837 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7838 parameter. Change all callers.
7839 (Symbol_table::do_define_in_output_data): Likewise.
7840 (Symbol_table::define_in_output_segment): Likewise.
7841 (Symbol_table::do_define_in_output_segment): Likewise.
7842 (Symbol_table::define_as_constant): Likewise.
7843 (Symbol_table::do_define_as_constant): Likewise.
7844 * script.h (class Symbol_assignment): Add is_defsym parameter to
7845 constructor; change all callers.
7846 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7847 parameter. Change all callers. Add is_defsym_ field.
7848 (class Parser_closure): Add parsing_defsym parameter to
7849 constructor; change all callers. Add parsing_defsym accessor
7850 function. Add parsing_defsym_ field.
7851
7852 2009-12-28 Ian Lance Taylor <iant@google.com>
7853
7854 * gold.cc (queue_middle_tasks): Fix formatting.
7855 * object.cc (Relobj::is_section_name_included): Likewise.
7856
7857 2009-12-23 Ian Lance Taylor <iant@google.com>
7858
7859 * i386.cc (Target_i386::do_calls_non_split): Recognize
7860 -fsplit-stack prologue for a function with a static chain.
7861 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7862 -fsplit-stack prologue when using %r11.
7863
7864 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7865
7866 * options.cc (General_options::parse_version): Make -v continue and do
7867 the link like GNU ld does.
7868
7869 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7870
7871 * Makefile.am (CCFILES): Add timer.cc.
7872 (HFILES): Add timer.h.
7873 * configure.ac: Check for sysconf and times.
7874 * main.cc: include timer.h.
7875 (main): Use Timer instead of get_run_time.
7876 * timer.cc: New.
7877 * timer.h: New.
7878 * workqueue.cc: include timer.h.
7879 (Workqueue::find_and_run_task):
7880 Report user, sys and wall time.
7881 * Makefile.in: Regenerate.
7882 * config.in: Regenerate.
7883 * configure: Regenerate.
7884
7885 2009-12-16 Doug Kwan <dougkwan@google.com>
7886
7887 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7888 sections.
7889 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7890 relaxed input sections.
7891 * output.cc (Output_section::find_relaxed_input_section): Change
7892 return type to Output_relaxed_input_section pointer. Adjust code
7893 for new type of relaxed_input_section_map_.
7894 * output.h (Output_section::find_relaxed_input_section): Change
7895 return type to Output_relaxed_input_section pointer.
7896 (Output_section::Output_relaxed_input_section_by_input_section_map):
7897 New type.
7898 (Output_section::relaxed_input_section_map_): Change type to
7899 Output_section::Output_relaxed_input_section_by_input_section_map.
7900 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7901 input section.
7902
7903 2009-12-15 Ian Lance Taylor <iant@google.com>
7904
7905 * layout.cc (Layout::create_shstrtab): Only write out after input
7906 sections if we are compressing debug sections.
7907
7908 2009-12-15 Ian Lance Taylor <iant@google.com>
7909
7910 * archive.cc (Archive::add_symbols): Only look up a symbol without
7911 a version if there is, in fact, a version.
7912
7913 2009-12-14 Ian Lance Taylor <iant@google.com>
7914
7915 Revert -Wshadow changes, all changes from:
7916 2009-12-11 Doug Kwan <dougkwan@google.com>
7917 2009-12-11 Nick Clifton <nickc@redhat.com>
7918 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7919
7920 2009-12-11 Doug Kwan <dougkwan@google.com>
7921
7922 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7923 due to -Wshadow.
7924 * attributes.cc (Object_attribute::size): Ditto.
7925 (Attributes_section_data::size): Ditto.
7926 (Attributes_section_data::Attributes_section_data): Ditto.
7927 (Output_attributes_section_data::do_write): Ditto.
7928 * attributes.h (Object_attribute::set_type): Ditto.
7929 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7930
7931 2009-12-11 Nick Clifton <nickc@redhat.com>
7932
7933 * archive.cc: Fix shadowed variable warnings.
7934 * arm.cc: Likewise.
7935 * compressed_output.cc: Likewise.
7936 * compressed_output.h: Likewise.
7937 * configure: Likewise.
7938 * dwarf_reader.cc: Likewise.
7939 * dynobj.cc: Likewise.
7940 * dynobj.h: Likewise.
7941 * ehframe.cc: Likewise.
7942 * ehframe.h: Likewise.
7943 * errors.cc: Likewise.
7944 * expression.cc: Likewise.
7945 * fileread.cc: Likewise.
7946 * fileread.h: Likewise.
7947 * freebsd.h: Likewise.
7948 * i386.cc: Likewise.
7949 * icf.cc: Likewise.
7950 * incremental.h: Likewise.
7951 * layout.cc: Likewise.
7952 * layout.h: Likewise.
7953 * mapfile.cc: Likewise.
7954 * merge.cc: Likewise.
7955 * merge.h: Likewise.
7956 * object.cc: Likewise.
7957 * object.h: Likewise.
7958 * options.h: Likewise.
7959 * output.cc: Likewise.
7960 * output.h: Likewise.
7961 * parameters.cc: Likewise.
7962 * plugin.cc: Likewise.
7963 * powerpc.cc: Likewise.
7964 * reduced_debug_output.cc: Likewise.
7965 * reduced_debug_output.h: Likewise.
7966 * reloc.cc: Likewise.
7967 * reloc.h: Likewise.
7968 * resolve.cc: Likewise.
7969 * script-sections.cc: Likewise.
7970 * script.cc: Likewise.
7971 * script.h: Likewise.
7972 * sparc.cc: Likewise.
7973 * symtab.cc: Likewise.
7974 * symtab.h: Likewise.
7975 * target-select.cc: Likewise.
7976 * target-select.h: Likewise.
7977 * token.h: Likewise.
7978 * workqueue.cc: Likewise.
7979 * workqueue.h: Likewise.
7980 * x86_64.cc: Likewise.
7981
7982 2009-12-10 Doug Kwan <dougkwan@google.com>
7983
7984 * arm.cc (attributes.h): New include.
7985 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7986 (Arm_relobj::~Arm_relobj): Delete object pointed by
7987 attributes_section_data_.
7988 (Arm_relobj::attributes_section_data): New method definition.
7989 (Arm_relobj::attributes_section_data_): New data member declaration.
7990 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7991 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7992 attributes_section_data_.
7993 (Arm_dynobj::attributes_section_data): New method definition.
7994 (Arm_dynobj::attributes_section_data_): New data member declaration.
7995 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7996 initialization value of may_use_blx_ to false.
7997 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7998 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7999 object attributes to compute results instead of hard-coding.
8000 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8001 Target_arm::get_secondary_compatible_arch,
8002 Target_arm::set_secondary_compatible_arch
8003 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8004 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8005 New method declarations.
8006 (Target_arm::get_aeabi_object_attribute): New method definition.
8007 (Target_arm::attributes_section_data_): New data member declaration.
8008 (read_arm_attributes_section): New template definition.
8009 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8010 (Arm_dynobj::do_read_symbols): Ditto.
8011 (Target_arm::do_finalize_sections): Merge attributes sections from
8012 input. Check for BLX use after attributes section merging.
8013 Fix __exidx_start and __exidx_end visibility. Create an
8014 .ARM.attributes section if necessary.
8015 (Target_arm::get_secondary_compatible_arch,
8016 Target_arm::set_secondary_compatible_arch,
8017 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8018 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8019 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8020 New method definitions.
8021
8022 2009-12-09 Ian Lance Taylor <iant@google.com>
8023
8024 * plugin.cc (Plugin::load): Don't cast from void* to a function
8025 pointer.
8026
8027 2009-12-09 Ian Lance Taylor <iant@google.com>
8028
8029 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8030 information fields.
8031
8032 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8033
8034 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8035 Replace two_file_shared_1.so with two_file_shared_2.so.
8036 * testsuite/Makefile.in: Regenerated.
8037
8038 2009-12-08 Doug Kwan <dougkwan@google.com>
8039
8040 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8041 (HFILES): Add attributes.h and int_encoding.h.
8042 * Makefile.in: Regenerate.
8043 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8044 function definitions to int_encoding.cc
8045 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8046 prototypes to int_encoding.h
8047 * reduced_debug_output.cc (int_encoding.h): New include.
8048 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8049 function definitions to int_encoding.cc
8050 (insert_into_vector, read_from_pointer): Move template definitions to
8051 int_encoding.h
8052 * attributes.cc: New file.
8053 * attributes.h: New file.
8054 * int_encoding.cc: New file.
8055 * int_encoding.h: New file.
8056
8057 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8058
8059 PR gold/11055
8060 * incremental-dump.cc (dump_incremental_inputs): New.
8061 (main): Use dump_incremental_inputs.
8062
8063 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8064
8065 PR gold/10893
8066 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8067 checking elfcpp::STT_FUNC.
8068 (Target_i386::Relocate::relocate): Likewise.
8069 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8070
8071 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8072 symbols from shared libraries into normal FUNC symbols.
8073
8074 * symtab.h (Symbol): Add is_func and use it.
8075
8076 2009-12-05 Doug Kwan <dougkwan@google.com>
8077
8078 * arm.cc (Target_arm::arm_info): Initialize new fields
8079 attributes_section and attributes_vendor.
8080 * i386.cc (Target_i386::i386_info): Same.
8081 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8082 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8083 fields attributes_section and attributes_vendor.
8084 * sparc.cc (Target_sparc::sparc_info): Same.
8085 * target.h (Target::attributes_section, Target::attributes_vendor,
8086 Target::is_attributes_section, Target::attribute_arg_type,
8087 Target::attributes_order): New method definitions.
8088 (Target::Target_info::attributes_section,
8089 Target::Target_info::attributes_vendor): New fields.
8090 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8091 virtual method definitions.
8092 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8093 attributes_section and attributes_vendor.
8094 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8095
8096 2009-12-05 Doug Kwan <dougkwan@google.com>
8097
8098 * arm.cc: Update comments about interworking and stub generation.
8099 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8100 considered as non-PIC.
8101 (Arm_relocate_functions::base_abs): Fix formatting.
8102 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8103 of function to use GOT entry address instead of offset.
8104 (Target_arm::Scan::global): Issue an error if a symbol would need a
8105 PLT does not get one because it is untyped. Remove code to create
8106 dynamic symbols for relative branches.
8107 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8108 takes unsigned integer instead of boolean.
8109
8110 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8111
8112 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8113 (two_file_test_LDADD): Likewise.
8114 (common_test_1_LDADD): Likewise.
8115 (exception_test_LDADD) Likewise.
8116 (weak_test_LDADD): Likewise.
8117 (many_sections_test_LDADD): Likewise.
8118 (initpri1_LDADD): Likewise.
8119 (script_test_1_LDADD): Likewise.
8120 (script_test_2_LDADD): Likewise.
8121 (justsyms_LDADD): Likewise.
8122 (binary_test_LDADD): Likewise.
8123 (large_LDADD): Likewise.
8124 * testsuite/Makefile.in: Regenerated.
8125
8126 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8127
8128 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8129 (Symbol_table::override_with_special): Likewise.
8130 (Symbol_table::add_from_object): Likewise.
8131
8132 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8133
8134 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8135 Don't set the data_offset twice.
8136
8137 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8138
8139 * testsuite/Makefile.in: Regenerate.
8140
8141 2009-12-03 Doug Kwan <dougkwan@google.com>
8142
8143 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8144 (Target_arm::do_finalize_sections): Add parameter for symbol table
8145 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8146 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8147 parameter for symbol table pointer.
8148 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8149 an additional parameter for a pointer to symbol table.
8150 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8151 parameter for a symbol table pointer.
8152 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8153 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8154 Ditto.
8155 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8156 parameter for a symbol table pointer.
8157
8158 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8159
8160 * incremental.cc (Incremental_inputs_header)
8161 (Incremental_inputs_header_write, Incremental_inputs_entry)
8162 (Incremental_inputs_entry_write): Move ...
8163 * incremental.h (Incremental_inputs_header)
8164 (Incremental_inputs_header_write, Incremental_inputs_entry)
8165 (Incremental_inputs_entry_write): here.
8166
8167 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8168
8169 * incremental.cc (make_sized_incremental_binary): Set the target.
8170 Error if it is incompatible.
8171 * output.h (Output_file): Add filename method.
8172
8173 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8174
8175 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8176 from the get_* methods.
8177
8178 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8179
8180 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8181 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8182 Write 0 for the data_offset of scripts.
8183
8184 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8185
8186 * testsuite/Makefile.am: Add the incremental_test.sh test.
8187 * testsuite/incremental_test.sh: New.
8188 * testsuite/incremental_test_1.c: New.
8189 * testsuite/incremental_test_2.c: New.
8190
8191 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8192
8193 * incremental-dump.cc (main): Fix typos.
8194
8195 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8196
8197 PR gold/11025
8198 * incremental-dump.cc (main): Use llu to print 64 bit values.
8199
8200 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8201 H.J. Lu <hongjiu.lu@intel.com>
8202
8203 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8204 $(LIBDL).
8205 (incremental_dump_LDADD): Likewise.
8206 * Makefile.in: Regenerated.
8207
8208 2009-11-25 Doug Kwan <dougkwan@google.com>
8209
8210 Revert:
8211
8212 2009-11-25 Doug Kwan <dougkwan@google.com>
8213
8214 * arm.cc (Target_arm::Target_arm): Move method definition
8215 outside of class definition. Add code to handle
8216 --target1-rel, --target1-abs and --target2= options.
8217 (Target_arm::get_reloc_reloc_type): Change method to be
8218 non-static and const.
8219 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8220 New data member declaration.
8221 (Target_arm::Scan::local, Target_arm::Scan::global,
8222 Target_arm::Relocate::relocate,
8223 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8224 Adjust call to Target_arm::get_real_reloc_type.
8225 (Target_arm::get_real_reloc_type): Use command line options
8226 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8227 * options.h (--target1-rel, --target1-abs, --target2): New
8228 ARM-only options.
8229
8230 2009-11-25 Doug Kwan <dougkwan@google.com>
8231
8232 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8233 class definition. Add code to handle --target1-rel, --target1-abs
8234 and --target2= options.
8235 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8236 and const.
8237 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8238 member declaration.
8239 (Target_arm::Scan::local, Target_arm::Scan::global,
8240 Target_arm::Relocate::relocate,
8241 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8242 call to Target_arm::get_real_reloc_type.
8243 (Target_arm::get_real_reloc_type): Use command line options to
8244 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8245 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8246 options.
8247
8248 2009-11-25 Doug Kwan <dougkwan@google.com>
8249
8250 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8251 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8252 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8253 formatting.
8254 (Arm_relocate_functions::thm_call): Replace body with a call to
8255 Arm_relocate_functions::thumb_branch_common.
8256 (Arm_relocate_functions::thm_jump24,
8257 Arm_relocate_functions::thm_xpc22): New method definitions.
8258 (Arm_relocate_functions::thumb_branch_common): New method definition.
8259 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8260 operator.
8261 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8262 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8263
8264 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8265
8266 * Makefile.am: Build incremental-dump
8267 * Makefile.in: Regenerate.
8268 * incremental-dump.cc: New.
8269 * incremental.cc (Incremental_inputs_header_data,
8270 Incremental_inputs_entry_data): Move to incremental.h
8271 * incremental.h: (Incremental_inputs_header_data,
8272 Incremental_inputs_entry_data): Move from incremental.cc
8273
8274 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8275
8276 * incremental.cc (Incremental_inputs_header,
8277 Incremental_inputs_header_write, Incremental_inputs_entry,
8278 Incremental_inputs_entry_write): Add a typedef with the data type.
8279
8280 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8281
8282 * incremental.cc (Incremental_inputs_header,
8283 Incremental_inputs_header_write, Incremental_inputs_entry,
8284 Incremental_inputs_entry_write): Update comment about which
8285 type has the filed descriptions.
8286
8287 2009-11-15 Doug Kwan <dougkwan@google.com>
8288
8289 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8290 (Arm_relocate_functions::arm_branch_common): Change method defintion
8291 in class definition to a method declaration and update list of formal
8292 parameters.
8293 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8294 Arm_relocation_functions::jump24): Adjust call to
8295 Arm_relocate_functions::arm_branch_common. Update list of formal
8296 parameters.
8297 (Arm_relocate_functions::xpc25): New method definition.
8298 (Arm_relocate_functions::arm_branch_common): Move method defintion
8299 out from class definition. Use stubs for mode-switching and extending
8300 branch ranges.
8301 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8302 specially. Change code to enable use of stubs in ARM branches.
8303
8304 2009-11-10 Doug Kwan <dougkwan@google.com>
8305
8306 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8307 in method declaration.
8308 (Target_arm::relocate_stub): New method declaration.
8309 (Target_arm::default_target): Change to return a pointer instead of
8310 a const reference.
8311 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8312 Target_arm::default_target.
8313 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8314 method definition.
8315 (Target_arm::relocate_section): Adjust view.
8316 (Target_arm::relocate_stub): New method definition.
8317
8318 2009-11-10 Doug Kwan <dougkwan@google.com>
8319
8320 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8321 a format warning.
8322 * incremental.cc (open_incremental_binary): Initialized local
8323 variables to avoid warnings.
8324 * object.cc (make_elf_object): Ditto.
8325 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8326 a format warning.
8327
8328 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8329
8330 PR gold/10930
8331 * testsuite/plugin_test.c: Include "config.h".
8332
8333 2009-11-09 Doug Kwan <dougkwan@google.com>
8334
8335 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8336 (arm_symbol_value): Remove.
8337 (Arm_relocate_functions::arm_branch_common,
8338 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8339 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8340 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8341 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8342 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8343 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8344 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8345 Arm_relocate_functions::thm_mobw_abs_nc,
8346 Arm_relocate_functions::thm_mov_abs,
8347 Arm_relocate_functions::movw_prel_nc,
8348 Arm_relocate_functions::thm_movt_abs,
8349 Arm_relocate_functions::movt_prel,
8350 Arm_relocate_functions::thm_movw_prel_nc,
8351 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8352 (Target_arm::Relocate::relocate): Only decompose address into two
8353 parts if relocation type uses the thumb-bit and pass the actual
8354 bit instead of a flag indicating that the thumb-bit is used. Adjust
8355 calls to methods in Arm_relocate_functions for this change.
8356
8357 2009-11-08 Ian Lance Taylor <iant@google.com>
8358
8359 PR 10925
8360 * reloc.cc: Instantiate
8361 Sized_relobj::initialize_input_to_output_maps and
8362 Sized_relobj:free_input_to_output_maps.
8363
8364 2009-11-06 Ian Lance Taylor <iant@google.com>
8365
8366 PR 10876
8367 * defstd.cc (in_segment): Set only_if_ref true for "end".
8368
8369 2009-11-06 Doug Kwan <dougkwan@google.com>
8370
8371 * arm.cc (class Reloc_stub): Correct a comment.
8372 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8373 (Target_arm::scan_section_for_stubs): New method declaration.
8374 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8375 Change methods from private to protected.
8376 (Target_arm::do_may_relax): New method definition.
8377 (Target_arm::do_relax, Target_arm::group_sections,
8378 Target_arm::scan_reloc_for_stub,
8379 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8380 (Target_arm::arm_input_section_map_): New data member declaration.
8381 (Target_arm::scan_reloc_for_stub,
8382 Target_arm::scan_reloc_section_for_stubs,
8383 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8384 Target_arm::do_relax): New method definitions.
8385
8386 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8387
8388 * configure.ac: Check for (struct stat)::st_mtim
8389 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8390 * config.in: Regenerate.
8391 * configure: Regenerate.
8392
8393 2009-11-05 Ian Lance Taylor <iant@google.com>
8394
8395 PR 10910
8396 * output.cc (Output_segment::add_output_section): Add missing
8397 return statement.
8398
8399 2009-11-04 Ian Lance Taylor <iant@google.com>
8400
8401 PR 10880
8402 * object.h (class Object): Add is_needed and set_is_needed
8403 methods. Add is_needed_ field. Make bool fields into bitfields.
8404 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8405 defined in a dynamic object and referenced by a regular object,
8406 set is_needed for the dynamic object.
8407 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8408 if the file is marked with as_needed and it is not needed.
8409
8410 2009-11-04 Ian Lance Taylor <iant@google.com>
8411
8412 PR 10887
8413 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8414 tags if data is discarded by linker script.
8415 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8416 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8417 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8418 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8419
8420 2009-11-04 Ian Lance Taylor <iant@google.com>
8421
8422 * layout.cc (Layout::get_output_section): Add is_interp and
8423 is_dynamic_linker_section parameters. Change all callers.
8424 (Layout::choose_output_section): Likewise.
8425 (Layout::make_output_section): Likewise.
8426 (Layout::add_output_section_data): Add is_dynamic_linker_section
8427 parameter. Change all callers.
8428 * layout.h (class Layout): Update declarations.
8429 * output.h (class Output_section): Add is_interp, set_is_interp,
8430 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8431 Add is_interp_, is_dynamic_linker_section_ fields. Change
8432 generate_code_fills_at_write_ to a bitfield.
8433 * output.cc (Output_section::Output_sections): Initialize new
8434 fields.
8435 (Output_segment::add_output_section): Add do_sort parameter.
8436 Change all callers.
8437
8438 2009-11-03 Ian Lance Taylor <iant@google.com>
8439
8440 PR 10860
8441 * options.h (class General_options): Add --warn-common.
8442 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8443 merging two common symbols.
8444 (Symbol_table::should_override): Handle --warn-common when merging
8445 a common symbol with a defined symbol. Use report_resolve_problem
8446 for multiple definitions.
8447 (Symbol_table::report_resolve_problem): New function.
8448 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8449
8450 2009-11-03 Doug Kwan <dougkwan@google.com>
8451
8452 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8453 stub_factory_.
8454 (Target_arm::stub_factory): New method definition.
8455 (Target_arm::new_arm_input_section,
8456 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8457 Target_arm::reloc_uses_thumb_bit): New method declarations.
8458 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8459 New type definitions.
8460 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8461 member declarations.
8462 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8463 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8464 New method definitions.
8465
8466 2009-11-03 Ian Lance Taylor <iant@google.com>
8467
8468 * options.h (class General_options): Add --warn_constructors.
8469
8470 2009-11-03 Ian Lance Taylor <iant@google.com>
8471
8472 PR 10893
8473 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8474 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8475
8476 2009-11-03 Ian Lance Taylor <iant@google.com>
8477
8478 PR 10895
8479 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8480 --msgid-bugs-address.
8481 (install-pdf): New target.
8482 (install-data_yes): Look up one directory to find mkinstalldirs.
8483
8484 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8485
8486 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8487 tree.
8488
8489 2009-10-30 Doug Kwan <dougkwan@google.com>
8490
8491 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8492
8493 2009-10-30 Doug Kwan <dougkwan@google.com>
8494
8495 * arm.cc (Stub_addend_reader): New struct template definition
8496 and partial specializations.
8497 (Stub_addend_reader::operator()): New method definition for a
8498 partially specialized template.
8499
8500 2009-10-30 Doug Kwan <dougkwan@google.com>
8501
8502 * arm.cc (Arm_relobj::processor_specific_flags): New method
8503 definition.
8504 (Arm_relobj::do_read_symbols): New method declaration.
8505 (Arm_relobj::processor_specific_flags_): New data member declaration.
8506 (Arm_dynobj): New class definition.
8507 (Target_arm::do_finalize_sections): Add input_objects parameter.
8508 (Target_arm::do_adjust_elf_header): New method declaration.
8509 (Target_arm::are_eabi_versions_compatible,
8510 (Target_arm::merge_processor_specific_flags): New method declaration.
8511 (Target_arm::do_make_elf_object): New overloaded method definitions
8512 and declaration.
8513 (Arm_relobj::do_read_symbols): New method definition.
8514 (Arm_dynobj::do_read_symbols): Ditto.
8515 (Target_arm::do_finalize_sections): Add input_objects parameters.
8516 Merge processor-specific flags from all input objects.
8517 (Target_arm::are_eabi_versions_compatible,
8518 Target_arm::merge_processor_specific_flags,
8519 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8520 New method definitions.
8521 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8522 Input_objects pointer type parameter.
8523 * layout.cc (Layout::finalize): Pass input objects to target's.
8524 finalize_sections function.
8525 * output.cc (Output_file_header::do_sized_write): Set ELF file
8526 header's processor-specific flags.
8527 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8528 Input_objects pointer type parameter.
8529 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8530 * target.h (Input_objects): New forward class declaration.
8531 (Target::processor_specific_flags,
8532 Target::are_processor_specific_flags_sect): New method definitions.
8533 (Target::finalize_sections): Add input_objects parameter.
8534 (Target::Target): Initialize processor_specific_flags_ and
8535 are_processor_specific_flags_set_.
8536 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8537 parameter.
8538 (Target::set_processor_specific_flags): New method definition.
8539 (Target::processor_specific_flags_,
8540 Target::are_processor_specific_flags_set_): New data member
8541 declarations.
8542 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8543 Input_objects pointer type parameter.
8544
8545 2009-10-30 Doug Kwan <dougkwan@google.com>
8546
8547 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8548
8549 2009-10-28 Ian Lance Taylor <iant@google.com>
8550
8551 * object.h (class Relobj): Drop options parameter from
8552 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8553 do_scan_relocs, do_relocate. Change all callers.
8554 (class Sized_relobj): Drop options parameters from
8555 do_gc_process_relocs, do_scan_relocs, do_relocate,
8556 do_relocate_sections, relocate_sections, emit_relocs_scan,
8557 emit_relocs_scan_reltype. Change all callers.
8558 (struct Relocate_info): Remove options field and all references to
8559 it.
8560 * reloc.h (class Read_relocs): Remove options constructor
8561 parameter and options_ field. Change all callers.
8562 (class Gc_process_relocs, class Scan_relocs): Likewise.
8563 (class Relocate_task): Likewise.
8564 * target-reloc.h (scan_relocs): Remove options parameter. Change
8565 all callers.
8566 (scan_relocatable_relocs): Likewise.
8567 * target.h (class Sized_target): Remove options parameter from
8568 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8569 all callers.
8570 * gc.h (gc_process_relocs): Remove options parameter. Change all
8571 callers.
8572 * arm.cc: Update functions to remove options parameters.
8573 * i386.cc: Likewise.
8574 * powerpc.cc: Likewise.
8575 * sparc.cc: Likewise.
8576 * x86_64.cc: Likewise.
8577 * testsuite/testfile.cc: Likewise.
8578
8579 2009-10-28 Doug Kwan <dougkwan@google.com>
8580
8581 * arm.cc (Arm_relobj): New class definition.
8582 (Arm_relobj::scan_sections_for_stubs,
8583 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8584 New method definitions.
8585
8586 2009-10-28 Cary Coutant <ccoutant@google.com>
8587
8588 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8589 (Plugin::cleanup_done_): New member.
8590 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8591 (Plugin_manager::cleanup_done_): Remove.
8592 (Plugin_manager::add_input_file): Edit error message.
8593 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8594 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8595
8596 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8597
8598 * fileread.cc: (File_read::View::~View): Use the new
8599 data_ownership_ filed.
8600 (File_read::~File_read): Dispose the new whole_file_view_.
8601 (File_read::open): Mmap the whole file if needed.
8602 (File_read::open): Use whole_file_view_ instead of contents_.
8603 (File_read::find_view): Use whole_file_view_ if applicable.
8604 (File_read::do_read): Use whole_file_view_ instead of contents_.
8605 (File_read::make_view): Use whole_file_view_ instead of contents_,
8606 update File_read::View::View call.
8607 (File_read::find_or_make_view): Update File_read::View::View
8608 call.
8609 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8610 remove contents_
8611 (File_read::View::Data_ownership): New enum.
8612 (File_read::View::View): Replace bool mapped_ with Data_ownership
8613 argument.
8614 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8615 (File_read::View::data_ownership_): New field.
8616 (File_read::contents_): Remove (replaced by whole_file_view_).
8617 (File_read::whole_file_view_): New field.
8618 * options.h (class General_options): Add --keep-files-mapped.
8619
8620 2009-10-27 Cary Coutant <ccoutant@google.com>
8621
8622 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8623 * testsuite/Makefile.am (plugin_test_5): New test case.
8624 * testsuite/Makefile.in: Regenerate.
8625
8626 2009-10-25 Doug Kwan <dougkwan@google.com>
8627
8628 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8629 from private to protected to allow access by child class.
8630 (Sized_relobj::do_relocate_sections): New method declaration.
8631 (Sized_relobj::relocate_sections): Virtualize.
8632 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8633 Sized_relobj::relocate_sections. Instantiate template explicitly
8634 for different target sizes and endianity.
8635
8636 2009-10-24 Doug Kwan <dougkwan@google.com>
8637
8638 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8639 (Arm_input_section::as_arm_input_section): New method.
8640 (Arm_output_section): New class definition.
8641 (Arm_output_section::create_stub_group,
8642 Arm_output_section::group_sections): New method definitions.
8643
8644 2009-10-22 Doug Kwan <dougkwan@google.com>
8645
8646 * arm.cc (Arm_input_section): New class definition.
8647 (Arm_input_section::init, Arm_input_section:do_write,
8648 Arm_input_section::set_final_data_size,
8649 Arm_input_section::do_reset_address_and_file_offset): New method
8650 definitions.
8651
8652 2009-10-21 Doug Kwan <dougkwan@google.com>
8653
8654 * arm.cc (Stub_table, Arm_input_section): New forward class
8655 declarations.
8656 (Stub_table): New class defintion.
8657 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8658 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8659 New method definition.
8660
8661 2009-10-21 Doug Kwan <dougkwan@google.com>
8662
8663 * arm.cc: Update copyright comments.
8664 (Target_arm): New forward class template declaration.
8665 (Arm_address): New type.
8666 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8667 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8668 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8669 constants.
8670 (Insn_template): Same.
8671 (DEF_STUBS): New macro.
8672 (Stub_type): New enum type.
8673 (Stub_template): New class definition.
8674 (Stub): Same.
8675 (Reloc_stub): Same.
8676 (Stub_factory): Same.
8677 (Target_arm::Target_arm): Initialize may_use_blx_ and
8678 should_force_pic_veneer_.
8679 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8680 Target_arm::should_force_pic_veneer,
8681 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8682 Target_arm::using_thumb_only, Target_arm:;default_target): New
8683 method defintions.
8684 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8685 New data member declarations.
8686 (Insn_template::size, Insn_template::alignment): New method defintions.
8687 (Stub_template::Stub_template): New method definition.
8688 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8689 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8690 (Stub_factory::Stub_factory): New method definition.
8691 * gold.h (string_hash): New template.
8692 * output.h (Input_section_specifier::hash_value): Use
8693 gold::string_hash.
8694 (Input_section_specifier::string_hash): Remove.
8695 * stringpool.cc (Stringpool_template::string_hash): Use
8696 gold::string_hash.
8697
8698 2009-10-20 Doug Kwan <dougkwan@google.com>
8699
8700 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8701 symbols of relaxed input sections.
8702 * output.h (Output_section::find_relaxed_input_section): Make
8703 method public.
8704
8705 2009-10-16 Doug Kwan <dougkwan@google.com>
8706
8707 * dynobj.cc (Versions::Versions): Initialize version_script_.
8708 Only insert base version symbol definition for a shared object
8709 if version script defines any version versions.
8710 (Versions::define_base_version): New method definition.
8711 (Versions::add_def): Check that base version is not needed.
8712 (Versions::add_need): Define base version lazily.
8713 * dynobj.h (Versions::define_base_version): New method declaration.
8714 (Versions::needs_base_version_): New data member declaration.
8715 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8716 (check_DATA): Add no_version_test.stdout.
8717 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8718 New make rules.
8719 * testsuite/Makefile.in: Regenerate.
8720 * testsuite/no_version_test.c: New file.
8721 * testsuite/no_version_test.sh: Ditto.
8722
8723 2009-10-16 Doug Kwan <dougkwan@google.com>
8724
8725 * expression.cc (class Segment_start_expression): New class definition.
8726 (Segment_start_expression::value): New method definition.
8727 (script_exp_function_segment_start): Return a new
8728 Segment_start_expression.
8729 * gold/script-c.h (script_saw_segment_start_expression): New function
8730 prototype.
8731 * script-sections.cc (Script_sections::Script_sections): Initialize
8732 SAW_SEGMENT_START_EXPRESSION_ to false.
8733 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8734 and -Tbbs options to specify section addresses if given in
8735 command line and no SEGMENT_START expression is seen in a script.
8736 * script-sections.h (Script_sections::saw_segment_start_expression,
8737 Script_sections::set_saw_segment_start_expression): New method
8738 definition.
8739 (Script_sections::saw_segment_start_expression_): New data member
8740 declaration.
8741 * script.cc (script_saw_segment_start_expression): New function.
8742 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8743 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8744 script_test_7.sh and script_test_8.sh.
8745 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8746 script_test_8.stdout.
8747 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8748 (script_test_6, script_test_6.stdout, script_test_7,
8749 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8750 * Makefile.in: Regenerate.
8751 * testsuite/script_test_6.sh: New file.
8752 * testsuite/script_test_6.t: Same.
8753 * testsuite/script_test_7.sh: Same.
8754 * testsuite/script_test_7.t: Same.
8755 * testsuite/script_test_8.sh: Same.
8756
8757 2009-10-16 Doug Kwan <dougkwan@google.com>
8758
8759 * output.cc (Output_segment::set_section_list_address): Cast
8760 expressions to unsigned long long type to avoid format warnings.
8761
8762 2009-10-15 Ian Lance Taylor <iant@google.com>
8763
8764 * script.cc (Script_options::add_symbol_assignment): Always add a
8765 dot assignment to script_sections_.
8766 * script-sections.cc (Script_sections::add_dot_assignment):
8767 Initialize if necessary.
8768
8769 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8770 program headers with no load segment if there is a linker script.
8771
8772 * layout.cc (Layout::set_segment_offsets): Align the file offset
8773 to the segment aligment for -N or -n with no load segment.
8774 * output.cc (Output_segment::add_output_section): Don't crash if
8775 the first section is a TLS section.
8776 (Output_segment::set_section_list_addresses): Print an error
8777 message if the address moves backward in a linker script.
8778 * script-sections.cc
8779 (Output_section_element_input::set_section_addresses): Don't
8780 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8781 (Orphan_output_section::set_section_addresses): Likewise.
8782
8783 2009-10-15 Doug Kwan <dougkwan@google.com>
8784
8785 * layout.cc (Layout::finish_dynamic_section): Generate tags
8786 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8787 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8788 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8789
8790 2009-10-14 Ian Lance Taylor <iant@google.com>
8791
8792 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8793 fields.
8794 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8795 data_shdr fields of relinfo.
8796 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8797 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8798 R_386_TLS_LDO_32, adjust based on section flags.
8799 (Target_i386::Relocate::fix_up_ldo): Remove.
8800
8801 2009-10-13 Ian Lance Taylor <iant@google.com>
8802
8803 Add support for -pie.
8804 * options.h (class General_options): Add -pie and
8805 --pic-executable.
8806 (General_options::output_is_position_independent): Test -pie.
8807 (General_options::output_is_executable): Return true if not shared
8808 and not relocatable.
8809 (General_options::output_is_pie): Remove.
8810 * options.cc (General_options::finalize): Reject incompatible uses
8811 of -pie.
8812 * gold.cc (queue_middle_tasks): A -pie link is not static.
8813 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8814 * symtab.cc (Symbol::final_value_is_known): Return false if
8815 output_is_position_independent.
8816 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8817 output_is_position_independent.
8818 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8819 output_is_position_independent.
8820 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8821 output_is_position_independent.
8822 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8823 two_file_pie_test.
8824 (basic_pie_test.o, basic_pie_test): New targets.
8825 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8826 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8827 (two_file_pie_test): New target.
8828 * testsuite/Makefile.in: Rebuild.
8829 * README: Remove note saying that -pie is not supported.
8830
8831 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8832
8833 * options.h (class General_options): Add -init and -fini.
8834 * layout.cc (Layout::finish_dynamic_section): Emit
8835 given init and fini functions.
8836
8837 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8838
8839 * gc.h (gc_process_relocs): Check if icf is enabled using new
8840 function.
8841 * gold.cc (queue_initial_tasks): Likewise.
8842 (queue_middle_tasks): Likewise.
8843 * object.cc (do_layout): Likewise.
8844 * symtab.cc (is_section_folded): Likewise.
8845 * main.cc (main): Likewise.
8846 * reloc.cc (Read_relocs::run): Likewise.
8847 (Sized_relobj::do_scan_relocs): Likewise.
8848 * icf.cc (is_function_ctor_or_dtor): New function.
8849 (Icf::find_identical_sections): Check if function is ctor or dtor when
8850 safe icf is chosen.
8851 * options.h (General_options::icf): Change option to be an enum.
8852 (Icf_status): New enum.
8853 (icf_enabled): New method.
8854 (icf_safe_folding): New method.
8855 (set_icf_status): New method.
8856 (icf_status_): New variable.
8857 * (options.cc) (General_options::finalize): Set icf_status_.
8858 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8859 icf_test and icf_keep_unique_test to use the --icf enum flag.
8860 * testsuite/icf_safe_test.sh: New file.
8861 * testsuite/icf_safe_test.cc: New file.
8862
8863 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8864
8865 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8866 includes to gc.h and icf.h.
8867 * arm.cc: Include gc.h.
8868 * gold.cc: Likewise.
8869 * i386.cc: Likewise.
8870 * powerpc.cc: Likewise.
8871 * sparc.cc: Likewise.
8872 * x86_64.cc: Likewise.
8873 * gc.h: Include icf.h.
8874
8875 2009-10-11 Ian Lance Taylor <iant@google.com>
8876
8877 * plugin.cc: Include "gold.h" before other header files.
8878
8879 2009-10-10 Chris Demetriou <cgd@google.com>
8880
8881 * options.h (Input_file_argument::Input_file_type): New enum.
8882 (Input_file_argument::is_lib_): Replace with...
8883 (Input_file_argument::type_): New member.
8884 (Input_file_argument::Input_file_argument): Take Input_file_type
8885 'type' rather than boolean 'is_lib' as second argument.
8886 (Input_file_argument::is_lib): Use type_.
8887 (Input_file_argument::is_searched_file): New function.
8888 (Input_file_argument::may_need_search): Handle is_searched_file.
8889 * options.cc (General_options::parse_library): Support -l:filename.
8890 (General_options::parse_just_symbols): Update for Input_file_argument
8891 changes.
8892 (Command_line::process): Likewise.
8893 * archive.cc (Archive::get_file_and_offset): Likewise.
8894 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8895 * script.cc (read_script_file, script_add_file): Likewise.
8896 * fileread.cc (Input_file::Input_file): Likewise.
8897 (Input_file::will_search_for): Handle is_searched_file.
8898 (Input_file::open): Likewise.
8899 * readsyms.cc (Read_symbols::get_name): Likewise.
8900 * testsuite/Makefile.am (searched_file_test): New test.
8901 * testsuite/Makefile.in: Regenerate.
8902 * testsuite/searched_file_test.cc: New file.
8903 * testsuite/searched_file_test_lib.cc: New file.
8904
8905 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8906 Ian Lance Taylor <iant@google.com>
8907
8908 * descriptor.cc: Include <cstdio> and "binary-io.h".
8909 (Descriptors::open): Open the files in binary mode always.
8910 * script.cc (Lex::get_token): Treat \r as whitespace.
8911
8912 2009-10-09 Ian Lance Taylor <iant@google.com>
8913
8914 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8915
8916 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8917 Ian Lance Taylor <iant@google.com>
8918
8919 * configure.ac: Check for readv function also.
8920 * fileread.cc (readv): Define if not HAVE_READV.
8921 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8922 does not exist.
8923 * config.in: Regenerate.
8924 * configure: Regenerate.
8925
8926 2009-10-09 Doug Kwan <dougkwan@google.com>
8927
8928 * layout.cc (Layout::make_output_section): Call target hook to make
8929 ordinary output section.
8930 (Layout::finalize): Adjust parameter list of call the
8931 Target::may_relax().
8932 * layout.h (class Layout::section_list): New method.
8933 * merge.h (Output_merge_base::entsize): Change visibility to public.
8934 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8935 New methods.
8936 (Output_merge_string::do_is_string): New method.
8937 * object.cc (Sized_relobj::do_setup): renamed from
8938 Sized_relobj::set_up.
8939 * object.h (Sized_relobj::adjust_shndx,
8940 Sized_relobj::initializ_input_to_output_maps,
8941 Sized_relobj::free_input_to_output_maps): Change visibilities to
8942 protected.
8943 (Sized_relobj::setup): Virtualize.
8944 (Sized_relobj::do_setup): New method declaration.
8945 (Sized_relobj::invalidate_section_offset,
8946 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8947 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8948 * options.cc (parse_int): New function.
8949 * options.h (parse_int): New declaration.
8950 (DEFINE_int): New macro.
8951 (stub_group_size): New option.
8952 * output.cc (Output_section::Output_section): Initialize memebers
8953 merge_section_map_, merge_section_by_properties_map_,
8954 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8955 (Output_section::add_input_section): Handled deferred code-fill
8956 generation and remove an old comment.
8957 (Output_section::add_relaxed_input_section): New method definition.
8958 (Output_section::add_merge_input_section): Use merge section by
8959 properties map to speed to search. Update merge section maps
8960 as appropriate.
8961 (Output_section::build_relaxation_map): New method definition.
8962 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8963 Same.
8964 (Output_section::relax_input_section): Renamed to
8965 Output_section::convert_input_sections_to_relaxed_sections and change
8966 interface to take a vector of pointers to relaxed sections.
8967 (Output_section::find_merge_section,
8968 Output_section::find_relaxed_input_section): New method definitions.
8969 (Output_section::is_input_address_mapped,
8970 Output_section::output_offset, Output_section::output_address):
8971 Use output section data maps to speed up searching.
8972 (Output_section::find_starting_output_address): Add comments.
8973 (Output_section::do_write,
8974 Output_section::write_to_postprocessing_buffer): Do code-fill
8975 generation as appropriate.
8976 (Output_section::get_input_sections): Invalidate relaxed input section
8977 map.
8978 (Output_section::restore_states): Adjust type of checkpoint .
8979 Invalidate relaxed input section map.
8980 * output.h (Output_merge_base): New class declaration.
8981 (Input_section_specifier): New class defintion.
8982 (class Output_relaxed_input_section) Change base class to
8983 Output_section_data_build.
8984 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8985 base class initializer.
8986 (Output_section::add_relaxed_input_section): New method declaration.
8987 (Output_section::Input_section): Change visibility to protected.
8988 (Output_section::Input_section::relobj,
8989 Output_section::Input_section::shndx): Handle relaxed input sections.
8990 Output_section::input_sections) Change visibility to protected. Also
8991 define overload to return a non-const pointer.
8992 (Output_section::Merge_section_properties): New class defintion.
8993 (Output_section::Merge_section_by_properties_map,
8994 Output_section::Output_section_data_by_input_section_map,
8995 Output_section::Relaxation_map): New types.
8996 (Output_section::relax_input_section): Rename method to
8997 Output_section::convert_input_sections_to_relaxed_sections and change
8998 interface to take a vector of relaxed section pointers.
8999 (Output_section::find_merge_section,
9000 Output_section::find_relaxed_input_section,
9001 Output_section::build_relaxation_map,
9002 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9003 New method declarations.
9004 (Output_section::merge_section_map_
9005 Output_section::merge_section_by_properties_map_,
9006 Output_section::relaxed_input_section_map_,
9007 Output_section::is_relaxed_input_section_map_valid_,
9008 Output_section::generate_code_fills_at_write_): New data members.
9009 * script-sections.cc
9010 (Output_section_element_input::set_section_addresses): Call
9011 current_data_size and addralign methods of relaxed input sections.
9012 (Orphan_output_section::set_section_addresses): Call current_data_size
9013 and addralign methods of relaxed input sections.
9014 * symtab.cc (Symbol_table::compute_final_value): Extract template
9015 from the body of Symbol_table::sized_finalize_symbol.
9016 (Symbol_table::sized_finalized_symbol): Call
9017 Symbol_table::compute_final_value.
9018 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9019 (Symbol_table::compute_final_value): New templated method declaration.
9020 * target.cc (Target::do_make_output_section): New method defintion.
9021 * target.h (Target::make_output_section): New method declaration.
9022 (Target::relax): Add more parameters for input objects, symbol table
9023 and layout. Adjust call to do_relax.
9024 (Target::do_make_output_section): New method declaration.
9025 (Target::do_relax): Add parameters for input objects, symbol table
9026 and layout.
9027
9028 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9029
9030 * pread.c: Include stdio.h.
9031
9032 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9033
9034 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9035 defined.
9036
9037 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9038
9039 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9040 Change read_shndx type to unsigned int.
9041 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9042 int.
9043 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9044 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9045 Change read_shndx type to unsigned int.
9046 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9047 int.
9048 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9049 * layout.cc (Layout::create_symtab_sections): Cast the result of
9050 local_symcount * symsize to off_t in the gold_assert.
9051
9052 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9053
9054 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9055 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9056 R_ARM_BASE_ABS.
9057 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9058 (Arm_relocate_functions::thm_abs5): New function.
9059 (Arm_relocate_functions::abs12): New function.
9060 (Arm_relocate_functions::abs16): New function.
9061 (Arm_relocate_functions::base_abs): New function.
9062 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9063 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9064 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9065 R_ARM_BASE_ABS.
9066 (Scan::global): Likewise.
9067 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9068 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9069 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9070 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9071 R_ARM_BASE_ABS.
9072
9073 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9074
9075 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9076 (Arm_relocate_functions::movt_prel): New function.
9077 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9078 (Arm_relocate_functions::thm_movt_prel): New function.
9079 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9080 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9081 (Scan::global, Relocate::relocate): Likewise.
9082 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9083
9084 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9085
9086 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9087 Incremental_checker.
9088 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9089 unsigned int.
9090 (class Incremental_inputs_header): New class.
9091 (Incremental_inputs_header_writer): Edit comment.
9092 (Incremental_inputs_entry): New class.
9093 (Incremental_inputs_entry_writer): Edit comment.
9094 (Sized_incremental_binary::do_find_incremental_inputs_section):
9095 Add *strtab_shndx parameter, fill it.
9096 (Sized_incremental_binary::do_check_inputs): New method.
9097 (Incremental_checker::can_incrementally_link_output_file): Use
9098 Sized_incremental_binary::check_inputs.
9099 (Incremental_inputs::report_command_line): Save command line in
9100 command_line_.
9101 * incremental.h:
9102 (Incremental_binary::find_incremental_inputs_section): New
9103 method.
9104 (Incremental_binary::do_find_incremental_inputs_section): Add
9105 strtab_shndx parameter.
9106 (Incremental_binary::do_check_inputs): New pure virtual method.
9107 (Sized_incremental_binary::do_check_inputs): Declare.
9108 (Incremental_checker::Incremental_checker): Add incremental_inputs
9109 parameter, use it to initialize incremental_inputs_.
9110 (Incremental_checker::incremental_inputs_): New field.
9111 (Incremental_checker::command_line): New method.
9112 (Incremental_checker::inputs): New method.
9113 (Incremental_checker::command_line_): New field.
9114
9115 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9116
9117 * incremental.cc: Include <cstdarg> and "target-select.h".
9118 (vexplain_no_incremental): New function.
9119 (explain_no_incremental): New function.
9120 (Incremental_binary::error): New method.
9121 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9122 method.
9123 (make_sized_incremental_binary): New function.
9124 (open_incremental_binary): New function.
9125 (can_incrementally_link_file): Add checks if output is ELF and has
9126 inputs section.
9127 * incremental.h: Include "elfcpp_file.h" and "output.h".
9128 (Incremental_binary): New class.
9129 (Sized_incremental_binary): New class.
9130 (open_incremental_binary): Declare.
9131 * object.cc (is_elf_object): Use
9132 elfcpp::Elf_recognizer::is_elf_file.
9133 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9134 * output.h (Output_file::filesize): New method.
9135
9136 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9137
9138 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9139 New function.
9140 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9141 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9142 function.
9143 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9144 function.
9145 (Arm_relocate_functions::movw_abs_nc): New function.
9146 (Arm_relocate_functions::movt_abs): New function.
9147 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9148 (Arm_relocate_functions::thm_movt_abs): New function.
9149 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9150 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9151 (Scan::global): Likewise.
9152 (Relocate::relocate): Likewise.
9153 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9154
9155 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9156
9157 * arm.cc (Arm_relocate_functions::got_prel) New function.
9158 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9159 (Relocate::relocate): Likewise.
9160 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9161
9162 2009-10-06 Ian Lance Taylor <iant@google.com>
9163
9164 * options.h (class General_options): Define
9165 split_stack_adjust_size parameter.
9166 * object.h (class Object): Add uses_split_stack_ and
9167 has_no_split_stack_ fields. Add uses_split_stack and
9168 has_no_split_stack accessor functions. Declare
9169 handle_split_stack_section.
9170 (class Reloc_symbol_changes): Define.
9171 (class Sized_relobj): Define Function_offsets. Declare
9172 split_stack_adjust, split_stack_adjust_reltype, and
9173 find_functions.
9174 * object.cc (Object::handle_split_stack_section): New function.
9175 (Sized_relobj::do_layout): Call handle_split_stack_section.
9176 * dynobj.cc (Sized_dynobj::do_layout): Call
9177 handle_split_stack_section.
9178 * reloc.cc (Sized_relobj::relocate_sections): Call
9179 split_stack_adjust for executable sections in split_stack
9180 objects. Pass reloc_map to relocate_section.
9181 (Sized_relobj::split_stack_adjust): New function.
9182 (Sized_relobj::split_stack_adjust_reltype): New function.
9183 (Sized_relobj::find_functions): New function.
9184 * target-reloc.h: Include "object.h".
9185 (relocate_section): Add reloc_symbol_changes parameter. Change
9186 all callers.
9187 * target.h (class Target): Add calls_non_split method. Declare
9188 do_calls_non_split virtual method. Declare match_view and
9189 set_view_to_nop.
9190 * target.cc: Include "elfcpp.h".
9191 (Target::do_calls_non_split): New function.
9192 (Target::match_view): New function.
9193 (Target::set_view_to_nop): New function.
9194 * gold.cc (queue_middle_tasks): Give an error if mixing
9195 split-stack and non-split-stack objects with -r.
9196 * i386.cc (Target_i386::relocate_section): Add
9197 reloc_symbol_changes parameter.
9198 (Target_i386::do_calls_non_split): New function.
9199 * x86_64.cc (Target_x86_64::relocate_section): Add
9200 reloc_symbol_changes parameter.
9201 (Target_x86_64::do_calls_non_split): New function.
9202 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9203 parameter.
9204 * powerpc.cc (Target_powerpc::relocate_section): Add
9205 reloc_symbol_changes parameter.
9206 * sparc.cc (Target_sparc::relocate_section): Add
9207 reloc_symbol_changes parameter.
9208 * configure.ac: Call AM_CONDITIONAL for the default target.
9209 * configure: Rebuild.
9210 * testsuite/Makefile.am (TEST_AS): New variable.
9211 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9212 (check_DATA): Add split_i386 and split_x86_64 files.
9213 (SPLIT_DEFSYMS): Define.
9214 (split_i386_[1234n].o): New targets.
9215 (split_i386_[124]): New targets.
9216 (split_i386_[1234r].stdout): New targets.
9217 (split_x86_64_[1234n].o): New targets.
9218 (split_x86_64_[124]): New targets.
9219 (split_x86_64_[1234r].stdout): New targets.
9220 (MOSTLYCLEANFILES): Add new executables.
9221 * testsuite/split_i386.sh: New file.
9222 * testsuite/split_x86_64.sh: New file.
9223 * testsuite/split_i386_1.s: New file.
9224 * testsuite/split_i386_2.s: New file.
9225 * testsuite/split_i386_3.s: New file.
9226 * testsuite/split_i386_4.s: New file.
9227 * testsuite/split_i386_n.s: New file.
9228 * testsuite/split_x86_64_1.s: New file.
9229 * testsuite/split_x86_64_2.s: New file.
9230 * testsuite/split_x86_64_3.s: New file.
9231 * testsuite/split_x86_64_4.s: New file.
9232 * testsuite/split_x86_64_n.s: New file.
9233 * testsuite/testfile.cc (Target_test): Update relocation_section
9234 function.
9235 * testsuite/Makefile.in: Rebuild.
9236
9237 2009-10-06 Ian Lance Taylor <iant@google.com>
9238
9239 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9240 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9241 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9242 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9243 the address on ldo_addrs_.
9244 (Target_i386::Relocate::fix_up_ldo): New function.
9245
9246 2009-10-06 Rafael Espindola <espindola@google.com>
9247
9248 * plugin.cc (add_input_library): New.
9249 (Plugin::load): Add add_input_library to tv.
9250 (Plugin_manager::add_input_file): Add the is_lib argument.
9251 (add_input_file): Update call to Plugin_manager::add_input_file.
9252 (add_input_library): New.
9253 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9254
9255 2009-09-30 Doug Kwan <dougkwan@google.com>
9256
9257 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9258 symbol and call Symbol::may_need_copy_reloc to determine if
9259 a copy reloc is needed.
9260 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9261 nocopyreloc is given in command line.
9262 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9263 given in command line.
9264 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9265 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9266 of the removed Target_i386::may_need_copy_reloc.
9267 * options.h (copyreloc): New option with default value false.
9268 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9269 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9270 instead of the removed Target_powerpc::may_need_copy_reloc.
9271 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9272 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9273 instead of the removed Target_sparc::may_need_copy_reloc.
9274 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9275 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9276 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9277 instead of the removed Target_x86_64::may_need_copy_reloc.
9278
9279 2009-09-30 Ian Lance Taylor <iant@google.com>
9280
9281 * object.h (class Object): Remove target_ field, and target,
9282 sized_target, and set_target methods.
9283 (Object::sized_target): Remove.
9284 (class Sized_relobj): Update declarations. Remove sized_target.
9285 * object.cc (Sized_relobj::setup): Remove target parameter.
9286 Change all callers.
9287 (Input_objects::add_object): Don't do anything with the target.
9288 (make_elf_sized_object): Add punconfigured parameter. Change all
9289 callers. Set or test parameter target.
9290 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9291 Change all callers.
9292 * parameters.cc (Parameters::set_target): Change parameter type to
9293 be non-const.
9294 (Parameters::default_target): Remove.
9295 (set_parameters_target): Change parameter type to be non-const.
9296 (parameters_force_valid_target): New function.
9297 (parameters_clear_target): New function.
9298 * parameters.h (class Parameters): Update declarations. Remove
9299 default_target method. Add sized_target and clear_target
9300 methods. Change target_ to be non-const.
9301 (set_parameters_target): Update declaration.
9302 (parameters_force_valid_target): Declare.
9303 (parameters_clear_target): Declare.
9304 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9305 as NULL if we aren't searching.
9306 (Add_symbols::run): Don't check for compatible target.
9307 * fileread.cc (Input_file::open_binary): Call
9308 parameters_force_valid_target.
9309 * gold.cc (queue_middle_tasks): Likewise.
9310 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9311 set_target on object.
9312 * dynobj.h (class Sized_dynobj): Update declarations.
9313 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9314 make_elf_object returns NULL.
9315 (Archive::include_member): Don't check whether object target is
9316 compatible.
9317 * output.cc (Output_section::add_input_section): Get target from
9318 parameters.
9319 (Output_section::relax_input_section): Likewise.
9320 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9321 parameters.
9322 (Sized_relobj::do_scan_relocs): Likewise.
9323 (Sized_relobj::relocate_sections): Likewise.
9324 * resolve.cc (Symbol_table::resolve): Likewise.
9325 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9326 parameter. Change all callers.
9327 (Symbol_table::add_from_object): Get target from parameters.
9328 (Symbol_table::add_from_relobj): Don't check object target.
9329 (Symbol_table::add_from_dynobj): Likewise.
9330 (Symbol_table::define_special_symbol): Get target from
9331 parameters.
9332 * symtab.h (class Symbol_table): Update declaration.
9333 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9334 parameter. Change all callers. Clear parameter target.
9335 (Binary_test): Test target here.
9336 * testsuite/object_unittest.cc (gold_testsuite): Remove
9337 target_test_pointer parameter. Change all callers.
9338 (Object_test): Test target here.
9339
9340 2009-09-26 Ian Lance Taylor <iant@google.com>
9341
9342 * testsuite/initpri1.c: Don't try to use constructor priorities if
9343 compiling with gcc before 4.3.
9344
9345 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9346
9347 * testsuite/retain_symbols_file_test.sh (check_present): Change
9348 output file name to retain_symbols_file_test.stdout.
9349 (check_absent): Likewise.
9350
9351 2009-09-18 Craig Silverstein <csilvers@google.com>
9352
9353 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9354 * options.cc: Include <cerrno> and <fstream>.
9355 (General_options::finalize): Parse -retain-symbols-file tag.
9356 * options.h: New flag.
9357 (General_options): New method should_retain_symbol, new
9358 variable symbols_to_retain.
9359 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9360 should_retain_symbol map.
9361 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9362 * testsuite/Makefile.in: Regenerate.
9363 * testsuite/retain_symbols_file_test.sh: New file.
9364
9365 2009-09-18 Nick Clifton <nickc@redhat.com>
9366
9367 * po/es.po: Updated Spanish translation.
9368
9369 2009-09-17 Doug Kwan <dougkwan@google.com>
9370
9371 * debug.h (DEBUG_RELAXATION): New constant.
9372 (DEBUG_ALL): Add DEBUG_RELAXATION.
9373 (debug_string_to_enum): Add relaxation debug option.
9374 * layout.cc
9375 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9376 Layout::Relaxation_debug_check::read_sections,
9377 Layout::Relaxation_debug_check::read_sections): New method definitions.
9378 (Layout::Layout): Initialize data members
9379 record_output_section_data_from_scrips_,
9380 script_output_section_data_list_ and relaxation_debug_check_.
9381 (Layout::save_segments, Layout::restore_segments,
9382 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9383 Layout::relaxation_loop_body): New method definitions.
9384 (Layout::finalize): Support relaxation. Move section layout code to
9385 Layout::relaxation_loop_body.
9386 (Layout::set_asection_address_from_script): Move code for orphan
9387 section placement out.
9388 (Layout::place_orphan_sections_in_script): New method definition.
9389 * layout.h (Output_segment_headers, Output_file_header):
9390 New forward class declarations.
9391 (Layout::~Layout): Define.
9392 (Layout::new_output_section_data_from_script): New method definition.
9393 (Layout::place_orphan_sections_in_script): New method declaration.
9394 (Layout::Segment_states): New type declaration.
9395 (Layout::save_segments, Layout::restore_segments,
9396 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9397 Layout::relaxation_loop_body): New method declarations.
9398 (Layout::Output_section_data_list): New type declaration.
9399 (Layout::Relaxation_debug_check): New class definition.
9400 (Layout::record_output_section_data_from_script_,
9401 Layout::script_output_section_data_list_, Layout::segment_states_,
9402 Layout::relaxation_debug_check_): New data members.
9403 * output.cc: (Output_section_headers::do_size): New method definition.
9404 (Output_section_headers::Output_section_headers): Move size
9405 computation to Output_section_headers::do_size.
9406 (Output_segment_headers::do_size): New method definition.
9407 (Output_file_header::Output_file_header): Move size computation to
9408 Output_file_header::do_size and call it.
9409 (Output_file_header::do_size): New method definition.
9410 (Output_data_group::Output_data_group): Adjust call to
9411 Output_section_data.
9412 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9413 (Output_symtab_xindex::do_write): Add array bound check.
9414 (Output_section::Input_section::print_to_mapfile): Handle
9415 RELAXED_INPUT_SECTION_CODE.
9416 (Output_section::Output_section): Initialize data member checkpoint_.
9417 (Output_section::~Output_section): Delete checkpoint object pointed
9418 by checkpoint_.
9419 (Output_section::add_input_section): Always add an Input_section if
9420 relaxing.
9421 (Output_section::add_merge_input_section): Add assert.
9422 (Output_section::relax_input_section): New method definition.
9423 (Output_section::set_final_data_size): Set load address to zero for
9424 an unallocated section.
9425 (Output_section::do_address_and_file_offset_have_reset_values):
9426 New method definition.
9427 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9428 Handle relaxed input section.
9429 (Output_section::sort_attached_input_sections): Checkpoint input
9430 section list lazily.
9431 (Output_section::get_input_sections): Change type of input_sections to
9432 list of Simple_input_section pointers. Checkpoint input section list
9433 lazily. Also handle relaxed input sections.
9434 (Output_section::add_input_section_for_script): Take a reference to
9435 a Simple_input_section object instead of Relobj pointer and section
9436 index as parameter. Handle relaxed input sections.
9437 (Output_section::save_states, Output_section::restore_states): New
9438 method definitions.
9439 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9440 (Output_data::is_data_size_fixed): New method definition.
9441 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9442 if it is fixed.
9443 (Output_data::address_and_file_offset_have_reset_values): New method
9444 definition.
9445 (Output_data::do_address_and_file_offset_have_reset_values): New method
9446 definition.
9447 (Output_data::set_data_size): Check that data size is not fixed.
9448 (Output_data::fix_data_size): New method definition.
9449 (Output_data::is_data_size_fixed_): New data member.
9450 (Output_section_headers::set_final_data_size): New method definition.
9451 (Output_section_headers::do_size): New method declaration.
9452 (Output_segment_headers::set_final_data_size): New method definition.
9453 (Output_segment_headers::do_size): New method declaration.
9454 (Output_file_header::set_final_data_size)::New method definition.
9455 (Output_file_header::do_size)::New method declaration.
9456 (Output_section_data::Output_section_data): Add new parameter
9457 is_data_size_fixed and use it to fix data size.
9458 (Output_data_const::Output_data_const): Adjust call to base class
9459 constructor and fix data size.
9460 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9461 base class constructor and fix data size.
9462 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9463 base class constructor and fix data size.
9464 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9465 class constructor and fix data size.
9466 (Output_data_group::set_final_data_size): New method definition.
9467 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9468 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9469 class constructor and fix data size.
9470 (Output_relaxed_input_section): New class definition.
9471 (Output_section::Simple_input_section): New class definition.
9472 (Output_section::get_input_sections): Adjust parameter list.
9473 (Output_section::add_input_section_for_script): Same.
9474 (Output_section::save_states, Output_section::restore_states,
9475 Output_section::do_address_and_file_offset_have_reset_values,
9476 (Output_section::Input_section::Input_section): Handle
9477 RELAXED_INPUT_SECTION_CODE. Add new overload for
9478 Output_relaxed_input_section.
9479 (Output_section::Input_section::is_input_section,
9480 Output_section::Input_section::set_output_section): Handle relaxed
9481 input section.
9482 (Output_section::Input_section::is_relaxed_input_section,
9483 Output_section::Input_section::output_section_data,
9484 Output_section::Input_section::relaxed_input_section): New method
9485 definitions.
9486 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9487 value.
9488 (Output_section::Input_section::u1_): Update comments.
9489 (Output_section::Input_section::u2_): Add new union member poris.
9490 (Output_section::Checkpoint_output_section): New classs definition.
9491 (Output_section::relax_input_section): New method declaration.
9492 (Output_section::checkpoint_): New data member.
9493 (Output_segment): Update comments.
9494 (Output_segment::Output_segment): Un-privatize copy constructor.
9495 (Output_segment::operator=): Un-privatize.
9496 * script-sections.cc (Output_section_element::Input_section_list):
9497 Change element type to Output_section::Simple_input_section.
9498 (Output_section_element_dot_assignment::set_section_addresses):
9499 Register output section data for relaxation clean up.
9500 (Output_data_exression::Output_data_expression): Adjust call to base
9501 constructor to fix data size.
9502 (Output_section_element_data::set_section_addresses): Register
9503 Output_data_expression object for relaxation clean up.
9504 (struct Input_section_info): Replace Relobj pointer and section index
9505 pair with Output_section::Simple_input_section and Convert struct to a
9506 class.
9507 (Input_section_sorter::operator()): Adjust access to
9508 Input_section_info data member to use accessors.
9509 (Output_section_element_input::set_section_addresses): Use layout
9510 parameter. Adjust code to use Output_section::Simple_input_section
9511 and Input_secction_info classes. Register filler for relaxation
9512 clean up.
9513 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9514 and section index pair with Output_section::Simple_input_section
9515 class. Adjust code accordingly.
9516 (Phdrs_element::release_segment): New method definition.
9517 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9518 segment list.
9519 (Script_sections::release_segments): New method definition.
9520 * gold/script-sections.h (Script_sections::release_segments): New
9521 method declaration.
9522 * gold/target.h (Target::may_relax, Target::relax,
9523 Target::do_may_relax, Target::do_relax): New method definitions.
9524
9525 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9526
9527 * arm.cc (has_signed_unsigned_overflow): New function.
9528 (Arm_relocate_functions::abs8): New function.
9529 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9530 (Target_arm::Scan::global): Likewise.
9531 (Target_arm::relocate::relocate): Likewise.
9532 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9533 Likewise.
9534
9535 2009-09-16 Cary Coutant <ccoutant@google.com>
9536
9537 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9538 * testsuite/Makefile.in: Regenerate.
9539
9540 2009-09-11 Nick Clifton <nickc@redhat.com>
9541
9542 * po/gold.pot: Updated by the Translation project.
9543
9544 2009-09-08 Cary Coutant <ccoutant@google.com>
9545
9546 * output.cc (Output_file::open): Add execute permission to empty file.
9547 * testsuite/Makefile.am (permission_test): New test.
9548 * testsuite/Makefile.in: Regenerate.
9549
9550 2009-09-02 Ian Lance Taylor <iant@google.com>
9551
9552 * output.cc (Output_file::resize): Call map_no_anonymous rather
9553 than map.
9554
9555 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9556
9557 * gold.cc: Include "incremental.h".
9558 (queue_initial_tasks): Call Incremental_checker methods.
9559 * incremental.cc: Include "output.h".
9560 (Incremental_checker::can_incrementally_link_output_file): New
9561 method.
9562 * incremental.h (Incremental_checker): New class.
9563
9564 * output.cc (Output_file::open_for_modification): New method.
9565 (Output_file::map_anonymous): Changed return type to bool. Record
9566 map in base_ field.
9567 (Output_file::map_no_anonymous): New method, broken out of map.
9568 (Output_file::map): Use map_no_anonymous and map_anonymous.
9569 * output.h (class Output_file): Update declarations.
9570
9571 2009-08-24 Cary Coutant <ccoutant@google.com>
9572
9573 * options.h (Command_line::Pre_options): New class.
9574 (Command_line::pre_options): New member.
9575 * options.cc (gold::options::ready_to_register): New variable.
9576 (One_option::register_option): Do nothing if not registering options.
9577 Assert if same short option registered twice.
9578 (General_options::General_options): Turn off option registration when
9579 done constructing.
9580 (Command_line::Pre_options::Pre_options): New constructor.
9581
9582 2009-08-24 Cary Coutant <ccoutant@google.com>
9583
9584 * options.h (General_options::no_keep_memory): Remove incorrect
9585 short option.
9586
9587 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9588
9589 * Makefile.am (am__skiplex, am__skipyacc): New.
9590 * Makefile.in: Regenerate.
9591
9592 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9593
9594 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9595 (INCLUDES): ... this.
9596 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9597 (AM_CPPFLAGS): Renamed from ...
9598 (INCLUDE): ... this.
9599 * Makefile.in, testsuite/Makefile.in: Regenerate.
9600
9601 * Makefile.in: Regenerate.
9602 * aclocal.m4: Likewise.
9603 * config.in: Likewise.
9604 * configure: Likewise.
9605 * testsuite/Makefile.in: Likewise.
9606
9607 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9608 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9609 * Makefile.in: Regenerate.
9610 * testsuite/Makefile.in: Regenerate.
9611
9612 2009-08-19 Cary Coutant <ccoutant@google.com>
9613
9614 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9615 symbols in shared libraries overridden by hidden or internal symbols
9616 in the main program.
9617
9618 2009-08-19 Chris Demetriou <cgd@google.com>
9619
9620 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9621 checking source file names in error messages.
9622
9623 2009-08-18 Doug Kwan <dougkwan@google.com>
9624
9625 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9626 an elcpp::Ehdr as parameter. Adjust call to set_target.
9627 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9628 an elfcpp::Ehdr as parameter.
9629 * object.cc (Object::set_target): Remove the version that looks up
9630 a target and sets it.
9631 (Sized_relobj::setup): Take a Target object instead of
9632 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9633 (make_elf_sized_object): Find target and ask target to
9634 make an ELF object.
9635 * object.h: (Object::set_target): Remove the version that looks up
9636 a target and sets it.
9637 (Sized_relobj::setup): Take a Target object instead of
9638 an elfcpp:Ehdr as parameter.
9639 * target.cc: Include dynobj.h.
9640 (Target::do_make_elf_object_implementation): New.
9641 (Target::do_make_elf_object): New.
9642 * target.h (Target::make_elf_object): New template declaration.
9643 (Target::do_make_elf_object): New method declarations.
9644 (Target::do_make_elf_object_implementation): New template declaration.
9645
9646 2009-08-14 Ian Lance Taylor <iant@google.com>
9647
9648 * gold.h (FUNCTION_NAME): Define.
9649 (gold_unreachable): Use FUNCTION_NAME.
9650
9651 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9652
9653 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9654 symbol in the --keep-unique list is not found.
9655
9656 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9657
9658 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9659 been maked as --keep-unique.
9660 (Icf::unfold_section): New function.
9661 * icf.h (Icf::unfold_section): New function.
9662 * options.h (General_options::keep_unique): New option.
9663 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9664 * testsuite/Makefile.in: Regenerate.
9665 * testsuite/icf_keep_unique_test.sh: New file.
9666 * testsuite/icf_keep_unique_test.cc: New file.
9667
9668 2009-08-12 Cary Coutant <ccoutant@google.com>
9669
9670 PR 10471
9671 * resolve.cc (Symbol_table::resolve): Check for references from
9672 dynamic objects to hidden and internal symbols.
9673 * testsuite/Makefile.am (hidden_test.sh): New test.
9674 * testsuite/Makefile.in: Regenerate.
9675 * testsuite/hidden_test.sh: New script.
9676 * testsuite/hidden_test_1.c: New test source.
9677 * testsuite/hidden_test_main.c: New test source.
9678
9679 2009-08-11 Doug Kwan <dougkwan@google.com>
9680
9681 * arm.cc: Update comments.
9682 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9683 segment to locate the .ARM.exidx section if present.
9684
9685 2009-08-09 Doug Kwan <dougkwan@google.com>
9686
9687 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9688 patch.
9689
9690 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9691 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9692 compiler warnings.
9693
9694 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9695
9696 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9697 valid tls_segment only for non-debug-section relocations.
9698 * testsuite/Makefile.am: Add gc_tls_test.
9699 * testsuite/Makefile.in: Regenerate.
9700 * testsuite/gc_tls_test.cc: New file.
9701 * testsuite/gc_tls_test.sh: New file.
9702
9703 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9704
9705 * icf.cc: New file.
9706 * icf.h: New file.
9707 * Makefile.am (CCFILES): Add icf.cc.
9708 (HFILES): Add icf.h
9709 * Makefile.in: Regenerate.
9710 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9711 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9712 section, symbol and addend information for the relocs.
9713 * gold.cc (queue_middle_tasks): Call identical code folding.
9714 * gold.h: Add defines for multimap.
9715 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9716 to the call of finalize_local_symbols.
9717 * main.cc (main): Create object of class Icf.
9718 * object.cc (Sized_relobj::do_layout): Allow this function to be
9719 called twice during icf.
9720 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9721 to sections marked as identical by icf.
9722 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9723 when available.
9724 (Sized_relobj::do_section_entsize): New function.
9725 * object.h (Object::section_entsize): New function.
9726 (Object::do_section_entsize): New pure virtual function.
9727 (Relobj::finalize_local_symbols): Add new parameter.
9728 (Relobj::do_section_entsize): New function.
9729 * options.h (General_options::icf): New option.
9730 (General_options::icf_iterations): New option.
9731 (General_options::print_icf_sections): New option.
9732 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9733 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9734 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9735 icf.
9736 * symtab.cc (Symbol_table::is_section_folded): New function.
9737 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9738 to sections marked as identical by icf.
9739 * symtab.h (Symbol_table::set_icf): New function.
9740 (Symbol_table::icf): New function.
9741 (Symbol_table::is_section_folded): New function.
9742 (Symbol_table::icf_): New data member.
9743 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9744 * testsuite/Makefile.am: Add commands to build icf_test.
9745 * testsuite/Makefile.in: Regenerate.
9746 * testsuite/icf_test.sh: New file.
9747 * testsuite/icf_test.cc: New file.
9748
9749 2009-07-24 Chris Demetriou <cgd@google.com>
9750
9751 * layout.cc (is_compressible_debug_section): Fix incorrect
9752 comment about compressed section names.
9753
9754 2009-07-20 Ian Lance Taylor <ian@airs.com>
9755
9756 PR 10419
9757 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9758
9759 2009-07-16 Ian Lance Taylor <iant@google.com>
9760
9761 PR 10400
9762 * layout.h: #include <map>.
9763 (class Kept_section): Change from struct to class. Add accessors
9764 and setters. Add section size to Comdat_group mapping. Change
9765 Comdat_group to std::map. Add is_comdat_ field. Add
9766 linkonce_size field in union.
9767 (class Layout): Update declaration of find_or_add_kept_section.
9768 Don't declare find_kept_object.
9769 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9770 parameter. Add object, shndx, is_comdat, and is_group_name
9771 parameters. Change all callers. Adjust for new Kept_section.
9772 (Layout::find_kept_object): Remove.
9773 * object.cc (Sized_relobj::include_section_group): Update use of
9774 Kept_section. Rename secnum to shndx. Only record
9775 Kept_comdat_section if sections are the same size.
9776 (Sized_relobj::include_linkonce_section): Update use of
9777 Kept_section. Only record Kept_comdat_section if sections are the
9778 same size. Set size of linkonce section.
9779 (Sized_relobj::map_to_kept_section): Update call to
9780 get_kept_comdat_section.
9781 * object.h (class Sized_relobj): Rename fields in
9782 Kept_comdat_section to drop trailing underscores; change object
9783 field to Relobj*. Change Kept_comdat_section_table to store
9784 struct rather than pointer.
9785 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9786 Add kept_object and kept_shndx parameters. Change all callers.
9787 (Sized_relobj::get_kept_comdat_section): Change return type to
9788 bool. Add kept_object and kept_shndx parameters. Change all
9789 callers.
9790 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9791 Layout::find_or_add_kept_section.
9792
9793 2009-07-09 Ian Lance Taylor <iant@google.com>
9794
9795 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9796 Reserve space in the hash table.
9797
9798 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9799
9800 * fileread.cc (File_read::get_mtime): New method.
9801 * fileread.h (Timespec): New structure.
9802 (File_read::get_mtime): New method.
9803 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9804 Renamed from timestamp_nsec.
9805 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9806 Elf_Xword.
9807 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9808 timestamp_nsec.
9809 (Incremental_inputs::report_archive): Save mtime; style fix.
9810 (Incremental_inputs::report_obejct): Save mtime; style fix.
9811 (Incremental_inputs::report_script): Save mtime; style fix.
9812 (Incremental_inputs::finalize_inputs): Style fix.
9813 (Incremental_inputs::finalize): Style fix.
9814 (Incremental_inputs::create_input_section_data): Store inputs
9815 mtime.
9816 * incremental.h (Incremental_inputs::report_script): Add mtime
9817 argument.
9818 (Incremental_inputs::Input_info::Input_info): Intialize only one
9819 union member.
9820 (Incremental_inputs::Input_info::archive): Move to nameless
9821 union.
9822 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9823 (Incremental_inputs::Input_info::script): Move to nameless union.
9824 (Incremental_inputs::mtime): New field.
9825 * script.cc (read_input_script): Pass file mtime to
9826 Incremental_input.
9827 * script.h (Script_info::inputs): Style fix.
9828
9829 2009-07-01 Ian Lance Taylor <ian@airs.com>
9830
9831 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9832 instead of 32.
9833
9834 2009-06-24 Ian Lance Taylor <iant@google.com>
9835
9836 PR 10156
9837 * layout.cc (Layout::choose_output_section): If we find an
9838 existing section, update the flags.
9839 (Layout::create_notes): New function, broken out of
9840 Layout::finalize.
9841 (Layout::finalize): Don't create note sections.
9842 (Layout::create_note): Don't crash if linker script discards
9843 section.
9844 (Layout::create_gold_note): Likewise.
9845 (Layout::create_build_id): Likewise. Don't set
9846 after_input_sections on the section.
9847 (Layout::create_executable_stack_info): Remove target parameter.
9848 Change caller.
9849 * layout.h (class Layout): Declare create_notes. Update
9850 declaration of create_executable_stack_info.
9851 * gold.cc (queue_middle_tasks): Call create_notes.
9852 * output.cc (Output_section::update_flags_for_input_section): Move
9853 here from output.h. If SHF_ALLOC flag is newly set, mark address
9854 invalid.
9855 * output.h (Output_data::mark_address_invalid): New function.
9856 (class Output_section): Only declare, not define,
9857 update_flags_for_input_section. Remove set_flags.
9858
9859 2009-06-24 Ian Lance Taylor <iant@google.com>
9860
9861 * script-sections.cc (Output_section_definition::
9862 set_section_addresses): Rename shadowing local load_address to
9863 laddr.
9864
9865 2009-06-24 Ian Lance Taylor <iant@google.com>
9866
9867 PR 10244
9868 * reloc.cc (relocate_sections): Skip empty relocation sections.
9869
9870 2009-06-23 Ian Lance Taylor <iant@google.com>
9871
9872 PR 10156
9873 * layout.cc (Layout::create_note): Use choose_output_section
9874 rather than make_output_section.
9875
9876 2009-06-23 Ian Lance Taylor <iant@google.com>
9877
9878 PR 10237
9879 * options.cc (General_options::parse_V): Set printed_version_.
9880 (General_options::General_options): Initialize printed_version_.
9881 * options.h (class General_options): Add printed_version_ field.
9882 * gold.cc (queue_initial_tasks): If there are no input files,
9883 don't give a fatal error if we printed the version information.
9884 (queue_middle_tasks): If using -r with a shared object, give a
9885 fatal error rather than an ordinary error.
9886
9887 2009-06-23 Ian Lance Taylor <iant@google.com>
9888
9889 PR 10219
9890 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9891 (Layout::make_output_section): Set have_stabstr_section_ if we see
9892 a .stab*str section.
9893 (Layout::finalize): Call link_stabs_sections.
9894 (Layout::link_stabs_sections): New file.
9895 * layout.h (class Layout): Add have_stabstr_section_ field.
9896 Declare link_stabs_sections.
9897
9898 2009-06-23 Doug Kwan <dougkwan@google.com>
9899
9900 * Makefile.am (libgold_a_LIBADD): New.
9901 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9902 * Makefile.in: Regenerate.
9903 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9904 * configure: Regenerate.
9905 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9906 * fileread.cc: Include sys/state.h
9907 * gold.h: Declare memmem and strndup if found missing.
9908 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9909
9910 2009-06-23 Ian Lance Taylor <iant@google.com>
9911
9912 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9913 * configure: Rebuild.
9914
9915 2009-06-23 Ian Lance Taylor <iant@google.com>
9916
9917 PR 10147
9918 * object.cc (Object::section_contents): Don't try to get a view if
9919 the section has length zero.
9920 (Object::handle_gnu_warning_section): If the section is empty, use
9921 the name of the section as the warning.
9922
9923 2009-06-23 Ian Lance Taylor <iant@google.com>
9924
9925 PR 10133
9926 * stringpool.h (class Stringpool_template): Add optimize_ field.
9927 (Stringpool_template::set_optimize): New function.
9928 * stringpool.cc (Stringpool_template::Stringpool_template):
9929 Initialize optimize_ field.
9930 (Stringpool_template::set_string_offsets): Test local optimize
9931 fild rather than parameter.
9932 * layout.cc (Layout::Layout): Call set_optimize on the section
9933 name stringpool.
9934
9935 2009-06-22 Ian Lance Taylor <iant@google.com>
9936
9937 PR 10030
9938 * yyscript.y: Parse TARGET.
9939 * script.cc (script_set_target): New function.
9940 * script-c.h (script_set_target): Declare.
9941 * options.cc (General_options::string_to_object_format): Rename
9942 from string_to_object_format in anonymous namespace. Change
9943 callers.
9944 * options.h (class General_options): Declare
9945 string_to_object_format.
9946
9947 2009-06-22 Ian Lance Taylor <iant@google.com>
9948
9949 * script-sections.cc (Script_sections::create_segments): Don't put
9950 program headers in a PT_LOAD segment if -n or -N.
9951
9952 2009-06-22 Ian Lance Taylor <iant@google.com>
9953
9954 PR 10141
9955 * options.h (class General_options): Add -z lazy and -z now. Sort
9956 -z options into alphabetical order.
9957 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9958
9959 2009-06-21 Ian Lance Taylor <iant@google.com>
9960
9961 * layout.cc (Layout::make_output_section): Call
9962 Target::new_output_section.
9963 (Layout::attach_allocated_section_to_segment): Put large section
9964 sections in a separate load segment with the large segment flag
9965 set.
9966 (Layout::segment_precedes): Sort large data segments after other
9967 load segments.
9968 (align_file_offset): New static function.
9969 (Layout::set_segment_offsets): Use align_file_offset.
9970 * output.h (class Output_section): Add is_small_section_ and
9971 is_large_section_ fields.
9972 (Output_section::is_small_section): New function.
9973 (Output_section::set_is_small_section): New function.
9974 (Output_section::is_large_section): New function.
9975 (Output_section::set_is_large_section): New function.
9976 (Output_section::is_large_data_section): New function.
9977 (class Output_segment): Add is_large_data_segment_ field.
9978 (Output_segment::is_large_data_segment): New function.
9979 (Output_segment::set_is_large_data_segment): New function.
9980 * output.cc (Output_section::Output_section): Initialize new
9981 fields.
9982 (Output_segment::Output_segment): Likewise.
9983 (Output_segment::add_output_section): Add assertion that large
9984 data sections always go in large data segments. Force small data
9985 sections to the end of the list of data sections. Force small BSS
9986 sections to the start of the list of BSS sections. For large BSS
9987 sections to the end of the list of BSS sections.
9988 * symtab.h (class Symbol): Declare is_common_shndx.
9989 (Symbol::is_defined): Check Symbol::is_common_shndx.
9990 (Symbol::is_common): Likewise.
9991 (class Symbol_table): Define enum Commons_section_type. Update
9992 declarations. Add small_commons_ and large_commons_ fields.
9993 * symtab.cc (Symbol::is_common_shndx): New function.
9994 (Symbol_table::Symbol_table): Initialize new fields.
9995 (Symbol_table::add_from_object): Put small and large common
9996 symbols in the right list.
9997 (Symbol_table::sized_finalized_symbol): Check
9998 Symbol::is_common_shndx.
9999 (Symbol_table::sized_write_globals): Likewise.
10000 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10001 common symbol lists. Don't call do_allocate_commons_list if the
10002 list is empty.
10003 (Symbol_table::do_allocate_commons_list): Remove is_tls
10004 parameter. Add comons_section_type parameter. Change all
10005 callers. Handle small and large common symbols.
10006 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10007 Symbol::is_common_shndx.
10008 * resolve.cc (symbol_to_bits): Likewise.
10009 * target.h (Target::small_common_shndx): New function.
10010 (Target::small_common_section_flags): New function.
10011 (Target::large_common_shndx): New function.
10012 (Target::large_common_section_flags): New function.
10013 (Target::new_output_section): New function.
10014 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10015 small_common_section_flags, and large_common_section_flags
10016 fields.
10017 (Target::do_new_output_section): New virtual function.
10018 * arm.cc (Target_arm::arm_info): Initialize new fields.
10019 * i386.cc (Target_i386::i386_info): Likewise.
10020 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10021 Likewise.
10022 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10023 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10024 (Target_x86_64::do_new_output_section): New function.
10025 * configure.ac: Define conditional MCMODEL_MEDIUM.
10026 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10027 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10028 (large_LDFLAGS): Define.
10029 * testsuite/large.c: New file.
10030 * testsuite/testfile.cc (Target_test::test_target_info):
10031 Initialize new fields.
10032 * configure, testsuite/Makefile.in: Rebuild.
10033
10034 2009-06-05 Doug Kwan <dougkwan@google.com>
10035
10036 * Makefile.am (CCFILES): Add target.cc.
10037 * Makefile.in: Regenerate.
10038 * i386.cc (class Target_i386): Define new virtual method to
10039 override do_is_local_label_name in parent.
10040 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10041 local symbols if --discard-locals or -X is given.
10042 * options.h (class General_options): Declare new options
10043 '--discard-locals' and '-X' for discarding locals.
10044 * target.h (class Target): Define new methods is_local_label_name.
10045 Declare new virtual method do_is_local_label_name.
10046 * target.cc: New file.
10047 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10048 (check_SCRIPTS): Add discard_locals_test.sh.
10049 (check_DATA): Add discard_local_tests.syms.
10050 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10051 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10052 * testsuite/Makefile.in: Regenerate.
10053 * testsuite/discard_locals_test.c: New file.
10054 * testsuite/discard_locals_test.sh: Same.
10055
10056 2009-06-05 Doug Kwan <dougkwan@google.com>
10057
10058 * object.cc (Sized_relobj::Sized_relobj): Initialize
10059 discarded_eh_frame_shndx_ to -1U.
10060 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10061 section.
10062 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10063 a discarded .eh_frame section.
10064 (Sized_relobj::do_finalize_local_symbols): Ditto.
10065 * object.h (class Sized_relobj): Declare new member
10066 discarded_eh_frame_shndx_.
10067 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10068 (local_labels_test.o, local_labels_test): New rules.
10069 * testsuite/Makefile.in: Regenerate.
10070
10071 2009-06-04 Doug Kwan <dougkwan@google.com>
10072
10073 * layout.cc (Layout::section_name_mapping): Add mapping for
10074 special ARM sections.
10075
10076 2009-06-03 Doug Kwan <dougkwan@google.com>
10077
10078 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10079 (utils::has_overflow): Same.
10080
10081 2009-06-03 Ian Lance Taylor <iant@google.com>
10082
10083 * layout.cc (Layout::section_name_mapping): New array, replacing
10084 Layout::linkonce_mapping.
10085 (Layout::section_name_mapping_count): New variable, replacing
10086 Layout::linkonce_mapping_count.
10087 (Layout::linkonce_output_name): Remove.
10088 (Layout::output_section_name): Rewrite.
10089 * layout.h (class Layout): Rename Linkonce_mapping to
10090 Section_name_mapping, linkonce_mapping to section_name_mapping,
10091 linkonce_mapping_count to section_name_mapping_count. Don't
10092 declare linkonce_output_name.
10093
10094 2009-06-03 Doug Kwan <dougkwan@google.com>
10095
10096 * gold/arm.cc (namespace utils): New.
10097 (Target_arm::reloc_is_non_pic): Define new method.
10098 (class Arm_relocate_functions): New.
10099 (Target_arm::Relocate::relocate): Handle relocation types used by
10100 Android.
10101
10102 2009-06-03 Ian Lance Taylor <iant@google.com>
10103
10104 * arm.cc (Target_arm::scan::global): Use || instead of |.
10105
10106 2009-06-02 Doug Kwan <dougkwan@google.com>
10107
10108 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10109 issued_non_pic_error_.
10110 (class Target_arm::Scan): Declare new method check_non_pic.
10111 Define new method symbol_needs_plt_entry.
10112 Declare new data member issued_non_pic_error_.
10113 (class Target_arm::Relocate): Declare new method
10114 should_apply_static_reloc.
10115 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10116 (Target_arm::Scan::check_non_pic): Define new method.
10117 (Target_arm::Scan::local): Handle a small subset of reloc types used
10118 by Android.
10119 (Target_arm::Scan::local): Same.
10120 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10121
10122 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10123
10124 * incremental.cc (Incremental_inputs::report_command_line): Filter
10125 out --incremental-* options.
10126
10127 2009-05-29 Doug Kwan <dougkwan@google.com>
10128
10129 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10130 template class.
10131 (class Target_arm): Update comment.
10132 (Target_arm::Target_arm): Initialize new data members GOT_,
10133 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10134 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10135 and Target_arm::rel_dyn_section.
10136 Declare new_enum Target_arm::Got_type.
10137 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10138 and DYNBSS_.
10139 Update commments for member do_dynsym_value.
10140 (Target_arm::got_size, Target_arm::plt_section,
10141 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10142 new methods inside class defintion.
10143 (Target_arm::got_section): Define new method.
10144 (Target_arm::rel_dyn_section): Same.
10145 (Output_data_plt_arm): New template class.
10146 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10147 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10148 (Output_data_plt_arm::add_entry): Same.
10149 (Output_data_plt_arm::first_plt_entry): Define new
10150 static data member for PLT instruction template.
10151 (Output_data_plt_arm::plt_entry): Same.
10152 (Output_data_plt_arm::do_write): Define new method.
10153 (Target_arm::make_plt_entry): Same.
10154 (Target_arm::do_finalize_sections): Same.
10155 (Target_arm::do_dynsym_value): Same.
10156
10157 2009-05-28 Doug Kwan <dougkwan@google.com>
10158
10159 * Makefile.am (TARGETSOURCES): Add arm.cc.
10160 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10161 * Makefile.in: Regenerate.
10162 * arm.cc: New file.
10163 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10164
10165 2009-05-26 Doug Kwan <dougkwan@google.com>
10166
10167 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10168 (General_options::check_excluded_libs): Strip off directories in
10169 archive name before matching like GNU ld does.
10170 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10171 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10172 (exclude_libs_test_LDFLAGS): Add linker option
10173 -Wl,--exclude-libs,libexclude_libs_test_3
10174 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10175 an explicit archive without using -l.
10176 (alt/libexclude_libs_test_3.a): New make rule.
10177 * testsuite/Makefile.in: Regenerate.
10178 * testsuite/exclude_libs_test.c : Declare lib3_default().
10179 (main): Call it.
10180 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10181 * exclude_libs_test_3.c: New file.
10182
10183 2009-05-26 Nick Clifton <nickc@redhat.com>
10184
10185 * po/id.po: New Indonesian translation.
10186 * po/gold.pot: Updated template file.
10187
10188 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10189
10190 * testsuite/Makefile.am: Add -ffunction-sections to compile
10191 gc_comdat_test files. Add -Wl,--gc-sections to build
10192 gc_comdat_test.
10193 * testsuite/Makefile.in: Regenerate.
10194 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10195
10196 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10197
10198 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10199 kept comdat section was garbage collected.
10200 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10201 * testsuite/Makefile.in: Regenerate.
10202 * testsuite/gc_comdat_test.sh: New file.
10203 * testsuite/gc_comdat_test_1.cc: New file.
10204 * testsuite/gc_comdat_test_2.cc: New file.
10205
10206 2009-05-19 Doug Kwan <dougkwan@google.com>
10207
10208 * archive.cc (Archive::Archive): Move constructor from archive.h
10209 to here. Initialize no_export_.
10210 (Archive::get_elf_object_for_member): Set no_export flag of object.
10211 * archive.h (Archive::Archive): Move constructor body to
10212 archive.cc.
10213 (Archive::no_export): New method.
10214 (Archive::no_export_): New field.
10215 * object.h (Object::Object): Initialize no_export_ to false.
10216 (Object::no_export, Object::set_no_export): New methods.
10217 (Object::no_export_): New field.
10218 * options.cc (General_options::parse_exclude_libs): New method.
10219 (General_options::check_excluded_libs) Same.
10220 * options.h (exclude_libs): New option.
10221 (General_options::check_excluded_libs): New method declaration.
10222 (General_options::excluded_libs_): New field.
10223 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10224 default or protected visibility if an object has no-export flag set.
10225 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10226 (check_SCRIPTS): Add exclude_libs_test.sh.
10227 (check_DATA): Add exclude_libs_test.syms.
10228 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10229 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10230 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10231 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10232 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10233 libexclude_libs_test_2.a): New rules.
10234 * testsuite/Makefile.in: Regenerate.
10235 * testsuite/exclude_libs_test.c: New file.
10236 * testsuite/exclude_libs_test.sh: Ditto.
10237 * testsuite/exclude_libs_test_1.c: Ditto.
10238 * testsuite/exclude_libs_test_2.c: Ditto.
10239
10240 2009-05-15 Ian Lance Taylor <iant@google.com>
10241
10242 * configure.ac: Check for declarations for cases where libiberty.h
10243 checks HAVE_DECL_xxx.
10244 * configure, config.in: Rebuild.
10245
10246 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10247
10248 * gold.h (Incremental_argument_list): Remove (invalid) forward
10249 declaration.
10250 * incremental.cc (Incremental_inputs::report_achive): New method.
10251 (Incremental_inputs::report_object): New method.
10252 (Incremental_inputs::report_script): New method.
10253 (Incremental_inputs::finalize_inputs): New method.
10254 (Incremental_inputs::finalize): Call finalize_inputs().
10255 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10256 Create inputs entries.
10257 * incremental.h (Incremental_input_type): New enum.
10258 (Incremental_inputs::Incremental_input): Initialize new fields.
10259 (Incremental_inputs::report_inputs): New method.
10260 (Incremental_inputs::report_achive): New method.
10261 (Incremental_inputs::report_object): New method.
10262 (Incremental_inputs::report_script): New method.
10263 (Incremental_inputs::finalize_inputs): New method.
10264 (Incremental_inputs::Input_info): New struct.
10265 (Incremental_inputs::Input_info_map): New typedef.
10266 (Incremental_inputs::lock_): New field.
10267 (Incremental_inputs::Inputs_): New field.
10268 (Incremental_inputs::Inputs_map): New field.
10269 * main.cc (main): Call Incremental_input::report_inputs.
10270 * options.h (Input_argument_list): Typedef moved from
10271 Input_arguments.
10272 (Input_file_group::Files): Remove, use ::Input_argument_list.
10273 (Input_file_group::Input_argument_list): Remove, use
10274 ::Input_argument_list.
10275 * plugin.cc (Plugin_manager::add_input_file): Add error in
10276 incremental build.
10277 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10278 functions.
10279 * script.cc (read_input_script): Call
10280 Incremental_input::report_script.
10281 * script.h (Script_info): New class.
10282
10283 2009-04-27 Ian Lance Taylor <iant@google.com>
10284
10285 * x86_64.cc (do_adjust_output_section): Set entsize to
10286 plt_entry_size.
10287
10288 2009-04-23 Elliott Hughes <enh@google.com>
10289
10290 * output.cc (Output_file::close): After short writes, continue
10291 writing from the correct offset in the buffer being written.
10292
10293 2009-04-23 Chris Demetriou <cgd@google.com>
10294
10295 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10296 * configure: Regenerate.
10297 * config.in: Regenerate.
10298 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10299 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10300
10301 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10302
10303 * incremental.cc (Incremental_inputs_header_data): Renamed from
10304 Incremental_input_header_data.
10305 (Incremental_inputs_header_data::data_size): New field.
10306 (Incremental_inputs_header_data::put_input_file_count): Renamed
10307 from input_file_count.
10308 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10309 from command_line_offset.
10310 (Incremental_inputs_header_data::put_reserved): Renamed from
10311 put_reserved.
10312 (Incremental_inputs_entry_data): Renamed from
10313 Incremental_input_entry_data.
10314 (Incremental_inputs_entry_data::data_size): New field.
10315 (Incremental_inputs::report_command_line): New method.
10316 (Incremental_inputs::finalize): New method.
10317 (Incremental_inputs::create_incremental_inputs_data): New method.
10318 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10319 * incremental.h: New file.
10320 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10321 (Layout::finalize): Create incremental inputs section in
10322 incremental builds.
10323 (Layout::create_incremental_info_sections): New method.
10324 * layout.h (Layout::incremental_inputs): New method.
10325 (Layout::create_incremental_info_sections): New method.
10326 (Layout::incremental_inputs_): New field.
10327 * main.cc (main): Notify Incremental_input of the command line.
10328
10329 2009-04-01 Ian Lance Taylor <iant@google.com>
10330 Mikolaj Zalewski <mikolajz@google.com>
10331
10332 * gold.h (reserve_unordered_map): Define, three versions, one for
10333 each version of Unordered_map.
10334 * layout.cc (Layout::Layout): Remove options parameter. Add
10335 number_of_input_files parameter. Don't initialize options_.
10336 Initialize number_of_input_files_ and resized_signatures_. Move
10337 sections_are_attached_.
10338 (Layout::layout_group): Reserve space for group_signatures_.
10339 (Layout::find_or_add_kept_section): Change name parameter to be a
10340 reference. Resize signatures_ map when it gets large enough.
10341 (Layout::layout_eh_frame): Use parameters->options() instead of
10342 this->options_.
10343 (Layout::make_output_section): Likewise.
10344 (Layout::attach_allocated_section_to_segment): Likewise.
10345 (Layout::finalize, Layout::create_executable_stack): Likewise.
10346 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10347 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10348 * layout.h (class Layout): Update declarations. Remove options_
10349 field. Add number_of_input_files_ and resized_signatures_
10350 fields. Move sections_are_attached_ field.
10351 * main.cc (main): Pass number of input files to Layout
10352 constructor. Don't pass options.
10353
10354 2009-03-30 Ian Lance Taylor <iant@google.com>
10355
10356 * ffsll.c (ffsll): Correct implementation.
10357
10358 2009-03-27 Ian Lance Taylor <iant@google.com>
10359
10360 * ffsll.c: New file.
10361 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10362 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10363 * ftruncate.c (ftruncate): Declare before definition.
10364 * mremap.c (mremap): Likewise.
10365 * pread.c (pread): Likewise.
10366 * configure, Makefile.in, config.in: Rebuild.
10367
10368 * mremap.c: New file.
10369 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10370 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10371 (mremap): Declare if HAVE_MREMAP is not defined.
10372 * configure, Makefile.in, config.in: Rebuild.
10373
10374 2009-03-27 Cary Coutant <ccoutant@google.com>
10375
10376 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10377 position independent.
10378 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10379 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10380
10381 2009-03-24 Cary Coutant <ccoutant@google.com>
10382
10383 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10384 an executable.
10385 (needs_dynamic_reloc): Likewise.
10386
10387 2009-03-24 Ian Lance Taylor <iant@google.com>
10388
10389 * yyscript.y (file_cmd): Recognize EXTERN.
10390 (extern_name_list, extern_name_list_body): New nonterminals.
10391 * script.cc (script_add_extern): Define.
10392 * script-c.h (script_add_extern): Declare.
10393
10394 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10395
10396 * object.cc (is_elf_object): Define.
10397 * object.h (is_elf_object): Declare.
10398 * archive.cc (Archive::get_elf_object_for_member): Call
10399 is_elf_object.
10400 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10401
10402 2009-03-24 Elliott Hughes <enh@google.com>
10403
10404 * output.cc (Output_file::map_anonymous): Define.
10405 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10406 try an anonymous one. Report the size if the mmap fails.
10407 * output.h (class Output_file): Declare map_anonymous.
10408
10409 2009-03-24 Ian Lance Taylor <iant@google.com>
10410
10411 * target-select.cc (instantiate_target): Don't acquire the lock if
10412 the instantiated_target_ field has already been set.
10413
10414 2009-03-23 Ian Lance Taylor <iant@google.com>
10415
10416 * gold-threads.h (class Initialize_lock): Define.
10417 * gold-threads.cc (class Initialize_lock_once): Define.
10418 (initialize_lock_control): New static variable.
10419 (initialize_lock_pointer): New static variable.
10420 (initialize_lock_once): New static function.
10421 (Initialize_lock::Initialize_lock): Define.
10422 (Initialize_lock::initialize): Define.
10423 * target-select.h: Include "gold-threads.h".
10424 (class Target_selector): Add lock_ and initialize_lock_ fields.
10425 Don't define instantiate_target, just declare it.
10426 * target-select.cc (Target_selector::Target_selector): Initialize
10427 new fields.
10428 (Target_selector::instantiate_target): Define.
10429 * descriptors.h: Include "gold-threads.h".
10430 (class Descriptors): Add initialize_lock_ field.
10431 * descriptors.cc (Descriptors::Descriptors): Initialize new
10432 field.
10433 (Descriptors::open): Use initialize_lock_ field
10434 * errors.h (class Errors): Add initialize_lock_ field.
10435 * errors.cc (Errors::Errors): Initialize new field.
10436 (Errors::initialize_lock): Use initialize_lock_ field.
10437 * powerpc.cc (class Target_selector_powerpc): Remove
10438 instantiated_target_ field. In do_recognize call
10439 instantiate_target rather than do_instantiate_target. In
10440 do_instantiate_target just allocate a new target.
10441 * sparc.cc (class Target_selector_sparc): Likewise.
10442
10443 * freebsd.h: New file.
10444 * i386.cc: Include "freebsd.h".
10445 (Target_i386): Derive from Target_freebsd rather than
10446 Sized_target.
10447 (Target_selector_i386): Derive from Target_selector_freebsd rather
10448 than Target_selector.
10449 * x86_64.cc: Include "freebsd.h".
10450 (Target_x86_64): Derive from Target_freebsd rather than
10451 Sized_target.
10452 (Target_selector_x86_64): Derive from Target_selector_freebsd
10453 rather than Target_selector.
10454 * target.h (class Target): Add adjust_elf_header and
10455 do_adjust_elf_header.
10456 * output.cc (Output_file_header:: do_sized_write): Call target
10457 adjust_elf_header routine.
10458 * configure.tgt: Set targ_osabi.
10459 * configure.ac: Define GOLD_DEFAULT_OSABI.
10460 * parameters.cc (Parameters::default_target): Pass
10461 GOLD_DEFAULT_OSABI to select_target.
10462 * target-select.h (class Target_selector): Make instantiate_target
10463 protected rather than private.
10464 * Makefile.am (HFILES): Add freebsd.h.
10465 * configure, Makefile.in, config.in: Rebuild.
10466
10467 * merge.cc (do_add_input_section): Correct pend value. Change
10468 message about last entry not being null terminated from error to
10469 warning.
10470
10471 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10472
10473 * incremental.cc: New file.
10474 * Makefile.am (CCFILES): Add incremental.cc.
10475 * Makefile.in: Rebuild.
10476
10477 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10478
10479 * layout.cc (Layout::output_section_name): Preserve names
10480 of '.note.' sections.
10481
10482 2009-03-19 Ian Lance Taylor <iant@google.com>
10483
10484 * descriptors.cc (Descriptors::open): Check that the options are
10485 valid before using them.
10486
10487 2009-03-18 Ian Lance Taylor <iant@google.com>
10488
10489 * script-sections.h: Include <list>.
10490 (class Script_sections): Change Sections_elements from std::vector
10491 to std::list. Typedef public Elements_iterator. Add
10492 orphan_section_placement_, data_segment_align_start_, and
10493 saw_data_segment_align_ fields. Remove data_segment_align_index_
10494 field.
10495 * script-sections.cc (class Orphan_section_placement): New class.
10496 (class Sections_element): Add virtual functions is_relro and
10497 orphan_section_init. Remove virtual function place_orphan_here.
10498 (class Output_section_definition): Add is_relro and
10499 orphan_section_init. Remove place_orphan_here.
10500 (class Orphan_output_section): Likewise.
10501 (Script_sections::Script_sections): Update for field changes.
10502 (Script_sections::data_segment_align): Set saw_data_segment_align_
10503 and data_segment_align_start_, not data_segment_align_index.
10504 (Script_sections::data_segment_relro_end): Check
10505 saw_data_segment_align_. Use data_segment_align_start_ rather
10506 than data_segment_align_index_.
10507 (Script_sections::place_orphan): Rewrite to use
10508 Orphan_section_placement.
10509
10510 2009-03-17 Ian Lance Taylor <iant@google.com>
10511
10512 * archive.cc (Archive::add_symbols): Check for a version attached
10513 to the symbol name in the archive map.
10514 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10515 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10516 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10517 (ver_test_11.a): New target.
10518 * testsuite/Makefile.in: Rebuild.
10519
10520 * configure.ac: Check for chsize and posix_fallocate. Replace
10521 ftruncate.
10522 * ftruncate.c: New file, from gnulib.
10523 * output.cc (posix_fallocate): Define dummy version if not
10524 HAVE_POSIX_FALLOCATE.
10525 (Output_file::map): Call posix_fallocate rather than lseek and
10526 write.
10527 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10528 * configure, Makefile.in, config.in: Rebuild.
10529
10530 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10531
10532 * layout.h (Layout::create_note): Add section_name parameter.
10533 * layout.cc (Layout::create_note): Likewise.
10534 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10535
10536 2009-03-17 Ian Lance Taylor <iant@google.com>
10537
10538 * descriptors.cc: Include "options.h".
10539 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10540 (Descriptors::open): Always use O_CLOEXEC when opening a new
10541 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10542 then set FD_CLOEXEC.
10543
10544 * sparc.cc (class Target_sparc): Add has_got_section.
10545 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10546 make sure we have a GOT section.
10547
10548 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10549 (Target_sparc::Scan::local): Likewise.
10550 (Target_sparc::Scan::global): Likewise.
10551 (Target_sparc::Relocate::relocate): Likewise.
10552 (Target_sparc::Relocate::relocate_tls): Likewise.
10553
10554 * symtab.cc (Symbol_table::define_default_version): New function,
10555 broken out of add_from_object.
10556 (Symbol_table::add_from_object): Call define_default_version.
10557 (Symbol_table::define_special_symbol): Add resolve_oldsym
10558 parameter. Change all callers. If the version for a symbol comes
10559 from a version script, resolve it with the symbol with the same
10560 name with no version. Also add the symbol without a version if
10561 appropriate.
10562 (do_define_in_output_data): If resolving with oldsym, don't delete
10563 sym.
10564 (do_define_in_output_segment): Likewise.
10565 (do_define_as_constant): Likewise.
10566 * symtab.h (class Symbol_table): Update declarations.
10567
10568 2009-03-13 Ian Lance Taylor <iant@google.com>
10569
10570 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10571 (Read_symbols::requeue): New function.
10572 (Read_symbols::do_read_symbols): If make_elf_object fails because
10573 the target type is not configured, and the file was searched for,
10574 issue a warning and retry with the next directory.
10575 (Add_symbols::run): If the file has an incompatible format, and
10576 it was searched for, requeue the Read_symbols task. On error,
10577 release the object.
10578 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10579 dirindex parameter to constructor. Change all callers. Declare
10580 incompatible_warning and requeue.
10581 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10582 input_argument_ and input_group_ fields. Add them to
10583 constructor. Change all callers.
10584 (class Read_script): Add dirindex_ field. Add it to constructor.
10585 Change all callers.
10586 * archive.cc (Archive::setup): Remove input_objects parameter.
10587 Change all callers.
10588 (Archive::get_file_and_offset): Likewise.
10589 (Archive::read_all_symbols): Likewise.
10590 (Archive::read_symbols): Likewise.
10591 (Archive::get_elf_object_for_member): Remove input_objects
10592 parameter. Add punconfigured parameter. Change all callers.
10593 (Archive::add_symbols): Change return type to bool. Check return
10594 value of include_member.
10595 (Archive::include_all_members): Likewise.
10596 (Archive::include_member): Change return type to bool. Return
10597 false if first included object has incompatible target. Set
10598 included_member_ field.
10599 (Add_archive_symbols::run): If add_symbols returns false, requeue
10600 Read_symbols task.
10601 * archive.h (class Archive): Add included_member_ field.
10602 Initialize it in constructor. Add input_file and searched_for
10603 methods. Update declarations.
10604 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10605 input_argument_ fields. Add them to constructor. Change all
10606 callers.
10607 * script.cc: Include "target-select.h".
10608 (class Parser_closure): Add skip_on_incompatible_target_ and
10609 found_incompatible_target_ fields. Add
10610 skip_on_incompatible_target parameter to constructor. Change all
10611 callers. Add methods skip_on_incompatible_target,
10612 clear_skip_on_incompatible_target, found_incompatible_target, and
10613 set_found_incompatible_target.
10614 (read_input_script): Add dirindex parameter. Change all callers.
10615 If parser finds an incompatible target, requeue Read_symbols
10616 task.
10617 (script_set_symbol): Clear skip_on_incompatible_target in
10618 closure.
10619 (script_add_assertion, script_parse_option): Likewise.
10620 (script_start_sections, script_add_phdr): Likewise.
10621 (script_check_output_format): New function.
10622 * script.h (read_input_script): Update declaration.
10623 * script-c.h (script_check_output_format): Declare.
10624 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10625 (ignore_cmd): Remove OUTPUT_FORMAT.
10626 * fileread.cc (Input_file::Input_file): Add explicit this.
10627 (Input_file::will_search_for): New function.
10628 (Input_file::open): Add pindex parameter. Change all callers.
10629 * fileread.h (class Input_file): Add input_file_argument method.
10630 Declare will_search_for. Update declarations.
10631 * object.cc (make_elf_object): Add punconfigured parameter.
10632 Change all callers.
10633 * object.h (class Object): Make input_file public. Add
10634 searched_for method.
10635 (make_elf_object): Update declaration.
10636 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10637 restart search.
10638 * dirsearch.h (class Dirsearch): Update declaration.
10639 * options.h (class General_options): Add --warn-search-mismatch.
10640 * parameters.cc (Parameters::is_compatible_target): New function.
10641 * parameters.h (class Parameters): Declare is_compatible_target.
10642 * workqueue.cc (Workqueue::add_blocker): New function.
10643 * workqueue.h (class Workqueue): Declare add_blocker.
10644
10645 * fileread.cc (Input_file::open): Remove options parameter.
10646 Change all callers.
10647 (Input_file::open_binary): Likewise.
10648 * script.cc (read_input_script): Likewise.
10649 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10650 options parameter from constructor. Change all callers.
10651 (class Read_script): Likewise.
10652 * fileread.h (class Input_file): Update declarations.
10653 * script.h (read_input_script): Update declaration.
10654
10655 2009-03-10 Nick Clifton <nickc@redhat.com>
10656
10657 * po/es.po: New Spanish translation.
10658
10659 2009-03-06 Cary Coutant <ccoutant@google.com>
10660
10661 * options.cc (parse_short_option): Keep dash_z from registering itself.
10662
10663 2009-03-03 Ian Lance Taylor <iant@google.com>
10664
10665 PR 9918
10666 * target-reloc.h (relocate_section): Pass output_section to
10667 relocate.
10668 * i386.cc (Target_i386::should_apply_static_reloc): Add
10669 output_section parameter. Change all callers.
10670 (Target_i386::Relocate::relocate): Add output_section parameter.
10671 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10672 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10673 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10674 * testsuite/two_file_shared.sh: New script.
10675 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10676 (check_DATA): Add two_file_shared.dbg.
10677 (two_file_shared.dbg): New target.
10678 * testsuite/Makefile.in: Rebuild.
10679
10680 2009-03-01 Ian Lance Taylor <iant@google.com>
10681
10682 * configure.ac: Check for byteswap.h.
10683 * configure: Rebuild.
10684 * config.in: Rebuild.
10685
10686 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10687
10688 * layout.cc (Layout::find_or_add_kept_section): New function.
10689 (Layout::add_comdat): Removed.
10690 * layout.h (struct Kept_section): Move out of class Layout.
10691 Remove trailing underscores from field names. Add group_sections
10692 field. Rename group_ field to is_group. Change all uses.
10693 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10694 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10695 comdat_groups_ field.
10696 (Sized_relobj::include_section_group): Use
10697 find_or_add_kept_section and Kept_section::group_sections.
10698 (Sized_relobj::include_linkonce_section): Likewise.
10699 * object.cc (class Sized_relobj): Don't define Comdat_group or
10700 Comdat_group_table. Remove find_comdat_group and
10701 add_comdat_group. Remove comdat_groups_ field.
10702 * plugin.cc (include_comdat_group): Use
10703 Layout::find_or_add_kept_section.
10704
10705 2009-02-28 Ian Lance Taylor <iant@google.com>
10706
10707 * README: --gc-sections and map files are now supported. Document
10708 some build requirements.
10709
10710 PR 6992
10711 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10712 relocatable link set the value of the section symbol to zero.
10713 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10714 relocatable link don't include the section address in the local
10715 symbol value.
10716
10717 2009-02-27 Ian Lance Taylor <iant@google.com>
10718
10719 PR 6811
10720 * options.h (class Search_directory): Add is_system_directory.
10721 (class General_options): Declare is_in_system_directory.
10722 * options.cc (get_relative_sysroot): Make static.
10723 (get_default_sysroot): Make static.
10724 (General_optoins::is_in_system_directory): New function.
10725 * fileread.cc (Input_file::is_in_system_directory): New function.
10726 * fileread.h (class Input_file): Declare is_in_system_directory.
10727 * object.h (class Object): Add is_in_system_directory.
10728 (class Input_objects): Remove system_library_directory_ field.
10729 * object.cc (Input_objects::add_object): Don't set
10730 system_library_directory_.
10731 (input_objects::found_in_system_library_directory): Remove.
10732 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10733 parameter. Change all callers.
10734 (Symbol_table::sized_write_globals): Likewise.
10735 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10736 Call Object::is_in_system_directory.
10737 * symtab.h (class Symbol_table): Update declarations.
10738
10739 PR 5990
10740 * descriptors.h (Open_descriptor): Add is_on_stack field.
10741 * descriptors.cc (Descriptors::open): If the descriptor is on the
10742 top of the stack, remove it. Initialize is_on_stack field.
10743 (Descriptors::release): Only add pod to stack if it is not on the
10744 stack already.
10745 (Descriptors::close_some_descriptor): Clear stack_next and
10746 is_on_stack fields.
10747
10748 PR 7091
10749 * output.cc (Output_section::find_starting_output_address): Rename
10750 from starting_output_address; add PADDR parameter; change return
10751 type.
10752 * output.h (class Output_section): Declare
10753 find_starting_output_address instead of starting_output_address.
10754 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10755 section symbol for which we can't find a merge section.
10756
10757 PR 9836
10758 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10759 hidden or internal, force the symbol to be local.
10760 * resolve.cc (Symbol::override_visibility): Define.
10761 (Symbol::override_base): Use override_visibility.
10762 (Symbol_table::resolve): Likewise.
10763 (Symbol::override_base_with_special): Likewise.
10764 (Symbol_table::override_with_special): If the visibility is hidden
10765 or internal, force the symbol to be local.
10766 * symtab.h (class Symbol): Add set_visibility and
10767 override_visibility.
10768 * testsuite/ver_test_1.sh: New file.
10769 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10770 (check_DATA): Add ver_test_1.syms.
10771 (ver_test_1.syms): New target.
10772 * testsuite/Makefile.in: Rebuild.
10773
10774 2009-02-25 Cary Coutant <ccoutant@google.com>
10775
10776 * layout.cc (Layout::choose_output_section): Don't rename sections
10777 when using a linker script that has a SECTIONS clause.
10778 * Makefile.in: Regenerate.
10779
10780 * testsuite/Makefile.am (script_test_5.sh): New test case.
10781 * testsuite/Makefile.in: Regenerate.
10782 * testsuite/script_test_5.cc: New file.
10783 * testsuite/script_test_5.sh: New file.
10784 * testsuite/script_test_5.t: New file.
10785
10786 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10787
10788 * archive.cc (Archive::include_member): Update calls to add_symbols.
10789 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10790 the Layout argument.
10791 * dynobj.h (do_add_symbols): Add the Layout argument.
10792 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10793 Layout argument.
10794 * object.h (Object::add_symbols): Add the Layout argument.
10795 (Object::do_add_symbols): Add the Layout argument.
10796 (Sized_relobj::do_add_symbols): Add the Layout argument.
10797 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10798 Unify the two versions.
10799 (Add_plugin_symbols): Remove.
10800 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10801 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10802 (Add_plugin_symbols): Remove.
10803 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10804 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10805 (Add_symbols::run): Make it work with Pulginobj.
10806
10807 2009-02-06 Ian Lance Taylor <iant@google.com>
10808
10809 * object.cc (Sized_relobj::do_layout): Make info message start
10810 with lower case letter.
10811
10812 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10813
10814 * binary.cc: Fix file comment.
10815
10816 * options.h (enum Incremental_disposition): Define.
10817 (class General_options): Add new options: --incremental,
10818 --incremental_changed, --incremental_unchanged,
10819 --incremental_unknown. Add incremental_disposition_ and
10820 implicit_incremental_ fields.
10821 (General_options::incremental_disposition): New function.
10822 (class Position_dependent_options): Add incremental_disposition
10823 option.
10824 (Position_dependent_options::copy_from_options): Set incremental
10825 dispositions.
10826 * options.cc (General_options::parse_incremental_changed): New
10827 function.
10828 (General_options::parse_incremental_unchanged): New function.
10829 (General_options::parse_incremental_unknown): New function.
10830 (General_options::General_options): Initialize new fields
10831 incremental_disposition_ and implicit_incremental_.
10832 (General_options::finalize): Check for uasge of --incremental-*
10833 without --incremental.
10834
10835 2009-02-06 Chris Demetriou <cgd@google.com>
10836
10837 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10838 pointer and to report location as the file name associated with
10839 the symbol.
10840 (gold_undefined_symbol_at_location): New function to replace the
10841 old gold_undefined_symbol functionality.
10842 * target-reloc.h (relocate_section): Update to use
10843 gold_undefined_symbol_at_location.
10844 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10845 Call gold_undefined_symbol function rather than gold_error.
10846 * errors.h (Errors::undefined_symbol): Take location as a
10847 string, rather than calculating it from a relocation.
10848 * errors.cc (Errors::fatal): Print "fatal error:" before the
10849 formatted message.
10850 (Errors::error, Errors::error_at_location): Print "error: "
10851 before the formatted message.
10852 (Errors::undefined_symbol): Take location as a string, rather
10853 than calculating it from a relocation.
10854 (gold_undefined_symbol_at_location): New function akin to
10855 old gold_undefined_symbol, calculates location from relocation.
10856 (gold_undefined_symbol): Change to take only a Symbol pointer
10857 and to report location as the file name associated with the symbol.
10858 * testsuite/debug_msg.sh: Update for changed error messages.
10859 * testsuite/undef_symbol.sh: Likewise.
10860
10861 2009-02-04 Duncan Sands <baldrick@free.fr>
10862
10863 PR 9812
10864 * reduced_debug_output.h
10865 (Output_reduced_debug_abbrev_section::failed): Use format for
10866 gold_warning.
10867 (Output_reduced_debug_info_section::faild): Likewise.
10868
10869 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10870
10871 * script.cc (Lazy_demangler): New class.
10872 (Version_script_info::get_symbol_version_helper): Demangle a
10873 symbol only once.
10874
10875 2009-01-29 Cary Coutant <ccoutant@google.com>
10876
10877 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10878 to __tls_get_addr.
10879 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10880
10881 2009-01-28 Ian Lance Taylor <iant@google.com>
10882
10883 * version.cc (version_string): Bump to 1.9.
10884
10885 * gold.h: Include <cstring> and <stdint.h>.
10886 * version.cc: Include <cstdio>.
10887 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10888 warning.
10889 * reduced_debug_output.cc (insert_into_vector): Rename from
10890 Insert_into_vector; change all callers. Use Swap_unaligned to
10891 avoid aliasing issue; remove union since it is unnecessary.
10892
10893 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10894
10895 * Makefile.am (CCFILES): Add gc.cc.
10896 (HFILES): Add gc.h.
10897 * Makefile.in: Regenerate.
10898 * gold.cc (Gc_runner): New class.
10899 (queue_initial_tasks): Call garbage collection related tasks
10900 when corresponding options are invoked.
10901 (queue_middle_gc_tasks): New function.
10902 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10903 processed early before laying out sections during garbage collection.
10904 * gold.h (queue_middle_gc_tasks): New function.
10905 (is_prefix_of): Move from "layout.cc".
10906 * i386.cc (Target_i386::gc_process_relocs): New function.
10907 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10908 * main.cc (main): Create object of class "Garbage_collection".
10909 * object.cc (Relobj::copy_symbols_data): New function.
10910 (Relobj::is_section_name_included): New function.
10911 (Sized_relobj::do_layout): Allow this function to be called twice
10912 during garbage collection and defer layout of section during the
10913 first call.
10914 * object.h (Relobj::get_symbols_data): New function.
10915 (Relobj::is_section_name_included): New function.
10916 (Relobj::copy_symbols_data): New function.
10917 (Relobj::set_symbols_data): New function.
10918 (Relobj::get_relocs_data): New function.
10919 (Relobj::set_relocs_data): New function.
10920 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10921 (Relobj::gc_process_relocs): New function.
10922 (Relobj::do_gc_process_relocs): New pure virtual function.
10923 (Relobj::sd_): New data member.
10924 (Sized_relobj::is_output_section_offset_invalid): New function.
10925 (Sized_relobj::do_gc_process_relocs): New function.
10926 * options.h (General_options::gc_sections): Modify to not be a no-op.
10927 (General_options::print_gc_sections): New option.
10928 * plugin.cc (Plugin_finish::run): Remove function call to
10929 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10930 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10931 * reloc.cc (Read_relocs::run): Add task to process relocs and
10932 determine unreferenced sections when doing garbage collection.
10933 (Gc_process_relocs): New class.
10934 (Sized_relobj::do_gc_process_relocs): New function.
10935 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10936 sections that are garbage collected.
10937 * reloc.h (Gc_process_relocs): New class.
10938 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10939 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10940 symbols whose corresponding sections are garbage collected.
10941 (Symbol_table::Symbol_table): Add new parameter for the garbage
10942 collection object.
10943 (Symbol_table::gc_mark_undef_symbols): New function.
10944 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10945 (Symbol_table::gc_mark_dyn_syms): New function.
10946 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10947 as garbage.
10948 (Symbol_table::add_from_object): Likewise.
10949 (Symbol_table::add_from_relobj): When building shared objects, do not
10950 treat externally visible symbols as garbage.
10951 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10952 table information for static and relocatable links.
10953 * symtab.h (Symbol_table::set_gc): New function.
10954 (Symbol_table::gc): New function.
10955 (Symbol_table::gc_mark_undef_symbols): New function.
10956 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10957 (Symbol_table::gc_mark_dyn_syms): New function.
10958 (Symbol_table::gc_): New data member.
10959 * target.h (Sized_target::gc_process_relocs): New pure virtual
10960 function.
10961 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10962 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10963
10964 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10965
10966 * options.h (General_options::gc_sections): Define as a no-op for now.
10967 (General_options::no_keep_memory): Ditto.
10968 (General_options::Bshareable): Define.
10969 * options.cc (General_options::finalize): Honor -Bshareable.
10970
10971 2009-01-20 Andreas Schwab <schwab@suse.de>
10972
10973 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10974 read the value in the contents, since we don't use it. Use the
10975 template endianness when writing.
10976 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10977
10978 2009-01-19 Andreas Schwab <schwab@suse.de>
10979
10980 * configure.tgt (powerpc64-*): Fix targ_obj.
10981
10982 2009-01-15 Ian Lance Taylor <iant@google.com>
10983
10984 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10985 local symbols when stripping all symbols.
10986
10987 2009-01-14 Cary Coutant <ccoutant@google.com>
10988
10989 * output.cc (Output_reloc): Add explicit instantiations.
10990
10991 2009-01-14 Cary Coutant <ccoutant@google.com>
10992
10993 * archive.cc (Archive::get_elf_object_for_member): Remove call
10994 to File_read::claim_for_plugin.
10995 * descriptors.cc (Descriptors::open): Remove reference to
10996 is_claimed.
10997 (Descriptors::claim_for_plugin): Remove.
10998 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10999 (Descriptors::is_claimed): Remove.
11000 (claim_descriptor_for_plugin): Remove.
11001 * fileread.cc (File_read::claim_for_plugin): Remove.
11002 * fileread.h (File_read::claim_for_plugin): Remove.
11003 (File_read::descriptor): Reopen descriptor if necessary.
11004 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11005 (Plugin_manager::all_symbols_read): Add task parameter. Change
11006 all callers.
11007 (Plugin_manager::get_input_file): New function.
11008 (Plugin_manager::release_input_file): New function.
11009 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11010 corresponding data member.
11011 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11012 and pass to base constructor. Change all callers.
11013 (get_input_file, release_input_file): New functions.
11014 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11015 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11016 (Plugin_manager::all_symbols_read): Add task parameter.
11017 (Plugin_manager::get_input_file): New function.
11018 (Plugin_manager::release_input_file): New function.
11019 (Plugin_manager::task_): New data member.
11020 (Pluginobj::Pluginobj): Add filesize parameter.
11021 (Pluginobj::filename): New function.
11022 (Pluginobj::descriptor): New function.
11023 (Pluginobj::filesize): New function.
11024 (Pluginobj::filesize_): New data member.
11025 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11026 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11027 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11028
11029 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11030 with archive libraries.
11031 * testsuite/Makefile.in: Regenerate.
11032 * testsuite/plugin_test.c (struct sym_info): New type.
11033 (get_input_file, release_input_file): New static variables.
11034 (onload): Capture new transfer vector entries.
11035 (claim_file_hook): Stop reading at end of file according to filesize.
11036 Factor out parsing of readelf output into separate function.
11037 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11038 APIs and get the source file name from the symbol table. Convert
11039 source file name to corresponding object file name. Print info
11040 message when adding new input files.
11041 (parse_readelf_line): New function.
11042 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11043 * testsuite/plugin_test_2.sh: Likewise.
11044 * testsuite/plugin_test_3.sh: Likewise.
11045 * testsuite/plugin_test_4.sh: New test case.
11046
11047 2009-01-07 Ian Lance Taylor <iant@google.com>
11048
11049 * version.cc (version_string): Bump to 1.8.
11050
11051 2008-12-23 Cary Coutant <ccoutant@google.com>
11052
11053 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11054 * plugin.cc (Plugin_manager::finish): Rename as
11055 layout_deferred_objects. Move cleanup to separate function.
11056 (Plugin_manager::cleanup): New function.
11057 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11058 separately.
11059 * plugin.h (Plugin_manager::finish): Rename as
11060 layout_deferred_objects.
11061 (Plugin_manager::cleanup): New function.
11062 (Plugin_manager::cleanup_done): New field.
11063
11064 2008-12-23 Cary Coutant <ccoutant@google.com>
11065
11066 * plugin.cc (is_visible_from_outside): New function.
11067 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11068 so we don't return "IR only" status for exported symbols or -r links.
11069
11070 * testsuite/Makefile.am (plugin_test_3): New test case.
11071 * testsuite/Makefile.in: Regenerate.
11072 * testsuite/plugin_test_3.sh: New file.
11073
11074 2008-12-22 Cary Coutant <ccoutant@google.com>
11075
11076 * object.cc (Sized_relobj::layout_section): New function.
11077 (Sized_relobj::do_layout): Defer layout of input sections until after
11078 plugin has provided replacement files.
11079 (Sized_relobj::do_layout_deferred_sections): New function.
11080 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11081 (Relobj::layout_deferred_sections): New function.
11082 (Relobj::do_layout_deferred_sections): New function.
11083 (Sized_relobj::do_layout_deferred_sections): New function.
11084 (Sized_relobj::layout_section): New function.
11085 (Sized_relobj::Deferred_layout): New structure.
11086 (Sized_relobj::deferred_layout_): New field.
11087 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11088 Change all callers. Layout deferred sections.
11089 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11090 references.
11091 (Plugin_hook::run): Move code from do_plugin_hook inline.
11092 (Plugin_hook::do_plugin_hook): Remove.
11093 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11094 (Plugin_manager::finish): Renamed, was cleanup.
11095 (Plugin_manager::should_defer_layout): New function.
11096 (Plugin_manager::add_deferred_layout_object): New function.
11097 (Plugin_manager::Deferred_layout_list): New type.
11098 (Plugin_manager::deferred_layout_objects_): New field.
11099 (Plugin_hook::do_plugin_hook): Remove.
11100
11101 2008-12-17 Ian Lance Taylor <iant@google.com>
11102
11103 * options.h (class General_options): Add --no case for
11104 --export-dynamic.
11105
11106 2008-12-16 Cary Coutant <ccoutant@google.com>
11107
11108 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11109 vector.
11110 (Plugin_manager::claim_file): Create plugin object even if
11111 plugin did not call the add_symbols callback.
11112 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11113 asking for more symbols than were added.
11114 * testsuite/Makefile.am (plugin_test_1): Add test case with
11115 no global symbols.
11116 (empty.syms): New target.
11117 * testsuite/Makefile.in: Regenerate.
11118 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11119 message. Don't call add_symbols if no globals.
11120 (all_symbols_read_hook): Don't provide replacement for empty
11121 claimed file.
11122
11123 2008-12-12 Ian Lance Taylor <iant@google.com>
11124
11125 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11126 r_type == 0 for a local symbol with r_sym == 0.
11127 (scan_relocatable_relocs): Pass r_sym to
11128 local_non_section_strategy.
11129 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11130 r_sym parameter.
11131
11132 * configure.ac: Update test for TLS descriptors: they are
11133 supported as of glibc 2.9.
11134 * configure: Rebuild.
11135
11136 2008-12-11 Ian Lance Taylor <iant@google.com>
11137
11138 PR 7091
11139 * target-reloc.h (Default_scan_relocatable_relocs): For each
11140 function, map r_type == 0 to RELOC_DISCARD.
11141
11142 2008-12-10 Cary Coutant <ccoutant@google.com>
11143
11144 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11145 object to override a kept COMDAT group from a plugin object.
11146
11147 2008-12-09 Ian Lance Taylor <iant@google.com>
11148
11149 PR 7088
11150 * yyscript.y (file_cmd): Handle INPUT.
11151
11152 * testsuite/initpri1.c: Change all declarations to be full
11153 prototypes by adding void, to avoid compiler warnings.
11154
11155 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11156
11157 * options.cc (General_options::parse_plugin_opt): New.
11158 (General_options::add_plugin): The argument now is just the filename.
11159 (General_options::add_plugin_option): New.
11160 * options.h (plugin_opt): New.
11161 (add_plugin): Change argument name.
11162 (add_plugin_option): New.
11163 * plugin.cc (Plugin::load): Don't parse the plugin option.
11164 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11165 (Plugin::add_option): New.
11166 (Plugin::args_): Change type.
11167 (Plugin::filename_): New.
11168 (Plugin_manager::add_plugin_option): New.
11169 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11170 * testsuite/Makefile.in: Regenerate.
11171
11172 2008-12-05 Cary Coutant <ccoutant@google.com>
11173
11174 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11175 Handle --strip-lto-sections option.
11176 * options.h (strip_lto_sections): New option.
11177
11178 2008-12-01 Cary Coutant <ccoutant@google.com>
11179
11180 * plugin.cc (ld_plugin_message): Change format parameter to const.
11181 Fix mismatch between new[] and delete.
11182
11183 2008-11-14 Cary Coutant <ccoutant@google.com>
11184
11185 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11186 instead of -1U.
11187
11188 2008-11-05 Craig Silverstein <csilvers@google.com>
11189
11190 * options.cc (General_options::parse_dynamic_list): New function.
11191 * options.h (General_options): New flags dynamic_list,
11192 dynamic_list_data, dynamic_list_cpp_new, and
11193 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11194 (General_options::in_dynamic_list): New function.
11195 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11196 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11197 (Lex::can_continue_name): Likewise.
11198 (yylex): Likewise.
11199 (read_script_file): New parameter script_options.
11200 (read_dynamic_list): New function.
11201 (Script_options::define_dynamic_list): New function.
11202 (dynamic_list_keyword_parsecodes): New variable.
11203 (dynamic_list_keywords): New variable.
11204 * script.h (Script_options::define_dynamic_list): New function
11205 prototype.
11206 (read_dynamic_list): New function prototype.
11207 * symtab.cc (strprefix): New macro.
11208 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11209 dynamic_list_data, dynamic_list_cpp_new, and
11210 dynamic_list_cpp_typeinfo.
11211 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11212 (dynamic_list_expr): New rule.
11213 (dynamic_list_nodes): Likewise.
11214 (dynamic_list_node): Likewise.
11215 * testsuite/Makefile.am (dynamic_list): New test.
11216 * testsuite/Makefile.in: Regenerated.
11217 * testsuite/dynamic_list.t: New file.
11218 * testsuite/dynamic_list.sh: New file.
11219
11220 2008-11-05 Craig Silverstein <csilvers@google.com>
11221
11222 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11223 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11224 (t11_last): Likewise.
11225 * testsuite/ver_test_6.c (main): Likewise.
11226
11227 2008-10-07 Cary Coutant <ccoutant@google.com>
11228
11229 * options.c (General_options::finalize): Add check for -static and
11230 -shared.
11231 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11232 is not empty.
11233
11234 2008-10-02 Cary Coutant <ccoutant@google.com>
11235
11236 * plugin.cc (make_sized_plugin_object): Fix conditional
11237 compilation to work when not all targets are enabled.
11238
11239 2008-09-29 Cary Coutant <ccoutant@google.com>
11240
11241 * archive.cc (Archive::get_file_and_offset): Use filename instead
11242 of name to get library path.
11243 (Archive::include_member): Unlock external member of a thin archive.
11244
11245 * testsuite/Makefile.am (TEST_AR): New variable.
11246 (thin_archive_test_1): New test.
11247 (thin_archive_test_2): New test.
11248 * testsuite/Makefile.in: Regenerate.
11249 * testsuite/thin_archive_main.cc: New file.
11250 * testsuite/thin_archive_test_1.cc: New file.
11251 * testsuite/thin_archive_test_2.cc: New file.
11252 * testsuite/thin_archive_test_3.cc: New file.
11253 * testsuite/thin_archive_test_4.cc: New file.
11254
11255 2008-09-29 Cary Coutant <ccoutant@google.com>
11256
11257 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11258 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11259 instead of -1U.
11260 (Sized_relobj::do_finalize_local_symbols): Likewise.
11261 (Sized_relobj::map_to_kept_section): Likewise.
11262 * object.h (Sized_relobj::invalid_address): New constant.
11263 (Sized_relobj::do_output_section_offset): Check for invalid_address
11264 and return -1ULL.
11265 * output.cc (Output_reloc::local_section_offset): Use constant
11266 invalid_address instead of -1U.
11267 (Output_reloc::get_address): Likewise.
11268 (Output_section::output_address): Change -1U to -1ULL.
11269 * output.h (Output_reloc::invalid_address): New constant.
11270 * reloc.cc (Sized_relobj::write_sections): Use constant
11271 invalid_address instead of -1U.
11272 (Sized_relobj::relocate_sections): Likewise.
11273 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11274 values for merge sections.
11275 * target-reloc.h (relocate_for_relocatable): Use constant
11276 invalid_address instead of -1U.
11277
11278 2008-09-19 Cary Coutant <ccoutant@google.com>
11279
11280 Add plugin functionality for link-time optimization (LTO).
11281 * configure.ac (plugins): Add --enable-plugins option.
11282 * configure: Regenerate.
11283 * config.in: Regenerate.
11284 * Makefile.am (LIBDL): New variable.
11285 (CCFILES): Add plugin.cc.
11286 (HFILES): Add plugin.h.
11287 (ldadd_var): Add LIBDL.
11288 * Makefile.in: Regenerate.
11289
11290 * archive.cc: Include "plugin.h".
11291 (Archive::setup): Don't preread archive symbols when using a plugin.
11292 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11293 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11294 files.
11295 (Archive::include_member): Add symbols from plugin objects.
11296 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11297 * descriptors.cc (Descriptors::open): Check for file descriptors
11298 abandoned by plugins.
11299 (Descriptors::claim_for_plugin): New function.
11300 * descriptors.h (Descriptors::claim_for_plugin): New function.
11301 (Open_descriptor::is_claimed): New field.
11302 (claim_descriptor_for_plugin): New function.
11303 * fileread.cc (File_read::claim_for_plugin): New function.
11304 * fileread.h (File_read::claim_for_plugin): New function.
11305 (File_read::descriptor): New function.
11306 * gold.cc: Include "plugin.h".
11307 (queue_initial_tasks): Add task to call plugin hooks for generating
11308 new object files.
11309 * main.cc: Include "plugin.h".
11310 (main): Load plugin libraries.
11311 * object.h (Pluginobj): Declare.
11312 (Object::pluginobj): New function.
11313 (Object::do_pluginobj): New function.
11314 (Object::set_target): New function.
11315 * options.cc: Include "plugin.h".
11316 (General_options::parse_plugin): New function.
11317 (General_options::General_options): Initialize plugins_ field.
11318 (General_options::add_plugin): New function.
11319 * options.h (Plugin_manager): Declare.
11320 (General_options): Add --plugin option.
11321 (General_options::has_plugins): New function.
11322 (General_options::plugins): New function.
11323 (General_options::add_plugin): New function.
11324 (General_options::plugins_): New field.
11325 * plugin.cc: New file.
11326 * plugin.h: New file.
11327 * readsyms.cc: Include "plugin.h".
11328 (Read_symbols::do_read_symbols): Check for archive before checking
11329 for ELF file. Call plugin hooks to claim files.
11330 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11331 from a real object file; force override when processing replacement
11332 files.
11333 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11334 (Symbol::init_base_object): Likewise.
11335 (Symbol::init_base_output_data): Likewise.
11336 (Symbol::init_base_output_segment): Likewise.
11337 (Symbol::init_base_constant): Likewise.
11338 (Symbol::init_base_undefined): Likewise.
11339 (Symbol::output_section): Assert that object is not a plugin.
11340 (Symbol_table::add_from_pluginobj): New function.
11341 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11342 undefined.
11343 (Symbol_table::sized_write_globals): Likewise.
11344 (Symbol_table::add_from_pluginobj): Instantiate template.
11345 * symtab.h (Sized_pluginobj): Declare.
11346 (Symbol::in_real_elf): New function.
11347 (Symbol::set_in_real_elf): New function.
11348 (Symbol::in_real_elf_): New field.
11349 (Symbol_table::add_from_pluginobj): New function.
11350
11351 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11352 (LIBDL): New variable.
11353 (LDADD): Add LIBDL.
11354 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11355 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11356 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11357 (MOSTLYCLEANFILES): Likewise.
11358 * testsuite/Makefile.in: Regenerate.
11359 * testsuite/plugin_test.c: New file.
11360 * testsuite/plugin_test_1.sh: New file.
11361 * testsuite/plugin_test_2.sh: New file.
11362
11363 2008-09-16 Ian Lance Taylor <iant@google.com>
11364
11365 * target-reloc.h (relocate_section): Check whether a symbol is
11366 defined by the ABI before reporting an undefined symbol error.
11367 * target.h (Target::is_defined_by_abi): Make parameter const.
11368 (Target::do_is_defined_by_abi): Likewise.
11369 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11370 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11371 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11372 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11373 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11374 * testsuite/Makefile.in: Rebuild.
11375
11376 * fileread.cc (make_view): Add casts to avoid warning.
11377
11378 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11379
11380 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11381 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11382
11383 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11384
11385 * options.h (General_options::output_is_executable): New.
11386 (General_options::output_is_pie): New.
11387 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11388 for shared libraries.
11389 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11390
11391 2008-09-11 Chris Demetriou <cgd@google.com>
11392
11393 * options.h (origin): New -z option.
11394 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11395 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11396 in DT_FLAGS_1.
11397
11398 2008-09-05 Cary Coutant <ccoutant@google.com>
11399
11400 * fileread.cc (File_read::make_view): Add check for attempt to map
11401 beyond end of file.
11402
11403 2008-09-05 Cary Coutant <ccoutant@google.com>
11404
11405 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11406 explicit instantiations.
11407
11408 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11409
11410 PR gold/6858
11411 * options.cc (General_options::finalize): Allow undefined symbols
11412 in shlibs if linking -shared.
11413
11414 PR gold/6859
11415 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11416 symbols as not needing a dynsym entry.
11417
11418 2008-08-20 Craig Silverstein <csilvers@google.com>
11419
11420 * fileread.cc (File_read::open): Do not lock the file unless it
11421 was successfully opened.
11422
11423 2008-08-14 Cary Coutant <ccoutant@google.com>
11424
11425 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11426 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11427 * testsuite/tls_test.cc (struct int128): 128-bit struct
11428 for testing TLS relocs with non-zero addend.
11429 (v12): New TLS variable.
11430 (t12): New test.
11431 (t_last): Add check for v12.
11432 * testsuite/tls_test.h (t12): New function.
11433 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11434
11435 2008-08-13 Ian Lance Taylor <iant@google.com>
11436
11437 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11438 set tls_segment_ or relro_segment_.
11439 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11440 when appropriate.
11441 * output.h (Output_section::clear_is_relro): New function.
11442 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11443 sections specially even when output_data_ is empty.
11444 (Output_segment::maximum_alignment): When first section is relro,
11445 only force alignment for PT_LOAD segments.
11446 * script.cc (script_data_segment_align): New function.
11447 (script_data_segment_relro_end): New function.
11448 * script-c.h (script_data_segment_align): Declare.
11449 (script_data_segment_relro_end): Declare.
11450 * script-sections.h (class Script_sections): Declare
11451 data_segment_align and data_segment_relro_end. Add fields
11452 segment_align_index_ and saw_relro_end_.
11453 * script-sections.cc (class Sections_element): Add set_is_relro
11454 virtual function. Add new bool* parameter to place_orphan_here.
11455 Add get_output_section virtual function.
11456 (class Output_section_definition): Add set_is_relro. Add new
11457 bool* parameter to place_orphan_here. Add get_output_section.
11458 Add is_relro_ field.
11459 (Output_section_definition::Output_section_definition): Initialize
11460 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11461 and is_relro_ fields.
11462 (Output_section_definition::place_orphan_here): Add is_relro
11463 parameter.
11464 (Output_section_definition::set_section_addresses): Set relro for
11465 output section.
11466 (Output_section_definition::alternate_constraint): Likewise.
11467 (class Orphan_output_section): Add new bool* parameter to
11468 place_orphan_here. Add get_output_section.
11469 (Orphan_output_section::place_orphan_here): Add is_relro
11470 parameter.
11471 (Script_sections::Script_sections): Initialize
11472 data_segment_align_index_ and saw_relro_end_.
11473 (Script_sections::data_segment_align): New function.
11474 (Script_sections::data_segment_relro_end): New function.
11475 (Script_sections::place_orphan): Set or clear is_relro.
11476 (Script_sections::set_section_addresses): Force alignment of first
11477 TLS section.
11478 * yyscript.y (exp): Call script_data_segment_align and
11479 script_data_segment_relro_end.
11480 * testsuite/relro_script_test.t: New file.
11481 * testsuite/relro_test.cc (using_script): Declare.
11482 (t1, t2): Test using_script.
11483 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11484 (relro_script_test_SOURCES): Define.
11485 (relro_script_test_DEPENDENCIES): Define.
11486 (relro_script_test_LDFLAGS): Define.
11487 (relro_script_test_LDADD): Define.
11488 (relro_script_test.so): New target.
11489 * testsuite/Makefile.in: Rebuild.
11490
11491 2008-08-06 Cary Coutant <ccoutant@google.com>
11492
11493 * archive.cc (Archive::total_archives, Archive::total_members)
11494 (Archive::total_members_loaded): New variables.
11495 (Archive::setup): Add parameter. Add option to preread
11496 archive symbols.
11497 (Archive::read_armap): Add counter.
11498 (Archive::get_file_and_offset): New function.
11499 (Archive::get_elf_object_for_member): New function.
11500 (Archive::read_all_symbols): New function.
11501 (Archive::read_symbols): New function.
11502 (Archive::add_symbols): Add counters.
11503 (Archive::include_all_members): Use armap to find members if it's
11504 already built.
11505 (Archive::include_member): Skip reading symbols if already read.
11506 Factored code into Archive::get_file_and_offset and
11507 Archive::get_elf_object_for_member. Changed call to
11508 Mapfile::report_include_archive_member.
11509 (Archive::print_stats): New function.
11510 * archive.h: Declare Object and Read_symbols_data classes.
11511 (Archive::Archive): Add initializers for new members.
11512 (Archive::setup): Add parameter.
11513 (Archive::print_stats): New function.
11514 (Archive::total_archives, Archive::total_members)
11515 (Archive::total_members_loaded): New variables.
11516 (Archive::get_file_and_offset): New function.
11517 (Archive::get_elf_object_for_member): New function.
11518 (Archive::read_all_symbols): New function.
11519 (Archive::read_symbols): New function.
11520 (Archive::Archive_member): New class.
11521 (Archive::members_): New member.
11522 (Archive::num_members_): New member.
11523 * main.cc: Include archive.h.
11524 (main): Call Archive::print_stats.
11525 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11526 archive parameter; member_name is now the fully-decorated name.
11527 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11528 * options.h: (General_options): Add --preread-archive-symbols option.
11529 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11530 Archive::setup.
11531
11532 2008-08-04 Ian Lance Taylor <iant@google.com>
11533
11534 * symtab.h (Symbol::use_plt_offset): New function.
11535 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11536 * powerpc.cc (Relocate::relocate): Likewise.
11537 * sparc.cc (Relocate::relocate): Likewise.
11538 * x86_64.cc (Relocate::relocate): Likewise.
11539 * testsuite/weak_plt.sh: New test.
11540 * testsuite/weak_plt_main.cc: New test.
11541 * testsuite/weak_plt_shared.cc: New test.
11542 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11543 (check_PROGRAMS): Add weak_plt.
11544 (check_DATA): Add weak_plt_shared.so.
11545 (weak_plt_main_pic.o, weak_plt): New targets.
11546 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11547 * testsuite/Makefile.in: Rebuild.
11548
11549 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11550 gcctestdir/ld.
11551 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11552 * testsuite/Makefile.in: Rebuild.
11553
11554 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11555
11556 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11557 * Makefile.in: Regenerate.
11558 * po/POTFILES.in: Regenerate.
11559
11560 2008-07-29 Ian Lance Taylor <iant@google.com>
11561
11562 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11563 symbols before other symbols.
11564 * testsuite/script_test_2.cc (test_addr): Declare.
11565 (test_addr_alias): Declare.
11566 (main): Check that test_addr and test_addr_alias have the right
11567 values.
11568 * testsuite/script_test_2.t: Define test_addr_alias and
11569 test_addr.
11570
11571 2008-07-24 Ian Lance Taylor <iant@google.com>
11572
11573 PR 5990
11574 * descriptors.cc: New file.
11575 * descriptors.h: New file.
11576 * gold-threads.h (class Hold_optional_lock): New class.
11577 * fileread.cc: Include "descriptors.h".
11578 (File_read::~File_read): Release descriptor rather than closing
11579 it.
11580 (File_read::open) [file]: Call open_descriptor rather than open.
11581 Set is_descriptor_opened_.
11582 (File_read::open) [memory]: Assert that descriptor is not open.
11583 (File_read::reopen_descriptor): New function.
11584 (File_read::release): Release descriptor.
11585 (File_read::do_read): Make non-const. Reopen descriptor.
11586 (File_read::read): Make non-const.
11587 (File_read::make_view): Reopen descriptor.
11588 (File_read::do_readv): Likewise.
11589 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11590 Update declarations.
11591 * layout.cc: Include "descriptors.h".
11592 (Layout::create_build_id): Use open_descriptor rather than open.
11593 * output.cc: Include "descriptors.h".
11594 (Output_file::open): Use open_descriptor rather than open.
11595 * archive.cc (Archive::const_iterator): Change Archive to be
11596 non-const.
11597 (Archive::begin, Archive::end): Make non-const.
11598 (Archive::count_members): Likewise.
11599 * archive.h (class Archive): Update declarations.
11600 * object.h (Object::read): Make non-const.
11601 * Makefile.am (CCFILES): Add descriptors.cc.
11602 (HFILES): Add descriptors.h.
11603 * Makefile.in: Rebuild.
11604
11605 PR 6716
11606 * gold.h: Always include <clocale>. Add Solaris workarounds
11607 following code in binutils/sysdep.h.
11608
11609 PR 6048
11610 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11611 this->eh_frame_hdr_ is NULL before using it.
11612
11613 * dynobj.cc (Versions::Versions): Update comment.
11614
11615 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11616 the base version name.
11617
11618 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11619 array size plus one.
11620 (Stringpool_template::set_string_offsets): Subtract one from key
11621 before using it as an array index.
11622 (Stringpool_template::get_offset_with_length): Likewise.
11623 (Stringpool_template::write_to_buffer): Likewise.
11624 * stringpool.h (Stringpool_template::get_offset_from_key):
11625 Likewise.
11626
11627 2008-07-23 Ian Lance Taylor <iant@google.com>
11628
11629 PR 6658
11630 * object.h (Merged_symbol_value::value): Do our best to handle a
11631 negative addend.
11632
11633 PR 6647
11634 * script.cc (Version_script_info::get_versions): Don't add empty
11635 version tag to return value.
11636 (Version_script_info::get_symbol_version_helper): Change return
11637 type to bool. Add pversion parameter. Change all callers.
11638 (script_register_vers_node): Don't require a non-NULL tag.
11639 * script.h (class Version_script_info): Update declarations.
11640 (Version_script_info::get_symbol_version): Change return type to
11641 bool. Add version parameter. Change all callers.
11642 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11643 handling. Handle an empty version from a version script.
11644 (Symbol_table::define_special_symbol): Likewise.
11645 * testsuite/ver_test_10.script: New file.
11646 * testsuite/ver_test_10.sh: New file.
11647 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11648 (check_DATA): Add ver_test_10.syms.
11649 (ver_test_10.syms, ver_test_10.so): New target.
11650 * testsuite/Makefile.in: Rebuild.
11651
11652 2008-07-23 Simon Baldwin <simonb@google.com>
11653
11654 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11655 to zero for undefined symbols from dynamic libraries.
11656
11657 2008-07-23 Ian Lance Taylor <iant@google.com>
11658
11659 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11660 Change all callers.
11661 * symtab.h (class Symbol_table): Update declaration.
11662 * testsuite/ver_test_9.cc: New file.
11663 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11664 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11665 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11666 (ver_test_9.so, ver_test_9.o): New targets.
11667 * testsuite/Makefile.in: Rebuild.
11668
11669 2008-07-22 Ian Lance Taylor <iant@google.com>
11670
11671 * options.h (class General_options): Define --check-sections.
11672 * layout.cc (Layout::set_segment_offsets): Handle
11673 --check-sections.
11674
11675 * options.h (class General_options): Define -n/--nmagic and
11676 -N/--omagic.
11677 * options.cc (General_options::finalize): For -n/--nmagic or
11678 -N/--omagic, set -static.
11679 * layout.cc (Layout::attach_allocated_section_to_segment): If
11680 -N/--omagic, don't put read-only and read-write sections in
11681 different segments.
11682 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11683 finding a read-only segment.
11684 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11685 don't set the minimum segment alignment to the common page size,
11686 and don't set the file offset to the address modulo the page size.
11687 * script-sections.cc (Script_sections::create_segments): If
11688 -n/--omagic, don't put read-only and read-write sections in
11689 different segments.
11690
11691 * cref.cc: New file.
11692 * cref.h: New file.
11693 * options.h (class General_options): Add --print-symbol-counts.
11694 * main.cc (main): Issue defined symbol report if requested.
11695 * archive.cc (Archive::interpret_header): Make into a const member
11696 function.
11697 (Archive::add_symbols): Call Input_objects::archive_start and
11698 archive_stop.
11699 (Archive::const_iterator): Define new class.
11700 (Archive::begin, Archive::end): New functions.
11701 (Archive::include_all_members): Rewrite to use iterator.
11702 (Archive::count_members): New function.
11703 * archive.h (class Archive): Update declarations.
11704 (Archive::filename): New function.
11705 * object.cc: Include "cref.h".
11706 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11707 (Sized_relobj::do_get_global_symbol_counts): New function.
11708 (Input_objects::add_object): Add object to cross-referencer.
11709 (Input_objects::archive_start): New function.
11710 (Input_objects::archive_stop): New function.
11711 (Input_objects::print_symbol_counts): New function.
11712 * object.h: Declare Cref and Archive.
11713 (Object::get_global_symbol_counts): New function.
11714 (Object::do_get_global_symbol_counts): New pure virtual function.
11715 (class Sized_relobj): Add defined_count_ field. Update
11716 declarations.
11717 (class Input_objects): Add cref_ field. Update constructor.
11718 Update declarations.
11719 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11720 defined_count_.
11721 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11722 symbol counts.
11723 (Sized_dynobj::do_get_global_symbol_counts): New function.
11724 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11725 defined_count_. Update declarations. Define Symbols typedef.
11726 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11727 parameter. Change all callers.
11728 (Symbol_table::add_from_dynobj): Add sympointers and defined
11729 parameters. Change all callers.
11730 * symtab.h (class Symbol_table): Update declarations.
11731 * Makefile.am (CCFILES): Add cref.cc.
11732 (HFILES): Add cref.h.
11733 * Makefile.in: Rebuild.
11734
11735 2008-07-22 Simon Baldwin <simonb@google.com>
11736
11737 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11738 to zero when writing undefined symbols.
11739
11740 2008-07-22 Ian Lance Taylor <iant@google.com>
11741
11742 * output.cc (Output_section::add_input_section): Don't try to
11743 merge empty merge sections.
11744
11745 2008-07-21 Craig Silverstein <csilvers@google.com>
11746
11747 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11748 Include symbol version in error message.
11749
11750 2008-07-20 Chris Demetriou <cgd@google.com>
11751
11752 * configure.ac (gold_cv_c_random_seed): New configured variable.
11753 (RANDOM_SEED_CFLAGS): New substituted variable.
11754 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11755 * configure: Rebuild.
11756 * Makefile.in: Likewise.
11757 * testsuite/Makefile.in: Likewise.
11758
11759 2008-07-18 Ian Lance Taylor <iant@google.com>
11760
11761 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11762 where we see NAME/NULL and NAME/VERSION as separate symbols.
11763 * testsuite/ver_test_main.cc (main): Call t4.
11764 (t4, t4_2a): Define.
11765 * testsuite/ver_test_2.cc (t4_2): Define.
11766 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11767 * testsuite/ver_test_4.cc (t4_2a): Define.
11768 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11769 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11770
11771 2008-07-17 Ian Lance Taylor <iant@google.com>
11772
11773 * dynobj.cc (Versions::add_def): If we give an error about a
11774 missing version, go ahead and create the version anyhow.
11775
11776 2008-07-10 Ian Lance Taylor <iant@google.com>
11777
11778 Handle output sections with more than 0x7fffffff bytes.
11779 * object.h (class Relobj): Change map_to_output_ to
11780 output_sections_, and just keep a section pointer. Change all
11781 uses. Move comdat group support to Sized_relobj.
11782 (Relobj::is_section_specially_mapped): Remove.
11783 (Relobj::output_section): Remove poff parameter. Change all
11784 callers.
11785 (Relobj::output_section_offset): New function.
11786 (Relobj::set_section_offset): Rewrite.
11787 (Relobj::map_to_output): Remove.
11788 (Relobj::output_sections): New function.
11789 (Relobj::do_output_section_offset): New pure virtual function.
11790 (Relobj::do_set_section_offset): Likewise.
11791 (class Sized_relobj): Add section_offsets_ field. Add comdat
11792 group support from Relobj. Update declarations.
11793 (Sized_relobj::get_output_section_offset): New function.
11794 (Sized_relobj::do_output_section_offset): New function.
11795 (Sized_relobj::do_set_section_offset): New function.
11796 * object.cc (Relobj::output_section_address): Remove.
11797 (Sized_relobj::Sized_relobj): Initialize new fields.
11798 (Sized_relobj::include_section_group): Cast find_kept_object to
11799 Sized_relobj.
11800 (Sized_relobj::include_linkonce_section): Likewise.
11801 (Sized_relobj::do_layout): Use separate arrays for output section
11802 and output offset.
11803 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11804 output_sections.
11805 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11806 output_sections and section_offsets.
11807 (Sized_relobj::write_local_symbols): Likewise.
11808 (map_to_kept_section): Compute output address directly.
11809 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11810 output_sections and section_offsets.
11811 (Sized_relobj::write_sections): Likewise.
11812 (Sized_relobj::relocate_sections): Likewise.
11813 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11814 * output.h (class Output_reloc): Update declarations. Change
11815 u2_.relobj to Sized_relobj*.
11816 (class Output_data_reloc): Change add functions to use
11817 Sized_relobj*.
11818 * output.cc (Output_reloc::Output_reloc): Change relobj to
11819 Sized_relobj*.
11820 (Output_reloc::local_section_offset): Change return type to
11821 Elf_Addr. Use get_output_section_offset.
11822 (Output_reloc::get_address): Likewise.
11823 (Output_section::is_input_address_mapped): Don't call
11824 is_section_specially_mapped.
11825 (Output_section::output_offset): Likewise.
11826 (Output_section::output_address): Likewise.
11827 (Output_section::starting_output_address): Likewise.
11828 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11829 parameter to Sized_relobj*.
11830 (Copy_relocs::need_copy_reloc): Likewise.
11831 (Copy_relocs::save): Likewise.
11832 * copy-relocs.h (class Copy_relocs): Update declarations.
11833 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11834 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11835 * target-reloc.h (relocate_for_relocatable): Change
11836 offset_in_output_section type to Elf_Addr. Change code that uses
11837 it as well.
11838 * layout.cc (Layout::layout): Always set *off.
11839 * mapfile.cc (Mapfile::print_input_section): Use
11840 output_section_offset.
11841 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11842 Sized_relobj*.
11843 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11844 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11845 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11846
11847 2008-07-03 Ian Lance Taylor <iant@google.com>
11848
11849 * layout.cc (Layout::include_section): Do not discard unrecognized
11850 SHT_STRTAB sections.
11851
11852 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11853
11854 * script.cc (Lex::can_continue_name): Make '?' allowable in
11855 version-script names.
11856 * testsuite/version_script.map: Change glob pattern to use '?'
11857
11858 2008-06-30 Manish Singh <yosh@gimp.org>
11859
11860 PR 6585
11861 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11862 Correct typo.
11863
11864 2008-06-30 Ian Lance Taylor <iant@google.com>
11865
11866 PR 6660
11867 PR 6682
11868 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11869 versions]: Don't try to read the value in the contents, since we
11870 don't use it. Use the template endianness when writing.
11871
11872 2008-06-25 Cary Coutant <ccoutant@google.com>
11873
11874 * fileread.cc (File_read::make_view): Assert on zero-length view.
11875 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11876 symbol table when there are no symbols to read.
11877
11878 2008-06-23 Craig Silverstein <csilvers@google.com>
11879
11880 * version.cc (version_string): Bump to 1.7
11881
11882 2008-06-18 Craig Silverstein <csilvers@google.com>
11883
11884 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11885 constant 0xFFFF to type Valtype.
11886 (Powerpc_relocate_functions::rel16_ha): Likewise.
11887
11888 2008-06-17 Ian Lance Taylor <iant@google.com>
11889
11890 * output.h (Output_section::Input_section): Initialize p2align_ to
11891 zero for Output_section_data constructors.
11892 (Output_section::Input_section::addralign): If not an input
11893 section, return the alignment of the Output_section_data.
11894 * testsuite/copy_test.cc: New file.
11895 * testsuite/copy_test_1.cc: New file.
11896 * testsuite/copy_test_2.cc: New file.
11897 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11898 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11899 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11900 (copy_test_1_pic.o, copy_test_1.so): New targets.
11901 (copy_test_2_pic.o, copy_test_2.so): New targets.
11902 * testsuite/Makefile.in: Rebuild.
11903
11904 * script-sections.cc (Script_sections::place_orphan): Initialize
11905 local variable exact.
11906
11907 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11908
11909 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11910
11911 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11912 David S. Miller <davem@davemloft.net>
11913
11914 * powerpc.cc: New file.
11915 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11916 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11917 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11918 * Makefile.in: Rebuild.
11919
11920 2008-06-09 Ian Lance Taylor <iant@google.com>
11921
11922 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11923 <exception>.
11924 (throwing, orig_terminate): New static variables.
11925 (terminate_handler): New static function.
11926 (t2): Set terminate handler.
11927
11928 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11929
11930 PR 6584
11931 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11932 alignment.
11933
11934 2008-05-30 Cary Coutant <ccoutant@google.com>
11935
11936 * archive.cc (Archive::include_all_members) Correct to step
11937 over symbol table and extended name table in thin archives.
11938
11939 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11940
11941 PR 6407
11942 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11943 calculation.
11944
11945 2008-05-28 Caleb Howe <cshowe@google.com>
11946
11947 * reduced_debug_output.cc: New file.
11948 * reduced_debug_output.h: New file.
11949 * options.h (class General_options): Add --strip-debug-non-line.
11950 * options.cc (General_options::finalize): Add strip_debug_non_line
11951 to the strip heirarchy.
11952 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11953 fields.
11954 * layout.cc: Include "reduced_debug_output.h".
11955 (Layout::Layout): Initialize new fields.
11956 (line_only_debug_sections): New static array.
11957 (is_lines_only_debug_sections): New static inline function.
11958 (Layout::include_section): Handle --strip-debug-non-line.
11959 (Layout::make_output_section): If --strip-debug-non-line, build
11960 new output sections for .debug_abbrev and .debug_info.
11961 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11962 gold. Warn about possible overflow.
11963 (read_signed_LEB_128): Likewise.
11964 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11965 (read_signed_LEB_128): Declare.
11966 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11967 (HFILES): Add reduced_debug_output.h.
11968 * Makefile.in: Rebuild.
11969
11970 2008-05-21 Ian Lance Taylor <iant@google.com>
11971
11972 * mapfile.cc: New file.
11973 * mapfile.h: New file.
11974 * options.h (class General_options): Add -M/--print-map and -Map.
11975 * options.cc (General_options::finalize): Make -M equivalent to
11976 -Map -.
11977 * main.cc: Include <cstdio> and "mapfile.h".
11978 (main): Open mapfile if requested.
11979 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11980 constructor. Change caller.
11981 (queue_initial_tasks): Add mapfile parameter. Change caller.
11982 (queue_middle_tasks): Likewise.
11983 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11984 declarations.
11985 * archive.cc: Include "mapfile.h".
11986 (Archive::add_symbols): Add mapfile parameter. Change all
11987 callers. Pass mapfile, symbol, and reason to include_member.
11988 (Archive::include_all_members): Add mapfile parameter. Change all
11989 callers.
11990 (Archive::include_member): Add mapfile, sym, and why parameters.
11991 Change all callers. Report inclusion to map file.
11992 * archive.h: Include "fileread.h".
11993 (class Archive): Update declarations.
11994 (Archive::file): New const method.
11995 (class Add_archive_symbols): Add mapfile_ field. Update
11996 constructor. Change all callers.
11997 * readsyms.h (class Read_symbols): Likewise.
11998 (class Finish_group): Likewise.
11999 (class Read_script): Likewise.
12000 * common.cc: Include "mapfile.h".
12001 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12002 all callers.
12003 (Symbol_table::do_allocate_commons): Likewise.
12004 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12005 symbol allocation to mapfile.
12006 * common.h (class Allocate_commons_task): Add mapfile_ field.
12007 Update constructor. Change all callers.
12008 * symtab.h (class Symbol_table): Update declarations.
12009 * layout.cc: Include "mapfile.h".
12010 (Layout_task_runner::run): Print information to mapfile.
12011 (Layout::create_gold_note): Change Output_data_fixed_space to
12012 Output_data_zero_fill.
12013 (Layout::create_build_id): Likewise.
12014 (Layout::print_to_mapfile): New function.
12015 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12016 constructor. Change caller.
12017 (class Layout): Declare print_to_mapfile.
12018 * output.cc (Output_section::Input_section::print_to_mapfile): New
12019 function.
12020 (Output_section::add_input_section): If producing a map, always
12021 add to input_sections_ list.
12022 (Output_section::do_print_to_mapfile): New function.
12023 (Output_segment::print_sections_to_mapfile): New function.
12024 (Output_segment::print_section_list_to_mapfile): New function.
12025 * output.h: Include "mapfile.h".
12026 (Output_data::print_to_mapfile): New function.
12027 (Output_data::do_print_to_mapfile): New virtual function.
12028 (Output_segment_headers::do_print_to_mapfile): New function.
12029 (Output_file_header::do_print_to_mapfile): New function.
12030 (Output_data_const::do_print_to_mapfile): New function.
12031 (class Output_data_const_buffer): Add map_name_ field. Update
12032 constructor. Change all callers. Add do_print_to_mapfile
12033 function.
12034 (class Output_data_fixed_space): Likewise.
12035 (class Output_data_space): Likewise.
12036 (class Output_data_zero_fill): New class.
12037 (Output_data_strtab::do_print_to_mapfile): New function.
12038 (Output_data_reloc_base::do_print_to_mapfile): New function.
12039 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12040 (Output_data_group::do_print_to_mapfile): New function.
12041 (Output_data_got::do_print_to_mapfile): New function.
12042 (Output_data_dynamic::do_print_to_mapfile): New function.
12043 (Output_symtab_xindex::do_print_to_mapfile): New function.
12044 (class Output_section): Declare do_print_to_mapflie. Declare
12045 print_to_mapfile in Input_section.
12046 (class Output_segment): Declare new functions.
12047 * object.h (Sized_relobj::symbol_count): New function.
12048 * script-sections.cc
12049 (Output_section_element_dot_assignment::set_section_addresses):
12050 Change Output_data_fixed_space to Output_data_zero_fill.
12051 (Output_data_expression::do_print_to_mapfile): New function.
12052 * script.cc (read_input_script): Add mapfile parameter. Change
12053 all callers.
12054 * script.h (read_input_script): Update declaration.
12055 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12056 (Eh_frame::do_print_to_mapfile): New function.
12057 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12058 (Output_merge_string::do_print_to_mapfile): New function.
12059 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12060 function.
12061 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12062 function.
12063 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12064 function.
12065 * Makefile.am (CCFILES): Add mapfile.cc.
12066 (HFILES): Add mapfile.h.
12067 * Makefile.in: Rebuild.
12068
12069 2008-05-19 Ian Lance Taylor <iant@google.com>
12070
12071 * options.h (class General_options): Add -z relro.
12072 * layout.cc (Layout::Layout): Initialize relro_segment_.
12073 (Layout::add_output_section_data): Return the output section.
12074 (Layout::make_output_section): Rcognize relro sections and mark
12075 them appropriately.
12076 (Layout::attach_allocated_section_to_segment): Put relro sections
12077 in a PT_GNU_RELRO segment.
12078 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12079 section as relro.
12080 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12081 PT_TLS segments.
12082 (Layout::linkonce_mapping): Map d.rel.ro.local to
12083 .data.rel.ro.local.
12084 (Layout::output_section_name): Us .data.rel.ro.local for any
12085 section which begins with that.
12086 * layout.h (class Layout): Update add_output_section_data
12087 declaration. Add relro_segment_ field.
12088 * output.cc (Output_section::Output_section): Initialize is_relro_
12089 and is_relro_local_ fields.
12090 (Output_segment::add_output_section): Group relro sections.
12091 (Output_segment::is_first_section_relro): New function.
12092 (Output_segment::maximum_alignment): If there is a relro section,
12093 align the segment to the common page size.
12094 (Output_segment::set_section_addresses): Track whether we are
12095 looking at relro sections. If the last section is a relro
12096 section, align to the common page size.
12097 (Output_segment::set_section_list_addresses): Add in_relro
12098 parameter. Change all callers. Align to the page size when
12099 moving from relro to non-relro section.
12100 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12101 segment.
12102 * output.h (class Output_section): Add is_relro_ and
12103 is_relro_local_ fields.
12104 (Output_section::is_relro): New function.
12105 (Output_section::set_is_relro): New function.
12106 (Output_section::is_relro_local): New function.
12107 (Output_section::set_is_relro_local): New function.
12108 (class Output_segment): Update declarations.
12109 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12110 * sparc.cc (Target_sparc::got_section): Likewise.
12111 * x86_64.cc (Target_x86_64::got_section): Likewise.
12112 * testsuite/relro_test_main.cc: New file.
12113 * testsuite/relro_test.cc: New file.
12114 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12115 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12116 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12117 (relro_test.so, relro_test_pic.o): New targets.
12118 * testsuite/Makefile.in: Rebuild.
12119
12120 2008-05-16 Ian Lance Taylor <iant@google.com>
12121
12122 * output.cc (Output_segment::add_output_section): Remove front
12123 parameter.
12124 * output.h (class Output_segment): Remove
12125 add_initial_output_section and overloaded add_output_section.
12126 Update declaration of remaining add_output_section.
12127 * layout.cc (Layout::create_interp): Call add_output_section
12128 rather than add_initial_output_section.
12129 (Layout::finish_dynamic_section): Likewise.
12130
12131 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12132 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12133 know the dynamic type.
12134 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12135 field. Initialize it in constructor.
12136 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12137 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12138 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12139 reloc.
12140
12141 * output.cc (Output_reloc::get_address): Change return type to
12142 Elf_Addr.
12143 * output.h (class Output_reloc): Update get_address declaration.
12144 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12145 for section addresses.
12146
12147 2008-05-09 Ian Lance Taylor <iant@google.com>
12148
12149 PR 6493
12150 * gold.cc (gold_nomem): Use return value of write.
12151
12152 2008-05-08 Ian Lance Taylor <iant@google.com>
12153
12154 * symtab.c (Symbol::init_base_output_data): Add version
12155 parameter. Change all callers.
12156 (Symbol::init_base_output_segment): Likewise.
12157 (Symbol::init_base_constant): Likewise.
12158 (Symbol::init_base_undefined): Likewise.
12159 (Sized_symbol::init_output_data): Likewise.
12160 (Sized_symbol::init_output_segment): Likewise.
12161 (Sized_symbol::init_constant): Likewise.
12162 (Sized_symbol::init_undefined): Likewise.
12163 (Symbol_table::do_define_in_output_data): If the new symbol has a
12164 version, mark it as the default.
12165 (Symbol_table::do_define_in_output_segment): Likewise.
12166 (Symbol_table::do_define_as_constant): Likewise.
12167 * symtab.h (class Symbol): Update declarations.
12168 (class Sized_symbol): Likewise.
12169 * resolve.cc (Symbol::override_version): New function.
12170 (Symbol::override_base): Call override_version.
12171 (Symbol::override_base_with_special): Likewise.
12172 * testsuite/ver_script_8.script: New file.
12173 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12174 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12175 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12176 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12177
12178 2008-05-06 Ian Lance Taylor <iant@google.com>
12179
12180 PR 6049
12181 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12182 functions.
12183 (class General_options): Remove existing --undefined, and add
12184 --no-undefined instead. Add new --undefined as synonym for -u.
12185 * archive.cc (Archive::add_symbols): Check whether symbol was
12186 named with -u.
12187 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12188 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12189 all uses. Add IS_UNDEFINED. Update declarations to split
12190 different versions of init_base. Declare init_base_undefined.
12191 (Symbol::is_defined): Handle IS_UNDEFINED.
12192 (Symbol::is_undefined): Likewise.
12193 (Symbol::is_weak_undefined): Call is_undefined.
12194 (Symbol::is_absolute): Handle IS_CONSTANT.
12195 (class Sized_symbol): Update declarations to split different
12196 versions of init. Declare init_undefined.
12197 (class Symbol_table): Declare new functions.
12198 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12199 Change all callers.
12200 (Symbol::init_base_output_data): Likewise.
12201 (Symbol::init_base_output_segment): Likewise.
12202 (Symbol::init_base_constant): Likewise.
12203 (Symbol::init_base_undefined): New function.
12204 (Sized_symbol::init_object): Rename from init. Change all
12205 callers.
12206 (Sized_symbol::init_output_data): Likewise.
12207 (Sized_symbol::init_output_segment): Likewise.
12208 (Sized_symbol::init_constant): Likewise.
12209 (Sized_symbol::init_undefined): New function.
12210 (Symbol_table::add_undefined_symbols_from_command_line): New
12211 function.
12212 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12213 function.
12214 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12215 (Symbol::output_section): Likewise.
12216 (Symbol::set_output_section): Likewise.
12217 (Symbol_table::sized_finalize_symbol): Likewise.
12218 (Symbol_table::sized_write_globals): Likewise.
12219 * resolve.cc (Symbol_table::should_override): Likewise.
12220 (Symbol::override_base_with_special): Likewise.
12221
12222 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12223 symbol, change it to have default visibility.
12224 * testsuite/protected_1.cc: New file.
12225 * testsuite/protected_2.cc: New file.
12226 * testsuite/protected_3.cc: New file.
12227 * testsuite/protected_main_1.cc: New file.
12228 * testsuite/protected_main_2.cc: New file.
12229 * testsuite/protected_main_3.cc: New file.
12230 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12231 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12232 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12233 (protected_1.so): New target.
12234 (protected_1_pic.o, protected_2_pic.o): New targets.
12235 (protected_3_pic.o): New target.
12236 (check_PROGRAMS): Add protected_2.
12237 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12238 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12239 * testsuite/Makefile.in: Rebuild.
12240
12241 * options.h (DEFINE_var): Add set_user_set_##varname__.
12242 (DEFINE_bool_alias): New macro.
12243 (class General_options): Define -Bstatic using DEFINE_bool_alias
12244 rather than DEFINE_special. Add --undefined as an alias for -z
12245 defs.
12246 * options.cc (General_options::parse_Bstatic): Remove.
12247
12248 * options.h (class General_options): Add --fatal-warnings.
12249 * main.cc (main): Implement --fatal-warnings.
12250 * errors.h (Errors::warning_count): New function.
12251
12252 * options.h (class General_options): Add -Bsymbolic-functions.
12253 * symtab.h (Symbol::is_preemptible): Check for
12254 -Bsymbolic-functions.
12255
12256 2008-05-05 Ian Lance Taylor <iant@google.com>
12257
12258 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12259 as noVARNAME rather than no-VARNAME.
12260 (class General_options): Add option -z combreloc.
12261 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12262 get_address.
12263 (Output_reloc::sort_before) [SHT_REL]: New function.
12264 (Output_reloc::sort_before) [SHT_RELA]: New function.
12265 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12266 Sort_relocs_comparison.
12267 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12268 parameter. Change all callers.
12269 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12270 sort_relocs parameter. Change all callers.
12271 * output.cc (Output_reloc::get_address): New function, broken out
12272 of write_rel.
12273 (Output_reloc::write_rel): Call it.
12274 (Output_reloc::compare): New function.
12275 (Output_data_reloc_base::do_write): Optionally sort relocs.
12276
12277 * configure.ac: If targ_extra_obj is set, link it in.
12278 * configure.tgt: Initialize all variables.
12279 (x86_64*): Set targ_extra_obj and targ_extra_size.
12280 * configure: Rebuild.
12281
12282 * object.cc (Sized_relobj::include_section_group): Adjust section
12283 indexes read from group data. Build vector to pass to
12284 layout_group.
12285 * layout.cc (Layout::layout_group): Add flags and shndxes
12286 parameters. Remove contents parameter. Change caller. Update
12287 explicit instantiations.
12288 * layout.h (class Layout): Update layout_group declaration.
12289 * output.cc (Output_data_group::Output_data_group): Add flags and
12290 input_shndxes parameters. Remove contents parameter. Change
12291 caller.
12292 (Output_data_group::do_write): Change input_sections_ to
12293 input_shndxes_.
12294 * output.h (class Output_data_group): Update constructor
12295 declaration. Rename input_sections_ to input_shndxes_.
12296 * testsuite/many_sections_test.cc: Add template.
12297
12298 2008-04-30 Cary Coutant <ccoutant@google.com>
12299
12300 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12301
12302 * layout.cc (Layout::include_section): Refactored check for debug
12303 info section.
12304 (Layout::add_comdat): Add new parameters. Change type
12305 of signature parameter. Add object and shndx to signatures table.
12306 (Layout::find_kept_object): New function.
12307 * layout.h: Include <cstring>.
12308 (Layout::is_debug_info_section): New function.
12309 (Layout::add_comdat): Add new parameters.
12310 (Layout::find_kept_object): New function.
12311 (Layout::Kept_section): New struct.
12312 (Layout::Signatures): Change type of map range.
12313 * object.cc (Relobj::output_section_address): New function.
12314 (Sized_relobj::include_section_group): Add new parameters. Change
12315 calls to Layout::add_comdat. Change to build table of kept comdat
12316 groups and table mapping discarded sections to kept sections.
12317 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12318 (Sized_relobj::do_layout): Change calls to include_section_group and
12319 include_linkonce_section.
12320 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12321 value to zero when section is discarded.
12322 (Sized_relobj::map_to_kept_section): New function.
12323 * object.h (Relobj::output_section_address): New function.
12324 (Relobj::Comdat_group): New type.
12325 (Relobj::find_comdat_group): New function.
12326 (Relobj::Comdat_group_table): New type.
12327 (Relobj::Kept_comdat_section): New type.
12328 (Relobj::Kept_comdat_section_table): New type.
12329 (Relobj::add_comdat_group): New function.
12330 (Relobj::set_kept_comdat_section): New function.
12331 (Relobj::get_kept_comdat_section): New function.
12332 (Relobj::comdat_groups_): New field.
12333 (Relobj::kept_comdat_sections_): New field.
12334 (Symbol_value::input_value): Update comment.
12335 (Sized_relobj::map_to_kept_section) New function.
12336 (Sized_relobj::include_linkonce_section): Add new parameter.
12337 * target-reloc.h (Comdat_behavior): New type.
12338 (get_comdat_behavior): New function.
12339 (relocate_section): Add code to map a discarded section to the
12340 corresponding kept section when applying a relocation.
12341
12342 2008-04-30 Craig Silverstein <csilvers@google.com>
12343
12344 * dwarf_reader.cc (next_generation_count): New static var.
12345 (Addr2line_cache_entry): New struct.
12346 (addr2line_cache): New static var.
12347 (Dwarf_line_info::one_addr2line): Added caching.
12348 (Dwarf_line_info::clear_addr2line_cache): New function.
12349 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12350 cache-size parameter.
12351 (Dwarf_line_info::one_addr2line_cache): New function.
12352 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12353 new cache-size argument to one_addr2line(), and clear cache.
12354
12355 2008-04-28 Cary Coutant <ccoutant@google.com>
12356
12357 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12358 R_386_PC8 relocations.
12359
12360 2008-04-23 Ian Lance Taylor <iant@google.com>
12361
12362 * object.cc (Sized_relobj::include_section_group): Check for
12363 invalid section group.
12364
12365 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12366 header size.
12367
12368 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12369 than read for file header.
12370 * archive.cc (Archive::include_member): Likewise.
12371
12372 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12373
12374 * aclocal.m4: Regenerate.
12375 * configure: Regenerate.
12376
12377 2008-04-19 Ian Lance Taylor <iant@google.com>
12378
12379 * version.cc (version_string): Bump to 1.6.
12380
12381 * testsuite/Makefile.am (many_sections_r_test): New target.
12382 (many_sections_r_test_SOURCES): Remove.
12383 (many_sections_r_test_DEPENDENCIES): Remove.
12384 (many_sections_r_test_LDFLAGS): Remove.
12385 (many_sections_r_test_LDADD): Remove.
12386
12387 * object.cc (Sized_relobj::do_add_symbols): Always pass
12388 local_symbol_count_ to add_from_relobj.
12389
12390 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12391 every thousand variables.
12392 * testsuite/Makefile.in: Rebuild.
12393
12394 * object.cc (Xindex::initialize_symtab_xindex): New function.
12395 (Xindex::read_symtab_xindex): New function.
12396 (Xindex::sym_xindex_to_shndx): New function.
12397 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12398 available.
12399 (Sized_relobj::do_initialize_xindex): New function.
12400 (Sized_relobj::do_read_symbols): Adjust section links.
12401 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12402 parameter. Change all callers.
12403 (Sized_relobj::include_section_group): Adjust section links and
12404 symbol section indexes.
12405 (Sized_relobj::do_layout): Adjust section links.
12406 (Sized_relobj::do_count_local_symbols): Adjust section links and
12407 symbol section indexes.
12408 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12409 ordinary and special symbols.
12410 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12411 dynsym_xindex parameters. Change all callers. Adjust section
12412 links. Use SHN_XINDEX when needed.
12413 (Sized_relobj::get_symbol_location_info): Adjust section links.
12414 Don't get fooled by special symbols.
12415 * object.h (class Xindex): Define.
12416 (class Object): Add xindex_ parameter. Declare virtual functoin
12417 do_initialize_xindex.
12418 (Object::adjust_sym_shndx): New function.
12419 (Object::set_xindex): New protected function.
12420 (class Symbol_value): Add is_ordinary_shndx_ field.
12421 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12422 (Symbol_value::value): Assert ordinary section.
12423 (Symbol_value::initialize_input_to_output_map): Likewise.
12424 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12425 Change all callers.
12426 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12427 all callers.
12428 (class Sized_relobj): Update declarations.
12429 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12430 parameter. Change all callers.
12431 (Sized_relobj::adjust_shndx): New function.
12432 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12433 field.
12434 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12435 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12436 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12437 (Sized_dynobj::read_dynsym_section): Adjust section links.
12438 (Sized_dynobj::read_dynamic): Likewise.
12439 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12440 section links.
12441 (Sized_dynobj::do_initialize_xindex): New function.
12442 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12443 do_initialize_xindex.
12444 (Sized_dynobj::adjust_shndx): New function.
12445 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12446 dynsym_xindex_ fields.
12447 (Layout::finalize): Add a call to set_section_indexes before
12448 creating the symtab sections.
12449 (Layout::set_section_indexes): Don't do anything if the section
12450 already has a section index.
12451 (Layout::create_symtab_sections): Add shnum parameter. Change
12452 caller. Create .symtab_shndx section if needed.
12453 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12454 caller.
12455 (Layout::allocated_output_section_count): New function.
12456 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12457 needed.
12458 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12459 fields. Update declarations.
12460 (Layout::symtab_xindex): New function.
12461 (Layout::dynsym_xindex): New function.
12462 (class Write_symbols_task): Add layout_ field.
12463 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12464 Change caller.
12465 * output.cc (Output_section_headers::Output_section_headers): Add
12466 shstrtab_section parameter. Change all callers.
12467 (Output_section_headers::do_sized_write): Store overflow values
12468 for section count and section string table section index in
12469 section header zero.
12470 (Output_file_header::do_sized_write): Check for overflow of
12471 section count and section string table section index.
12472 (Output_symtab_xindex::do_write): New function.
12473 (Output_symtab_xindex::endian_do_write): New function.
12474 * output.h (class Output_section_headers): Add shstrtab_section_.
12475 Update declarations.
12476 (class Output_symtab_xindex): Define.
12477 (Output_section::has_out_shndx): New function.
12478 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12479 field.
12480 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12481 Change all callers.
12482 (Sized_symbol::init): Likewise.
12483 (Symbol::output_section): Check for ordinary symbol.
12484 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12485 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12486 callers.
12487 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12488 Change all callers. Simplify handling of symbols from sections
12489 not included in the link.
12490 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12491 distinction.
12492 (Weak_alias_sorter::operator()): Assert that symbols are
12493 ordinary.
12494 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12495 distinction.
12496 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12497 parameters. Change all callers.
12498 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12499 symbol distinction. Use SHN_XINDEX when needed.
12500 (Symbol_table::write_section_symbol): Add symtab_xindex
12501 parameter. Change all callers.
12502 (Symbol_table::sized_write_section_symbol): Likewise. Use
12503 SHN_XINDEX when needed.
12504 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12505 declarations.
12506 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12507 (Symbol::is_defined): Check is_ordinary.
12508 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12509 (Symbol::is_absolute, Symbol::is_common): Likewise.
12510 (class Sized_symbol): Update declarations.
12511 (class Symbol_table): Update declarations.
12512 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12513 parameters. Change all callers.
12514 (Sized_symbol::override): Likewise.
12515 (Symbol_table::override): Likewise.
12516 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12517 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12518 is_ordinary, and orig_st_shndx parameters. Change all callers.
12519 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12520 to be in an ordinary section.
12521 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12522 object and is_ordinary parameters. Change all callers.
12523 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12524 Change all callers. Don't add undefined or non-ordinary symbols
12525 to reloc_map_.
12526 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12527 Change all callers.
12528 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12529 declarations.
12530 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12531 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12532 (Sized_relobj::relocate_sections): Likewise.
12533 * target-reloc.h (scan_relocs): Adjust section symbol index.
12534 (scan_relocatable_relocs): Likewise.
12535 * i386.cc (Scan::local): Check for ordinary symbols.
12536 * sparc.cc (Scan::local): Likewise.
12537 * x86_64.cc (Scan::local): Likewise.
12538 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12539 to symbol_section_and_value.
12540 * testsuite/many_sections_test.cc: New file.
12541 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12542 (check_PROGRAMS): Add many_sections_test.
12543 (many_sections_test_SOURCES): Define.
12544 (many_sections_test_DEPENDENCIES): Define.
12545 (many_sections_test_LDFLAGS): Define.
12546 (BUILT_SOURCES): Add many_sections_define.h.
12547 (many_sections_define.h): New target.
12548 (BUILT_SOURCES): Add many_sections_check.h.
12549 (many_sections_check.h): New target.
12550 (check_PROGRAMS): Add many_sections_r_test.
12551 (many_sections_r_test_SOURCES): Define.
12552 (many_sections_r_test_DEPENDENCIES): Define.
12553 (many_sections_r_test_LDFLAGS): Define.
12554 (many_sections_r_test_LDADD): Define.
12555 (many_sections_r_test.o): New target.
12556 * testsuite/Makefile.in: Rebuild.
12557
12558 2008-04-17 Cary Coutant <ccoutant@google.com>
12559
12560 * errors.cc (Errors::info): New function.
12561 (gold_info): New function.
12562 * errors.h (Errors::info): New function.
12563 * gold.h (gold_info): New function.
12564 * object.cc (Input_objects::add_object): Print trace output.
12565 * options.cc (options::parse_set): New function.
12566 (General_options::parse_wrap): Deleted.
12567 (General_options::General_options): Deleted initializer.
12568 * options.h (options::String_set): New typedef.
12569 (options::parse_set): New function.
12570 (DEFINE_set): New macro.
12571 (General_options::wrap): Changed to use DEFINE_set. Changed
12572 callers of any_wrap_symbols and is_wrap_symbol.
12573 (General_options::trace, General_options::trace_symbol):
12574 New options.
12575 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12576 (General_options::wrap_symbols_): Deleted.
12577 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12578
12579 2008-04-17 David S. Miller <davem@davemloft.net>
12580
12581 * options.cc (General_options::parse_V): New function.
12582 * options.h: Add entries for -V and -Qy.
12583
12584 2008-04-17 Ian Lance Taylor <iant@google.com>
12585
12586 * common.cc (Symbol_table::allocate_commons): Remove options
12587 parameter. Change caller.
12588 (Symbol_table::do_allocate_commons): Remove options parameter.
12589 Change caller. Just call do_allocate_commons_list twice.
12590 (Symbol_table::do_allocate_commons_list): New function, broken out
12591 of do_allocate_commons.
12592 * common.h (class Allocate_commons_task): Remove options_ field.
12593 Update constructor.
12594 * symtab.cc (Symbol_table::Symbol_table): Initialize
12595 tls_commons_.
12596 (Symbol_table::add_from_object): Put TLS common symbols on
12597 tls_commons_ list.
12598 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12599 which are IN_OUTPUT_DATA.
12600 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12601 allocate_commons and do_allocate_commons declarations. Declare
12602 do_allocate_commons_list.
12603 * gold.cc (queue_middle_tasks): Update creation of
12604 Allocate_commons_task to not pass options.
12605 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12606 (TLS_TEST_C_FLAGS): New variable.
12607 (tls_test_c_pic.o): New target.
12608 (tls_test_shared.so): Link in tls_test_c_pic.o.
12609 (tls_test_c_pic_ie.o): New target.
12610 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12611 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12612 (tls_test_c.o): New target.
12613 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12614 (tls_pic_test_LDADD): Likewise.
12615 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12616 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12617 (tls_test_c_gnu2.o): New target.
12618 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12619 tls_test_c_gnu2.o.
12620 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12621 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12622 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12623 * testsuite/tls_test.cc: Include "config.h".
12624 (t_last): Call t11_last.
12625 * testsuite/tls_test.h (t11, t11_last): Declare.
12626 * testsuite/tls_test_c.c: New file.
12627 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12628 * configure.ac: Check for OpenMP support.
12629 * configure, config.in, Makefile.in: Rebuild.
12630 * testsuite/Makefile.in: Rebuild.
12631
12632 2008-04-16 Cary Coutant <ccoutant@google.com>
12633
12634 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12635 (Target_i386::tls_base_symbol_defined_): New field.
12636 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12637 (Target_i386::Scan::global): Likewise.
12638 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12639 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12640 (Target_x86_64::tls_base_symbol_defined_): New field.
12641 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12642 (Target_x86_64::Scan::global): Likewise.
12643
12644 2008-04-16 Cary Coutant <ccoutant@google.com>
12645
12646 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12647 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12648 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12649 building shared libraries.
12650 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12651 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12652 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12653 * testsuite/Makefile.in: Rebuild.
12654 * testsuite/weak_undef.h: New file.
12655 * testsuite/weak_undef_file1.cc: Add extra test cases.
12656 * testsuite/weak_undef_file2.cc: Likewise.
12657 * testsuite/weak_undef_test.cc: Likewise.
12658
12659 2008-04-16 David S. Miller <davem@davemloft.net>
12660
12661 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12662 Add issued_non_pic_error_ field. Declare check_non_pic.
12663 (Target_sparc::Scan::check_non_pic): New function.
12664 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12665 (Target_sparc::Scan::global): Likewise.
12666
12667 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12668 * configure: Rebuild.
12669
12670 * options.h (DEFINE_enable): New macro.
12671 (new_dtags): New enable option.
12672 (initfirst, interpose, loadfltr, nodefaultlib,
12673 nodelete, nodlopen, nodump): New -z options.
12674 * layout.cc (Layout:finish_dynamic_section): If new
12675 dtags enabled, emit DT_RUNPATH. Also, emit a
12676 DT_FLAGS_1 containing any specified -z flags.
12677
12678 2008-04-16 Ian Lance Taylor <iant@google.com>
12679
12680 * copy-relocs.cc: New file.
12681 * copy-relocs.h: New file.
12682 * reloc.cc: Remove Copy_relocs code.
12683 * reloc.h: Likewise.
12684 * reloc-types.h (struct Reloc_types) [both versions]: Add
12685 get_reloc_addend_noerror.
12686 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12687 variants of add_global which take an addend which must be zero.
12688 * i386.cc: Include "copy-relocs.h".
12689 (class Target_i386): Change type of copy_relocs_ to variable,
12690 update initializer.
12691 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12692 Change all callers.
12693 (Target_i386::do_finalize_sections): Change handling of
12694 copy_relocs_.
12695 * sparc.cc: Include "copy-relocs.h".
12696 (class Target_sparc): Change type of copy_relocs_ to variable,
12697 update initializer.
12698 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12699 Change all callers.
12700 (Target_sparc::do_finalize_sections): Change handling of
12701 copy_relocs_.
12702 * x86_64.cc: Include "copy-relocs.h".
12703 (class Target_x86_64): Change type of copy_relocs_ to variable,
12704 update initializer.
12705 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12706 class. Change all callers.
12707 (Target_x86_64::do_finalize_sections): Change handling of
12708 copy_relocs_.
12709 * Makefile.am (CCFILES): Add copy-relocs.cc.
12710 (HFILES): Add copy-relocs.h.
12711
12712 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12713
12714 * testsuite/script_test_4.sh: Permit leading zeroes.
12715
12716 2008-04-15 Ian Lance Taylor <iant@google.com>
12717
12718 * script-sections.cc (Script_sections::create_segments): Use
12719 header_size_adjustment even when there is enough room for the
12720 headers.
12721 * testsuite/script_test_4.sh: New file.
12722 * testsuite/script_test_4.t: New file.
12723 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12724 (check_DATA): Add script_test_4.stdout.
12725 (MOSTLYCLEANFILES): Likewise.
12726 (script_test_4): New target.
12727 (script_test_4.stdout): New target.
12728 * testsuite/Makefile.in: Rebuild.
12729
12730 * sparc.cc: Add definitions for Output_data_plt_sparc class
12731 constants.
12732
12733 2008-04-14 David S. Miller <davem@davemloft.net>
12734
12735 * sparc.cc: New file.
12736 * Makefile.am (TARGETSOURCES): Add sparc.cc
12737 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12738 * configure.tgt: Document targ_extra_size and
12739 targ_extra_big_endian. Add entries for sparc-* and
12740 sparc64-*.
12741 * configure.ac: Handle targ_extra_size and
12742 targ_extra_big_endian.
12743 * Makefile.in: Rebuild.
12744 * configure: Likewise.
12745 * po/POTFILES.in: Likewise.
12746 * po/gold.pot: Likewise.
12747
12748 2008-04-14 Ian Lance Taylor <iant@google.com>
12749
12750 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12751 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12752 in the name/type/flags to section mapping. Don't call
12753 allocate_output_section.
12754 (Layout::choose_output_section): Change parameter from adjust_name
12755 to is_input_section. Don't permit input sections after sections
12756 are attached to segments. Don't call allocate_output_section.
12757 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12758 not write_enable_output_section.
12759 (Layout::make_output_section): Don't push to
12760 unattached_section_list_ nor call attach_to_segment. Call
12761 attach_section_to_segment if sections are attached.
12762 (Layout::attach_sections_to_segments): New function.
12763 (Layout::attach_section_to_segment): New function.
12764 (Layout::attach_allocated_section_to_segment): Rename from
12765 attach_to_segment. Remove flags parameter.
12766 (Layout::allocate_output_section): Remove function.
12767 (Layout::write_enable_output_section): Remove function.
12768 * layout.h (class Layout): Update for above changes. Add new
12769 field sections_are_attached_.
12770 * output.h (Output_section::update_flags_for_input_section): New
12771 function.
12772 * output.cc (Output_section::add_input_section): Call
12773 update_flags_for_input_section.
12774 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12775
12776 2008-04-11 Cary Coutant <ccoutant@google.com>
12777
12778 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12779 thought unnecessary.
12780 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12781
12782 2008-04-11 Ian Lance Taylor <iant@google.com>
12783
12784 * output.h (class Output_section_data): Remove inline definition
12785 of set_addralign.
12786 * output.cc (Output_section_data::set_addralign): New function.
12787
12788 2008-04-11 Cary Coutant <ccoutant@google.com>
12789
12790 Add support for TLS descriptors for i386 and x86_64.
12791 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12792 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12793 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12794 GOT_TYPE_TLS_DESC.
12795 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12796 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12797 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12798 relocations.
12799 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12800 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12801 Fix problem with initial-exec relocations.
12802 (Target_i386::Relocate::relocate_tls): Likewise.
12803 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12804 relaxation.
12805 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12806 support for section-plus-offset dynamic table entries.
12807 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12808 (Output_data_dynamic::Dynamic_entry): Add support for
12809 section-plus-offset dynamic table entries.
12810 (Output_data_dynamic::Classification): Likewise.
12811 (Output_data_dynamic::classification_): Renamed offset_.
12812 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12813 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12814 (Target_x86_64::make_plt_section): New function.
12815 (Target_x86_64::reserve_tlsdesc_entries): New function.
12816 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12817 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12818 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12819 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12820 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12821 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12822 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12823 add extra PLT entry for TLS descriptors.
12824 (Output_data_plt_x86_64::got_): New field.
12825 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12826 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12827 fields.
12828 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12829 descriptors.
12830 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12831 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12832 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12833 R_386_TLS_DESC_CALL relocations.
12834 (Target_x86_64::Scan::global): Likewise.
12835 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12836 for TLS descriptors.
12837 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12838 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12839 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12840 GD-to-IE relaxation.
12841 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12842 and TLS_DESCRIPTORS.
12843 * Makefile.in: Rebuild.
12844 * configure: Rebuild.
12845 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12846 (tls_test_shared2.so): New target.
12847 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12848 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12849 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12850 (tls_shared_gd_to_ie_test_LDADD): New variable.
12851 (tls_shared_gnu2_gd_to_ie_test): New target.
12852 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12853 New targets.
12854 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12855 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12856 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12857 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12858 (tls_shared_gnu2_test): New target.
12859 (tls_test_gnu2_shared.so): New target.
12860 (tls_shared_gnu2_test_SOURCES): New variable.
12861 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12862 (tls_shared_gnu2_test_LDFLAGS): New variable.
12863 (tls_shared_gnu2_test_LDADD): New variable.
12864 * testsuite/Makefile.in: Rebuild.
12865 * testsuite/Makefile.
12866
12867 2008-04-11 Ian Lance Taylor <iant@google.com>
12868
12869 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12870 justsyms.t.
12871 * testsuite/Makefile.in: Rebuild.
12872
12873 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12874 long.
12875 * testsuite/script_test_2.cc (main): Adjust test.
12876
12877 2008-04-11 David S. Miller <davem@davemloft.net>
12878 Ian Lance Taylor <iant@google.com>
12879
12880 * options.h (General_options): Add entries for '-Y' and
12881 '-relax'.
12882 * options.cc (General_options:finalize): If -Y was used, add those
12883 entries to the library path instead of the default "/lib" and
12884 "/usr/lib".
12885
12886 2008-04-11 David S. Miller <davem@davemloft.net>
12887
12888 * testsuite/justsyms.t: Start at 0x100.
12889 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12890 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12891 long.
12892 * testsuite/script_test_2.cc: Adjust string and section length
12893 checks.
12894
12895 2008-04-09 Ian Lance Taylor <iant@google.com>
12896
12897 PR gold/5996
12898 * script-sections.cc (Sections_element::allocate_to_segment): Add
12899 orphan parameter.
12900 (Output_section_definition::allocate_to_segment): Likewise.
12901 (Orphan_output_section::allocate_to_segment): Likewise.
12902 (Script_sections::attach_sections_using_phdrs_clause): Don't
12903 propagate non-PT_LOAD segments to orphan sections.
12904 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12905 readelf rather than objdump.
12906 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12907 .interp section and PT_INTERP segment are the same size.
12908 * testsuite/Makefile.in: Rebuild.
12909
12910 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12911 aliases for symbols defined in the same object.
12912 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12913 (weak_alias_test_SOURCES): New variable.
12914 (weak_alias_test_DEPENDENCIES): New variable.
12915 (weak_alias_test_LDFLAGS): New variable.
12916 (weak_alias_test_LDADD): New variable.
12917 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12918 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12919 (weak_alias_test_3.o): New target.
12920 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12921 * testsuite/weak_alias_test_main.cc: New file.
12922 * testsuite/weak_alias_test_1.cc: New file.
12923 * testsuite/weak_alias_test_2.cc: New file.
12924 * testsuite/weak_alias_test_3.cc: New file.
12925
12926 2008-04-08 Ian Lance Taylor <iant@google.com>
12927
12928 * options.h (class General_options): Add --noinhibit-exec option.
12929 * main.cc (main): Check --noinhibit-exec.
12930
12931 * options.h (class General_options): Define --wrap as a special
12932 option. Add wrap_symbols_ field.
12933 (General_options::any_wrap_symbols): New function.
12934 (General_options::is_wrap_symbol): New function.
12935 * options.cc (General_options::parse_wrap): New function.
12936 (General_options::General_options): Initialize wrap_symbols_.
12937 * symtab.cc (Symbol_table::wrap_symbol): New function.
12938 (Symbol_table::add_from_object): Handle --wrap.
12939 * symtab.h (class Symbol_table): Declare wrap_symbol.
12940 * target.h (Target::wrap_char): New function.
12941 (Target::Target_info): Add wrap_char field.
12942 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12943 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12944 * testsuite/testfile.cc (Target_test::test_target_info):
12945 Likewise.
12946
12947 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12948 there is one.
12949
12950 * layout.h (class Layout): Add added_eh_frame_data_ field.
12951 * layout.cc (Layout::Layout): Initialize new field.
12952 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12953 output section until we find a section we merged successfully.
12954 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12955 that the size be non-zero.
12956
12957 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12958 qualifier.
12959
12960 2008-04-08 Craig Silverstein <csilvers@google.com>
12961
12962 * configure.ac: Export new conditional variable HAVE_ZLIB.
12963 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12964 on HAVE_ZLIB.
12965 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12966 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12967
12968 2008-04-07 Ian Lance Taylor <iant@google.com>
12969
12970 * version.cc (version_string): Set to "1.5".
12971
12972 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12973 Add issued_non_pic_error_ field. Declare check_non_pic.
12974 (Target_x86_64::Scan::check_non_pic): New function.
12975 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12976 (Target_x86_64::Scan::global): Likewise.
12977
12978 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12979 addend parameter. Change caller. Handle merge sections.
12980 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12981 Address to Addend. Don't add in the result of
12982 local_section_offset, pass down the addend and use the returned
12983 value.
12984 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12985 Update declarations of local_section_offset and symbol_value.
12986 * testsuite/two_file_test_1.cc (t18): New function.
12987 * testsuite/two_file_test_2.cc (f18): New function.
12988 * testsuite/two_file_test_main.cc (main): Call t18.
12989 * testsuite/two_file_test.h (t18, f18): Declare.
12990
12991 * configure.ac: Don't test for objdump, c++filt, or readelf.
12992 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12993 conditionals.
12994 (TEST_READELF): New variable.
12995 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12996 (check_PROGRAMS): Add two_file_strip_test.
12997 (two_file_strip_test): New target.
12998 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12999 (two_file_same_shared_strip_test_SOURCES): New variable.
13000 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13001 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13002 (two_file_same_shared_strip_test_LDADD): New variable.
13003 (two_file_shared_strip.so): New target.
13004 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13005 (ver_test_5.syms, ver_test_7.syms): Likewise.
13006 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13007 (strip_test_3.stdout): Use TEST_OBJDUMP.
13008 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13009
13010 2008-04-04 Cary Coutant <ccoutant@google.com>
13011
13012 * symtab.h (Symbol::is_weak_undefined): New function.
13013 (Symbol::is_strong_undefined): New function.
13014 (Symbol::is_absolute): New function.
13015 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13016 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13017 absolute symbols.
13018 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13019 (weak_undef_test): New target.
13020 * testsuite/Makefile.in: Rebuild.
13021 * testsuite/weak_undef_file1.cc: New file.
13022 * testsuite/weak_undef_file2.cc: New file.
13023 * testsuite/weak_undef_test.cc: New file.
13024
13025 2008-04-03 Craig Silverstein <csilvers@google.com>
13026
13027 * compressed_output.h (class Output_compressed_section): Use
13028 unsigned buffer.
13029 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13030 add zlib header.
13031 (zlib_compressed_suffix): Removed.
13032 (Output_compressed_section::set_final_data_size): Use unsigned
13033 buffers.
13034 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13035 Fix linker invocation.
13036 (flagstest_o_specialfile_and_compress_debug_sections):
13037 Likewise.
13038 * testsuite/Makefile.in: Regenerated.
13039
13040 2008-04-02 David S. Miller <davem@davemloft.net>
13041
13042 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13043 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13044
13045 2008-04-02 Craig Silverstein <csilvers@google.com>
13046
13047 * TODO: New file.
13048
13049 2008-04-02 Ian Lance Taylor <iant@google.com>
13050
13051 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13052 parameters. Update for new key type to views_. Change all
13053 callers.
13054 (File_read::read): Adjust for byteshift in returned view.
13055 (File_read::add_view): New function, broken out of
13056 find_and_make_view.
13057 (File_read::make_view): New function, broken out of
13058 find_and_make_view.
13059 (File_read::find_or_make_view): Add offset and aligned
13060 parameters. Rewrite accordingly. Change all callers.
13061 (File_read::get_view): Add offset and aligned parameters. Adjust
13062 for byteshift in return value.
13063 (File_read::get_lasting_view): Likewise.
13064 * fileread.h (class File_read): Update declarations.
13065 (class File_read::View): Add byteshift_ field. Add byteshift to
13066 constructor. Add byteshift method.
13067 * archive.h (Archive::clear_uncached_views): New function.
13068 (Archive::get_view): Add aligned parameter. Change all callers.
13069 * object.h (Object::get_view): Add aligned parameter. Change all
13070 callers.
13071 (Object::get_lasting_view): Likewise.
13072
13073 * fileread.cc (File_read::release): Don't call clear_views if
13074 there are multiple objects.
13075 * fileread.h (File_read::clear_uncached_views): New function.
13076 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13077 on the archive.
13078
13079 2008-03-31 Cary Coutant <ccoutant@google.com>
13080
13081 Add thin archive support.
13082 * archive.cc (Archive::armagt): New const.
13083 (Archive::setup): Remove task parameter and calls to unlock.
13084 (Archive::unlock_nested_archives): New function.
13085 (Archive::read_header): Add nested_off parameter. Change
13086 all callers.
13087 (Archive::interpret_header): Likewise.
13088 (Archive::include_all_members): Change to handle thin
13089 archives.
13090 (Archive::include_member): Likewise.
13091 * archive.h (Archive::Archive): Add new parameters and
13092 initializers.
13093 (Archive::armagt): New const.
13094 (Archive::setup): Remove task parameter.
13095 (Archive::unlock_nested_archives): New function.
13096 (Archive::read_header): Add nested_off parameter.
13097 (Archive::interpret_header): Likewise.
13098 (Archive::Nested_archive_table): New typedef.
13099 (Archive::is_thin_archive_): New field.
13100 (Archive::nested_archives_): New field.
13101 (Archive::options_): New field.
13102 (Archive::dirpath_): New field.
13103 (Archive::task_): New field.
13104 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13105 for thin archives. Pass additional parameters to
13106 Archive::Archive. Unlock the archive file after calling
13107 Archive::setup.
13108
13109 2008-03-29 Ian Lance Taylor <iant@google.com>
13110
13111 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13112 version symbol to be local.
13113 * testsuite/ver_test_4.sh: New file.
13114 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13115 (check_DATA): Add ver_test_4.syms.
13116 (ver_test_4.syms): New target.
13117 * testsuite/Makefile.in: Rebuild.
13118
13119 * output.cc
13120 (Output_section::Input_section_sort_entry::has_priority): New
13121 function.
13122 (Output_section::Input_section_sort_entry::match_file_name): New
13123 function.
13124 (Output_section::Input_section_sort_entry::match_section_name):
13125 Remove.
13126 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13127 Remove.
13128 (Output_section::Input_section_sort_entry::match_section_file):
13129 Remove.
13130 (Output_section::Input_section_sort_compare::operator()): Rewrite
13131 using new Input_section_sort_entry functions. Sort crtbegin and
13132 crtend first. Sort sections with no priority before sections with
13133 a priority.
13134 * testsuite/initpri1.c (d3): Check j != 4.
13135 (cd5): New constructor/destructor function.
13136 (main): Check j != 2.
13137
13138 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13139 new symbol when resolving, don't call set_is_default.
13140 * testsuite/ver_test_7.cc: New file.
13141 * testsuite/ver_test_7.sh: New file.
13142 * testsuite/Makefile.am (ver_test_7.so): New target.
13143 (ver_test_7.o): New target.
13144 (check_SCRIPTS): Add ver_test_7.sh.
13145 (check_DATA): Add ver_test_7.syms.
13146 (ver_test_7.syms): New target.
13147
13148 2008-03-28 Ian Lance Taylor <iant@google.com>
13149
13150 * layout.cc (Layout::layout): If we see an input section with a
13151 name that needs sorting, set the must_sort flag for the output
13152 section.
13153 (Layout::make_output_section): If the name of the output section
13154 indicates that it might require sorting, set the may_sort flag.
13155 * output.h (Output_section::may_sort_attached_input_sections): New
13156 function.
13157 (Output_section::set_may_sort_attached_input_sections): New
13158 function.
13159 (Output_section::must_sort_attached_input_sections): New
13160 function.
13161 (Output_section::set_must_sort_attached_input_sections): New
13162 function.
13163 (class Output_section): Declare Input_section_sort_entry. Define
13164 Input_section_sort_compare. Declare
13165 sort_attached_input_sections. Add new fields:
13166 may_sort_attached_input_sections_,
13167 must_sort_attached_input_sections_,
13168 attached_input_sections_are_sorted_.
13169 * output.cc (Output_section::Output_section): Initialize new
13170 fields.
13171 (Output_section::add_input_section): Add an entry to
13172 input_sections_ if may_sort or must_sort are true.
13173 (Output_section::set_final_data_size): Call
13174 sort_attached_input_sections if necessary.
13175 (Output_section::Input_section_sort_entry): Define new class.
13176 (Output_section::Input_section_sort_compare::operator()): New
13177 function.
13178 (Output_section::sort_attached_input_sections): New function.
13179 * configure.ac: Check whether the compiler supports constructor
13180 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13181 * testsuite/initpri1.c: New file.
13182 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13183 CONSTRUCTOR_PRIORITY.
13184 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13185 (initpri1_LDFLAGS): New variable.
13186 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13187
13188 2008-03-27 Ian Lance Taylor <iant@google.com>
13189
13190 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13191 * testsuite/common_test_1.c: New file.
13192 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13193 (common_test_1_SOURCES): New variable.
13194 (common_test_1_DEPENDENCIES): New variable.
13195 (common_test_1_LDFLAGS): New variable.
13196
13197 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13198 and commons_ correctly when NAME/VERSION does not override
13199 NAME/NULL.
13200 * testsuite/ver_test_6.c: New file.
13201 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13202 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13203 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13204
13205 2008-03-26 Ian Lance Taylor <iant@google.com>
13206
13207 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13208 of an undefined symbol from a version script.
13209 * testsuite/Makefile.am (ver_test_5.so): New target.
13210 (ver_test_5.o): New target.
13211 (check_SCRIPTS): Add ver_test_5.sh.
13212 (check_DATA): Add ver_test_5.syms.
13213 (ver_test_5.syms): New target.
13214 * testsuite/ver_test_5.cc: New file.
13215 * testsuite/ver_test_5.script: New file.
13216 * testsuite/ver_test_5.sh: New file.
13217 * Makefile.in, testsuite/Makefile.in: Rebuild.
13218
13219 PR gold/5986
13220 Fix problems building gold with gcc 4.3.0.
13221 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13222 (gold_error_at_location, gold_warning_at_location): Use it.
13223 * configure.ac: Check whether we can compile and use a template
13224 function with a printf attribute.
13225 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13226 when jumping over bytes.
13227 * object.cc: Instantiate Object::read_section_data.
13228 * debug.h: Include <cstring>
13229 * dwarf_reader.cc: Include <algorithm>
13230 * main.cc: Include <cstring>.
13231 * options.cc: Include <cstring>.
13232 * output.cc: Include <cstring>.
13233 * script.cc: Include <cstring>.
13234 * script.h: Include <string>.
13235 * symtab.cc: Include <cstring> and <algorithm>.
13236 * target-select.cc: Include <cstring>.
13237 * version.cc: Include <string>.
13238 * testsuite/testmain.cc: Include <cstdlib>.
13239 * configure, config.in: Rebuild.
13240
13241 2008-03-25 Ian Lance Taylor <iant@google.com>
13242
13243 * options.cc: Include "../bfd/bfdver.h".
13244 (options::help): Print bug reporting address.
13245
13246 * version.cc (print_version): Adjust output for current value of
13247 BFD_VERSION_STRING.
13248
13249 * NEWS: New file.
13250
13251 * options.cc (options::help): Print list of supported targets.
13252 * target-select.h: Include <vector>.
13253 (class Target_selector): Make machine_, size_, and is_big_endian_
13254 fields const. Add bfd_name_ and instantiated_target_ fields.
13255 (Target_selector::Target_selector): Add bfd_name parameter.
13256 (Target_selector::recognize): Make non-virtual, call
13257 do_recognize.
13258 (Target_selector::recognize_by_name): Make non-virtual, call
13259 do_recognize_by_name.
13260 (Target_selector::supported_names): New function.
13261 (Target_selector::bfd_name): New function.
13262 (Target_selector::do_instantiate_target): New pure virtual
13263 function.
13264 (Target_selector::do_recognize): New virtual function.
13265 (Target_selector::do_recognize_by_name): New virtual function.
13266 (Target_selector::instantiate_target): New private function.
13267 (supported_target_names): Declare.
13268 * target-select.cc (Target_selector::Target_selector): Update for
13269 new parameter and fields.
13270 (select_target_by_name): Check that the name matches before
13271 calling recognize_by_name.
13272 (supported_target_names): New function.
13273 * i386.cc (class Target_selector_i386): Update Target_selector
13274 constructor call. Remove recognize and recognize_by_name. Add
13275 do_instantiate_target.
13276 * x86_64.cc (class Target_selector_x86_64): Likewise.
13277 * testsuite/testfile.cc (class Target_selector_test): Update for
13278 changes to Target_selector.
13279
13280 * README: Rewrite, with some notes on unsupported features.
13281
13282 2008-03-24 Cary Coutant <ccoutant@google.com>
13283
13284 * i386.cc (Target_i386::Got_type): New enum declaration.
13285 (Target_i386::Scan::local): Updated callers of Output_data_got
13286 member functions.
13287 (Target_i386::Scan::global): Likewise.
13288 (Target_i386::Relocate::relocate): Likewise.
13289 (Target_i386::Relocate::relocate_tls): Likewise.
13290 * object.h (Got_offset_list): New class.
13291 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13292 (Sized_relobj::local_got_offset): Likewise.
13293 (Sized_relobj::set_local_got_offset): Likewise.
13294 (Sized_relobj::local_has_tls_got_offset): Removed.
13295 (Sized_relobj::local_tls_got_offset): Removed.
13296 (Sized_relobj::set_local_tls_got_offset): Removed.
13297 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13298 * output.cc (Output_data_got::add_global): Added got_type parameter.
13299 (Output_data_got::add_global_with_rel): Likewise.
13300 (Output_data_got::add_global_with_rela): Likewise.
13301 (Output_data_got::add_global_pair_with_rel): New function.
13302 (Output_data_got::add_global_pair_with_rela): New function.
13303 (Output_data_got::add_local): Added got_type parameter.
13304 (Output_data_got::add_local_with_rel): Likewise.
13305 (Output_data_got::add_local_with_rela): Likewise.
13306 (Output_data_got::add_local_pair_with_rel): New function.
13307 (Output_data_got::add_local_pair_with_rela): New function.
13308 (Output_data_got::add_global_tls): Removed.
13309 (Output_data_got::add_global_tls_with_rel): Removed.
13310 (Output_data_got::add_global_tls_with_rela): Removed.
13311 (Output_data_got::add_local_tls): Removed.
13312 (Output_data_got::add_local_tls_with_rel): Removed.
13313 (Output_data_got::add_local_tls_with_rela): Removed.
13314 * output.h (Output_data_got::add_global): Added got_type parameter.
13315 (Output_data_got::add_global_with_rel): Likewise.
13316 (Output_data_got::add_global_with_rela): Likewise.
13317 (Output_data_got::add_global_pair_with_rel): New function.
13318 (Output_data_got::add_global_pair_with_rela): New function.
13319 (Output_data_got::add_local): Added got_type parameter.
13320 (Output_data_got::add_local_with_rel): Likewise.
13321 (Output_data_got::add_local_with_rela): Likewise.
13322 (Output_data_got::add_local_pair_with_rel): New function.
13323 (Output_data_got::add_local_pair_with_rela): New function.
13324 (Output_data_got::add_global_tls): Removed.
13325 (Output_data_got::add_global_tls_with_rel): Removed.
13326 (Output_data_got::add_global_tls_with_rela): Removed.
13327 (Output_data_got::add_local_tls): Removed.
13328 (Output_data_got::add_local_tls_with_rel): Removed.
13329 (Output_data_got::add_local_tls_with_rela): Removed.
13330 * resolve.cc (Symbol::override_base_with_special): Removed
13331 reference to has_got_offset_ field.
13332 * symtab.cc (Symbol::init_fields): Replaced initialization
13333 of got_offset_ with got_offsets_. Removed initialization
13334 of has_got_offset_
13335 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13336 (Symbol::got_offset): Likewise.
13337 (Symbol::set_got_offset): Likewise.
13338 (Symbol::has_tls_got_offset): Removed.
13339 (Symbol::tls_got_offset): Removed.
13340 (Symbol::set_tls_got_offset): Removed.
13341 (Symbol::got_offset_): Removed.
13342 (Symbol::tls_mod_got_offset_): Removed.
13343 (Symbol::tls_pair_got_offset_): Removed.
13344 (Symbol::got_offsets_): New field.
13345 (Symbol::has_got_offset): Removed.
13346 (Symbol::has_tls_mod_got_offset): Removed.
13347 (Symbol::has_tls_pair_got_offset): Removed.
13348 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13349 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13350 member functions.
13351 (Target_x86_64::Scan::global): Likewise.
13352 (Target_x86_64::Relocate::relocate): Likewise.
13353 (Target_x86_64::Relocate::relocate_tls): Likewise.
13354
13355 2008-03-25 Ben Elliston <bje@au.ibm.com>
13356
13357 * yyscript.y: Fix spelling error in comment.
13358
13359 2008-03-24 Ian Lance Taylor <iant@google.com>
13360
13361 * options.h (class General_options): Define build_id option.
13362 * layout.h (class Layout): Declare write_build_id, create_note,
13363 create_build_id. Add build_id_note_ member.
13364 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13365 "libiberty.h", "md5.h", "sha1.h".
13366 (Layout::Layout): Initialize eh_frame_data_,
13367 eh_frame_hdr_section_, and build_id_note_.
13368 (Layout::finalize): Call create_build_id.
13369 (Layout::create_note): New function, broken out of
13370 Layout::create_gold_note.
13371 (Layout::create_gold_note): Call create_note.
13372 (Layout::create_build_id): New function.
13373 (Layout::write_build_id): New function.
13374 (Close_task_runner::run): Call write_build_id.
13375
13376 * x86_64.cc: Correct license to GPLv3.
13377
13378 2008-03-23 Ian Lance Taylor <iant@google.com>
13379
13380 * options.cc: Include "demangle.h".
13381 (parse_optional_string): New function.
13382 (parse_long_option): Handle takes_optional_argument.
13383 (parse_short_option): Update dash_z initializer. Handle
13384 takes_optional_argument.
13385 (General_options::General_options): Initialize do_demangle_.
13386 (General_options::finalize): Set do_demangle_. Handle demangling
13387 style.
13388 * options.h (parse_optional_string): Declare.
13389 (struct One_option): Add optional_arg field. Update constructor.
13390 Update call constructor calls. Add takes_optional_argument
13391 function.
13392 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13393 (DEFINE_optional_string): Define.
13394 (General_options::demangle): Change from DEFINE_bool to
13395 DEFINE_optional_string.
13396 (General_options::no_demangle): New function.
13397 (General_options::do_demangle): New function.
13398 (General_options::set_do_demangle): New function.
13399 (General_options::execstack_status_): Move definition to end of
13400 class definition.
13401 (General_options::static_): Likewise.
13402 (General_options::do_demangle_): New field.
13403 * object.cc (big_endian>::get_symbol_location_info): Call
13404 Options::do_demangle, not Options::demangle.
13405 * symtab.cc (demangle): Likewise.
13406
13407 2008-03-22 Ian Lance Taylor <iant@google.com>
13408
13409 * gold.h: Include <cstddef> and <sys/types.h>
13410 * options.h: Include <cstring>.
13411
13412 2008-03-21 Ian Lance Taylor <iant@google.com>
13413
13414 * Added source code to GNU binutils.
This page took 0.536284 seconds and 5 git commands to generate.