libiberty/md5: fix strict alias warnings
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-07-30 Nick Clifton <nickc@redhat.com>
2
3 * po/gold.pot: Updated template.
4 * po/es.po: Updated Spanish translation.
5
6 2012-07-18 Cary Coutant <ccoutant@google.com>
7
8 PR gold/14344
9 * configure.ac: Add check for -gpubnames support.
10 * configure: Regenerate.
11 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
12 support; force -gno-pubnames.
13 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
14 support.
15 (gdb_index_test_4): New test.
16 * testsuite/Makefile.in: Regenerate.
17 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
18 * testsuite/gdb_index_test_2.sh: Likewise.
19 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
20 * testsuite/gdb_index_test_4.sh: New script.
21 * testsuite/gdb_index_test_comm.sh: New script with common code;
22 don't look for space after colon.
23
24 2012-07-16 Sriraman Tallam <tmsriram@google.com>
25
26 * gold.cc (queue_middle_tasks): Update function order only after
27 deferred objects due to plugins are processed.
28
29 2012-07-11 Ian Lance Taylor <iant@google.com>
30
31 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
32 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
33 (Target_arm::scan_reloc_for_stub): Likewise.
34 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
35 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
36 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
37 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
38 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
39
40 2012-07-10 Dodji Seketeli <dodji@redhat.com>
41 Ian Lance Taylor <iant@google.com>
42
43 PR gold/14309
44 * configure.ac: Test whether std::tr1::hash<off_t> works.
45 * gold.h: Add a specialization for std::tr1::hash<off_t> if
46 needed.
47 * output.h (class Output_fill): Add virtual destructor.
48 * configure, config.in: Rebuild.
49
50 2012-06-22 Roland McGrath <mcgrathr@google.com>
51
52 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
53
54 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
55
56 * plugin.cc (Plugin::load): Handle position independent executables.
57
58 2012-06-06 Cary Coutant <ccoutant@google.com>
59
60 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
61 add .debug_macro.
62 (lines_only_debug_sections): Likewise.
63 (gdb_fast_lookup_sections): New static array.
64 (is_gdb_debug_section): Rename formal parameter.
65 (is_lines_only_debug_section): Likewise.
66 (is_gdb_fast_lookup_section): New function.
67 (Layout::include_section): Check for ".zdebug_" prefix; pass
68 section name suffix to is_gdb_debug_section, et al.; check for
69 fast-lookup sections when building .gdb_index.
70 * options.h (--strip-debug-gdb): Update GDB version number.
71
72 2012-06-06 Cary Coutant <ccoutant@google.com>
73
74 * configure.ac: Add check for fallocate.
75 * configure: Regenerate.
76 * config.in: Regenerate.
77
78 * options.h (class General_options): Add --mmap-output-file and
79 --posix-fallocate options.
80 * output.cc: (posix_fallocate): Remove; replace with...
81 (gold_fallocate): New function.
82 (Output_file::map_no_anonymous): Call gold_fallocate.
83 (Output_file::map): Check --mmap-output-file option.
84
85 2012-06-05 Jing Yu <jingyu@google.com>
86
87 * gold.h (textdomain): Add do {} to empty while(0).
88 (bindtextdomain): Likewise.
89
90 2012-06-04 Cary Coutant <ccoutant@google.com>
91
92 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
93 has_dynsym_index.
94
95 2012-05-25 Sriraman Tallam <tmsriram@google.com>
96
97 * symtab.cc (Symbol_table::define_special_symbol):
98 Initialize *poldsym to prevent uninitialized variable errors.
99
100 2012-05-23 Cary Coutant <ccoutant@google.com>
101
102 * layout.cc (Layout::section_name_mapping): Add rules to handle
103 exact match on .data.rel.ro.local or .data.rel.ro.
104 (Layout::output_section_name): Check for exact matches.
105
106 2012-05-23 Cary Coutant <ccoutant@google.com>
107
108 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
109 more carefully.
110
111 2012-05-22 Cary Coutant <ccoutant@google.com>
112
113 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
114 object before exporting symbol.
115
116 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
117
118 * testsuite/tls_test.cc: Include "config.h" first.
119 * testsuite/tls_test_c.c: Likewise.
120
121 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
122 Nick Clifton <nickc@redhat.com>
123
124 PR 14072
125 * configure.in: Add check that sysdep.h has been included before
126 any system header files.
127 * configure: Regenerate.
128 * config.in: Regenerate.
129
130 2012-05-14 Cary Coutant <ccoutant@google.com>
131
132 * layout.cc (Layout::make_output_section): Mark .tdata section
133 as RELRO.
134 * testsuite/relro_test.cc: Add a TLS variable.
135
136 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
137
138 PR gold/14091
139 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
140 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
141 R_X86_64_64.
142
143 2012-05-08 Cary Coutant <ccoutant@google.com>
144
145 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
146 (lines_only_debug_sections): Likewise.
147
148 2012-05-02 Roland McGrath <mcgrathr@google.com>
149
150 * nacl.cc: New file.
151 * nacl.h: New file.
152 * Makefile.am (CCFILES, HFILES): Add them.
153 * Makefile.in: Regenerate.
154 * i386.cc (Output_data_plt_i386_nacl): New class.
155 (Output_data_plt_i386_nacl_exec): New class.
156 (Output_data_plt_i386_nacl_dyn): New class.
157 (Target_i386_nacl): New class.
158 (Target_selector_i386_nacl): New class.
159 (target_selector_i386): Use it instead of Target_selector_i386.
160 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
161 (Target_x86_64_nacl): New class.
162 (Target_selector_x86_64_nacl): New class.
163 (target_selector_x86_64, target_selector_x32): Use it instead of
164 Target_selector_x86_64.
165 * arm.cc (Output_data_plt_arm_nacl): New class.
166 (Target_arm_nacl): New class.
167 (Target_selector_arm_nacl): New class.
168 (target_selector_arm, target_selector_armbe): Use it instead of
169 Target_selector_arm.
170
171 * target-select.cc (select_target): Take new Input_file* and off_t
172 arguments, pass them on to recognize method of selector.
173 * object.cc (make_elf_sized_object): Update caller.
174 * parameters.cc (parameters_force_valid_target): Likewise.
175 * incremental.cc (make_sized_incremental_binary): Likewise.
176 * target-select.h: Update decl.
177 (Target_selector::recognize): Take new Input_file* argument,
178 pass it on to do_recognize.
179 (Target_selector::do_recognize): Take new Input_file* argument.
180 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
181 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
182 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
183 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
184
185 * target.h (Target::Target_info): New members isolate_execinstr
186 and rosegment_gap.
187 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
188 * arm.cc (Target_arm::arm_info): Update initializer.
189 * i386.cc (Target_i386::i386_info): Likewise.
190 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
191 * sparc.cc (Target_sparc::sparc_info): Likewise.
192 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
193 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
194 * layout.cc (Layout::attach_allocated_section_to_segment):
195 Take new const Target* argument. If target->isolate_execinstr(), act
196 like --rosegment.
197 (Layout::find_first_load_seg): Take new const Target* argument;
198 if target->isolate_execinstr(), reject PF_X segments.
199 (Layout::relaxation_loop_body): Update caller.
200 (Layout::set_segment_offsets): If target->isolate_execinstr(),
201 reset file offset to zero when we hit LOAD_SEG, and then do a second
202 loop over the segments before LOAD_SEG to reassign offsets after
203 addresses have been determined. Handle target->rosegment_gap().
204 (Layout::attach_section_to_segment): Take new const Target* argument;
205 pass it to attach_allocated_section_to_segment.
206 (Layout::make_output_section): Update caller.
207 (Layout::attach_sections_to_segments): Take new const Target* argument;
208 pass it to attach_section_to_segment.
209 * gold.cc (queue_middle_tasks): Update caller.
210 * layout.h (Layout): Update method decls with new arguments.
211
212 * arm.cc (Target_arm::Target_arm): Take optional argument for the
213 Target_info pointer to use.
214 (Target_arm::do_make_data_plt): New virtual method.
215 (Target_arm::make_data_plt): New method that calls it.
216 (Target_arm::make_plt_entry): Use it.
217 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
218 for the section alignment.
219 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
220 method.
221 (Output_data_plt_arm::first_plt_entry_offset): Call it.
222 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
223 method.
224 (Output_data_plt_arm::get_plt_entry_size): Call it.
225 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
226 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
227 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
228 method.
229 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
230 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
231 method instead of sizeof(plt_entry).
232 (Output_data_plt_arm::add_entry): Likewise.
233 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
234 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
235 than static method.
236 (Target_arm::plt_entry_size): Likewise.
237 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
238 Move to ...
239 (Output_data_plt_arm_standard): ... here, new class.
240 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
241 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
242 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
243
244 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
245 Take additional argument for the PLT entry size.
246 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
247 Use get_plt_entry_size method rather than plt_entry_size variable.
248 (Output_data_plt_x86_64::reserve_slot): Likewise.
249 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
250 (Output_data_plt_x86_64::add_entry): Likewise.
251 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
252 (Output_data_plt_x86_64::address_for_global): Likewise.
253 (Output_data_plt_x86_64::address_for_local): Likewise.
254 (Output_data_plt_x86_64::set_final_data_size): Likewise.
255 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
256 Make method non-static.
257 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
258 method.
259 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
260 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
261 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
262 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
263 virtual method.
264 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
265 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
266 virtual method.
267 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
268 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
269 virtual method.
270 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
271 (Output_data_plt_x86_64::plt_entry_size)
272 (Output_data_plt_x86_64::first_plt_entry)
273 (Output_data_plt_x86_64::plt_entry)
274 (Output_data_plt_x86_64::tlsdesc_plt_entry)
275 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
276 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
277 (Output_data_plt_x86_64_standard): ... here, new class.
278 (Target_x86_64::Target_x86_64): Take optional argument for the
279 Target_info pointer to use.
280 (Target_x86_64::do_make_data_plt): New virtual method.
281 (Target_x86_64::make_data_plt): New method to call it.
282 (Target_x86_64::init_got_plt_for_update): Use that.
283 Call this->plt_->add_eh_frame method here.
284 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
285 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
286 rather than static method.
287 (Target_x86_64::plt_entry_size): Likewise.
288 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
289 rather than plt_entry_size variable. Move guts of PLT filling to...
290 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
291 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
292 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
293
294 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
295 additional argument for the section alignment.
296 Don't do add_eh_frame_for_plt here.
297 (Output_data_plt_i386::first_plt_entry_offset): Make the method
298 non-static. Use get_plt_entry_size method rather than plt_entry_size
299 variable.
300 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
301 method.
302 (Output_data_plt_i386::get_plt_entry_size): Call it.
303 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
304 (Output_data_plt_i386::add_eh_frame): New method to call it.
305 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
306 method.
307 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
308 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
309 method.
310 (Output_data_plt_i386::fill_plt_entry): New method to call it.
311 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
312 method instead of plt_entry_size.
313 (Output_data_plt_i386::plt_entry_size)
314 (Output_data_plt_i386::plt_eh_frame_fde_size)
315 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
316 (Output_data_plt_i386_standard): ... here, new class.
317 (Output_data_plt_i386_exec): New class.
318 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
319 (Output_data_plt_i386_exec::first_plt_entry): ... here.
320 (Output_data_plt_i386::exec_plt_entry): Move to ...
321 (Output_data_plt_i386_exec::plt_entry): ... here.
322 (Output_data_plt_i386_dyn): New class.
323 (Output_data_plt_i386::first_plt_entry): Move to ...
324 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
325 (Output_data_plt_i386::dyn_plt_entry): Move to ...
326 (Output_data_plt_i386_dyn::plt_entry): ... here.
327 (Target_i386::Target_i386): Take optional argument for the Target_info
328 pointer to use.
329 (Target_i386::do_make_data_plt): New virtual method.
330 (Target_i386::make_data_plt): New method to call it.
331 (Target_i386::make_plt_section): Use that.
332 Call this->plt_->add_eh_frame method here.
333 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
334 rather than plt_entry_size variable.
335 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
336 (Output_data_plt_i386::address_for_local): Likewise.
337 (Output_data_plt_i386::do_write): Likewise.
338 Move guts of PLT filling to...
339 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
340 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
341 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
342 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
343
344 2012-05-01 Cary Coutant <ccoutant@google.com>
345
346 * dwarf_reader.cc (Dwarf_die::read_attributes)
347 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
348 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
349 * reduced_debug_output.cc
350 (Output_reduced_debug_info_section::get_die_end): Remove
351 DW_FORM_GNU_ref_index. Add default case.
352
353 2012-04-26 Mark Wielaard <mjw@redhat.com>
354
355 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
356 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
357 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
358 DW_AT_high_pc as offset from DW_AT_low_pc.
359
360 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
361 * testsuite/Makefile.in: Regenerate.
362 * testsuite/gdb_index_test_3.c: New test source file.
363 * testsuite/gdb_index_test_3.sh: New test source file.
364
365 2012-04-25 Ian Lance Taylor <iant@google.com>
366
367 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
368 pointer.
369 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
370 as a class, not a struct.
371 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
372 (Target_arm::apply_cortex_a8_workaround): Likewise.
373 * gc.h: Declare Reloc_types as a struct, not a class.
374 * object.h: Declare Symbols_data as a struct.
375 * reloc.h: Declare Read_relocs_data as a struct.
376 * target.h: Declare Relocate_info as a struct.
377
378 2012-04-24 David S. Miller <davem@davemloft.net>
379
380 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
381 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
382 and R_SPARC_WPLT30.
383
384 2012-04-24 Cary Coutant <ccoutant@google.com>
385
386 * incremental-dump.cc (find_input_containing_global): Replace
387 magic number with symbolic constant.
388 (dump_incremental_inputs): Update version number.
389 * incremental.cc (Output_section_incremental_inputs): Update version
390 number; import symbolic constants from Incremental_inputs_reader.
391 (Incremental_inputs::create_data_sections): Align relocations
392 section correctly for 64-bit targets.
393 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
394 constants; add padding.
395 (Output_section_incremental_inputs::write_header): Add assert for
396 header_size.
397 (Output_section_incremental_inputs::write_input_files): Add assert
398 for input_entry_size.
399 (Output_section_incremental_inputs::write_info_blocks): Add padding;
400 add assert for object_info_size, input_section_entry_size,
401 global_sym_entry_size.
402 * incremental.h (Incremental_inputs_reader): Add symbolic constants
403 for data structure sizes; use them.
404 (Incremental_input_entry_reader): Import symbolic constants from
405 Incremental_inputs_reader; use them.
406
407 2012-04-23 David S. Miller <davem@davemloft.net>
408
409 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
410 and elf_flags_set_.
411 (Target_sparc::Target_sparc): Initialize new fields.
412 (Target_sparc::do_make_elf_object): New function.
413 (Target_sparc::do_adjust_elf_header): New function.
414
415 2012-04-23 Cary Coutant <ccoutant@google.com>
416
417 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
418 CU range table of gdb index.
419
420 2012-04-20 David S. Miller <davem@davemloft.net>
421
422 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
423 instead of false.
424
425 2012-04-16 David S. Miller <davem@davemloft.net>
426
427 * sparc.cc (Target_sparc::got_address): New function.
428 (Sparc_relocate_functions::gdop_hix22): New function.
429 (Sparc_relocate_functions::gdop_lox10): New function.
430 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
431 relocs.
432 (Target_sparc::Scan::local): Likewise if the global symbol is not
433 preemptible and is not IFUNC.
434 (Target_sparc::Relocate::relocate): Perform GOTDATA code
435 transformations for local and non-preemptible non-IFUNC global
436 symbols.
437
438 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
439 writing out 64-bit part of ranges.
440
441 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
442 -fpic and -fpie respectively.
443 * Makefile.in: Regenerate.
444
445 * sparc.cc (class Target_sparc): Add rela_ifunc_.
446 (Target_sparc::Target_sparc): Initialize new field.
447 (Target_sparc::do_plt_section_for_global): New function.
448 (Target_sparc::do_plt_section_for_local): New function.
449 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
450 (Target_sparc::make_plt_section): New function, broken out of
451 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
452 (Target_sparc::make_plt_entry): Call make_plt_section.
453 (Target_sparc::make_local_ifunc_plt_entry): New function.
454 (Target_sparc::rela_ifunc_section): New function.
455 (Target_sparc::plt_section): Remove const.
456 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
457 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
458 and ifunc_count_ fields.
459 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
460 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
461 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
462 (Output_data_plt_sparc::rela_ifunc): New function.
463 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
464 (Output_data_plt_sparc::has_ifunc_section): New function.
465 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
466 (Output_data_plt_sparc::address_for_global): New function.
467 (Output_data_plt_sparc::address_for_local): New function.
468 (Output_data_plt_sparc::plt_index_to_offset): New function.
469 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
470 and entry_count.
471 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
472 entry_count.
473 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
474 R_SPARC_JMP_IREL to switch.
475 (Target_sparc::Scan::check_non_pic): Likewise.
476 (Target_sparc::Scan::local): Handle IFUNC symbols.
477 (Target_sparc::Scan::local): Likewise.
478 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
479 and plt_address_for_local.
480 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
481 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
482
483 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
484 (class Output_data_reloc): Adjust calls to Output_reloc_type.
485 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
486 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
487 global relocs too.
488 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
489 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
490 calls.
491 * sparc.cc (Target_sparc::Scan::global): Likewise.
492 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
493
494 2012-04-16 Cary Coutant <ccoutant@google.com>
495
496 * archive.cc (Library_base::should_include_member): Check for
497 --export-dynamic-symbol.
498 * options.h (class General_options): Add --export-dynamic-symbol.
499 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
500 --export-dynamic-symbol.
501 (Symbol_table::gc_mark_undef_symbols): Likewise.
502 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
503
504 2012-04-12 David S. Miller <davem@davemloft.net>
505
506 * sparc.cc (Reloc::wdisp10): New relocation method.
507 (Reloc::h34): Likewise.
508 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
509 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
510 R_SPARC_WDISP10.
511 (Target_sparc::Scan::local): Likewise.
512 (Target_sparc::Scan::global): Likewise.
513 (Target_sparc::Relocate::relocate): Likewise.
514
515 2012-04-09 Cary Coutant <ccoutant@google.com>
516
517 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
518 low_pc == 0.
519
520 2012-04-06 Ian Lance Taylor <iant@google.com>
521
522 * timer.cc: #include <unistd.h>.
523
524 2012-04-06 Roland McGrath <mcgrathr@google.com>
525
526 * configure.in (AC_CHECK_HEADERS): Add locale.h.
527 * config.in: Regenerate.
528 * configure: Regenerate.
529
530 2012-04-05 Nick Clifton <nickc@redhat.com>
531
532 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
533 (AM_LC_MESSAGES): Add.
534 * aclocal.m4: Regenerate.
535 * config.in: Regenerate.
536 * configure: Regenerate.
537
538 2012-03-21 Cary Coutant <ccoutant@google.com>
539
540 * Makefile.am: Add gdb-index.cc, gdb-index.h.
541 * Makefile.in: Regenerate.
542 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
543 (Sized_elf_reloc_mapper::symbol_section): New function.
544 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
545 (make_elf_reloc_mapper): New function.
546 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
547 (Dwarf_abbrev_table::do_read_abbrevs): New function.
548 (Dwarf_abbrev_table::do_get_abbrev): New function.
549 (Dwarf_ranges_table::read_ranges_table): New function.
550 (Dwarf_ranges_table::read_range_list): New function.
551 (Dwarf_pubnames_table::read_section): New function.
552 (Dwarf_pubnames_table::read_header): New function.
553 (Dwarf_pubnames_table::next_name): New function.
554 (Dwarf_die::Dwarf_die): New function.
555 (Dwarf_die::read_attributes): New function.
556 (Dwarf_die::skip_attributes): New function.
557 (Dwarf_die::set_name): New function.
558 (Dwarf_die::set_linkage_name): New function.
559 (Dwarf_die::attribute): New function.
560 (Dwarf_die::string_attribute): New function.
561 (Dwarf_die::int_attribute): New function.
562 (Dwarf_die::uint_attribute): New function.
563 (Dwarf_die::ref_attribute): New function.
564 (Dwarf_die::child_offset): New function.
565 (Dwarf_die::sibling_offset): New function.
566 (Dwarf_info_reader::check_buffer): New function.
567 (Dwarf_info_reader::parse): New function.
568 (Dwarf_info_reader::do_parse): New function.
569 (Dwarf_info_reader::do_read_string_table): New function.
570 (Dwarf_info_reader::lookup_reloc): New function.
571 (Dwarf_info_reader::get_string): New function.
572 (Dwarf_info_reader::visit_compilation_unit): New function.
573 (Dwarf_info_reader::visit_type_unit): New function.
574 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
575 Sized_elf_reloc_mapper.
576 (Sized_dwarf_line_info::symbol_section): Remove function.
577 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
578 (Sized_dwarf_line_info::read_line_mappings): Remove object
579 parameter, adjust callers.
580 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
581 * dwarf_reader.h: Include <sys/types.h>.
582 (class Track_relocs): Remove forward declaration.
583 (class Elf_reloc_mapper): New class.
584 (class Sized_elf_reloc_mapper): New class.
585 (class Dwarf_abbrev_table): New class.
586 (class Dwarf_range_list): New class.
587 (class Dwarf_ranges_table): New class.
588 (class Dwarf_pubnames_table): New class.
589 (class Dwarf_die): New class.
590 (class Dwarf_info_reader): New class.
591 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
592 (Sized_dwarf_line_info::symbol_section): Remove member function.
593 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
594 base class.
595 * gdb-index.cc: New source file.
596 * gdb-index.h: New source file.
597 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
598 and .debug_types sections, call Layout::add_to_gdb_index.
599 (Sized_relobj_incr::do_section_name): Implement.
600 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
601 return type; Implement.
602 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
603 return type.
604 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
605 parameter list and return type.
606 (Sized_incr_dynobj::do_section_contents): Likewise.
607 * layout.cc: Include gdb-index.h.
608 (Layout::Layout): Initialize gdb_index_data_.
609 (Layout::init_fixed_output_section): Check for .gdb_index section.
610 (Layout::add_to_gdb_index): New function. Instantiate.
611 * layout.h: Add forward declaration for class Gdb_index.
612 (Layout::add_to_gdb_index): New member function.
613 (Layout::gdb_index_data_): New data member.
614 * main.cc: Include gdb-index.h.
615 (main): Print statistics for gdb index.
616 * object.cc (Object::section_contents): Move code into
617 do_section_contents.
618 (need_decompressed_section): Check for sections needed when building
619 gdb index.
620 (build_compressed_section_map): Likewise.
621 (Sized_relobj_file::do_read_symbols): Need local symbols when building
622 gdb index.
623 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
624 sections; call Layout::add_to_gdb_index.
625 (Sized_relobj_file::do_decompressed_section_contents): Call
626 do_section_contents directly.
627 * object.h (Object::do_section_contents): Adjust parameter list and
628 return type.
629 (Object::do_decompressed_section_contents): Call do_section_contents
630 directly.
631 (Sized_relobj_file::do_section_contents): Adjust parameter list and
632 return type.
633 * options.h (class General_options): Add --gdb-index option.
634 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
635 list and return type.
636 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
637 * reloc.h (Track_relocs::checkpoint): New function.
638 (Track_relocs::reset): New function.
639
640 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
641 New test cases.
642 * testsuite/Makefile.in: Regenerate.
643 * testsuite/gdb_index_test.cc: New test source file.
644 * testsuite/gdb_index_test_1.sh: New test source file.
645 * testsuite/gdb_index_test_2.sh: New test source file.
646
647 2012-03-19 Doug Kwan <dougkwan@google.com>
648
649 * arm.cc (Target_arm::do_define_standard_symbols): New method.
650 (Target_arm::do_finalize_sections): Remove code which defines
651 __exidx_start and __exidx_end. Make symbol table parameter
652 anonymous as it is not used.
653 * gold.cc (queue_middle_tasks): Call target hook to define any
654 target-specific symbols.
655 * target.h (Target::define_standard_symbols): New method.
656 (Target::do_define_standard_symbols): Same.
657 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
658 * testsuite/Makefile.in: Regenerate.
659 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
660 and __exidx_end.
661 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
662 relocations are generated for __exidx_start and __exidx_end.
663
664 2012-03-16 Doug Kwan <dougkwan@google.com>
665
666 * testsuite/Makefile.am: Disable test initpri3b.
667 * testsuite/Makefile.in: Regenerate.
668
669 2012-03-15 Doug Kwan <dougkwan@google.com>
670
671 * arm.cc (Target_arm::got_section): Make .got section read-only
672 if -z now is given.
673
674 2012-03-15 Ian Lance Taylor <iant@google.com>
675
676 PR gold/13850
677 * layout.cc (Layout::make_output_section): Correctly mark
678 SHT_INIT_ARRAY, et. al., as relro.
679
680 2012-03-14 Doug Kwan <dougkwan@google.com>
681
682 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
683 dynamic relocations for protected symbols in shared objects.
684
685 2012-03-13 Ian Lance Taylor <iant@google.com>
686
687 * resolve.cc (Symbol_table::resolve): When merging common symbols,
688 keep the larger alignment.
689
690 2012-03-12 Cary Coutant <ccoutant@google.com>
691
692 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
693 handling of DW_LNE_define_file.
694
695 2012-03-12 Cary Coutant <ccoutant@google.com>
696
697 * reduced_debug_output.cc
698 (Output_reduced_debug_info_section::get_die_end): Add new FORM
699 codes to switch.
700
701 2012-02-29 Cary Coutant <ccoutant@google.com>
702
703 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
704
705 2012-02-29 Cary Coutant <ccoutant@google.com>
706
707 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
708 Call Object::decompressed_section_contents.
709 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
710 New dtor.
711 (Sized_dwarf_line_info::buffer_start_): New data member.
712 * merge.cc (Output_merge_data::do_add_input_section): Call
713 Object::decompressed_section_contents.
714 (Output_merge_string::do_add_input_section): Likewise.
715 * object.cc (need_decompressed_section): New function.
716 (build_compressed_section_map): Decompress sections needed later.
717 (Sized_relobj_file::do_decompressed_section_contents): New function.
718 (Sized_relobj_file::do_discard_decompressed_sections): New function.
719 * object.h (Object::decompressed_section_contents): New function.
720 (Object::discard_decompressed_sections): New function.
721 (Object::do_decompressed_section_contents): New function.
722 (Object::do_discard_decompressed_sections): New function.
723 (Compressed_section_info): New type.
724 (Compressed_section_map): Include decompressed section contents.
725 (Sized_relobj_file::do_decompressed_section_contents): New function.
726 (Sized_relobj_file::do_discard_decompressed_sections): New function.
727
728 2012-02-16 Cary Coutant <ccoutant@google.com>
729
730 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
731 * testsuite/Makefile.in: Regenerate.
732
733 2012-02-14 Cary Coutant <ccoutant@google.com>
734
735 * options.cc (General_options::finalize): Disallow -pie and -static.
736
737 2012-02-03 Doug Kwan <dougkwan@google.com>
738
739 * arm.cc (Arm_relocate_functions::abs8,
740 Arm_relocate_functions::abs16): Use
741 Bits::has_signed_unsigned_overflow32.
742 (Arm_relocate_functions::thm_abs8): Correct range of
743 overflow check.
744 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
745 in assertions.
746
747 2012-02-02 Doug Kwan <dougkwan@google.com>
748
749 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
750 position independent outputs, not just shared objects.
751
752 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
753
754 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
755 * configure: Regenerated.
756
757 2012-01-27 Ian Lance Taylor <iant@google.com>
758
759 * reloc.h (Bits): New class with static functions, copied from
760 namespace utils in arm.cc.
761 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
762 instead.
763
764 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
765
766 * incremental.cc (write_info_blocks): Correct relocation offset.
767
768 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
769
770 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
771 (Relocate::tls_gd_to_le): Likewise.
772
773 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
774
775 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
776
777 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
778
779 * configure.ac: Check if -mcmodel=medium works.
780 * configure: Regenerated.
781
782 2012-01-24 Cary Coutant <ccoutant@google.com>
783
784 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
785 definition and ...
786 (read_unsigned_LEB_128_x): ... this new function.
787 (read_signed_LEB_128): Replaced with inline definition and ...
788 (read_signed_LEB_128_x): ... this new function.
789 * int_encoding.h (read_unsigned_LEB_128_x): New function.
790 (read_unsigned_LEB_128): Add inline definition.
791 (read_signed_LEB_128_x): New function.
792 (read_signed_LEB_128): Add inline definition.
793 * testsuite/Makefile.am (leb128_unittest): New unit test.
794 * testsuite/Makefile.in: Regenerate.
795 * testsuite/leb128_unittest.cc: New unit test.
796
797 2012-01-23 Ian Lance Taylor <iant@google.com>
798
799 PR gold/13617
800 * i386.cc (Target_i386::do_code_fill): When using a jmp
801 instruction, pad with nop instructions.
802 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
803
804 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
805
806 * x86_64.cc (gc_process_relocs): Add typename on types used in
807 template.
808 (scan_relocs): Likewise.
809 (relocate_section): Likewise.
810 (apply_relocation): Likewise.
811
812 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
813
814 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
815 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
816 under x32.
817
818 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
819
820 * x86_64.cc: Initial support for x32.
821
822 2012-01-03 Cary Coutant <ccoutant@google.com>
823
824 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
825 Use abstract base class for GOT.
826 * gold/output.h (class Output_data_got_base): New abstract base class.
827 (class Output_data_got): Derive from new base class, adjust ctors.
828 (Output_data_got::reserve_slot): Make virtual; rename to
829 do_reserve_slot; Adjust callers.
830 * gold/target.h (Sized_target::init_got_plt_for_update): Return
831 pointer to abstract base class.
832 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
833
834 2011-12-18 Ian Lance Taylor <iant@google.com>
835
836 * object.h (Relobj::local_symbol_value): New function.
837 (Relobj::local_plt_offset): New function.
838 (Relobj::local_has_got_offset): New function.
839 (Relobj::local_got_offset): New function.
840 (Relobj::set_local_got_offset): New function.
841 (Relobj::do_local_symbol_value): New pure virtual function.
842 (Relobj::do_local_plt_offset): Likewise.
843 (Relobj::do_local_has_got_offset): Likewise.
844 (Relobj::do_local_got_offset): Likewise.
845 (Relobj::do_set_local_got_offset): Likewise.
846 (Sized_relobj::do_local_has_got_offset): Rename from
847 local_has_got_offset.
848 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
849 (Sized_relobj::do_set_local_got_offset): Rename from
850 set_local_got_offset.
851 (Sized_relobj_file::do_local_plt_offset): Rename from
852 local_plt_offset.
853 (Sized_relobj_file::do_local_symbol_value): New function.
854 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
855 local_plt_offset.
856 * output.cc (Output_data_got::Got_entry::write): Change object to
857 Relobj. Use local_symbol_value.
858 (Output_data_got::add_global_with_rel): Change rel_dyn to
859 Output_data_reloc_generic*. Use add_global_generic.
860 (Output_data_got::add_global_with_rela): Remove. Change all
861 callers to use add_global_with_rel.
862 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
863 Output_data_reloc_generic*. Use add_global_generic.
864 (Output_data_got::add_global_pair_with_rela): Remove. Change all
865 callers to use add_global_pair_with_rel.
866 (Output_data_got::add_local): Change object to Relobj*.
867 (Output_data_got::add_local_plt): Likewise.
868 (Output_data_got::add_local_with_rel): Change object to Relobj*,
869 change rel_dyn to Output_data_reloc_generic*. Use
870 add_local_generic.
871 (Output_data_got::add_local_with_rela): Remove. Change all
872 callers to use all_local_with_rel.
873 (Output_data_got::add_local_pair_with_rel): Change object to
874 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
875 add_output_section_generic.
876 (Output_data_got::add_local_pair_with_rela): Remove. Change all
877 callers to use add_local_pair_with_rel.
878 (Output_data_got::reserve_local): Change object to Relobj*.
879 * output.h: (class Output_data_reloc_generic): Add pure virtual
880 declarations for add_global_generic, add_local_generic,
881 add_output_section_generic.
882 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
883 functions for Output_data_reloc_generic. Update declarations for
884 changes listed in output.cc.
885 (class Output_data_got): Change template parameter to got_size.
886 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
887 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
888 function.
889 (Sized_relobj_incr::do_local_plt_offset): New function.
890 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
891 add_global_generic.
892
893 2011-12-17 Cary Coutant <ccoutant@google.com>
894
895 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
896 * resolve.cc (Symbol_table::resolve): Likewise.
897 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
898 arrays.
899 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
900
901 2011-12-16 Ian Lance Taylor <iant@google.com>
902
903 * output.h (Output_data_reloc_generic::add): Only call
904 add_dynamic_reloc if this is a dynamic reloc section.
905
906 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
907
908 PR gold/13505
909 * target-reloc.h (apply_relocation): Replace <64, false> with
910 <size, big_endian>.
911
912 2011-11-25 Nick Clifton <nickc@redhat.com>
913
914 * po/it.po: New Italian translation.
915
916 2011-11-17 Sterling Augustine <saugustine@google.com>
917
918 * script.cc (script_include_directive): Implement.
919 (read_script_file): New local variables name and search_path. Update
920 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
921 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
922 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
923
924 2011-11-11 Sterling Augustine <saugustine@google.com>
925
926 * yyscript.y (section_cmd): Add support for INCLUDE directive.
927 (file_or_sections_cmd): Likewise.
928
929 2011-11-11 Doug Kwan <dougkwan@google.com>
930
931 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
932 if --just-symbols is given.
933
934 2011-11-10 Doug Kwan <dougkwan@google.com>
935
936 PR gold/13362
937 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
938 when processing data relocs.
939 * reloc.h (Relocate_functions::rel_unaligned): New method.
940 (Relocate_functions::pcrel_unaligned): Ditto.
941 (Relocate_functions::rel32_unaligned): Ditto.
942 (Relocate_functions::pcrel32_unaligned): Ditto.
943
944 2011-11-09 Doug Kwan <dougkwan@google.com>
945
946 PR gold/13362
947 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
948 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
949 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
950 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
951 (Relocate_functions::rel_unaligned): New.
952 (Relocate_functions::rel32_unaligned): New.
953 * target-reloc.h (relocate_for_relocatable): Add code to handle
954 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
955 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
956 arm_unaligned_reloc_r): New targets.
957 * testsuite/Makefile.in: Regenerate.
958 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
959 linking.
960
961 2011-11-02 Ian Lance Taylor <iant@google.com>
962
963 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
964 NATIVE_LINKER.
965 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
966 * options.cc (General_options::finalize): Use library search path
967 from configure script if specified. If not native and no sysroot,
968 only search TOOLLIBDIR.
969 * options.h (Search_directory::Search_directory): Change name to
970 const std::string&.
971 (General_options::add_to_library_path_with_sysroot): Change arg to
972 const std::string&.
973 * configure, Makefile.in, config.in: Rebuild.
974
975 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
976
977 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
978 we are working around the ARM1176 Erratum.
979 * options.h (General_options::fix_arm1176): Add option.
980 * testsuite/Makefile.am: Add testcases, and keep current ones
981 working.
982 * testsuite/Makefile.in: Regenerate.
983 * testsuite/arm_fix_1176.s: New file.
984 * testsuite/arm_fix_1176.sh: Likewise.
985
986 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
987
988 * arm.cc (Target_arm::Target_arm): Remove initialisation of
989 may_use_blx_.
990 (Target_arm::may_use_blx): Remove method.
991 (Target_arm::set_may_use_blx): Likewise.
992 (Target_arm::may_use_v4t_interworking): New method.
993 (Target_arm::may_use_v5t_interworking): Likewise.
994 (Target_arm::may_use_blx_): Remove member variable.
995 (Arm_relocate_functions::arm_branch_common): Check for v5T
996 interworking.
997 (Arm_relocate_functions::thumb_branch_common): Likewise.
998 (Reloc_stub::stub_type_for_reloc): Likewise.
999 (Target_arm::do_finalize_sections): Correct interworking checks.
1000 * testsuite/Makefile.am: Add new tests.
1001 * testsuite/Makefile.in: Regenerate.
1002 * testsuite/arm_farcall_arm_arm.s: New test.
1003 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1004 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1005 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1006 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1007 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1008 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1009 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1010
1011 2011-10-31 Cary Coutant <ccoutant@google.com>
1012
1013 PR gold/13023
1014 * expression.cc (Expression::eval_with_dot): Add
1015 is_section_dot_assignment parameter.
1016 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1017 absolute and assigning to dot within a section.
1018 * script-sections.cc
1019 (Output_section_element_assignment::set_section_addresses): Pass
1020 dot_section to set_if_absolute.
1021 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1022 as is_section_dot_assignment flag to eval_with_dot.
1023 (Output_section_element_dot_assignment::set_section_addresses):
1024 Likewise.
1025 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1026 parameter. Also set value if relative to dot_section; set the
1027 symbol's output_section.
1028 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1029 parameter. Adjust all callers.
1030 (Expression::eval_maybe_dot): Likewise.
1031 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1032 Adjust all callers.
1033 * testsuite/script_test_2.t: Test assignment of an absolute value
1034 to dot within an output section element.
1035
1036 2011-10-31 Cary Coutant <ccoutant@google.com>
1037
1038 * options.h (class General_options): Add --[no-]gnu-unique options.
1039 * symtab.cc (Symbol_table::sized_write_globals): Convert
1040 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1041
1042 2011-10-31 Cary Coutant <ccoutant@google.com>
1043
1044 PR gold/13359
1045 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1046 unnecessary assertion.
1047 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1048
1049 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1050
1051 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1052 gc_mark_symbol.
1053 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1054 gc_mark_symbol.
1055 Change to just keep the section associated with symbol.
1056 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1057 they are externally visible and --export-dynamic is turned on.
1058 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1059
1060 2011-10-19 Ian Lance Taylor <iant@google.com>
1061
1062 PR gold/13163
1063 * script-sections.cc
1064 (Output_section_element_dot_assignment::needs_output_section): New
1065 function.
1066
1067 2011-10-19 Ian Lance Taylor <iant@google.com>
1068
1069 PR gold/13204
1070 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1071 --section-start option was seen.
1072 * options.h (General_options::any_section_start): New function.
1073
1074 2011-10-18 David S. Miller <davem@davemloft.net>
1075
1076 PR binutils/13301
1077 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1078 member to track relocation locations that have moved during TLS
1079 reloc optimizations.
1080 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1081 (Target_sparc::Relocate::relocate): Adjust view down by 4
1082 bytes if it matches reloc_adjust_addr_.
1083 (Target_sparc::Relocate::relocate_tls): Always move the
1084 __tls_get_addr call delay slot instruction forward 4 bytes when
1085 performing relaxation.
1086
1087 2011-10-18 Cary Coutant <ccoutant@google.com>
1088
1089 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1090 (Output_file::map_no_anonymous): Check for non-zero
1091 return code from posix_fallocate.
1092
1093 2011-10-17 Cary Coutant <ccoutant@google.com>
1094
1095 PR gold/13245
1096 * plugin.cc (is_visible_from_outside): Check for symbols
1097 referenced from dynamic objects.
1098 * resolve.cc (Symbol_table::resolve): Don't count references
1099 from dynamic objects as references from real ELF files.
1100 * testsuite/plugin_test_2.sh: Adjust expected result.
1101
1102 2011-10-17 Cary Coutant <ccoutant@google.com>
1103
1104 * gold.cc: Include timer.h.
1105 (queue_middle_tasks): Stamp time.
1106 (queue_final_tasks): Likewise.
1107 * main.cc (main): Store timer in parameters. Print timers
1108 for each pass.
1109 * parameters.cc (Parameters::Parameters): Initialize timer_.
1110 (Parameters::set_timer): New function.
1111 (set_parameters_timer): New function.
1112 * parameters.h (Parameters::set_timer): New function.
1113 (Parameters::timer): New function.
1114 (Parameters::timer_): New data member.
1115 (set_parameters_timer): New function.
1116 * timer.cc (Timer::stamp): New function.
1117 (Timer::get_pass_time): New function.
1118 * timer.h (Timer::stamp): New function.
1119 (Timer::get_pass_time): New function.
1120 (Timer::pass_times_): New data member.
1121
1122 2011-10-17 Cary Coutant <ccoutant@google.com>
1123
1124 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1125 task for members of lib groups.
1126
1127 2011-10-17 Cary Coutant <ccoutant@google.com>
1128
1129 PR gold/13288
1130 * fileread.cc (File_read::find_view): Add assert.
1131 (File_read::make_view): Move bounds check (replace with assert)...
1132 (File_read::find_or_make_view): ... to here.
1133
1134 2011-10-12 Cary Coutant <ccoutant@google.com>
1135
1136 * output.cc (Output_file::open_base_file): Handle case where
1137 ::read returns less than requested size.
1138
1139 2011-10-10 Cary Coutant <ccoutant@google.com>
1140
1141 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1142 Initialize defined_count_.
1143 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1144 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1145 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1146 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1147 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1148 * incremental.h (Sized_relobj_incr::defined_count_): New data
1149 member.
1150 (Sized_incr_dynobj::defined_count_): New data member.
1151 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1152 Return zeroes instead of internal error.
1153
1154 2011-10-10 Cary Coutant <ccoutant@google.com>
1155
1156 PR gold/13249
1157 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1158 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1159 * output.h (class Output_reloc): Add use_plt_offset flag.
1160 (Output_reloc::type_): Adjust size of bit field.
1161 (Output_reloc::use_plt_offset_): New bit field.
1162 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1163 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1164 flag. Adjust all callers.
1165 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1166 creating RELATIVE relocations.
1167
1168 2011-10-10 Nick Clifton <nickc@redhat.com>
1169
1170 * po/es.po: Updated Spanish translation.
1171 * po/fi.po: Updated Finnish translation.
1172
1173 2011-10-03 Diego Novillo <dnovillo@google.com>
1174
1175 * options.cc (parse_uint): Fix dereference of RETVAL.
1176
1177 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1178
1179 * layout.h (section_order_map_): New member.
1180 (get_section_order_map): New member function.
1181 * output.cc (Output_section::add_input_section): Check for patterns
1182 only when --section-ordering-file is specified.
1183 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1184 output_sections have been formed.
1185 * layout.cc (Layout_Layout): Initialize section_order_map_.
1186 * plugin.cc (update_section_order): Store order in order_map. Do not
1187 update the order.
1188 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1189 * testsuite/Makefile.in: Regenerate.
1190 * testsuite/plugin_section_order.c: New file.
1191 * testsuite/plugin_final_layout.cc: New file.
1192 * testsuite/plugin_final_layout.sh: New file.
1193
1194 2011-09-29 Cary Coutant <ccoutant@google.com>
1195
1196 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1197 Check for NULL.
1198 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1199 symbols during incremental update.
1200 (Symbol_table::add_from_dynobj): Likewise.
1201
1202 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1203 Ian Lance Taylor <iant@google.com>
1204
1205 * symtab.cc (Symbol_table::define_special_symbol): Always
1206 canonicalize version string.
1207
1208 2011-09-26 Cary Coutant <ccoutant@google.com>
1209
1210 * gold.cc (queue_initial_tasks): Move option checks ...
1211 * options.cc (General_options::finalize): ... to here. Disable
1212 some options; make others fatal.
1213
1214 2011-09-26 Cary Coutant <ccoutant@google.com>
1215
1216 gcc PR lto/47247
1217 * plugin.cc (get_symbols_v2): New function.
1218 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1219 (is_referenced_from_outside): New function.
1220 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1221 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1222 (get_symbols): Pass version parameter.
1223 (get_symbols_v2): New function.
1224 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1225 parameter.
1226 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1227 (onload): Add LDPT_GET_SYMBOLS_V2.
1228 (all_symbols_read_hook): Use get_symbols_v2; check for
1229 LDPR_PREVAILING_DEF_IRONLY_EXP.
1230 * testsuite/plugin_test_3.sh: Update expected results.
1231
1232 2011-09-23 Simon Baldwin <simonb@google.com>
1233
1234 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1235 configuration options.
1236 * configure: Regenerate.
1237 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1238 * Makefile.in: Regenerate.
1239 * testsuite/Makefile.in: Regenerate.
1240
1241 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1242
1243 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1244
1245 2011-09-19 Cary Coutant <ccoutant@google.com>
1246
1247 * incremental.cc (can_incremental_update): Fix typo in comment.
1248 * incremental.h (can_incremental_update): Likewise.
1249
1250 2011-09-18 Cary Coutant <ccoutant@google.com>
1251
1252 * incremental.cc (can_incremental_update): New function.
1253 * incremental.h (can_incremental_update): New function.
1254 * layout.cc (Layout::init_fixed_output_section): Call it.
1255 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1256 * object.cc (Sized_relobj_file::do_layout): Call
1257 can_incremental_update.
1258
1259 2011-09-13 Cary Coutant <ccoutant@google.com>
1260
1261 * configure.ac: Check for glibc support for gnu_indirect_function
1262 support with static linking, setting automake conditional
1263 IFUNC_STATIC.
1264 * Makefile.in: Regenerate.
1265 * configure: Regenerate.
1266
1267 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1268 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1269 for IFUNC_STATIC.
1270 * testsuite/Makefile.in: Regenerate.
1271
1272 2011-09-13 Cary Coutant <ccoutant@google.com>
1273
1274 * incremental.cc (Sized_relobj_incr::do_layout): Call
1275 report_comdat_group for kept comdat sections.
1276 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1277 * testsuite/Makefile.in: Regenerate.
1278 * testsuite/incr_comdat_test_1.cc: New source file.
1279 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1280 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1281 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1282
1283 2011-09-13 Ian Lance Taylor <iant@google.com>
1284
1285 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1286 variable external_symbols_offset.
1287
1288 2011-09-12 Ian Lance Taylor <iant@google.com>
1289
1290 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1291 triggered if object has no symbols.
1292
1293 2011-09-09 David S. Miller <davem@davemloft.net>
1294
1295 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1296 (Output_fill_debug_line::do_write): Likewise.
1297
1298 2011-08-29 Cary Coutant <ccoutant@google.com>
1299
1300 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1301 casts to match formatting specs.
1302 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1303
1304 2011-08-26 Cary Coutant <ccoutant@google.com>
1305
1306 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1307 remaining hole size when allocating.
1308 (Layout::make_output_section): Set fill methods for debug sections.
1309 * layout.h (Free_list::Free_list_node): Move from private to
1310 public.
1311 (Free_list::set_min_hole_size): New function.
1312 (Free_list::begin, Free_list::end): New functions.
1313 (Free_list::min_hole_): New data member.
1314 * output.cc: Include dwarf.h.
1315 (Output_fill_debug_info::do_minimum_hole_size): New function.
1316 (Output_fill_debug_info::do_write): New function.
1317 (Output_fill_debug_line::do_minimum_hole_size): New function.
1318 (Output_fill_debug_line::do_write): New function.
1319 (Output_section::Output_section): Initialize new data member.
1320 (Output_section::set_final_data_size): Ensure patch space is larger
1321 than minimum hole size.
1322 (Output_section::do_write): Fill holes in debug sections.
1323 * output.h (Output_fill): New class.
1324 (Output_fill_debug_info): New class.
1325 (Output_fill_debug_line): New class.
1326 (Output_section::set_free_space_fill): New function.
1327 (Output_section::free_space_fill_): New data member.
1328 * testsuite/Makefile.am (incremental_test_3): Add
1329 --incremental-patch option.
1330 (incremental_test_4): Likewise.
1331 (incremental_test_5): Likewise.
1332 (incremental_test_6): Likewise.
1333 (incremental_copy_test): Likewise.
1334 (incremental_common_test_1): Likewise.
1335 * testsuite/Makefile.in: Regenerate.
1336
1337 2011-08-26 Nick Clifton <nickc@redhat.com>
1338
1339 * po/es.po: Updated Spanish translation.
1340
1341 2011-08-01 Cary Coutant <ccoutant@google.com>
1342
1343 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1344 * gold/testsuite/Makefile.in: Regenerate.
1345 * gold/testsuite/justsyms_exec.c: New source file.
1346 * gold/testsuite/justsyms_lib.c: New source file.
1347
1348 2011-08-01 Cary Coutant <ccoutant@google.com>
1349
1350 * layout.cc (Layout::set_segment_offsets): Don't realign text
1351 segment if -Ttext was specified.
1352 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1353 file type.
1354 * object.h (Sized_relobj_file::e_type): New function.
1355 (Sized_relobj_file::e_type_): New data member.
1356 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1357 base address for ET_EXEC files.
1358 * target.cc (Target::do_make_elf_object_implementation): Allow
1359 ET_EXEC files with --just-symbols option.
1360
1361 2011-07-28 Cary Coutant <ccoutant@google.com>
1362
1363 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1364 Add thread_number parameter.
1365 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1366 * workqueue-threads.cc
1367 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1368 current thread if its thread number is greater than desired thread
1369 count.
1370 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1371 Add thread_number parameter.
1372 (Workqueue::should_cancel_thread): Likewise.
1373 (Workqueue::find_runnable_or_wait): Pass thread_number to
1374 should_cancel_thread.
1375 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1376 parameter.
1377
1378 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1379
1380 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1381 only after checking if it cannot be forced local.
1382 * symtab.h (is_externally_visible): Check if the symbol is not forced
1383 local.
1384
1385 2011-07-15 Ian Lance Taylor <iant@google.com>
1386
1387 * options.h (class General_options): Add --print-output-format.
1388 Move -EL next to -EB, for better --help output.
1389 * target-select.cc: Include <cstdio>, "options.h", and
1390 "parameters.h".
1391 (Target_selector::do_target_bfd_name): New function.
1392 (print_output_format): New function.
1393 * target-select.h (class Target_selector): Update declarations.
1394 (Target_selector::target_bfd_name): New function.
1395 (print_output_format): Declare.
1396 * main.cc: Include "target-select.h".
1397 (main): Handle --print-output-format.
1398 * gold.cc: Include "target-select.h".
1399 (queue_initial_tasks): Handle --print-output-format when there are
1400 no input files.
1401 * parameters.cc (parameters_force_valid_target): Give a better
1402 error message if -EB/-EL does not match target.
1403 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1404 function.
1405
1406 2011-07-15 Ian Lance Taylor <iant@google.com>
1407
1408 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1409 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1410 (Output_data_plt_i386::do_write): Write address of .dynamic
1411 section to first entry in .got.plt section.
1412 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1413 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1414 Initialize layout_.
1415 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1416 section to first entry in .got.plt section.
1417 * layout.h (Layout::dynamic_section): New function.
1418
1419 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1420
1421 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1422 to claim_file call.
1423 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1424 input_section_position_, and input_section_glob_.
1425 (read_layout_from_file): Call function section_ordering_specified.
1426 * layout.h (is_section_ordering_specified): New function.
1427 (section_ordering_specified): New function.
1428 (section_ordering_specified_): New boolean member.
1429 * main.cc(main): Call load_plugins after layout object is defined.
1430 * output.cc (Output_section::add_input_section): Use
1431 function section_ordering_specified to check if section ordering is
1432 needed.
1433 * output.cc (Output_section::add_relaxed_input_section): Use
1434 function section_ordering_specified to check if section ordering is
1435 needed.
1436 (Output_section::update_section_layout): New function.
1437 (Output_section::sort_attached_input_sections): Check if input section
1438 must be reordered.
1439 * output.h (Output_section::update_section_layout): New function.
1440 * plugin.cc (get_section_count): New function.
1441 (get_section_type): New function.
1442 (get_section_name): New function.
1443 (get_section_contents): New function.
1444 (update_section_order): New function.
1445 (allow_section_ordering): New function.
1446 (Plugin::load): Add the new interfaces to the transfer vector.
1447 (Plugin_manager::load_plugins): New parameter.
1448 (Plugin_manager::all_symbols_read): New parameter.
1449 (Plugin_manager::claim_file): New parameter. Save the elf object for
1450 unclaimed objects.
1451 (Plugin_manager::get_elf_object): New function.
1452 (Plugin_manager::get_view): Change to directly use the bool to check
1453 if get_view is called from claim_file_hook.
1454 * plugin.h (input_objects): New function
1455 (Plugin__manager::load_plugins): New parameter.
1456 (Plugin_manager::claim_file): New parameter.
1457 (Plugin_manager::get_elf_object): New function.
1458 (Plugin_manager::in_claim_file_handler): New function.
1459 (Plugin_manager::in_claim_file_handler_): New member.
1460 (layout): New function.
1461 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1462 handler with an extra parameter. Make the elf object before calling
1463 claim_file handler.
1464 * testsuite/plugin_test.c (get_section_count): New function pointer.
1465 (get_section_type): New function pointer.
1466 (get_section_name): New function pointer.
1467 (get_section_contents): New function pointer.
1468 (update_section_order): New function pointer.
1469 (allow_section_ordering): New function pointer.
1470 (onload): Check if the new interfaces exist.
1471
1472 2011-07-13 Ian Lance Taylor <iant@google.com>
1473
1474 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1475 relro section.
1476 * x86_64.cc (Target_x86_64::got_section): Likewise.
1477 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1478 (relro_now_test_SOURCES): New variable.
1479 (relro_now_test_DEPENDENCIES): New variable.
1480 (relro_now_test_LDFLAGS): New variable.
1481 (relro_now_test_LDADD): New variable.
1482 (relro_now_test.so): New target.
1483 * testsuite/Makefile.in: Rebuild.
1484
1485 2011-07-12 Ian Lance Taylor <iant@google.com>
1486
1487 PR gold/12980
1488 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1489 GLOB_DAT relocation rather than a RELATIVE relocation for a
1490 protected symbol when creating a shared library.
1491 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1492 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1493 * testsuite/protected_main_1.cc (main): Test that protected
1494 function has same address.
1495
1496 2011-07-11 Ian Lance Taylor <iant@google.com>
1497
1498 PR gold/12979
1499 * options.h (class General_options): Add -Bgroup.
1500 * options.cc (General_options::finalize): If -Bgroup is set,
1501 default to --unresolved-symbols=report-all.
1502 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1503 * target-reloc.h (issue_undefined_symbol_error): Handle
1504 --unresolved-symbols=report-all.
1505
1506 2011-07-08 Ian Lance Taylor <iant@google.com>
1507
1508 PR gold/11985
1509 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1510 if linker script discards key sections.
1511 (Layout::create_dynamic_symtab): Likewise.
1512 (Layout::assign_local_dynsym_offsets): Likewise.
1513 (Layout::sized_create_version_sections): Likewise.
1514 (Layout::create_interp): Likewise.
1515 (Layout::finish_dynamic_section): Likewise.
1516 (Layout::set_dynamic_symbol_size): Likewise.
1517
1518 2011-07-08 Ian Lance Taylor <iant@google.com>
1519
1520 PR gold/12386
1521 * options.h (class General_options): Add --unresolved-symbols.
1522 * target-reloc.h (issue_undefined_symbol_error): Check
1523 --unresolved-symbols. Add comments.
1524
1525 2011-07-08 Ian Lance Taylor <iant@google.com>
1526
1527 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1528 expression more complex.
1529
1530 2011-07-08 Ian Lance Taylor <iant@google.com>
1531
1532 PR gold/11317
1533 * target-reloc.h (issue_undefined_symbol_error): New inline
1534 function, broken out of relocate_section.
1535 (relocate_section): Call issue_undefined_symbol_error.
1536 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1537 there is no TLS segment if we are about to issue an undefined
1538 symbol error.
1539 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1540
1541 2011-07-08 Ian Lance Taylor <iant@google.com>
1542
1543 PR gold/12279
1544 * resolve.cc (Symbol_table::should_override): Add fromtype
1545 parameter. Change all callers. Give error when linking together
1546 TLS and non-TLS symbol.
1547 (Symbol_table::should_override_with_special): Add fromtype
1548 parameter. Change all callers.
1549 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1550 there is no TLS segment if we have reported some errors.
1551 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1552
1553 2011-07-08 Ian Lance Taylor <iant@google.com>
1554
1555 PR gold/12372
1556 * target.h (Target::plt_address_for_global): New function.
1557 (Target::plt_address_for_local): New function.
1558 (Target::plt_section_for_global): Remove.
1559 (Target::plt_section_for_local): Remove.
1560 (Target::do_plt_address_for_global): New virtual function.
1561 (Target::do_plt_address_for_local): New virtual function.
1562 (Target::do_plt_section_for_global): Remove.
1563 (Target::do_plt_section_for_local): Remove.
1564 (Target::register_global_plt_entry): Add Symbol_table and Layout
1565 parameters.
1566 * output.cc (Output_data_got::Got_entry::write): Use
1567 plt_address_for_global and plt_address_for_local.
1568 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1569 address of output section.
1570 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1571 got_irelative_, and irelative_count_ fields. Update
1572 declarations.
1573 (Output_data_plt_i386::has_irelative_section): New function.
1574 (Output_data_plt_i386::entry_count): Add irelative_count_.
1575 (Output_data_plt_i386::set_final_data_size): Likewise.
1576 (class Target_i386): Add got_irelative_ and rel_irelative_
1577 fields. Update declarations.
1578 (Target_i386::Target_i386): Initialize new fields.
1579 (Target_i386::do_plt_address_for_global): New function replacing
1580 do_plt_section_for_global.
1581 (Target_i386::do_plt_address_for_local): New function replacing
1582 do_plt_section_for_local.
1583 (Target_i386::got_section): Create got_irelative_.
1584 (Target_i386::rel_irelative_section): New function.
1585 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1586 fields. Don't define __rel_iplt_{start,end}.
1587 (Output_data_plt_i386::add_entry): Add symtab and layout
1588 parameters. Change all callers. Use different PLT and GOT for
1589 IFUNC symbols.
1590 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1591 layout parameters. Change all callers. Use different PLT and
1592 GOT.
1593 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1594 (Output_data_plt_i386::rel_irelative): New function.
1595 (Output_data_plt_i386::address_for_global): New function.
1596 (Output_data_plt_i386::address_for_local): New function.
1597 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1598 IRELATIVE GOT when changing IFUNC GOT entries.
1599 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1600 reloc.
1601 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1602 if we didn't create an IRELATIVE GOT.
1603 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1604 plt_address_for_local.
1605 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1606 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1607 got_irelative_, and irelative_count_ fields. Update
1608 declarations.
1609 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1610 Initialize new fields. Remove symtab parameter. Change all
1611 callers.
1612 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1613 irelative_count_.
1614 (Output_data_plt_x86_64::has_irelative_section): New function.
1615 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1616 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1617 fields. Update declarations.
1618 (Target_x86_64::Target_x86_64): Initialize new fields.
1619 (Target_x86_64::do_plt_address_for_global): New function replacing
1620 do_plt_section_for_global.
1621 (Target_x86_64::do_plt_address_for_local): New function replacing
1622 do_plt_section_for_local.
1623 (Target_x86_64::got_section): Create got_irelative_.
1624 (Target_x86_64::rela_irelative_section): New function.
1625 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1626 all callers. Don't create __rel_iplt_{start,end}.
1627 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1628 parameters. Change all callers. Use different PLT and GOT for
1629 IFUNC symbols.
1630 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1631 layout parameters. Change all callers. Use different PLT and
1632 GOT.
1633 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1634 parameters. Change all callers. Use different PLT and GOT for
1635 IFUNC symbols.
1636 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1637 (Output_data_plt_x86_64::rela_irelative): New function.
1638 (Output_data_plt_x86_64::address_for_global): New function.
1639 (Output_data_plt_x86_64::address_for_local): New function.
1640 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1641 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1642 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1643 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1644 parameters.
1645 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1646 reloc.
1647 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1648 symbols if we didn't create an IRELATIVE GOT.
1649 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1650 plt_address_for_local.
1651 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1652 * testsuite/ifuncvar1.c: New test file.
1653 * testsuite/ifuncvar2.c: New test file.
1654 * testsuite/ifuncvar3.c: New test file.
1655 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1656 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1657 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1658 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1659 * testsuite/Makefile.in: Rebuild.
1660
1661 2011-07-07 Cary Coutant <ccoutant@google.com>
1662
1663 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1664 (two_file_test_1_ndebug.o): Likewise.
1665 (two_file_test_1b_ndebug.o): Likewise.
1666 (two_file_test_2_ndebug.o): Likewise.
1667 (two_file_test_main_ndebug.o): Likewise.
1668 (incremental_test_2): Link with no-debug versions.
1669
1670 2011-07-06 Cary Coutant <ccoutant@google.com>
1671
1672 * gold/incremental.cc
1673 (Output_section_incremental_inputs::write_info_blocks): Check for
1674 hidden and internal symbols.
1675
1676 2011-07-06 Cary Coutant <ccoutant@google.com>
1677
1678 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1679 Check disposition for startup file.
1680 (Incremental_inputs::report_command_line): Ignore
1681 --incremental-startup-unchanged option.
1682 * options.cc (General_options::parse_incremental_startup_unchanged):
1683 New function.
1684 (General_options::General_options): Initialize new data member.
1685 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1686 (General_options): Add --incremental-startup-unchanged option.
1687 (General_options::incremental_startup_disposition): New function.
1688 (General_options::incremental_startup_disposition_): New data member.
1689
1690 2011-07-06 Cary Coutant <ccoutant@google.com>
1691
1692 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1693 input file index to Script_info ctor.
1694 (Sized_incremental_binary::do_file_has_changed): Find the
1695 command-line argument for files named in scripts.
1696 * incremental.h (Script_info::Script_info): New ctor
1697 with input file index.
1698 (Script_info::input_file_index): New function.
1699 (Script_info::input_file_index_): New data member.
1700 (Incremental_binary::get_library): Add const.
1701 (Incremental_binary::get_script_info): Add const.
1702 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1703 * testsuite/Makefile.am (incremental_test_5): New test case.
1704 (incremental_test_6): New test case.
1705 * testsuite/Makefile.in: Regenerate.
1706
1707 2011-07-06 Cary Coutant <ccoutant@google.com>
1708
1709 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1710 debug output when command lines differ.
1711
1712 2011-07-06 Cary Coutant <ccoutant@google.com>
1713
1714 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1715 --incremental-patch option.
1716 * layout.cc (Free_list::allocate): Extend allocation beyond original
1717 end if enabled.
1718 (Layout::make_output_section): Mark sections that should get
1719 patch space.
1720 * options.cc (parse_percent): New function.
1721 * options.h (parse_percent): New function.
1722 (DEFINE_percent): New macro.
1723 (General_options): Add --incremental-patch option.
1724 * output.cc (Output_section::Output_section): Initialize new data
1725 members.
1726 (Output_section::add_input_section): Print section name when out
1727 of patch space.
1728 (Output_section::add_output_section_data): Likewise.
1729 (Output_section::set_final_data_size): Add patch space when
1730 doing --incremental-full.
1731 (Output_section::do_reset_address_and_file_offset): Remove patch
1732 space.
1733 (Output_segment::set_section_list_addresses): Print debug output
1734 only if --incremental-update.
1735 * output.h (Output_section::set_is_patch_space_allowed): New function.
1736 (Output_section::is_patch_space_allowed_): New data member.
1737 (Output_section::patch_space_): New data member.
1738 * parameters.cc (Parameters::incremental_full): New function.
1739 * parameters.h (Parameters::incremental_full): New function
1740 * testsuite/Makefile.am (incremental_test_2): Add test for
1741 --incremental-patch option.
1742 * testsuite/Makefile.in: Regenerate.
1743 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1744 (t18): Remove function body.
1745
1746 2011-07-05 Doug Kwan <dougkwan@google.com>
1747
1748 PR gold/12771
1749 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1750 Arm_Address type for relocation result.
1751 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1752 overflow check.
1753 (Arm_relocate_functions::abs32): Use unaligned access.
1754 (Arm_relocate_functions::rel32): Ditto.
1755 (Arm_relocate_functions::prel31): Ditto.
1756 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1757 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1758 static data relocations.
1759 * testsuite/Makefile.in: Regnerate.
1760 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1761
1762 2011-07-05 Ian Lance Taylor <iant@google.com>
1763
1764 PR gold/12392
1765 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1766 symbols if necessary.
1767 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1768
1769 2011-07-05 Ian Lance Taylor <iant@google.com>
1770
1771 PR gold/12952
1772 * resolve.cc (Symbol::override_base_with_special): Simply override
1773 version with special symbol version, ignoring previous version.
1774
1775 2011-07-05 Ian Lance Taylor <iant@google.com>
1776
1777 * object.cc (Sized_relobj_file::include_section_group): Add
1778 information to comment about signature location.
1779
1780 2011-07-02 Ian Lance Taylor <iant@google.com>
1781
1782 PR gold/12957
1783 * options.h (class General_options): Add -f and -F.
1784 * options.cc (General_options::finalize): Fatal error if -f/-F
1785 are used without -shared.
1786 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1787
1788 2011-07-02 Ian Lance Taylor <iant@google.com>
1789
1790 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1791
1792 2011-07-01 Ian Lance Taylor <iant@google.com>
1793
1794 PR gold/12525
1795 PR gold/12952
1796 * resolve.cc (Symbol::override_base_with_special): Don't override
1797 the version if the overriding symbol has a different name.
1798 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1799 all callers. If we give an error about an undefined version,
1800 define the base version if necessary.
1801 * dynobj.h (class Versions): Update declaration.
1802 * testsuite/weak_alias_test_5.cc: New file.
1803 * testsuite/weak_alias_test.script: New file.
1804 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1805 and versioned_alias have the right value, and call t2.
1806 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1807 weak_alias_test_5.so.
1808 (weak_alias_test_LDADD): Likewise.
1809 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1810 * testsuite/Makefile.in: Rebuild.
1811
1812 2011-07-01 Ian Lance Taylor <iant@google.com>
1813
1814 PR gold/12525
1815 * options.h (class General_options): Support -z notext.
1816 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1817 -Wl,-z,notext.
1818 (two_file_shared_nonpic.so): Likewise.
1819 (two_file_shared_mixed.so): Likewise.
1820 (two_file_shared_mixed_1.so): Likewise.
1821 (weak_undef_lib_nonpic.so): Likewise.
1822 (alt/weak_undef_lib_nonpic.so): Likewise.
1823 (tls_test_shared_nonpic.so): Likewise.
1824 * testsuite/Makefile.in: Rebuild.
1825
1826 2011-07-01 Ian Lance Taylor <iant@google.com>
1827
1828 PR gold/12525
1829 * configure.ac: Test whether static linking works, setting
1830 the automake conditional HAVE_STATIC.
1831 * testsuite/Makefile.am: Disable tests using -static if
1832 HAVE_STATIC is not true.
1833 * configure, testsuite/Makefile.in: Rebuild.
1834
1835 2011-07-01 Ian Lance Taylor <iant@google.com>
1836
1837 PR gold/12525
1838 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1839 Assert if we see DW_EH_PE_indirect.
1840 * target.h (Target::ehframe_datarel_base): New function.
1841 (Target::do_ehframe_datarel_base): New target function.
1842 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1843 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1844 function.
1845
1846 2011-07-01 Ian Lance Taylor <iant@google.com>
1847
1848 PR gold/12571
1849 * options.h (class General_options): Add
1850 --ld-generated-unwind-info.
1851 * ehframe.cc (Fde::write): Add address parameter. Change all
1852 callers. If associated with PLT, fill in address and size.
1853 (Cie::set_output_offset): Only add merge mapping if there is an
1854 object.
1855 (Cie::write): Add address parameter. Change all callers.
1856 (Eh_frame::add_ehframe_for_plt): New function.
1857 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1858 input_offset_ fields into union u_, with new plt field.
1859 (Fde::Fde): Adjust for new union field.
1860 (Fde::Fde) [Output_data version]: New constructor.
1861 (Fde::add_mapping): Only add merge mapping if there is an object.
1862 (class Cie): Update declarations.
1863 (class Eh_frame): Declare add_ehframe_for_plt.
1864 * layout.cc (Layout::layout_eh_frame): Break out code into
1865 make_eh_frame_section, and call it.
1866 (Layout::make_eh_frame_section): New function.
1867 (Layout::add_eh_frame_for_plt): New function.
1868 * layout.h (class Layout): Update declarations.
1869 * merge.cc (Merge_map::add_mapping): Add assertion.
1870 * i386.cc: Include "dwarf.h".
1871 (class Output_data_plt_i386): Make first_plt_entry,
1872 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1873 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1874 and plt_eh_frame_fde.
1875 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1876 boundary. Call add_eh_frame_for_plt if appropriate.
1877 * x86_64.cc: Include "dwarf.h".
1878 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1879 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1880 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1881 and plt_eh_frame_fde.
1882 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1883 appropriate.
1884
1885 2011-06-29 Ian Lance Taylor <iant@google.com>
1886
1887 PR gold/12629
1888 * object.cc (Sized_relobj_file::layout_section): Change shdr
1889 parameter to be const.
1890 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1891 out of do_layout.
1892 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1893 appropriate. Call layout_eh_frame_section.
1894 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1895 sections.
1896 * object.h (class Sized_relobj_file): Update declarations.
1897
1898 2011-06-29 Ian Lance Taylor <iant@google.com>
1899
1900 PR gold/12652
1901 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1902 modifier.
1903 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1904
1905 2011-06-29 Ian Lance Taylor <iant@google.com>
1906
1907 PR gold/12675
1908 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1909 SHT_X86_64_UNWIND.
1910 * layout.cc (Layout::layout_eh_frame): Likewise.
1911
1912 2011-06-29 Ian Lance Taylor <iant@google.com>
1913
1914 PR gold/12695
1915 * layout.cc (Layout::symtab_section_shndx): New function.
1916 * layout.h (class Layout): Declare symtab_section_shndx.
1917 * output.cc (Output_section::write_header): Call it.
1918
1919 2011-06-29 Ian Lance Taylor <iant@google.com>
1920
1921 PR gold/12818
1922 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1923 symbols which are not used in a relocation.
1924
1925 2011-06-28 Ian Lance Taylor <iant@google.com>
1926
1927 PR gold/12898
1928 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1929 script create indistinguishable segments.
1930 (Layout::set_segment_offsets): Use stable_sort when sorting
1931 segments. Pass this to Compare_segments constructor.
1932 * layout.h (class Layout): Make segment_precedes non-static.
1933 (class Compare_segments): Change from struct to class. Add
1934 layout_ field. Add constructor.
1935 * script-sections.cc
1936 (Script_sections::attach_sections_using_phdrs_clause): Rename
1937 local orphan to is_orphan. Don't report failure to put empty
1938 section in segment. On attachment failure, report name of
1939 section, and attach to first PT_LOAD segment.
1940
1941 2011-06-28 Ian Lance Taylor <iant@google.com>
1942
1943 PR gold/12934
1944 * target-select.cc (Target_selector::Target_selector): Add
1945 emulation parameter. Change all callers.
1946 (select_target_by_bfd_name): Rename from select_target_by_name.
1947 Change all callers.
1948 (select_target_by_emulation): New function.
1949 (supported_emulation_names): New function.
1950 * target-select.h (class Target_selector): Add emulation_ field.
1951 Update declarations.
1952 (Target_selector::recognize_by_bfd_name): Rename from
1953 recognize_by_name. Change all callers.
1954 (Target_selector::supported_bfd_names): Rename from
1955 supported_names. Change all callers.
1956 (Target_selector::recognize_by_emulation): New function.
1957 (Target_selector::supported_emulations): New function.
1958 (Target_selector::emulation): New function.
1959 (Target_selector::do_recognize_by_bfd_name): Rename from
1960 do_recognize_by_name. Change all callers.
1961 (Target_selector::do_supported_bfd_names): Rename from
1962 do_supported_names. Change all callers.
1963 (Target_selector::do_recognize_by_emulation): New function.
1964 (Target_selector::do_supported_emulations): New function.
1965 (select_target_by_bfd_name): Change name in declaration.
1966 (select_target_by_emulation): Declare.
1967 (supported_emulation_names): Declare.
1968 * parameters.cc (parameters_force_valid_target): Try to find
1969 target based on emulation from -m option.
1970 * options.h (class General_options): Change doc string for -m.
1971 * options.cc (help): Print emulations.
1972 (General_options::parse_V): Likewise.
1973 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1974 Add emulation parameter. Change all callers.
1975
1976 2011-06-28 Ian Lance Taylor <iant@google.com>
1977
1978 * target.h (class Target): Add osabi_ field.
1979 (Target::osabi): New function.
1980 (Target::set_osabi): New function.
1981 (Target::Target): Initialize osabi_.
1982 (Target::do_adjust_elf_header): Make pure virtual.
1983 (Sized_target::do_adjust_elf_header): Declare.
1984 * target.cc (Sized_target::do_adjust_elf_header): New function.
1985 (class Sized_target): Instantiate all versions.
1986 * freebsd.h (class Target_freebsd): Remove.
1987 (Target_selector_freebsd::do_recognize): Call set_osabi on
1988 Target.
1989 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1990 (Target_selector_freebsd::set_osabi): Remove.
1991 * i386.cc (class Target_i386): Inherit from Sized_target rather
1992 than Target_freebsd.
1993 * x86_64.cc (class Target_x86_64): Likewise.
1994
1995 2011-06-28 Ian Lance Taylor <iant@google.com>
1996
1997 * target.h (Target::can_check_for_function_pointers): Rewrite.
1998 Make non-virtual.
1999 (Target::can_icf_inline_merge_sections): Likewise.
2000 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2001 (Target::Target_info): Add can_icf_inline_merge_sections field.
2002 (Target::do_can_check_for_function_pointers): New virtual
2003 function.
2004 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2005 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2006 from can_check_for_function_pointers, move in file.
2007 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2008 section_may_have_icf_unsafe_poineters, move in file.
2009 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2010 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2011 Rename from can_check_for_function_pointers, move in file.
2012 (Target_i386::can_icf_inline_merge_sections): Remove.
2013 (Target_i386::i386_info): Initialize
2014 can_icf_inline_merge_sections.
2015 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2016 Initialize can_icf_inline_merge_sections.
2017 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2018 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2019 Rename from can_check_for_function_pointers, move in file.
2020 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2021 (Target_x86_64::x86_64_info): Initialize
2022 can_icf_inline_merge_sections.
2023 * testsuite/testfile.cc (Target_test::test_target_info):
2024 Likewise.
2025 * icf.cc (get_section_contents): Correct formatting.
2026
2027 2011-06-27 Ian Lance Taylor <iant@google.com>
2028
2029 * symtab.cc (Symbol::versioned_name): New function.
2030 (Symbol_table::add_to_final_symtab): Use versioned_name when
2031 appropriate.
2032 (Symbol_table::sized_write_symbol): Likewise.
2033 * symtab.h (class Symbol): Declare versioned_name.
2034 * stringpool.h (class Stringpool_template): Add variant of add
2035 which takes a std::basic_string.
2036 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2037 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2038 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2039 (ver_test_12.o): New target.
2040 * testsuite/Makefile.in: Rebuild.
2041
2042 2011-06-27 Doug Kwan <dougkwan@google.com>
2043
2044 * arm.cc (Arm_relocate_functions::thm_jump8,
2045 Arm_relocate_functions::thm_jump11): Use a wider signed
2046 type to compute offset.
2047 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2048 arm_thm_jump8.
2049 * testsuite/Makefile.in: Regenerate.
2050 * testsuite/arm_branch_in_range.sh: Check test results of
2051 arm_thm_jump11 and arm_thm_jump8.
2052 * testsuite/arm_thm_jump11.s: New test source file.
2053 * testsuite/arm_thm_jump11.t: New linker script.
2054 * testsuite/arm_thm_jump8.s: New test source file.
2055 * testsuite/arm_thm_jump8.t: New linker script.
2056
2057 2011-06-24 Ian Lance Taylor <iant@google.com>
2058
2059 * layout.cc: Include "object.h".
2060 (ctors_sections_in_init_array): New static variable.
2061 (Layout::is_ctors_in_init_array): New function.
2062 (Layout::layout): Add entry to ctors_sections_in_init_array if
2063 appropriate.
2064 * layout.h (class Layout): Declare is_ctors_in_init_array.
2065 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2066 is_ctors_reverse_view is set.
2067 (Sized_relobj_file::write_sections): Add layout parameter. Change
2068 all callers. Set is_ctors_reverse_view field of View_size.
2069 (Sized_relobj_file::reverse_words): New function.
2070 * object.h (Sized_relobj_file::View_size): Add
2071 is_ctors_reverse_view field.
2072 (class Sized_relobj_file): Update declarations.
2073 * testsuite/initpri3.c: New test.
2074 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2075 initpri3b.
2076 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2077 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2078 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2079 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2080 * testsuite/Makefile.in: Rebuild.
2081
2082 2011-06-24 Cary Coutant <ccoutant@google.com>
2083
2084 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2085 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2086 (debug_msg_cdebug.err): New targets.
2087 * testsuite/Makefile.in: Regenerate.
2088 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2089 Fix checks for link with shared library.
2090
2091 2011-06-24 Doug Kwan <dougkwan@google.com>
2092
2093 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2094 skip empty text sections.
2095 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2096
2097 2011-06-22 Ian Lance Taylor <iant@google.com>
2098
2099 PR gold/12910
2100 * options.h (class General_options): Add --ctors-in-init-array.
2101 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2102 friends as SHT_PROGBITS for merging sections.
2103 (Layout::layout): Remove special handling of .init_array and
2104 friends. Don't sort if doing relocatable link. Sort for .ctors
2105 and .dtors if ctors_in_init_array.
2106 (Layout::make_output_section): Force correct section types for
2107 .init_array and friends. Don't sort if doing relocatable link,
2108 Don't sort .ctors and .dtors if ctors_in_init_array.
2109 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2110 (Layout::output_section_name): Add relobj parameter. Change all
2111 callers. Handle .ctors. and .dtors. in code rather than table.
2112 Handle .ctors and .dtors if ctors_in_init_array.
2113 (Layout::match_file_name): New function, moved from output.cc.
2114 * layout.h (class Layout): Update declarations.
2115 * output.cc: Include "layout.h".
2116 (Input_section_sort_entry::get_priority): New function.
2117 (Input_section_sort_entry::match_file_name): Just call
2118 Layout::match_file_name.
2119 (Output_section::Input_section_sort_init_fini_compare::operator()):
2120 Handle .ctors and .dtors. Sort by explicit priority rather than
2121 by name.
2122 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2123 * testsuite/initpri2.c: New test.
2124 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2125 (check_PROGRAMS): Add initpri2.
2126 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2127 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2128 * configure, testsuite/Makefile.in: Rebuild.
2129
2130 2011-06-19 Ian Lance Taylor <iant@google.com>
2131
2132 PR gold/12880
2133 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2134 .interp section to a PT_INTERP segment even if we have seen a
2135 --dynamic-linker option. Don't do it if we have seen a PHDRS
2136 clause in a linker script.
2137 (Layout::finalize): Don't create a .interp section if we've
2138 already create a PT_INTERP segment.
2139 (Layout::create_interp): Always call choose_output_section (revert
2140 patch of 2011-06-17). Don't create PT_INTERP segment.
2141 * script-sections.cc
2142 (Script_sections::create_note_and_tls_segments): Add a .interp
2143 section to a PT_INTERP segment even if we have seen a
2144 --dynamic-linker option.
2145
2146 2011-06-18 Ian Lance Taylor <iant@google.com>
2147
2148 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2149 merely because a non-PT_LOAD segment has a dynamic reloc.
2150
2151 2011-06-18 Ian Lance Taylor <iant@google.com>
2152
2153 * layout.cc (Layout::finish_dynamic_section): Don't create
2154 DT_FLAGS entry if not needed.
2155
2156 2011-06-18 Ian Lance Taylor <iant@google.com>
2157
2158 PR gold/12745
2159 * layout.cc (Layout::layout_eh_frame): Correct handling of
2160 writable .eh_frame section.
2161
2162 2011-06-17 Ian Lance Taylor <iant@google.com>
2163
2164 PR gold/12893
2165 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2166 symbol is redefined with the exact same object and value.
2167
2168 2011-06-17 Ian Lance Taylor <iant@google.com>
2169
2170 PR gold/12880
2171 * layout.h (class Layout): Add interp_segment_ field.
2172 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2173 (Layout::attach_allocated_section_to_segment): If making shared
2174 library, put .interp section in PT_INTERP segment.
2175 (Layout::finalize): Also call create_interp if -dynamic-linker
2176 option was used.
2177 (Layout::create_interp): Assert that there is no PT_INTERP
2178 segment. If not using a SECTIONS clause, use make_output_section.
2179 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2180 * script-sections.cc
2181 (Script_sections::create_note_and_tls_segments): If making shared
2182 library, put .interp section in PT_INTERP segment.
2183
2184 2011-06-17 Ian Lance Taylor <iant@google.com>
2185
2186 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2187 when making a shared library.
2188
2189 2011-06-17 Ian Lance Taylor <iant@google.com>
2190
2191 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2192 parameter. Change all callers. Don't issue warning about PC32
2193 against locally defined symbol.
2194
2195 2011-06-16 Ian Lance Taylor <iant@google.com>
2196
2197 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2198 occurs in same object.
2199
2200 2011-06-14 Alan Modra <amodra@gmail.com>
2201
2202 * po/POTFILES.in: Regenerate.
2203
2204 2011-06-09 Ian Lance Taylor <iant@google.com>
2205
2206 * script-sections.cc
2207 (Orphan_output_section::set_section_addresses): For a relocatable
2208 link set address to 0.
2209
2210 2011-06-09 Cary Coutant <ccoutant@google.com>
2211
2212 PR gold/12804
2213 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2214 used with --compress-debug-sections.
2215 * gold/object.cc (Sized_relobj_file::do_layout): Report
2216 uncompressed size of compressed input sections.
2217
2218 2011-06-08 Cary Coutant <ccoutant@google.com>
2219
2220 PR gold/12804
2221 * testsuite/two_file_test_2_v1.cc: Change initialization of
2222 v2 to keep it in .data.
2223
2224 2011-06-07 Cary Coutant <ccoutant@google.com>
2225
2226 * common.cc (Symbol_table::do_allocate_commons_list): Call
2227 gold_fallback.
2228 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2229 (Errors::fallback): New function.
2230 (gold_fallback): New function.
2231 * errors.h (Errors::fallback): New function.
2232 * gold.cc (gold_exit): Change status parameter to enum; adjust
2233 all callers.
2234 (queue_initial_tasks): Call gold_fallback.
2235 * gold.h: Include cstdlib.
2236 (Exit_status): New enum type.
2237 (gold_exit): Change status parameter to enum.
2238 (gold_fallback): New function.
2239 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2240 (Layout::create_symtab_sections): Likewise.
2241 (Layout::create_shdrs): Likewise.
2242 * main.cc (main): Adjust call to gold_exit.
2243 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2244 (Output_data_got::add_got_entry_pair): Likewise.
2245 (Output_section::add_input_section): Likewise.
2246 (Output_section::add_output_section_data): Likewise.
2247 (Output_segment::set_section_list_addresses): Likewise.
2248 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2249
2250 2011-06-07 Cary Coutant <ccoutant@google.com>
2251
2252 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2253 for incremental links.
2254 * output.cc (Output_segment::set_section_list_addresses): Remove
2255 FIXME and test for TLS or BSS.
2256
2257 2011-06-07 Cary Coutant <ccoutant@google.com>
2258
2259 * testsuite/Makefile.am: Add incremental_copy_test,
2260 incremental_common_test_1.
2261 * testsuite/Makefile.in: Regenerate.
2262 * testsuite/common_test_1_v1.c: New source file.
2263 * testsuite/common_test_1_v2.c: New source file.
2264 * testsuite/copy_test_v1.cc: New source file.
2265
2266 2011-06-07 Cary Coutant <ccoutant@google.com>
2267
2268 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2269 update, allocate common from bss section's free list.
2270 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2271 linker-defined symbols.
2272 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2273 Skip GOT and PLT entries that are no longer referenced.
2274 (Output_section_incremental_inputs::write_info_blocks): Mark
2275 linker-defined symbols.
2276 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2277 * output.cc (Output_section::allocate): New function.
2278 * output.h (Output_section::allocate): New function.
2279 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2280 linker-defined symbols.
2281 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2282 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2283 (Symbol::init_base_output_data): Likewise.
2284 (Symbol::init_base_output_segment): Likewise.
2285 (Symbol::init_base_constant): Likewise.
2286 (Sized_symbol::init_output_data): Likewise.
2287 (Sized_symbol::init_output_segment): Likewise.
2288 (Sized_symbol::init_constant): Likewise.
2289 (Symbol_table::do_define_in_output_data): Likewise.
2290 (Symbol_table::do_define_in_output_segment): Likewise.
2291 (Symbol_table::do_define_as_constant): Likewise.
2292 * symtab.h (Symbol::is_predefined): New function.
2293 (Symbol::init_base_output_data): Add is_predefined parameter.
2294 (Symbol::init_base_output_segment): Likewise.
2295 (Symbol::init_base_constant): Likewise.
2296 (Symbol::is_predefined_): New data member.
2297 (Sized_symbol::init_output_data): Add is_predefined parameter.
2298 (Sized_symbol::init_output_segment): Likewise.
2299 (Sized_symbol::init_constant): Likewise.
2300 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2301
2302 2011-06-07 Cary Coutant <ccoutant@google.com>
2303
2304 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2305 instead of emit_copy_reloc.
2306 (Copy_relocs::emit_copy_reloc): Refactor.
2307 (Copy_relocs::make_copy_reloc): New function.
2308 (Copy_relocs::add_copy_reloc): Remove.
2309 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2310 section.
2311 (Copy_relocs::make_copy_reloc): New function.
2312 (Copy_relocs::add_copy_reloc): Remove.
2313 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2314 unchanged input files.
2315 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2316 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2317 Reserve BSS space for COPY relocations.
2318 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2319 (Output_section_incremental_inputs::write_info_blocks): Record
2320 whether a symbol is copied from a shared object.
2321 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2322 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2323 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2324 (Incremental_input_entry_reader::get_output_symbol_index): Add
2325 is_copy parameter.
2326 (Incremental_binary::emit_copy_relocs): New function.
2327 (Incremental_binary::do_emit_copy_relocs): New function.
2328 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2329 new data member.
2330 (Sized_incremental_binary::add_copy_reloc): New function.
2331 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2332 (Sized_incremental_binary::Copy_reloc): New struct.
2333 (Sized_incremental_binary::Copy_relocs): New typedef.
2334 (Sized_incremental_binary::copy_relocs_): New data member.
2335 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2336 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2337 * target.h (Sized_target::emit_copy_reloc): New function.
2338 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2339
2340 2011-06-02 Cary Coutant <ccoutant@google.com>
2341
2342 PR gold/12163
2343 * gold/archive.cc (Archive::Archive): Initialize new data member.
2344 (Archive::include_all_members): Return if archive has already been
2345 included.
2346 * gold/archive.h (Archive::include_all_members_): New data member.
2347
2348 2011-06-02 Nick Clifton <nickc@redhat.com>
2349
2350 * dynobj.h: Fix spelling mistake in comment.
2351 * output.cc: Likewise.
2352
2353 2011-05-31 Doug Kwan <dougkwan@google.com>
2354 Asier Llano
2355
2356 PR gold/12826
2357 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2358 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2359 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2360 redundant arm_exidx_test.so.
2361 * testsuite/Makefile.in: Regenerate.
2362 (check_SCRIPTS): Add pr12826.sh
2363 (check_DATA): Add pr12826.stdout
2364 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2365 * testsuite/pr12826.sh: New file.
2366 * testsuite/pr12826_1.s: Ditto.
2367 * testsuite/pr12826_1.s: Ditto.
2368
2369 2011-05-30 Ian Lance Taylor <iant@google.com>
2370
2371 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2372 sections.
2373
2374 2011-05-29 Ian Lance Taylor <iant@google.com>
2375
2376 PR gold/12804
2377 * testsuite/Makefile.am: Use different file name for two_file_test
2378 temporary file for each incremental test.
2379 * testsuite/Makefile.in: Rebuild.
2380
2381 2011-05-29 Ian Lance Taylor <iant@google.com>
2382
2383 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2384 binary input file is empty.
2385
2386 2011-05-27 Ian Lance Taylor <iant@google.com>
2387
2388 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2389 (ver_test_9.so): Likewise.
2390 * testsuite/Makefile.in: Rebuild.
2391
2392 2011-05-26 Cary Coutant <ccoutant@google.com>
2393
2394 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2395 * incremental.cc (Incremental_inputs::report_input_section): Fix
2396 comment, indentation.
2397 (Incremental_inputs::report_comdat_group): New function.
2398 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2399 of data for incremental input file entry.
2400 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2401 group count, COMDAT group signatures.
2402 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2403 an unchanged input file.
2404 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2405 Initialize new data member.
2406 (Incremental_object_entry::add_comdat_group): New function.
2407 (Incremental_object_entry::get_comdat_group_count): New function.
2408 (Incremental_object_entry::get_comdat_signature_key): New function.
2409 (Incremental_object_entry::groups_): New data member.
2410 (Incremental_inputs::report_comdat_group): New function.
2411 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2412 data for incremental input file entry.
2413 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2414 (Incremental_input_entry_reader::get_input_section): Adjust size of
2415 data for incremental input file entry.
2416 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2417 (Incremental_input_entry_reader::get_comdat_group_signature): New
2418 function.
2419 * object.cc (Sized_relobj::include_section_group): Report kept
2420 COMDAT groups for incremental links.
2421
2422 2011-05-24 David Meyer <pdox@google.com>
2423
2424 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2425 with name parameter. Add found_name parameter.
2426 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2427 * dirsearch.h (class Dirsearch): Update declaration.
2428
2429 2011-05-24 Ian Lance Taylor <iant@google.com>
2430
2431 * archive.cc (Library_base::should_include_member): Pull in object
2432 from archive if it defines the entry symbol.
2433 * parameters.cc (Parameters::entry): New function.
2434 * parameters.h (class Parameters): Declare entry.
2435 * output.h (class Output_file_header): Remove entry_ field.
2436 * output.cc (Output_file_header::Output_file_header): Remove entry
2437 parameter. Change all callers.
2438 (Output_file_header::entry): Use parameters->entry.
2439 * gold.cc (queue_middle_tasks): Likewise.
2440 * plugin.cc (Plugin_hook::run): Likewise.
2441
2442 2011-05-24 Cary Coutant <ccoutant@google.com>
2443
2444 * gold.cc (queue_initial_tasks): Pass incremental base filename
2445 to Output_file::open_base_file; don't print error message.
2446 * incremental-dump.cc (main): Adjust call to
2447 Output_file::open_for_modification.
2448 * incremental-dump.cc (main): Likewise.
2449 * incremental.cc (Incremental_inputs::report_command_line):
2450 Ignore --incremental-base option when comparing command lines.
2451 Ignore parameter when given as separate argument.
2452 * options.h (class General_options): Add --incremental-base.
2453 * output.cc (Output_file::Output_file):
2454 (Output_file::open_base_file): Add base_name and writable parameters;
2455 read base file into new file; print error message here.
2456 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2457 callers.
2458 * output.h (Output_file::open_for_modification): Rename to...
2459 (Output_file::open_base_file): ...this; add base_name and
2460 writable parameters; adjust all callers.
2461 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2462 callers.
2463 * testsuite/Makefile.am (incremental_test_4): Test
2464 --incremental-base.
2465 * testsuite/Makefile.in: Regenerate.
2466
2467 2011-05-24 Cary Coutant <ccoutant@google.com>
2468
2469 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2470 incremental_test_4.
2471 * testsuite/Makefile.in: Regenerate.
2472 * testsuite/two_file_test_1_v1.cc: New test source file.
2473 * testsuite/two_file_test_1b_v1.cc: New test source file.
2474 * testsuite/two_file_test_2_v1.cc: New test source file.
2475
2476 2011-05-24 Cary Coutant <ccoutant@google.com>
2477
2478 * dynobj.h (Dynobj::do_dynobj): New function.
2479 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2480 flag and soname for shared objects.
2481 * incremental.cc (Incremental_inputs::report_object): Make
2482 either Incremental_object_entry or Incremental_dynobj_entry; add
2483 soname to string table.
2484 (Incremental_inputs::report_input_section): Add assertion.
2485 (Output_section_incremental_inputs::set_final_data_size): Adjust
2486 type of input file entry for shared libraries; adjust size of
2487 shared library info entry.
2488 (Output_section_incremental_inputs::write_input_files): Write
2489 as_needed flag for shared libraries.
2490 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2491 of input file entry for shared libraries; write soname.
2492 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2493 soname from incremental info.
2494 * incremental.h (enum Incremental_input_flags): Add
2495 INCREMENTAL_INPUT_AS_NEEDED.
2496 (Incremental_input_entry::Incremental_input_entry): Initialize new
2497 data member.
2498 (Incremental_input_entry::set_as_needed): New function.
2499 (Incremental_input_entry::as_needed): New function.
2500 (Incremental_input_entry::do_dynobj_entry): New function.
2501 (Incremental_input_entry::as_needed_): New data member.
2502 (Incremental_object_entry::Incremental_object_entry): Don't check
2503 for shared library.
2504 (Incremental_object_entry::do_type): Likewise.
2505 (class Incremental_dynobj_entry): New class.
2506 (Incremental_input_entry_reader::as_needed): New function.
2507 (Incremental_input_entry_reader::get_soname): New function.
2508 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2509 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2510 size of shared library info entry.
2511 * layout.cc (Layout::finish_dynamic_section): Don't test for
2512 incremental link when adding DT_NEEDED entries.
2513 * object.h (Object::Object): Initialize new data member.
2514 (Object::dynobj): New function.
2515 (Object::set_as_needed): New function.
2516 (Object::as_needed): New function.
2517 (Object::do_dynobj): New function.
2518 (Object::as_needed_): New data member.
2519
2520 2011-05-24 Cary Coutant <ccoutant@google.com>
2521
2522 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2523 info; adjust display of GOT entries.
2524 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2525 vector of input objects; remove file_status_.
2526 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2527 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2528 got_plt reader; call target hooks to reserve GOT entries.
2529 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2530 of input file info header and GOT info entry.
2531 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2532 relocation info.
2533 (Got_plt_view_info::got_descriptor): Remove.
2534 (Got_plt_view_info::sym_index): New data member.
2535 (Got_plt_view_info::input_index): New data member.
2536 (Local_got_offset_visitor::visit): Write input file index.
2537 (Global_got_offset_visitor::visit): Write 0 for input file index.
2538 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2539 with sym_index and input_index.
2540 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2541 incremental info GOT entry; replace got_descriptor with input_index.
2542 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2543 map from input file index to object.
2544 (Sized_relobj_incr::do_layout): Replace direct data member reference
2545 with accessor function.
2546 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2547 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2548 Adjust size of input file info header.
2549 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2550 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2551 (Incremental_input_entry_reader::get_input_section): Adjust size of
2552 input file info header.
2553 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2554 of incremental info GOT entry.
2555 (Incremental_got_plt_reader::get_got_desc): Remove.
2556 (Incremental_got_plt_reader::get_got_symndx): New function.
2557 (Incremental_got_plt_reader::get_got_input_index): New function.
2558 (Sized_incremental_binary::Sized_incremental_binary): Remove
2559 file_status_; add input_objects_.
2560 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2561 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2562 (Sized_incremental_binary::file_is_unchanged): Remove.
2563 (Sized_incremental_binary::set_input_object): New function.
2564 (Sized_incremental_binary::input_object): New function.
2565 (Sized_incremental_binary::file_status_): Remove.
2566 (Sized_incremental_binary::input_objects_): New data member.
2567 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2568 references.
2569 (Sized_relobj_incr::invalid_address): Move to base class.
2570 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2571 class.
2572 (Sized_relobj_incr::do_output_section_offset): Likewise.
2573 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2574 (Sized_relobj_incr::section_offsets_): Likewise.
2575 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2576 function.
2577 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2578 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2579 with accessor function.
2580 (Sized_relobj_file::do_layout): Likewise.
2581 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2582 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2583 (Sized_relobj_file::compute_final_local_value): Replace refs to
2584 section_offsets_ with accessor function.
2585 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2586 * object.h (Relobj::Relobj): Initialize new data members.
2587 (Relobj::add_dyn_reloc): New function.
2588 (Relobj::first_dyn_reloc): New function.
2589 (Relobj::dyn_reloc_count): New function.
2590 (Relobj::first_dyn_reloc_): New data member.
2591 (Relobj::dyn_reloc_count_): New data member.
2592 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2593 references.
2594 (Sized_relobj::Address): New typedef.
2595 (Sized_relobj::invalid_address): Move here from child class.
2596 (Sized_relobj::Sized_relobj): Initialize new data members.
2597 (Sized_relobj::sized_relobj): New function.
2598 (Sized_relobj::is_output_section_offset_invalid): Move here from
2599 child class.
2600 (Sized_relobj::get_output_section_offset): Likewise.
2601 (Sized_relobj::local_has_got_offset): Likewise.
2602 (Sized_relobj::local_got_offset): Likewise.
2603 (Sized_relobj::set_local_got_offset): Likewise.
2604 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2605 (Sized_relobj::clear_got_offsets): New function.
2606 (Sized_relobj::section_offsets): Move here from child class.
2607 (Sized_relobj::do_output_section_offset): Likewise.
2608 (Sized_relobj::do_set_section_offset): Likewise.
2609 (Sized_relobj::Local_got_offsets): Likewise.
2610 (Sized_relobj::local_got_offsets_): Likewise.
2611 (Sized_relobj::section_offsets_): Likewise.
2612 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2613 references.
2614 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2615 class.
2616 (Sized_relobj_file::sized_relobj): New function
2617 (Sized_relobj_file::local_has_got_offset): Move to base class.
2618 (Sized_relobj_file::local_got_offset): Likewise.
2619 (Sized_relobj_file::set_local_got_offset): Likewise.
2620 (Sized_relobj_file::get_output_section_offset): Likewise.
2621 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2622 (Sized_relobj_file::do_output_section_offset): Likewise.
2623 (Sized_relobj_file::do_set_section_offset): Likewise.
2624 (Sized_relobj_file::Local_got_offsets): Likewise.
2625 (Sized_relobj_file::local_got_offsets_): Likewise.
2626 (Sized_relobj_file::section_offsets_): Likewise.
2627 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2628 (all constructors).
2629 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2630 (Output_reloc::get_symbol_index): Likewise.
2631 (Output_reloc::local_section_offset): Likewise.
2632 (Output_reloc::get_address): Likewise.
2633 (Output_reloc::symbol_value): Likewise.
2634 (Output_data_got::reserve_slot): Move to class definition.
2635 (Output_data_got::reserve_local): New function.
2636 (Output_data_got::reserve_slot_for_global): Remove.
2637 (Output_data_got::reserve_global): New function.
2638 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2639 (all constructors, two instantiations).
2640 (Output_reloc::get_relobj): New function (two instantiations).
2641 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2642 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2643 (Output_data_reloc::add_global): Adjust type of relobj.
2644 (Output_data_reloc::add_global_relative): Likewise.
2645 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2646 (Output_data_reloc::add_local): Likewise.
2647 (Output_data_reloc::add_local_relative): Likewise.
2648 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2649 (Output_data_reloc::add_local_section): Likewise.
2650 (Output_data_reloc::add_output_section): Likewise.
2651 (Output_data_reloc::add_absolute): Likewise.
2652 (Output_data_reloc::add_target_specific): Likewise.
2653 (Output_data_got::reserve_slot): Move definition here.
2654 (Output_data_got::reserve_local): New function.
2655 (Output_data_got::reserve_global): New function.
2656 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2657 section_offsets_ with accessor function.
2658 (Sized_relobj_file::write_sections): Likewise.
2659 (Sized_relobj_file::do_relocate_sections): Likewise.
2660 * target.h (Sized_target::reserve_local_got_entry): New function.
2661 (Sized_target::reserve_global_got_entry): New function.
2662 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2663 (Target_x86_64::reserve_global_got_entry): New function.
2664 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2665
2666 2011-05-23 Cary Coutant <ccoutant@google.com>
2667
2668 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2669 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2670 bit when checking got_type.
2671 * incremental.cc (Sized_incremental_binary::setup_readers):
2672 Store symbol table and string table locations; initialize bit vector
2673 of file status flags.
2674 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2675 unchanged files.
2676 (Sized_incremental_binary::do_process_got_plt): New function.
2677 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2678 (Output_section_incremental_inputs::set_final_data_size): Record
2679 file index for each input file.
2680 (Output_section_incremental_inputs::write_got_plt): Store file index
2681 instead of input entry offset for each GOT entry.
2682 * incremental.h
2683 (Incremental_input_entry::Incremental_input_entry): Initialize new
2684 data member.
2685 (Incremental_input_entry::set_offset): Store file index.
2686 (Incremental_input_entry::get_file_index): New function.
2687 (Incremental_input_entry::file_index_): New data member.
2688 (Incremental_binary::process_got_plt): New function.
2689 (Incremental_binary::do_process_got_plt): New function.
2690 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2691 data members.
2692 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2693 (Sized_incremental_binary::set_file_is_unchanged): New function.
2694 (Sized_incremental_binary::file_is_unchanged): New function.
2695 (Sized_incremental_binary::do_process_got_plt): New function.
2696 (Sized_incremental_binary::file_status_): New data member.
2697 (Sized_incremental_binary::main_symtab_loc_): New data member.
2698 (Sized_incremental_binary::main_strtab_loc_): New data member.
2699 * output.cc (Output_data_got::Got_entry::write): Add case
2700 RESERVED_CODE.
2701 (Output_data_got::add_global): Call add_got_entry.
2702 (Output_data_got::add_global_plt): Likewise.
2703 (Output_data_got::add_global_with_rel): Likewise.
2704 (Output_data_got::add_global_with_rela): Likewise.
2705 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2706 (Output_data_got::add_global_pair_with_rela): Likewise.
2707 (Output_data_got::add_local): Call add_got_entry.
2708 (Output_data_got::add_local_plt): Likewise.
2709 (Output_data_got::add_local_with_rel): Likewise.
2710 (Output_data_got::add_local_with_rela): Likewise.
2711 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2712 (Output_data_got::add_local_pair_with_rela): Likewise.
2713 (Output_data_got::reserve_slot): New function.
2714 (Output_data_got::reserve_slot_for_global): New function.
2715 (Output_data_got::add_got_entry): New function.
2716 (Output_data_got::add_got_entry_pair): New function.
2717 (Output_section::add_output_section_data): Edit FIXME.
2718 * output.h
2719 (Output_section_data_build::Output_section_data_build): New
2720 constructor with size parameter.
2721 (Output_data_space::Output_data_space): Likewise.
2722 (Output_data_got::Output_data_got): Initialize new data member; new
2723 constructor with size parameter.
2724 (Output_data_got::add_constant): Call add_got_entry.
2725 (Output_data_got::reserve_slot): New function.
2726 (Output_data_got::reserve_slot_for_global): New function.
2727 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2728 (Output_data_got::add_got_entry): New function.
2729 (Output_data_got::add_got_entry_pair): New function.
2730 (Output_data_got::free_list_): New data member.
2731 * target.h (Sized_target::init_got_plt_for_update): New function.
2732 (Sized_target::register_global_plt_entry): New function.
2733 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2734 Initialize new data member; call init; add constructor with PLT count.
2735 (Output_data_plt_x86_64::init): New function.
2736 (Output_data_plt_x86_64::add_relocation): New function.
2737 (Output_data_plt_x86_64::reserve_slot): New function.
2738 (Output_data_plt_x86_64::free_list_): New data member.
2739 (Target_x86_64::init_got_plt_for_update): New function.
2740 (Target_x86_64::register_global_plt_entry): New function.
2741 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2742 incremental updates.
2743 (Output_data_plt_x86_64::add_relocation): New function.
2744 * testsuite/object_unittest.cc (Object_test): Set default options.
2745
2746 2011-05-16 Ian Lance Taylor <iant@google.com>
2747
2748 * options.h (class General_options): Make -i a synonym for -r.
2749
2750 2011-05-16 Ian Lance Taylor <iant@google.com>
2751
2752 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2753
2754 2011-05-10 Cary Coutant <ccoutant@google.com>
2755
2756 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2757 strip_all (-s).
2758
2759 2011-05-06 Ian Lance Taylor <iant@google.com>
2760
2761 * layout.cc (Layout::layout): If the output section flags change,
2762 update the ordering.
2763
2764 2011-04-25 Cary Coutant <ccoutant@google.com>
2765
2766 * incremental-dump.cc (dump_incremental_inputs): Print local
2767 symbol info for each input file.
2768 * incremental.cc
2769 (Output_section_incremental_inputs::set_final_data_size): Add local
2770 symbol info to input file entries in incremental info.
2771 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2772 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2773 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2774 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2775 implementation.
2776 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2777 (Sized_incr_relobj::do_relocate): Write the local symbols.
2778 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2779 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2780 Adjust size of input file header.
2781 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2782 (Incremental_inputs_reader::get_local_symbol_count): New function.
2783 (Incremental_inputs_reader::get_input_section): Adjust size of input
2784 file header.
2785 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2786 (Sized_incr_relobj::This): New typedef.
2787 (Sized_incr_relobj::sym_size): New const data member.
2788 (Sized_incr_relobj::Local_symbol): New struct.
2789 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2790 (Sized_incr_relobj::do_local_symbol_offset): New function.
2791 (Sized_incr_relobj::local_symbol_count_): New data member.
2792 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2793 (Sized_incr_relobj::local_symbol_index_): New data member.
2794 (Sized_incr_relobj::local_symbol_offset_): New data member.
2795 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2796 (Sized_incr_relobj::local_symbols_): New data member.
2797 * object.h (Relobj::output_local_symbol_count): New function.
2798 (Relobj::local_symbol_offset): New function.
2799 (Relobj::do_output_local_symbol_count): New function.
2800 (Relobj::do_local_symbol_offset): New function.
2801 (Sized_relobj::do_output_local_symbol_count): New function.
2802 (Sized_relobj::do_local_symbol_offset): New function.
2803
2804 2011-04-22 Vladimir Simonov <sv@sw.ru>
2805
2806 * descriptors.cc (set_close_on_exec): New function.
2807 (Descriptors::open): Use set_close_on_exec.
2808 * output.cc (S_ISLNK): Define if not defined.
2809
2810 2011-04-22 Cary Coutant <ccoutant@google.com>
2811
2812 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2813 global symbol map.
2814 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2815 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2816 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2817 relocations.
2818 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2819 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2820 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2821 * incremental.h
2822 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2823 function.
2824 (Incremental_binary::apply_incremental_relocs): New function.
2825 (Incremental_binary::do_apply_incremental_relocs): New function.
2826 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2827 data member.
2828 (Sized_incremental_binary::add_global_symbol): New function.
2829 (Sized_incremental_binary::global_symbol): New function.
2830 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2831 (Sized_incremental_binary::symbol_map_): New data member.
2832 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2833 * target.h (Sized_target::apply_relocation): New function.
2834 * target-reloc.h (apply_relocation): New function.
2835 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2836
2837 2011-04-22 Doug Kwan <dougkwan@google.com>
2838
2839 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2840 flag of a SHT_ARM_EXIDX section.
2841 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2842 * testsuite/Makefile.in: Regenerate.
2843 * testsuite/arm_exidx_test.s: New file.
2844 * testsuite/arm_exidx_test.sh: Same.
2845
2846 2011-04-20 Cary Coutant <ccoutant@google.com>
2847
2848 PR gold/12689
2849 * archive.h (Incremental_archive_entry::Archive_member):
2850 Initialize arg_serial_ (second constructor).
2851
2852 2011-04-17 Ian Lance Taylor <iant@google.com>
2853
2854 * object.cc (Relocate_info::location): Simplify location string.
2855 * errors.cc (Errors::error_at_location): Don't print program
2856 name.
2857 (Errors::warning_at_location): Likewise.
2858 (Errors::undefined_symbol): Likewise.
2859 * testsuite/debug_msg.sh: Update accordingly.
2860
2861 2011-04-14 Cary Coutant <ccoutant@google.com>
2862
2863 * gold/layout.cc (Layout::symtab_section_offset): New function.
2864 * gold/layout.h (Layout::symtab_section_offset): New function.
2865 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2866
2867 2011-04-12 Ian Lance Taylor <iant@google.com>
2868
2869 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2870 with MREMAP_MAYMOVE.
2871 * output.h (class Output_file): Add map_is_allocated_ field.
2872 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2873 not available, provide stubs. If mremap is not available, #define
2874 it to gold_mremap.
2875 (MREMAP_MAYMOVE): Define if not defined.
2876 (Output_file::Output_file): Initialize map_is_allocated_.
2877 (Output_file::resize): Check map_is_allocated_.
2878 (Output_file::map_anonymous): If mmap fails, use malloc.
2879 (Output_file::unmap): Don't do anything for an anonymous map.
2880 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2881 is not available, provide stubs.
2882 (File_read::View::~View): Use free rather than delete[].
2883 (File_read::make_view): Use malloc rather than new[]. If mmap
2884 fails, use malloc.
2885 (File_read::find_or_make_view): Use malloc rather than new[].
2886 * gold.h: Remove HAVE_REMAP code.
2887 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2888 exists. Rename mremap to gold_mremap. If mmap is not available
2889 don't do anything.
2890 * configure, config.in: Rebuild.
2891
2892 2011-04-11 Ian Lance Taylor <iant@google.com>
2893
2894 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2895 initialize local variable v.
2896
2897 2011-04-11 Cary Coutant <ccoutant@google.com>
2898
2899 * archive.cc (Archive::include_member): Adjust call to
2900 report_object.
2901 (Add_archive_symbols::run): Track argument serial numbers.
2902 (Lib_group::include_member): Likewise.
2903 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2904 * archive.h (Incremental_archive_entry::Archive_member):
2905 Initialize arg_serial_.
2906 (Archive_member::arg_serial_): New data member.
2907 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2908 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2909 incremental link.
2910 (Sized_dynobj::do_for_all_local_got_entries): New function.
2911 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2912 function.
2913 * fileread.cc (get_mtime): New function.
2914 * fileread.h (get_mtime): New function.
2915 * gold.cc (queue_initial_tasks): Check for incremental update.
2916 (process_incremental_input): New function.
2917 (queue_middle_tasks): Don't force valid target for incremental
2918 update.
2919 * incremental-dump.cc (find_input_containing_global): Adjust
2920 size of symbol info entry.
2921 (dump_incremental_inputs): Dump argument serial number and
2922 in_system_directory flag; bias shndx by 1; print symbol names
2923 when dumping per-file symbol lists; use new symbol info readers.
2924 * incremental.cc
2925 (Output_section_incremental_inputs:update_data_size): New function.
2926 (Sized_incremental_binary::setup_readers): Setup input readers
2927 for each input file; build maps for files added from libraries
2928 and scripts.
2929 (Sized_incremental_binary::check_input_args): New function.
2930 (Sized_incremental_binary::do_check_inputs): Build map of argument
2931 serial numbers to input arguments.
2932 (Sized_incremental_binary::do_file_has_changed): Rename
2933 do_file_is_unchanged to this; compare file modification times.
2934 (Sized_incremental_binary::do_init_layout): New function.
2935 (Sized_incremental_binary::do_reserve_layout): New function.
2936 (Sized_incremental_binary::do_get_input_reader): Remove.
2937 (Sized_incremental_binary::get_symtab_view): New function.
2938 (Incremental_checker::can_incrementally_link_output_file): Remove.
2939 (Incremental_inputs::report_command_line): Exclude --debug options.
2940 (Incremental_inputs::report_archive_begin): Add parameter; track
2941 argument serial numbers; don't put input file entry for archive
2942 before archive members.
2943 (Incremental_inputs::report_archive_end): Put input file entry
2944 for archive after archive members.
2945 (Incremental_inputs::report_object): Add parameter; track argument
2946 serial numbers and in_system_directory flag.
2947 (Incremental_inputs::report_script): Add parameter; track argument
2948 serial numbers.
2949 (Output_section_incremental_inputs::set_final_data_size): Adjust
2950 size of symbol info entry; check for forwarding symbols.
2951 (Output_section_incremental_inputs::write_input_files): Write
2952 in_system_directory flag and argument serial number.
2953 (Output_section_incremental_inputs::write_info_blocks): Map section
2954 indices between incremental info and original input file; store
2955 input section index for each symbol.
2956 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2957 change operator() to visit().
2958 (class Global_got_offset_visitor): Likewise.
2959 (class Global_symbol_visitor_got_plt):
2960 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2961 classes.
2962 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2963 (Sized_incr_relobj::do_read_symbols): New function.
2964 (Sized_incr_relobj::do_layout): New function.
2965 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2966 (Sized_incr_relobj::do_add_symbols): New function.
2967 (Sized_incr_relobj::do_should_include_member): New function.
2968 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2969 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2970 (Sized_incr_relobj::do_section_size): New function.
2971 (Sized_incr_relobj::do_section_name): New function.
2972 (Sized_incr_relobj::do_section_contents): New function.
2973 (Sized_incr_relobj::do_section_flags): New function.
2974 (Sized_incr_relobj::do_section_entsize): New function.
2975 (Sized_incr_relobj::do_section_address): New function.
2976 (Sized_incr_relobj::do_section_type): New function.
2977 (Sized_incr_relobj::do_section_link): New function.
2978 (Sized_incr_relobj::do_section_info): New function.
2979 (Sized_incr_relobj::do_section_addralign): New function.
2980 (Sized_incr_relobj::do_initialize_xindex): New function.
2981 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2982 (Sized_incr_relobj::do_read_relocs): New function.
2983 (Sized_incr_relobj::do_gc_process_relocs): New function.
2984 (Sized_incr_relobj::do_scan_relocs): New function.
2985 (Sized_incr_relobj::do_count_local_symbols): New function.
2986 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2987 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2988 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2989 (Sized_incr_relobj::do_relocate): New function.
2990 (Sized_incr_relobj::do_set_section_offset): New function.
2991 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2992 (Sized_incr_dynobj::do_read_symbols): New function.
2993 (Sized_incr_dynobj::do_layout): New function.
2994 (Sized_incr_dynobj::do_add_symbols): New function.
2995 (Sized_incr_dynobj::do_should_include_member): New function.
2996 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2997 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2998 (Sized_incr_dynobj::do_section_size): New function.
2999 (Sized_incr_dynobj::do_section_name): New function.
3000 (Sized_incr_dynobj::do_section_contents): New function.
3001 (Sized_incr_dynobj::do_section_flags): New function.
3002 (Sized_incr_dynobj::do_section_entsize): New function.
3003 (Sized_incr_dynobj::do_section_address): New function.
3004 (Sized_incr_dynobj::do_section_type): New function.
3005 (Sized_incr_dynobj::do_section_link): New function.
3006 (Sized_incr_dynobj::do_section_info): New function.
3007 (Sized_incr_dynobj::do_section_addralign): New function.
3008 (Sized_incr_dynobj::do_initialize_xindex): New function.
3009 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3010 (make_sized_incremental_object): New function.
3011 (Incremental_library::copy_unused_symbols): New function.
3012 (Incremental_library::do_for_all_unused_symbols): New function.
3013 * incremental.h (enum Incremental_input_flags): New type.
3014 (class Incremental_checker): Remove.
3015 (Incremental_input_entry::Incremental_input_entry): Add argument
3016 serial number.
3017 (Incremental_input_entry::arg_serial): New function.
3018 (Incremental_input_entry::set_is_in_system_directory): New function.
3019 (Incremental_input_entry::is_in_system_directory): New function.
3020 (Incremental_input_entry::arg_serial_): New data member.
3021 (Incremental_input_entry::is_in_system_directory_): New data member.
3022 (class Script_info): Move here from script.h.
3023 (Script_info::Script_info): Add filename parameter.
3024 (Script_info::filename): New function.
3025 (Script_info::filename_): New data member.
3026 (Incremental_script_entry::Incremental_script_entry): Add argument
3027 serial number.
3028 (Incremental_object_entry::Incremental_object_entry): Likewise.
3029 (Incremental_object_entry::add_input_section): Build list of input
3030 sections with map to original shndx.
3031 (Incremental_object_entry::get_input_section_index): New function.
3032 (Incremental_object_entry::shndx_): New data member.
3033 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3034 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3035 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3036 serial number.
3037 (Incremental_inputs::report_archive_begin): Likewise.
3038 (Incremental_inputs::report_object): Likewise.
3039 (Incremental_inputs::report_script): Likewise.
3040 (class Incremental_global_symbol_reader): New class.
3041 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3042 and store flags and input file type.
3043 (Incremental_input_entry_reader::arg_serial): New function.
3044 (Incremental_input_entry_reader::type): Extract type from flags.
3045 (Incremental_input_entry_reader::is_in_system_directory): New function.
3046 (Incremental_input_entry_reader::get_input_section_count): Call
3047 accessor function for type.
3048 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3049 function for type; adjust size of global symbol entry.
3050 (Incremental_input_entry_reader::get_global_symbol_count): Call
3051 accessor function for type.
3052 (Incremental_input_entry_reader::get_object_count): Likewise.
3053 (Incremental_input_entry_reader::get_object_offset): Likewise.
3054 (Incremental_input_entry_reader::get_member_count): Likewise.
3055 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3056 (Incremental_input_entry_reader::get_member_offset): Likewise.
3057 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3058 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3059 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3060 (Incremental_input_entry_reader::get_global_symbol_reader): New
3061 function.
3062 (Incremental_input_entry_reader::get_output_symbol_index): New
3063 function.
3064 (Incremental_input_entry_reader::type_): Remove.
3065 (Incremental_input_entry_reader::flags_): New data member.
3066 (Incremental_inputs_reader::input_file_offset): New function.
3067 (Incremental_inputs_reader::input_file_index): New function.
3068 (Incremental_inputs_reader::input_file): Call input_file_offset.
3069 (Incremental_inputs_reader::input_file_at_offset): New function.
3070 (Incremental_relocs_reader::get_r_type): Reformat.
3071 (Incremental_relocs_reader::get_r_shndx): Reformat.
3072 (Incremental_relocs_reader::get_r_offset): Reformat.
3073 (Incremental_relocs_reader::data): New function.
3074 (Incremental_binary::Incremental_binary): Initialize new data members.
3075 (Incremental_binary::check_inputs): Add cmdline parameter.
3076 (Incremental_binary::file_is_unchanged): Remove.
3077 (Input_reader::arg_serial): New function.
3078 (Input_reader::get_unused_symbol_count): New function.
3079 (Input_reader::get_unused_symbol): New function.
3080 (Input_reader::do_arg_serial): New function.
3081 (Input_reader::do_get_unused_symbol_count): New function.
3082 (Input_reader::do_get_unused_symbol): New function.
3083 (Incremental_binary::input_file_count): New function.
3084 (Incremental_binary::get_input_reader): Change signature to use
3085 index instead of filename.
3086 (Incremental_binary::file_has_changed): New function.
3087 (Incremental_binary::get_input_argument): New function.
3088 (Incremental_binary::get_library): New function.
3089 (Incremental_binary::get_script_info): New function.
3090 (Incremental_binary::init_layout): New function.
3091 (Incremental_binary::reserve_layout): New function.
3092 (Incremental_binary::output_file): New function.
3093 (Incremental_binary::do_check_inputs): New function.
3094 (Incremental_binary::do_file_is_unchanged): Remove.
3095 (Incremental_binary::do_file_has_changed): New function.
3096 (Incremental_binary::do_init_layout): New function.
3097 (Incremental_binary::do_reserve_layout): New function.
3098 (Incremental_binary::do_input_file_count): New function.
3099 (Incremental_binary::do_get_input_reader): Change signature.
3100 (Incremental_binary::input_args_map_): New data member.
3101 (Incremental_binary::library_map_): New data member.
3102 (Incremental_binary::script_map_): New data member.
3103 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3104 new data members.
3105 (Sized_incremental_binary::output_section): New function.
3106 (Sized_incremental_binary::inputs_reader): Add const.
3107 (Sized_incremental_binary::symtab_reader): Add const.
3108 (Sized_incremental_binary::relocs_reader): Add const.
3109 (Sized_incremental_binary::got_plt_reader): Add const.
3110 (Sized_incremental_binary::get_symtab_view): New function.
3111 (Sized_incremental_binary::Inputs_reader): New typedef.
3112 (Sized_incremental_binary::Input_entry_reader): New typedef.
3113 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3114 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3115 (Sized_incremental_binary::do_file_has_changed): New function.
3116 (Sized_incremental_binary::do_init_layout): New function.
3117 (Sized_incremental_binary::do_reserve_layout): New function.
3118 (Sized_input_reader::Inputs_reader): Remove.
3119 (Sized_input_reader::Input_entry_reader): Remove.
3120 (Sized_input_reader::do_arg_serial): New function.
3121 (Sized_input_reader::do_get_unused_symbol_count): New function.
3122 (Sized_input_reader::do_get_unused_symbol): New function.
3123 (Sized_incremental_binary::do_input_file_count): New function.
3124 (Sized_incremental_binary::do_get_input_reader): Change signature;
3125 use index instead of filename.
3126 (Sized_incremental_binary::section_map_): New data member.
3127 (Sized_incremental_binary::input_entry_readers_): New data member.
3128 (class Sized_incr_relobj): New class.
3129 (class Sized_incr_dynobj): New class.
3130 (make_sized_incremental_object): New function.
3131 (class Incremental_library): New class.
3132 * layout.cc (Free_list::num_lists): New static data member.
3133 (Free_list::num_nodes): New static data member.
3134 (Free_list::num_removes): New static data member.
3135 (Free_list::num_remove_visits): New static data member.
3136 (Free_list::num_allocates): New static data member.
3137 (Free_list::num_allocate_visits): New static data member.
3138 (Free_list::init): New function.
3139 (Free_list::remove): New function.
3140 (Free_list::allocate): New function.
3141 (Free_list::dump): New function.
3142 (Free_list::print_stats): New function.
3143 (Layout_task_runner::run): Resize output file for incremental updates.
3144 (Layout::Layout): Initialize new data members.
3145 (Layout::set_incremental_base): New function.
3146 (Layout::init_fixed_output_section): New function.
3147 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3148 incremental updates.
3149 (Layout::create_gold_note): Do not create gold note section for
3150 incremental updates.
3151 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3152 for incremental updates.
3153 (Layout::set_section_offsets): For incremental updates, allocate space
3154 from free list.
3155 (Layout::create_symtab_sections): Layout with offsets relative to
3156 start of section; for incremental updates, allocate space from free
3157 list.
3158 (Layout::create_shdrs): For incremental updates, allocate space from
3159 free list.
3160 (Layout::finish_dynamic_section): For incremental updates, do not
3161 check --as-needed (fixed in subsequent patch).
3162 * layout.h (class Free_list): New class.
3163 (Layout::set_incremental_base): New function.
3164 (Layout::incremental_base): New function.
3165 (Layout::init_fixed_output_section): New function.
3166 (Layout::allocate): New function.
3167 (Layout::incremental_base_): New data member.
3168 (Layout::free_list_): New data member.
3169 * main.cc (main): Print Free_list statistics.
3170 * object.cc (Relobj::finalize_incremental_relocs): Add
3171 clear_counts parameter; clear counts only when clear_counts is set.
3172 (Sized_relobj::Sized_relobj): Initialize new base class.
3173 (Sized_relobj::do_layout): Don't report special sections.
3174 (Sized_relobj::do_for_all_local_got_entries): New function.
3175 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3176 symtab_off to all symbol table offsets.
3177 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3178 * object.h (class Got_offset_list): Move to top of file.
3179 (Object::Object): Allow case where input_file == NULL.
3180 (Object::~Object): Likewise.
3181 (Object::input_file): Assert that input_file != NULL.
3182 (Object::lock): Allow case where input_file == NULL.
3183 (Object::unlock): Likewise.
3184 (Object::is_locked): Likewise.
3185 (Object::token): Likewise.
3186 (Object::release): Likewise.
3187 (Object::is_incremental): New function.
3188 (Object::get_mtime): New function.
3189 (Object::for_all_local_got_entries): New function.
3190 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3191 (Object::set_is_in_system_directory): New function.
3192 (Object::is_in_system_directory): New function.
3193 (Object::do_is_incremental): New function.
3194 (Object::do_get_mtime): New function.
3195 (Object::do_for_all_local_got_entries): New function.
3196 (Object::is_in_system_directory_): New data member.
3197 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3198 (class Sized_relobj_base): New class.
3199 (class Sized_relobj): Derive from Sized_relobj_base.
3200 (class Sized_relobj::Symbols): Redeclare from base class.
3201 (class Sized_relobj::local_got_offset_list): Remove.
3202 (class Sized_relobj::Output_sections): Redeclare from base class.
3203 (class Sized_relobj::do_for_all_local_got_entries): New function.
3204 (class Sized_relobj::write_local_symbols): Add offset parameter.
3205 (class Sized_relobj::local_symbol_offset_): Update comment.
3206 (class Sized_relobj::local_dynsym_offset_): Update comment.
3207 * options.cc (Input_arguments::add_file): Remove const.
3208 * options.h (Input_file_argument::Input_file_argument):
3209 Initialize arg_serial_ (all constructors).
3210 (Input_file_argument::set_arg_serial): New function.
3211 (Input_file_argument::arg_serial): New function.
3212 (Input_file_argument::arg_serial_): New data member.
3213 (Input_arguments::Input_arguments): Initialize file_count_.
3214 (Input_arguments::add_file): Remove const.
3215 (Input_arguments::number_of_input_files): New function.
3216 (Input_arguments::file_count_): New data member.
3217 (Command_line::number_of_input_files): Call
3218 Input_arguments::number_of_input_files.
3219 * output.cc (Output_segment_headers::Output_segment_headers):
3220 Set current size.
3221 (Output_section::Input_section::current_data_size): New function.
3222 (Output_section::Output_section): Initialize new data members.
3223 (Output_section::add_input_section): Don't do merge sections for
3224 an incremental link; allocate space from free list for an
3225 incremental update.
3226 (Output_section::add_output_section_data): Allocate space from
3227 free list for an incremental update.
3228 (Output_section::update_data_size): New function.
3229 (Output_section::set_fixed_layout): New function.
3230 (Output_section::reserve): New function.
3231 (Output_segment::set_section_addresses): Remove const.
3232 (Output_segment::set_section_list_addresses): Remove const; allocate
3233 space from free list for an incremental update.
3234 (Output_segment::set_offset): Adjust size of RELRO segment for an
3235 incremental update.
3236 * output.h (Output_data::current_data_size): Move here from
3237 child classes.
3238 (Output_data::pre_finalize_data_size): New function.
3239 (Output_data::update_data_size): New function.
3240 (Output_section_headers::update_data_size): new function.
3241 (Output_section_data_build::current_data_size): Move to Output_data.
3242 (Output_data_strtab::update_data_size): New function.
3243 (Output_section::current_data_size): Move to Output_data.
3244 (Output_section::set_fixed_layout): New function.
3245 (Output_section::has_fixed_layout): New function.
3246 (Output_section::reserve): New function.
3247 (Output_section::update_data_size): New function.
3248 (Output_section::has_fixed_layout_): New data member.
3249 (Output_section::free_list_): New data member.
3250 (Output_segment::set_section_addresses): Remove const.
3251 (Output_segment::set_section_list_addresses): Remove const.
3252 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3253 New function.
3254 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3255 New function.
3256 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3257 parameter when calling Add_symbols constructor; store argument
3258 serial number for members of a lib group.
3259 (Add_symbols::locks): Allow case where token == NULL.
3260 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3261 (Read_member::~Read_member): New function.
3262 (Read_member::is_runnable): New function.
3263 (Read_member::locks): New function.
3264 (Read_member::run): New function.
3265 (Check_script::~Check_script): New function.
3266 (Check_script::is_runnable): New function.
3267 (Check_script::locks): New function.
3268 (Check_script::run): New function.
3269 (Check_library::~Check_library): New function.
3270 (Check_library::is_runnable): New function.
3271 (Check_library::locks): New function.
3272 (Check_library::run): New function.
3273 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3274 (Add_symbols::library_): New data member.
3275 (class Read_member): New class.
3276 (class Check_script): New class.
3277 (class Check_library): New class.
3278 * reloc.cc (Read_relocs::is_runnable): Allow case where
3279 token == NULL.
3280 (Read_relocs::locks): Likewise.
3281 (Scan_relocs::locks): Likewise.
3282 (Relocate_task::locks): Likewise.
3283 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3284 to clear counters.
3285 (Sized_relobj::incremental_relocs_scan): Fix comment.
3286 (Sized_relobj::do_relocate): Pass output file offset to
3287 write_local_symbols.
3288 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3289 from class declaration.
3290 * script.cc (read_input_script): Allocate Script_info; pass
3291 argument serial number to report_script.
3292 * script.h (class Script_info): Move to incremental.h.
3293 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3294 * symtab.h (Symbol_table::add_from_incrobj): New function.
3295 (Symbol_table::set_file_offset): New function.
3296
3297 2011-04-05 Cary Coutant <ccoutant@google.com>
3298
3299 * incremental-dump.cc (dump_incremental_inputs): Change signature
3300 to take a Sized_incremental_binary; change caller. Use readers
3301 in Sized_incremental_binary.
3302 * incremental.cc
3303 (Sized_incremental_binary::find_incremental_inputs_sections):
3304 Rename do_find_incremental_inputs_sections to this.
3305 (Sized_incremental_binary::setup_readers): New function.
3306 (Sized_incremental_binary::do_check_inputs): Check
3307 has_incremental_info_ flag; move setup code to setup_readers;
3308 use input readers.
3309 (Sized_incremental_binary::do_file_is_unchanged): New function.
3310 (Sized_incremental_binary::do_get_input_reader): New function.
3311 * incremental.h (class Incremental_binary): Move to end of file.
3312 (Incremental_binary::file_is_unchanged): New function.
3313 (Incremental_binary::do_file_is_unchanged): New function.
3314 (Incremental_binary::Input_reader): New class.
3315 (Incremental_binary::get_input_reader): New function.
3316 (class Sized_incremental_binary): Move to end of file.
3317 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3318 input section reader classes.
3319 (Sized_incremental_binary::has_incremental_info): New function.
3320 (Sized_incremental_binary::inputs_reader): New function.
3321 (Sized_incremental_binary::symtab_reader): New function.
3322 (Sized_incremental_binary::relocs_reader): New function.
3323 (Sized_incremental_binary::got_plt_reader): New function.
3324 (Sized_incremental_binary::do_file_is_unchanged): New function.
3325 (Sized_incremental_binary::Sized_input_reader): New class.
3326 (Sized_incremental_binary::get_input_reader): New function.
3327 (Sized_incremental_binary::find_incremental_inputs_sections):
3328 Rename do_find_incremental_inputs_sections to this.
3329 (Sized_incremental_binary::setup_readers): New function.
3330 (Sized_incremental_binary::has_incremental_info_): New data member.
3331 (Sized_incremental_binary::inputs_reader_): New data member.
3332 (Sized_incremental_binary::symtab_reader_): New data member.
3333 (Sized_incremental_binary::relocs_reader_): New data member.
3334 (Sized_incremental_binary::got_plt_reader_): New data member.
3335 (Sized_incremental_binary::current_input_file_): New data member.
3336
3337 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3338
3339 PR gold/12640
3340 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3341 violation.
3342
3343 2011-03-30 Cary Coutant <ccoutant@google.com>
3344
3345 * archive.cc (Archive::include_member): Adjust call to report_object.
3346 (Add_archive_symbols::run): Add script_info to call to
3347 report_archive_begin.
3348 (Lib_group::include_member): Adjust call to report_object.
3349 (Add_lib_group_symbols::run): Adjust call to report_object.
3350 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3351 blocks. Add object count for script input files.
3352 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3353 script_info parameter; change all callers.
3354 (Incremental_inputs::report_object): Add script_info parameter;
3355 change all callers.
3356 (Incremental_inputs::report_script): Store backpointer to
3357 incremental info entry.
3358 (Output_section_incremental_inputs::set_final_data_size): Record
3359 additional information for scripts.
3360 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3361 * incremental.h (Incremental_script_entry::add_object): New function.
3362 (Incremental_script_entry::get_object_count): New function.
3363 (Incremental_script_entry::get_object): New function.
3364 (Incremental_script_entry::objects_): New data member; adjust
3365 constructor.
3366 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3367 (Incremental_inputs::report_object): Add script_info parameter.
3368 (Incremental_inputs_reader::get_object_count): New function.
3369 (Incremental_inputs_reader::get_object_offset): New function.
3370 * options.cc (Input_arguments::add_file): Return reference to
3371 new input argument.
3372 * options.h (Input_argument::set_script_info): New function.
3373 (Input_argument::script_info): New function.
3374 (Input_argument::script_info_): New data member; adjust all
3375 constructors.
3376 (Input_file_group::add_file): Return reference to new input argument.
3377 (Input_file_lib::add_file): Likewise.
3378 (Input_arguments::add_file): Likewise.
3379 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3380 * script.cc (Parser_closure::Parser_closure): Add script_info
3381 parameter; adjust all callers.
3382 (Parser_closure::script_info): New function.
3383 (Parser_closure::script_info_): New data member.
3384 (read_input_script): Report scripts earlier to incremental info.
3385 (script_add_file): Set script_info in Input_argument.
3386 (script_add_library): Likewise.
3387 * script.h (Script_options::Script_info): Rewrite class.
3388
3389 2011-03-29 Cary Coutant <ccoutant@google.com>
3390
3391 * archive.cc (Library_base::should_include_member): Move
3392 method here from class Archive.
3393 (Archive::Archive): Initialize base class.
3394 (Archive::should_include_member): Move to base class.
3395 (Archive::do_for_all_unused_symbols): New function.
3396 (Add_archive_symbols::run): Remove redundant access to
3397 incremental_inputs.
3398 (Lib_group::Lib_group): Initialize base class.
3399 (Lib_group::do_filename): New function.
3400 (Lib_group::include_member): Pass pointer to Lib_group to
3401 report_object.
3402 (Lib_group::do_for_all_unused_symbols): New function.
3403 (Add_lib_group_symbols::run): Report archive information for
3404 incremental links.
3405 * archive.h (class Library_base): New base class.
3406 (class Archive): Derive from Library_base.
3407 (Archive::filename): Move to base class.
3408 (Archive::set_incremental_info): Likewise.
3409 (Archive::incremental_info): Likewise.
3410 (Archive::Should_include): Likewise.
3411 (Archive::should_include_member): Likewise.
3412 (Archive::Armap_entry): Remove.
3413 (Archive::Unused_symbol_iterator): Remove.
3414 (Archive::unused_symbols_begin): Remove.
3415 (Archive::unused_symbols_end): Remove.
3416 (Archive::do_filename): New function.
3417 (Archive::do_get_mtime): New function.
3418 (Archive::do_for_all_unused_symbols): New function.
3419 (Archive::task_): Move to base class.
3420 (Archive::incremental_info_): Likewise.
3421 (class Lib_group): Derive from Library_base.
3422 (Lib_group::do_filename): New function.
3423 (Lib_group::do_get_mtime): New function.
3424 (Lib_group::do_for_all_unused_symbols): New function.
3425 (Lib_group::task_): Move to base class.
3426 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3427 function.
3428 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3429 function.
3430 * incremental.cc (Incremental_inputs::report_archive_begin):
3431 Use Library_base; call library's get_mtime; add incremental inputs
3432 entry before members.
3433 (class Unused_symbol_visitor): New class.
3434 (Incremental_inputs::report_archive_end): Use Library_base; use
3435 visitor class to record unused symbols; don't add incremental inputs
3436 entry after members.
3437 (Incremental_inputs::report_object): Use Library_base.
3438 * incremental.h
3439 (Incremental_archive_entry::Incremental_archive_entry): Remove
3440 unused Archive parameter.
3441 (Incremental_inputs::report_archive_begin): Use Library_base.
3442 (Incremental_inputs::report_archive_end): Likewise.
3443 (Incremental_inputs::report_object): Likewise.
3444 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3445 function.
3446 * object.h (Object::for_all_global_symbols): New function.
3447 (Object::do_for_all_global_symbols): New function.
3448 (Sized_relobj::do_for_all_global_symbols): New function.
3449 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3450 function.
3451 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3452 function.
3453
3454 2011-03-27 Ian Lance Taylor <iant@google.com>
3455
3456 * archive.cc (Archive::interpret_header): Return -1 if something
3457 goes wrong. Change callers accordingly.
3458
3459 2011-03-25 Cary Coutant <ccoutant@google.com>
3460
3461 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3462 * testsuite/Makefile.in: Regenerate.
3463
3464 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3465
3466 * plugin.cc (get_view): New.
3467 (Plugin::load): Pass get_view to the plugin.
3468 (Plugin_manager::get_view): New.
3469
3470 2011-03-21 Ian Lance Taylor <iant@google.com>
3471
3472 * testsuite/final_layout.sh: Rewrite to not use dc.
3473 * testsuite/relro_test.sh: Fail if dc is not present.
3474
3475 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3476
3477 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3478 Change == to -eq.
3479 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3480 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3481 Change == to -eq.
3482 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3483 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3484
3485 2011-03-14 Ian Lance Taylor <iant@google.com>
3486
3487 * script-sections.cc (Sort_output_sections::script_compare):
3488 Rename from is_before, change return type.
3489 (Sort_output_sections::operator()): Adjust accordingly.
3490
3491 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3492
3493 PR gold/12572
3494 * testsuite/odr_violation2.cc: Add comment to make all error line
3495 numbers double digits.
3496 * testsuite/debug_msg.sh: Adjust expected errors.
3497
3498 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3499
3500 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3501 but mark earlier ones as non-canonical
3502 (offset_to_iterator): Update search target and example
3503 (do_addr2line): Return extra lines in a vector*
3504 (format_file_lineno): Extract from do_addr2line
3505 (one_addr2line): Add vector* out-param
3506 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3507 when a lineno entry appeared last for its instruction
3508 (Dwarf_line_info): Add vector* out-param
3509 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3510 * symtab.cc (Odr_violation_compare): Include the lineno in the
3511 comparison again.
3512 (linenos_from_loc): New. Combine the canonical line for an
3513 address with its other lines.
3514 (True_if_intersect): New. Helper functor to make
3515 std::set_intersection a query.
3516 (detect_odr_violations): Compare sets of lines instead of just
3517 one line for each function. This became less deterministic, but
3518 has fewer false positives.
3519 * symtab.h: Declarations.
3520 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3521 mix an optimized and non-optimized object in the same binary
3522 (odr_violation2.so): Same.
3523 * testsuite/Makefile.in: Regenerate from Makefile.am.
3524 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3525 * testsuite/debug_msg.sh: Update line numbers and add
3526 assertions.
3527 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3528 non-optimized context.
3529 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3530 isn't inlined, and use OdrDerived in an optimized context.
3531 * testsuite/odr_header1.h: Defines OdrDerived, where
3532 optimization will change the
3533 first-instruction-in-the-destructor's file and line number.
3534 * testsuite/odr_header2.h: Defines OdrBase.
3535
3536 2011-03-09 Ian Lance Taylor <iant@google.com>
3537
3538 * fileread.cc (File_read::clear_views): Don't delete the whole
3539 file view.
3540
3541 2011-03-08 Ian Lance Taylor <iant@google.com>
3542
3543 PR gold/12525
3544 * fileread.cc: #include <climits>.
3545 (GOLD_IOV_MAX): Define.
3546 (File_read::read_multiple): Limit number of entries by iov_max.
3547 * fileread.h (class File_read): Always set max_readv_entries to
3548 128.
3549
3550 2011-03-07 Ian Lance Taylor <iant@google.com>
3551
3552 PR gold/12525
3553 * options.h (class General_options): Add -dy and -dn.
3554
3555 2011-03-02 Cary Coutant <ccoutant@google.com>
3556
3557 * testsuite/script_test_9.t: Add TLS segment.
3558
3559 2011-03-02 Simon Baldwin <simonb@google.com>
3560
3561 * configure.ac: Add check for gnu_indirect_function support in
3562 the toolchain building binutils.
3563 * configure: Rebuild.
3564
3565 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3566
3567 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3568 plugin only symbols.
3569 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3570 in plugin files as not needed in the symbol table.
3571
3572 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3573
3574 * output.cc (Output_section::add_input_section): Delay fill
3575 generation for section ordering.
3576
3577 2011-02-09 Ian Lance Taylor <iant@google.com>
3578
3579 PR gold/12316
3580 * object.h (class Sized_relobj): Remove clear_local_symbols.
3581 * reloc.cc (Sized_relobj::do_relocate): Don't call
3582 clear_local_symbols.
3583
3584 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3585
3586 * plugin.cc (is_visible_from_outside): Return true for symbols
3587 in the -u option.
3588
3589 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3590
3591 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3592 filename.
3593
3594 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3595
3596 * icf.h (is_section_foldable_candidate): Change type of parameter
3597 to std::string.
3598 * icf.cc (Icf::find_identical_sections): Change type of local variable
3599 section_name to be std::string.
3600 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3601
3602 2011-01-25 Ian Lance Taylor <iant@google.com>
3603
3604 * script.cc (script_add_extern): Rewrite to use
3605 add_symbol_reference.
3606
3607 2011-01-25 Doug Kwan <dougkwan@google.com>
3608
3609 * icf.cc (get_section_contents): Always lock section's object.
3610
3611 2011-01-24 Ian Lance Taylor <iant@google.com>
3612
3613 * options.h (class General_options): Accept
3614 --no-detect-odr-violations.
3615
3616 2011-01-24 Ian Lance Taylor <iant@google.com>
3617
3618 * version.cc (version_string): Bump to 1.11.
3619
3620 2011-01-24 Ian Lance Taylor <iant@google.com>
3621
3622 * plugin.cc (class Plugin_rescan): Define new class.
3623 (Plugin_manager::claim_file): Set any_claimed_.
3624 (Plugin_manager::save_archive): New function.
3625 (Plugin_manager::save_input_group): New function.
3626 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3627 necessary.
3628 (Plugin_manager::new_undefined_symbol): New function.
3629 (Plugin_manager::rescan): New function.
3630 (Plugin_manager::rescannable_defines): New function.
3631 (Plugin_manager::add_input_file): Set any_added_.
3632 * plugin.h (class Plugin_manager): define new fields rescannable_,
3633 undefined_symbols_, any_claimed_, and any_added_. Declare
3634 Plugin_rescan as friend. Declare new functions.
3635 (Plugin_manager::Rescannable): Define type.
3636 (Plugin_manager::Rescannable_list): Define type.
3637 (Plugin_manager::Undefined_symbol_list): Define type.
3638 (Plugin_manager::Plugin_manager): Initialize new fields.
3639 * archive.cc (Archive::defines_symbol): New function.
3640 (Add_archive_symbols::run): Pass archive to plugins if any.
3641 * archive.h (class Archive): Declare defines_symbol.
3642 * readsyms.cc (Input_group::~Input_group): New function.
3643 (Finish_group::run): Pass input_group to plugins if any.
3644 * readsyms.h (class Input_group): Declare destructor.
3645 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3646 any.
3647
3648 2011-01-10 Ian Lance Taylor <iant@google.com>
3649
3650 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3651 section as relro.
3652 (Layout::set_segment_offsets): Reset increase_relro before calling
3653 set_section_addresses a second time.
3654
3655 2011-01-04 Cary Coutant <ccoutant@google.com>
3656
3657 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3658 sections before NOBITS sections.
3659
3660 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3661
3662 * version.cc (print_version): Update copyright to 2011.
3663
3664 2010-12-23 Cary Coutant <ccoutant@google.com>
3665
3666 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3667 of OS to this->add. Add OD parameter to second form of the function.
3668
3669 2010-12-20 Ian Lance Taylor <iant@google.com>
3670
3671 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3672 second of two consecutive entries with same offset.
3673
3674 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3675
3676 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3677 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3678 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3679 to avoid unneeded links against $(LDADD).
3680 * testsuite/Makefile.in: Regenerate.
3681
3682 2010-12-15 Ian Lance Taylor <iant@google.com>
3683
3684 PR gold/12324
3685 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3686 for R_X86_64_32 and R_X86_64_PC32.
3687 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3688 ver_matching_def_pic.o.
3689 (ver_matching_def_pic.o): New target.
3690
3691 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3692
3693 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3694 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3695 Move definition before File_read::View member definitions.
3696 (File_read::View::~View): Initialize and hold lock before
3697 updating current_mapped_bytes.
3698
3699 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3700
3701 * dwarf_reader.cc: Remove outdated comment.
3702 * gold-threads.cc: Fix typo in error message.
3703 * archive.cc: Fix typos in comments.
3704 * archive.h: Likewise.
3705 * arm-reloc-property.cc: Likewise.
3706 * arm-reloc-property.h: Likewise.
3707 * arm-reloc.def: Likewise.
3708 * arm.cc: Likewise.
3709 * attributes.h: Likewise.
3710 * cref.cc: Likewise.
3711 * ehframe.cc: Likewise.
3712 * fileread.h: Likewise.
3713 * gold.h: Likewise.
3714 * i386.cc: Likewise.
3715 * icf.cc: Likewise.
3716 * incremental.h: Likewise.
3717 * int_encoding.cc: Likewise.
3718 * layout.h: Likewise.
3719 * main.cc: Likewise.
3720 * merge.h: Likewise.
3721 * object.cc: Likewise.
3722 * object.h: Likewise.
3723 * options.cc: Likewise.
3724 * readsyms.cc: Likewise.
3725 * reduced_debug_output.cc: Likewise.
3726 * reloc.cc: Likewise.
3727 * script-sections.cc: Likewise.
3728 * sparc.cc: Likewise.
3729 * symtab.h: Likewise.
3730 * target-reloc.h: Likewise.
3731 * target.cc: Likewise.
3732 * target.h: Likewise.
3733 * timer.cc: Likewise.
3734 * timer.h: Likewise.
3735 * x86_64.cc: Likewise.
3736
3737 2010-12-09 Cary Coutant <ccoutant@google.com>
3738
3739 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3740 stack.
3741 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3742 parameter; change all callers.
3743 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3744 * options.h (warn_execstack): New option.
3745
3746 2010-12-07 Doug Kwan <dougkwan@google.com>
3747
3748 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3749 like function call relocations.
3750
3751 2010-12-07 Ian Lance Taylor <iant@google.com>
3752
3753 * archive.cc (Archive::get_elf_object_for_member): Permit
3754 punconfigured to be NULL.
3755 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3756 (Archive::include_member): Pass NULL to get_elf_object_for_member
3757 if we searched for the archive and this is the first included
3758 object.
3759
3760 2010-12-01 Ian Lance Taylor <iant@google.com>
3761
3762 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3763 track_relocs_type_ field.
3764 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3765 Set track_relocs_type_.
3766 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3767 contents when using RELA relocs.
3768 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3769 reloc_map_.
3770 * reloc.cc (Track_relocs::next_addend): New function.
3771 * reloc.h (class Track_relocs): Declare next_addend.
3772
3773 2010-12-01 Ian Lance Taylor <iant@google.com>
3774
3775 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3776 virtual destructor.
3777
3778 2010-12-01 Ian Lance Taylor <iant@google.com>
3779
3780 * README: Update compilers known to work and fail.
3781
3782 2010-11-23 Matthias Klose <doko@ubuntu.com>
3783
3784 * configure.in: For --enable-gold, handle value `default' instead of
3785 `both*'. Always install ld as ld.bfd, install as ld if gold is
3786 not the default.
3787 * configure: Regenerate.
3788
3789 2010-11-18 Doug Kwan <dougkwan@google.com>
3790
3791 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3792 and right_alignment to be zero. Store result alignment only if it is
3793 greater than existing alignment.
3794
3795 2010-11-16 Cary Coutant <ccoutant@google.com>
3796
3797 PR gold/12220
3798 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3799 Check for ".zdebug_line".
3800
3801 2010-11-16 Doug Kwan <dougkwan@google.com>
3802 Cary Coutant <ccoutant@google.com>
3803
3804 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3805 by reference; adjust all callers.
3806 * output.cc (Output_segment::set_section_addresses): Adjust references
3807 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3808 list is empty.
3809 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3810 end at page boundary.
3811
3812 2010-11-16 Cary Coutant <ccoutant@google.com>
3813
3814 PR gold/12220
3815 * layout.cc (Layout::choose_output_section): Transform names of
3816 compressed sections even when using a script with a SECTIONS clause.
3817 (Layout::output_section_name): Remove code to transform
3818 compressed debug section names.
3819 * output.cc (Output_section::add_input_section): Use uncompressed
3820 section size when tracking input sections.
3821
3822 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3823
3824 * symtab.h (Symbol::NON_PIC_REF): Remove.
3825 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3826 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3827 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3828 (Symbol::use_plt_offset): Take a flags argument and pass it
3829 directly to needs_dynamic_reloc. Restrict check for undefined
3830 weak symbols to function calls.
3831 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3832 (Target_arm::Scan::global): Use it.
3833 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3834 (Target_arm::Relocate::relocate): Likewise.
3835 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3836 parameter with an r_type parameter. Use get_reference_flags
3837 to get the flags.
3838 (Target_arm::Relocate::relocate): Update accordingly.
3839 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3840 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3841 (Target_i386::Scan::global): Likewise.
3842 (Target_i386::Relocate::relocate): Likewise.
3843 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3844 parameter with an r_type parameter. Use get_reference_flags
3845 to get the flags.
3846 (Target_i386::Relocate::relocate): Update accordingly.
3847 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3848 (Target_powerpc::Scan::global): Use it.
3849 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3850 (Target_powerpc::Relocate::relocate): Likewise.
3851 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3852 (Target_sparc::Scan::global): Use it.
3853 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3854 (Target_sparc::Relocate::relocate): Likewise.
3855 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3856 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3857 (Target_x86_64::Scan::global): Likewise.
3858 (Target_x86_64::Relocate::relocate): Likewise.
3859
3860 2010-11-08 Doug Kwan <dougkwan@google.com>
3861 Cary Coutant <ccoutant@google.com>
3862
3863 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3864 (Arm_exidx_merge_section::section_contents_): New data member.
3865 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3866 (Arm_input_section::~Arm_input_section): De-allocate memory.
3867 (Arm_input_section::original_contents_): New data member.
3868 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3869 in parameters instead of calling Object::section_contents without
3870 locking.
3871 (Arm_output_section::group_section): New parameter TASK. Pass it
3872 to callees that need locking objects.
3873 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3874 to lock EXIDX input sections. Fix a formatting issue. Call
3875 Arm_exidx_merged_section::build_contents to create merged section
3876 contents.
3877 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3878 to lock object of stub table owner.
3879 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3880 TEXT_SIZE to initialize data member TEXT_SIZE_.
3881 (Arm_exidx_input_section::addralign): Fix typo in comment.
3882 (Arm_exidx_input_section::text_size): New method.
3883 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3884 that require locking objects. Lock objects before scanning for stubs
3885 and updating local symbols.
3886 (Arm_input_section<big_endian>::init): Copy contents of original
3887 input section.
3888 (Arm_input_section<big_endian>::do_write): Use saved contents of
3889 original input section instead of calling Object::section_contents
3890 without locking.
3891 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3892 size without calling Object::section_size().
3893 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3894 for size. Allocate a buffer for merged EXIDX entries.
3895 (Arm_exidx_merged_section::build_contents): New method.
3896 (Arm_exidx_merged_section::do_write): Move merge section contents
3897 building code to Arm_exidx_merged_section::build_contetns. Write
3898 out contetns in buffer instead of building it on the fly.
3899 (Arm_relobj::make_exidx_input_section): Also pass text section size
3900 to Arm_exidx_input_section constructor.
3901 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3902 (Arm_dynobj::do_read_symbols): Fix memory leak.
3903 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3904 * target.h: (class Task): Add forward declaration.
3905 (Target::relax): Add new parameter TASK and pass it to
3906 Target::do_relax().
3907 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3908
3909 2010-11-05 Cary Coutant <ccoutant@google.com>
3910
3911 PR gold/10708
3912 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3913 object when reading from the file.
3914 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3915 second layout pass.
3916 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3917 when reading section contents.
3918 (get_section_contents): Likewise.
3919 (icf::find_identical_sections): Likewise.
3920 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3921 object when reading from the file.
3922 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3923 the object when doing deferred section layout.
3924
3925 2010-11-03 Nick Clifton <nickc@redhat.com>
3926
3927 PR gold/12001
3928 * script.h (class Symbol_assignment: name): New member. Returns
3929 the name of the symbol.
3930 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3931 Returns true if the given symbol name is on the list of
3932 assignments wating to be processed.
3933 * archive.cc (should_incldue_member): If the symbol is undefined,
3934 check to see if it is on the list of symbols pending assignment.
3935
3936 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3937
3938 * script-sections.cc (Script_sections::find_memory_region): Check
3939 for a NULL output section pointer.
3940
3941 2010-10-29 Doug Kwan <dougkwan@google.com>
3942
3943 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3944 Output_section::add_relaxed_input_section.
3945 * output.cc (Output_section::add_relaxed_input_section): Add new
3946 arguments LAYOUT and NAME. Set section order index.
3947 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3948 Copy section order index.
3949 * output.h (Output_section::add_relaxed_input_section): Add new
3950 arguments LAYOUT and NAME.
3951
3952 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3953
3954 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3955 NATIVE_OR_CROSS_LINKER.
3956 * testsuite/Makefile.in: Regenerate.
3957
3958 2010-10-20 Doug Kwan <dougkwan@google.com>
3959
3960 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3961 without SHF_LINK_ORDER flags.
3962 * layout.cc (Layout::choose_output_section): Do not filter
3963 SHF_LINK_ORDER flag in a relocatable link.
3964
3965 2010-10-17 Cary Coutant <ccoutant@google.com>
3966
3967 * output.h (Output_segment::set_section_addresses): Change function
3968 signature. Update all callers.
3969 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3970 sections.
3971 (Output_segment::set_section_addresses): Align after last TLS
3972 section. Add padding before last relro section instead of after.
3973
3974 2010-10-17 Doug Kwan <dougkwan@google.com>
3975
3976 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3977 GOT output section to be writable.
3978
3979 2010-10-14 Cary Coutant <ccoutant@google.com>
3980
3981 * debug.h (DEBUG_INCREMENTAL): New flag.
3982 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3983 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3984 mode.
3985 * incremental.cc (report_command_line): Ignore all forms of
3986 --incremental.
3987 * layout.cc (Layout::Layout): Check parameters for incremental link
3988 mode.
3989 * options.cc (General_options::parse_incremental): New function.
3990 (General_options::parse_no_incremental): New function.
3991 (General_options::parse_incremental_full): New function.
3992 (General_options::parse_incremental_update): New function.
3993 (General_options::incremental_mode_): New data member.
3994 (General_options::finalize): Check incremental_mode_.
3995 * options.h (General_options): Update help text for --incremental.
3996 Add --no-incremental, --incremental-full, --incremental-update.
3997 (General_options::Incremental_mode): New enum type.
3998 (General_options::incremental_mode): New function.
3999 (General_options::incremental_mode_): New data member.
4000 * parameters.cc (Parameters::incremental_mode_): New data member.
4001 (Parameters::set_options): Set incremental_mode_.
4002 (Parameters::set_incremental_full): New function.
4003 (Parameters::incremental): New function.
4004 (Parameters::incremental_update): New function.
4005 (set_parameters_incremental_full): New function.
4006 * parameters.h (Parameters::set_incremental_full): New function.
4007 (Parameters::incremental): New function.
4008 (Parameters::incremental_update): New function.
4009 (Parameters::incremental_mode_): New data member.
4010 (set_parameters_incremental_full): New function.
4011 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4012 incremental link mode.
4013 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4014 (Sized_relobj::do_relocate_sections): Likewise.
4015 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4016 option.
4017 * testsuite/Makefile.in: Regenerate.
4018 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4019
4020 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4021
4022 * script-sections.h (class Script_sections): Make
4023 Sections_elements typedef public.
4024 * script-sections.cc (class Sort_output_sections): Add elements_
4025 field. Add constructor which sets it; change all callers.
4026 (Sort_output_sections::is_before): New function.
4027 (Sort_output_sections::operator()): Call is_before.
4028 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4029 conditional.
4030 * testsuite/script_test_10.sh: New test. Test script section
4031 order.
4032 * testsuite/script_test_10.t: Likewise.
4033 * testsuite/script_test_10.s: Likewise.
4034 * testsuite/Makefile.am: Wrap the cross linker tests and the
4035 common tests into NATIVE_OR_CROSS_LINKER.
4036 (check_SCRIPTS): Add script_test_10.sh.
4037 (check_DATA): Add script_test_10.stdout.
4038 (script_test_10.o, script_test_10): New targets.
4039 (script_test_10.stdout): New target.
4040 * configure, testsuite/Makefile.in: Regenerate.
4041
4042 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4043
4044 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4045 error for the deprecated relocations.
4046 (Target_arm::Scan::global): Likewise.
4047 (Target_arm::Relocate::relocate): Likewise.
4048
4049 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4050
4051 * fileread.cc (Input_file::find_file): Initialize *found_name
4052 and *namep when using the fallback search for case 4.
4053
4054 2010-10-11 Cary Coutant <ccoutant@google.com>
4055
4056 * options.h (class General_options): Redefine -z lazy as an alias for
4057 the negation of -z now.
4058
4059 2010-10-11 Ian Lance Taylor <iant@google.com>
4060
4061 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4062 binding.
4063
4064 2010-10-06 Nick Clifton <nickc@redhat.com>
4065
4066 * script-sections.cc(class Memory_region): Remove
4067 current_lma_offset_ field. Rename current_vma_offset_ to
4068 current_offset_. Add last_section_ field.
4069 (Memory_region::get_current_vma_address): Rename to
4070 get_current_address.
4071 (Memory_region::get_current_lma_address): Delete.
4072 (Memory_region::increment_vma_offset): Rename to
4073 increment_offset.
4074 (Memory_region::increment_lma_offset): Delete.
4075 (Memory_region::attributes_compatible): New method. Returns
4076 true if the provided section is compatible with the region.
4077 (Memory_region::get_last_section): New method. Returns the last
4078 section to use the region.
4079 (Memory_region::set_last_section): New method. Stores the last
4080 section to use the region.
4081 (Script_sections::block_in_region): New method. Returns true if
4082 a block of memory is contained within a region.
4083 (Script_sections::find_memory_region): New method. Locates a
4084 memory region to be used to set a VMA or LMA address.
4085 (Output_section_definition::set_section_addresses): Add code to
4086 check for addresses set by memory regions.
4087 (Output_segment::set_section_addresses): Remove memory region
4088 walking code.
4089 (Script_sections::create_segment): Add a warning if a header
4090 segment is created outside of any region.
4091 * script-sections.h (class Script_sections): Add prototypes for
4092 find_memory_region and block_in_region methods.
4093 * testsuite/memory_test.s: Use .long instead of .word.
4094 * testsuite/memory_test.t: Add some more output sections.
4095 * testsuite/memory_test.sh: Update expected output.
4096
4097 2010-10-02 Doug Kwan <dougkwan@google.com>
4098
4099 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4100 defintion to symtab.h
4101 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4102 declaration to defintion.
4103
4104 2010-10-01 Nick Clifton <nickc@redhat.com>
4105
4106 * expression.cc (eval): Replace dummy argument with NULL.
4107 (eval_maybe_dot): Check for a NULL result section pointer.
4108 (Symbol_expression::value): Likewise.
4109 (Dot_expression::value): Likewise.
4110 (BINARY_EXPRESSION): Likewise.
4111 (Max_expression::value): Likewise.
4112 (Min_expression::value): Likewise.
4113 (Absolute_expression::value): Likewise.
4114 (Addr_expression::value_from_output_section): Likewise.
4115 (Loaddddr_expression::value_from_output_section): Likewise.
4116 (Segment_start_expression::value): Likewise.
4117 * script-sections.cc
4118 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4119 argument with NULL.
4120 (Sections_elememt_dot_assignment::set_section_addresses):
4121 Likewise.
4122 (Output_data_expression::do_write_to_buffer): Likewise.
4123 (Output_section_definition::finalize_symbols): Likewise.
4124 (Output_section_definition::set_section_addresses): Likewise.
4125
4126 2010-09-30 Doug Kwan <dougkwan@google.com>
4127
4128 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4129
4130 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4131
4132 * target.h (Target::can_icf_inline_merge_sections): New virtual
4133 function.
4134 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4135 virtual function.
4136 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4137 virtual function.
4138 * icf.cc (get_section_contents): Inline merge sections only when
4139 target allows it.
4140
4141 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4142
4143 * configure: Regenerate.
4144
4145 2010-09-17 Ian Lance Taylor <iant@google.com>
4146
4147 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4148 * testsuite/Makefile.am (memory_test.o): New target.
4149 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4150 memory_test.t.
4151 * testsuite/Makefile.in: Rebuild.
4152
4153 2010-09-17 Doug Kwan <dougkwan@google.com>
4154
4155 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4156 defintion if relocation uses GOT entries of the symbol.
4157 * testsuite/icf_safe_test.sh: Fix test.
4158 * testsuite/icf_safe_so_test.sh: Fix test.
4159
4160 2010-09-16 Cary Coutant <ccoutant@google.com>
4161
4162 * script_sections.cc (class Memory_region): Remove "NULL" from
4163 vector initializations.
4164
4165 2010-09-15 Cary Coutant <ccoutant@google.com>
4166
4167 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4168 Resolve forwarding symbols.
4169
4170 2010-09-15 Doug Kwan <dougkwan@google.com>
4171
4172 * gold/testsuite/script_test_3.t: Add ARM special sections.
4173 * gold/testsuite/script_test_4.t: Same.
4174 * gold/testsuite/script_test_5.t: Same.
4175 * gold/testsuite/script_test_6.t: Same.
4176 * gold/testsuite/script_test_7.t: Same.
4177 * gold/testsuite/script_test_7.t: Same.
4178 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4179
4180 2010-09-14 Cary Coutant <ccoutant@google.com>
4181
4182 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4183 (Target_x86_64::Relocate::relocate_tls): Replace check for
4184 saw_tls_block_reloc_ with test for executable section.
4185
4186 2010-09-12 Cary Coutant <ccoutant@google.com>
4187
4188 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4189 position-independent executables to shared libraries need dynamic
4190 relocations.
4191 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4192 position-independent executables.
4193 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4194 * testsuite/Makefile.in: Regenerate.
4195
4196 2010-09-10 Nick Clifton <nickc@redhat.com>
4197
4198 PR gold/11997
4199 * testsuite/memory_test.t: Discard any sections that are not
4200 needed.
4201
4202 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4203
4204 PR gold/11996
4205 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4206 "This::" to work around a bug in gcc 4.2.
4207
4208 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4209
4210 2010-09-09 Rafael Espindola <espindola@google.com>
4211
4212 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4213 sections with different PF_X flags in the same segment.
4214 (Layout::find_first_load_seg): Search all segments to find the first
4215 one.
4216 * options.h (rosegment): New.
4217
4218 2010-09-08 Rafael Espindola <espindola@google.com>
4219
4220 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4221
4222 2010-09-08 Doug Kwan <dougkwan@google.com>
4223
4224 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4225 (Arm_relobj::do_relocate_sections): Add new parameter for output
4226 file to match the parent.
4227 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4228 of local symbols instead of input values. Update code to track
4229 changes in gold::relocate_section.
4230 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4231 (Sized_relobj::compute_final_local_value_internal): New methods.
4232 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4233 body into private version of Sized_relobj::compute_final_local_value.
4234 Call the inline method.
4235 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4236 merged symbol value if there is one.
4237 (Symbol_value::has_output_value): New method defintiion.
4238 (Sized_relobj::Compute_final_local_value_status): New enum type.
4239 (Sized_relobj::compute_final_local_value): New methods.
4240 (Sized_relobj::compute_final_local_value_internal): New methods.
4241 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4242 and arm_cortex_a8.sh.
4243 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4244 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4245 New tests.
4246 * Makefile.in: Regenerate.
4247 * testsuite/arm_bl_out_of_range.s: Update test.
4248 * testsuite/thumb_bl_out_of_range.s: Ditto.
4249 * testsuite/thumb_blx_out_of_range.s: Ditto.
4250 * testsuite/arm_branch_out_of_range.sh: New file.
4251 * testsuite/arm_cortex_a8.sh: Ditto.
4252 * testsuite/arm_cortex_a8_b.s: Ditto.
4253 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4254 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4255 * testsuite/arm_cortex_a8_bl.s: Ditto.
4256 * testsuite/arm_cortex_a8_blx.s: Ditto.
4257 * testsuite/arm_cortex_a8_local.s: Ditto.
4258 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4259 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4260
4261 2010-09-08 Rafael Espindola <espindola@google.com>
4262
4263 * Makefile.am (memory_test.stdout): Run readelf with -W.
4264 * Makefile.in: Regenerate.
4265 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4266 64 bit output.
4267
4268 2010-09-08 Rafael Espindola <espindola@google.com>
4269
4270 * script-sections.cc (Script_sections::add_memory_region): Convert
4271 field precision to int.
4272 * script.cc (script_set_section_region, script_set_section_region):
4273 Convert field precision to int.
4274
4275 2010-09-08 Rafael Espindola <espindola@google.com>
4276
4277 * arm.cc (do_finalize_sections): Create the __exidx_start and
4278 __exdix_end symbols even when the section is missing.
4279
4280 2010-09-08 Nick Clifton <nickc@redhat.com>
4281
4282 * README: Remove claim that MEMORY is not supported.
4283 * expression.cc (script_exp_function_origin)
4284 (script_exp_function_length): Move from here to ...
4285 * script.cc: ... here.
4286 (script_set_section_region, script_add_memory)
4287 (script_parse_memory_attr, script_include_directive): New
4288 functions.
4289 * script-sections.cc
4290 (class Memory_region): New class.
4291 (class Output_section_definition): Add set_memory_region,
4292 set_section_vma, set_section_lma and get_section_name methods.
4293 (class Script_Sections): Add add_memory_region,
4294 find_memory_region, find_memory_region_origin,
4295 find_memory_region_length and set_memory_region methods.
4296 Have set_section_addresses method walk the list of set memory
4297 regions.
4298 Extend the print methos to display memory regions.
4299 * script-sections.h: Add prototypes for new methods.
4300 Add enum for MEMORY region attributes.
4301 * yyscript.y: Add support for parsing MEMORY regions.
4302 * script-c.h: Add prototypes for new functions.
4303 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4304 * testsuite/Makefile.in: Regenerate.
4305 * testsuite/memory_test.sh: New script.
4306 * testsuite/memory_test.s: New assembler source file.
4307 * testsuite/memory_test.t: New linker script.
4308
4309 2010-08-27 Doug Kwan <dougkwan@google.com>
4310
4311 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4312 reference override an existing dynamic weak reference.
4313 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4314 * testsuite/Makefile.in: Regenerate.
4315 * testsuite/dyn_weak_ref.sh: New file.
4316 * testsuite/dyn_weak_ref_1.c: Ditto.
4317 * testsuite/dyn_weak_ref_2.c: Ditto.
4318
4319 2010-08-27 Ian Lance Taylor <iant@google.com>
4320
4321 * incremental.h (class Incremental_input_entry): Add virtual
4322 destructor.
4323
4324 2010-08-27 Ian Lance Taylor <iant@google.com>
4325
4326 * testsuite/start_lib_test_3.c: Mark t3 as used.
4327
4328 2010-08-27 Nick Clifton <nickc@redhat.com>
4329
4330 * options.cc (version_script): Fix small typo in previous
4331 whitespace tidyup.
4332
4333 2010-08-25 Nick Clifton <nickc@redhat.com>
4334
4335 * archive.cc: Formatting fixes: Remove whitespace between
4336 typename and following asterisk. Remove whitespace between
4337 function name and opening parenthesis.
4338 * archive.h: Likewise.
4339 * arm.cc: Likewise.
4340 * attributes.cc: Likewise.
4341 * attributes.h: Likewise.
4342 * common.cc: Likewise.
4343 * copy-relocs.cc: Likewise.
4344 * dirsearch.h: Likewise.
4345 * dynobj.cc: Likewise.
4346 * ehframe.cc: Likewise.
4347 * ehframe.h: Likewise.
4348 * expression.cc: Likewise.
4349 * fileread.cc: Likewise.
4350 * fileread.h: Likewise.
4351 * gc.h: Likewise.
4352 * gold-threads.cc: Likewise.
4353 * gold.cc: Likewise.
4354 * i386.cc: Likewise.
4355 * icf.h: Likewise.
4356 * incremental-dump.cc: Likewise.
4357 * incremental.cc: Likewise.
4358 * layout.cc: Likewise.
4359 * layout.h: Likewise.
4360 * main.cc: Likewise.
4361 * merge.cc: Likewise.
4362 * merge.h: Likewise.
4363 * object.cc: Likewise.
4364 * object.h: Likewise.
4365 * options.cc: Likewise.
4366 * options.h: Likewise.
4367 * output.cc: Likewise.
4368 * output.h: Likewise.
4369 * plugin.cc: Likewise.
4370 * plugin.h: Likewise.
4371 * powerpc.cc: Likewise.
4372 * reloc.cc: Likewise.
4373 * script-c.h: Likewise.
4374 * script-sections.cc: Likewise.
4375 * script.cc: Likewise.
4376 * stringpool.cc: Likewise.
4377 * symtab.cc: Likewise.
4378 * symtab.h: Likewise.
4379 * target.cc: Likewise.
4380 * timer.cc: Likewise.
4381 * timer.h: Likewise.
4382 * version.cc: Likewise.
4383 * x86_64.cc: Likewise.
4384
4385 2010-08-24 Nick Clifton <nickc@redhat.com>
4386
4387 PR 11899
4388 * layout.cc (segment_precedes): Sort segments by their physical
4389 addresses, if they have been set.
4390
4391 2010-08-23 Cary Coutant <ccoutant@google.com>
4392
4393 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4394 symbols data.
4395 (Lib_group::include_member): Unlock object after deleting its
4396 symbols data.
4397 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4398 the bug fixed here.
4399
4400 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4401 Cary Coutant <ccoutant@google.com>
4402
4403 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4404 constructor, and set_blocker.
4405 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4406 readsyms_blocker_.
4407 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4408 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4409 * testsuite/Makefile.am (start_lib_test): New test case.
4410 * testsuite/Makefile.in: Regenerate.
4411 * testsuite/start_lib_test_main.c: New file.
4412 * testsuite/start_lib_test_1.c: New file.
4413 * testsuite/start_lib_test_2.c: New file.
4414 * testsuite/start_lib_test_3.c: New file.
4415
4416 2010-08-19 Ian Lance Taylor <iant@google.com>
4417
4418 * Makefile.in: Rebuild with automake 1.11.1.
4419 * aclocal.m4: Likewise.
4420 * testsuite/Makefile.in: Likewise.
4421
4422 2010-08-19 Ian Lance Taylor <iant@google.com>
4423
4424 PR 10893
4425 * i386.cc (class Output_data_plt_i386): Update declarations.
4426 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4427 local_ifuncs_ fields.
4428 (Target_i386::do_plt_section_for_global): New function.
4429 (Target_i386::do_plt_section_for_local): New function.
4430 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4431 parameter; change all callers. Initialize global_ifuncs_ and
4432 local_ifuncs_. If doing a static link define __rel_iplt_start and
4433 __rel_iplt_end.
4434 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4435 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4436 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4437 symbols.
4438 (Target_i386::make_plt_section): New function, broken out of
4439 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4440 (Target_i386::make_plt_entry): Call make_plt_section.
4441 (Target_i386::make_local_ifunc_plt_entry): New function.
4442 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4443 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4444 R_386_IRELATIVE to switch.
4445 (Target_i386::Scan::global): Likewise.
4446 (Target_i386::Relocate::relocate): Likewise.
4447 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4448 switch.
4449 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4450 (Target_x86_64::do_plt_section_for_global): New function.
4451 (Target_x86_64::do_plt_section_for_local): New function.
4452 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4453 parameter; change all callers. If doing a static link define
4454 __rela_iplt_start and __rela_iplt_end.
4455 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4456 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4457 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4458 to point to .plt.
4459 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4460 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4461 switch.
4462 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4463 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4464 R_X86_64_IRELATIVE to switch.
4465 (Target_x86_64::Scan::global): Likewise.
4466 (Target_x86_64::Relocate::relocate): Likewise.
4467 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4468 switch.
4469 * target.h (class Target): Add plt_section_for_global and
4470 plt_section_for_local functions. Add do_plt_section_for_global
4471 and do_plt_section_for_local virtual functions.
4472 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4473 clarifying comments.
4474 (Symbol::use_plt_offset): Handle IFUNC symbol.
4475 * object.cc (Sized_relobj::Sized_relobj): Initialize
4476 local_plt_offsets_.
4477 (Sized_relobj::local_has_plt_offset): New function.
4478 (Sized_relobj::local_plt_offset): New function.
4479 (Sized_relobj::set_local_plt_offset): New function.
4480 (Sized_relobj::do_count): Handle IFUNC symbol.
4481 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4482 a bit away from input_shndx_ field. Add set_is_func_symbol and
4483 is_ifunc_symbol functions.
4484 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4485 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4486 local_plt_offsets_ field.
4487 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4488 * output.h (class Output_section_data): Add non-const
4489 output_section function.
4490 (class Output_data_got): Update declarations.
4491 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4492 Add use_plt_offset parameter to global and local constructors.
4493 Change all callers. Change local_sym_index_ field to 31 bits.
4494 Change GSYM_CODE and CONSTANT_CODE accordingly.
4495 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4496 doing a static link don't set sh_link field.
4497 (Output_data_got::Got_entry::write): Use PLT offset if
4498 appropriate.
4499 (Output_data_got::add_global_plt): New function.
4500 (Output_data_got::add_local_plt): New function.
4501 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4502 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4503 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4504 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4505 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4506 IFUNC conditional.
4507 * testsuite/ifunc-sel.h: New file.
4508 * testsuite/ifuncmain1.c: New file.
4509 * testsuite/ifuncmain1vis.c: New file.
4510 * testsuite/ifuncmod1.c: New file.
4511 * testsuite/ifuncdep2.c: New file.
4512 * testsuite/ifuncmain2.c: New file.
4513 * testsuite/ifuncmain3.c: New file.
4514 * testsuite/ifuncmod3.c: New file.
4515 * testsuite/ifuncmain4.c: New file.
4516 * testsuite/ifuncmain5.c: New file.
4517 * testsuite/ifuncmod5.c: New file.
4518 * testsuite/ifuncmain6pie.c: New file.
4519 * testsuite/ifuncmod6.c: New file.
4520 * testsuite/ifuncmain7.c: New file.
4521 * configure, testsuite/Makefile.in: Rebuild.
4522
4523 2010-08-18 Ian Lance Taylor <iant@google.com>
4524
4525 * incremental.cc
4526 (Output_section_incremental_inputs::write_input_files): Add cast
4527 to avoid signed/unsigned comparison warning.
4528 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4529
4530 2010-08-12 Cary Coutant <ccoutant@google.com>
4531
4532 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4533
4534 2010-08-13 Ian Lance Taylor <iant@google.com>
4535
4536 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4537
4538 2010-08-12 Cary Coutant <ccoutant@google.com>
4539 Doug Kwan <dougkwan@google.com>
4540
4541 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4542 defintion overrides non-weak undef, remember that the original undef
4543 is not weak.
4544 * symtab.cc (Symbol_table::sized_write_global): For undef without
4545 an original weak binding, set binding to global in output.
4546 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4547 * testsuite/Makefile.in: Regenerate.
4548 * testsuite/strong_ref_weak_def.sh: New file.
4549 * testsuite/strong_ref_weak_def_1.c: Ditto.
4550 * testsuite/strong_ref_weak_def_2.c: Ditto.
4551
4552 2010-08-12 Cary Coutant <ccoutant@google.com>
4553
4554 * testsuite/incremental_test.sh: Rewrite.
4555 * testsuite/incremental_test_1.c: Rewrite.
4556 * testsuite/incremental_test_2.c: Rewrite.
4557
4558 2010-08-12 Cary Coutant <ccoutant@google.com>
4559
4560 * arm.cc (Target_arm::got_size): Add const.
4561 (Target_arm::got_entry_count): New function.
4562 (Target_arm::plt_entry_count): New function.
4563 (Target_arm::first_plt_entry_offset): New function.
4564 (Target_arm::plt_entry_size): New function.
4565 (Output_data_plt_arm::entry_count): New function.
4566 (Output_data_plt_arm::first_plt_entry_offset): New function.
4567 (Output_data_plt_arm::get_plt_entry_size): New function.
4568 * i386.cc (Target_i386::got_size): Add const.
4569 (Target_i386::got_entry_count): New function.
4570 (Target_i386::plt_entry_count): New function.
4571 (Target_i386::first_plt_entry_offset): New function.
4572 (Target_i386::plt_entry_size): New function.
4573 (Output_data_plt_i386::entry_count): New function.
4574 (Output_data_plt_i386::first_plt_entry_offset): New function.
4575 (Output_data_plt_i386::get_plt_entry_size): New function.
4576 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4577 find_incremental_inputs_sections. Dump incremental_got_plt section.
4578 * incremental.cc: Include target.h.
4579 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4580 parameter. Adjust all callers. Find incremental_got_plt section.
4581 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4582 section.
4583 (Output_section_incremental_inputs::set_final_data_size): Calculate
4584 size of incremental_got_plt section.
4585 (Output_section_incremental_inputs::do_write): Write the
4586 incremental_got_plt section.
4587 (Got_plt_view_info): New struct.
4588 (Local_got_offset_visitor): New class.
4589 (Global_got_offset_visitor): New class.
4590 (Global_symbol_visitor_got_plt): New class.
4591 (Output_section_incremental_inputs::write_got_plt): New function.
4592 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4593 Add parameter. Adjust all callers.
4594 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4595 (Incremental_inputs::got_plt_section): New function.
4596 (Incremental_inputs::got_plt_section_): New data member.
4597 (Incremental_got_plt_reader): New class.
4598 * layout.cc (Layout::create_incremental_info_sections): Add the
4599 incremental_got_plt section.
4600 * object.h (Got_offset_list::get_list): New function.
4601 (Got offset_list::for_all_got_offsets): New function.
4602 (Sized_relobj::local_got_offset_list): New function.
4603 * powerpc.cc (Target_powerpc::got_size): Add const.
4604 (Target_powerpc::got_entry_count): New function.
4605 (Target_powerpc::plt_entry_count): New function.
4606 (Target_powerpc::first_plt_entry_offset): New function.
4607 (Target_powerpc::plt_entry_size): New function.
4608 (Output_data_plt_powerpc::entry_count): New function.
4609 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4610 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4611 * sparc.cc (Target_sparc::got_size): Add const.
4612 (Target_sparc::got_entry_count): New function.
4613 (Target_sparc::plt_entry_count): New function.
4614 (Target_sparc::first_plt_entry_offset): New function.
4615 (Target_sparc::plt_entry_size): New function.
4616 (Output_data_plt_sparc::entry_count): New function.
4617 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4618 (Output_data_plt_sparc::get_plt_entry_size): New function.
4619 * symtab.h (Symbol::got_offset_list): New function.
4620 (Symbol_table::for_all_symbols): New function.
4621 * target.h (Sized_target::got_entry_count): New function.
4622 (Sized_target::plt_entry_count): New function.
4623 (Sized_target::plt_entry_size): New function.
4624 * x86_64.cc (Target_x86_64::got_size): Add const.
4625 (Target_x86_64::got_entry_count): New function.
4626 (Target_x86_64::plt_entry_count): New function.
4627 (Target_x86_64::first_plt_entry_offset): New function.
4628 (Target_x86_64::plt_entry_size): New function.
4629 (Output_data_plt_x86_64::entry_count): New function.
4630 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4631 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4632
4633 2010-08-12 Cary Coutant <ccoutant@google.com>
4634
4635 * archive.cc: Include incremental.h.
4636 (Archive::Archive): Initialize incremental_info_.
4637 (Archive::include_member): Record archive members in incremental info.
4638 (Add_archive_symbols::run): Record begin and end of an archive in
4639 incremental info.
4640 (Lib_group::include_member): Record objects in incremental info.
4641 * archive.h (Incremental_archive_entry): Forward declaration.
4642 (Archive::set_incremental_info): New member function.
4643 (Archive::incremental_info): New member function.
4644 (Archive::Unused_symbol_iterator): New class.
4645 (Archive::unused_symbols_begin): New member function.
4646 (Archive::unused_symbols_end): New member function.
4647 (Archive::incremental_info_): New data member.
4648 * incremental-dump.cc (find_input_containing_global): New function.
4649 (dump_incremental_inputs): Dump new incremental info sections.
4650 * incremental.cc: Include symtab.h.
4651 (Output_section_incremental_inputs): New class.
4652 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4653 new incremental info sections.
4654 (Sized_incremental_binary::do_check_inputs): Likewise.
4655 (Incremental_inputs::report_archive): Remove.
4656 (Incremental_inputs::report_archive_begin): New function.
4657 (Incremental_inputs::report_archive_end): New function.
4658 (Incremental_inputs::report_object): New function.
4659 (Incremental_inputs::finalize_inputs): Remove.
4660 (Incremental_inputs::report_input_section): New function.
4661 (Incremental_inputs::report_script): Rewrite.
4662 (Incremental_inputs::finalize): Do nothing but finalize string table.
4663 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4664 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4665 (Incremental_inputs::create_data_sections): New function.
4666 (Incremental_inputs::relocs_entsize): New function.
4667 (Output_section_incremental_inputs::set_final_data_size): New function.
4668 (Output_section_incremental_inputs::do_write): New function.
4669 (Output_section_incremental_inputs::write_header): New function.
4670 (Output_section_incremental_inputs::write_input_files): New function.
4671 (Output_section_incremental_inputs::write_info_blocks): New function.
4672 (Output_section_incremental_inputs::write_symtab): New function.
4673 * incremental.h (Incremental_script_entry): Forward declaration.
4674 (Incremental_object_entry): Forward declaration.
4675 (Incremental_archive_entry): Forward declaration.
4676 (Incremental_inputs): Forward declaration.
4677 (Incremental_inputs_header_data): Remove.
4678 (Incremental_inputs_header): Remove.
4679 (Incremental_inputs_header_write): Remove.
4680 (Incremental_inputs_entry_data): Remove.
4681 (Incremental_inputs_entry): Remove.
4682 (Incremental_inputs_entry_write): Remove.
4683 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4684 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4685 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4686 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4687 Likewise.
4688 (Incremental_input_entry): New class.
4689 (Incremental_script_entry): New class.
4690 (Incremental_object_entry): New class.
4691 (Incremental_archive_entry): New class.
4692 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4693 (Incremental_inputs::report_inputs): Remove.
4694 (Incremental_inputs::report_archive): Remove.
4695 (Incremental_inputs::report_archive_begin): New function.
4696 (Incremental_inputs::report_archive_end): New function.
4697 (Incremental_inputs::report_object): Change prototype.
4698 (Incremental_inputs::report_input_section): New function.
4699 (Incremental_inputs::report_script): Change prototype.
4700 (Incremental_inputs::get_reloc_count): New function.
4701 (Incremental_inputs::set_reloc_count): New function.
4702 (Incremental_inputs::create_data_sections): New function.
4703 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4704 (Incremental_inputs::inputs_section): New function.
4705 (Incremental_inputs::symtab_section): New function.
4706 (Incremental_inputs::relocs_section): New function.
4707 (Incremental_inputs::get_stringpool): Add const.
4708 (Incremental_inputs::command_line): Add const.
4709 (Incremental_inputs::inputs): Remove.
4710 (Incremental_inputs::command_line_key): New function.
4711 (Incremental_inputs::input_file_count): New function.
4712 (Incremental_inputs::input_files): New function.
4713 (Incremental_inputs::relocs_entsize): New function.
4714 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4715 (Incremental_inputs::finalize_inputs): Remove.
4716 (Incremental_inputs::Input_info): Remove.
4717 (Incremental_inputs::lock_): Remove.
4718 (Incremental_inputs::inputs_): Change type.
4719 (Incremental_inputs::inputs_map_): Remove.
4720 (Incremental_inputs::current_object_entry_): New data member.
4721 (Incremental_inputs::inputs_section_): New data member.
4722 (Incremental_inputs::symtab_section_): New data member.
4723 (Incremental_inputs::relocs_section_): New data member.
4724 (Incremental_inputs::reloc_count_): New data member.
4725 (Incremental_inputs_reader): New class.
4726 (Incremental_symtab_reader): New class.
4727 (Incremental_relocs_reader): New class.
4728 * layout.cc (Layout::finalize): Move finalization of incremental info
4729 and creation of incremental info sections to follow finalization of
4730 symbol table. Set offsets for postprocessing sections.
4731 (Layout::create_incremental_info_sections): Call
4732 Incremental_inputs::create_data_sections. Add incremental symtab
4733 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4734 sections to layout after input sections.
4735 * layout.h (struct Timespec): Forward declaration.
4736 (Layout::incremental_inputs): Add const.
4737 (Layout::create_incremental_info_sections): Add parameter.
4738 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4739 * object.cc: Include incremental.h.
4740 (Relobj::finalize_incremental_relocs): New function.
4741 (Sized_relobj::do_layout): Record input sections in incremental info.
4742 * object.h (Object::output_section): New function.
4743 (Object::output_section_offset): Moved from Relobj.
4744 (Object::get_incremental_reloc_base): New function.
4745 (Object::get_incremental_reloc_count): New function.
4746 (Object::do_output_section): New function.
4747 (Object::do_output_section_offset): Moved from Relobj.
4748 (Object::do_get_incremental_reloc_base): New function.
4749 (Object::do_get_incremental_reloc_count): New function.
4750 (Object::Object): Initialize new data members.
4751 (Relobj::output_section): Renamed do_output_section and moved to
4752 protected.
4753 (Relobj::output_section_offset): Moved to Object.
4754 (Relobj::do_get_incremental_reloc_base): New function.
4755 (Relobj::do_get_incremental_reloc_count): New function.
4756 (Relobj::allocate_incremental_reloc_counts): New function.
4757 (Relobj::count_incremental_reloc): New function.
4758 (Relobj::finalize_incremental_relocs): New function.
4759 (Relobj::next_incremental_reloc_index): New function.
4760 (Relobj::reloc_counts_): New data member.
4761 (Relobj::reloc_bases_): New data member.
4762 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4763 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4764 (Sized_relobj::incremental_relocs_scan): New function.
4765 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4766 (Sized_relobj::incremental_relocs_write): New function.
4767 (Sized_relobj::incremental_relocs_write_reltype): New function.
4768 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4769 incremental link.
4770 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4771 archives and object files elsewhere.
4772 (Add_symbols::run): Report object files here.
4773 (Finish_group::run): Report end of archive at end of group.
4774 * reloc.cc: Include layout.h, incremental.h.
4775 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4776 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4777 (Sized_relobj::incremental_relocs_scan): New function.
4778 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4779 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4780 (Sized_relobj::incremental_relocs_write): New function.
4781 (Sized_relobj::incremental_relocs_write_reltype): New function.
4782 * script.cc (read_input_script): Rewrite test for incremental link.
4783 Change call to Incremental_inputs::report_script.
4784 * symtab.h (Symbol_table::first_global_index): New function.
4785 (Symbol_table::output_count): New function.
4786
4787 2010-08-12 Doug Kwan <dougkwan@google.com>
4788
4789 * arm.cc (Target_arm::merge_object_attributes): Check command line
4790 options --no-wchar-size-warning and --no-enum-size-warning.
4791 * options.h (General_options): Add ld-compatible options
4792 --no-enum-size-warning and --no-wchar-size-warning.
4793
4794 2010-08-04 Ian Lance Taylor <iant@google.com>
4795
4796 * x86_64.cc (Target_x86_64::Scan::local): Use
4797 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4798 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4799 (Target_x86_64::Scan::global): Likewise.
4800 (Target_x86_64::Relocate::relocate): Likewise.
4801 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4802 Likewise.
4803
4804 2010-08-03 Cary Coutant <ccoutant@google.com>
4805
4806 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4807 to reserve space in merged_strings vector. Keep total input size
4808 for stats.
4809 (Output_merge_string::do_print_merge_stats): Print total input size.
4810 * merge.h (Output_merge_string): Add input_size_ field.
4811 * stringpool.cc (Stringpool_template::string_length): Move
4812 implementations out of Stringpool_template class and place in
4813 stringpool.h.
4814 * stringpool.h (string_length): Move out of Stringpool_template.
4815
4816 2010-08-03 Ian Lance Taylor <iant@google.com>
4817
4818 PR 11712
4819 * layout.cc (relaxation_loop_body): If address of load segment is
4820 set, adjust address to include headers if possible.
4821
4822 2010-08-03 Ian Lance Taylor <iant@google.com>
4823
4824 * version.cc (version_string): Bump to 1.10.
4825
4826 2010-08-03 Ian Lance Taylor <iant@google.com>
4827
4828 PR 11805
4829 * layout.h (enum Output_section_order): Define.
4830 (class Layout): Update declarations.
4831 * layout.cc (Layout::get_output_section): Add order parameter.
4832 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4833 is_first_non_relro parameters. Change all callers.
4834 (Layout::choose_output_section): Likewise.
4835 (Layout::add_output_section_data): Likewise.
4836 (Layout::make_output_section): Likewise. Set order.
4837 (Layout::default_section_order): New function.
4838 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4839 * output.cc (Output_section::Output_section): Initialize order_.
4840 Don't initialize deleted fields.
4841 (Output_segment::Output_segment): Don't initialize deleted
4842 fields.
4843 (Output_segment::add_output_section_to_load): New function
4844 replacing add_output_section. Change all callers to call this or
4845 add_output_section_to_nonload.
4846 (Output_segment::add_output_section_to_nonload): New function.
4847 (Output_segment::remove_output_section): Rewrite.
4848 (Output_segment::add_initial_output_data): Likewise.
4849 (Output_segment::has_any_data_sections): Likewise.
4850 (Output_segment::is_first_section_relro): Likewise.
4851 (Output_segment::maximum_alignment): Likewise.
4852 (Output_segment::has_dynamic_reloc): New function replacing
4853 dynamic_reloc_count. Change all callers.
4854 (Output_segment::has_dynamic_reloc_list): New function replacing
4855 dynamic_reloc_count_list. Change all callers.
4856 (Output_segment::set_section_addresses): Rewrite.
4857 (Output_segment::set_offset): Rewrite.
4858 (Output_segment::find_first_and_last_list): Remove.
4859 (Output_segment::set_tls_offsets): Rewrite.
4860 (Output_segment::first_section_load_address): Likewise.
4861 (Output_segment::output_section_count): Likewise.
4862 (Output_segment::section_with_lowest_load_address): Likewise.
4863 (Output_segment::write_section_headers): Likewise.
4864 (Output_segment::print_sections_to_map): Likewise.
4865 * output.h (class Output_data): Remove dynamic_reloc_count_
4866 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4867 (Output_data::add_dynamic_reloc): Rewrite.
4868 (Output_data::has_dynamic_reloc): New function.
4869 (Output_data::dynamic_reloc_count): Remove.
4870 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4871 is_last_relro_, is_first_non_relro_, is_interp_,
4872 is_dynamic_linker_section_ fields. Add order and set_order
4873 functions. Remove is_relro_local, set_is_relro_local,
4874 is_last_relro, set_is_last_relro, is_first_non_relro,
4875 set_is_first_non_relro functions, is_interp, set_is_interp,
4876 is_dynamic_linker_section, and set_is_dynamic_linker_section
4877 functions.
4878 (class Output_segment): Change Output_data_list from std::list to
4879 std:;vector. Add output_lists_ field. Remove output_data_ and
4880 output_bss_ fields. Update declarations.
4881
4882 2010-08-02 Ian Lance Taylor <iant@google.com>
4883
4884 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4885 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4886 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4887
4888 2010-08-02 Ian Lance Taylor <iant@google.com>
4889
4890 PR 11855
4891 * script.cc (Script_options::Script_options): Initialize
4892 symbol_definitions_ and symbol_references_.
4893 (Script_options::add_symbol_assignment): Update
4894 symbol_definitions_ and symbol_references_.
4895 (Script_options::add_symbol_reference): New function.
4896 (script_symbol): New function.
4897 * script.h (class Script_options): Add symbol_definitions_ and
4898 symbol_references_ fields.
4899 (Script_options::referenced_const_iterator): New type.
4900 (Script_options::referenced_begin): New function.
4901 (Script_options::referenced_end): New function.
4902 (Script_options::is_referenced): New function.
4903 (Script_options::any_unreferenced): New function.
4904 * script-c.h (script_symbol): Declare.
4905 * yyscript.y (exp): Call script_symbol.
4906 * symtab.cc: Include "script.h".
4907 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4908 Change all callers. Check symbols referenced by scripts.
4909 (Symbol_table::add_undefined_symbols_from_command_line): Add
4910 layout parameter. Change all callers.
4911 (Symbol_table::do_add_undefined_symbols_from_command_line):
4912 Likewise. Break out loop body. Check symbols referenced by
4913 scripts.
4914 (Symbol_table::add_undefined_symbol_from_command_line): New
4915 function broken out of
4916 do_add_undefined_symbols_from_command_line.
4917 * symtab.h (class Symbol_table): Update declarations.
4918 * archive.cc: Include "layout.h".
4919 (Archive::should_include_member): Add layout parameter. Change
4920 all callers. Check for symbol mentioned in expression.
4921 * archive.h (class Archive): Update declaration.
4922 * object.cc (Sized_relobj::do_should_include_member): Add layout
4923 parameter.
4924 * object.h (Object::should_include_member): Add layout parameter.
4925 Change all callers.
4926 (Object::do_should_include_member): Add layout parameter.
4927 (class Sized_relobj): Update declaration.
4928 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4929 parameter.
4930 * dynobj.h (class Sized_dynobj): Update declaration.
4931 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4932 layout parameter.
4933 * plugin.h (class Sized_pluginobj): Update declaration.
4934
4935 2010-08-02 Ian Lance Taylor <iant@google.com>
4936
4937 PR 11866
4938 * output.cc (Output_segment::set_offset): Search for the first and
4939 last sections rather than assuming that the list is in order.
4940 (Output_segment::find_first_and_last_list): New function.
4941 * output.h (class Output_segment): Update declarations.
4942 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4943 (relro_strip_test_SOURCES): New variable.
4944 (relro_strip_test_DEPENDENCIES): New variable.
4945 (relro_strip_test_LDFLAGS): New variable.
4946 (relro_strip_test_LDADD): New variable.
4947 (relro_strip_test.so): New target.
4948
4949 2010-08-02 Ian Lance Taylor <iant@google.com>
4950
4951 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4952 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4953 (Target_i386::got_tlsdesc_section): New function.
4954 (Target_i386::got_section): Create space for GOT entries for
4955 TLSDESC relocations.
4956 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4957 R_386_TLS_GOTDESC.
4958 (Target_i386::Scan::global): Likewise.
4959 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4960 using TLSDESC GOT.
4961 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4962 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4963 (Target_x86_64::got_tlsdesc_section): New function.
4964 (Target_x86_64::got_section): Create space for GOT entries for
4965 TLSDESC relocations.
4966 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4967 R_386_TLS_GOTDESC.
4968 (Target_x86_64::Scan::global): Likewise.
4969 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4970 using TLSDESC GOT.
4971
4972 2010-08-02 Ian Lance Taylor <iant@google.com>
4973
4974 * testsuite/final_layout.sh: Use dc to convert from hex to
4975 decimal.
4976
4977 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4978
4979 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4980 paramter to the call to gold::gc_process_relocs.
4981 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4982 paramter to the call to gold::gc_process_relocs.
4983 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4984 parameter to the call to gold::gc_process_relocs.
4985 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4986 template parameter to the call to gold::gc_process_relocs.
4987 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4988 paramter to the call to gold::gc_process_relocs.
4989 * gc.h (get_embedded_addend_size): New function.
4990 (gc_process_relocs): Save the size of the reloc for use by ICF.
4991 * icf.cc (get_section_contents): Get the addend from the text section
4992 for SHT_REL relocation sections.
4993 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4994 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4995 * int_encoding.h (read_from_pointer): New overloaded function.
4996 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4997 * testsuite/icf_sht_rel_addend_test.sh: New file.
4998 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4999 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5000
5001 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5002
5003 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5004 * Makefile.in: Regenerate.
5005 * testsuite/Makefile.in: Regenerate.
5006
5007 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5008
5009 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5010 * gold/testsuite/debug_msg.cc: Likewise.
5011 * gold/testsuite/odr_violation1.cc
5012 * gold/testsuite/odr_violation2.cc
5013
5014 2010-07-21 Cary Coutant <ccoutant@google.com>
5015
5016 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5017 string, and length fields.
5018 (Output_merge_string::Merged_strings_list): New type.
5019 (Output_merge_string::Merged_strings_lists): New typedef.
5020 (Output_merge_string): Replace merged_strings_ with
5021 merged_strings_lists_.
5022 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5023 Merged_strings_list per input object and section. Don't store pointer
5024 to the string. Don't store length with each merged string entry.
5025 (Output_merge_string::finalize_merged_data): Loop over list of merged
5026 strings lists. Recompute length of each merged string.
5027
5028 2010-07-15 Cary Coutant <ccoutant@google.com>
5029
5030 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5031 here.
5032
5033 2010-07-14 Ian Lance Taylor <iant@google.com>
5034
5035 * descriptors.cc (Descriptors::open): Report correct name in error
5036 message.
5037
5038 2010-07-13 Doug Kwan <dougkwan@google.com>
5039
5040 * arm.cc (Arm_input_section::Arm_input_section): For a
5041 SHT_ARM_EXIDX section, always keeps the input sections.
5042 (Arm_input_section::set_exidx_section_link): New method.
5043 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5044 has_errors_ to false.
5045 (Arm_exidx_input_section::has_errors,
5046 Arm_exidx_input_section::set_has_errors): New methods.
5047 (Arm_exidx_input_section::has_errors_): New data member.
5048 (Arm_relobj::get_exidx_shndx_list): New method.
5049 (Arm_output_section::append_text_sections_to_list): Do not skip
5050 section without SHF_EXECINSTR.
5051 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5052 errors.
5053 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5054 section header. Make error messages more verbose. Check for
5055 a non-executable section linked to an EXIDX section.
5056 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5057 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5058 check that there is no deferred EXIDX section if we exit early.
5059 Instead of not making an EXIDX section in case of an error, make one
5060 and set the has_errors flag of it.
5061 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5062 in a relocatable link.
5063 (Target_arm::do_relax): Look for the EXIDX output section instead of
5064 assuming that it is called .ARM.exidx.
5065 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5066 section list. Do not check for SHF_EXECINSTR section flags but
5067 skip any input section with errors.
5068 * output.cc (Output_section::Output_section): Initialize
5069 always_keeps_input_sections_ to false.
5070 (Output_section::add_input_section): Check for
5071 always_keeps_input_sections_.
5072 * output.h (Output_section::always_keeps_input_sections,
5073 Output_section::set_always_keeps_input_sections): New methods.
5074 (Output_section::always_keeps_input_sections): New data member.
5075
5076 2010-07-13 Rafael Espindola <espindola@google.com>
5077
5078 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5079 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5080
5081 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5082 Ian Lance Taylor <iant@google.com>
5083
5084 * output.h (Output_section_lookup_maps::add_merge_section):
5085 Correct check of whether value was inserted.
5086 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5087 (Output_section_lookup_maps::add_relaxed_input_section):
5088 Likewise.
5089 * arm.cc (Target_arm::got_section): Remove used local os.
5090 * i386.cc (Target_i386::got_section): Likewise.
5091 * x86_64.cc (Target_x86_64::got_section): Likewise.
5092 * sparc.cc (Target_sparc::got_section): Likewise.
5093 (Target_sparc::relocate): Remove unused local have_got_offset.
5094 * powerpc.cc (Target_powerpc::relocate): Likewise.
5095
5096 2010-07-13 Ian Lance Taylor <iant@google.com>
5097
5098 * compressed_output.cc (zlib_decompress): Fix signature in
5099 !HAVE_ZLIB_H case.
5100
5101 * archive.cc (Archive::include_member): Unlock an external member
5102 of a thin archive. Don't bother to delete an object we know is
5103 NULL.
5104
5105 2010-07-12 Cary Coutant <ccoutant@google.com>
5106
5107 * compressed_output.cc (zlib_decompress): New function.
5108 (get_uncompressed_size): New function.
5109 (decompress_input_section): New function.
5110 * compressed_output.h (get_uncompressed_size): New function.
5111 (decompress_input_section): New function.
5112 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5113 Handle compressed debug sections.
5114 * layout.cc (is_compressed_debug_section): New function.
5115 (Layout::output_section_name): Map compressed section names to
5116 canonical names.
5117 * layout.h (is_compressed_debug_section): New function.
5118 (is_debug_info_section): Recognize compressed debug sections.
5119 * merge.cc: Include compressed_output.h.
5120 (Output_merge_data::do_add_input_section): Handle compressed
5121 debug sections.
5122 (Output_merge_string::do_add_input_section): Handle compressed
5123 debug sections.
5124 * object.cc: Include compressed_output.h.
5125 (Sized_relobj::Sized_relobj): Initialize new data members.
5126 (build_compressed_section_map): New function.
5127 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5128 * object.h (Object::section_is_compressed): New method.
5129 (Object::do_section_is_compressed): New method.
5130 (Sized_relobj::Compressed_section_map): New type.
5131 (Sized_relobj::do_section_is_compressed): New method.
5132 (Sized_relobj::compressed_sections_): New data member.
5133 * output.cc (Output_section::add_input_section): Handle compressed
5134 debug sections.
5135 * reloc.cc: Include compressed_output.h.
5136 (Sized_relobj::write_sections): Handle compressed debug sections.
5137
5138 2010-07-08 Cary Coutant <ccoutant@google.com>
5139
5140 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5141 weak when resolving to a dynamic def.
5142 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5143 for weak undef/dynamic def cases. Adjust callers.
5144 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5145 undef_binding_weak_.
5146 (Symbol_table::sized_write_globals): Adjust symbol binding.
5147 (Symbol_table::sized_write_symbol): Add binding parameter.
5148 * symtab.h (Symbol::set_undef_binding): New method.
5149 (Symbol::is_undef_binding_weak): New method.
5150 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5151 (Symbol_table::should_override): Add new parameter.
5152 (Symbol_table::sized_write_symbol): Add new parameter.
5153
5154 * testsuite/weak_undef_file1.cc: Add new test case.
5155 * testsuite/weak_undef_file2.cc: Fix header comment.
5156 * testsuite/weak_undef_test.cc: Add new test case.
5157
5158 2010-06-29 Doug Kwan <dougkwan@google.com>
5159
5160 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5161 Initialize USE_SYMBOL_.
5162 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5163 definition.
5164 (Arm_reloc_property::uses_symbol_): New data member declaration.
5165 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5166 uses symbol value and symbol is undefined but not weakly undefined.
5167
5168 2010-06-28 Rafael Espindola <espindola@google.com>
5169
5170 * plugin.cc (Plugin::load): Use dlerror.
5171
5172 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5173
5174 * symtab.cc (detect_odr_violations): When reporting an ODR
5175 violation, report an object where the symbol is defined.
5176
5177 2010-06-25 Doug Kwan <dougkwan@google.com>
5178
5179 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5180 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5181 definition.
5182 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5183 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5184 target hook to detect function points.
5185 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5186 * icf.h (Icf::check_section_for_function_pointers): Change type of
5187 parameter SECTION_NAME to const reference to std::string. Use
5188 target hook to determine if section may have unsafe pointers.
5189 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5190 method definition.
5191
5192 2010-06-21 Rafael Espindola <espindola@google.com>
5193
5194 * fileread.cc (Input_file::find_fie): New
5195 (Input_file::open): Use Input_file::find_fie.
5196 * fileread.h (Input_file::find_fie): New
5197 * plugin.cc (set_extra_library_path): New.
5198 (Plugin::load): Add set_extra_library_path to the transfer vector.
5199 (Plugin_manager::set_extra_library_path): New.
5200 (Plugin_manager::add_input_file): Use the extra search path if set.
5201 (set_extra_library_path(): New.
5202 * plugin.h (Plugin_manager): Add set_extra_library_path and
5203 extra_search_path_.
5204
5205 2010-06-19 Cary Coutant <ccoutant@google.com>
5206
5207 * layout.cc (gdb_sections): Add .debug_types.
5208 (lines_only_debug_sections): Likewise.
5209
5210 2010-06-18 Rafael Espindola <espindola@google.com>
5211
5212 * plugin.cc (add_input_file,add_input_library)
5213 (Plugin_manager::add_input_file): Make filename arguments const.
5214 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5215 const.
5216
5217 2010-06-16 Doug Kwan <dougkwan@google.com>
5218
5219 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5220 .ARM.attributes section if we have not merged any input
5221 attributes sections.
5222
5223 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5224
5225 * arm.cc: Allow combining objects with no EABI version
5226 information.
5227
5228 2010-06-15 Rafael Espindola <espindola@google.com>
5229
5230 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5231
5232 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5233
5234 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5235 (struct iovec): Correct !HAVE_READV definition.
5236
5237 2010-06-10 Cary Coutant <ccoutant@google.com>
5238
5239 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5240 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5241 reloc sections.
5242 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5243
5244 PR 11683
5245 * symtab.h (Symbol::is_placeholder): New member function.
5246 * target-reloc.h (relocate_section): Check for placeholder symbols.
5247
5248 * testsuite/Makefile.am (plugin_test_8): New test.
5249 (plugin_test_9): New test.
5250 * testsuite/Makefile.in: Regenerate.
5251
5252 2010-06-09 Nick Clifton <nickc@redhat.com>
5253
5254 * yyscript.y (input_list_element): Allow strings prefixed with
5255 the '-' character. Treat these as libraries.
5256 * script.cc (script_add_library): New function. Adds a library
5257 specified by "-l<name>" found in an input script.
5258 * script-c.h: Add prototype for script_add_library.
5259
5260 2010-06-07 Doug Kwan <dougkwan@google.com>
5261
5262 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5263 Restrict stub-group size to be within long conditional branch
5264 range when working around cortex-A8 erratum.
5265
5266 2010-06-07 Damien Diederen <dd@crosstwine.com>
5267
5268 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5269 #ifdef typo.
5270
5271 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5272
5273 PR gold/11658
5274 * output.cc
5275 (Output_section::Input_section_sort_entry::compare_section_ordering):
5276 Change to return non-zero correctly.
5277 (Output_section::Input_section_sort_section_order_index_compare
5278 ::operator()): Change to fix ambiguity in comparisons.
5279
5280 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5281
5282 * gold.h (is_wildcard_string): New function.
5283 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5284 (Layout::layout_eh_frame): Ditto.
5285 (Layout::find_section_order_index): New method.
5286 (Layout::read_layout_from_file): New method.
5287 * layout.h (Layout::find_section_order_index): New method.
5288 (Layout::read_layout_from_file): New method.
5289 (Layout::input_section_position_): New private member.
5290 (Layout::input_section_glob_): New private member.
5291 * main.cc (main): Call read_layout_from_file here.
5292 * options.h (--section-ordering-file): New option.
5293 * output.cc (Output_section::input_section_order_specified_): New
5294 member.
5295 (Output_section::Output_section): Initialize new member.
5296 (Output_section::add_input_section): Add new parameter.
5297 Keep input sections when --section-ordering-file is used.
5298 (Output_section::set_final_data_size): Sort input sections when
5299 section ordering file is specified.
5300 (Output_section::Input_section_sort_entry): Add new parameter.
5301 Check sorting type.
5302 (Output_section::Input_section_sort_entry::compare_section_ordering):
5303 New method.
5304 (Output_section::Input_section_sort_compare::operator()): Change to
5305 consider section_order_index.
5306 (Output_section::Input_section_sort_init_fini_compare::operator()):
5307 Change to consider section_order_index.
5308 (Output_section::Input_section_sort_section_order_index_compare
5309 ::operator()): New method.
5310 (Output_section::sort_attached_input_sections): Change to sort
5311 according to section order when specified.
5312 (Output_section::add_input_section<32, true>): Add new parameter.
5313 (Output_section::add_input_section<64, true>): Add new parameter.
5314 (Output_section::add_input_section<32, false>): Add new parameter.
5315 (Output_section::add_input_section<64, false>): Add new parameter.
5316 * output.h (Output_section::add_input_section): Add new parameter.
5317 (Output_section::input_section_order_specified): New
5318 method.
5319 (Output_section::set_input_section_order_specified): New method.
5320 (Input_section::Input_section): Initialize section_order_index_.
5321 (Input_section::section_order_index): New method.
5322 (Input_section::set_section_order_index): New method.
5323 (Input_section::section_order_index_): New member.
5324 (Input_section::Input_section_sort_section_order_index_compare): New
5325 struct.
5326 (Output_section::input_section_order_specified_): New member.
5327 * script-sections.cc (is_wildcard_string): Delete and move modified
5328 method to gold.h.
5329 (Output_section_element_input::Output_section_element_input): Modify
5330 call to is_wildcard_string.
5331 (Output_section_element_input::Input_section_pattern
5332 ::Input_section_pattern): Ditto.
5333 (Output_section_element_input::Output_section_element_input): Ditto.
5334 * testsuite/Makefile.am (final_layout): New test case.
5335 * testsuite/Makefile.in: Regenerate.
5336 * testsuite/final_layout.cc: New file.
5337 * testsuite/final_layout.sh: New file.
5338
5339 2010-06-01 Rafael Espindola <espindola@google.com>
5340
5341 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5342
5343 2010-06-01 Rafael Espindola <espindola@google.com>
5344
5345 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5346 visibility of symbols.
5347
5348 2010-05-27 Doug Kwan <dougkwan@google.com>
5349
5350 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5351 from start of output section instead of address for a local symbol
5352 in a merged or relaxed section when doing a relocatable link.
5353
5354 2010-05-26 Rafael Espindola <espindola@google.com>
5355
5356 PR 11604
5357 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5358 adding sections the garbage collector removed.
5359 * gold/testsuite/Makefile.am: Add test.
5360 * gold/testsuite/Makefile.in: Regenerate.
5361 * gold/testsuite/plugin_test_7.sh: New.
5362 * gold/testsuite/plugin_test_7_1.c: New.
5363 * gold/testsuite/plugin_test_7_2.c: New.
5364
5365 2010-05-26 Rafael Espindola <espindola@google.com>
5366
5367 * script-sections.cc (Output_section_definition::set_section_addresses):
5368 Check for --section-start.
5369
5370 2010-05-26 Doug Kwan <dougkwan@google.com>
5371
5372 * arm.cc (Arm_scan_relocatable_relocs): New class.
5373 (Target_arm::relocate_special_relocatable): New method.
5374 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5375 (Arm_relocate_functions::thumb_branch_common): Same.
5376 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5377 instead of Default_scan_relocatable_relocs.
5378 * target-reloc.h (relocate_for_relocatable): Let target handle
5379 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5380 * target.h (Sized_target::relocate_special_relocatable): New method.
5381
5382 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5383
5384 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5385
5386 2010-05-23 Doug Kwan <dougkwan@google.com>
5387
5388 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5389 instead of a cast.
5390 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5391 with a direct branch, not a conditional branch, to a stub.
5392 * merge.cc (Output_merge_base::record_input_section): New method
5393 defintion.
5394 (Output_merge_data::do_add_input_section): Record input section if
5395 keeps-input-sections flag is set.
5396 (Output_merge_string::do_add_input_section): Ditto.
5397 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5398 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5399 INPUT_SECTIONS_.
5400 (Output_merge_base::keeps_input_sections,
5401 Output_merge_base::set_keeps_input_sections,
5402 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5403 method definitions.
5404 (Output_merge_base::Input_sections): New type declaration.
5405 (Output_merge_base::input_sections_begin,
5406 Output_merge_base::input_sections_end,
5407 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5408 (Output_merge_base::bool keeps_input_sections_,
5409 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5410 Output_merge_base::input_sections_): New data members.
5411 (Output_merge_data::do_set_keeps_input_sections): New method
5412 defintion.
5413 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5414 * output.cc (Output_section::Input_section::relobj): Move method
5415 defintion from class declaration to here and handle merge sections.
5416 (Output_section::Input_section::shndx): Ditto.
5417 (Output_section::Output_section): Remove initializations of removed
5418 data members and initialize new data member LOOKUP_MAPS_.
5419 (Output_section::add_input_section): Set keeps-input-sections flag
5420 for a newly created merge output section as appropriate. Adjust code
5421 to use Output_section_lookup_maps class.
5422 (Output_section::add_relaxed_input_section): Adjst code for lookup
5423 maps code refactoring.
5424 (Output_section::add_merge_input_section): Add a new parameter
5425 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5426 class. If adding input section to a newly created merge output
5427 section fails, remove the new merge section.
5428 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5429 Adjust code for use of the Output_section_lookup_maps class.
5430 (Output_section::find_merge_section): Ditto.
5431 (Output_section::build_lookup_maps): New method defintion.
5432 (Output_section::find_relaxed_input_section): Adjust code to use
5433 Output_section_lookup_maps class.
5434 (Output_section::get_input_sections): Export merge sections. Adjust
5435 code to use Output_section_lookup_maps class.
5436 (Output_section:::add_script_input_section): Adjust code to use
5437 Output_section_lookup_maps class. Update lookup maps for merge
5438 sections also.
5439 (Output_section::discard_states): Use Output_section_lookup_maps.
5440 (Output_section::restore_states): Same.
5441 * output.h (Merge_section_properties): Move class defintion out of
5442 Output_section.
5443 (Output_section_lookup_maps): New class.
5444 (Output_section::Input_section::is_merge_section): New method
5445 defintion.
5446 (Output_section::Input_section::relobj): Move defintion out of class
5447 defintion. Declare method only.
5448 (Output_section::Input_section::shndx): Ditto.
5449 (Output_section::Input_section::output_merge_base): New method defintion.
5450 (Output_section::Input_section::u2_.pomb): New union field.
5451 (Output_section::Merge_section_by_properties_map,
5452 Output_section::Output_section_data_by_input_section_map,
5453 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5454 Remove types.
5455 (Output_section::add_merge_input_section): Add new parameter
5456 KEEPS_INPUT_SECTIONS.
5457 (Output_section::build_lookup_maps): New method declaration.
5458 (Output_section::merge_section_map_,
5459 Output_section::merge_section_by_properties_map_,
5460 Output_section::relaxed_input_section_map_,
5461 Output_section::is_relaxed_input_section_map_valid_): Remove data
5462 members.
5463 (Output_section::lookup_maps_): New data member.
5464
5465 2010-05-21 Doug Kwan <dougkwan@google.com>
5466
5467 PR gold/11619
5468 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5469 avoid a compilation error.
5470
5471 2010-05-19 Rafael Espindola <espindola@google.com>
5472
5473 * script-sections.cc (Output_section_definition::allocate_to_segment):
5474 Update the phdrs_list even when the output section is NULL.
5475 * testsuite/Makefile.am: Add test.
5476 * testsuite/Makefile.in: Regenerate.
5477 * testsuite/script_test_9.cc: New.
5478 * testsuite/script_test_9.sh: New.
5479 * testsuite/script_test_9.t: New.
5480
5481 2010-05-19 Doug Kwan <dougkwan@google.com>
5482
5483 * arm.cc (Arm_input_section::original_size): New method.
5484 (Arm_input_section::do_addralign): Add a cast.
5485 (Arm_input_section::do_output_offset): Remove static cast.
5486 (Arm_input_section::original_addralign,
5487 Arm_input_section::original_size_): Change type to uint32_t.
5488 (Arm_input_section::init): Add safe casts for section alignment
5489 and size.
5490 (Arm_input_section::set_final_data_size): Do not set address and
5491 offset of stub table.
5492 (Arm_output_section::fix_exidx_coverage): Change use of of
5493 Output_section::Simple_input_section to that of
5494 Output_section::Input_section.
5495 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5496 except for the first pass.
5497 * output.cc (Output_section::get_input_sections): Change type of
5498 input_sections to std::list<Input_section>.
5499 (Output_section::add_script_input_section): Rename from
5500 Output_section::add_simple_input_section. Change type of SIS
5501 parameter from Simple_input_section to Input_section.
5502 * output.h (Output_section::Simple_input_section): Remove class.
5503 (Output_section::Input_section): Change class visibility to public.
5504 (Output_section::Input_section::addralign): Use stored alignments
5505 for special input sections if set.
5506 (Output_section::Input_section::set_addralign): New method.
5507 (Output_section::get_input_sections): Change parameter type from
5508 list of Simple_input_section to list of Input_section.
5509 (Output_section::add_script_input_section): Rename from
5510 Output_section::add_simple_input_section. Change first parameter's
5511 type from Simple_input_section to Input_section and remove the
5512 second and third parameters.
5513 * script-sections.cc (Input_section::Input_section_list): Change
5514 type to list of Output_section::Input_section/
5515 (Input_section_info::Input_section_info): Change parameter type of
5516 INPUT_SECTION to Output_section::Input_section.
5517 (Input_section_info::input_section): Change return type.
5518 (Input_section_info::input_section_): Change type to
5519 Output_section::Input_section.
5520 (Output_section_element_input::set_section_addresses): Adjust code
5521 to use Output_section::Input_section instead of
5522 Output_section::Simple_input_section. Adjust code for renaming
5523 of Output_section::add_simple_input_section.
5524 (Orphan_output_section::set_section_addresses): Ditto.
5525
5526 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5527
5528 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5529 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5530
5531 2010-05-18 Rafael Espindola <espindola@google.com>
5532
5533 * options.cc (General_options::finalize): Handle -nostdlib.
5534 * options.h (nostdlib): New option.
5535 * script.cc (script_add_search_dir): Handle -nostdlib.
5536
5537 2010-05-12 Doug Kwan <dougkwan@google.com>
5538
5539 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5540 attributes section only if there no attributes section after merging.
5541 (Target_arm::merge_object_attributes): Move value of
5542 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5543 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5544 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5545 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5546 and arm_attr_merge_7.stdout.
5547 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5548 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5549 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5550 arm_attr_merge_7b.o): New rules.
5551 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5552 arm_attr_merge_7
5553 * testsuite/Makefile.in: Regenerate.
5554 * testsuite/arm_attr_merge.sh: New file.
5555 * testsuite/arm_attr_merge_[67][ab].s: Same.
5556
5557 2010-05-05 Nick Clifton <nickc@redhat.com>
5558
5559 * po/es.po: Updated Spanish translation.
5560
5561 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5562
5563 * Makefile.am (install-exec-local): Properly install gold as
5564 default cross linker.
5565 * Makefile.in: Regenerated.
5566
5567 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5568 Nick Clifton <nickc@redhat.com>
5569
5570 * configure.ac (install_as_default): Define and set to false
5571 unless --enable-gold or --enable-gold=both/gold has been
5572 specified.
5573 * configure: Regenerate.
5574
5575 * Makefile.am (install-exec-local): Install the executable as
5576 'ld.gold'. If install_as_default is true then also install it as
5577 'ld'.
5578 * Makefile.in: Regenerated.
5579
5580 2010-04-24 Ian Lance Taylor <iant@google.com>
5581
5582 * layout.cc (Layout::layout_reloc): In relocatable link don't
5583 combine reloc sections for grouped sections.
5584
5585 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5586
5587 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5588 sections that are not ordinary to icf.
5589 * icf.cc (get_section_contents): Handle relocation pointing to section
5590 with no object or shndx information.
5591 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5592 * testsuite/Makefile.in: Regenerate.
5593 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5594 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5595
5596 2010-04-22 Ian Lance Taylor <iant@google.com>
5597
5598 * expression.cc (Expression::Expression_eval_info): Add
5599 result_alignment_pointer field.
5600 (Expression::eval_with_dot): Add result_alignment_pointer
5601 parameter. Change all callers.
5602 (Expression::eval_maybe_dot): Likewise.
5603 (class Binary_expression): Add alignment_pointer parameter to
5604 left_value and right_value. Change all callers.
5605 (BINARY_EXPRESSION): Set result alignment.
5606 (class Trinary_expression): Add alignment_pointer parameter to
5607 arg2_value and arg3_value. Change all callers.
5608 (Trinary_cond::value): Set result alignment.
5609 (Max_expression::value, Min_expression::value): Likewise.
5610 (Align_expression::value): Likewise.
5611 * script-sections.cc (class Sections_element): Add dot_alignment
5612 parameter to set_section_addresses virtual function. Update
5613 instantiations.
5614 (class Output_section_element): Likewise.
5615 (Script_sections::create_segments): Add dot_alignment parameter.
5616 Change all callers.
5617 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5618 (Script_sections::set_phdrs_clause_addresses): Likewise.
5619 * script-sections.h: Update declarations.
5620 * script.h: Update declarations.
5621 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5622 min_p_align.
5623 * testsuite/script_test_3.t: Set large alignment.
5624 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5625 segment has expected alignment.
5626
5627 2010-04-22 Nick Clifton <nickc@redhat.com>
5628
5629 * po/gold.pot: Updated by the Translation project.
5630 * po/vi.po: Updated Vietnamese translation.
5631
5632 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5633
5634 * testsuite/Makefile.am (check_PROGRAMS): Add
5635 icf_virtual_function_folding_test.
5636 * testsuite/Makefile.in: Regenerated.
5637
5638 2010-04-15 Andrew Haley <aph@redhat.com>
5639
5640 * options.h (merge_exidx_entries): New option.
5641 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5642 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5643 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5644 (Target_arm::merge_exidx_entries): New function.
5645 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5646 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5647 to Arm_exidx_fixup constructor.
5648 Add new arg, merge_exidx_entries.
5649 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5650 Arm_output_section::fix_exidx_coverage.
5651
5652 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5653
5654 * icf.cc (get_section_contents): Check for preemptible functions.
5655 Ignore addend when appropriate.
5656 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5657 section folded.
5658 (add_from_relobj): Check for section folded.
5659 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5660 * symtab.h (should_add_dynsym_entry): Add new parameter.
5661 * target-reloc.h (scan_relocs): Check for section folded.
5662 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5663 Check reloc types for function pointers in shared objects.
5664 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5665 case.
5666 (icf_preemptible_functions_test): New test case.
5667 (icf_string_merge_test): New test case.
5668 * testsuite.Makefile.in: Regenerate.
5669 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5670 bar_glob. Refactor code.
5671 * testsuite/icf_preemptible_functions_test.cc: New file.
5672 * testsuite/icf_preemptible_functions_test.sh: New file.
5673 * testsuite/icf_string_merge_test.cc: New file.
5674 * testsuite/icf_string_merge_test.sh: New file.
5675 * testsuite/icf_virtual_function_folding_test.cc: New file.
5676 * testsuite/icf_virtual_function_folding_test.sh: New file.
5677
5678 2010-04-14 Doug Kwan <dougkwan@google.com>
5679
5680 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5681 for local symbol recounting if we remove a section due to ICF.
5682 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5683 there are no regular objects in input.
5684
5685 2010-04-13 Doug Kwan <dougkwan@google.com>
5686
5687 * arm.cc (Arm_input_section::set_final_data_size): Compute
5688 accurate final data size instead of using current data size.
5689
5690 2010-04-09 Doug Kwan <dougkwan@google.com>
5691
5692 * layout.cc (Layout::choose_output_section): Handle script section
5693 types.
5694 (Layout::make_output_section_for_script): Add section type parameter.
5695 Handle script section types.
5696 * layout.h (Layout::make_output_section_for_script): Add section
5697 type parameter.
5698 * output.cc (Output_section::Output_section): Initialize data member
5699 is_noload_.
5700 (Output_section::do_reset_address_and_file_offset): Do not set address
5701 to 0 if section is a NOLOAD section.
5702 * output.h (Output_section::is_noload): New method.
5703 (Output_section::set_is_noload): Ditto.
5704 (Output_section::is_noload_): New data member.
5705 * script-c.h (Script_section_type): New enum type.
5706 (struct Parser_output_section_header): Add new file section_type.
5707 * script-sections.cc (Sections_element::output_section_name): Add
5708 parameter for returning script section type.
5709 (Output_section_definition::output_section_name): Ditto.
5710 (Output_section_definition::section_type)P; New method.
5711 (Output_section_definiton::script_section_type_name): Ditto.
5712 (Output_section_definition::script_section_type_): New data member.
5713 (Output_section_definition::Output_section_definition): Initialize
5714 data member Output_section_definition::script_section_type_.
5715 (Output_section_definition::create_sections): Pass script section type
5716 to Layout::make_output_section_for_script.
5717 (Output_section_definition::output_section_name): Return script
5718 section type to caller.
5719 (Output_section_definition::set_section_address): Do not advance
5720 dot value and load address if section type is NOLOAD. Set address
5721 of NOLOAD sections regardless of section flags.
5722 (Output_section_definition::print): Print section type if it is
5723 not SCRIPT_SECTION_TYPE_NONE.
5724 (Output_section_definition::section_type): New method.
5725 (Output_section_definition::script_section_type_name): Ditto.
5726 (Script_sections::output_section_name): Add new parameter
5727 PSECTION_TYPE for returning script section type. Pass it to
5728 section elements. Handle discard sections.
5729 (Sort_output_sections::operator()): Handle NOLOAD sections.
5730 * script-sections.h (Script_sections::Section_type): New enum type.
5731 (Script_sections::output_section_name): Add a new parameter for
5732 returning script section type.
5733 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5734 INFO and NOLOAD.
5735 * yyscript.y (union): Add new field SECTION_TYPE.
5736 (COPY, DSECT, INFO, NOLOAD): New tokens.
5737 (opt_address_and_section_type): Change type to output_section_header.
5738 (section_type): New non-terminal
5739 (section_header): Handle section type.
5740 (opt_address_and_section_type): Return section type value.
5741
5742 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5743
5744 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5745 * testsuite/plugin_common_test_2.c (foo): Likewise.
5746
5747 2010-04-08 Doug Kwan <dougkwan@google.com>
5748
5749 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5750 Output_merge_data.
5751 * output.cc (Output_section::add_merge_input_section): Simplify
5752 code and return status of Output_merge_base::add_input_section.
5753 Update merge section map only if Output_merge_base::add_input_section
5754 returns true.
5755
5756 2010-04-07 Doug Kwan <dougkwan@google.com>
5757
5758 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5759 if section is marked as containing instructions but has no mapping
5760 symbols.
5761 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5762 correct section index.
5763 (Arm_relobj::find_linked_text_section): Ditto.
5764
5765 2010-04-07 Cary Coutant <ccoutant@google.com>
5766
5767 * archive.cc (include_member): Destroy Read_symbols_data object before
5768 releasing file.
5769 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5770 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5771 (Read_symbols_data::~Read_symbols_data) New destructor.
5772 (Section_relocs::Section_relocs) New constructor.
5773 (Section_relocs::~Section_relocs) New destructor.
5774 (Read_relocs_data::Read_relocs_data) New constructor.
5775 (Read_relocs_data::~Read_relocs_data) New destructor.
5776 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5777 pointers to NULL after deleting.
5778
5779 2010-04-07 Doug Kwan <dougkwan@google.com>
5780
5781 * arm.cc: Replace "endianity" with "endianness" in comments.
5782 (Arm_exidx_cantunwind): Ditto.
5783 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5784 (Arm_relobj::merge_flags_and_attributes): New method.
5785 (Arm_relobj::merge_flags_and_attributes_): New data member.
5786 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5787 (Arm_relobj::scan_sections_for_stubs): Ditto.
5788 (Arm_relobj::do_read_symbols): Check to see if we really want to
5789 merge processor-specific flags and attributes. Exit early if
5790 an object is empty except for section names and the undefined symbol.
5791 (Target_arm::do_finalize_sections): Move check for ELF format to
5792 Arm_relobj::do_read_symbols. Merge processor specific flags and
5793 attributes from a regular object only when we have determined that
5794 it is aapropriate. Do not create an .ARM.attributes section in
5795 output if there is no regular input object.
5796 (Target_arm::merge_processor_specific_flags): Check
5797 --warn-mismatch before printing any error.
5798 (Target_arm::merge_object_attributes): Ditto.
5799 * gold.cc (queue_middle_tasks): Handle the case in which there is
5800 no regular object in input.
5801 * options.cc (General_options::parse_EB): New method.
5802 (General_options::parse_EL): Same.
5803 (General_options::General_options): Initialize endianness_.
5804 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5805 New options.
5806 (General_options::Endianness): New enum.
5807 (General_options::endianness): New method.
5808 (General_options::endianness_): New data member.
5809 * parameters.cc (Parameters::set_options): Check target endianness.
5810 (Parameters::set_target_once): Ditto.
5811 (Parameters::check_target_endianness): New method.
5812 (parameters_force_valid_target): If either -EL or -EB is specified,
5813 use it to define endianness of default target.
5814 * parameters.h (Parameters::check_target_endianness): New method
5815 declaration.
5816 * target.h (class Target): Change "endianity" to "endianness"
5817 in comments.
5818
5819 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5820
5821 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5822 * configure: Regenerate.
5823 * Makefile.in: Regenerate.
5824 * testsuite/Makefile.in: Regenerate.
5825
5826 2010-04-06 Cary Coutant <ccoutant@google.com>
5827
5828 gcc PR lto/42757
5829 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5830 prevailing definitions of common symbols.
5831 * testsuite/plugin_test_6.sh: New test case.
5832 * testsuite/plugin_common_test_1.c: New test case.
5833 * testsuite/plugin_common_test_2.c: New test case.
5834 * testsuite/Makefile.am (plugin_test_6): New test case.
5835 * testsuite/Makefile.in: Regenerate.
5836
5837 2010-04-06 Nick Clifton <nickc@redhat.com>
5838
5839 * po/vi.po: New Vietnamese translation.
5840
5841 2010-03-30 Doug Kwan <dougkwan@google.com>
5842
5843 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5844
5845 2010-03-25 Doug Kwan <dougkwan@google.com>
5846
5847 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5848 to avoid a conversion warning on a 32-bit host.
5849
5850 2010-03-24 Ian Lance Taylor <iant@google.com>
5851
5852 * testsuite/script_test_3.t: Add a TLS segment.
5853 * testsuite/Makefile.am (check_PROGRAMS): Add
5854 tls_phdrs_script_test.
5855 (tls_phdrs_script_test_SOURCES): Define.
5856 (tls_phdrs_script_test_DEPENDENCIES): Define.
5857 (tls_phdrs_script_test_LDFLAGS): Define.
5858 (tls_phdrs_script_test_LDADD): Define.
5859 * testsuite/Makefile.in: Rebuild.
5860
5861 2010-03-23 Cary Coutant <ccoutant@google.com>
5862
5863 * fileread.cc (find_or_make_view): Fix comment.
5864
5865 2010-03-23 Ian Lance Taylor <iant@google.com>
5866
5867 * script-sections.cc (class Orphan_section_placement): Define
5868 PLACE_TLS and PLACE_TLS_BSS.
5869 (Orphan_section_placement::Orphan_section_placement): Initialize
5870 new places.
5871 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5872 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5873 (tls_script_test_SOURCES): Define.
5874 (tls_script_test_DEPENDENCIES): Define.
5875 (tls_script_test_LDFLAGS): Define.
5876 (tls_script_test_LDADD): Define.
5877 * testsuite/Makefile.in: Rebuild.
5878
5879 2010-03-22 Doug Kwan <dougkwan@google.com>
5880
5881 * arm.cc (Arm_relocate_functions::abs8,
5882 Arm_relocate_functions::abs16): Use correct check for overflow
5883 specified in the ARM ELF specs.
5884 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5885 target of a BLX instruction specially.
5886 (Reloc_stub::stub_type_for_reloc): Ditto.
5887 (Relocate::relocate): Use symbolic names instead of numeric relocation
5888 codes to report error.
5889 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5890 workaround.
5891 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5892 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5893 thumb2_blx_out_of_range.stdout
5894 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5895 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5896 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5897 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5898 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5899 thumb2_blx_in_range, thumb2_blx_in_range.o,
5900 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5901 thumb2_blx_out_of_range.o): New rules.
5902 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5903 thumb2_blx_in_range and thumb2_blx_out_of_range.
5904 * testsuite/Makefile.in: Regenerate.
5905 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5906 * testsuite/thumb_blx_in_range.s: New file.
5907 * testsuite/thumb_blx_out_of_range.s: New file.
5908
5909 2010-03-22 Rafael Espindola <espindola@google.com>
5910
5911 * archive.cc (Should_include): Move to archive.h.
5912 (should_include_member): Make it a member of Archive.
5913 (Lib_group): New.
5914 (Add_lib_group_symbols): New.
5915 * archive.h: Include options.h.
5916 (Archive_member): Moved from Archive.
5917 (Should_include): Moved from archive.cc.
5918 (Lib_group): New.
5919 (Add_lib_group_symbols): New.
5920 * dynobj.cc (do_should_include_member): New.
5921 * dynobj.h (do_should_include_member): New.
5922 * gold.cc (queue_initial_tasks): Update call to queue.
5923 * main.cc (main): Print lib group stats.
5924 * object.cc (do_should_include_member): New.
5925 * object.h: Include archive.h.
5926 (Object::should_include_member): New.
5927 (Object::do_should_include_member): New.
5928 (Sized_relobj::do_should_include_member): New.
5929 * options.cc (General_options::parse_start_lib): New.
5930 (General_options::parse_end_lib): New.
5931 (Input_arguments::add_file): Handle lib groups.
5932 (Input_arguments::start_group): Check we are not in a lib.
5933 (Input_arguments::start_lib): New.
5934 (Input_arguments::end_lib): New.
5935 * options.h (General_options): Add start_lib and end_lib.
5936 (Input_argument::lib_): New.
5937 (Input_argument::lib): New.
5938 (Input_argument::is_lib): New.
5939 (Input_file_lib): New.
5940 (Input_arguments::in_lib_): New.
5941 (Input_arguments::in_lib): New.
5942 (Input_arguments::start_lib): New.
5943 (Input_arguments::end_lib_): New.
5944 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5945 in unused members as preempted.
5946 (Sized_pluginobj::do_should_include_member): New.
5947 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5948 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5949 return the blocker.
5950 (Read_symbols::do_whole_lib_group): New.
5951 (Read_symbols::do_lib_group): New.
5952 (Read_symbols::do_read_symbols): Handle lib groups.
5953 (Read_symbols::get_name): Handle lib groups.
5954 * readsyms.h (Read_symbols): Add an archive member pointer.
5955 (Read_symbols::do_whole_lib_group): New.
5956 (Read_symbols::do_lib_group): New.
5957 (Read_symbols::member_): New.
5958 * script.cc (read_input_script): Update call to queue_soon.
5959
5960 2010-03-19 Doug Kwan <dougkwan@google.com>
5961
5962 * arm.cc (Stub_table::Stub_table): Initialize new data members
5963 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5964 (Stub_table::add_reloc_stub): Assign stub offset and update
5965 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5966 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5967 New data members.
5968 (Stub_table::update_data_size_and_addralign): Use
5969 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5970 instead of going over all reloc stubs.
5971 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5972 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5973 Stringpool_template::offset_ to size of Stringpool_char.
5974 (Stringpool_template::new_key_offset): Remove code to initialize
5975 Stringpool_template::offset_.
5976 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5977 Stringpool_template::offset_ to zero.
5978
5979 2010-03-15 Doug Kwan <dougkwan@google.com>
5980
5981 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5982 offset_.
5983 (Stringpool_template::new_key_offset): New method.
5984 (Stringpool_template::add_string): Assign offsets when adding new
5985 strings.
5986 (Stringpool_template::set_string_offsets): Do not set string offsets
5987 when not optimizing.
5988 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5989 member size_.
5990 (Chunked_vector::clear): Clear size_.
5991 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5992 (Chunked_vector::size): Return size_.
5993 (Chunked_vector::push_back): Use size_ to find insert position.
5994 (Chunked_vector::size_): New data member.
5995 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5996 (Stringpool_template::new_key_offset): New method declaration.
5997 (Stringpool_template::offset_): New data member.
5998
5999 2010-03-15 Rafael Espindola <espindola@google.com>
6000
6001 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6002 Add_symbols' constructor.
6003 * readsyms.h (Add_symbols): Remove the input_group member.
6004
6005 2010-03-10 Ian Lance Taylor <iant@google.com>
6006
6007 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6008 target to ask whether a reference to a symbol requires a stack
6009 split.
6010 * target.h (Target::is_call_to_non_split): New function.
6011 (Target::do_is_call_to_non_split): Declare virtual function.
6012 * target.cc: Include "symtab.h".
6013 (Target::do_is_call_to_non_split): New function.
6014 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6015
6016 2010-03-10 Cary Coutant <ccoutant@google.com>
6017
6018 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6019 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6020 (File_read::open[2]): Add whole_file_view_ to list of views.
6021 (File_read::make_view): Remove test of whole_file_view_.
6022 (File_read::find_or_make_view): Create whole_file_view_ if
6023 necessary.
6024 (File_read::clear_views): Replace bool parameter with enum;
6025 adjust all callers. Don't delete views with permanent data;
6026 do delete cached views and views from archives if
6027 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6028 if clearing the corresponding view.
6029 * fileread.h (File_read::Clear_views_mode): New enum.
6030 (File_read::View::is_permanent_view): New method.
6031 (File_read::clear_views): Replace bool parameter
6032 with enum; adjust all callers.
6033 * options.h (General_options): Change keep_files_mapped option;
6034 add map_whole_files.
6035 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6036 releasing the file.
6037 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6038 the file.
6039
6040 2010-03-10 David S. Miller <davem@davemloft.net>
6041
6042 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6043
6044 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6045
6046 * icf.cc (get_section_contents): Add '@' marker after processing the
6047 merge reloc.
6048
6049 2010-03-08 Doug Kwan <dougkwan@google.com>
6050
6051 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6052 due to a conversion warning.
6053 (Arm_relobj::update_output_local_symbol_count): Check for local
6054 symbol with unset output index.
6055
6056 2010-03-05 Ian Lance Taylor <iant@google.com>
6057
6058 * options.h (class General_options): Add --spare-dynamic-tags.
6059 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6060 --spare-dynamic-tags.
6061
6062 2010-03-05 Ian Lance Taylor <iant@google.com>
6063
6064 * incremental.cc: Include "libiberty.h".
6065
6066 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6067
6068 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6069 function, is_info_ member.
6070 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6071 (Versions::Versions): Update caller.
6072 (Versions::define_base_version): Likewise.
6073 (Versions::add_def): Likewise.
6074
6075 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6076
6077 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6078 (Scan::possible_function_pointer_reloc): New function.
6079 (Scan::local_reloc_may_be_function_pointer): Change to call
6080 possible_function_pointer_reloc.
6081 (Scan::global_reloc_may_be_function_pointer): Ditto.
6082 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6083 relocations in ".data.rel.ro._ZTV" section.
6084 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6085 * testsuite/icf_safe_so_test.cc: Ditto.
6086 * testsuite/icf_safe_test.cc: Ditto.
6087 * testsuite/icf_safe_test.sh: Ditto.
6088
6089 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6090 Ian Lance Taylor <iant@google.com>
6091
6092 * target-reloc.h (relocate_section): Check the symbol table index
6093 for -1U before setting the local symbol index.
6094 (scan_relocatable_relocs): If copying the relocation, record that
6095 the local symbol is required.
6096 * object.h (Symbol_value::is_output_symtab_index_set): New
6097 function.
6098 (Symbol_value::may_be_discarded_from_output_symtab): New
6099 function.
6100 (Symbol_value::has_output_symtab_entry): New function.
6101 (Symbol_value::needs_output_symtab_entry): Remove.
6102 (Symbol_value::output_symtab_index): Make sure the symbol index is
6103 set.
6104 (Symbol_value::set_output_symtab_index): Make sure the symbol
6105 index is not set. Make sure the new index is valid.
6106 (Symbol_value::set_must_have_output_symtab_entry): New function.
6107 (Symbol_value::has_output_dynsym_entry): New function.
6108 (Symbol_value::set_output_dynsym_index): Make sure the new index
6109 is valid.
6110 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6111 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6112 local symbol if permitted.
6113 (Sized_relobj::do_finalize_local_symbols): Call
6114 is_output_symtab_index_set rather than needs_output_symtab_entry.
6115 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6116 rather than needs_output_symtab_entry. Call
6117 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6118 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6119 is_output_symtab_index_set rather than needs_output_symtab_entry.
6120 * testsuite/discard_locals_relocatable_test.c: New file.
6121 * testsuite/discard_locals_test.sh: Test -r.
6122 * testsuite/Makefile.am (check_DATA): Add
6123 discard_locals_relocatable_test1.syms,
6124 discard_local_relocatable_test2.syms.
6125 (MOSTLYCLEANFILES): Likewise. Also add
6126 discard_locals_relocatable_test1.lout and
6127 discard_locals_relocatable_test2.out.
6128 (discard_locals_relocatable_test1.syms): New target.
6129 (discard_locals_relocatable_test.o): New target.
6130 (discard_locals_relocatable_test1.out): New target.
6131 (discard_locals_relocatable_test2.syms): New target.
6132 (discard_locals_relocatable_test2.out): New target.
6133 (various): Add missing ../ld-new dependencies.
6134 * testsuite/Makefile.in: Rebuild.
6135
6136 2010-03-03 Nick Clifton <nickc@redhat.com>
6137
6138 * po/fi.po: New Finnish translation.
6139
6140 2010-03-01 Doug Kwan <dougkwan@google.com>
6141
6142 * layout.cc (Layout::Layout): Force section types of .init_array*,
6143 .preinit_array* and .fini_array* sections.
6144 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6145 Fix check of return value of std::string::find.().
6146 (Output_section::Input_section_sort_compare::operator()): Remove
6147 comment about .init_array.
6148 (Output_section::Input_section_sort_init_fini_compare::operator()):
6149 New method.
6150 (Output_section::sort_attached_input_sections): Handle .init_array
6151 and .fini_array specially.
6152 * output.h (Output_section::Inut_section_sort_compare): Update
6153 comment.
6154 (Output_section::Input_section_sort_init_fini_compare): New struct.
6155
6156 2010-02-26 Doug Kwan <dougkwan@google.com>
6157
6158 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6159 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6160 * testsuite/debug_msg.sh: Avoid matching source line number for
6161 use of global variable undef_int.
6162
6163 2010-02-26 Doug Kwan <dougkwan@google.com>
6164
6165 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6166 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6167 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6168 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6169 * options.cc (General_options::General_options): Initialize member
6170 fix_v4bx_.
6171 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6172 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6173 and rm_no_fix_v4bx.stdout
6174 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6175 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6176 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6177 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6178 and arm_no_fix_v4bx.
6179 * Makefile.in: Regenerate.
6180 * testsuite/arm_fix_v4bx.s: New file.
6181 * testsuite/arm_fix_v4bx.sh: Ditto.
6182
6183 2010-02-24 Doug Kwan <dougkwan@google.com>
6184
6185 * arm.cc (Target_arm::got_section): Make the .got section the first
6186 non RELRO section in the data segment.
6187 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6188 suffixes of section names.
6189
6190 2010-02-24 Doug Kwan <dougkwan@google.com>
6191
6192 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6193 flags and attributes merging if an input file is a binary file.
6194 * fileread.cc (Input_file::open): Record format of original file.
6195 * fileread.h (Input_file::Format): New enum type.
6196 (Input_file::Input_file): Initialize data member format_.
6197 (Input_file::format): New method definition.
6198 (Input_file::format_):: New data member.
6199
6200 2010-02-24 Doug Kwan <dougkwan@google.com>
6201
6202 * arm.cc (Arm_output_data_got): New class.
6203 (ARM_TCB_SIZE): New constant
6204 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6205 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6206 If user uses a script with a SECTIONS clause, issue only a warning
6207 for a misplaced EXIDX input section. Otherwise, issue an error.
6208 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6209 garbage collection.
6210 (Target_arm::got_mode_index_entry): Handle static linking.
6211 (Target_arm::Scan::local): Ditto.
6212 (Target_arm::Scan::global): Ditto.
6213 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6214 all incorrectly implemented relocations.
6215 (Target_arm::fix_exidx_coverage): Pass layout to
6216 Arm_output_section::fix_exidx_coverage.
6217 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6218 from ".ARM.exidx." and ".ARM.extab.".
6219
6220 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6221
6222 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6223 section if it does not already exist.
6224 * attributes.cc (Attributes_section_data::Attributes_section_data):
6225 Don't crash if size is zero.
6226
6227 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6228 Ian Lance Taylor <iant@google.com>
6229
6230 * gold.cc (queue_middle_tasks): If no input files were opened,
6231 exit.
6232 * workqueue.h (Task_function::Task_function): Assert that there is
6233 a blocker.
6234
6235 2010-02-22 Doug Kwan <dougkwan@google.com>
6236
6237 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6238 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6239 types to avoid warnings due to different uint64_t implementations
6240 on different hosts.
6241
6242 2010-02-21 Doug Kwan <dougkwan@google.com>
6243
6244 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6245 handling of the maximum backward branch offset.
6246 (Arm_relocate_functions::thumb_branch_common): Ditto.
6247 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6248 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6249 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6250 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6251 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6252 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6253 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6254 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6255 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6256 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6257 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6258 thumb2_bl_out_of_range.o): New rules.
6259 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6260 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6261 thumb2_bl_out_of_range
6262 * testsuite/Makefile.in: Regenerate.
6263 * testsuite/arm_bl_in_range.s: New file.
6264 * testsuite/arm_bl_out_of_range.s: Ditto.
6265 * testsuite/arm_branch_in_range.sh: Ditto.
6266 * testsuite/arm_branch_range.t: Ditto.
6267 * testsuite/thumb2_branch_range.t: Ditto.
6268 * testsuite/thumb_bl_in_range.s: Ditto.
6269 * testsuite/thumb_bl_out_of_range.s: Ditto.
6270 * testsuite/thumb_branch_range.t: Ditto.
6271
6272 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6273
6274 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6275 Add reloc offset information.
6276 * icf.cc (get_section_contents): Change iterators to point to the new
6277 vectors. Add reloc offset information to the contents.
6278 * icf.h (Icf::Sections_reachable_info): New typedef.
6279 (Icf::Sections_reachable_list): New typedef.
6280 (Icf::Offset_info): New typedef.
6281 (Icf::Reloc_info): New struct typedef.
6282 (Icf::Reloc_info_list): New typedef.
6283 (Icf::symbol_reloc_list): Delete method.
6284 (Icf::addend_reloc_list): Delete method.
6285 (Icf::section_reloc_list): Delete method.
6286 (Icf::reloc_info_list): New method.
6287 (Icf::reloc_info_list_): New member.
6288
6289 2010-02-19 Doug Kwan <dougkwan@google.com>
6290
6291 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6292 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6293 * arm.cc (Arm_relocation_functions): New forward declaration.
6294 (Target_arm::Target_arm): Initialize new data members
6295 got_mod_index_offset_ and tls_base_symbol_defined_.
6296 (Target_arm::Relocate::relocate_tls): New method.
6297 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6298 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6299 New methods.
6300 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6301 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6302 (Target_arm::got_mod_index_offset_,
6303 Target_arm::tls_base_symbol_defined_): New data members.
6304 (Target_arm::Scan::local, Target::Scan::global,
6305 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6306 relocations.
6307
6308 2010-02-18 Doug Kwan <dougkwan@google.com>
6309
6310 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6311 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6312 text section as a parameter becuase some broken tools may not set
6313 the link in section header.
6314 (Target_arm::has_got_section): New method.
6315 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6316 without any mapping symbol as data only. Remove warning.
6317 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6318 link in its section header, try to discover the link by inspecting the
6319 REL31 relocation at the beginning of the section.
6320 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6321 in error message.
6322 (Target_arm::Scan::global): Treat any reference to the symbol
6323 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6324
6325 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6326
6327 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6328 (Scan::global_reloc_may_be_function_pointer): New function.
6329 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6330 (Scan::global_reloc_may_be_function_pointer): New function.
6331 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6332 (Scan::global_reloc_may_be_function_pointer): New function.
6333 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6334 (Scan::global_reloc_may_be_function_pointer): New function.
6335 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6336 (Scan::global_reloc_may_be_function_pointer): New function.
6337 (Scan::possible_function_pointer_reloc): New function.
6338 (Target_x86_64::can_check_for_function_pointers): New function.
6339 * gc.h (gc_process_relocs): Scan relocation types to determine if
6340 function pointers were taken for targets that support it.
6341 * icf.cc (Icf::find_identical_sections): Include functions for
6342 folding in safe ICF whose pointer is not taken.
6343 * icf.h (Secn_fptr_taken_set): New typedef.
6344 (fptr_section_id_): New member.
6345 (section_has_function_pointers): New function.
6346 (set_section_has_function_pointers): New function.
6347 (check_section_for_function_pointers): New function.
6348 * options.h: Fix comment for safe ICF option.
6349 * target.h (can_check_for_function_pointers): New function.
6350 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6351 Modify icf_safe_test for X86-64.
6352 * testsuite/Makefile.in: Regenerate.
6353 * testsuite/icf_safe_so_test.cc: New file.
6354 * testsuite/icf_safe_so_test.sh: New file.
6355 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6356 (main): Change to take pointer to function kept_func_3.
6357 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6358 folding is done correctly for X86-64.
6359
6360 2010-02-12 David S. Miller <davem@davemloft.net>
6361
6362 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6363 is_symbolless parameter.
6364 (Output_reloc<SHT_REL>::is_symbolless): New.
6365 (Output_reloc<SHT_REL>::is_symbolless_): New.
6366 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6367 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6368 (Output_reloc<SHT_RELA>::is_symbolless): New.
6369 (Output_data_reloc::add_global): Handle is_symbolless.
6370 (Output_data_reloc::add_global_relative): Likewise.
6371 (Output_data_reloc::add_local): Likewise.
6372 (Output_data_reloc::add_local_relative): Likewise.
6373 (Output_data_reloc::add_symbolless_global_addend): New.
6374 (Output_data_reloc::add_symbolless_local_addend): New.
6375 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6376 is_symbolless.
6377 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6378 instead of ->is_relative_
6379 (Output_reloc::write): Likewise.
6380 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6381 (Output_reloc::write_rel): Simplify.
6382
6383 * sparc.cc (Target_sparc::Scan::local): Use
6384 ->add_symbolless_local_addend as needed.
6385 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6386 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6387 based upon relocation offset.
6388
6389 2010-02-11 Doug Kwan <dougkwan@google.com>
6390
6391 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6392 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6393 beginning of function.
6394 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6395 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6396 parameter is_32bit in calls to should_apply_static_reloc.
6397 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6398 (check_DATA): Add arm_abs_global.stdout.
6399 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6400 arm_abs_global.stdout): New rules.
6401 (MOSTLLYCLEANFILES): Add arm_abs_global
6402 * Makefile.in: Regenerate.
6403 * testsuite/arm_abs_global.s: New file.
6404 * testsuite/arm_abs_global.sh: Ditto.
6405 * testsuite/arm_abs_lib.s: Ditto.
6406
6407 2010-02-11 Ian Lance Taylor <iant@google.com>
6408
6409 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6410 Read_relocs task.
6411 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6412 Allocate_commons_task first.
6413 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6414 task, rather than symtab_lock_.
6415 (Gc_process_relocs::~Gc_process_relocs): New function.
6416 (Gc_process_relocs::is_runnable): Check this_blocker_.
6417 (Gc_process_relocs::locks): Use next_blocker_ rather than
6418 blocker_.
6419 (Scan_relocs::~Scan_relocs): New function.
6420 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6421 symtab_lock_.
6422 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6423 next_blocker_.
6424 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6425 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6426 constructor accordingly.
6427 (class Gc_process_relocs): Likewise.
6428 (class Scan_relocs): Likewise.
6429 * common.h (class Allocate_commons_task): Remove symtab_lock_
6430 field, and corresponding constructor parameter.
6431 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6432 symtab_lock_.
6433 (Allocate_commons_task::locks): Likewise.
6434
6435 2010-02-11 Ian Lance Taylor <iant@google.com>
6436
6437 * gold-threads.h (class Once): Define.
6438 (class Initialize_lock): Rewrite as child of Once.
6439 * gold-threads.cc (class Once_initialize): Define.
6440 (once_pointer_control): New static variable.
6441 (once_pointer, once_arg): New static variables.
6442 (c_run_once): New static function.
6443 (Once::Once, Once::run_once, Once::internal_run): New functions.
6444 (class Initialize_lock_once): Remove.
6445 (initialize_lock_control): Remove.
6446 (initialize_lock_pointer): Remove.
6447 (initialize_lock_once): Remove.
6448 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6449 (Initialize_lock::initialize): Rewrite.
6450 (Initialize_lock::do_run_once): New function.
6451 * archive.cc (Archive::interpret_header): Only clear name if it is
6452 not already empty.
6453 * fileread.cc: Include "gold-threads.h"
6454 (file_counts_lock): New static variable.
6455 (file_counts_initialize_lock): Likewise.
6456 (File_read::release): Only increment counts when using --stats.
6457 Use a lock around the increment.
6458 * parameters.cc (class Set_parameters_target_once): Define.
6459 (set_parameters_target_once): New static variable.
6460 (Parameters::Parameters): Move here from parameters.h.
6461 (Parameters::set_target): Rewrite.
6462 (Parameters::set_target_once): New function.
6463 (Parameters::clear_target): Move here and rewrite.
6464 * parameters.h (class Parameters): Update declarations. Add
6465 set_parameters_target_once_ field.
6466 (Parameters::Parameters): Move to parameters.cc.
6467 (Parameters::clear_target): Likewise.
6468 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6469 task.
6470 (Start_group::~Start_group): New function.
6471 (Start_group::is_runnable): New function.
6472 (Start_group::locks, Start_group::run): New functions.
6473 (Finish_group::run): Change saw_undefined to size_t.
6474 * readsyms.h (class Start_group): Define.
6475 (class Finish_group): Change saw_undefined_ field to size_t.
6476 (Finish_group::Finish_group): Remove saw_undefined and
6477 this_blocker parameters. Change all callers.
6478 (Finish_group::set_saw_undefined): New function.
6479 (Finish_group::set_blocker): New function.
6480 * symtab.h (class Symbol_table): Change saw_undefined to return
6481 size_t. Change saw_undefined_ field to size_t.
6482 * target-select.cc (Set_target_once::do_run_once): New function.
6483 (Target_selector::Target_selector): Initialize set_target_once_
6484 field. Don't initialize lock_ and initialize_lock_ fields.
6485 (Target_selector::instantiate_target): Rewrite.
6486 (Target_selector::set_target): New function.
6487 * target-select.h (class Set_target_once): Define.
6488 (class Target_selector): Update declarations. Make
6489 Set_target_once a friend. Remove lock_ and initialize_lock_
6490 fields. Add set_target_once_ field.
6491
6492 2010-02-10 Ian Lance Taylor <iant@google.com>
6493
6494 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6495 queueing any tasks.
6496 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6497 (queue_middle_tasks): Add all blockers before queueing any tasks.
6498 (queue_final_tasks): Likewise.
6499 * token.h (Task_token::add_blockers): New function.
6500 * object.h (Input_objects::number_of_relobjs): New function.
6501
6502 2010-02-10 Ian Lance Taylor <iant@google.com>
6503
6504 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6505 shared, not if not position independent.
6506 * x86_64.cc (Relocate::relocate_tls): Likewise.
6507 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6508 (tls_pie_pic_test): New target.
6509 * testsuite/Makefile.in: Rebuild.
6510
6511 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6512 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6513 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6514 * testsuite/Makefile.in: Rebuild.
6515
6516 2010-02-09 David S. Miller <davem@davemloft.net>
6517
6518 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6519 R_SPARC_RELATIVE using ->add_local_relative().
6520 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6521
6522 * output.h (Output_data_dynamic::add_section_size): New method
6523 that takes two Output_data objects.
6524 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6525 entry param. Handle it in initializers.
6526 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6527 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6528 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6529 arg.
6530 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6531 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6532 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6533 for dynrel_includes_plt.
6534 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6535 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6536 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6537 before .rela.plt
6538 (Target_sparc::do_finalize_sections): Update to pass true for
6539 dynrel_includes_plt.
6540 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6541 output before .rela.plt
6542 (Target_powerpc::do_finalize_sections): Update to pass true for
6543 dynrel_includes_plt when 32-bit.
6544
6545 2010-02-08 Doug Kwan <dougkwan@google.com>
6546
6547 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6548 method.
6549 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6550 Arm_relobj::scan_section_for_cortex_a8_stubs,
6551 Arm_relobj::do_relocation_section): Instead of calling
6552 Output_section::output_address, use faster
6553 Arm_relobj::simple_input_section_output_address.
6554
6555 2010-02-08 David S. Miller <davem@davemloft.net>
6556
6557 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6558 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6559 relocation helper function.
6560
6561 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6562 just like R_SPARC_GOT{10,13,22}.
6563 (Target_sparc::Scan::local): Likewise.
6564 (Target_sparc::Relocate:relocate): Likewise.
6565
6566 2010-02-06 Ian Lance Taylor <iant@google.com>
6567
6568 * configure.ac: Rewrite targetobjs duplicate removal code to use
6569 only shell constructs.
6570 * configure: Rebuild.
6571
6572 2010-02-05 Doug Kwan <dougkwan@google.com>
6573
6574 PR 11247
6575 * arm.cc (Arm_relobj::section_is_scannable): New method.
6576 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6577 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6578
6579 2010-02-04 Doug Kwan <dougkwan@google.com>
6580
6581 PR 11247
6582 * arm-reloc-property.cc (cstdio): Include.
6583 * configure.ac (targetobjs): Remove duplicates.
6584 * configure: Regenerate.
6585 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6586 big and little endian version for a given address size.
6587
6588 2010-02-03 Doug Kwan <dougkwan@google.com>
6589
6590 * arm-reloc-property.cc
6591 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6592 definition.
6593 * arm-reloc-property.h
6594 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6595 New method definition.
6596 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6597 declaration.
6598 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6599 overflow to N.
6600 (GOT_PREL): Change implemented to Y.
6601 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6602 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6603 (Arm_relocate_functions::movw_abs_nc): Remove method.
6604 (Arm_relocate_functions::movt_abs): Ditto.
6605 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6606 (Arm_relocate_functions::thm_movt_abs): Ditto.
6607 (Arm_relocate_functions::movw_rel_nc): Ditto.
6608 (Arm_relocate_functions::movw_rel): Ditto.
6609 (Arm_relocate_functions::movt_rel): Ditto.
6610 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6611 (Arm_relocate_functions:thm_movw_rel): Ditto.
6612 (Arm_relocate_functions:thm_movt_rel): Ditto.
6613 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6614 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6615 New method definitions.
6616 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6617 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6618 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6619 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6620 (Target_arm::Relocate::relocate): Check for non-static or
6621 unimplemented relocation code and exit early. Change calls to
6622 Target_arm::reloc_uses_thumb_bit and
6623 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6624 instead. Refactor code to handle similar relocations to increase
6625 code sharing. Remove check for unsupported relocation code in switch
6626 statement.
6627 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6628 relocation property table to find out size. Change error message to
6629 print out the name of a relocation code instead of the numeric value.
6630 (Target_arm::scan_reloc_for_stub): Use relocation property table
6631 instead of calling Target_arm::reloc_uses_thumb_bit().
6632
6633 2010-02-02 Doug Kwan <dougkwan@google.com>
6634
6635 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6636 types of relaxed input section.
6637
6638 2010-02-02 Doug Kwan <dougkwan@google.com>
6639
6640 * Makefile.am (HFILES): Add arm-reloc-property.h.
6641 (DEFFILES): New.
6642 (TARGETSOURCES): Add arm-reloc-property.cc
6643 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6644 (libgold_a_SOURCES): $(DEFFILES)
6645 * Makefile.in: Regenerate.
6646 * arm-reloc-property.cc: New file.
6647 * arm-reloc-property.h: New file.
6648 * arm-reloc.def: New file.
6649 * arm.cc: Update comments.
6650 (arm-reloc-property.h): New included header.
6651 (arm_reloc_property_table): New global variable.
6652 (Target_arm::do_select_as_default_target): New method definition.
6653 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6654 arm-reloc-property to targ_extra_obj.
6655 * parameters.cc (set_parameters_target): Call
6656 Target::select_as_default_target().
6657 * target.h (Target::select_as_default_target): New method definition.
6658 (Target::do_select_as_default_target): Same.
6659
6660 2010-02-01 Doug Kwan <dougkwan@google.com>
6661
6662 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6663 first_output_text_section_.
6664 (Arm_exidx_fixup::first_output_text_section): New method definition.
6665 (Arm_exidx_fixup::first_output_text_section_): New data member.
6666 (Arm_exidx_fixup::process_exidx_section): Record the first text
6667 output section seen.
6668 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6669 and entsize in output section header.
6670
6671 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6672
6673 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6674 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6675 (Arm_relocate_functions::thm_alu11): New Method.
6676 (Arm_relocate_functions::thm_pc8): New Method.
6677 (Arm_relocate_functions::thm_pc12): New Method.
6678 (Target_arm::Scan::local): Handle the relocations.
6679 (Target_arm::Scan::global): Likewise.
6680 (Target_arm::Relocate::relocate): Likewise.
6681 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6682
6683 2010-01-29 Doug Kwan <dougkwan@google.com>
6684
6685 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6686 of relocation types as ld.
6687
6688 2010-01-29 Doug Kwan <dougkwan@google.com>
6689
6690 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6691 to public.
6692 (Arm_relocate_functions::thumb_branch_common): Ditto.
6693 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6694 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6695 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6696 Arm_relocate_functions::jump24): Remove.
6697 (Target_arm::Relocate::relocate): Adjust code to call
6698 Arm_relocation_functions::arm_branch_common and
6699 Arm_relocation_functions::thumb_branch_common instead of their removed
6700 wrappers. Merge switch-cases together to reduce source code size.
6701
6702 2010-01-29 Doug Kwan <dougkwan@google.com>
6703
6704 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6705 output_local_symbol_count_needs_update_.
6706 (Arm_relobj::output_local_symbol_count_needs_update,
6707 Arm_relobj::set_output_local_symbol_count_needs_update,
6708 Arm_relobj::update_output_local_symbol_count): New methods.
6709 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6710 member.
6711 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6712 of pointed function as in a R_ARM_PREL31 relocation.
6713 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6714 for output local symbol count updating.
6715 (Target_arm::do_relax): Update output local symbol counts in objects
6716 if necessary.
6717 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6718
6719 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6720
6721 * arm.cc: Added support for the ARM relocations:
6722 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6723 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6724 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6725 movw_prel_nc).
6726 (Arm_relocate_functions::movw_rel): New method.
6727 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6728 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6729 thm_movw_prel_nc).
6730 (Arm_relocate_functions::thm_movw_rel): New method.
6731 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6732 thm_movt_prel).
6733 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6734 relocations.
6735 (Target_arm::Scan::global): Likewise.
6736 (Target_arm::Relocate::relocate): Likewise.
6737 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6738 Likewise.
6739
6740 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6741
6742 * arm.cc: Added support for ARM group relocations.
6743 (Target_arm::reloc_needs_sym_origin): New method.
6744 (Arm_relocate_functions::calc_grp_kn): New method.
6745 (Arm_relocate_functions::calc_grp_residual): New method.
6746 (Arm_relocate_functions::calc_grp_gn): New method.
6747 (Arm_relocate_functions::arm_grp_alu): New Method.
6748 (Arm_relocate_functions::arm_grp_ldr): New Method.
6749 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6750 (Arm_relocate_functions::arm_grp_ldc): New Method.
6751 (Target_arm::Scan::local): Handle the ARM group relocations.
6752 (Target_arm::Scan::global): Likewise.
6753 (Target_arm::Relocate::relocate): Likewise.
6754 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6755 Likewise.
6756
6757 2010-01-26 Doug Kwan <dougkwan@google.com>
6758
6759 * arm.cc (set): Include.
6760 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6761 pointer type.
6762 (Arm_output_section::Text_section_list): New type.
6763 (Arm_output_section::append_text_sections_to_list): New method.
6764 (Arm_output_section::fix_exidx_coverage): Ditto.
6765 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6766 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6767 Relobj::set_section_offset() instead of
6768 Sized_relobj::invalidate_section_offset().
6769 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6770 parameter for section headers. Ignore relocation sections for
6771 unallocated sections and EXIDX sections.
6772 (Target_arm::fix_exidx_coverage): New method.
6773 (Target_arm::output_section_address_less_than): New type.
6774 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6775 linked text section instead of the EXIDX section.
6776 (Arm_output_section::create_stub_group): Add an assertion to check
6777 that this is not an EXIDX output section.
6778 (Arm_output_section::append_text_sections_to_list): New method.
6779 (Arm_output_section::fix_exidx_coverage): Ditto.
6780 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6781 Arm_relobj::section_needs_reloc_stub_scanning.
6782 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6783 first pass.
6784 (Target_arm::fix_exidx_coverage): New method.
6785 * object.h (Relobj::set_output_section): New method.
6786 (Sized_relobj::invalidate_section_offset): Remove method.
6787 (Sized_relobj::do_invalidate_section_offset): Remove method.
6788 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6789
6790 2010-01-25 Doug Kwan <dougkwan@google.com>
6791
6792 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6793 Fix warning due to signed and unsigned comparison on a 32-bit host.
6794
6795 2010-01-22 Doug Kwan <dougkwan@google.com>
6796
6797 * arm.cc (Target_arm::do_relax): Record an output section for section
6798 offset adjustment it contains any stub table that has changed.
6799 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6800 offsets in an output section if necessary.
6801 * output.cc (Output_section::Output_section): Initialize
6802 section_offsets_need_adjustments_.
6803 (Output_section::add_input_section_for_script): Renamed to
6804 Output_section::add_simple_input_section.
6805 (Output_section::save_states): Add a comment.
6806 (Output_section::discard_states): New method defintion.
6807 (Output_section::adjust_section_offsets): Same.
6808 * output.h (Output_section::add_input_section_for_script): Renamed to
6809 Output_section::add_simple_input_section.
6810 (Output_section::discard_states): New method declaration.
6811 (Output_section::adjust_section_offsets): Same.
6812 (Output_section::section_offsets_need_adjustment,
6813 Output_section::set_section_offsets_need_adjustment): New method
6814 definitions.
6815 (Output_section::section_offsets_need_adjustment_): New data member.
6816 * script-sections.cc
6817 (Output_section_element_input::set_section_address): Adjust code for
6818 renaming of Output_section::add_input_section_for_script.
6819 (Orphan_output_section::set_section_address): Same.
6820
6821 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6822
6823 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6824 Fix_v4bx enum values .
6825 * gold/options.h (General_options): New option definitions.
6826 (General_options::fix_v4bx): New method.
6827 (General_options::Fix_v4bx): New enum.
6828 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6829 (General_options::parse_fix_v4bx_interworking): New method.
6830
6831 2010-01-22 Doug Kwan <dougkwan@google.com>
6832
6833 * arm.cc (Arm_exidx_fixup): New class.
6834
6835 2010-01-21 Doug Kwan <dougkwan@google.com>
6836
6837 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6838 classes.
6839 (Arm_exidx_section_offset_map): New type.
6840
6841 2010-01-21 Doug Kwan <dougkwan@google.com>
6842
6843 * arm.cc (Arm_exidx_input_section): New class.
6844 (Arm_relobj::exidx_input_section_by_link,
6845 Arm_relobj::exidx_input_section_by_shndx,
6846 Arm_relobj::make_exidx_input_section): New methods.
6847 (read_arm_attributes_section): Remove.
6848 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6849 information about them.
6850 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6851 to here.
6852
6853 2010-01-20 Doug Kwan <dougkwan@google.com>
6854
6855 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6856 Input_section_specifier to Section_id.
6857 (Target_arm::new_arm_input_section: Adjust code for change of key
6858 type.
6859 (Target_arm::find_arm_input_section): Ditto.
6860 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6861 (Section_id): Remove.
6862 (Garbage_collection::Section_id_hash): Remove.
6863 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6864 (Section_id): Remove.
6865 (Icf::Section_id_hash): Remove.
6866 * object.h (Section_id, Const_section_id, Section_id_hash,
6867 Const_section_id_hash): New type definitions.
6868 * output.cc (Output_section::add_relaxed_input_section): Change to
6869 use Const_section_id instead of Input_section_specifier as key type.
6870 (Output_section::add_merge_input_section): Ditto.
6871 (Output_section::build_relaxation_map): Change to use Section_id
6872 instead of Input_section_specifier as key type.
6873 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6874 Ditto.
6875 (Output_section::convert_input_sections_to_relaxed_sections): Change
6876 to use Const_section_id instead of Input_section_specifier as key type.
6877 (Output_section::find_merge_section): Ditto.
6878 (Output_section::find_relaxed_input_section): Ditto.
6879 * output.h (Input_section_specifier): Remove class.
6880 (Output_section::Output_section_data_by_input_section_map): Change
6881 key type to Const_section_id.
6882 (Output_section::Output_relaxed_input_section_by_input_section_map):
6883 Ditto.
6884 (Output_section::Relaxation_map): Change key type to Section_id.
6885
6886 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6887
6888 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6889 (class Arm_v4bx_stub): New class.
6890 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6891 (Stub_factory::make_arm_v4bx_stub): New method.
6892 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6893 (Stub_table::empty): Handle v4bx stubs.
6894 (Stub_table::add_arm_v4bx_stub): New method.
6895 (Stub_table::find_arm_v4bx_stub): New method.
6896 (Arm_relocate_functions::v4bx): New method.
6897 (Target_arm::fix_v4bx): New method.
6898 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6899 (Stub_table::relocate_stubs): Likewise.
6900 (Stub_table::do_write): Likewise.
6901 (Stub_table::update_data_size_and_addralign): Likewise.
6902 (Stub_table::finalize_stubs): Likewise.
6903 (Target_arm::Scan::local): Likewise.
6904 (Target_arm::Scan::global): Likewise.
6905 (Target_arm::do_finalize_sections): Likewise.
6906 (Target_arm::Relocate::relocate): Likewise.
6907 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6908 Likewise.
6909 (Target_arm::scan_reloc_for_stub): Likewise.
6910 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6911
6912 2010-01-19 Ian Lance Taylor <iant@google.com>
6913
6914 * output.cc (Output_section_headers::do_sized_write): Write large
6915 segment count to sh_info field.
6916 (Output_file_header::do_sized_write): For large segment count,
6917 write PN_XNUM to e_phnum field.
6918
6919 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6920
6921 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6922 (Arm_relocate_functions::thm_jump8): New function.
6923 (Arm_relocate_functions::thm_jump11): New function.
6924 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6925 R_ARM_THM_JUMP11.
6926 (Target_arm::Scan::global): Likewise.
6927 (Target_arm::Relocate::relocate): Likewise.
6928 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6929 Likewise.
6930
6931 2010-01-14 Doug Kwan <dougkwan@google.com>
6932
6933 * arm.cc (map, utility): Include headers.
6934 (Target_arm::apply_cortex_a8_workaround): New method.
6935 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6936 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6937 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6938 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6939 the --[no-]fix-cortex-a8 command line options.
6940 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6941 (Target_arm::relocate_stub): Use addend in instruction template.
6942 * options.h (DEFINE_bool): Set the user-set flag.
6943 (General_options): Add --[no-]-fix-cortex options.
6944 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6945 : Update fast look-up map after conversion.
6946
6947 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6948
6949 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6950 in the first pass of do_layout.
6951
6952 2010-01-13 Doug Kwan <dougkwan@google.com>
6953
6954 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6955 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6956 apparent compiler problem of not folding static constant integral
6957 data members of elfcpp::Elf_sizes<32>.
6958
6959 2010-01-13 Doug Kwan <dougkwan@google.com>
6960
6961 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6962 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6963 Arm_relobj::scan_section_for_cortex_a8_erratum,
6964 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6965 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6966 sections to scan for relocation stubs into a new method
6967 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6968 relocation and Cortex-A8 stub scanning.
6969 (Target_arm::do_relax): Force stubs to be after stubbed sections
6970 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6971 the beginning of a new relaxation pass. Update a comment.
6972 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6973
6974 2010-01-12 Ian Lance Taylor <iant@google.com>
6975
6976 * target-reloc.h (visibility_error): New inline function.
6977 (relocate_section): Call visibility_error.
6978 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6979 (MOSTLYCLEANFILES): Likewise.
6980 (protected_4_pic.o, protected_3.err): New targets.
6981 * testsuite/protected_4.cc: New file.
6982
6983 2010-01-12 Doug Kwan <dougkwan@google.com>
6984
6985 * arm.cc (Cortex_a8_reloc): New class.
6986 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6987 and cortex_a8_relocs_info_.
6988 (Target_arm::fix_cortex_a8): New method definition.
6989 (Target_arm::Cortex_a8_relocs_info): New type.
6990 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6991 New data member declarations.
6992 (Target_arm::scan_reloc_for_stub): Record information about
6993 relocations for THUMB branches that might be exempted from the
6994 Cortex-A8 workaround.
6995 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6996 at the beginning of a relaxation pass.
6997
6998 2010-01-12 Doug Kwan <dougkwan@google.com>
6999
7000 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7001 (Arm_relobj::Mapping_symbol_position,
7002 Arm_reloj::Mapping_symbol_position_less,
7003 Arm_relobj::Mapping_symbols_info): New types.
7004 (Target_arm::is_mapping_symbol_name): New method definition.
7005 (Arm_relobj::do_count_local_symbols): Save information about mapping
7006 symbols.
7007
7008 2010-01-11 Doug Kwan <dougkwan@google.com>
7009
7010 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7011 Arm_relocate_functions::thumb32_branch_upper,
7012 Arm_relocate_functions::thumb32_branch_lower,
7013 Arm_relocate_functions::thumb32_cond_branch_offset,
7014 Arm_relocate_functions::thumb32_cond_branch_upper,
7015 Arm_relocate_functions::thumb32_cond_branch_lower,
7016 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7017 branch offset encoding.
7018 (Arm_relocate_functions::thumb_branch_common): Use new branch
7019 offset encoding methods to avoid code duplication.
7020 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7021 (Stub_addend_reader::operator()): Use new branch encoding method
7022 to avoid code duplication.
7023
7024 2010-01-11 Doug Kwan <dougkwan@google.com>
7025
7026 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7027 (Target_arm::do_finalize_sections): Define special EXIDX section
7028 symbols only if referenced.
7029 * gc.h (Garbage_collection::add_reference): New method.
7030 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7031 code duplication.
7032
7033 2010-01-11 Ian Lance Taylor <iant@google.com>
7034
7035 * script.cc (Version_script_info::build_expression_list_lookup):
7036 Change complaing about duplicate wildcard match from error to
7037 warning.
7038
7039 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7040 of 2009-12-30.
7041 (Version_script_info::Version_script_info): Initialize globs_,
7042 default_version_, default_is_global_, and exact_. Don't
7043 initialize globals_ or locals_.
7044 (Version_script_info::build_lookup_tables): Build local symbols
7045 first.
7046 (Version_script_info::unquote): New function.
7047 (Version_script_info::add_exact_match): New function.
7048 (Version_script_info::build_expression_list_lookup): Remove lookup
7049 parameter. Add is_global parameter. Change all callers. Handle
7050 wildcard pattern specially. Unquote pattern. Call
7051 add_exact_match.
7052 (Version_script_info::get_name_to_match): New function.
7053 (Version_script_info::get_symbol_version): New function.
7054 (Version_script_info::get_symbol_version_helper): Remove.
7055 (Version_script_info::check_unmatched_names): Call unquote.
7056 * script.h (class Version_script_info): Change get_symbol_version
7057 to be non-inline and add is_global parameter; change all callers.
7058 Rewrite symbol_is_local. Update declarations. Define struct
7059 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7060 Remove globals_ and locals_ members. Add exact_, globs_,
7061 default_version_, is_global_.
7062 (Version_script_info::Glob): Remove pattern, add expression and
7063 is_global. Update constructor. Change all callers.
7064 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7065 default version.
7066 (Versions::symbol_section_contents): If a symbol is undefined, or
7067 defined in a dynamic object, set the version index to
7068 VER_NDX_LOCAL.
7069 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7070 symbol_is_local.
7071 (Symbol_table::add_from_pluginobj): Likewise.
7072 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7073
7074 2010-01-11 Doug Kwan <dougkwan@google.com>
7075
7076 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7077 (incremental_dump_LDADD): Add linking option for libintl.
7078 * Makefile.in: Regenerate.
7079
7080 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7081
7082 PR gold/11144
7083 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7084 instead of -Ds.
7085 * testsuite/Makefile.in: Regenerated.
7086
7087 2010-01-10 Doug Kwan <dougkwan@google.com>
7088
7089 * options.h (DEFINE_var): Use parentheses around argument varname__
7090 in macro body to avoid any unintended subsequent substitutions.
7091
7092 2010-01-10 Ian Lance Taylor <iant@google.com>
7093
7094 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7095 candidates before doing symbol resolution.
7096
7097 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7098 ODR candidates if only one is weak.
7099
7100 2010-01-08 Ian Lance Taylor <iant@google.com>
7101
7102 * script.cc (Version_script_info::build_expression_list_lookup):
7103 Don't warn about ambiguous version, just record the ambiguity.
7104 (Version_script_info::get_symbol_version_helper): Give error if
7105 version is ambiguous.
7106
7107 2010-01-08 Doug Kwan <dougkwan@google.com>
7108
7109 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7110 prev_data_size_ and prev_addralign_. Remove initializer for
7111 deleted data member has_been_changed_.
7112 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7113 to determine if the table is empty.
7114 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7115 Remove.
7116 (Stub_table::add_reloc_stub): Define method in class definition
7117 instead of just declaring it there.
7118 (Stub_table::add_cortex_a8_stub): New method definition.
7119 (Stub_table::update_data_size_and_addralign): Ditto.
7120 (Stub_table::finalize_stubs): Ditto.
7121 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7122 (Stub_table::do_addralign_): Return address alignment in the
7123 (Stub_table::do_reset_address_and_file_offset): Define method in
7124 class definition instead of declaring it there. Set current data
7125 size to be the data size of the previous pass.
7126 (Stub_table::set_final_data_size): Use current data size as the
7127 final data size.
7128 (Stub_table::relocate_stub): Change parameter type of stub from
7129 Reloc_stub pointer to Stub pointer.
7130 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7131 (Stub_table::Cortex_a8_stub_list): New typedef.
7132 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7133 Stub_table::prev_addralign_): New data member.
7134 (Arm_relobj::Arm_relobj): Initialize data member
7135 section_has_cortex_a8_workaround_.
7136 (Arm_relobj::section_has_cortex_a8_workaround,
7137 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7138 definitions.
7139 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7140 declarations.
7141 (Target_arm::relocate_stub): Change parameter type of stub from
7142 Reloc_stub pointer to Stub pointer.
7143 (Insn_template::size, Insn_template::alignment): Handle
7144 THUMB16_SPECIAL_TYPE.
7145 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7146 Stub_table::update_data_size_and_addralign,
7147 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7148 definitions.
7149 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7150 (Stub_table::do_write): Ditto.
7151 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7152
7153 2010-01-08 Ian Lance Taylor <iant@google.com>
7154
7155 PR 11108
7156 * symtab.h (class Symbol): Remove fields is_target_special_ and
7157 has_plt_offset_. Add field is_defined_in_discarded_section_.
7158 (Symbol::is_defined_in_discarded_section): New function.
7159 (Symbol::set_is_defined_in_discarded_section): New function.
7160 (Symbol::has_plt_offset): Rewrite.
7161 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7162 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7163 Don't initialize is_target_special_ or has_plt_offset_.
7164 Initialize is_defined_in_discarded_section_.
7165 (Symbol_table::add_from_relobj): If appropriate, set
7166 is_defined_in_discarded_section.
7167 * resolve.cc (Symbol::override_base_with_special): Don't test
7168 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7169 * target-reloc.h (relocate_section): Do special handling for
7170 symbols defined in discarded sections for global symbols as well
7171 as local symbols.
7172
7173 2010-01-08 Ian Lance Taylor <iant@google.com>
7174
7175 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7176 the SHT_SYMTAB case.
7177
7178 2010-01-08 Ian Lance Taylor <iant@google.com>
7179
7180 * object.cc (Sized_relobj::do_layout): Don't get confused if
7181 layout_eh_frame returns NULL.
7182
7183 2010-01-08 Ian Lance Taylor <iant@google.com>
7184
7185 PR 11084
7186 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7187 dynamic symbol table, use the normal symbol table.
7188 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7189 symbol table.
7190
7191 2010-01-08 Ian Lance Taylor <iant@google.com>
7192
7193 PR 11072
7194 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7195 sections.
7196
7197 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7198
7199 * version.cc (print_version): Change to "Copyright 2010".
7200
7201 2010-01-08 Ian Lance Taylor <iant@google.com>
7202
7203 PR 10287
7204 PR 11063
7205 * i386.cc (class Target_i386): Change return type of plt_section
7206 to be non-const.
7207 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7208 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7209 tls_desc_rel_ field.
7210 (Output_data_plt_i386::rel_tls_desc): New function.
7211 (Target_i386::rel_tls_desc_section): New function.
7212 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7213 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7214 R_386_TLS_DESC reloc in rel_tls_desc_section.
7215 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7216 Define struct Tlsdesc_info.
7217 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7218 (Target_x86_64::do_reloc_symbol_index): New function.
7219 (Target_x86_64::add_tlsdesc_info): New function.
7220 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7221 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7222 tlsdesc_rel_ field.
7223 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7224 all callers.
7225 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7226 (Target_x86_64::rela_tlsdesc_section): New function.
7227 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7228 handling.
7229 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7230 (Target_x86_64::do_reloc_addend): New function.
7231 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7232 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7233 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7234 (Output_reloc::type): New function.
7235 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7236 (Output_reloc::is_target_specific): New function.
7237 (Output_reloc::target_arg): New function.
7238 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7239 absolute relocs and target specific relocs.
7240 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7241 add_target_specific.
7242 (class Output_data_reloc) [SHT_RELA]: Likewise.
7243 * output.cc (Output_reloc::Output_reloc): Add four new versions
7244 for absolute relocs and target specific relocs.
7245 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7246 (Output_reloc::get_symbol_index): Likewise.
7247 (Output_reloc::local_section_offset): Check that local_sym_index_
7248 is not TARGET_CODE or 0.
7249 (Output_reloc::symbol_value): Likewise.
7250 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7251 reloc.
7252 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7253 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7254 functions.
7255 * layout.cc (add_target_dynamic_tags): Use output section for
7256 DT_PLTRELSZ and DT_JMPREL.
7257
7258 2010-01-07 Ian Lance Taylor <iant@google.com>
7259
7260 PR 11061
7261 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7262 function.
7263 (class Output_data_reloc_generic): Define.
7264 (class Output_data_reloc_base): Change base class to
7265 Output_data_reloc_generic. Change add() method to call
7266 bump_relative_reloc_count for a relative reloc. Remove
7267 sort_relocs_ field.
7268 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7269 to sort_relocs().
7270 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7271 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7272 appropriate.
7273 * layout.h (class Layout): Update declaration.
7274
7275 2010-01-07 Ian Lance Taylor <iant@google.com>
7276
7277 * output.h (class Output_data): Add const version of
7278 output_section and do_output_section.
7279 (class Output_section_data): Add const version of
7280 do_output_section.
7281 (class Output_section): Likewise.
7282 * layout.cc (Layout::add_target_dynamic_tags): New function.
7283 * layout.h (class Layout): Update declarations.
7284 * arm.cc (Target_arm::do_finalize_sections): Use
7285 add_target_dynamic_tags.
7286 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7287 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7288 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7289 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7290
7291 2010-01-07 Ian Lance Taylor <iant@google.com>
7292
7293 PR 11042
7294 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7295 object as needed.
7296
7297 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7298 Ian Lance Taylor <iant@google.com>
7299
7300 PR 11019
7301 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7302 Xindex::read_symtab_xindex.
7303
7304 2010-01-07 Doug Kwan <dougkwan@google.com>
7305
7306 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7307 (Insn_template::thumb16_bcond_insn): New method declaration.
7308 (Insn_template): Fix spelling.
7309 (Stub::thumb16_special): New method declaration.
7310 (Stub::do_write): Define virtual method which was previously pure
7311 virtual.
7312 (Stub::do_thumb16_special): New method declaration.
7313 (Stub::do_fixed_endian_write): New template member.
7314 (Reloc_stub::do_write): Remove.
7315 (Reloc_stub::do_fixed_endian_write): Remove.
7316 (Cortex_a8_stub): New class definition.
7317 (Stub_factory::make_cortex_a8_stub): New method definition.
7318 (Stub_factory::Stub_factory): Add missing static storage class
7319 qualifier for elf32_arm_stub_a8_veneer_blx.
7320
7321 2010-01-07 Ian Lance Taylor <iant@google.com>
7322
7323 PR 10980
7324 * options.h (class General_options): Add --warn-unresolved-symbols
7325 and --error-unresolved-symbols.
7326 * errors.cc (Errors::undefined_symbol): Implement
7327 --warn-unresolved-symbols.
7328
7329 * options.h (class General_options): Add -z text and -z textoff.
7330 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7331
7332 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7333
7334 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7335 (Garbage_collection::cident_sections): New function.
7336 (Garbage_collection::add_cident_section): New function.
7337 (Garbage_collection::cident_sections_): New member.
7338 (gc_process_relocs): Add references to sections whose names are C
7339 identifiers.
7340 * gold.h (cident_section_start_prefix): New constant.
7341 (cident_section_stop_prefix): New constant.
7342 (is_cident): New function.
7343 * layout.cc (Layout::define_section_symbols): Replace string constants
7344 with the newly defined constants.
7345 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7346 C identifiers.
7347 * testsuite/Makefile.am: Add gc_orphan_section_test.
7348 * testsuite/Makefile.in: Regenerate.
7349 * testsuite/gc_orphan_section_test.cc: New file.
7350 * testsuite/gc_orphan_section_test.sh: New file.
7351
7352 2010-01-06 Ian Lance Taylor <iant@google.com>
7353
7354 PR 10980
7355 * options.h (class General_options): Add --warn-shared-textrel.
7356 * layout.cc (Layout::finish_dynamic_section): Implement
7357 --warn-shared-textrel.
7358
7359 PR 10980
7360 * options.h (class General_options): Add --warn-multiple-gp.
7361
7362 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7363
7364 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7365 $(THREADSLIB) and $(LIBDL).
7366 * Makefile.in: Rebuild.
7367
7368 2010-01-06 Ian Lance Taylor <iant@google.com>
7369
7370 PR 10980
7371 * options.cc (General_options::parse_section_start): New function.
7372 (General_options::section_start): New function.
7373 (General_options::General_options): Initialize all members.
7374 * options.h: Include <map>
7375 (class General_options): Add --section-start. Add section_starts_
7376 member.
7377 * layout.cc (Layout::attach_allocated_section_to_segment): If
7378 --section-start was used, set the address of the segment. Remove
7379 local sort_sections.
7380 (Layout::relaxation_loop_body): If the address of the load segment
7381 has been set by --section-start, don't use it.
7382 * output.h (Output_segment::update_flags_for_output_section): New
7383 function.
7384 * output.cc (Output_segment::add_output_section): Call
7385 update_flags_for_output_section.
7386
7387 2010-01-05 Ian Lance Taylor <iant@google.com>
7388
7389 PR 10980
7390 * options.h (class General_options): Add --undefined-version.
7391 * script.cc (struct Version_expression): Add was_matched_by_symbol
7392 field.
7393 (Version_script_info::matched_symbol): New function.
7394 (Version_script_info::get_symbol_version_helper): Call
7395 matched_symbol.
7396 (Version_script_info::check_unmatched_names): New function.
7397 * script.h (class Version_script_info): Update declarations.
7398 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7399
7400 * options.h (class General_options): Use DEFINE_bool_alias for
7401 allow_multiple_definition.
7402 * resolve.cc (Symbol_table::should_override): Don't test
7403 allow_multiple_definition.
7404
7405 PR 10980
7406 * options.h (class General_options): Add --cref.
7407 * main.cc (main): Print cref table if --cref. Don't close mapfile
7408 until after printing cref table.
7409 * cref.cc: Include "symtab.h".
7410 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7411 (Cref_table_compare::operator()): New function.
7412 (Cref_inputs::gather_cref): New function.
7413 (filecol): New static const.
7414 (Cref_inputs::print_cref): New function.
7415 (Cref::print_cref): New function.
7416 * cref.h: Include <cstdio>.
7417 (class Cref): Update declarations.
7418 * mapfile.h (Mapfile::file): New function.
7419 * object.h (class Object): Define Symbols. Declare virtual
7420 do_get_global_symbols.
7421 (Object::get_global_symbols): New function.
7422 * object.cc (Input_objects::add_object): Pass object to cref_ if
7423 --cref.
7424 (Input_objects::archive_start): Likewise.
7425 (Input_objects::archive_stop): Likewise.
7426 (Input_objects::print_cref): New function.
7427 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7428 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7429 --cref.
7430 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7431 function.
7432 * plugin.h (class Sized_pluginobj): Update declarations.
7433
7434 2010-01-05 Ian Lance Taylor <iant@google.com>
7435
7436 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7437 to is_default_version. Rename insdef to insdefault.
7438 (Symbol_table::add_from_relobj): Rename def to is_default_version
7439 and local to is_forced_local.
7440 (Symbol_table::add_from_pluginobj): Likewise.
7441 (Symbol_table::add_from_dynobj): Likewise.
7442 (Symbol_table::define_special_symbol): Rename insdef to
7443 insdefault.
7444
7445 2010-01-04 Ian Lance Taylor <iant@google.com>
7446
7447 PR 10980
7448 * options.h (class General_options): Add
7449 --allow-multiple-definition and -z muldefs.
7450 * resolve.cc (Symbol_table::should_override): Don't warn about a
7451 multiple symbol definition if --allow-multiple-definition or -z
7452 muldefs.
7453
7454 PR 10980
7455 * options.h (class General_options): Add --add-needed and
7456 --copy-dt-needed-entries. Tweak --as-needed help entry.
7457 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7458 error if --copy-dt-needed-entries aka --add-needed is used and
7459 would cause a change in behaviour.
7460
7461 PR 10980
7462 * options.h (class General_options): Add -G as a short version of
7463 --shared. Add no-op options -assert, -g, and -i.
7464
7465 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7466
7467 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7468 check for .text or .gnu.linkonce.t sections.
7469 * icf.cc (Icf::find_identical_sections): Ditto.
7470 Change the detection for mangled function name within the section
7471 name.
7472 * icf.h (is_section_foldable_candidate): New function.
7473
7474 2009-12-30 Ian Lance Taylor <iant@google.com>
7475
7476 PR 10980
7477 * options.h (class General_options): Permit two dashes with
7478 --retain-symbols-file.
7479
7480 2009-12-30 Ian Lance Taylor <iant@google.com>
7481
7482 PR 10979
7483 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7484 don't put the file header and segment headers in the text
7485 segment.
7486
7487 PR 10979
7488 * common.cc (Sort_commons::operator()): Stabilize sort when both
7489 entries are NULL.
7490 (Symbol_table::do_allocate_commons_list): When allocating common
7491 symbols, skip a symbol which is no longer common.
7492 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7493 an object before checking its type.
7494 * testsuite/common_test_2.c: New file.
7495 * testsuite/common_test_3.c: New file.
7496 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7497 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7498 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7499 (common_test_2_pic.o, common_test_2.so): New targets.
7500 (common_test_3_pic.o, common_test_3.so): New targets.
7501 * testsuite/Makefile.in: Rebuild.
7502
7503 PR 10979
7504 * script.cc (read_input_script): If we see a new SECTIONS clause,
7505 and we have added an input section, give an error.
7506 * layout.h (class Layout): Add have_added_input_section function.
7507 Add have_added_input_section_ field.
7508 * layout.cc (Layout::Layout): Initialize
7509 have_added_input_section_.
7510 (Layout::layout): Set have_added_input_section_.
7511 (Layout::layout_eh_frame): Likewise.
7512
7513 2009-12-30 Ian Lance Taylor <iant@google.com>
7514
7515 PR 10931
7516 * options.h (class General_options): Add --sort-common option.
7517 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7518 * common.cc (Sort_common): Add sort_order parameter to
7519 constructor. Add sort_order_ field.
7520 (Sort_commons::operator): Check sort_order_.
7521 (Symbol_table::allocate_commons): Determine the sort order.
7522 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7523 Change all callers.
7524 (Symbol_table::do_allocate_commons_list): Likewise.
7525
7526 2009-12-30 Ian Lance Taylor <iant@google.com>
7527
7528 PR 10916
7529 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7530 symbols from this object, don't change the visibility of an
7531 undefined symbol.
7532 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7533
7534 2009-12-30 Ian Lance Taylor <iant@google.com>
7535
7536 PR 10861
7537 * script.h (class Version_script_info): Define Language enum.
7538 Update declarations. Define Glob, Exact, and Lookup types. Add
7539 new fields globals_, locals_, and is_finalized_.
7540 * script.cc: Various formatting fixes.
7541 (class Parser_closure): Change language_stack_ from a vector of
7542 std::string to one of Version_script_info::Language. Adjust all
7543 uses accordingly.
7544 (class Lazy_demangler): Remove.
7545 (struct Version_expression): Change language from std::string to
7546 Version_script_info::Language.
7547 (Version_script_info::Version_script_info): New function.
7548 (Version_script_info::~Version_script_info): Don't call clear.
7549 (Version_script_info::finalize): New function.
7550 (Version_script_info::build_lookup_tables): New function.
7551 (Version_script_info::build_expression_list_lookup): New
7552 function.
7553 (Version_script_info::get_symbol_version_helper): Rewrite to use
7554 lookup tables.
7555 (Version_script_info::print_expression_list): Adjust to use
7556 Version_script_info::Language.
7557 (script_push_lex_into_version_mode): Check that the version script
7558 has not been finalized.
7559 (version_script_push_lang): Change language string to
7560 Version_script_info::Language.
7561 * options.cc (Command_line::version_script): New function.
7562 * options.h (class General_options): Add finalize_dynamic_list
7563 function. Change version_script from declaration to definition.
7564 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7565 * testsuite/version_script.map: Remove duplicate def of foo.
7566 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7567 version_script.map.
7568 * testsuite/Makefile.in: Rebuild.
7569
7570 2009-12-30 Ian Lance Taylor <iant@google.com>
7571
7572 PR 10843
7573 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7574 if the input symbol index is 0, make the output symbol index 0.
7575
7576 2009-12-30 Ian Lance Taylor <iant@google.com>
7577
7578 PR 10670
7579 * options.h (class General_options): Add -x/--discard-all.
7580 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7581 --discard-all. If the local symbol needs a dynamic entry, check
7582 that before handling --discard-locals.
7583
7584 2009-12-30 Ian Lance Taylor <iant@google.com>
7585
7586 PR 10450
7587 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7588 flags to PF_R.
7589 (Output_segment::add_output_section): Don't change the flags if
7590 the type is PT_TLS.
7591
7592 PR 10450
7593 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7594 GNU hash table if they need a dynamic value. Otherwise, don't add
7595 them if they are defined in a dynamic object or are forced local.
7596
7597 2009-12-29 Ian Lance Taylor <iant@google.com>
7598
7599 PR 10450
7600 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7601 .gnu.hash table for a 32-bit target.
7602
7603 PR 10450
7604 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7605 regular and a dynamic object only needs a dynamic symbol table
7606 entry if it is externally visible.
7607
7608 PR 10450
7609 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7610 constructor. Add global_offset_table_ field.
7611 (Target_i386::got_section): Set global_offset_table_.
7612 (Target_i386::do_finalize_sections): Set global_offset_table_
7613 size.
7614 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7615 in constructor. Add global_offset_table_ field.
7616 (Target_x86_64::got_section): Set global_offset_table_.
7617 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7618 size.
7619
7620 * layout.cc (Layout::Layout): Initialize increase_relro_.
7621 (Layout::get_output_section): Add is_relro, is_last_relro, and
7622 is_first_non_relro parameters. Change all callers.
7623 (Layout::choose_output_section): Likewise.
7624 (Layout::add_output_section_data): Likewise.
7625 (Layout::make_output_section): Likewise.
7626 (Layout::set_segment_offsets): Clear increase_relro when using a
7627 linker script.
7628 * layout.h (class Layout): Add increase_relro method. Add
7629 increase_relro_ field. Update declarations.
7630 * output.cc (Output_section::Output_section): Initialize
7631 is_last_relro_ and is_first_non_relro_.
7632 (Output_segment::add_output_section): Group relro sections is
7633 do_sort is true. Handle is_last_relro and is_first_non_relro.
7634 (Output_segment::maximum_alignment): Remove relro handling.
7635 (Output_segment::set_section_addresses): Add increase_relro
7636 parameter. Change all callers. Add initial alignment to align
7637 relro sections on separate page. Remove old relro handling.
7638 (Output_segment::set_section_list_addresses): Remove in_relro
7639 parameter. Change all callers.
7640 (Output_segment::set_offset): Add increase parameter. Change all
7641 callers. Remove old relro handling.
7642 * output.h (class Output_section): Add new methods: is_last_relro,
7643 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7644 Add is_last_relro_ and is_first_non_relro_ fields.
7645 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7646 Create separate .got.plt section. Call increase_relro.
7647 * x86_64.cc (Target_x86_64::got_section): Likewise.
7648 * testsuite/relro_script_test.t: Add .got.plt.
7649
7650 PR 10450
7651 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7652 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7653 (Layout::finalize): Call set_dynamic_symbol_size.
7654 (Layout::set_dynamic_symbol_size): New function.
7655 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7656 set_dynamic_symbol_size.
7657
7658 PR 10450
7659 * output.h (class Output_section): Add is_entsize_zero_ field.
7660 * output.cc (Output_section::Output_section): Initialize
7661 is_entsize_zero_.
7662 (Output_section::set_entsize): If two different entsizes are
7663 requested, force it to zero.
7664 (Output_section::add_input_section): Set flags for .debug_str
7665 before updating section flags. Set entsize.
7666 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7667 and SHF_STRING if all input sections have those flags.
7668
7669 2009-12-29 Rafael Espindola <espindola@google.com>
7670
7671 * main.cc (main): Fix the sys time reporting.
7672 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7673 reporting.
7674
7675 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7676
7677 * options.cc (General_options::parse_version): Allow -v to exit
7678 without an error if there is nothing to link.
7679
7680 2009-12-29 Ian Lance Taylor <iant@google.com>
7681
7682 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7683 using a version of gcc before 4.1.
7684 * configure: Rebuild.
7685
7686 2009-12-28 Chris Demetriou <cgd@google.com>
7687
7688 * attributes.cc (Output_attributes_section_data::do_write): Use
7689 std::vector::front rather than std::vector::data.
7690
7691 2009-12-28 Ian Lance Taylor <iant@google.com>
7692
7693 * symtab.h (class Symbol_table): Add enum Defined.
7694 * resolve.cc (Symbol_table::should_override): Add defined
7695 parameter. Change all callers. Test whether object is NULL
7696 before calling a method on it.
7697 (Symbol_table::report_resolve_problem): Add defined parameter.
7698 Change all callers.
7699 (Symbol_table::should_override_with_special): Likewise.
7700 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7701 parameter. Change all callers.
7702 (Symbol_table::do_define_in_output_data): Likewise.
7703 (Symbol_table::define_in_output_segment): Likewise.
7704 (Symbol_table::do_define_in_output_segment): Likewise.
7705 (Symbol_table::define_as_constant): Likewise.
7706 (Symbol_table::do_define_as_constant): Likewise.
7707 * script.h (class Symbol_assignment): Add is_defsym parameter to
7708 constructor; change all callers.
7709 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7710 parameter. Change all callers. Add is_defsym_ field.
7711 (class Parser_closure): Add parsing_defsym parameter to
7712 constructor; change all callers. Add parsing_defsym accessor
7713 function. Add parsing_defsym_ field.
7714
7715 2009-12-28 Ian Lance Taylor <iant@google.com>
7716
7717 * gold.cc (queue_middle_tasks): Fix formatting.
7718 * object.cc (Relobj::is_section_name_included): Likewise.
7719
7720 2009-12-23 Ian Lance Taylor <iant@google.com>
7721
7722 * i386.cc (Target_i386::do_calls_non_split): Recognize
7723 -fsplit-stack prologue for a function with a static chain.
7724 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7725 -fsplit-stack prologue when using %r11.
7726
7727 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7728
7729 * options.cc (General_options::parse_version): Make -v continue and do
7730 the link like GNU ld does.
7731
7732 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7733
7734 * Makefile.am (CCFILES): Add timer.cc.
7735 (HFILES): Add timer.h.
7736 * configure.ac: Check for sysconf and times.
7737 * main.cc: include timer.h.
7738 (main): Use Timer instead of get_run_time.
7739 * timer.cc: New.
7740 * timer.h: New.
7741 * workqueue.cc: include timer.h.
7742 (Workqueue::find_and_run_task):
7743 Report user, sys and wall time.
7744 * Makefile.in: Regenerate.
7745 * config.in: Regenerate.
7746 * configure: Regenerate.
7747
7748 2009-12-16 Doug Kwan <dougkwan@google.com>
7749
7750 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7751 sections.
7752 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7753 relaxed input sections.
7754 * output.cc (Output_section::find_relaxed_input_section): Change
7755 return type to Output_relaxed_input_section pointer. Adjust code
7756 for new type of relaxed_input_section_map_.
7757 * output.h (Output_section::find_relaxed_input_section): Change
7758 return type to Output_relaxed_input_section pointer.
7759 (Output_section::Output_relaxed_input_section_by_input_section_map):
7760 New type.
7761 (Output_section::relaxed_input_section_map_): Change type to
7762 Output_section::Output_relaxed_input_section_by_input_section_map.
7763 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7764 input section.
7765
7766 2009-12-15 Ian Lance Taylor <iant@google.com>
7767
7768 * layout.cc (Layout::create_shstrtab): Only write out after input
7769 sections if we are compressing debug sections.
7770
7771 2009-12-15 Ian Lance Taylor <iant@google.com>
7772
7773 * archive.cc (Archive::add_symbols): Only look up a symbol without
7774 a version if there is, in fact, a version.
7775
7776 2009-12-14 Ian Lance Taylor <iant@google.com>
7777
7778 Revert -Wshadow changes, all changes from:
7779 2009-12-11 Doug Kwan <dougkwan@google.com>
7780 2009-12-11 Nick Clifton <nickc@redhat.com>
7781 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7782
7783 2009-12-11 Doug Kwan <dougkwan@google.com>
7784
7785 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7786 due to -Wshadow.
7787 * attributes.cc (Object_attribute::size): Ditto.
7788 (Attributes_section_data::size): Ditto.
7789 (Attributes_section_data::Attributes_section_data): Ditto.
7790 (Output_attributes_section_data::do_write): Ditto.
7791 * attributes.h (Object_attribute::set_type): Ditto.
7792 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7793
7794 2009-12-11 Nick Clifton <nickc@redhat.com>
7795
7796 * archive.cc: Fix shadowed variable warnings.
7797 * arm.cc: Likewise.
7798 * compressed_output.cc: Likewise.
7799 * compressed_output.h: Likewise.
7800 * configure: Likewise.
7801 * dwarf_reader.cc: Likewise.
7802 * dynobj.cc: Likewise.
7803 * dynobj.h: Likewise.
7804 * ehframe.cc: Likewise.
7805 * ehframe.h: Likewise.
7806 * errors.cc: Likewise.
7807 * expression.cc: Likewise.
7808 * fileread.cc: Likewise.
7809 * fileread.h: Likewise.
7810 * freebsd.h: Likewise.
7811 * i386.cc: Likewise.
7812 * icf.cc: Likewise.
7813 * incremental.h: Likewise.
7814 * layout.cc: Likewise.
7815 * layout.h: Likewise.
7816 * mapfile.cc: Likewise.
7817 * merge.cc: Likewise.
7818 * merge.h: Likewise.
7819 * object.cc: Likewise.
7820 * object.h: Likewise.
7821 * options.h: Likewise.
7822 * output.cc: Likewise.
7823 * output.h: Likewise.
7824 * parameters.cc: Likewise.
7825 * plugin.cc: Likewise.
7826 * powerpc.cc: Likewise.
7827 * reduced_debug_output.cc: Likewise.
7828 * reduced_debug_output.h: Likewise.
7829 * reloc.cc: Likewise.
7830 * reloc.h: Likewise.
7831 * resolve.cc: Likewise.
7832 * script-sections.cc: Likewise.
7833 * script.cc: Likewise.
7834 * script.h: Likewise.
7835 * sparc.cc: Likewise.
7836 * symtab.cc: Likewise.
7837 * symtab.h: Likewise.
7838 * target-select.cc: Likewise.
7839 * target-select.h: Likewise.
7840 * token.h: Likewise.
7841 * workqueue.cc: Likewise.
7842 * workqueue.h: Likewise.
7843 * x86_64.cc: Likewise.
7844
7845 2009-12-10 Doug Kwan <dougkwan@google.com>
7846
7847 * arm.cc (attributes.h): New include.
7848 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7849 (Arm_relobj::~Arm_relobj): Delete object pointed by
7850 attributes_section_data_.
7851 (Arm_relobj::attributes_section_data): New method definition.
7852 (Arm_relobj::attributes_section_data_): New data member declaration.
7853 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7854 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7855 attributes_section_data_.
7856 (Arm_dynobj::attributes_section_data): New method definition.
7857 (Arm_dynobj::attributes_section_data_): New data member declaration.
7858 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7859 initialization value of may_use_blx_ to false.
7860 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7861 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7862 object attributes to compute results instead of hard-coding.
7863 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7864 Target_arm::get_secondary_compatible_arch,
7865 Target_arm::set_secondary_compatible_arch
7866 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7867 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7868 New method declarations.
7869 (Target_arm::get_aeabi_object_attribute): New method definition.
7870 (Target_arm::attributes_section_data_): New data member declaration.
7871 (read_arm_attributes_section): New template definition.
7872 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7873 (Arm_dynobj::do_read_symbols): Ditto.
7874 (Target_arm::do_finalize_sections): Merge attributes sections from
7875 input. Check for BLX use after attributes section merging.
7876 Fix __exidx_start and __exidx_end visibility. Create an
7877 .ARM.attributes section if necessary.
7878 (Target_arm::get_secondary_compatible_arch,
7879 Target_arm::set_secondary_compatible_arch,
7880 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7881 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7882 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7883 New method definitions.
7884
7885 2009-12-09 Ian Lance Taylor <iant@google.com>
7886
7887 * plugin.cc (Plugin::load): Don't cast from void* to a function
7888 pointer.
7889
7890 2009-12-09 Ian Lance Taylor <iant@google.com>
7891
7892 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7893 information fields.
7894
7895 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7896
7897 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7898 Replace two_file_shared_1.so with two_file_shared_2.so.
7899 * testsuite/Makefile.in: Regenerated.
7900
7901 2009-12-08 Doug Kwan <dougkwan@google.com>
7902
7903 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7904 (HFILES): Add attributes.h and int_encoding.h.
7905 * Makefile.in: Regenerate.
7906 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7907 function definitions to int_encoding.cc
7908 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7909 prototypes to int_encoding.h
7910 * reduced_debug_output.cc (int_encoding.h): New include.
7911 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7912 function definitions to int_encoding.cc
7913 (insert_into_vector, read_from_pointer): Move template definitions to
7914 int_encoding.h
7915 * attributes.cc: New file.
7916 * attributes.h: New file.
7917 * int_encoding.cc: New file.
7918 * int_encoding.h: New file.
7919
7920 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7921
7922 PR gold/11055
7923 * incremental-dump.cc (dump_incremental_inputs): New.
7924 (main): Use dump_incremental_inputs.
7925
7926 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7927
7928 PR gold/10893
7929 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7930 checking elfcpp::STT_FUNC.
7931 (Target_i386::Relocate::relocate): Likewise.
7932 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7933
7934 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7935 symbols from shared libraries into normal FUNC symbols.
7936
7937 * symtab.h (Symbol): Add is_func and use it.
7938
7939 2009-12-05 Doug Kwan <dougkwan@google.com>
7940
7941 * arm.cc (Target_arm::arm_info): Initialize new fields
7942 attributes_section and attributes_vendor.
7943 * i386.cc (Target_i386::i386_info): Same.
7944 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7945 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7946 fields attributes_section and attributes_vendor.
7947 * sparc.cc (Target_sparc::sparc_info): Same.
7948 * target.h (Target::attributes_section, Target::attributes_vendor,
7949 Target::is_attributes_section, Target::attribute_arg_type,
7950 Target::attributes_order): New method definitions.
7951 (Target::Target_info::attributes_section,
7952 Target::Target_info::attributes_vendor): New fields.
7953 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7954 virtual method definitions.
7955 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7956 attributes_section and attributes_vendor.
7957 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7958
7959 2009-12-05 Doug Kwan <dougkwan@google.com>
7960
7961 * arm.cc: Update comments about interworking and stub generation.
7962 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7963 considered as non-PIC.
7964 (Arm_relocate_functions::base_abs): Fix formatting.
7965 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7966 of function to use GOT entry address instead of offset.
7967 (Target_arm::Scan::global): Issue an error if a symbol would need a
7968 PLT does not get one because it is untyped. Remove code to create
7969 dynamic symbols for relative branches.
7970 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7971 takes unsigned integer instead of boolean.
7972
7973 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7974
7975 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7976 (two_file_test_LDADD): Likewise.
7977 (common_test_1_LDADD): Likewise.
7978 (exception_test_LDADD) Likewise.
7979 (weak_test_LDADD): Likewise.
7980 (many_sections_test_LDADD): Likewise.
7981 (initpri1_LDADD): Likewise.
7982 (script_test_1_LDADD): Likewise.
7983 (script_test_2_LDADD): Likewise.
7984 (justsyms_LDADD): Likewise.
7985 (binary_test_LDADD): Likewise.
7986 (large_LDADD): Likewise.
7987 * testsuite/Makefile.in: Regenerated.
7988
7989 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7990
7991 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7992 (Symbol_table::override_with_special): Likewise.
7993 (Symbol_table::add_from_object): Likewise.
7994
7995 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7996
7997 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7998 Don't set the data_offset twice.
7999
8000 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8001
8002 * testsuite/Makefile.in: Regenerate.
8003
8004 2009-12-03 Doug Kwan <dougkwan@google.com>
8005
8006 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8007 (Target_arm::do_finalize_sections): Add parameter for symbol table
8008 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8009 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8010 parameter for symbol table pointer.
8011 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8012 an additional parameter for a pointer to symbol table.
8013 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8014 parameter for a symbol table pointer.
8015 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8016 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8017 Ditto.
8018 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8019 parameter for a symbol table pointer.
8020
8021 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8022
8023 * incremental.cc (Incremental_inputs_header)
8024 (Incremental_inputs_header_write, Incremental_inputs_entry)
8025 (Incremental_inputs_entry_write): Move ...
8026 * incremental.h (Incremental_inputs_header)
8027 (Incremental_inputs_header_write, Incremental_inputs_entry)
8028 (Incremental_inputs_entry_write): here.
8029
8030 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8031
8032 * incremental.cc (make_sized_incremental_binary): Set the target.
8033 Error if it is incompatible.
8034 * output.h (Output_file): Add filename method.
8035
8036 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8037
8038 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8039 from the get_* methods.
8040
8041 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8042
8043 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8044 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8045 Write 0 for the data_offset of scripts.
8046
8047 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8048
8049 * testsuite/Makefile.am: Add the incremental_test.sh test.
8050 * testsuite/incremental_test.sh: New.
8051 * testsuite/incremental_test_1.c: New.
8052 * testsuite/incremental_test_2.c: New.
8053
8054 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8055
8056 * incremental-dump.cc (main): Fix typos.
8057
8058 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8059
8060 PR gold/11025
8061 * incremental-dump.cc (main): Use llu to print 64 bit values.
8062
8063 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8064 H.J. Lu <hongjiu.lu@intel.com>
8065
8066 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8067 $(LIBDL).
8068 (incremental_dump_LDADD): Likewise.
8069 * Makefile.in: Regenerated.
8070
8071 2009-11-25 Doug Kwan <dougkwan@google.com>
8072
8073 Revert:
8074
8075 2009-11-25 Doug Kwan <dougkwan@google.com>
8076
8077 * arm.cc (Target_arm::Target_arm): Move method definition
8078 outside of class definition. Add code to handle
8079 --target1-rel, --target1-abs and --target2= options.
8080 (Target_arm::get_reloc_reloc_type): Change method to be
8081 non-static and const.
8082 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8083 New data member declaration.
8084 (Target_arm::Scan::local, Target_arm::Scan::global,
8085 Target_arm::Relocate::relocate,
8086 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8087 Adjust call to Target_arm::get_real_reloc_type.
8088 (Target_arm::get_real_reloc_type): Use command line options
8089 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8090 * options.h (--target1-rel, --target1-abs, --target2): New
8091 ARM-only options.
8092
8093 2009-11-25 Doug Kwan <dougkwan@google.com>
8094
8095 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8096 class definition. Add code to handle --target1-rel, --target1-abs
8097 and --target2= options.
8098 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8099 and const.
8100 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8101 member declaration.
8102 (Target_arm::Scan::local, Target_arm::Scan::global,
8103 Target_arm::Relocate::relocate,
8104 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8105 call to Target_arm::get_real_reloc_type.
8106 (Target_arm::get_real_reloc_type): Use command line options to
8107 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8108 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8109 options.
8110
8111 2009-11-25 Doug Kwan <dougkwan@google.com>
8112
8113 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8114 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8115 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8116 formatting.
8117 (Arm_relocate_functions::thm_call): Replace body with a call to
8118 Arm_relocate_functions::thumb_branch_common.
8119 (Arm_relocate_functions::thm_jump24,
8120 Arm_relocate_functions::thm_xpc22): New method definitions.
8121 (Arm_relocate_functions::thumb_branch_common): New method definition.
8122 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8123 operator.
8124 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8125 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8126
8127 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8128
8129 * Makefile.am: Build incremental-dump
8130 * Makefile.in: Regenerate.
8131 * incremental-dump.cc: New.
8132 * incremental.cc (Incremental_inputs_header_data,
8133 Incremental_inputs_entry_data): Move to incremental.h
8134 * incremental.h: (Incremental_inputs_header_data,
8135 Incremental_inputs_entry_data): Move from incremental.cc
8136
8137 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8138
8139 * incremental.cc (Incremental_inputs_header,
8140 Incremental_inputs_header_write, Incremental_inputs_entry,
8141 Incremental_inputs_entry_write): Add a typedef with the data type.
8142
8143 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8144
8145 * incremental.cc (Incremental_inputs_header,
8146 Incremental_inputs_header_write, Incremental_inputs_entry,
8147 Incremental_inputs_entry_write): Update comment about which
8148 type has the filed descriptions.
8149
8150 2009-11-15 Doug Kwan <dougkwan@google.com>
8151
8152 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8153 (Arm_relocate_functions::arm_branch_common): Change method defintion
8154 in class definition to a method declaration and update list of formal
8155 parameters.
8156 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8157 Arm_relocation_functions::jump24): Adjust call to
8158 Arm_relocate_functions::arm_branch_common. Update list of formal
8159 parameters.
8160 (Arm_relocate_functions::xpc25): New method definition.
8161 (Arm_relocate_functions::arm_branch_common): Move method defintion
8162 out from class definition. Use stubs for mode-switching and extending
8163 branch ranges.
8164 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8165 specially. Change code to enable use of stubs in ARM branches.
8166
8167 2009-11-10 Doug Kwan <dougkwan@google.com>
8168
8169 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8170 in method declaration.
8171 (Target_arm::relocate_stub): New method declaration.
8172 (Target_arm::default_target): Change to return a pointer instead of
8173 a const reference.
8174 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8175 Target_arm::default_target.
8176 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8177 method definition.
8178 (Target_arm::relocate_section): Adjust view.
8179 (Target_arm::relocate_stub): New method definition.
8180
8181 2009-11-10 Doug Kwan <dougkwan@google.com>
8182
8183 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8184 a format warning.
8185 * incremental.cc (open_incremental_binary): Initialized local
8186 variables to avoid warnings.
8187 * object.cc (make_elf_object): Ditto.
8188 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8189 a format warning.
8190
8191 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8192
8193 PR gold/10930
8194 * testsuite/plugin_test.c: Include "config.h".
8195
8196 2009-11-09 Doug Kwan <dougkwan@google.com>
8197
8198 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8199 (arm_symbol_value): Remove.
8200 (Arm_relocate_functions::arm_branch_common,
8201 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8202 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8203 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8204 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8205 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8206 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8207 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8208 Arm_relocate_functions::thm_mobw_abs_nc,
8209 Arm_relocate_functions::thm_mov_abs,
8210 Arm_relocate_functions::movw_prel_nc,
8211 Arm_relocate_functions::thm_movt_abs,
8212 Arm_relocate_functions::movt_prel,
8213 Arm_relocate_functions::thm_movw_prel_nc,
8214 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8215 (Target_arm::Relocate::relocate): Only decompose address into two
8216 parts if relocation type uses the thumb-bit and pass the actual
8217 bit instead of a flag indicating that the thumb-bit is used. Adjust
8218 calls to methods in Arm_relocate_functions for this change.
8219
8220 2009-11-08 Ian Lance Taylor <iant@google.com>
8221
8222 PR 10925
8223 * reloc.cc: Instantiate
8224 Sized_relobj::initialize_input_to_output_maps and
8225 Sized_relobj:free_input_to_output_maps.
8226
8227 2009-11-06 Ian Lance Taylor <iant@google.com>
8228
8229 PR 10876
8230 * defstd.cc (in_segment): Set only_if_ref true for "end".
8231
8232 2009-11-06 Doug Kwan <dougkwan@google.com>
8233
8234 * arm.cc (class Reloc_stub): Correct a comment.
8235 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8236 (Target_arm::scan_section_for_stubs): New method declaration.
8237 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8238 Change methods from private to protected.
8239 (Target_arm::do_may_relax): New method definition.
8240 (Target_arm::do_relax, Target_arm::group_sections,
8241 Target_arm::scan_reloc_for_stub,
8242 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8243 (Target_arm::arm_input_section_map_): New data member declaration.
8244 (Target_arm::scan_reloc_for_stub,
8245 Target_arm::scan_reloc_section_for_stubs,
8246 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8247 Target_arm::do_relax): New method definitions.
8248
8249 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8250
8251 * configure.ac: Check for (struct stat)::st_mtim
8252 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8253 * config.in: Regenerate.
8254 * configure: Regenerate.
8255
8256 2009-11-05 Ian Lance Taylor <iant@google.com>
8257
8258 PR 10910
8259 * output.cc (Output_segment::add_output_section): Add missing
8260 return statement.
8261
8262 2009-11-04 Ian Lance Taylor <iant@google.com>
8263
8264 PR 10880
8265 * object.h (class Object): Add is_needed and set_is_needed
8266 methods. Add is_needed_ field. Make bool fields into bitfields.
8267 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8268 defined in a dynamic object and referenced by a regular object,
8269 set is_needed for the dynamic object.
8270 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8271 if the file is marked with as_needed and it is not needed.
8272
8273 2009-11-04 Ian Lance Taylor <iant@google.com>
8274
8275 PR 10887
8276 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8277 tags if data is discarded by linker script.
8278 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8279 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8280 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8281 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8282
8283 2009-11-04 Ian Lance Taylor <iant@google.com>
8284
8285 * layout.cc (Layout::get_output_section): Add is_interp and
8286 is_dynamic_linker_section parameters. Change all callers.
8287 (Layout::choose_output_section): Likewise.
8288 (Layout::make_output_section): Likewise.
8289 (Layout::add_output_section_data): Add is_dynamic_linker_section
8290 parameter. Change all callers.
8291 * layout.h (class Layout): Update declarations.
8292 * output.h (class Output_section): Add is_interp, set_is_interp,
8293 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8294 Add is_interp_, is_dynamic_linker_section_ fields. Change
8295 generate_code_fills_at_write_ to a bitfield.
8296 * output.cc (Output_section::Output_sections): Initialize new
8297 fields.
8298 (Output_segment::add_output_section): Add do_sort parameter.
8299 Change all callers.
8300
8301 2009-11-03 Ian Lance Taylor <iant@google.com>
8302
8303 PR 10860
8304 * options.h (class General_options): Add --warn-common.
8305 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8306 merging two common symbols.
8307 (Symbol_table::should_override): Handle --warn-common when merging
8308 a common symbol with a defined symbol. Use report_resolve_problem
8309 for multiple definitions.
8310 (Symbol_table::report_resolve_problem): New function.
8311 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8312
8313 2009-11-03 Doug Kwan <dougkwan@google.com>
8314
8315 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8316 stub_factory_.
8317 (Target_arm::stub_factory): New method definition.
8318 (Target_arm::new_arm_input_section,
8319 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8320 Target_arm::reloc_uses_thumb_bit): New method declarations.
8321 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8322 New type definitions.
8323 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8324 member declarations.
8325 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8326 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8327 New method definitions.
8328
8329 2009-11-03 Ian Lance Taylor <iant@google.com>
8330
8331 * options.h (class General_options): Add --warn_constructors.
8332
8333 2009-11-03 Ian Lance Taylor <iant@google.com>
8334
8335 PR 10893
8336 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8337 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8338
8339 2009-11-03 Ian Lance Taylor <iant@google.com>
8340
8341 PR 10895
8342 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8343 --msgid-bugs-address.
8344 (install-pdf): New target.
8345 (install-data_yes): Look up one directory to find mkinstalldirs.
8346
8347 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8348
8349 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8350 tree.
8351
8352 2009-10-30 Doug Kwan <dougkwan@google.com>
8353
8354 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8355
8356 2009-10-30 Doug Kwan <dougkwan@google.com>
8357
8358 * arm.cc (Stub_addend_reader): New struct template definition
8359 and partial specializations.
8360 (Stub_addend_reader::operator()): New method definition for a
8361 partially specialized template.
8362
8363 2009-10-30 Doug Kwan <dougkwan@google.com>
8364
8365 * arm.cc (Arm_relobj::processor_specific_flags): New method
8366 definition.
8367 (Arm_relobj::do_read_symbols): New method declaration.
8368 (Arm_relobj::processor_specific_flags_): New data member declaration.
8369 (Arm_dynobj): New class definition.
8370 (Target_arm::do_finalize_sections): Add input_objects parameter.
8371 (Target_arm::do_adjust_elf_header): New method declaration.
8372 (Target_arm::are_eabi_versions_compatible,
8373 (Target_arm::merge_processor_specific_flags): New method declaration.
8374 (Target_arm::do_make_elf_object): New overloaded method definitions
8375 and declaration.
8376 (Arm_relobj::do_read_symbols): New method definition.
8377 (Arm_dynobj::do_read_symbols): Ditto.
8378 (Target_arm::do_finalize_sections): Add input_objects parameters.
8379 Merge processor-specific flags from all input objects.
8380 (Target_arm::are_eabi_versions_compatible,
8381 Target_arm::merge_processor_specific_flags,
8382 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8383 New method definitions.
8384 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8385 Input_objects pointer type parameter.
8386 * layout.cc (Layout::finalize): Pass input objects to target's.
8387 finalize_sections function.
8388 * output.cc (Output_file_header::do_sized_write): Set ELF file
8389 header's processor-specific flags.
8390 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8391 Input_objects pointer type parameter.
8392 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8393 * target.h (Input_objects): New forward class declaration.
8394 (Target::processor_specific_flags,
8395 Target::are_processor_specific_flags_sect): New method definitions.
8396 (Target::finalize_sections): Add input_objects parameter.
8397 (Target::Target): Initialize processor_specific_flags_ and
8398 are_processor_specific_flags_set_.
8399 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8400 parameter.
8401 (Target::set_processor_specific_flags): New method definition.
8402 (Target::processor_specific_flags_,
8403 Target::are_processor_specific_flags_set_): New data member
8404 declarations.
8405 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8406 Input_objects pointer type parameter.
8407
8408 2009-10-30 Doug Kwan <dougkwan@google.com>
8409
8410 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8411
8412 2009-10-28 Ian Lance Taylor <iant@google.com>
8413
8414 * object.h (class Relobj): Drop options parameter from
8415 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8416 do_scan_relocs, do_relocate. Change all callers.
8417 (class Sized_relobj): Drop options parameters from
8418 do_gc_process_relocs, do_scan_relocs, do_relocate,
8419 do_relocate_sections, relocate_sections, emit_relocs_scan,
8420 emit_relocs_scan_reltype. Change all callers.
8421 (struct Relocate_info): Remove options field and all references to
8422 it.
8423 * reloc.h (class Read_relocs): Remove options constructor
8424 parameter and options_ field. Change all callers.
8425 (class Gc_process_relocs, class Scan_relocs): Likewise.
8426 (class Relocate_task): Likewise.
8427 * target-reloc.h (scan_relocs): Remove options parameter. Change
8428 all callers.
8429 (scan_relocatable_relocs): Likewise.
8430 * target.h (class Sized_target): Remove options parameter from
8431 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8432 all callers.
8433 * gc.h (gc_process_relocs): Remove options parameter. Change all
8434 callers.
8435 * arm.cc: Update functions to remove options parameters.
8436 * i386.cc: Likewise.
8437 * powerpc.cc: Likewise.
8438 * sparc.cc: Likewise.
8439 * x86_64.cc: Likewise.
8440 * testsuite/testfile.cc: Likewise.
8441
8442 2009-10-28 Doug Kwan <dougkwan@google.com>
8443
8444 * arm.cc (Arm_relobj): New class definition.
8445 (Arm_relobj::scan_sections_for_stubs,
8446 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8447 New method definitions.
8448
8449 2009-10-28 Cary Coutant <ccoutant@google.com>
8450
8451 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8452 (Plugin::cleanup_done_): New member.
8453 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8454 (Plugin_manager::cleanup_done_): Remove.
8455 (Plugin_manager::add_input_file): Edit error message.
8456 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8457 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8458
8459 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8460
8461 * fileread.cc: (File_read::View::~View): Use the new
8462 data_ownership_ filed.
8463 (File_read::~File_read): Dispose the new whole_file_view_.
8464 (File_read::open): Mmap the whole file if needed.
8465 (File_read::open): Use whole_file_view_ instead of contents_.
8466 (File_read::find_view): Use whole_file_view_ if applicable.
8467 (File_read::do_read): Use whole_file_view_ instead of contents_.
8468 (File_read::make_view): Use whole_file_view_ instead of contents_,
8469 update File_read::View::View call.
8470 (File_read::find_or_make_view): Update File_read::View::View
8471 call.
8472 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8473 remove contents_
8474 (File_read::View::Data_ownership): New enum.
8475 (File_read::View::View): Replace bool mapped_ with Data_ownership
8476 argument.
8477 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8478 (File_read::View::data_ownership_): New field.
8479 (File_read::contents_): Remove (replaced by whole_file_view_).
8480 (File_read::whole_file_view_): New field.
8481 * options.h (class General_options): Add --keep-files-mapped.
8482
8483 2009-10-27 Cary Coutant <ccoutant@google.com>
8484
8485 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8486 * testsuite/Makefile.am (plugin_test_5): New test case.
8487 * testsuite/Makefile.in: Regenerate.
8488
8489 2009-10-25 Doug Kwan <dougkwan@google.com>
8490
8491 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8492 from private to protected to allow access by child class.
8493 (Sized_relobj::do_relocate_sections): New method declaration.
8494 (Sized_relobj::relocate_sections): Virtualize.
8495 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8496 Sized_relobj::relocate_sections. Instantiate template explicitly
8497 for different target sizes and endianity.
8498
8499 2009-10-24 Doug Kwan <dougkwan@google.com>
8500
8501 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8502 (Arm_input_section::as_arm_input_section): New method.
8503 (Arm_output_section): New class definition.
8504 (Arm_output_section::create_stub_group,
8505 Arm_output_section::group_sections): New method definitions.
8506
8507 2009-10-22 Doug Kwan <dougkwan@google.com>
8508
8509 * arm.cc (Arm_input_section): New class definition.
8510 (Arm_input_section::init, Arm_input_section:do_write,
8511 Arm_input_section::set_final_data_size,
8512 Arm_input_section::do_reset_address_and_file_offset): New method
8513 definitions.
8514
8515 2009-10-21 Doug Kwan <dougkwan@google.com>
8516
8517 * arm.cc (Stub_table, Arm_input_section): New forward class
8518 declarations.
8519 (Stub_table): New class defintion.
8520 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8521 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8522 New method definition.
8523
8524 2009-10-21 Doug Kwan <dougkwan@google.com>
8525
8526 * arm.cc: Update copyright comments.
8527 (Target_arm): New forward class template declaration.
8528 (Arm_address): New type.
8529 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8530 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8531 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8532 constants.
8533 (Insn_template): Same.
8534 (DEF_STUBS): New macro.
8535 (Stub_type): New enum type.
8536 (Stub_template): New class definition.
8537 (Stub): Same.
8538 (Reloc_stub): Same.
8539 (Stub_factory): Same.
8540 (Target_arm::Target_arm): Initialize may_use_blx_ and
8541 should_force_pic_veneer_.
8542 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8543 Target_arm::should_force_pic_veneer,
8544 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8545 Target_arm::using_thumb_only, Target_arm:;default_target): New
8546 method defintions.
8547 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8548 New data member declarations.
8549 (Insn_template::size, Insn_template::alignment): New method defintions.
8550 (Stub_template::Stub_template): New method definition.
8551 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8552 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8553 (Stub_factory::Stub_factory): New method definition.
8554 * gold.h (string_hash): New template.
8555 * output.h (Input_section_specifier::hash_value): Use
8556 gold::string_hash.
8557 (Input_section_specifier::string_hash): Remove.
8558 * stringpool.cc (Stringpool_template::string_hash): Use
8559 gold::string_hash.
8560
8561 2009-10-20 Doug Kwan <dougkwan@google.com>
8562
8563 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8564 symbols of relaxed input sections.
8565 * output.h (Output_section::find_relaxed_input_section): Make
8566 method public.
8567
8568 2009-10-16 Doug Kwan <dougkwan@google.com>
8569
8570 * dynobj.cc (Versions::Versions): Initialize version_script_.
8571 Only insert base version symbol definition for a shared object
8572 if version script defines any version versions.
8573 (Versions::define_base_version): New method definition.
8574 (Versions::add_def): Check that base version is not needed.
8575 (Versions::add_need): Define base version lazily.
8576 * dynobj.h (Versions::define_base_version): New method declaration.
8577 (Versions::needs_base_version_): New data member declaration.
8578 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8579 (check_DATA): Add no_version_test.stdout.
8580 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8581 New make rules.
8582 * testsuite/Makefile.in: Regenerate.
8583 * testsuite/no_version_test.c: New file.
8584 * testsuite/no_version_test.sh: Ditto.
8585
8586 2009-10-16 Doug Kwan <dougkwan@google.com>
8587
8588 * expression.cc (class Segment_start_expression): New class definition.
8589 (Segment_start_expression::value): New method definition.
8590 (script_exp_function_segment_start): Return a new
8591 Segment_start_expression.
8592 * gold/script-c.h (script_saw_segment_start_expression): New function
8593 prototype.
8594 * script-sections.cc (Script_sections::Script_sections): Initialize
8595 SAW_SEGMENT_START_EXPRESSION_ to false.
8596 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8597 and -Tbbs options to specify section addresses if given in
8598 command line and no SEGMENT_START expression is seen in a script.
8599 * script-sections.h (Script_sections::saw_segment_start_expression,
8600 Script_sections::set_saw_segment_start_expression): New method
8601 definition.
8602 (Script_sections::saw_segment_start_expression_): New data member
8603 declaration.
8604 * script.cc (script_saw_segment_start_expression): New function.
8605 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8606 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8607 script_test_7.sh and script_test_8.sh.
8608 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8609 script_test_8.stdout.
8610 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8611 (script_test_6, script_test_6.stdout, script_test_7,
8612 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8613 * Makefile.in: Regenerate.
8614 * testsuite/script_test_6.sh: New file.
8615 * testsuite/script_test_6.t: Same.
8616 * testsuite/script_test_7.sh: Same.
8617 * testsuite/script_test_7.t: Same.
8618 * testsuite/script_test_8.sh: Same.
8619
8620 2009-10-16 Doug Kwan <dougkwan@google.com>
8621
8622 * output.cc (Output_segment::set_section_list_address): Cast
8623 expressions to unsigned long long type to avoid format warnings.
8624
8625 2009-10-15 Ian Lance Taylor <iant@google.com>
8626
8627 * script.cc (Script_options::add_symbol_assignment): Always add a
8628 dot assignment to script_sections_.
8629 * script-sections.cc (Script_sections::add_dot_assignment):
8630 Initialize if necessary.
8631
8632 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8633 program headers with no load segment if there is a linker script.
8634
8635 * layout.cc (Layout::set_segment_offsets): Align the file offset
8636 to the segment aligment for -N or -n with no load segment.
8637 * output.cc (Output_segment::add_output_section): Don't crash if
8638 the first section is a TLS section.
8639 (Output_segment::set_section_list_addresses): Print an error
8640 message if the address moves backward in a linker script.
8641 * script-sections.cc
8642 (Output_section_element_input::set_section_addresses): Don't
8643 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8644 (Orphan_output_section::set_section_addresses): Likewise.
8645
8646 2009-10-15 Doug Kwan <dougkwan@google.com>
8647
8648 * layout.cc (Layout::finish_dynamic_section): Generate tags
8649 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8650 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8651 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8652
8653 2009-10-14 Ian Lance Taylor <iant@google.com>
8654
8655 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8656 fields.
8657 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8658 data_shdr fields of relinfo.
8659 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8660 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8661 R_386_TLS_LDO_32, adjust based on section flags.
8662 (Target_i386::Relocate::fix_up_ldo): Remove.
8663
8664 2009-10-13 Ian Lance Taylor <iant@google.com>
8665
8666 Add support for -pie.
8667 * options.h (class General_options): Add -pie and
8668 --pic-executable.
8669 (General_options::output_is_position_independent): Test -pie.
8670 (General_options::output_is_executable): Return true if not shared
8671 and not relocatable.
8672 (General_options::output_is_pie): Remove.
8673 * options.cc (General_options::finalize): Reject incompatible uses
8674 of -pie.
8675 * gold.cc (queue_middle_tasks): A -pie link is not static.
8676 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8677 * symtab.cc (Symbol::final_value_is_known): Return false if
8678 output_is_position_independent.
8679 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8680 output_is_position_independent.
8681 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8682 output_is_position_independent.
8683 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8684 output_is_position_independent.
8685 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8686 two_file_pie_test.
8687 (basic_pie_test.o, basic_pie_test): New targets.
8688 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8689 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8690 (two_file_pie_test): New target.
8691 * testsuite/Makefile.in: Rebuild.
8692 * README: Remove note saying that -pie is not supported.
8693
8694 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8695
8696 * options.h (class General_options): Add -init and -fini.
8697 * layout.cc (Layout::finish_dynamic_section): Emit
8698 given init and fini functions.
8699
8700 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8701
8702 * gc.h (gc_process_relocs): Check if icf is enabled using new
8703 function.
8704 * gold.cc (queue_initial_tasks): Likewise.
8705 (queue_middle_tasks): Likewise.
8706 * object.cc (do_layout): Likewise.
8707 * symtab.cc (is_section_folded): Likewise.
8708 * main.cc (main): Likewise.
8709 * reloc.cc (Read_relocs::run): Likewise.
8710 (Sized_relobj::do_scan_relocs): Likewise.
8711 * icf.cc (is_function_ctor_or_dtor): New function.
8712 (Icf::find_identical_sections): Check if function is ctor or dtor when
8713 safe icf is chosen.
8714 * options.h (General_options::icf): Change option to be an enum.
8715 (Icf_status): New enum.
8716 (icf_enabled): New method.
8717 (icf_safe_folding): New method.
8718 (set_icf_status): New method.
8719 (icf_status_): New variable.
8720 * (options.cc) (General_options::finalize): Set icf_status_.
8721 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8722 icf_test and icf_keep_unique_test to use the --icf enum flag.
8723 * testsuite/icf_safe_test.sh: New file.
8724 * testsuite/icf_safe_test.cc: New file.
8725
8726 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8727
8728 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8729 includes to gc.h and icf.h.
8730 * arm.cc: Include gc.h.
8731 * gold.cc: Likewise.
8732 * i386.cc: Likewise.
8733 * powerpc.cc: Likewise.
8734 * sparc.cc: Likewise.
8735 * x86_64.cc: Likewise.
8736 * gc.h: Include icf.h.
8737
8738 2009-10-11 Ian Lance Taylor <iant@google.com>
8739
8740 * plugin.cc: Include "gold.h" before other header files.
8741
8742 2009-10-10 Chris Demetriou <cgd@google.com>
8743
8744 * options.h (Input_file_argument::Input_file_type): New enum.
8745 (Input_file_argument::is_lib_): Replace with...
8746 (Input_file_argument::type_): New member.
8747 (Input_file_argument::Input_file_argument): Take Input_file_type
8748 'type' rather than boolean 'is_lib' as second argument.
8749 (Input_file_argument::is_lib): Use type_.
8750 (Input_file_argument::is_searched_file): New function.
8751 (Input_file_argument::may_need_search): Handle is_searched_file.
8752 * options.cc (General_options::parse_library): Support -l:filename.
8753 (General_options::parse_just_symbols): Update for Input_file_argument
8754 changes.
8755 (Command_line::process): Likewise.
8756 * archive.cc (Archive::get_file_and_offset): Likewise.
8757 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8758 * script.cc (read_script_file, script_add_file): Likewise.
8759 * fileread.cc (Input_file::Input_file): Likewise.
8760 (Input_file::will_search_for): Handle is_searched_file.
8761 (Input_file::open): Likewise.
8762 * readsyms.cc (Read_symbols::get_name): Likewise.
8763 * testsuite/Makefile.am (searched_file_test): New test.
8764 * testsuite/Makefile.in: Regenerate.
8765 * testsuite/searched_file_test.cc: New file.
8766 * testsuite/searched_file_test_lib.cc: New file.
8767
8768 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8769 Ian Lance Taylor <iant@google.com>
8770
8771 * descriptor.cc: Include <cstdio> and "binary-io.h".
8772 (Descriptors::open): Open the files in binary mode always.
8773 * script.cc (Lex::get_token): Treat \r as whitespace.
8774
8775 2009-10-09 Ian Lance Taylor <iant@google.com>
8776
8777 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8778
8779 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8780 Ian Lance Taylor <iant@google.com>
8781
8782 * configure.ac: Check for readv function also.
8783 * fileread.cc (readv): Define if not HAVE_READV.
8784 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8785 does not exist.
8786 * config.in: Regenerate.
8787 * configure: Regenerate.
8788
8789 2009-10-09 Doug Kwan <dougkwan@google.com>
8790
8791 * layout.cc (Layout::make_output_section): Call target hook to make
8792 ordinary output section.
8793 (Layout::finalize): Adjust parameter list of call the
8794 Target::may_relax().
8795 * layout.h (class Layout::section_list): New method.
8796 * merge.h (Output_merge_base::entsize): Change visibility to public.
8797 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8798 New methods.
8799 (Output_merge_string::do_is_string): New method.
8800 * object.cc (Sized_relobj::do_setup): renamed from
8801 Sized_relobj::set_up.
8802 * object.h (Sized_relobj::adjust_shndx,
8803 Sized_relobj::initializ_input_to_output_maps,
8804 Sized_relobj::free_input_to_output_maps): Change visibilities to
8805 protected.
8806 (Sized_relobj::setup): Virtualize.
8807 (Sized_relobj::do_setup): New method declaration.
8808 (Sized_relobj::invalidate_section_offset,
8809 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8810 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8811 * options.cc (parse_int): New function.
8812 * options.h (parse_int): New declaration.
8813 (DEFINE_int): New macro.
8814 (stub_group_size): New option.
8815 * output.cc (Output_section::Output_section): Initialize memebers
8816 merge_section_map_, merge_section_by_properties_map_,
8817 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8818 (Output_section::add_input_section): Handled deferred code-fill
8819 generation and remove an old comment.
8820 (Output_section::add_relaxed_input_section): New method definition.
8821 (Output_section::add_merge_input_section): Use merge section by
8822 properties map to speed to search. Update merge section maps
8823 as appropriate.
8824 (Output_section::build_relaxation_map): New method definition.
8825 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8826 Same.
8827 (Output_section::relax_input_section): Renamed to
8828 Output_section::convert_input_sections_to_relaxed_sections and change
8829 interface to take a vector of pointers to relaxed sections.
8830 (Output_section::find_merge_section,
8831 Output_section::find_relaxed_input_section): New method definitions.
8832 (Output_section::is_input_address_mapped,
8833 Output_section::output_offset, Output_section::output_address):
8834 Use output section data maps to speed up searching.
8835 (Output_section::find_starting_output_address): Add comments.
8836 (Output_section::do_write,
8837 Output_section::write_to_postprocessing_buffer): Do code-fill
8838 generation as appropriate.
8839 (Output_section::get_input_sections): Invalidate relaxed input section
8840 map.
8841 (Output_section::restore_states): Adjust type of checkpoint .
8842 Invalidate relaxed input section map.
8843 * output.h (Output_merge_base): New class declaration.
8844 (Input_section_specifier): New class defintion.
8845 (class Output_relaxed_input_section) Change base class to
8846 Output_section_data_build.
8847 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8848 base class initializer.
8849 (Output_section::add_relaxed_input_section): New method declaration.
8850 (Output_section::Input_section): Change visibility to protected.
8851 (Output_section::Input_section::relobj,
8852 Output_section::Input_section::shndx): Handle relaxed input sections.
8853 Output_section::input_sections) Change visibility to protected. Also
8854 define overload to return a non-const pointer.
8855 (Output_section::Merge_section_properties): New class defintion.
8856 (Output_section::Merge_section_by_properties_map,
8857 Output_section::Output_section_data_by_input_section_map,
8858 Output_section::Relaxation_map): New types.
8859 (Output_section::relax_input_section): Rename method to
8860 Output_section::convert_input_sections_to_relaxed_sections and change
8861 interface to take a vector of relaxed section pointers.
8862 (Output_section::find_merge_section,
8863 Output_section::find_relaxed_input_section,
8864 Output_section::build_relaxation_map,
8865 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8866 New method declarations.
8867 (Output_section::merge_section_map_
8868 Output_section::merge_section_by_properties_map_,
8869 Output_section::relaxed_input_section_map_,
8870 Output_section::is_relaxed_input_section_map_valid_,
8871 Output_section::generate_code_fills_at_write_): New data members.
8872 * script-sections.cc
8873 (Output_section_element_input::set_section_addresses): Call
8874 current_data_size and addralign methods of relaxed input sections.
8875 (Orphan_output_section::set_section_addresses): Call current_data_size
8876 and addralign methods of relaxed input sections.
8877 * symtab.cc (Symbol_table::compute_final_value): Extract template
8878 from the body of Symbol_table::sized_finalize_symbol.
8879 (Symbol_table::sized_finalized_symbol): Call
8880 Symbol_table::compute_final_value.
8881 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8882 (Symbol_table::compute_final_value): New templated method declaration.
8883 * target.cc (Target::do_make_output_section): New method defintion.
8884 * target.h (Target::make_output_section): New method declaration.
8885 (Target::relax): Add more parameters for input objects, symbol table
8886 and layout. Adjust call to do_relax.
8887 (Target::do_make_output_section): New method declaration.
8888 (Target::do_relax): Add parameters for input objects, symbol table
8889 and layout.
8890
8891 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8892
8893 * pread.c: Include stdio.h.
8894
8895 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8896
8897 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8898 defined.
8899
8900 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8901
8902 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8903 Change read_shndx type to unsigned int.
8904 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8905 int.
8906 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8907 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8908 Change read_shndx type to unsigned int.
8909 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8910 int.
8911 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8912 * layout.cc (Layout::create_symtab_sections): Cast the result of
8913 local_symcount * symsize to off_t in the gold_assert.
8914
8915 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8916
8917 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8918 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8919 R_ARM_BASE_ABS.
8920 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8921 (Arm_relocate_functions::thm_abs5): New function.
8922 (Arm_relocate_functions::abs12): New function.
8923 (Arm_relocate_functions::abs16): New function.
8924 (Arm_relocate_functions::base_abs): New function.
8925 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8926 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8927 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8928 R_ARM_BASE_ABS.
8929 (Scan::global): Likewise.
8930 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8931 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8932 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8933 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8934 R_ARM_BASE_ABS.
8935
8936 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8937
8938 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8939 (Arm_relocate_functions::movt_prel): New function.
8940 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8941 (Arm_relocate_functions::thm_movt_prel): New function.
8942 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8943 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8944 (Scan::global, Relocate::relocate): Likewise.
8945 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8946
8947 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8948
8949 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8950 Incremental_checker.
8951 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8952 unsigned int.
8953 (class Incremental_inputs_header): New class.
8954 (Incremental_inputs_header_writer): Edit comment.
8955 (Incremental_inputs_entry): New class.
8956 (Incremental_inputs_entry_writer): Edit comment.
8957 (Sized_incremental_binary::do_find_incremental_inputs_section):
8958 Add *strtab_shndx parameter, fill it.
8959 (Sized_incremental_binary::do_check_inputs): New method.
8960 (Incremental_checker::can_incrementally_link_output_file): Use
8961 Sized_incremental_binary::check_inputs.
8962 (Incremental_inputs::report_command_line): Save command line in
8963 command_line_.
8964 * incremental.h:
8965 (Incremental_binary::find_incremental_inputs_section): New
8966 method.
8967 (Incremental_binary::do_find_incremental_inputs_section): Add
8968 strtab_shndx parameter.
8969 (Incremental_binary::do_check_inputs): New pure virtual method.
8970 (Sized_incremental_binary::do_check_inputs): Declare.
8971 (Incremental_checker::Incremental_checker): Add incremental_inputs
8972 parameter, use it to initialize incremental_inputs_.
8973 (Incremental_checker::incremental_inputs_): New field.
8974 (Incremental_checker::command_line): New method.
8975 (Incremental_checker::inputs): New method.
8976 (Incremental_checker::command_line_): New field.
8977
8978 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8979
8980 * incremental.cc: Include <cstdarg> and "target-select.h".
8981 (vexplain_no_incremental): New function.
8982 (explain_no_incremental): New function.
8983 (Incremental_binary::error): New method.
8984 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8985 method.
8986 (make_sized_incremental_binary): New function.
8987 (open_incremental_binary): New function.
8988 (can_incrementally_link_file): Add checks if output is ELF and has
8989 inputs section.
8990 * incremental.h: Include "elfcpp_file.h" and "output.h".
8991 (Incremental_binary): New class.
8992 (Sized_incremental_binary): New class.
8993 (open_incremental_binary): Declare.
8994 * object.cc (is_elf_object): Use
8995 elfcpp::Elf_recognizer::is_elf_file.
8996 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8997 * output.h (Output_file::filesize): New method.
8998
8999 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9000
9001 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9002 New function.
9003 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9004 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9005 function.
9006 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9007 function.
9008 (Arm_relocate_functions::movw_abs_nc): New function.
9009 (Arm_relocate_functions::movt_abs): New function.
9010 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9011 (Arm_relocate_functions::thm_movt_abs): New function.
9012 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9013 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9014 (Scan::global): Likewise.
9015 (Relocate::relocate): Likewise.
9016 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9017
9018 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9019
9020 * arm.cc (Arm_relocate_functions::got_prel) New function.
9021 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9022 (Relocate::relocate): Likewise.
9023 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9024
9025 2009-10-06 Ian Lance Taylor <iant@google.com>
9026
9027 * options.h (class General_options): Define
9028 split_stack_adjust_size parameter.
9029 * object.h (class Object): Add uses_split_stack_ and
9030 has_no_split_stack_ fields. Add uses_split_stack and
9031 has_no_split_stack accessor functions. Declare
9032 handle_split_stack_section.
9033 (class Reloc_symbol_changes): Define.
9034 (class Sized_relobj): Define Function_offsets. Declare
9035 split_stack_adjust, split_stack_adjust_reltype, and
9036 find_functions.
9037 * object.cc (Object::handle_split_stack_section): New function.
9038 (Sized_relobj::do_layout): Call handle_split_stack_section.
9039 * dynobj.cc (Sized_dynobj::do_layout): Call
9040 handle_split_stack_section.
9041 * reloc.cc (Sized_relobj::relocate_sections): Call
9042 split_stack_adjust for executable sections in split_stack
9043 objects. Pass reloc_map to relocate_section.
9044 (Sized_relobj::split_stack_adjust): New function.
9045 (Sized_relobj::split_stack_adjust_reltype): New function.
9046 (Sized_relobj::find_functions): New function.
9047 * target-reloc.h: Include "object.h".
9048 (relocate_section): Add reloc_symbol_changes parameter. Change
9049 all callers.
9050 * target.h (class Target): Add calls_non_split method. Declare
9051 do_calls_non_split virtual method. Declare match_view and
9052 set_view_to_nop.
9053 * target.cc: Include "elfcpp.h".
9054 (Target::do_calls_non_split): New function.
9055 (Target::match_view): New function.
9056 (Target::set_view_to_nop): New function.
9057 * gold.cc (queue_middle_tasks): Give an error if mixing
9058 split-stack and non-split-stack objects with -r.
9059 * i386.cc (Target_i386::relocate_section): Add
9060 reloc_symbol_changes parameter.
9061 (Target_i386::do_calls_non_split): New function.
9062 * x86_64.cc (Target_x86_64::relocate_section): Add
9063 reloc_symbol_changes parameter.
9064 (Target_x86_64::do_calls_non_split): New function.
9065 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9066 parameter.
9067 * powerpc.cc (Target_powerpc::relocate_section): Add
9068 reloc_symbol_changes parameter.
9069 * sparc.cc (Target_sparc::relocate_section): Add
9070 reloc_symbol_changes parameter.
9071 * configure.ac: Call AM_CONDITIONAL for the default target.
9072 * configure: Rebuild.
9073 * testsuite/Makefile.am (TEST_AS): New variable.
9074 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9075 (check_DATA): Add split_i386 and split_x86_64 files.
9076 (SPLIT_DEFSYMS): Define.
9077 (split_i386_[1234n].o): New targets.
9078 (split_i386_[124]): New targets.
9079 (split_i386_[1234r].stdout): New targets.
9080 (split_x86_64_[1234n].o): New targets.
9081 (split_x86_64_[124]): New targets.
9082 (split_x86_64_[1234r].stdout): New targets.
9083 (MOSTLYCLEANFILES): Add new executables.
9084 * testsuite/split_i386.sh: New file.
9085 * testsuite/split_x86_64.sh: New file.
9086 * testsuite/split_i386_1.s: New file.
9087 * testsuite/split_i386_2.s: New file.
9088 * testsuite/split_i386_3.s: New file.
9089 * testsuite/split_i386_4.s: New file.
9090 * testsuite/split_i386_n.s: New file.
9091 * testsuite/split_x86_64_1.s: New file.
9092 * testsuite/split_x86_64_2.s: New file.
9093 * testsuite/split_x86_64_3.s: New file.
9094 * testsuite/split_x86_64_4.s: New file.
9095 * testsuite/split_x86_64_n.s: New file.
9096 * testsuite/testfile.cc (Target_test): Update relocation_section
9097 function.
9098 * testsuite/Makefile.in: Rebuild.
9099
9100 2009-10-06 Ian Lance Taylor <iant@google.com>
9101
9102 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9103 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9104 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9105 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9106 the address on ldo_addrs_.
9107 (Target_i386::Relocate::fix_up_ldo): New function.
9108
9109 2009-10-06 Rafael Espindola <espindola@google.com>
9110
9111 * plugin.cc (add_input_library): New.
9112 (Plugin::load): Add add_input_library to tv.
9113 (Plugin_manager::add_input_file): Add the is_lib argument.
9114 (add_input_file): Update call to Plugin_manager::add_input_file.
9115 (add_input_library): New.
9116 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9117
9118 2009-09-30 Doug Kwan <dougkwan@google.com>
9119
9120 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9121 symbol and call Symbol::may_need_copy_reloc to determine if
9122 a copy reloc is needed.
9123 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9124 nocopyreloc is given in command line.
9125 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9126 given in command line.
9127 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9128 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9129 of the removed Target_i386::may_need_copy_reloc.
9130 * options.h (copyreloc): New option with default value false.
9131 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9132 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9133 instead of the removed Target_powerpc::may_need_copy_reloc.
9134 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9135 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9136 instead of the removed Target_sparc::may_need_copy_reloc.
9137 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9138 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9139 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9140 instead of the removed Target_x86_64::may_need_copy_reloc.
9141
9142 2009-09-30 Ian Lance Taylor <iant@google.com>
9143
9144 * object.h (class Object): Remove target_ field, and target,
9145 sized_target, and set_target methods.
9146 (Object::sized_target): Remove.
9147 (class Sized_relobj): Update declarations. Remove sized_target.
9148 * object.cc (Sized_relobj::setup): Remove target parameter.
9149 Change all callers.
9150 (Input_objects::add_object): Don't do anything with the target.
9151 (make_elf_sized_object): Add punconfigured parameter. Change all
9152 callers. Set or test parameter target.
9153 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9154 Change all callers.
9155 * parameters.cc (Parameters::set_target): Change parameter type to
9156 be non-const.
9157 (Parameters::default_target): Remove.
9158 (set_parameters_target): Change parameter type to be non-const.
9159 (parameters_force_valid_target): New function.
9160 (parameters_clear_target): New function.
9161 * parameters.h (class Parameters): Update declarations. Remove
9162 default_target method. Add sized_target and clear_target
9163 methods. Change target_ to be non-const.
9164 (set_parameters_target): Update declaration.
9165 (parameters_force_valid_target): Declare.
9166 (parameters_clear_target): Declare.
9167 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9168 as NULL if we aren't searching.
9169 (Add_symbols::run): Don't check for compatible target.
9170 * fileread.cc (Input_file::open_binary): Call
9171 parameters_force_valid_target.
9172 * gold.cc (queue_middle_tasks): Likewise.
9173 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9174 set_target on object.
9175 * dynobj.h (class Sized_dynobj): Update declarations.
9176 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9177 make_elf_object returns NULL.
9178 (Archive::include_member): Don't check whether object target is
9179 compatible.
9180 * output.cc (Output_section::add_input_section): Get target from
9181 parameters.
9182 (Output_section::relax_input_section): Likewise.
9183 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9184 parameters.
9185 (Sized_relobj::do_scan_relocs): Likewise.
9186 (Sized_relobj::relocate_sections): Likewise.
9187 * resolve.cc (Symbol_table::resolve): Likewise.
9188 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9189 parameter. Change all callers.
9190 (Symbol_table::add_from_object): Get target from parameters.
9191 (Symbol_table::add_from_relobj): Don't check object target.
9192 (Symbol_table::add_from_dynobj): Likewise.
9193 (Symbol_table::define_special_symbol): Get target from
9194 parameters.
9195 * symtab.h (class Symbol_table): Update declaration.
9196 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9197 parameter. Change all callers. Clear parameter target.
9198 (Binary_test): Test target here.
9199 * testsuite/object_unittest.cc (gold_testsuite): Remove
9200 target_test_pointer parameter. Change all callers.
9201 (Object_test): Test target here.
9202
9203 2009-09-26 Ian Lance Taylor <iant@google.com>
9204
9205 * testsuite/initpri1.c: Don't try to use constructor priorities if
9206 compiling with gcc before 4.3.
9207
9208 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9209
9210 * testsuite/retain_symbols_file_test.sh (check_present): Change
9211 output file name to retain_symbols_file_test.stdout.
9212 (check_absent): Likewise.
9213
9214 2009-09-18 Craig Silverstein <csilvers@google.com>
9215
9216 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9217 * options.cc: Include <cerrno> and <fstream>.
9218 (General_options::finalize): Parse -retain-symbols-file tag.
9219 * options.h: New flag.
9220 (General_options): New method should_retain_symbol, new
9221 variable symbols_to_retain.
9222 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9223 should_retain_symbol map.
9224 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9225 * testsuite/Makefile.in: Regenerate.
9226 * testsuite/retain_symbols_file_test.sh: New file.
9227
9228 2009-09-18 Nick Clifton <nickc@redhat.com>
9229
9230 * po/es.po: Updated Spanish translation.
9231
9232 2009-09-17 Doug Kwan <dougkwan@google.com>
9233
9234 * debug.h (DEBUG_RELAXATION): New constant.
9235 (DEBUG_ALL): Add DEBUG_RELAXATION.
9236 (debug_string_to_enum): Add relaxation debug option.
9237 * layout.cc
9238 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9239 Layout::Relaxation_debug_check::read_sections,
9240 Layout::Relaxation_debug_check::read_sections): New method definitions.
9241 (Layout::Layout): Initialize data members
9242 record_output_section_data_from_scrips_,
9243 script_output_section_data_list_ and relaxation_debug_check_.
9244 (Layout::save_segments, Layout::restore_segments,
9245 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9246 Layout::relaxation_loop_body): New method definitions.
9247 (Layout::finalize): Support relaxation. Move section layout code to
9248 Layout::relaxation_loop_body.
9249 (Layout::set_asection_address_from_script): Move code for orphan
9250 section placement out.
9251 (Layout::place_orphan_sections_in_script): New method definition.
9252 * layout.h (Output_segment_headers, Output_file_header):
9253 New forward class declarations.
9254 (Layout::~Layout): Define.
9255 (Layout::new_output_section_data_from_script): New method definition.
9256 (Layout::place_orphan_sections_in_script): New method declaration.
9257 (Layout::Segment_states): New type declaration.
9258 (Layout::save_segments, Layout::restore_segments,
9259 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9260 Layout::relaxation_loop_body): New method declarations.
9261 (Layout::Output_section_data_list): New type declaration.
9262 (Layout::Relaxation_debug_check): New class definition.
9263 (Layout::record_output_section_data_from_script_,
9264 Layout::script_output_section_data_list_, Layout::segment_states_,
9265 Layout::relaxation_debug_check_): New data members.
9266 * output.cc: (Output_section_headers::do_size): New method definition.
9267 (Output_section_headers::Output_section_headers): Move size
9268 computation to Output_section_headers::do_size.
9269 (Output_segment_headers::do_size): New method definition.
9270 (Output_file_header::Output_file_header): Move size computation to
9271 Output_file_header::do_size and call it.
9272 (Output_file_header::do_size): New method definition.
9273 (Output_data_group::Output_data_group): Adjust call to
9274 Output_section_data.
9275 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9276 (Output_symtab_xindex::do_write): Add array bound check.
9277 (Output_section::Input_section::print_to_mapfile): Handle
9278 RELAXED_INPUT_SECTION_CODE.
9279 (Output_section::Output_section): Initialize data member checkpoint_.
9280 (Output_section::~Output_section): Delete checkpoint object pointed
9281 by checkpoint_.
9282 (Output_section::add_input_section): Always add an Input_section if
9283 relaxing.
9284 (Output_section::add_merge_input_section): Add assert.
9285 (Output_section::relax_input_section): New method definition.
9286 (Output_section::set_final_data_size): Set load address to zero for
9287 an unallocated section.
9288 (Output_section::do_address_and_file_offset_have_reset_values):
9289 New method definition.
9290 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9291 Handle relaxed input section.
9292 (Output_section::sort_attached_input_sections): Checkpoint input
9293 section list lazily.
9294 (Output_section::get_input_sections): Change type of input_sections to
9295 list of Simple_input_section pointers. Checkpoint input section list
9296 lazily. Also handle relaxed input sections.
9297 (Output_section::add_input_section_for_script): Take a reference to
9298 a Simple_input_section object instead of Relobj pointer and section
9299 index as parameter. Handle relaxed input sections.
9300 (Output_section::save_states, Output_section::restore_states): New
9301 method definitions.
9302 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9303 (Output_data::is_data_size_fixed): New method definition.
9304 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9305 if it is fixed.
9306 (Output_data::address_and_file_offset_have_reset_values): New method
9307 definition.
9308 (Output_data::do_address_and_file_offset_have_reset_values): New method
9309 definition.
9310 (Output_data::set_data_size): Check that data size is not fixed.
9311 (Output_data::fix_data_size): New method definition.
9312 (Output_data::is_data_size_fixed_): New data member.
9313 (Output_section_headers::set_final_data_size): New method definition.
9314 (Output_section_headers::do_size): New method declaration.
9315 (Output_segment_headers::set_final_data_size): New method definition.
9316 (Output_segment_headers::do_size): New method declaration.
9317 (Output_file_header::set_final_data_size)::New method definition.
9318 (Output_file_header::do_size)::New method declaration.
9319 (Output_section_data::Output_section_data): Add new parameter
9320 is_data_size_fixed and use it to fix data size.
9321 (Output_data_const::Output_data_const): Adjust call to base class
9322 constructor and fix data size.
9323 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9324 base class constructor and fix data size.
9325 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9326 base class constructor and fix data size.
9327 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9328 class constructor and fix data size.
9329 (Output_data_group::set_final_data_size): New method definition.
9330 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9331 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9332 class constructor and fix data size.
9333 (Output_relaxed_input_section): New class definition.
9334 (Output_section::Simple_input_section): New class definition.
9335 (Output_section::get_input_sections): Adjust parameter list.
9336 (Output_section::add_input_section_for_script): Same.
9337 (Output_section::save_states, Output_section::restore_states,
9338 Output_section::do_address_and_file_offset_have_reset_values,
9339 (Output_section::Input_section::Input_section): Handle
9340 RELAXED_INPUT_SECTION_CODE. Add new overload for
9341 Output_relaxed_input_section.
9342 (Output_section::Input_section::is_input_section,
9343 Output_section::Input_section::set_output_section): Handle relaxed
9344 input section.
9345 (Output_section::Input_section::is_relaxed_input_section,
9346 Output_section::Input_section::output_section_data,
9347 Output_section::Input_section::relaxed_input_section): New method
9348 definitions.
9349 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9350 value.
9351 (Output_section::Input_section::u1_): Update comments.
9352 (Output_section::Input_section::u2_): Add new union member poris.
9353 (Output_section::Checkpoint_output_section): New classs definition.
9354 (Output_section::relax_input_section): New method declaration.
9355 (Output_section::checkpoint_): New data member.
9356 (Output_segment): Update comments.
9357 (Output_segment::Output_segment): Un-privatize copy constructor.
9358 (Output_segment::operator=): Un-privatize.
9359 * script-sections.cc (Output_section_element::Input_section_list):
9360 Change element type to Output_section::Simple_input_section.
9361 (Output_section_element_dot_assignment::set_section_addresses):
9362 Register output section data for relaxation clean up.
9363 (Output_data_exression::Output_data_expression): Adjust call to base
9364 constructor to fix data size.
9365 (Output_section_element_data::set_section_addresses): Register
9366 Output_data_expression object for relaxation clean up.
9367 (struct Input_section_info): Replace Relobj pointer and section index
9368 pair with Output_section::Simple_input_section and Convert struct to a
9369 class.
9370 (Input_section_sorter::operator()): Adjust access to
9371 Input_section_info data member to use accessors.
9372 (Output_section_element_input::set_section_addresses): Use layout
9373 parameter. Adjust code to use Output_section::Simple_input_section
9374 and Input_secction_info classes. Register filler for relaxation
9375 clean up.
9376 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9377 and section index pair with Output_section::Simple_input_section
9378 class. Adjust code accordingly.
9379 (Phdrs_element::release_segment): New method definition.
9380 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9381 segment list.
9382 (Script_sections::release_segments): New method definition.
9383 * gold/script-sections.h (Script_sections::release_segments): New
9384 method declaration.
9385 * gold/target.h (Target::may_relax, Target::relax,
9386 Target::do_may_relax, Target::do_relax): New method definitions.
9387
9388 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9389
9390 * arm.cc (has_signed_unsigned_overflow): New function.
9391 (Arm_relocate_functions::abs8): New function.
9392 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9393 (Target_arm::Scan::global): Likewise.
9394 (Target_arm::relocate::relocate): Likewise.
9395 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9396 Likewise.
9397
9398 2009-09-16 Cary Coutant <ccoutant@google.com>
9399
9400 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9401 * testsuite/Makefile.in: Regenerate.
9402
9403 2009-09-11 Nick Clifton <nickc@redhat.com>
9404
9405 * po/gold.pot: Updated by the Translation project.
9406
9407 2009-09-08 Cary Coutant <ccoutant@google.com>
9408
9409 * output.cc (Output_file::open): Add execute permission to empty file.
9410 * testsuite/Makefile.am (permission_test): New test.
9411 * testsuite/Makefile.in: Regenerate.
9412
9413 2009-09-02 Ian Lance Taylor <iant@google.com>
9414
9415 * output.cc (Output_file::resize): Call map_no_anonymous rather
9416 than map.
9417
9418 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9419
9420 * gold.cc: Include "incremental.h".
9421 (queue_initial_tasks): Call Incremental_checker methods.
9422 * incremental.cc: Include "output.h".
9423 (Incremental_checker::can_incrementally_link_output_file): New
9424 method.
9425 * incremental.h (Incremental_checker): New class.
9426
9427 * output.cc (Output_file::open_for_modification): New method.
9428 (Output_file::map_anonymous): Changed return type to bool. Record
9429 map in base_ field.
9430 (Output_file::map_no_anonymous): New method, broken out of map.
9431 (Output_file::map): Use map_no_anonymous and map_anonymous.
9432 * output.h (class Output_file): Update declarations.
9433
9434 2009-08-24 Cary Coutant <ccoutant@google.com>
9435
9436 * options.h (Command_line::Pre_options): New class.
9437 (Command_line::pre_options): New member.
9438 * options.cc (gold::options::ready_to_register): New variable.
9439 (One_option::register_option): Do nothing if not registering options.
9440 Assert if same short option registered twice.
9441 (General_options::General_options): Turn off option registration when
9442 done constructing.
9443 (Command_line::Pre_options::Pre_options): New constructor.
9444
9445 2009-08-24 Cary Coutant <ccoutant@google.com>
9446
9447 * options.h (General_options::no_keep_memory): Remove incorrect
9448 short option.
9449
9450 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9451
9452 * Makefile.am (am__skiplex, am__skipyacc): New.
9453 * Makefile.in: Regenerate.
9454
9455 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9456
9457 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9458 (INCLUDES): ... this.
9459 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9460 (AM_CPPFLAGS): Renamed from ...
9461 (INCLUDE): ... this.
9462 * Makefile.in, testsuite/Makefile.in: Regenerate.
9463
9464 * Makefile.in: Regenerate.
9465 * aclocal.m4: Likewise.
9466 * config.in: Likewise.
9467 * configure: Likewise.
9468 * testsuite/Makefile.in: Likewise.
9469
9470 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9471 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9472 * Makefile.in: Regenerate.
9473 * testsuite/Makefile.in: Regenerate.
9474
9475 2009-08-19 Cary Coutant <ccoutant@google.com>
9476
9477 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9478 symbols in shared libraries overridden by hidden or internal symbols
9479 in the main program.
9480
9481 2009-08-19 Chris Demetriou <cgd@google.com>
9482
9483 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9484 checking source file names in error messages.
9485
9486 2009-08-18 Doug Kwan <dougkwan@google.com>
9487
9488 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9489 an elcpp::Ehdr as parameter. Adjust call to set_target.
9490 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9491 an elfcpp::Ehdr as parameter.
9492 * object.cc (Object::set_target): Remove the version that looks up
9493 a target and sets it.
9494 (Sized_relobj::setup): Take a Target object instead of
9495 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9496 (make_elf_sized_object): Find target and ask target to
9497 make an ELF object.
9498 * object.h: (Object::set_target): Remove the version that looks up
9499 a target and sets it.
9500 (Sized_relobj::setup): Take a Target object instead of
9501 an elfcpp:Ehdr as parameter.
9502 * target.cc: Include dynobj.h.
9503 (Target::do_make_elf_object_implementation): New.
9504 (Target::do_make_elf_object): New.
9505 * target.h (Target::make_elf_object): New template declaration.
9506 (Target::do_make_elf_object): New method declarations.
9507 (Target::do_make_elf_object_implementation): New template declaration.
9508
9509 2009-08-14 Ian Lance Taylor <iant@google.com>
9510
9511 * gold.h (FUNCTION_NAME): Define.
9512 (gold_unreachable): Use FUNCTION_NAME.
9513
9514 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9515
9516 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9517 symbol in the --keep-unique list is not found.
9518
9519 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9520
9521 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9522 been maked as --keep-unique.
9523 (Icf::unfold_section): New function.
9524 * icf.h (Icf::unfold_section): New function.
9525 * options.h (General_options::keep_unique): New option.
9526 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9527 * testsuite/Makefile.in: Regenerate.
9528 * testsuite/icf_keep_unique_test.sh: New file.
9529 * testsuite/icf_keep_unique_test.cc: New file.
9530
9531 2009-08-12 Cary Coutant <ccoutant@google.com>
9532
9533 PR 10471
9534 * resolve.cc (Symbol_table::resolve): Check for references from
9535 dynamic objects to hidden and internal symbols.
9536 * testsuite/Makefile.am (hidden_test.sh): New test.
9537 * testsuite/Makefile.in: Regenerate.
9538 * testsuite/hidden_test.sh: New script.
9539 * testsuite/hidden_test_1.c: New test source.
9540 * testsuite/hidden_test_main.c: New test source.
9541
9542 2009-08-11 Doug Kwan <dougkwan@google.com>
9543
9544 * arm.cc: Update comments.
9545 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9546 segment to locate the .ARM.exidx section if present.
9547
9548 2009-08-09 Doug Kwan <dougkwan@google.com>
9549
9550 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9551 patch.
9552
9553 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9554 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9555 compiler warnings.
9556
9557 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9558
9559 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9560 valid tls_segment only for non-debug-section relocations.
9561 * testsuite/Makefile.am: Add gc_tls_test.
9562 * testsuite/Makefile.in: Regenerate.
9563 * testsuite/gc_tls_test.cc: New file.
9564 * testsuite/gc_tls_test.sh: New file.
9565
9566 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9567
9568 * icf.cc: New file.
9569 * icf.h: New file.
9570 * Makefile.am (CCFILES): Add icf.cc.
9571 (HFILES): Add icf.h
9572 * Makefile.in: Regenerate.
9573 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9574 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9575 section, symbol and addend information for the relocs.
9576 * gold.cc (queue_middle_tasks): Call identical code folding.
9577 * gold.h: Add defines for multimap.
9578 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9579 to the call of finalize_local_symbols.
9580 * main.cc (main): Create object of class Icf.
9581 * object.cc (Sized_relobj::do_layout): Allow this function to be
9582 called twice during icf.
9583 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9584 to sections marked as identical by icf.
9585 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9586 when available.
9587 (Sized_relobj::do_section_entsize): New function.
9588 * object.h (Object::section_entsize): New function.
9589 (Object::do_section_entsize): New pure virtual function.
9590 (Relobj::finalize_local_symbols): Add new parameter.
9591 (Relobj::do_section_entsize): New function.
9592 * options.h (General_options::icf): New option.
9593 (General_options::icf_iterations): New option.
9594 (General_options::print_icf_sections): New option.
9595 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9596 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9597 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9598 icf.
9599 * symtab.cc (Symbol_table::is_section_folded): New function.
9600 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9601 to sections marked as identical by icf.
9602 * symtab.h (Symbol_table::set_icf): New function.
9603 (Symbol_table::icf): New function.
9604 (Symbol_table::is_section_folded): New function.
9605 (Symbol_table::icf_): New data member.
9606 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9607 * testsuite/Makefile.am: Add commands to build icf_test.
9608 * testsuite/Makefile.in: Regenerate.
9609 * testsuite/icf_test.sh: New file.
9610 * testsuite/icf_test.cc: New file.
9611
9612 2009-07-24 Chris Demetriou <cgd@google.com>
9613
9614 * layout.cc (is_compressible_debug_section): Fix incorrect
9615 comment about compressed section names.
9616
9617 2009-07-20 Ian Lance Taylor <ian@airs.com>
9618
9619 PR 10419
9620 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9621
9622 2009-07-16 Ian Lance Taylor <iant@google.com>
9623
9624 PR 10400
9625 * layout.h: #include <map>.
9626 (class Kept_section): Change from struct to class. Add accessors
9627 and setters. Add section size to Comdat_group mapping. Change
9628 Comdat_group to std::map. Add is_comdat_ field. Add
9629 linkonce_size field in union.
9630 (class Layout): Update declaration of find_or_add_kept_section.
9631 Don't declare find_kept_object.
9632 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9633 parameter. Add object, shndx, is_comdat, and is_group_name
9634 parameters. Change all callers. Adjust for new Kept_section.
9635 (Layout::find_kept_object): Remove.
9636 * object.cc (Sized_relobj::include_section_group): Update use of
9637 Kept_section. Rename secnum to shndx. Only record
9638 Kept_comdat_section if sections are the same size.
9639 (Sized_relobj::include_linkonce_section): Update use of
9640 Kept_section. Only record Kept_comdat_section if sections are the
9641 same size. Set size of linkonce section.
9642 (Sized_relobj::map_to_kept_section): Update call to
9643 get_kept_comdat_section.
9644 * object.h (class Sized_relobj): Rename fields in
9645 Kept_comdat_section to drop trailing underscores; change object
9646 field to Relobj*. Change Kept_comdat_section_table to store
9647 struct rather than pointer.
9648 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9649 Add kept_object and kept_shndx parameters. Change all callers.
9650 (Sized_relobj::get_kept_comdat_section): Change return type to
9651 bool. Add kept_object and kept_shndx parameters. Change all
9652 callers.
9653 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9654 Layout::find_or_add_kept_section.
9655
9656 2009-07-09 Ian Lance Taylor <iant@google.com>
9657
9658 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9659 Reserve space in the hash table.
9660
9661 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9662
9663 * fileread.cc (File_read::get_mtime): New method.
9664 * fileread.h (Timespec): New structure.
9665 (File_read::get_mtime): New method.
9666 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9667 Renamed from timestamp_nsec.
9668 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9669 Elf_Xword.
9670 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9671 timestamp_nsec.
9672 (Incremental_inputs::report_archive): Save mtime; style fix.
9673 (Incremental_inputs::report_obejct): Save mtime; style fix.
9674 (Incremental_inputs::report_script): Save mtime; style fix.
9675 (Incremental_inputs::finalize_inputs): Style fix.
9676 (Incremental_inputs::finalize): Style fix.
9677 (Incremental_inputs::create_input_section_data): Store inputs
9678 mtime.
9679 * incremental.h (Incremental_inputs::report_script): Add mtime
9680 argument.
9681 (Incremental_inputs::Input_info::Input_info): Intialize only one
9682 union member.
9683 (Incremental_inputs::Input_info::archive): Move to nameless
9684 union.
9685 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9686 (Incremental_inputs::Input_info::script): Move to nameless union.
9687 (Incremental_inputs::mtime): New field.
9688 * script.cc (read_input_script): Pass file mtime to
9689 Incremental_input.
9690 * script.h (Script_info::inputs): Style fix.
9691
9692 2009-07-01 Ian Lance Taylor <ian@airs.com>
9693
9694 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9695 instead of 32.
9696
9697 2009-06-24 Ian Lance Taylor <iant@google.com>
9698
9699 PR 10156
9700 * layout.cc (Layout::choose_output_section): If we find an
9701 existing section, update the flags.
9702 (Layout::create_notes): New function, broken out of
9703 Layout::finalize.
9704 (Layout::finalize): Don't create note sections.
9705 (Layout::create_note): Don't crash if linker script discards
9706 section.
9707 (Layout::create_gold_note): Likewise.
9708 (Layout::create_build_id): Likewise. Don't set
9709 after_input_sections on the section.
9710 (Layout::create_executable_stack_info): Remove target parameter.
9711 Change caller.
9712 * layout.h (class Layout): Declare create_notes. Update
9713 declaration of create_executable_stack_info.
9714 * gold.cc (queue_middle_tasks): Call create_notes.
9715 * output.cc (Output_section::update_flags_for_input_section): Move
9716 here from output.h. If SHF_ALLOC flag is newly set, mark address
9717 invalid.
9718 * output.h (Output_data::mark_address_invalid): New function.
9719 (class Output_section): Only declare, not define,
9720 update_flags_for_input_section. Remove set_flags.
9721
9722 2009-06-24 Ian Lance Taylor <iant@google.com>
9723
9724 * script-sections.cc (Output_section_definition::
9725 set_section_addresses): Rename shadowing local load_address to
9726 laddr.
9727
9728 2009-06-24 Ian Lance Taylor <iant@google.com>
9729
9730 PR 10244
9731 * reloc.cc (relocate_sections): Skip empty relocation sections.
9732
9733 2009-06-23 Ian Lance Taylor <iant@google.com>
9734
9735 PR 10156
9736 * layout.cc (Layout::create_note): Use choose_output_section
9737 rather than make_output_section.
9738
9739 2009-06-23 Ian Lance Taylor <iant@google.com>
9740
9741 PR 10237
9742 * options.cc (General_options::parse_V): Set printed_version_.
9743 (General_options::General_options): Initialize printed_version_.
9744 * options.h (class General_options): Add printed_version_ field.
9745 * gold.cc (queue_initial_tasks): If there are no input files,
9746 don't give a fatal error if we printed the version information.
9747 (queue_middle_tasks): If using -r with a shared object, give a
9748 fatal error rather than an ordinary error.
9749
9750 2009-06-23 Ian Lance Taylor <iant@google.com>
9751
9752 PR 10219
9753 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9754 (Layout::make_output_section): Set have_stabstr_section_ if we see
9755 a .stab*str section.
9756 (Layout::finalize): Call link_stabs_sections.
9757 (Layout::link_stabs_sections): New file.
9758 * layout.h (class Layout): Add have_stabstr_section_ field.
9759 Declare link_stabs_sections.
9760
9761 2009-06-23 Doug Kwan <dougkwan@google.com>
9762
9763 * Makefile.am (libgold_a_LIBADD): New.
9764 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9765 * Makefile.in: Regenerate.
9766 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9767 * configure: Regenerate.
9768 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9769 * fileread.cc: Include sys/state.h
9770 * gold.h: Declare memmem and strndup if found missing.
9771 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9772
9773 2009-06-23 Ian Lance Taylor <iant@google.com>
9774
9775 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9776 * configure: Rebuild.
9777
9778 2009-06-23 Ian Lance Taylor <iant@google.com>
9779
9780 PR 10147
9781 * object.cc (Object::section_contents): Don't try to get a view if
9782 the section has length zero.
9783 (Object::handle_gnu_warning_section): If the section is empty, use
9784 the name of the section as the warning.
9785
9786 2009-06-23 Ian Lance Taylor <iant@google.com>
9787
9788 PR 10133
9789 * stringpool.h (class Stringpool_template): Add optimize_ field.
9790 (Stringpool_template::set_optimize): New function.
9791 * stringpool.cc (Stringpool_template::Stringpool_template):
9792 Initialize optimize_ field.
9793 (Stringpool_template::set_string_offsets): Test local optimize
9794 fild rather than parameter.
9795 * layout.cc (Layout::Layout): Call set_optimize on the section
9796 name stringpool.
9797
9798 2009-06-22 Ian Lance Taylor <iant@google.com>
9799
9800 PR 10030
9801 * yyscript.y: Parse TARGET.
9802 * script.cc (script_set_target): New function.
9803 * script-c.h (script_set_target): Declare.
9804 * options.cc (General_options::string_to_object_format): Rename
9805 from string_to_object_format in anonymous namespace. Change
9806 callers.
9807 * options.h (class General_options): Declare
9808 string_to_object_format.
9809
9810 2009-06-22 Ian Lance Taylor <iant@google.com>
9811
9812 * script-sections.cc (Script_sections::create_segments): Don't put
9813 program headers in a PT_LOAD segment if -n or -N.
9814
9815 2009-06-22 Ian Lance Taylor <iant@google.com>
9816
9817 PR 10141
9818 * options.h (class General_options): Add -z lazy and -z now. Sort
9819 -z options into alphabetical order.
9820 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9821
9822 2009-06-21 Ian Lance Taylor <iant@google.com>
9823
9824 * layout.cc (Layout::make_output_section): Call
9825 Target::new_output_section.
9826 (Layout::attach_allocated_section_to_segment): Put large section
9827 sections in a separate load segment with the large segment flag
9828 set.
9829 (Layout::segment_precedes): Sort large data segments after other
9830 load segments.
9831 (align_file_offset): New static function.
9832 (Layout::set_segment_offsets): Use align_file_offset.
9833 * output.h (class Output_section): Add is_small_section_ and
9834 is_large_section_ fields.
9835 (Output_section::is_small_section): New function.
9836 (Output_section::set_is_small_section): New function.
9837 (Output_section::is_large_section): New function.
9838 (Output_section::set_is_large_section): New function.
9839 (Output_section::is_large_data_section): New function.
9840 (class Output_segment): Add is_large_data_segment_ field.
9841 (Output_segment::is_large_data_segment): New function.
9842 (Output_segment::set_is_large_data_segment): New function.
9843 * output.cc (Output_section::Output_section): Initialize new
9844 fields.
9845 (Output_segment::Output_segment): Likewise.
9846 (Output_segment::add_output_section): Add assertion that large
9847 data sections always go in large data segments. Force small data
9848 sections to the end of the list of data sections. Force small BSS
9849 sections to the start of the list of BSS sections. For large BSS
9850 sections to the end of the list of BSS sections.
9851 * symtab.h (class Symbol): Declare is_common_shndx.
9852 (Symbol::is_defined): Check Symbol::is_common_shndx.
9853 (Symbol::is_common): Likewise.
9854 (class Symbol_table): Define enum Commons_section_type. Update
9855 declarations. Add small_commons_ and large_commons_ fields.
9856 * symtab.cc (Symbol::is_common_shndx): New function.
9857 (Symbol_table::Symbol_table): Initialize new fields.
9858 (Symbol_table::add_from_object): Put small and large common
9859 symbols in the right list.
9860 (Symbol_table::sized_finalized_symbol): Check
9861 Symbol::is_common_shndx.
9862 (Symbol_table::sized_write_globals): Likewise.
9863 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9864 common symbol lists. Don't call do_allocate_commons_list if the
9865 list is empty.
9866 (Symbol_table::do_allocate_commons_list): Remove is_tls
9867 parameter. Add comons_section_type parameter. Change all
9868 callers. Handle small and large common symbols.
9869 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9870 Symbol::is_common_shndx.
9871 * resolve.cc (symbol_to_bits): Likewise.
9872 * target.h (Target::small_common_shndx): New function.
9873 (Target::small_common_section_flags): New function.
9874 (Target::large_common_shndx): New function.
9875 (Target::large_common_section_flags): New function.
9876 (Target::new_output_section): New function.
9877 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9878 small_common_section_flags, and large_common_section_flags
9879 fields.
9880 (Target::do_new_output_section): New virtual function.
9881 * arm.cc (Target_arm::arm_info): Initialize new fields.
9882 * i386.cc (Target_i386::i386_info): Likewise.
9883 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9884 Likewise.
9885 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9886 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9887 (Target_x86_64::do_new_output_section): New function.
9888 * configure.ac: Define conditional MCMODEL_MEDIUM.
9889 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9890 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9891 (large_LDFLAGS): Define.
9892 * testsuite/large.c: New file.
9893 * testsuite/testfile.cc (Target_test::test_target_info):
9894 Initialize new fields.
9895 * configure, testsuite/Makefile.in: Rebuild.
9896
9897 2009-06-05 Doug Kwan <dougkwan@google.com>
9898
9899 * Makefile.am (CCFILES): Add target.cc.
9900 * Makefile.in: Regenerate.
9901 * i386.cc (class Target_i386): Define new virtual method to
9902 override do_is_local_label_name in parent.
9903 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9904 local symbols if --discard-locals or -X is given.
9905 * options.h (class General_options): Declare new options
9906 '--discard-locals' and '-X' for discarding locals.
9907 * target.h (class Target): Define new methods is_local_label_name.
9908 Declare new virtual method do_is_local_label_name.
9909 * target.cc: New file.
9910 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9911 (check_SCRIPTS): Add discard_locals_test.sh.
9912 (check_DATA): Add discard_local_tests.syms.
9913 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9914 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9915 * testsuite/Makefile.in: Regenerate.
9916 * testsuite/discard_locals_test.c: New file.
9917 * testsuite/discard_locals_test.sh: Same.
9918
9919 2009-06-05 Doug Kwan <dougkwan@google.com>
9920
9921 * object.cc (Sized_relobj::Sized_relobj): Initialize
9922 discarded_eh_frame_shndx_ to -1U.
9923 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9924 section.
9925 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9926 a discarded .eh_frame section.
9927 (Sized_relobj::do_finalize_local_symbols): Ditto.
9928 * object.h (class Sized_relobj): Declare new member
9929 discarded_eh_frame_shndx_.
9930 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9931 (local_labels_test.o, local_labels_test): New rules.
9932 * testsuite/Makefile.in: Regenerate.
9933
9934 2009-06-04 Doug Kwan <dougkwan@google.com>
9935
9936 * layout.cc (Layout::section_name_mapping): Add mapping for
9937 special ARM sections.
9938
9939 2009-06-03 Doug Kwan <dougkwan@google.com>
9940
9941 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9942 (utils::has_overflow): Same.
9943
9944 2009-06-03 Ian Lance Taylor <iant@google.com>
9945
9946 * layout.cc (Layout::section_name_mapping): New array, replacing
9947 Layout::linkonce_mapping.
9948 (Layout::section_name_mapping_count): New variable, replacing
9949 Layout::linkonce_mapping_count.
9950 (Layout::linkonce_output_name): Remove.
9951 (Layout::output_section_name): Rewrite.
9952 * layout.h (class Layout): Rename Linkonce_mapping to
9953 Section_name_mapping, linkonce_mapping to section_name_mapping,
9954 linkonce_mapping_count to section_name_mapping_count. Don't
9955 declare linkonce_output_name.
9956
9957 2009-06-03 Doug Kwan <dougkwan@google.com>
9958
9959 * gold/arm.cc (namespace utils): New.
9960 (Target_arm::reloc_is_non_pic): Define new method.
9961 (class Arm_relocate_functions): New.
9962 (Target_arm::Relocate::relocate): Handle relocation types used by
9963 Android.
9964
9965 2009-06-03 Ian Lance Taylor <iant@google.com>
9966
9967 * arm.cc (Target_arm::scan::global): Use || instead of |.
9968
9969 2009-06-02 Doug Kwan <dougkwan@google.com>
9970
9971 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9972 issued_non_pic_error_.
9973 (class Target_arm::Scan): Declare new method check_non_pic.
9974 Define new method symbol_needs_plt_entry.
9975 Declare new data member issued_non_pic_error_.
9976 (class Target_arm::Relocate): Declare new method
9977 should_apply_static_reloc.
9978 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9979 (Target_arm::Scan::check_non_pic): Define new method.
9980 (Target_arm::Scan::local): Handle a small subset of reloc types used
9981 by Android.
9982 (Target_arm::Scan::local): Same.
9983 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9984
9985 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9986
9987 * incremental.cc (Incremental_inputs::report_command_line): Filter
9988 out --incremental-* options.
9989
9990 2009-05-29 Doug Kwan <dougkwan@google.com>
9991
9992 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9993 template class.
9994 (class Target_arm): Update comment.
9995 (Target_arm::Target_arm): Initialize new data members GOT_,
9996 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9997 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9998 and Target_arm::rel_dyn_section.
9999 Declare new_enum Target_arm::Got_type.
10000 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10001 and DYNBSS_.
10002 Update commments for member do_dynsym_value.
10003 (Target_arm::got_size, Target_arm::plt_section,
10004 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10005 new methods inside class defintion.
10006 (Target_arm::got_section): Define new method.
10007 (Target_arm::rel_dyn_section): Same.
10008 (Output_data_plt_arm): New template class.
10009 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10010 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10011 (Output_data_plt_arm::add_entry): Same.
10012 (Output_data_plt_arm::first_plt_entry): Define new
10013 static data member for PLT instruction template.
10014 (Output_data_plt_arm::plt_entry): Same.
10015 (Output_data_plt_arm::do_write): Define new method.
10016 (Target_arm::make_plt_entry): Same.
10017 (Target_arm::do_finalize_sections): Same.
10018 (Target_arm::do_dynsym_value): Same.
10019
10020 2009-05-28 Doug Kwan <dougkwan@google.com>
10021
10022 * Makefile.am (TARGETSOURCES): Add arm.cc.
10023 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10024 * Makefile.in: Regenerate.
10025 * arm.cc: New file.
10026 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10027
10028 2009-05-26 Doug Kwan <dougkwan@google.com>
10029
10030 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10031 (General_options::check_excluded_libs): Strip off directories in
10032 archive name before matching like GNU ld does.
10033 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10034 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10035 (exclude_libs_test_LDFLAGS): Add linker option
10036 -Wl,--exclude-libs,libexclude_libs_test_3
10037 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10038 an explicit archive without using -l.
10039 (alt/libexclude_libs_test_3.a): New make rule.
10040 * testsuite/Makefile.in: Regenerate.
10041 * testsuite/exclude_libs_test.c : Declare lib3_default().
10042 (main): Call it.
10043 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10044 * exclude_libs_test_3.c: New file.
10045
10046 2009-05-26 Nick Clifton <nickc@redhat.com>
10047
10048 * po/id.po: New Indonesian translation.
10049 * po/gold.pot: Updated template file.
10050
10051 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10052
10053 * testsuite/Makefile.am: Add -ffunction-sections to compile
10054 gc_comdat_test files. Add -Wl,--gc-sections to build
10055 gc_comdat_test.
10056 * testsuite/Makefile.in: Regenerate.
10057 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10058
10059 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10060
10061 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10062 kept comdat section was garbage collected.
10063 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10064 * testsuite/Makefile.in: Regenerate.
10065 * testsuite/gc_comdat_test.sh: New file.
10066 * testsuite/gc_comdat_test_1.cc: New file.
10067 * testsuite/gc_comdat_test_2.cc: New file.
10068
10069 2009-05-19 Doug Kwan <dougkwan@google.com>
10070
10071 * archive.cc (Archive::Archive): Move constructor from archive.h
10072 to here. Initialize no_export_.
10073 (Archive::get_elf_object_for_member): Set no_export flag of object.
10074 * archive.h (Archive::Archive): Move constructor body to
10075 archive.cc.
10076 (Archive::no_export): New method.
10077 (Archive::no_export_): New field.
10078 * object.h (Object::Object): Initialize no_export_ to false.
10079 (Object::no_export, Object::set_no_export): New methods.
10080 (Object::no_export_): New field.
10081 * options.cc (General_options::parse_exclude_libs): New method.
10082 (General_options::check_excluded_libs) Same.
10083 * options.h (exclude_libs): New option.
10084 (General_options::check_excluded_libs): New method declaration.
10085 (General_options::excluded_libs_): New field.
10086 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10087 default or protected visibility if an object has no-export flag set.
10088 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10089 (check_SCRIPTS): Add exclude_libs_test.sh.
10090 (check_DATA): Add exclude_libs_test.syms.
10091 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10092 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10093 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10094 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10095 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10096 libexclude_libs_test_2.a): New rules.
10097 * testsuite/Makefile.in: Regenerate.
10098 * testsuite/exclude_libs_test.c: New file.
10099 * testsuite/exclude_libs_test.sh: Ditto.
10100 * testsuite/exclude_libs_test_1.c: Ditto.
10101 * testsuite/exclude_libs_test_2.c: Ditto.
10102
10103 2009-05-15 Ian Lance Taylor <iant@google.com>
10104
10105 * configure.ac: Check for declarations for cases where libiberty.h
10106 checks HAVE_DECL_xxx.
10107 * configure, config.in: Rebuild.
10108
10109 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10110
10111 * gold.h (Incremental_argument_list): Remove (invalid) forward
10112 declaration.
10113 * incremental.cc (Incremental_inputs::report_achive): New method.
10114 (Incremental_inputs::report_object): New method.
10115 (Incremental_inputs::report_script): New method.
10116 (Incremental_inputs::finalize_inputs): New method.
10117 (Incremental_inputs::finalize): Call finalize_inputs().
10118 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10119 Create inputs entries.
10120 * incremental.h (Incremental_input_type): New enum.
10121 (Incremental_inputs::Incremental_input): Initialize new fields.
10122 (Incremental_inputs::report_inputs): New method.
10123 (Incremental_inputs::report_achive): New method.
10124 (Incremental_inputs::report_object): New method.
10125 (Incremental_inputs::report_script): New method.
10126 (Incremental_inputs::finalize_inputs): New method.
10127 (Incremental_inputs::Input_info): New struct.
10128 (Incremental_inputs::Input_info_map): New typedef.
10129 (Incremental_inputs::lock_): New field.
10130 (Incremental_inputs::Inputs_): New field.
10131 (Incremental_inputs::Inputs_map): New field.
10132 * main.cc (main): Call Incremental_input::report_inputs.
10133 * options.h (Input_argument_list): Typedef moved from
10134 Input_arguments.
10135 (Input_file_group::Files): Remove, use ::Input_argument_list.
10136 (Input_file_group::Input_argument_list): Remove, use
10137 ::Input_argument_list.
10138 * plugin.cc (Plugin_manager::add_input_file): Add error in
10139 incremental build.
10140 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10141 functions.
10142 * script.cc (read_input_script): Call
10143 Incremental_input::report_script.
10144 * script.h (Script_info): New class.
10145
10146 2009-04-27 Ian Lance Taylor <iant@google.com>
10147
10148 * x86_64.cc (do_adjust_output_section): Set entsize to
10149 plt_entry_size.
10150
10151 2009-04-23 Elliott Hughes <enh@google.com>
10152
10153 * output.cc (Output_file::close): After short writes, continue
10154 writing from the correct offset in the buffer being written.
10155
10156 2009-04-23 Chris Demetriou <cgd@google.com>
10157
10158 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10159 * configure: Regenerate.
10160 * config.in: Regenerate.
10161 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10162 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10163
10164 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10165
10166 * incremental.cc (Incremental_inputs_header_data): Renamed from
10167 Incremental_input_header_data.
10168 (Incremental_inputs_header_data::data_size): New field.
10169 (Incremental_inputs_header_data::put_input_file_count): Renamed
10170 from input_file_count.
10171 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10172 from command_line_offset.
10173 (Incremental_inputs_header_data::put_reserved): Renamed from
10174 put_reserved.
10175 (Incremental_inputs_entry_data): Renamed from
10176 Incremental_input_entry_data.
10177 (Incremental_inputs_entry_data::data_size): New field.
10178 (Incremental_inputs::report_command_line): New method.
10179 (Incremental_inputs::finalize): New method.
10180 (Incremental_inputs::create_incremental_inputs_data): New method.
10181 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10182 * incremental.h: New file.
10183 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10184 (Layout::finalize): Create incremental inputs section in
10185 incremental builds.
10186 (Layout::create_incremental_info_sections): New method.
10187 * layout.h (Layout::incremental_inputs): New method.
10188 (Layout::create_incremental_info_sections): New method.
10189 (Layout::incremental_inputs_): New field.
10190 * main.cc (main): Notify Incremental_input of the command line.
10191
10192 2009-04-01 Ian Lance Taylor <iant@google.com>
10193 Mikolaj Zalewski <mikolajz@google.com>
10194
10195 * gold.h (reserve_unordered_map): Define, three versions, one for
10196 each version of Unordered_map.
10197 * layout.cc (Layout::Layout): Remove options parameter. Add
10198 number_of_input_files parameter. Don't initialize options_.
10199 Initialize number_of_input_files_ and resized_signatures_. Move
10200 sections_are_attached_.
10201 (Layout::layout_group): Reserve space for group_signatures_.
10202 (Layout::find_or_add_kept_section): Change name parameter to be a
10203 reference. Resize signatures_ map when it gets large enough.
10204 (Layout::layout_eh_frame): Use parameters->options() instead of
10205 this->options_.
10206 (Layout::make_output_section): Likewise.
10207 (Layout::attach_allocated_section_to_segment): Likewise.
10208 (Layout::finalize, Layout::create_executable_stack): Likewise.
10209 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10210 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10211 * layout.h (class Layout): Update declarations. Remove options_
10212 field. Add number_of_input_files_ and resized_signatures_
10213 fields. Move sections_are_attached_ field.
10214 * main.cc (main): Pass number of input files to Layout
10215 constructor. Don't pass options.
10216
10217 2009-03-30 Ian Lance Taylor <iant@google.com>
10218
10219 * ffsll.c (ffsll): Correct implementation.
10220
10221 2009-03-27 Ian Lance Taylor <iant@google.com>
10222
10223 * ffsll.c: New file.
10224 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10225 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10226 * ftruncate.c (ftruncate): Declare before definition.
10227 * mremap.c (mremap): Likewise.
10228 * pread.c (pread): Likewise.
10229 * configure, Makefile.in, config.in: Rebuild.
10230
10231 * mremap.c: New file.
10232 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10233 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10234 (mremap): Declare if HAVE_MREMAP is not defined.
10235 * configure, Makefile.in, config.in: Rebuild.
10236
10237 2009-03-27 Cary Coutant <ccoutant@google.com>
10238
10239 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10240 position independent.
10241 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10242 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10243
10244 2009-03-24 Cary Coutant <ccoutant@google.com>
10245
10246 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10247 an executable.
10248 (needs_dynamic_reloc): Likewise.
10249
10250 2009-03-24 Ian Lance Taylor <iant@google.com>
10251
10252 * yyscript.y (file_cmd): Recognize EXTERN.
10253 (extern_name_list, extern_name_list_body): New nonterminals.
10254 * script.cc (script_add_extern): Define.
10255 * script-c.h (script_add_extern): Declare.
10256
10257 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10258
10259 * object.cc (is_elf_object): Define.
10260 * object.h (is_elf_object): Declare.
10261 * archive.cc (Archive::get_elf_object_for_member): Call
10262 is_elf_object.
10263 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10264
10265 2009-03-24 Elliott Hughes <enh@google.com>
10266
10267 * output.cc (Output_file::map_anonymous): Define.
10268 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10269 try an anonymous one. Report the size if the mmap fails.
10270 * output.h (class Output_file): Declare map_anonymous.
10271
10272 2009-03-24 Ian Lance Taylor <iant@google.com>
10273
10274 * target-select.cc (instantiate_target): Don't acquire the lock if
10275 the instantiated_target_ field has already been set.
10276
10277 2009-03-23 Ian Lance Taylor <iant@google.com>
10278
10279 * gold-threads.h (class Initialize_lock): Define.
10280 * gold-threads.cc (class Initialize_lock_once): Define.
10281 (initialize_lock_control): New static variable.
10282 (initialize_lock_pointer): New static variable.
10283 (initialize_lock_once): New static function.
10284 (Initialize_lock::Initialize_lock): Define.
10285 (Initialize_lock::initialize): Define.
10286 * target-select.h: Include "gold-threads.h".
10287 (class Target_selector): Add lock_ and initialize_lock_ fields.
10288 Don't define instantiate_target, just declare it.
10289 * target-select.cc (Target_selector::Target_selector): Initialize
10290 new fields.
10291 (Target_selector::instantiate_target): Define.
10292 * descriptors.h: Include "gold-threads.h".
10293 (class Descriptors): Add initialize_lock_ field.
10294 * descriptors.cc (Descriptors::Descriptors): Initialize new
10295 field.
10296 (Descriptors::open): Use initialize_lock_ field
10297 * errors.h (class Errors): Add initialize_lock_ field.
10298 * errors.cc (Errors::Errors): Initialize new field.
10299 (Errors::initialize_lock): Use initialize_lock_ field.
10300 * powerpc.cc (class Target_selector_powerpc): Remove
10301 instantiated_target_ field. In do_recognize call
10302 instantiate_target rather than do_instantiate_target. In
10303 do_instantiate_target just allocate a new target.
10304 * sparc.cc (class Target_selector_sparc): Likewise.
10305
10306 * freebsd.h: New file.
10307 * i386.cc: Include "freebsd.h".
10308 (Target_i386): Derive from Target_freebsd rather than
10309 Sized_target.
10310 (Target_selector_i386): Derive from Target_selector_freebsd rather
10311 than Target_selector.
10312 * x86_64.cc: Include "freebsd.h".
10313 (Target_x86_64): Derive from Target_freebsd rather than
10314 Sized_target.
10315 (Target_selector_x86_64): Derive from Target_selector_freebsd
10316 rather than Target_selector.
10317 * target.h (class Target): Add adjust_elf_header and
10318 do_adjust_elf_header.
10319 * output.cc (Output_file_header:: do_sized_write): Call target
10320 adjust_elf_header routine.
10321 * configure.tgt: Set targ_osabi.
10322 * configure.ac: Define GOLD_DEFAULT_OSABI.
10323 * parameters.cc (Parameters::default_target): Pass
10324 GOLD_DEFAULT_OSABI to select_target.
10325 * target-select.h (class Target_selector): Make instantiate_target
10326 protected rather than private.
10327 * Makefile.am (HFILES): Add freebsd.h.
10328 * configure, Makefile.in, config.in: Rebuild.
10329
10330 * merge.cc (do_add_input_section): Correct pend value. Change
10331 message about last entry not being null terminated from error to
10332 warning.
10333
10334 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10335
10336 * incremental.cc: New file.
10337 * Makefile.am (CCFILES): Add incremental.cc.
10338 * Makefile.in: Rebuild.
10339
10340 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10341
10342 * layout.cc (Layout::output_section_name): Preserve names
10343 of '.note.' sections.
10344
10345 2009-03-19 Ian Lance Taylor <iant@google.com>
10346
10347 * descriptors.cc (Descriptors::open): Check that the options are
10348 valid before using them.
10349
10350 2009-03-18 Ian Lance Taylor <iant@google.com>
10351
10352 * script-sections.h: Include <list>.
10353 (class Script_sections): Change Sections_elements from std::vector
10354 to std::list. Typedef public Elements_iterator. Add
10355 orphan_section_placement_, data_segment_align_start_, and
10356 saw_data_segment_align_ fields. Remove data_segment_align_index_
10357 field.
10358 * script-sections.cc (class Orphan_section_placement): New class.
10359 (class Sections_element): Add virtual functions is_relro and
10360 orphan_section_init. Remove virtual function place_orphan_here.
10361 (class Output_section_definition): Add is_relro and
10362 orphan_section_init. Remove place_orphan_here.
10363 (class Orphan_output_section): Likewise.
10364 (Script_sections::Script_sections): Update for field changes.
10365 (Script_sections::data_segment_align): Set saw_data_segment_align_
10366 and data_segment_align_start_, not data_segment_align_index.
10367 (Script_sections::data_segment_relro_end): Check
10368 saw_data_segment_align_. Use data_segment_align_start_ rather
10369 than data_segment_align_index_.
10370 (Script_sections::place_orphan): Rewrite to use
10371 Orphan_section_placement.
10372
10373 2009-03-17 Ian Lance Taylor <iant@google.com>
10374
10375 * archive.cc (Archive::add_symbols): Check for a version attached
10376 to the symbol name in the archive map.
10377 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10378 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10379 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10380 (ver_test_11.a): New target.
10381 * testsuite/Makefile.in: Rebuild.
10382
10383 * configure.ac: Check for chsize and posix_fallocate. Replace
10384 ftruncate.
10385 * ftruncate.c: New file, from gnulib.
10386 * output.cc (posix_fallocate): Define dummy version if not
10387 HAVE_POSIX_FALLOCATE.
10388 (Output_file::map): Call posix_fallocate rather than lseek and
10389 write.
10390 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10391 * configure, Makefile.in, config.in: Rebuild.
10392
10393 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10394
10395 * layout.h (Layout::create_note): Add section_name parameter.
10396 * layout.cc (Layout::create_note): Likewise.
10397 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10398
10399 2009-03-17 Ian Lance Taylor <iant@google.com>
10400
10401 * descriptors.cc: Include "options.h".
10402 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10403 (Descriptors::open): Always use O_CLOEXEC when opening a new
10404 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10405 then set FD_CLOEXEC.
10406
10407 * sparc.cc (class Target_sparc): Add has_got_section.
10408 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10409 make sure we have a GOT section.
10410
10411 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10412 (Target_sparc::Scan::local): Likewise.
10413 (Target_sparc::Scan::global): Likewise.
10414 (Target_sparc::Relocate::relocate): Likewise.
10415 (Target_sparc::Relocate::relocate_tls): Likewise.
10416
10417 * symtab.cc (Symbol_table::define_default_version): New function,
10418 broken out of add_from_object.
10419 (Symbol_table::add_from_object): Call define_default_version.
10420 (Symbol_table::define_special_symbol): Add resolve_oldsym
10421 parameter. Change all callers. If the version for a symbol comes
10422 from a version script, resolve it with the symbol with the same
10423 name with no version. Also add the symbol without a version if
10424 appropriate.
10425 (do_define_in_output_data): If resolving with oldsym, don't delete
10426 sym.
10427 (do_define_in_output_segment): Likewise.
10428 (do_define_as_constant): Likewise.
10429 * symtab.h (class Symbol_table): Update declarations.
10430
10431 2009-03-13 Ian Lance Taylor <iant@google.com>
10432
10433 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10434 (Read_symbols::requeue): New function.
10435 (Read_symbols::do_read_symbols): If make_elf_object fails because
10436 the target type is not configured, and the file was searched for,
10437 issue a warning and retry with the next directory.
10438 (Add_symbols::run): If the file has an incompatible format, and
10439 it was searched for, requeue the Read_symbols task. On error,
10440 release the object.
10441 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10442 dirindex parameter to constructor. Change all callers. Declare
10443 incompatible_warning and requeue.
10444 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10445 input_argument_ and input_group_ fields. Add them to
10446 constructor. Change all callers.
10447 (class Read_script): Add dirindex_ field. Add it to constructor.
10448 Change all callers.
10449 * archive.cc (Archive::setup): Remove input_objects parameter.
10450 Change all callers.
10451 (Archive::get_file_and_offset): Likewise.
10452 (Archive::read_all_symbols): Likewise.
10453 (Archive::read_symbols): Likewise.
10454 (Archive::get_elf_object_for_member): Remove input_objects
10455 parameter. Add punconfigured parameter. Change all callers.
10456 (Archive::add_symbols): Change return type to bool. Check return
10457 value of include_member.
10458 (Archive::include_all_members): Likewise.
10459 (Archive::include_member): Change return type to bool. Return
10460 false if first included object has incompatible target. Set
10461 included_member_ field.
10462 (Add_archive_symbols::run): If add_symbols returns false, requeue
10463 Read_symbols task.
10464 * archive.h (class Archive): Add included_member_ field.
10465 Initialize it in constructor. Add input_file and searched_for
10466 methods. Update declarations.
10467 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10468 input_argument_ fields. Add them to constructor. Change all
10469 callers.
10470 * script.cc: Include "target-select.h".
10471 (class Parser_closure): Add skip_on_incompatible_target_ and
10472 found_incompatible_target_ fields. Add
10473 skip_on_incompatible_target parameter to constructor. Change all
10474 callers. Add methods skip_on_incompatible_target,
10475 clear_skip_on_incompatible_target, found_incompatible_target, and
10476 set_found_incompatible_target.
10477 (read_input_script): Add dirindex parameter. Change all callers.
10478 If parser finds an incompatible target, requeue Read_symbols
10479 task.
10480 (script_set_symbol): Clear skip_on_incompatible_target in
10481 closure.
10482 (script_add_assertion, script_parse_option): Likewise.
10483 (script_start_sections, script_add_phdr): Likewise.
10484 (script_check_output_format): New function.
10485 * script.h (read_input_script): Update declaration.
10486 * script-c.h (script_check_output_format): Declare.
10487 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10488 (ignore_cmd): Remove OUTPUT_FORMAT.
10489 * fileread.cc (Input_file::Input_file): Add explicit this.
10490 (Input_file::will_search_for): New function.
10491 (Input_file::open): Add pindex parameter. Change all callers.
10492 * fileread.h (class Input_file): Add input_file_argument method.
10493 Declare will_search_for. Update declarations.
10494 * object.cc (make_elf_object): Add punconfigured parameter.
10495 Change all callers.
10496 * object.h (class Object): Make input_file public. Add
10497 searched_for method.
10498 (make_elf_object): Update declaration.
10499 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10500 restart search.
10501 * dirsearch.h (class Dirsearch): Update declaration.
10502 * options.h (class General_options): Add --warn-search-mismatch.
10503 * parameters.cc (Parameters::is_compatible_target): New function.
10504 * parameters.h (class Parameters): Declare is_compatible_target.
10505 * workqueue.cc (Workqueue::add_blocker): New function.
10506 * workqueue.h (class Workqueue): Declare add_blocker.
10507
10508 * fileread.cc (Input_file::open): Remove options parameter.
10509 Change all callers.
10510 (Input_file::open_binary): Likewise.
10511 * script.cc (read_input_script): Likewise.
10512 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10513 options parameter from constructor. Change all callers.
10514 (class Read_script): Likewise.
10515 * fileread.h (class Input_file): Update declarations.
10516 * script.h (read_input_script): Update declaration.
10517
10518 2009-03-10 Nick Clifton <nickc@redhat.com>
10519
10520 * po/es.po: New Spanish translation.
10521
10522 2009-03-06 Cary Coutant <ccoutant@google.com>
10523
10524 * options.cc (parse_short_option): Keep dash_z from registering itself.
10525
10526 2009-03-03 Ian Lance Taylor <iant@google.com>
10527
10528 PR 9918
10529 * target-reloc.h (relocate_section): Pass output_section to
10530 relocate.
10531 * i386.cc (Target_i386::should_apply_static_reloc): Add
10532 output_section parameter. Change all callers.
10533 (Target_i386::Relocate::relocate): Add output_section parameter.
10534 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10535 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10536 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10537 * testsuite/two_file_shared.sh: New script.
10538 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10539 (check_DATA): Add two_file_shared.dbg.
10540 (two_file_shared.dbg): New target.
10541 * testsuite/Makefile.in: Rebuild.
10542
10543 2009-03-01 Ian Lance Taylor <iant@google.com>
10544
10545 * configure.ac: Check for byteswap.h.
10546 * configure: Rebuild.
10547 * config.in: Rebuild.
10548
10549 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10550
10551 * layout.cc (Layout::find_or_add_kept_section): New function.
10552 (Layout::add_comdat): Removed.
10553 * layout.h (struct Kept_section): Move out of class Layout.
10554 Remove trailing underscores from field names. Add group_sections
10555 field. Rename group_ field to is_group. Change all uses.
10556 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10557 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10558 comdat_groups_ field.
10559 (Sized_relobj::include_section_group): Use
10560 find_or_add_kept_section and Kept_section::group_sections.
10561 (Sized_relobj::include_linkonce_section): Likewise.
10562 * object.cc (class Sized_relobj): Don't define Comdat_group or
10563 Comdat_group_table. Remove find_comdat_group and
10564 add_comdat_group. Remove comdat_groups_ field.
10565 * plugin.cc (include_comdat_group): Use
10566 Layout::find_or_add_kept_section.
10567
10568 2009-02-28 Ian Lance Taylor <iant@google.com>
10569
10570 * README: --gc-sections and map files are now supported. Document
10571 some build requirements.
10572
10573 PR 6992
10574 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10575 relocatable link set the value of the section symbol to zero.
10576 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10577 relocatable link don't include the section address in the local
10578 symbol value.
10579
10580 2009-02-27 Ian Lance Taylor <iant@google.com>
10581
10582 PR 6811
10583 * options.h (class Search_directory): Add is_system_directory.
10584 (class General_options): Declare is_in_system_directory.
10585 * options.cc (get_relative_sysroot): Make static.
10586 (get_default_sysroot): Make static.
10587 (General_optoins::is_in_system_directory): New function.
10588 * fileread.cc (Input_file::is_in_system_directory): New function.
10589 * fileread.h (class Input_file): Declare is_in_system_directory.
10590 * object.h (class Object): Add is_in_system_directory.
10591 (class Input_objects): Remove system_library_directory_ field.
10592 * object.cc (Input_objects::add_object): Don't set
10593 system_library_directory_.
10594 (input_objects::found_in_system_library_directory): Remove.
10595 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10596 parameter. Change all callers.
10597 (Symbol_table::sized_write_globals): Likewise.
10598 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10599 Call Object::is_in_system_directory.
10600 * symtab.h (class Symbol_table): Update declarations.
10601
10602 PR 5990
10603 * descriptors.h (Open_descriptor): Add is_on_stack field.
10604 * descriptors.cc (Descriptors::open): If the descriptor is on the
10605 top of the stack, remove it. Initialize is_on_stack field.
10606 (Descriptors::release): Only add pod to stack if it is not on the
10607 stack already.
10608 (Descriptors::close_some_descriptor): Clear stack_next and
10609 is_on_stack fields.
10610
10611 PR 7091
10612 * output.cc (Output_section::find_starting_output_address): Rename
10613 from starting_output_address; add PADDR parameter; change return
10614 type.
10615 * output.h (class Output_section): Declare
10616 find_starting_output_address instead of starting_output_address.
10617 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10618 section symbol for which we can't find a merge section.
10619
10620 PR 9836
10621 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10622 hidden or internal, force the symbol to be local.
10623 * resolve.cc (Symbol::override_visibility): Define.
10624 (Symbol::override_base): Use override_visibility.
10625 (Symbol_table::resolve): Likewise.
10626 (Symbol::override_base_with_special): Likewise.
10627 (Symbol_table::override_with_special): If the visibility is hidden
10628 or internal, force the symbol to be local.
10629 * symtab.h (class Symbol): Add set_visibility and
10630 override_visibility.
10631 * testsuite/ver_test_1.sh: New file.
10632 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10633 (check_DATA): Add ver_test_1.syms.
10634 (ver_test_1.syms): New target.
10635 * testsuite/Makefile.in: Rebuild.
10636
10637 2009-02-25 Cary Coutant <ccoutant@google.com>
10638
10639 * layout.cc (Layout::choose_output_section): Don't rename sections
10640 when using a linker script that has a SECTIONS clause.
10641 * Makefile.in: Regenerate.
10642
10643 * testsuite/Makefile.am (script_test_5.sh): New test case.
10644 * testsuite/Makefile.in: Regenerate.
10645 * testsuite/script_test_5.cc: New file.
10646 * testsuite/script_test_5.sh: New file.
10647 * testsuite/script_test_5.t: New file.
10648
10649 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10650
10651 * archive.cc (Archive::include_member): Update calls to add_symbols.
10652 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10653 the Layout argument.
10654 * dynobj.h (do_add_symbols): Add the Layout argument.
10655 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10656 Layout argument.
10657 * object.h (Object::add_symbols): Add the Layout argument.
10658 (Object::do_add_symbols): Add the Layout argument.
10659 (Sized_relobj::do_add_symbols): Add the Layout argument.
10660 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10661 Unify the two versions.
10662 (Add_plugin_symbols): Remove.
10663 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10664 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10665 (Add_plugin_symbols): Remove.
10666 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10667 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10668 (Add_symbols::run): Make it work with Pulginobj.
10669
10670 2009-02-06 Ian Lance Taylor <iant@google.com>
10671
10672 * object.cc (Sized_relobj::do_layout): Make info message start
10673 with lower case letter.
10674
10675 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10676
10677 * binary.cc: Fix file comment.
10678
10679 * options.h (enum Incremental_disposition): Define.
10680 (class General_options): Add new options: --incremental,
10681 --incremental_changed, --incremental_unchanged,
10682 --incremental_unknown. Add incremental_disposition_ and
10683 implicit_incremental_ fields.
10684 (General_options::incremental_disposition): New function.
10685 (class Position_dependent_options): Add incremental_disposition
10686 option.
10687 (Position_dependent_options::copy_from_options): Set incremental
10688 dispositions.
10689 * options.cc (General_options::parse_incremental_changed): New
10690 function.
10691 (General_options::parse_incremental_unchanged): New function.
10692 (General_options::parse_incremental_unknown): New function.
10693 (General_options::General_options): Initialize new fields
10694 incremental_disposition_ and implicit_incremental_.
10695 (General_options::finalize): Check for uasge of --incremental-*
10696 without --incremental.
10697
10698 2009-02-06 Chris Demetriou <cgd@google.com>
10699
10700 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10701 pointer and to report location as the file name associated with
10702 the symbol.
10703 (gold_undefined_symbol_at_location): New function to replace the
10704 old gold_undefined_symbol functionality.
10705 * target-reloc.h (relocate_section): Update to use
10706 gold_undefined_symbol_at_location.
10707 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10708 Call gold_undefined_symbol function rather than gold_error.
10709 * errors.h (Errors::undefined_symbol): Take location as a
10710 string, rather than calculating it from a relocation.
10711 * errors.cc (Errors::fatal): Print "fatal error:" before the
10712 formatted message.
10713 (Errors::error, Errors::error_at_location): Print "error: "
10714 before the formatted message.
10715 (Errors::undefined_symbol): Take location as a string, rather
10716 than calculating it from a relocation.
10717 (gold_undefined_symbol_at_location): New function akin to
10718 old gold_undefined_symbol, calculates location from relocation.
10719 (gold_undefined_symbol): Change to take only a Symbol pointer
10720 and to report location as the file name associated with the symbol.
10721 * testsuite/debug_msg.sh: Update for changed error messages.
10722 * testsuite/undef_symbol.sh: Likewise.
10723
10724 2009-02-04 Duncan Sands <baldrick@free.fr>
10725
10726 PR 9812
10727 * reduced_debug_output.h
10728 (Output_reduced_debug_abbrev_section::failed): Use format for
10729 gold_warning.
10730 (Output_reduced_debug_info_section::faild): Likewise.
10731
10732 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10733
10734 * script.cc (Lazy_demangler): New class.
10735 (Version_script_info::get_symbol_version_helper): Demangle a
10736 symbol only once.
10737
10738 2009-01-29 Cary Coutant <ccoutant@google.com>
10739
10740 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10741 to __tls_get_addr.
10742 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10743
10744 2009-01-28 Ian Lance Taylor <iant@google.com>
10745
10746 * version.cc (version_string): Bump to 1.9.
10747
10748 * gold.h: Include <cstring> and <stdint.h>.
10749 * version.cc: Include <cstdio>.
10750 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10751 warning.
10752 * reduced_debug_output.cc (insert_into_vector): Rename from
10753 Insert_into_vector; change all callers. Use Swap_unaligned to
10754 avoid aliasing issue; remove union since it is unnecessary.
10755
10756 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10757
10758 * Makefile.am (CCFILES): Add gc.cc.
10759 (HFILES): Add gc.h.
10760 * Makefile.in: Regenerate.
10761 * gold.cc (Gc_runner): New class.
10762 (queue_initial_tasks): Call garbage collection related tasks
10763 when corresponding options are invoked.
10764 (queue_middle_gc_tasks): New function.
10765 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10766 processed early before laying out sections during garbage collection.
10767 * gold.h (queue_middle_gc_tasks): New function.
10768 (is_prefix_of): Move from "layout.cc".
10769 * i386.cc (Target_i386::gc_process_relocs): New function.
10770 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10771 * main.cc (main): Create object of class "Garbage_collection".
10772 * object.cc (Relobj::copy_symbols_data): New function.
10773 (Relobj::is_section_name_included): New function.
10774 (Sized_relobj::do_layout): Allow this function to be called twice
10775 during garbage collection and defer layout of section during the
10776 first call.
10777 * object.h (Relobj::get_symbols_data): New function.
10778 (Relobj::is_section_name_included): New function.
10779 (Relobj::copy_symbols_data): New function.
10780 (Relobj::set_symbols_data): New function.
10781 (Relobj::get_relocs_data): New function.
10782 (Relobj::set_relocs_data): New function.
10783 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10784 (Relobj::gc_process_relocs): New function.
10785 (Relobj::do_gc_process_relocs): New pure virtual function.
10786 (Relobj::sd_): New data member.
10787 (Sized_relobj::is_output_section_offset_invalid): New function.
10788 (Sized_relobj::do_gc_process_relocs): New function.
10789 * options.h (General_options::gc_sections): Modify to not be a no-op.
10790 (General_options::print_gc_sections): New option.
10791 * plugin.cc (Plugin_finish::run): Remove function call to
10792 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10793 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10794 * reloc.cc (Read_relocs::run): Add task to process relocs and
10795 determine unreferenced sections when doing garbage collection.
10796 (Gc_process_relocs): New class.
10797 (Sized_relobj::do_gc_process_relocs): New function.
10798 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10799 sections that are garbage collected.
10800 * reloc.h (Gc_process_relocs): New class.
10801 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10802 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10803 symbols whose corresponding sections are garbage collected.
10804 (Symbol_table::Symbol_table): Add new parameter for the garbage
10805 collection object.
10806 (Symbol_table::gc_mark_undef_symbols): New function.
10807 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10808 (Symbol_table::gc_mark_dyn_syms): New function.
10809 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10810 as garbage.
10811 (Symbol_table::add_from_object): Likewise.
10812 (Symbol_table::add_from_relobj): When building shared objects, do not
10813 treat externally visible symbols as garbage.
10814 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10815 table information for static and relocatable links.
10816 * symtab.h (Symbol_table::set_gc): New function.
10817 (Symbol_table::gc): New function.
10818 (Symbol_table::gc_mark_undef_symbols): New function.
10819 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10820 (Symbol_table::gc_mark_dyn_syms): New function.
10821 (Symbol_table::gc_): New data member.
10822 * target.h (Sized_target::gc_process_relocs): New pure virtual
10823 function.
10824 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10825 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10826
10827 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10828
10829 * options.h (General_options::gc_sections): Define as a no-op for now.
10830 (General_options::no_keep_memory): Ditto.
10831 (General_options::Bshareable): Define.
10832 * options.cc (General_options::finalize): Honor -Bshareable.
10833
10834 2009-01-20 Andreas Schwab <schwab@suse.de>
10835
10836 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10837 read the value in the contents, since we don't use it. Use the
10838 template endianness when writing.
10839 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10840
10841 2009-01-19 Andreas Schwab <schwab@suse.de>
10842
10843 * configure.tgt (powerpc64-*): Fix targ_obj.
10844
10845 2009-01-15 Ian Lance Taylor <iant@google.com>
10846
10847 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10848 local symbols when stripping all symbols.
10849
10850 2009-01-14 Cary Coutant <ccoutant@google.com>
10851
10852 * output.cc (Output_reloc): Add explicit instantiations.
10853
10854 2009-01-14 Cary Coutant <ccoutant@google.com>
10855
10856 * archive.cc (Archive::get_elf_object_for_member): Remove call
10857 to File_read::claim_for_plugin.
10858 * descriptors.cc (Descriptors::open): Remove reference to
10859 is_claimed.
10860 (Descriptors::claim_for_plugin): Remove.
10861 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10862 (Descriptors::is_claimed): Remove.
10863 (claim_descriptor_for_plugin): Remove.
10864 * fileread.cc (File_read::claim_for_plugin): Remove.
10865 * fileread.h (File_read::claim_for_plugin): Remove.
10866 (File_read::descriptor): Reopen descriptor if necessary.
10867 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10868 (Plugin_manager::all_symbols_read): Add task parameter. Change
10869 all callers.
10870 (Plugin_manager::get_input_file): New function.
10871 (Plugin_manager::release_input_file): New function.
10872 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10873 corresponding data member.
10874 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10875 and pass to base constructor. Change all callers.
10876 (get_input_file, release_input_file): New functions.
10877 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10878 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10879 (Plugin_manager::all_symbols_read): Add task parameter.
10880 (Plugin_manager::get_input_file): New function.
10881 (Plugin_manager::release_input_file): New function.
10882 (Plugin_manager::task_): New data member.
10883 (Pluginobj::Pluginobj): Add filesize parameter.
10884 (Pluginobj::filename): New function.
10885 (Pluginobj::descriptor): New function.
10886 (Pluginobj::filesize): New function.
10887 (Pluginobj::filesize_): New data member.
10888 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10889 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10890 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10891
10892 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10893 with archive libraries.
10894 * testsuite/Makefile.in: Regenerate.
10895 * testsuite/plugin_test.c (struct sym_info): New type.
10896 (get_input_file, release_input_file): New static variables.
10897 (onload): Capture new transfer vector entries.
10898 (claim_file_hook): Stop reading at end of file according to filesize.
10899 Factor out parsing of readelf output into separate function.
10900 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10901 APIs and get the source file name from the symbol table. Convert
10902 source file name to corresponding object file name. Print info
10903 message when adding new input files.
10904 (parse_readelf_line): New function.
10905 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10906 * testsuite/plugin_test_2.sh: Likewise.
10907 * testsuite/plugin_test_3.sh: Likewise.
10908 * testsuite/plugin_test_4.sh: New test case.
10909
10910 2009-01-07 Ian Lance Taylor <iant@google.com>
10911
10912 * version.cc (version_string): Bump to 1.8.
10913
10914 2008-12-23 Cary Coutant <ccoutant@google.com>
10915
10916 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10917 * plugin.cc (Plugin_manager::finish): Rename as
10918 layout_deferred_objects. Move cleanup to separate function.
10919 (Plugin_manager::cleanup): New function.
10920 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10921 separately.
10922 * plugin.h (Plugin_manager::finish): Rename as
10923 layout_deferred_objects.
10924 (Plugin_manager::cleanup): New function.
10925 (Plugin_manager::cleanup_done): New field.
10926
10927 2008-12-23 Cary Coutant <ccoutant@google.com>
10928
10929 * plugin.cc (is_visible_from_outside): New function.
10930 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10931 so we don't return "IR only" status for exported symbols or -r links.
10932
10933 * testsuite/Makefile.am (plugin_test_3): New test case.
10934 * testsuite/Makefile.in: Regenerate.
10935 * testsuite/plugin_test_3.sh: New file.
10936
10937 2008-12-22 Cary Coutant <ccoutant@google.com>
10938
10939 * object.cc (Sized_relobj::layout_section): New function.
10940 (Sized_relobj::do_layout): Defer layout of input sections until after
10941 plugin has provided replacement files.
10942 (Sized_relobj::do_layout_deferred_sections): New function.
10943 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10944 (Relobj::layout_deferred_sections): New function.
10945 (Relobj::do_layout_deferred_sections): New function.
10946 (Sized_relobj::do_layout_deferred_sections): New function.
10947 (Sized_relobj::layout_section): New function.
10948 (Sized_relobj::Deferred_layout): New structure.
10949 (Sized_relobj::deferred_layout_): New field.
10950 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10951 Change all callers. Layout deferred sections.
10952 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10953 references.
10954 (Plugin_hook::run): Move code from do_plugin_hook inline.
10955 (Plugin_hook::do_plugin_hook): Remove.
10956 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10957 (Plugin_manager::finish): Renamed, was cleanup.
10958 (Plugin_manager::should_defer_layout): New function.
10959 (Plugin_manager::add_deferred_layout_object): New function.
10960 (Plugin_manager::Deferred_layout_list): New type.
10961 (Plugin_manager::deferred_layout_objects_): New field.
10962 (Plugin_hook::do_plugin_hook): Remove.
10963
10964 2008-12-17 Ian Lance Taylor <iant@google.com>
10965
10966 * options.h (class General_options): Add --no case for
10967 --export-dynamic.
10968
10969 2008-12-16 Cary Coutant <ccoutant@google.com>
10970
10971 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10972 vector.
10973 (Plugin_manager::claim_file): Create plugin object even if
10974 plugin did not call the add_symbols callback.
10975 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10976 asking for more symbols than were added.
10977 * testsuite/Makefile.am (plugin_test_1): Add test case with
10978 no global symbols.
10979 (empty.syms): New target.
10980 * testsuite/Makefile.in: Regenerate.
10981 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10982 message. Don't call add_symbols if no globals.
10983 (all_symbols_read_hook): Don't provide replacement for empty
10984 claimed file.
10985
10986 2008-12-12 Ian Lance Taylor <iant@google.com>
10987
10988 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10989 r_type == 0 for a local symbol with r_sym == 0.
10990 (scan_relocatable_relocs): Pass r_sym to
10991 local_non_section_strategy.
10992 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10993 r_sym parameter.
10994
10995 * configure.ac: Update test for TLS descriptors: they are
10996 supported as of glibc 2.9.
10997 * configure: Rebuild.
10998
10999 2008-12-11 Ian Lance Taylor <iant@google.com>
11000
11001 PR 7091
11002 * target-reloc.h (Default_scan_relocatable_relocs): For each
11003 function, map r_type == 0 to RELOC_DISCARD.
11004
11005 2008-12-10 Cary Coutant <ccoutant@google.com>
11006
11007 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11008 object to override a kept COMDAT group from a plugin object.
11009
11010 2008-12-09 Ian Lance Taylor <iant@google.com>
11011
11012 PR 7088
11013 * yyscript.y (file_cmd): Handle INPUT.
11014
11015 * testsuite/initpri1.c: Change all declarations to be full
11016 prototypes by adding void, to avoid compiler warnings.
11017
11018 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11019
11020 * options.cc (General_options::parse_plugin_opt): New.
11021 (General_options::add_plugin): The argument now is just the filename.
11022 (General_options::add_plugin_option): New.
11023 * options.h (plugin_opt): New.
11024 (add_plugin): Change argument name.
11025 (add_plugin_option): New.
11026 * plugin.cc (Plugin::load): Don't parse the plugin option.
11027 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11028 (Plugin::add_option): New.
11029 (Plugin::args_): Change type.
11030 (Plugin::filename_): New.
11031 (Plugin_manager::add_plugin_option): New.
11032 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11033 * testsuite/Makefile.in: Regenerate.
11034
11035 2008-12-05 Cary Coutant <ccoutant@google.com>
11036
11037 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11038 Handle --strip-lto-sections option.
11039 * options.h (strip_lto_sections): New option.
11040
11041 2008-12-01 Cary Coutant <ccoutant@google.com>
11042
11043 * plugin.cc (ld_plugin_message): Change format parameter to const.
11044 Fix mismatch between new[] and delete.
11045
11046 2008-11-14 Cary Coutant <ccoutant@google.com>
11047
11048 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11049 instead of -1U.
11050
11051 2008-11-05 Craig Silverstein <csilvers@google.com>
11052
11053 * options.cc (General_options::parse_dynamic_list): New function.
11054 * options.h (General_options): New flags dynamic_list,
11055 dynamic_list_data, dynamic_list_cpp_new, and
11056 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11057 (General_options::in_dynamic_list): New function.
11058 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11059 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11060 (Lex::can_continue_name): Likewise.
11061 (yylex): Likewise.
11062 (read_script_file): New parameter script_options.
11063 (read_dynamic_list): New function.
11064 (Script_options::define_dynamic_list): New function.
11065 (dynamic_list_keyword_parsecodes): New variable.
11066 (dynamic_list_keywords): New variable.
11067 * script.h (Script_options::define_dynamic_list): New function
11068 prototype.
11069 (read_dynamic_list): New function prototype.
11070 * symtab.cc (strprefix): New macro.
11071 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11072 dynamic_list_data, dynamic_list_cpp_new, and
11073 dynamic_list_cpp_typeinfo.
11074 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11075 (dynamic_list_expr): New rule.
11076 (dynamic_list_nodes): Likewise.
11077 (dynamic_list_node): Likewise.
11078 * testsuite/Makefile.am (dynamic_list): New test.
11079 * testsuite/Makefile.in: Regenerated.
11080 * testsuite/dynamic_list.t: New file.
11081 * testsuite/dynamic_list.sh: New file.
11082
11083 2008-11-05 Craig Silverstein <csilvers@google.com>
11084
11085 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11086 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11087 (t11_last): Likewise.
11088 * testsuite/ver_test_6.c (main): Likewise.
11089
11090 2008-10-07 Cary Coutant <ccoutant@google.com>
11091
11092 * options.c (General_options::finalize): Add check for -static and
11093 -shared.
11094 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11095 is not empty.
11096
11097 2008-10-02 Cary Coutant <ccoutant@google.com>
11098
11099 * plugin.cc (make_sized_plugin_object): Fix conditional
11100 compilation to work when not all targets are enabled.
11101
11102 2008-09-29 Cary Coutant <ccoutant@google.com>
11103
11104 * archive.cc (Archive::get_file_and_offset): Use filename instead
11105 of name to get library path.
11106 (Archive::include_member): Unlock external member of a thin archive.
11107
11108 * testsuite/Makefile.am (TEST_AR): New variable.
11109 (thin_archive_test_1): New test.
11110 (thin_archive_test_2): New test.
11111 * testsuite/Makefile.in: Regenerate.
11112 * testsuite/thin_archive_main.cc: New file.
11113 * testsuite/thin_archive_test_1.cc: New file.
11114 * testsuite/thin_archive_test_2.cc: New file.
11115 * testsuite/thin_archive_test_3.cc: New file.
11116 * testsuite/thin_archive_test_4.cc: New file.
11117
11118 2008-09-29 Cary Coutant <ccoutant@google.com>
11119
11120 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11121 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11122 instead of -1U.
11123 (Sized_relobj::do_finalize_local_symbols): Likewise.
11124 (Sized_relobj::map_to_kept_section): Likewise.
11125 * object.h (Sized_relobj::invalid_address): New constant.
11126 (Sized_relobj::do_output_section_offset): Check for invalid_address
11127 and return -1ULL.
11128 * output.cc (Output_reloc::local_section_offset): Use constant
11129 invalid_address instead of -1U.
11130 (Output_reloc::get_address): Likewise.
11131 (Output_section::output_address): Change -1U to -1ULL.
11132 * output.h (Output_reloc::invalid_address): New constant.
11133 * reloc.cc (Sized_relobj::write_sections): Use constant
11134 invalid_address instead of -1U.
11135 (Sized_relobj::relocate_sections): Likewise.
11136 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11137 values for merge sections.
11138 * target-reloc.h (relocate_for_relocatable): Use constant
11139 invalid_address instead of -1U.
11140
11141 2008-09-19 Cary Coutant <ccoutant@google.com>
11142
11143 Add plugin functionality for link-time optimization (LTO).
11144 * configure.ac (plugins): Add --enable-plugins option.
11145 * configure: Regenerate.
11146 * config.in: Regenerate.
11147 * Makefile.am (LIBDL): New variable.
11148 (CCFILES): Add plugin.cc.
11149 (HFILES): Add plugin.h.
11150 (ldadd_var): Add LIBDL.
11151 * Makefile.in: Regenerate.
11152
11153 * archive.cc: Include "plugin.h".
11154 (Archive::setup): Don't preread archive symbols when using a plugin.
11155 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11156 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11157 files.
11158 (Archive::include_member): Add symbols from plugin objects.
11159 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11160 * descriptors.cc (Descriptors::open): Check for file descriptors
11161 abandoned by plugins.
11162 (Descriptors::claim_for_plugin): New function.
11163 * descriptors.h (Descriptors::claim_for_plugin): New function.
11164 (Open_descriptor::is_claimed): New field.
11165 (claim_descriptor_for_plugin): New function.
11166 * fileread.cc (File_read::claim_for_plugin): New function.
11167 * fileread.h (File_read::claim_for_plugin): New function.
11168 (File_read::descriptor): New function.
11169 * gold.cc: Include "plugin.h".
11170 (queue_initial_tasks): Add task to call plugin hooks for generating
11171 new object files.
11172 * main.cc: Include "plugin.h".
11173 (main): Load plugin libraries.
11174 * object.h (Pluginobj): Declare.
11175 (Object::pluginobj): New function.
11176 (Object::do_pluginobj): New function.
11177 (Object::set_target): New function.
11178 * options.cc: Include "plugin.h".
11179 (General_options::parse_plugin): New function.
11180 (General_options::General_options): Initialize plugins_ field.
11181 (General_options::add_plugin): New function.
11182 * options.h (Plugin_manager): Declare.
11183 (General_options): Add --plugin option.
11184 (General_options::has_plugins): New function.
11185 (General_options::plugins): New function.
11186 (General_options::add_plugin): New function.
11187 (General_options::plugins_): New field.
11188 * plugin.cc: New file.
11189 * plugin.h: New file.
11190 * readsyms.cc: Include "plugin.h".
11191 (Read_symbols::do_read_symbols): Check for archive before checking
11192 for ELF file. Call plugin hooks to claim files.
11193 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11194 from a real object file; force override when processing replacement
11195 files.
11196 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11197 (Symbol::init_base_object): Likewise.
11198 (Symbol::init_base_output_data): Likewise.
11199 (Symbol::init_base_output_segment): Likewise.
11200 (Symbol::init_base_constant): Likewise.
11201 (Symbol::init_base_undefined): Likewise.
11202 (Symbol::output_section): Assert that object is not a plugin.
11203 (Symbol_table::add_from_pluginobj): New function.
11204 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11205 undefined.
11206 (Symbol_table::sized_write_globals): Likewise.
11207 (Symbol_table::add_from_pluginobj): Instantiate template.
11208 * symtab.h (Sized_pluginobj): Declare.
11209 (Symbol::in_real_elf): New function.
11210 (Symbol::set_in_real_elf): New function.
11211 (Symbol::in_real_elf_): New field.
11212 (Symbol_table::add_from_pluginobj): New function.
11213
11214 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11215 (LIBDL): New variable.
11216 (LDADD): Add LIBDL.
11217 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11218 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11219 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11220 (MOSTLYCLEANFILES): Likewise.
11221 * testsuite/Makefile.in: Regenerate.
11222 * testsuite/plugin_test.c: New file.
11223 * testsuite/plugin_test_1.sh: New file.
11224 * testsuite/plugin_test_2.sh: New file.
11225
11226 2008-09-16 Ian Lance Taylor <iant@google.com>
11227
11228 * target-reloc.h (relocate_section): Check whether a symbol is
11229 defined by the ABI before reporting an undefined symbol error.
11230 * target.h (Target::is_defined_by_abi): Make parameter const.
11231 (Target::do_is_defined_by_abi): Likewise.
11232 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11233 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11234 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11235 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11236 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11237 * testsuite/Makefile.in: Rebuild.
11238
11239 * fileread.cc (make_view): Add casts to avoid warning.
11240
11241 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11242
11243 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11244 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11245
11246 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11247
11248 * options.h (General_options::output_is_executable): New.
11249 (General_options::output_is_pie): New.
11250 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11251 for shared libraries.
11252 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11253
11254 2008-09-11 Chris Demetriou <cgd@google.com>
11255
11256 * options.h (origin): New -z option.
11257 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11258 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11259 in DT_FLAGS_1.
11260
11261 2008-09-05 Cary Coutant <ccoutant@google.com>
11262
11263 * fileread.cc (File_read::make_view): Add check for attempt to map
11264 beyond end of file.
11265
11266 2008-09-05 Cary Coutant <ccoutant@google.com>
11267
11268 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11269 explicit instantiations.
11270
11271 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11272
11273 PR gold/6858
11274 * options.cc (General_options::finalize): Allow undefined symbols
11275 in shlibs if linking -shared.
11276
11277 PR gold/6859
11278 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11279 symbols as not needing a dynsym entry.
11280
11281 2008-08-20 Craig Silverstein <csilvers@google.com>
11282
11283 * fileread.cc (File_read::open): Do not lock the file unless it
11284 was successfully opened.
11285
11286 2008-08-14 Cary Coutant <ccoutant@google.com>
11287
11288 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11289 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11290 * testsuite/tls_test.cc (struct int128): 128-bit struct
11291 for testing TLS relocs with non-zero addend.
11292 (v12): New TLS variable.
11293 (t12): New test.
11294 (t_last): Add check for v12.
11295 * testsuite/tls_test.h (t12): New function.
11296 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11297
11298 2008-08-13 Ian Lance Taylor <iant@google.com>
11299
11300 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11301 set tls_segment_ or relro_segment_.
11302 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11303 when appropriate.
11304 * output.h (Output_section::clear_is_relro): New function.
11305 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11306 sections specially even when output_data_ is empty.
11307 (Output_segment::maximum_alignment): When first section is relro,
11308 only force alignment for PT_LOAD segments.
11309 * script.cc (script_data_segment_align): New function.
11310 (script_data_segment_relro_end): New function.
11311 * script-c.h (script_data_segment_align): Declare.
11312 (script_data_segment_relro_end): Declare.
11313 * script-sections.h (class Script_sections): Declare
11314 data_segment_align and data_segment_relro_end. Add fields
11315 segment_align_index_ and saw_relro_end_.
11316 * script-sections.cc (class Sections_element): Add set_is_relro
11317 virtual function. Add new bool* parameter to place_orphan_here.
11318 Add get_output_section virtual function.
11319 (class Output_section_definition): Add set_is_relro. Add new
11320 bool* parameter to place_orphan_here. Add get_output_section.
11321 Add is_relro_ field.
11322 (Output_section_definition::Output_section_definition): Initialize
11323 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11324 and is_relro_ fields.
11325 (Output_section_definition::place_orphan_here): Add is_relro
11326 parameter.
11327 (Output_section_definition::set_section_addresses): Set relro for
11328 output section.
11329 (Output_section_definition::alternate_constraint): Likewise.
11330 (class Orphan_output_section): Add new bool* parameter to
11331 place_orphan_here. Add get_output_section.
11332 (Orphan_output_section::place_orphan_here): Add is_relro
11333 parameter.
11334 (Script_sections::Script_sections): Initialize
11335 data_segment_align_index_ and saw_relro_end_.
11336 (Script_sections::data_segment_align): New function.
11337 (Script_sections::data_segment_relro_end): New function.
11338 (Script_sections::place_orphan): Set or clear is_relro.
11339 (Script_sections::set_section_addresses): Force alignment of first
11340 TLS section.
11341 * yyscript.y (exp): Call script_data_segment_align and
11342 script_data_segment_relro_end.
11343 * testsuite/relro_script_test.t: New file.
11344 * testsuite/relro_test.cc (using_script): Declare.
11345 (t1, t2): Test using_script.
11346 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11347 (relro_script_test_SOURCES): Define.
11348 (relro_script_test_DEPENDENCIES): Define.
11349 (relro_script_test_LDFLAGS): Define.
11350 (relro_script_test_LDADD): Define.
11351 (relro_script_test.so): New target.
11352 * testsuite/Makefile.in: Rebuild.
11353
11354 2008-08-06 Cary Coutant <ccoutant@google.com>
11355
11356 * archive.cc (Archive::total_archives, Archive::total_members)
11357 (Archive::total_members_loaded): New variables.
11358 (Archive::setup): Add parameter. Add option to preread
11359 archive symbols.
11360 (Archive::read_armap): Add counter.
11361 (Archive::get_file_and_offset): New function.
11362 (Archive::get_elf_object_for_member): New function.
11363 (Archive::read_all_symbols): New function.
11364 (Archive::read_symbols): New function.
11365 (Archive::add_symbols): Add counters.
11366 (Archive::include_all_members): Use armap to find members if it's
11367 already built.
11368 (Archive::include_member): Skip reading symbols if already read.
11369 Factored code into Archive::get_file_and_offset and
11370 Archive::get_elf_object_for_member. Changed call to
11371 Mapfile::report_include_archive_member.
11372 (Archive::print_stats): New function.
11373 * archive.h: Declare Object and Read_symbols_data classes.
11374 (Archive::Archive): Add initializers for new members.
11375 (Archive::setup): Add parameter.
11376 (Archive::print_stats): New function.
11377 (Archive::total_archives, Archive::total_members)
11378 (Archive::total_members_loaded): New variables.
11379 (Archive::get_file_and_offset): New function.
11380 (Archive::get_elf_object_for_member): New function.
11381 (Archive::read_all_symbols): New function.
11382 (Archive::read_symbols): New function.
11383 (Archive::Archive_member): New class.
11384 (Archive::members_): New member.
11385 (Archive::num_members_): New member.
11386 * main.cc: Include archive.h.
11387 (main): Call Archive::print_stats.
11388 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11389 archive parameter; member_name is now the fully-decorated name.
11390 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11391 * options.h: (General_options): Add --preread-archive-symbols option.
11392 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11393 Archive::setup.
11394
11395 2008-08-04 Ian Lance Taylor <iant@google.com>
11396
11397 * symtab.h (Symbol::use_plt_offset): New function.
11398 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11399 * powerpc.cc (Relocate::relocate): Likewise.
11400 * sparc.cc (Relocate::relocate): Likewise.
11401 * x86_64.cc (Relocate::relocate): Likewise.
11402 * testsuite/weak_plt.sh: New test.
11403 * testsuite/weak_plt_main.cc: New test.
11404 * testsuite/weak_plt_shared.cc: New test.
11405 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11406 (check_PROGRAMS): Add weak_plt.
11407 (check_DATA): Add weak_plt_shared.so.
11408 (weak_plt_main_pic.o, weak_plt): New targets.
11409 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11410 * testsuite/Makefile.in: Rebuild.
11411
11412 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11413 gcctestdir/ld.
11414 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11415 * testsuite/Makefile.in: Rebuild.
11416
11417 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11418
11419 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11420 * Makefile.in: Regenerate.
11421 * po/POTFILES.in: Regenerate.
11422
11423 2008-07-29 Ian Lance Taylor <iant@google.com>
11424
11425 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11426 symbols before other symbols.
11427 * testsuite/script_test_2.cc (test_addr): Declare.
11428 (test_addr_alias): Declare.
11429 (main): Check that test_addr and test_addr_alias have the right
11430 values.
11431 * testsuite/script_test_2.t: Define test_addr_alias and
11432 test_addr.
11433
11434 2008-07-24 Ian Lance Taylor <iant@google.com>
11435
11436 PR 5990
11437 * descriptors.cc: New file.
11438 * descriptors.h: New file.
11439 * gold-threads.h (class Hold_optional_lock): New class.
11440 * fileread.cc: Include "descriptors.h".
11441 (File_read::~File_read): Release descriptor rather than closing
11442 it.
11443 (File_read::open) [file]: Call open_descriptor rather than open.
11444 Set is_descriptor_opened_.
11445 (File_read::open) [memory]: Assert that descriptor is not open.
11446 (File_read::reopen_descriptor): New function.
11447 (File_read::release): Release descriptor.
11448 (File_read::do_read): Make non-const. Reopen descriptor.
11449 (File_read::read): Make non-const.
11450 (File_read::make_view): Reopen descriptor.
11451 (File_read::do_readv): Likewise.
11452 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11453 Update declarations.
11454 * layout.cc: Include "descriptors.h".
11455 (Layout::create_build_id): Use open_descriptor rather than open.
11456 * output.cc: Include "descriptors.h".
11457 (Output_file::open): Use open_descriptor rather than open.
11458 * archive.cc (Archive::const_iterator): Change Archive to be
11459 non-const.
11460 (Archive::begin, Archive::end): Make non-const.
11461 (Archive::count_members): Likewise.
11462 * archive.h (class Archive): Update declarations.
11463 * object.h (Object::read): Make non-const.
11464 * Makefile.am (CCFILES): Add descriptors.cc.
11465 (HFILES): Add descriptors.h.
11466 * Makefile.in: Rebuild.
11467
11468 PR 6716
11469 * gold.h: Always include <clocale>. Add Solaris workarounds
11470 following code in binutils/sysdep.h.
11471
11472 PR 6048
11473 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11474 this->eh_frame_hdr_ is NULL before using it.
11475
11476 * dynobj.cc (Versions::Versions): Update comment.
11477
11478 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11479 the base version name.
11480
11481 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11482 array size plus one.
11483 (Stringpool_template::set_string_offsets): Subtract one from key
11484 before using it as an array index.
11485 (Stringpool_template::get_offset_with_length): Likewise.
11486 (Stringpool_template::write_to_buffer): Likewise.
11487 * stringpool.h (Stringpool_template::get_offset_from_key):
11488 Likewise.
11489
11490 2008-07-23 Ian Lance Taylor <iant@google.com>
11491
11492 PR 6658
11493 * object.h (Merged_symbol_value::value): Do our best to handle a
11494 negative addend.
11495
11496 PR 6647
11497 * script.cc (Version_script_info::get_versions): Don't add empty
11498 version tag to return value.
11499 (Version_script_info::get_symbol_version_helper): Change return
11500 type to bool. Add pversion parameter. Change all callers.
11501 (script_register_vers_node): Don't require a non-NULL tag.
11502 * script.h (class Version_script_info): Update declarations.
11503 (Version_script_info::get_symbol_version): Change return type to
11504 bool. Add version parameter. Change all callers.
11505 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11506 handling. Handle an empty version from a version script.
11507 (Symbol_table::define_special_symbol): Likewise.
11508 * testsuite/ver_test_10.script: New file.
11509 * testsuite/ver_test_10.sh: New file.
11510 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11511 (check_DATA): Add ver_test_10.syms.
11512 (ver_test_10.syms, ver_test_10.so): New target.
11513 * testsuite/Makefile.in: Rebuild.
11514
11515 2008-07-23 Simon Baldwin <simonb@google.com>
11516
11517 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11518 to zero for undefined symbols from dynamic libraries.
11519
11520 2008-07-23 Ian Lance Taylor <iant@google.com>
11521
11522 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11523 Change all callers.
11524 * symtab.h (class Symbol_table): Update declaration.
11525 * testsuite/ver_test_9.cc: New file.
11526 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11527 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11528 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11529 (ver_test_9.so, ver_test_9.o): New targets.
11530 * testsuite/Makefile.in: Rebuild.
11531
11532 2008-07-22 Ian Lance Taylor <iant@google.com>
11533
11534 * options.h (class General_options): Define --check-sections.
11535 * layout.cc (Layout::set_segment_offsets): Handle
11536 --check-sections.
11537
11538 * options.h (class General_options): Define -n/--nmagic and
11539 -N/--omagic.
11540 * options.cc (General_options::finalize): For -n/--nmagic or
11541 -N/--omagic, set -static.
11542 * layout.cc (Layout::attach_allocated_section_to_segment): If
11543 -N/--omagic, don't put read-only and read-write sections in
11544 different segments.
11545 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11546 finding a read-only segment.
11547 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11548 don't set the minimum segment alignment to the common page size,
11549 and don't set the file offset to the address modulo the page size.
11550 * script-sections.cc (Script_sections::create_segments): If
11551 -n/--omagic, don't put read-only and read-write sections in
11552 different segments.
11553
11554 * cref.cc: New file.
11555 * cref.h: New file.
11556 * options.h (class General_options): Add --print-symbol-counts.
11557 * main.cc (main): Issue defined symbol report if requested.
11558 * archive.cc (Archive::interpret_header): Make into a const member
11559 function.
11560 (Archive::add_symbols): Call Input_objects::archive_start and
11561 archive_stop.
11562 (Archive::const_iterator): Define new class.
11563 (Archive::begin, Archive::end): New functions.
11564 (Archive::include_all_members): Rewrite to use iterator.
11565 (Archive::count_members): New function.
11566 * archive.h (class Archive): Update declarations.
11567 (Archive::filename): New function.
11568 * object.cc: Include "cref.h".
11569 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11570 (Sized_relobj::do_get_global_symbol_counts): New function.
11571 (Input_objects::add_object): Add object to cross-referencer.
11572 (Input_objects::archive_start): New function.
11573 (Input_objects::archive_stop): New function.
11574 (Input_objects::print_symbol_counts): New function.
11575 * object.h: Declare Cref and Archive.
11576 (Object::get_global_symbol_counts): New function.
11577 (Object::do_get_global_symbol_counts): New pure virtual function.
11578 (class Sized_relobj): Add defined_count_ field. Update
11579 declarations.
11580 (class Input_objects): Add cref_ field. Update constructor.
11581 Update declarations.
11582 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11583 defined_count_.
11584 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11585 symbol counts.
11586 (Sized_dynobj::do_get_global_symbol_counts): New function.
11587 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11588 defined_count_. Update declarations. Define Symbols typedef.
11589 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11590 parameter. Change all callers.
11591 (Symbol_table::add_from_dynobj): Add sympointers and defined
11592 parameters. Change all callers.
11593 * symtab.h (class Symbol_table): Update declarations.
11594 * Makefile.am (CCFILES): Add cref.cc.
11595 (HFILES): Add cref.h.
11596 * Makefile.in: Rebuild.
11597
11598 2008-07-22 Simon Baldwin <simonb@google.com>
11599
11600 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11601 to zero when writing undefined symbols.
11602
11603 2008-07-22 Ian Lance Taylor <iant@google.com>
11604
11605 * output.cc (Output_section::add_input_section): Don't try to
11606 merge empty merge sections.
11607
11608 2008-07-21 Craig Silverstein <csilvers@google.com>
11609
11610 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11611 Include symbol version in error message.
11612
11613 2008-07-20 Chris Demetriou <cgd@google.com>
11614
11615 * configure.ac (gold_cv_c_random_seed): New configured variable.
11616 (RANDOM_SEED_CFLAGS): New substituted variable.
11617 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11618 * configure: Rebuild.
11619 * Makefile.in: Likewise.
11620 * testsuite/Makefile.in: Likewise.
11621
11622 2008-07-18 Ian Lance Taylor <iant@google.com>
11623
11624 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11625 where we see NAME/NULL and NAME/VERSION as separate symbols.
11626 * testsuite/ver_test_main.cc (main): Call t4.
11627 (t4, t4_2a): Define.
11628 * testsuite/ver_test_2.cc (t4_2): Define.
11629 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11630 * testsuite/ver_test_4.cc (t4_2a): Define.
11631 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11632 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11633
11634 2008-07-17 Ian Lance Taylor <iant@google.com>
11635
11636 * dynobj.cc (Versions::add_def): If we give an error about a
11637 missing version, go ahead and create the version anyhow.
11638
11639 2008-07-10 Ian Lance Taylor <iant@google.com>
11640
11641 Handle output sections with more than 0x7fffffff bytes.
11642 * object.h (class Relobj): Change map_to_output_ to
11643 output_sections_, and just keep a section pointer. Change all
11644 uses. Move comdat group support to Sized_relobj.
11645 (Relobj::is_section_specially_mapped): Remove.
11646 (Relobj::output_section): Remove poff parameter. Change all
11647 callers.
11648 (Relobj::output_section_offset): New function.
11649 (Relobj::set_section_offset): Rewrite.
11650 (Relobj::map_to_output): Remove.
11651 (Relobj::output_sections): New function.
11652 (Relobj::do_output_section_offset): New pure virtual function.
11653 (Relobj::do_set_section_offset): Likewise.
11654 (class Sized_relobj): Add section_offsets_ field. Add comdat
11655 group support from Relobj. Update declarations.
11656 (Sized_relobj::get_output_section_offset): New function.
11657 (Sized_relobj::do_output_section_offset): New function.
11658 (Sized_relobj::do_set_section_offset): New function.
11659 * object.cc (Relobj::output_section_address): Remove.
11660 (Sized_relobj::Sized_relobj): Initialize new fields.
11661 (Sized_relobj::include_section_group): Cast find_kept_object to
11662 Sized_relobj.
11663 (Sized_relobj::include_linkonce_section): Likewise.
11664 (Sized_relobj::do_layout): Use separate arrays for output section
11665 and output offset.
11666 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11667 output_sections.
11668 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11669 output_sections and section_offsets.
11670 (Sized_relobj::write_local_symbols): Likewise.
11671 (map_to_kept_section): Compute output address directly.
11672 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11673 output_sections and section_offsets.
11674 (Sized_relobj::write_sections): Likewise.
11675 (Sized_relobj::relocate_sections): Likewise.
11676 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11677 * output.h (class Output_reloc): Update declarations. Change
11678 u2_.relobj to Sized_relobj*.
11679 (class Output_data_reloc): Change add functions to use
11680 Sized_relobj*.
11681 * output.cc (Output_reloc::Output_reloc): Change relobj to
11682 Sized_relobj*.
11683 (Output_reloc::local_section_offset): Change return type to
11684 Elf_Addr. Use get_output_section_offset.
11685 (Output_reloc::get_address): Likewise.
11686 (Output_section::is_input_address_mapped): Don't call
11687 is_section_specially_mapped.
11688 (Output_section::output_offset): Likewise.
11689 (Output_section::output_address): Likewise.
11690 (Output_section::starting_output_address): Likewise.
11691 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11692 parameter to Sized_relobj*.
11693 (Copy_relocs::need_copy_reloc): Likewise.
11694 (Copy_relocs::save): Likewise.
11695 * copy-relocs.h (class Copy_relocs): Update declarations.
11696 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11697 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11698 * target-reloc.h (relocate_for_relocatable): Change
11699 offset_in_output_section type to Elf_Addr. Change code that uses
11700 it as well.
11701 * layout.cc (Layout::layout): Always set *off.
11702 * mapfile.cc (Mapfile::print_input_section): Use
11703 output_section_offset.
11704 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11705 Sized_relobj*.
11706 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11707 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11708 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11709
11710 2008-07-03 Ian Lance Taylor <iant@google.com>
11711
11712 * layout.cc (Layout::include_section): Do not discard unrecognized
11713 SHT_STRTAB sections.
11714
11715 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11716
11717 * script.cc (Lex::can_continue_name): Make '?' allowable in
11718 version-script names.
11719 * testsuite/version_script.map: Change glob pattern to use '?'
11720
11721 2008-06-30 Manish Singh <yosh@gimp.org>
11722
11723 PR 6585
11724 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11725 Correct typo.
11726
11727 2008-06-30 Ian Lance Taylor <iant@google.com>
11728
11729 PR 6660
11730 PR 6682
11731 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11732 versions]: Don't try to read the value in the contents, since we
11733 don't use it. Use the template endianness when writing.
11734
11735 2008-06-25 Cary Coutant <ccoutant@google.com>
11736
11737 * fileread.cc (File_read::make_view): Assert on zero-length view.
11738 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11739 symbol table when there are no symbols to read.
11740
11741 2008-06-23 Craig Silverstein <csilvers@google.com>
11742
11743 * version.cc (version_string): Bump to 1.7
11744
11745 2008-06-18 Craig Silverstein <csilvers@google.com>
11746
11747 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11748 constant 0xFFFF to type Valtype.
11749 (Powerpc_relocate_functions::rel16_ha): Likewise.
11750
11751 2008-06-17 Ian Lance Taylor <iant@google.com>
11752
11753 * output.h (Output_section::Input_section): Initialize p2align_ to
11754 zero for Output_section_data constructors.
11755 (Output_section::Input_section::addralign): If not an input
11756 section, return the alignment of the Output_section_data.
11757 * testsuite/copy_test.cc: New file.
11758 * testsuite/copy_test_1.cc: New file.
11759 * testsuite/copy_test_2.cc: New file.
11760 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11761 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11762 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11763 (copy_test_1_pic.o, copy_test_1.so): New targets.
11764 (copy_test_2_pic.o, copy_test_2.so): New targets.
11765 * testsuite/Makefile.in: Rebuild.
11766
11767 * script-sections.cc (Script_sections::place_orphan): Initialize
11768 local variable exact.
11769
11770 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11771
11772 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11773
11774 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11775 David S. Miller <davem@davemloft.net>
11776
11777 * powerpc.cc: New file.
11778 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11779 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11780 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11781 * Makefile.in: Rebuild.
11782
11783 2008-06-09 Ian Lance Taylor <iant@google.com>
11784
11785 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11786 <exception>.
11787 (throwing, orig_terminate): New static variables.
11788 (terminate_handler): New static function.
11789 (t2): Set terminate handler.
11790
11791 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11792
11793 PR 6584
11794 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11795 alignment.
11796
11797 2008-05-30 Cary Coutant <ccoutant@google.com>
11798
11799 * archive.cc (Archive::include_all_members) Correct to step
11800 over symbol table and extended name table in thin archives.
11801
11802 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11803
11804 PR 6407
11805 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11806 calculation.
11807
11808 2008-05-28 Caleb Howe <cshowe@google.com>
11809
11810 * reduced_debug_output.cc: New file.
11811 * reduced_debug_output.h: New file.
11812 * options.h (class General_options): Add --strip-debug-non-line.
11813 * options.cc (General_options::finalize): Add strip_debug_non_line
11814 to the strip heirarchy.
11815 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11816 fields.
11817 * layout.cc: Include "reduced_debug_output.h".
11818 (Layout::Layout): Initialize new fields.
11819 (line_only_debug_sections): New static array.
11820 (is_lines_only_debug_sections): New static inline function.
11821 (Layout::include_section): Handle --strip-debug-non-line.
11822 (Layout::make_output_section): If --strip-debug-non-line, build
11823 new output sections for .debug_abbrev and .debug_info.
11824 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11825 gold. Warn about possible overflow.
11826 (read_signed_LEB_128): Likewise.
11827 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11828 (read_signed_LEB_128): Declare.
11829 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11830 (HFILES): Add reduced_debug_output.h.
11831 * Makefile.in: Rebuild.
11832
11833 2008-05-21 Ian Lance Taylor <iant@google.com>
11834
11835 * mapfile.cc: New file.
11836 * mapfile.h: New file.
11837 * options.h (class General_options): Add -M/--print-map and -Map.
11838 * options.cc (General_options::finalize): Make -M equivalent to
11839 -Map -.
11840 * main.cc: Include <cstdio> and "mapfile.h".
11841 (main): Open mapfile if requested.
11842 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11843 constructor. Change caller.
11844 (queue_initial_tasks): Add mapfile parameter. Change caller.
11845 (queue_middle_tasks): Likewise.
11846 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11847 declarations.
11848 * archive.cc: Include "mapfile.h".
11849 (Archive::add_symbols): Add mapfile parameter. Change all
11850 callers. Pass mapfile, symbol, and reason to include_member.
11851 (Archive::include_all_members): Add mapfile parameter. Change all
11852 callers.
11853 (Archive::include_member): Add mapfile, sym, and why parameters.
11854 Change all callers. Report inclusion to map file.
11855 * archive.h: Include "fileread.h".
11856 (class Archive): Update declarations.
11857 (Archive::file): New const method.
11858 (class Add_archive_symbols): Add mapfile_ field. Update
11859 constructor. Change all callers.
11860 * readsyms.h (class Read_symbols): Likewise.
11861 (class Finish_group): Likewise.
11862 (class Read_script): Likewise.
11863 * common.cc: Include "mapfile.h".
11864 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11865 all callers.
11866 (Symbol_table::do_allocate_commons): Likewise.
11867 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11868 symbol allocation to mapfile.
11869 * common.h (class Allocate_commons_task): Add mapfile_ field.
11870 Update constructor. Change all callers.
11871 * symtab.h (class Symbol_table): Update declarations.
11872 * layout.cc: Include "mapfile.h".
11873 (Layout_task_runner::run): Print information to mapfile.
11874 (Layout::create_gold_note): Change Output_data_fixed_space to
11875 Output_data_zero_fill.
11876 (Layout::create_build_id): Likewise.
11877 (Layout::print_to_mapfile): New function.
11878 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11879 constructor. Change caller.
11880 (class Layout): Declare print_to_mapfile.
11881 * output.cc (Output_section::Input_section::print_to_mapfile): New
11882 function.
11883 (Output_section::add_input_section): If producing a map, always
11884 add to input_sections_ list.
11885 (Output_section::do_print_to_mapfile): New function.
11886 (Output_segment::print_sections_to_mapfile): New function.
11887 (Output_segment::print_section_list_to_mapfile): New function.
11888 * output.h: Include "mapfile.h".
11889 (Output_data::print_to_mapfile): New function.
11890 (Output_data::do_print_to_mapfile): New virtual function.
11891 (Output_segment_headers::do_print_to_mapfile): New function.
11892 (Output_file_header::do_print_to_mapfile): New function.
11893 (Output_data_const::do_print_to_mapfile): New function.
11894 (class Output_data_const_buffer): Add map_name_ field. Update
11895 constructor. Change all callers. Add do_print_to_mapfile
11896 function.
11897 (class Output_data_fixed_space): Likewise.
11898 (class Output_data_space): Likewise.
11899 (class Output_data_zero_fill): New class.
11900 (Output_data_strtab::do_print_to_mapfile): New function.
11901 (Output_data_reloc_base::do_print_to_mapfile): New function.
11902 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11903 (Output_data_group::do_print_to_mapfile): New function.
11904 (Output_data_got::do_print_to_mapfile): New function.
11905 (Output_data_dynamic::do_print_to_mapfile): New function.
11906 (Output_symtab_xindex::do_print_to_mapfile): New function.
11907 (class Output_section): Declare do_print_to_mapflie. Declare
11908 print_to_mapfile in Input_section.
11909 (class Output_segment): Declare new functions.
11910 * object.h (Sized_relobj::symbol_count): New function.
11911 * script-sections.cc
11912 (Output_section_element_dot_assignment::set_section_addresses):
11913 Change Output_data_fixed_space to Output_data_zero_fill.
11914 (Output_data_expression::do_print_to_mapfile): New function.
11915 * script.cc (read_input_script): Add mapfile parameter. Change
11916 all callers.
11917 * script.h (read_input_script): Update declaration.
11918 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11919 (Eh_frame::do_print_to_mapfile): New function.
11920 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11921 (Output_merge_string::do_print_to_mapfile): New function.
11922 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11923 function.
11924 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11925 function.
11926 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11927 function.
11928 * Makefile.am (CCFILES): Add mapfile.cc.
11929 (HFILES): Add mapfile.h.
11930 * Makefile.in: Rebuild.
11931
11932 2008-05-19 Ian Lance Taylor <iant@google.com>
11933
11934 * options.h (class General_options): Add -z relro.
11935 * layout.cc (Layout::Layout): Initialize relro_segment_.
11936 (Layout::add_output_section_data): Return the output section.
11937 (Layout::make_output_section): Rcognize relro sections and mark
11938 them appropriately.
11939 (Layout::attach_allocated_section_to_segment): Put relro sections
11940 in a PT_GNU_RELRO segment.
11941 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11942 section as relro.
11943 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11944 PT_TLS segments.
11945 (Layout::linkonce_mapping): Map d.rel.ro.local to
11946 .data.rel.ro.local.
11947 (Layout::output_section_name): Us .data.rel.ro.local for any
11948 section which begins with that.
11949 * layout.h (class Layout): Update add_output_section_data
11950 declaration. Add relro_segment_ field.
11951 * output.cc (Output_section::Output_section): Initialize is_relro_
11952 and is_relro_local_ fields.
11953 (Output_segment::add_output_section): Group relro sections.
11954 (Output_segment::is_first_section_relro): New function.
11955 (Output_segment::maximum_alignment): If there is a relro section,
11956 align the segment to the common page size.
11957 (Output_segment::set_section_addresses): Track whether we are
11958 looking at relro sections. If the last section is a relro
11959 section, align to the common page size.
11960 (Output_segment::set_section_list_addresses): Add in_relro
11961 parameter. Change all callers. Align to the page size when
11962 moving from relro to non-relro section.
11963 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11964 segment.
11965 * output.h (class Output_section): Add is_relro_ and
11966 is_relro_local_ fields.
11967 (Output_section::is_relro): New function.
11968 (Output_section::set_is_relro): New function.
11969 (Output_section::is_relro_local): New function.
11970 (Output_section::set_is_relro_local): New function.
11971 (class Output_segment): Update declarations.
11972 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11973 * sparc.cc (Target_sparc::got_section): Likewise.
11974 * x86_64.cc (Target_x86_64::got_section): Likewise.
11975 * testsuite/relro_test_main.cc: New file.
11976 * testsuite/relro_test.cc: New file.
11977 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11978 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11979 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11980 (relro_test.so, relro_test_pic.o): New targets.
11981 * testsuite/Makefile.in: Rebuild.
11982
11983 2008-05-16 Ian Lance Taylor <iant@google.com>
11984
11985 * output.cc (Output_segment::add_output_section): Remove front
11986 parameter.
11987 * output.h (class Output_segment): Remove
11988 add_initial_output_section and overloaded add_output_section.
11989 Update declaration of remaining add_output_section.
11990 * layout.cc (Layout::create_interp): Call add_output_section
11991 rather than add_initial_output_section.
11992 (Layout::finish_dynamic_section): Likewise.
11993
11994 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11995 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11996 know the dynamic type.
11997 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11998 field. Initialize it in constructor.
11999 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12000 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12001 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12002 reloc.
12003
12004 * output.cc (Output_reloc::get_address): Change return type to
12005 Elf_Addr.
12006 * output.h (class Output_reloc): Update get_address declaration.
12007 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12008 for section addresses.
12009
12010 2008-05-09 Ian Lance Taylor <iant@google.com>
12011
12012 PR 6493
12013 * gold.cc (gold_nomem): Use return value of write.
12014
12015 2008-05-08 Ian Lance Taylor <iant@google.com>
12016
12017 * symtab.c (Symbol::init_base_output_data): Add version
12018 parameter. Change all callers.
12019 (Symbol::init_base_output_segment): Likewise.
12020 (Symbol::init_base_constant): Likewise.
12021 (Symbol::init_base_undefined): Likewise.
12022 (Sized_symbol::init_output_data): Likewise.
12023 (Sized_symbol::init_output_segment): Likewise.
12024 (Sized_symbol::init_constant): Likewise.
12025 (Sized_symbol::init_undefined): Likewise.
12026 (Symbol_table::do_define_in_output_data): If the new symbol has a
12027 version, mark it as the default.
12028 (Symbol_table::do_define_in_output_segment): Likewise.
12029 (Symbol_table::do_define_as_constant): Likewise.
12030 * symtab.h (class Symbol): Update declarations.
12031 (class Sized_symbol): Likewise.
12032 * resolve.cc (Symbol::override_version): New function.
12033 (Symbol::override_base): Call override_version.
12034 (Symbol::override_base_with_special): Likewise.
12035 * testsuite/ver_script_8.script: New file.
12036 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12037 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12038 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12039 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12040
12041 2008-05-06 Ian Lance Taylor <iant@google.com>
12042
12043 PR 6049
12044 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12045 functions.
12046 (class General_options): Remove existing --undefined, and add
12047 --no-undefined instead. Add new --undefined as synonym for -u.
12048 * archive.cc (Archive::add_symbols): Check whether symbol was
12049 named with -u.
12050 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12051 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12052 all uses. Add IS_UNDEFINED. Update declarations to split
12053 different versions of init_base. Declare init_base_undefined.
12054 (Symbol::is_defined): Handle IS_UNDEFINED.
12055 (Symbol::is_undefined): Likewise.
12056 (Symbol::is_weak_undefined): Call is_undefined.
12057 (Symbol::is_absolute): Handle IS_CONSTANT.
12058 (class Sized_symbol): Update declarations to split different
12059 versions of init. Declare init_undefined.
12060 (class Symbol_table): Declare new functions.
12061 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12062 Change all callers.
12063 (Symbol::init_base_output_data): Likewise.
12064 (Symbol::init_base_output_segment): Likewise.
12065 (Symbol::init_base_constant): Likewise.
12066 (Symbol::init_base_undefined): New function.
12067 (Sized_symbol::init_object): Rename from init. Change all
12068 callers.
12069 (Sized_symbol::init_output_data): Likewise.
12070 (Sized_symbol::init_output_segment): Likewise.
12071 (Sized_symbol::init_constant): Likewise.
12072 (Sized_symbol::init_undefined): New function.
12073 (Symbol_table::add_undefined_symbols_from_command_line): New
12074 function.
12075 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12076 function.
12077 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12078 (Symbol::output_section): Likewise.
12079 (Symbol::set_output_section): Likewise.
12080 (Symbol_table::sized_finalize_symbol): Likewise.
12081 (Symbol_table::sized_write_globals): Likewise.
12082 * resolve.cc (Symbol_table::should_override): Likewise.
12083 (Symbol::override_base_with_special): Likewise.
12084
12085 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12086 symbol, change it to have default visibility.
12087 * testsuite/protected_1.cc: New file.
12088 * testsuite/protected_2.cc: New file.
12089 * testsuite/protected_3.cc: New file.
12090 * testsuite/protected_main_1.cc: New file.
12091 * testsuite/protected_main_2.cc: New file.
12092 * testsuite/protected_main_3.cc: New file.
12093 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12094 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12095 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12096 (protected_1.so): New target.
12097 (protected_1_pic.o, protected_2_pic.o): New targets.
12098 (protected_3_pic.o): New target.
12099 (check_PROGRAMS): Add protected_2.
12100 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12101 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12102 * testsuite/Makefile.in: Rebuild.
12103
12104 * options.h (DEFINE_var): Add set_user_set_##varname__.
12105 (DEFINE_bool_alias): New macro.
12106 (class General_options): Define -Bstatic using DEFINE_bool_alias
12107 rather than DEFINE_special. Add --undefined as an alias for -z
12108 defs.
12109 * options.cc (General_options::parse_Bstatic): Remove.
12110
12111 * options.h (class General_options): Add --fatal-warnings.
12112 * main.cc (main): Implement --fatal-warnings.
12113 * errors.h (Errors::warning_count): New function.
12114
12115 * options.h (class General_options): Add -Bsymbolic-functions.
12116 * symtab.h (Symbol::is_preemptible): Check for
12117 -Bsymbolic-functions.
12118
12119 2008-05-05 Ian Lance Taylor <iant@google.com>
12120
12121 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12122 as noVARNAME rather than no-VARNAME.
12123 (class General_options): Add option -z combreloc.
12124 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12125 get_address.
12126 (Output_reloc::sort_before) [SHT_REL]: New function.
12127 (Output_reloc::sort_before) [SHT_RELA]: New function.
12128 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12129 Sort_relocs_comparison.
12130 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12131 parameter. Change all callers.
12132 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12133 sort_relocs parameter. Change all callers.
12134 * output.cc (Output_reloc::get_address): New function, broken out
12135 of write_rel.
12136 (Output_reloc::write_rel): Call it.
12137 (Output_reloc::compare): New function.
12138 (Output_data_reloc_base::do_write): Optionally sort relocs.
12139
12140 * configure.ac: If targ_extra_obj is set, link it in.
12141 * configure.tgt: Initialize all variables.
12142 (x86_64*): Set targ_extra_obj and targ_extra_size.
12143 * configure: Rebuild.
12144
12145 * object.cc (Sized_relobj::include_section_group): Adjust section
12146 indexes read from group data. Build vector to pass to
12147 layout_group.
12148 * layout.cc (Layout::layout_group): Add flags and shndxes
12149 parameters. Remove contents parameter. Change caller. Update
12150 explicit instantiations.
12151 * layout.h (class Layout): Update layout_group declaration.
12152 * output.cc (Output_data_group::Output_data_group): Add flags and
12153 input_shndxes parameters. Remove contents parameter. Change
12154 caller.
12155 (Output_data_group::do_write): Change input_sections_ to
12156 input_shndxes_.
12157 * output.h (class Output_data_group): Update constructor
12158 declaration. Rename input_sections_ to input_shndxes_.
12159 * testsuite/many_sections_test.cc: Add template.
12160
12161 2008-04-30 Cary Coutant <ccoutant@google.com>
12162
12163 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12164
12165 * layout.cc (Layout::include_section): Refactored check for debug
12166 info section.
12167 (Layout::add_comdat): Add new parameters. Change type
12168 of signature parameter. Add object and shndx to signatures table.
12169 (Layout::find_kept_object): New function.
12170 * layout.h: Include <cstring>.
12171 (Layout::is_debug_info_section): New function.
12172 (Layout::add_comdat): Add new parameters.
12173 (Layout::find_kept_object): New function.
12174 (Layout::Kept_section): New struct.
12175 (Layout::Signatures): Change type of map range.
12176 * object.cc (Relobj::output_section_address): New function.
12177 (Sized_relobj::include_section_group): Add new parameters. Change
12178 calls to Layout::add_comdat. Change to build table of kept comdat
12179 groups and table mapping discarded sections to kept sections.
12180 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12181 (Sized_relobj::do_layout): Change calls to include_section_group and
12182 include_linkonce_section.
12183 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12184 value to zero when section is discarded.
12185 (Sized_relobj::map_to_kept_section): New function.
12186 * object.h (Relobj::output_section_address): New function.
12187 (Relobj::Comdat_group): New type.
12188 (Relobj::find_comdat_group): New function.
12189 (Relobj::Comdat_group_table): New type.
12190 (Relobj::Kept_comdat_section): New type.
12191 (Relobj::Kept_comdat_section_table): New type.
12192 (Relobj::add_comdat_group): New function.
12193 (Relobj::set_kept_comdat_section): New function.
12194 (Relobj::get_kept_comdat_section): New function.
12195 (Relobj::comdat_groups_): New field.
12196 (Relobj::kept_comdat_sections_): New field.
12197 (Symbol_value::input_value): Update comment.
12198 (Sized_relobj::map_to_kept_section) New function.
12199 (Sized_relobj::include_linkonce_section): Add new parameter.
12200 * target-reloc.h (Comdat_behavior): New type.
12201 (get_comdat_behavior): New function.
12202 (relocate_section): Add code to map a discarded section to the
12203 corresponding kept section when applying a relocation.
12204
12205 2008-04-30 Craig Silverstein <csilvers@google.com>
12206
12207 * dwarf_reader.cc (next_generation_count): New static var.
12208 (Addr2line_cache_entry): New struct.
12209 (addr2line_cache): New static var.
12210 (Dwarf_line_info::one_addr2line): Added caching.
12211 (Dwarf_line_info::clear_addr2line_cache): New function.
12212 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12213 cache-size parameter.
12214 (Dwarf_line_info::one_addr2line_cache): New function.
12215 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12216 new cache-size argument to one_addr2line(), and clear cache.
12217
12218 2008-04-28 Cary Coutant <ccoutant@google.com>
12219
12220 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12221 R_386_PC8 relocations.
12222
12223 2008-04-23 Ian Lance Taylor <iant@google.com>
12224
12225 * object.cc (Sized_relobj::include_section_group): Check for
12226 invalid section group.
12227
12228 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12229 header size.
12230
12231 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12232 than read for file header.
12233 * archive.cc (Archive::include_member): Likewise.
12234
12235 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12236
12237 * aclocal.m4: Regenerate.
12238 * configure: Regenerate.
12239
12240 2008-04-19 Ian Lance Taylor <iant@google.com>
12241
12242 * version.cc (version_string): Bump to 1.6.
12243
12244 * testsuite/Makefile.am (many_sections_r_test): New target.
12245 (many_sections_r_test_SOURCES): Remove.
12246 (many_sections_r_test_DEPENDENCIES): Remove.
12247 (many_sections_r_test_LDFLAGS): Remove.
12248 (many_sections_r_test_LDADD): Remove.
12249
12250 * object.cc (Sized_relobj::do_add_symbols): Always pass
12251 local_symbol_count_ to add_from_relobj.
12252
12253 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12254 every thousand variables.
12255 * testsuite/Makefile.in: Rebuild.
12256
12257 * object.cc (Xindex::initialize_symtab_xindex): New function.
12258 (Xindex::read_symtab_xindex): New function.
12259 (Xindex::sym_xindex_to_shndx): New function.
12260 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12261 available.
12262 (Sized_relobj::do_initialize_xindex): New function.
12263 (Sized_relobj::do_read_symbols): Adjust section links.
12264 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12265 parameter. Change all callers.
12266 (Sized_relobj::include_section_group): Adjust section links and
12267 symbol section indexes.
12268 (Sized_relobj::do_layout): Adjust section links.
12269 (Sized_relobj::do_count_local_symbols): Adjust section links and
12270 symbol section indexes.
12271 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12272 ordinary and special symbols.
12273 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12274 dynsym_xindex parameters. Change all callers. Adjust section
12275 links. Use SHN_XINDEX when needed.
12276 (Sized_relobj::get_symbol_location_info): Adjust section links.
12277 Don't get fooled by special symbols.
12278 * object.h (class Xindex): Define.
12279 (class Object): Add xindex_ parameter. Declare virtual functoin
12280 do_initialize_xindex.
12281 (Object::adjust_sym_shndx): New function.
12282 (Object::set_xindex): New protected function.
12283 (class Symbol_value): Add is_ordinary_shndx_ field.
12284 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12285 (Symbol_value::value): Assert ordinary section.
12286 (Symbol_value::initialize_input_to_output_map): Likewise.
12287 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12288 Change all callers.
12289 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12290 all callers.
12291 (class Sized_relobj): Update declarations.
12292 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12293 parameter. Change all callers.
12294 (Sized_relobj::adjust_shndx): New function.
12295 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12296 field.
12297 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12298 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12299 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12300 (Sized_dynobj::read_dynsym_section): Adjust section links.
12301 (Sized_dynobj::read_dynamic): Likewise.
12302 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12303 section links.
12304 (Sized_dynobj::do_initialize_xindex): New function.
12305 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12306 do_initialize_xindex.
12307 (Sized_dynobj::adjust_shndx): New function.
12308 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12309 dynsym_xindex_ fields.
12310 (Layout::finalize): Add a call to set_section_indexes before
12311 creating the symtab sections.
12312 (Layout::set_section_indexes): Don't do anything if the section
12313 already has a section index.
12314 (Layout::create_symtab_sections): Add shnum parameter. Change
12315 caller. Create .symtab_shndx section if needed.
12316 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12317 caller.
12318 (Layout::allocated_output_section_count): New function.
12319 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12320 needed.
12321 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12322 fields. Update declarations.
12323 (Layout::symtab_xindex): New function.
12324 (Layout::dynsym_xindex): New function.
12325 (class Write_symbols_task): Add layout_ field.
12326 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12327 Change caller.
12328 * output.cc (Output_section_headers::Output_section_headers): Add
12329 shstrtab_section parameter. Change all callers.
12330 (Output_section_headers::do_sized_write): Store overflow values
12331 for section count and section string table section index in
12332 section header zero.
12333 (Output_file_header::do_sized_write): Check for overflow of
12334 section count and section string table section index.
12335 (Output_symtab_xindex::do_write): New function.
12336 (Output_symtab_xindex::endian_do_write): New function.
12337 * output.h (class Output_section_headers): Add shstrtab_section_.
12338 Update declarations.
12339 (class Output_symtab_xindex): Define.
12340 (Output_section::has_out_shndx): New function.
12341 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12342 field.
12343 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12344 Change all callers.
12345 (Sized_symbol::init): Likewise.
12346 (Symbol::output_section): Check for ordinary symbol.
12347 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12348 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12349 callers.
12350 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12351 Change all callers. Simplify handling of symbols from sections
12352 not included in the link.
12353 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12354 distinction.
12355 (Weak_alias_sorter::operator()): Assert that symbols are
12356 ordinary.
12357 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12358 distinction.
12359 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12360 parameters. Change all callers.
12361 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12362 symbol distinction. Use SHN_XINDEX when needed.
12363 (Symbol_table::write_section_symbol): Add symtab_xindex
12364 parameter. Change all callers.
12365 (Symbol_table::sized_write_section_symbol): Likewise. Use
12366 SHN_XINDEX when needed.
12367 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12368 declarations.
12369 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12370 (Symbol::is_defined): Check is_ordinary.
12371 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12372 (Symbol::is_absolute, Symbol::is_common): Likewise.
12373 (class Sized_symbol): Update declarations.
12374 (class Symbol_table): Update declarations.
12375 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12376 parameters. Change all callers.
12377 (Sized_symbol::override): Likewise.
12378 (Symbol_table::override): Likewise.
12379 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12380 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12381 is_ordinary, and orig_st_shndx parameters. Change all callers.
12382 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12383 to be in an ordinary section.
12384 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12385 object and is_ordinary parameters. Change all callers.
12386 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12387 Change all callers. Don't add undefined or non-ordinary symbols
12388 to reloc_map_.
12389 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12390 Change all callers.
12391 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12392 declarations.
12393 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12394 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12395 (Sized_relobj::relocate_sections): Likewise.
12396 * target-reloc.h (scan_relocs): Adjust section symbol index.
12397 (scan_relocatable_relocs): Likewise.
12398 * i386.cc (Scan::local): Check for ordinary symbols.
12399 * sparc.cc (Scan::local): Likewise.
12400 * x86_64.cc (Scan::local): Likewise.
12401 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12402 to symbol_section_and_value.
12403 * testsuite/many_sections_test.cc: New file.
12404 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12405 (check_PROGRAMS): Add many_sections_test.
12406 (many_sections_test_SOURCES): Define.
12407 (many_sections_test_DEPENDENCIES): Define.
12408 (many_sections_test_LDFLAGS): Define.
12409 (BUILT_SOURCES): Add many_sections_define.h.
12410 (many_sections_define.h): New target.
12411 (BUILT_SOURCES): Add many_sections_check.h.
12412 (many_sections_check.h): New target.
12413 (check_PROGRAMS): Add many_sections_r_test.
12414 (many_sections_r_test_SOURCES): Define.
12415 (many_sections_r_test_DEPENDENCIES): Define.
12416 (many_sections_r_test_LDFLAGS): Define.
12417 (many_sections_r_test_LDADD): Define.
12418 (many_sections_r_test.o): New target.
12419 * testsuite/Makefile.in: Rebuild.
12420
12421 2008-04-17 Cary Coutant <ccoutant@google.com>
12422
12423 * errors.cc (Errors::info): New function.
12424 (gold_info): New function.
12425 * errors.h (Errors::info): New function.
12426 * gold.h (gold_info): New function.
12427 * object.cc (Input_objects::add_object): Print trace output.
12428 * options.cc (options::parse_set): New function.
12429 (General_options::parse_wrap): Deleted.
12430 (General_options::General_options): Deleted initializer.
12431 * options.h (options::String_set): New typedef.
12432 (options::parse_set): New function.
12433 (DEFINE_set): New macro.
12434 (General_options::wrap): Changed to use DEFINE_set. Changed
12435 callers of any_wrap_symbols and is_wrap_symbol.
12436 (General_options::trace, General_options::trace_symbol):
12437 New options.
12438 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12439 (General_options::wrap_symbols_): Deleted.
12440 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12441
12442 2008-04-17 David S. Miller <davem@davemloft.net>
12443
12444 * options.cc (General_options::parse_V): New function.
12445 * options.h: Add entries for -V and -Qy.
12446
12447 2008-04-17 Ian Lance Taylor <iant@google.com>
12448
12449 * common.cc (Symbol_table::allocate_commons): Remove options
12450 parameter. Change caller.
12451 (Symbol_table::do_allocate_commons): Remove options parameter.
12452 Change caller. Just call do_allocate_commons_list twice.
12453 (Symbol_table::do_allocate_commons_list): New function, broken out
12454 of do_allocate_commons.
12455 * common.h (class Allocate_commons_task): Remove options_ field.
12456 Update constructor.
12457 * symtab.cc (Symbol_table::Symbol_table): Initialize
12458 tls_commons_.
12459 (Symbol_table::add_from_object): Put TLS common symbols on
12460 tls_commons_ list.
12461 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12462 which are IN_OUTPUT_DATA.
12463 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12464 allocate_commons and do_allocate_commons declarations. Declare
12465 do_allocate_commons_list.
12466 * gold.cc (queue_middle_tasks): Update creation of
12467 Allocate_commons_task to not pass options.
12468 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12469 (TLS_TEST_C_FLAGS): New variable.
12470 (tls_test_c_pic.o): New target.
12471 (tls_test_shared.so): Link in tls_test_c_pic.o.
12472 (tls_test_c_pic_ie.o): New target.
12473 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12474 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12475 (tls_test_c.o): New target.
12476 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12477 (tls_pic_test_LDADD): Likewise.
12478 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12479 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12480 (tls_test_c_gnu2.o): New target.
12481 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12482 tls_test_c_gnu2.o.
12483 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12484 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12485 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12486 * testsuite/tls_test.cc: Include "config.h".
12487 (t_last): Call t11_last.
12488 * testsuite/tls_test.h (t11, t11_last): Declare.
12489 * testsuite/tls_test_c.c: New file.
12490 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12491 * configure.ac: Check for OpenMP support.
12492 * configure, config.in, Makefile.in: Rebuild.
12493 * testsuite/Makefile.in: Rebuild.
12494
12495 2008-04-16 Cary Coutant <ccoutant@google.com>
12496
12497 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12498 (Target_i386::tls_base_symbol_defined_): New field.
12499 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12500 (Target_i386::Scan::global): Likewise.
12501 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12502 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12503 (Target_x86_64::tls_base_symbol_defined_): New field.
12504 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12505 (Target_x86_64::Scan::global): Likewise.
12506
12507 2008-04-16 Cary Coutant <ccoutant@google.com>
12508
12509 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12510 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12511 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12512 building shared libraries.
12513 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12514 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12515 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12516 * testsuite/Makefile.in: Rebuild.
12517 * testsuite/weak_undef.h: New file.
12518 * testsuite/weak_undef_file1.cc: Add extra test cases.
12519 * testsuite/weak_undef_file2.cc: Likewise.
12520 * testsuite/weak_undef_test.cc: Likewise.
12521
12522 2008-04-16 David S. Miller <davem@davemloft.net>
12523
12524 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12525 Add issued_non_pic_error_ field. Declare check_non_pic.
12526 (Target_sparc::Scan::check_non_pic): New function.
12527 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12528 (Target_sparc::Scan::global): Likewise.
12529
12530 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12531 * configure: Rebuild.
12532
12533 * options.h (DEFINE_enable): New macro.
12534 (new_dtags): New enable option.
12535 (initfirst, interpose, loadfltr, nodefaultlib,
12536 nodelete, nodlopen, nodump): New -z options.
12537 * layout.cc (Layout:finish_dynamic_section): If new
12538 dtags enabled, emit DT_RUNPATH. Also, emit a
12539 DT_FLAGS_1 containing any specified -z flags.
12540
12541 2008-04-16 Ian Lance Taylor <iant@google.com>
12542
12543 * copy-relocs.cc: New file.
12544 * copy-relocs.h: New file.
12545 * reloc.cc: Remove Copy_relocs code.
12546 * reloc.h: Likewise.
12547 * reloc-types.h (struct Reloc_types) [both versions]: Add
12548 get_reloc_addend_noerror.
12549 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12550 variants of add_global which take an addend which must be zero.
12551 * i386.cc: Include "copy-relocs.h".
12552 (class Target_i386): Change type of copy_relocs_ to variable,
12553 update initializer.
12554 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12555 Change all callers.
12556 (Target_i386::do_finalize_sections): Change handling of
12557 copy_relocs_.
12558 * sparc.cc: Include "copy-relocs.h".
12559 (class Target_sparc): Change type of copy_relocs_ to variable,
12560 update initializer.
12561 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12562 Change all callers.
12563 (Target_sparc::do_finalize_sections): Change handling of
12564 copy_relocs_.
12565 * x86_64.cc: Include "copy-relocs.h".
12566 (class Target_x86_64): Change type of copy_relocs_ to variable,
12567 update initializer.
12568 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12569 class. Change all callers.
12570 (Target_x86_64::do_finalize_sections): Change handling of
12571 copy_relocs_.
12572 * Makefile.am (CCFILES): Add copy-relocs.cc.
12573 (HFILES): Add copy-relocs.h.
12574
12575 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12576
12577 * testsuite/script_test_4.sh: Permit leading zeroes.
12578
12579 2008-04-15 Ian Lance Taylor <iant@google.com>
12580
12581 * script-sections.cc (Script_sections::create_segments): Use
12582 header_size_adjustment even when there is enough room for the
12583 headers.
12584 * testsuite/script_test_4.sh: New file.
12585 * testsuite/script_test_4.t: New file.
12586 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12587 (check_DATA): Add script_test_4.stdout.
12588 (MOSTLYCLEANFILES): Likewise.
12589 (script_test_4): New target.
12590 (script_test_4.stdout): New target.
12591 * testsuite/Makefile.in: Rebuild.
12592
12593 * sparc.cc: Add definitions for Output_data_plt_sparc class
12594 constants.
12595
12596 2008-04-14 David S. Miller <davem@davemloft.net>
12597
12598 * sparc.cc: New file.
12599 * Makefile.am (TARGETSOURCES): Add sparc.cc
12600 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12601 * configure.tgt: Document targ_extra_size and
12602 targ_extra_big_endian. Add entries for sparc-* and
12603 sparc64-*.
12604 * configure.ac: Handle targ_extra_size and
12605 targ_extra_big_endian.
12606 * Makefile.in: Rebuild.
12607 * configure: Likewise.
12608 * po/POTFILES.in: Likewise.
12609 * po/gold.pot: Likewise.
12610
12611 2008-04-14 Ian Lance Taylor <iant@google.com>
12612
12613 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12614 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12615 in the name/type/flags to section mapping. Don't call
12616 allocate_output_section.
12617 (Layout::choose_output_section): Change parameter from adjust_name
12618 to is_input_section. Don't permit input sections after sections
12619 are attached to segments. Don't call allocate_output_section.
12620 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12621 not write_enable_output_section.
12622 (Layout::make_output_section): Don't push to
12623 unattached_section_list_ nor call attach_to_segment. Call
12624 attach_section_to_segment if sections are attached.
12625 (Layout::attach_sections_to_segments): New function.
12626 (Layout::attach_section_to_segment): New function.
12627 (Layout::attach_allocated_section_to_segment): Rename from
12628 attach_to_segment. Remove flags parameter.
12629 (Layout::allocate_output_section): Remove function.
12630 (Layout::write_enable_output_section): Remove function.
12631 * layout.h (class Layout): Update for above changes. Add new
12632 field sections_are_attached_.
12633 * output.h (Output_section::update_flags_for_input_section): New
12634 function.
12635 * output.cc (Output_section::add_input_section): Call
12636 update_flags_for_input_section.
12637 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12638
12639 2008-04-11 Cary Coutant <ccoutant@google.com>
12640
12641 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12642 thought unnecessary.
12643 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12644
12645 2008-04-11 Ian Lance Taylor <iant@google.com>
12646
12647 * output.h (class Output_section_data): Remove inline definition
12648 of set_addralign.
12649 * output.cc (Output_section_data::set_addralign): New function.
12650
12651 2008-04-11 Cary Coutant <ccoutant@google.com>
12652
12653 Add support for TLS descriptors for i386 and x86_64.
12654 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12655 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12656 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12657 GOT_TYPE_TLS_DESC.
12658 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12659 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12660 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12661 relocations.
12662 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12663 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12664 Fix problem with initial-exec relocations.
12665 (Target_i386::Relocate::relocate_tls): Likewise.
12666 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12667 relaxation.
12668 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12669 support for section-plus-offset dynamic table entries.
12670 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12671 (Output_data_dynamic::Dynamic_entry): Add support for
12672 section-plus-offset dynamic table entries.
12673 (Output_data_dynamic::Classification): Likewise.
12674 (Output_data_dynamic::classification_): Renamed offset_.
12675 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12676 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12677 (Target_x86_64::make_plt_section): New function.
12678 (Target_x86_64::reserve_tlsdesc_entries): New function.
12679 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12680 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12681 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12682 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12683 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12684 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12685 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12686 add extra PLT entry for TLS descriptors.
12687 (Output_data_plt_x86_64::got_): New field.
12688 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12689 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12690 fields.
12691 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12692 descriptors.
12693 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12694 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12695 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12696 R_386_TLS_DESC_CALL relocations.
12697 (Target_x86_64::Scan::global): Likewise.
12698 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12699 for TLS descriptors.
12700 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12701 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12702 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12703 GD-to-IE relaxation.
12704 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12705 and TLS_DESCRIPTORS.
12706 * Makefile.in: Rebuild.
12707 * configure: Rebuild.
12708 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12709 (tls_test_shared2.so): New target.
12710 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12711 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12712 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12713 (tls_shared_gd_to_ie_test_LDADD): New variable.
12714 (tls_shared_gnu2_gd_to_ie_test): New target.
12715 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12716 New targets.
12717 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12718 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12719 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12720 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12721 (tls_shared_gnu2_test): New target.
12722 (tls_test_gnu2_shared.so): New target.
12723 (tls_shared_gnu2_test_SOURCES): New variable.
12724 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12725 (tls_shared_gnu2_test_LDFLAGS): New variable.
12726 (tls_shared_gnu2_test_LDADD): New variable.
12727 * testsuite/Makefile.in: Rebuild.
12728 * testsuite/Makefile.
12729
12730 2008-04-11 Ian Lance Taylor <iant@google.com>
12731
12732 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12733 justsyms.t.
12734 * testsuite/Makefile.in: Rebuild.
12735
12736 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12737 long.
12738 * testsuite/script_test_2.cc (main): Adjust test.
12739
12740 2008-04-11 David S. Miller <davem@davemloft.net>
12741 Ian Lance Taylor <iant@google.com>
12742
12743 * options.h (General_options): Add entries for '-Y' and
12744 '-relax'.
12745 * options.cc (General_options:finalize): If -Y was used, add those
12746 entries to the library path instead of the default "/lib" and
12747 "/usr/lib".
12748
12749 2008-04-11 David S. Miller <davem@davemloft.net>
12750
12751 * testsuite/justsyms.t: Start at 0x100.
12752 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12753 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12754 long.
12755 * testsuite/script_test_2.cc: Adjust string and section length
12756 checks.
12757
12758 2008-04-09 Ian Lance Taylor <iant@google.com>
12759
12760 PR gold/5996
12761 * script-sections.cc (Sections_element::allocate_to_segment): Add
12762 orphan parameter.
12763 (Output_section_definition::allocate_to_segment): Likewise.
12764 (Orphan_output_section::allocate_to_segment): Likewise.
12765 (Script_sections::attach_sections_using_phdrs_clause): Don't
12766 propagate non-PT_LOAD segments to orphan sections.
12767 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12768 readelf rather than objdump.
12769 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12770 .interp section and PT_INTERP segment are the same size.
12771 * testsuite/Makefile.in: Rebuild.
12772
12773 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12774 aliases for symbols defined in the same object.
12775 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12776 (weak_alias_test_SOURCES): New variable.
12777 (weak_alias_test_DEPENDENCIES): New variable.
12778 (weak_alias_test_LDFLAGS): New variable.
12779 (weak_alias_test_LDADD): New variable.
12780 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12781 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12782 (weak_alias_test_3.o): New target.
12783 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12784 * testsuite/weak_alias_test_main.cc: New file.
12785 * testsuite/weak_alias_test_1.cc: New file.
12786 * testsuite/weak_alias_test_2.cc: New file.
12787 * testsuite/weak_alias_test_3.cc: New file.
12788
12789 2008-04-08 Ian Lance Taylor <iant@google.com>
12790
12791 * options.h (class General_options): Add --noinhibit-exec option.
12792 * main.cc (main): Check --noinhibit-exec.
12793
12794 * options.h (class General_options): Define --wrap as a special
12795 option. Add wrap_symbols_ field.
12796 (General_options::any_wrap_symbols): New function.
12797 (General_options::is_wrap_symbol): New function.
12798 * options.cc (General_options::parse_wrap): New function.
12799 (General_options::General_options): Initialize wrap_symbols_.
12800 * symtab.cc (Symbol_table::wrap_symbol): New function.
12801 (Symbol_table::add_from_object): Handle --wrap.
12802 * symtab.h (class Symbol_table): Declare wrap_symbol.
12803 * target.h (Target::wrap_char): New function.
12804 (Target::Target_info): Add wrap_char field.
12805 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12806 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12807 * testsuite/testfile.cc (Target_test::test_target_info):
12808 Likewise.
12809
12810 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12811 there is one.
12812
12813 * layout.h (class Layout): Add added_eh_frame_data_ field.
12814 * layout.cc (Layout::Layout): Initialize new field.
12815 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12816 output section until we find a section we merged successfully.
12817 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12818 that the size be non-zero.
12819
12820 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12821 qualifier.
12822
12823 2008-04-08 Craig Silverstein <csilvers@google.com>
12824
12825 * configure.ac: Export new conditional variable HAVE_ZLIB.
12826 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12827 on HAVE_ZLIB.
12828 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12829 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12830
12831 2008-04-07 Ian Lance Taylor <iant@google.com>
12832
12833 * version.cc (version_string): Set to "1.5".
12834
12835 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12836 Add issued_non_pic_error_ field. Declare check_non_pic.
12837 (Target_x86_64::Scan::check_non_pic): New function.
12838 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12839 (Target_x86_64::Scan::global): Likewise.
12840
12841 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12842 addend parameter. Change caller. Handle merge sections.
12843 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12844 Address to Addend. Don't add in the result of
12845 local_section_offset, pass down the addend and use the returned
12846 value.
12847 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12848 Update declarations of local_section_offset and symbol_value.
12849 * testsuite/two_file_test_1.cc (t18): New function.
12850 * testsuite/two_file_test_2.cc (f18): New function.
12851 * testsuite/two_file_test_main.cc (main): Call t18.
12852 * testsuite/two_file_test.h (t18, f18): Declare.
12853
12854 * configure.ac: Don't test for objdump, c++filt, or readelf.
12855 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12856 conditionals.
12857 (TEST_READELF): New variable.
12858 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12859 (check_PROGRAMS): Add two_file_strip_test.
12860 (two_file_strip_test): New target.
12861 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12862 (two_file_same_shared_strip_test_SOURCES): New variable.
12863 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12864 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12865 (two_file_same_shared_strip_test_LDADD): New variable.
12866 (two_file_shared_strip.so): New target.
12867 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12868 (ver_test_5.syms, ver_test_7.syms): Likewise.
12869 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12870 (strip_test_3.stdout): Use TEST_OBJDUMP.
12871 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12872
12873 2008-04-04 Cary Coutant <ccoutant@google.com>
12874
12875 * symtab.h (Symbol::is_weak_undefined): New function.
12876 (Symbol::is_strong_undefined): New function.
12877 (Symbol::is_absolute): New function.
12878 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12879 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12880 absolute symbols.
12881 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12882 (weak_undef_test): New target.
12883 * testsuite/Makefile.in: Rebuild.
12884 * testsuite/weak_undef_file1.cc: New file.
12885 * testsuite/weak_undef_file2.cc: New file.
12886 * testsuite/weak_undef_test.cc: New file.
12887
12888 2008-04-03 Craig Silverstein <csilvers@google.com>
12889
12890 * compressed_output.h (class Output_compressed_section): Use
12891 unsigned buffer.
12892 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12893 add zlib header.
12894 (zlib_compressed_suffix): Removed.
12895 (Output_compressed_section::set_final_data_size): Use unsigned
12896 buffers.
12897 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12898 Fix linker invocation.
12899 (flagstest_o_specialfile_and_compress_debug_sections):
12900 Likewise.
12901 * testsuite/Makefile.in: Regenerated.
12902
12903 2008-04-02 David S. Miller <davem@davemloft.net>
12904
12905 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12906 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12907
12908 2008-04-02 Craig Silverstein <csilvers@google.com>
12909
12910 * TODO: New file.
12911
12912 2008-04-02 Ian Lance Taylor <iant@google.com>
12913
12914 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12915 parameters. Update for new key type to views_. Change all
12916 callers.
12917 (File_read::read): Adjust for byteshift in returned view.
12918 (File_read::add_view): New function, broken out of
12919 find_and_make_view.
12920 (File_read::make_view): New function, broken out of
12921 find_and_make_view.
12922 (File_read::find_or_make_view): Add offset and aligned
12923 parameters. Rewrite accordingly. Change all callers.
12924 (File_read::get_view): Add offset and aligned parameters. Adjust
12925 for byteshift in return value.
12926 (File_read::get_lasting_view): Likewise.
12927 * fileread.h (class File_read): Update declarations.
12928 (class File_read::View): Add byteshift_ field. Add byteshift to
12929 constructor. Add byteshift method.
12930 * archive.h (Archive::clear_uncached_views): New function.
12931 (Archive::get_view): Add aligned parameter. Change all callers.
12932 * object.h (Object::get_view): Add aligned parameter. Change all
12933 callers.
12934 (Object::get_lasting_view): Likewise.
12935
12936 * fileread.cc (File_read::release): Don't call clear_views if
12937 there are multiple objects.
12938 * fileread.h (File_read::clear_uncached_views): New function.
12939 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12940 on the archive.
12941
12942 2008-03-31 Cary Coutant <ccoutant@google.com>
12943
12944 Add thin archive support.
12945 * archive.cc (Archive::armagt): New const.
12946 (Archive::setup): Remove task parameter and calls to unlock.
12947 (Archive::unlock_nested_archives): New function.
12948 (Archive::read_header): Add nested_off parameter. Change
12949 all callers.
12950 (Archive::interpret_header): Likewise.
12951 (Archive::include_all_members): Change to handle thin
12952 archives.
12953 (Archive::include_member): Likewise.
12954 * archive.h (Archive::Archive): Add new parameters and
12955 initializers.
12956 (Archive::armagt): New const.
12957 (Archive::setup): Remove task parameter.
12958 (Archive::unlock_nested_archives): New function.
12959 (Archive::read_header): Add nested_off parameter.
12960 (Archive::interpret_header): Likewise.
12961 (Archive::Nested_archive_table): New typedef.
12962 (Archive::is_thin_archive_): New field.
12963 (Archive::nested_archives_): New field.
12964 (Archive::options_): New field.
12965 (Archive::dirpath_): New field.
12966 (Archive::task_): New field.
12967 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12968 for thin archives. Pass additional parameters to
12969 Archive::Archive. Unlock the archive file after calling
12970 Archive::setup.
12971
12972 2008-03-29 Ian Lance Taylor <iant@google.com>
12973
12974 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12975 version symbol to be local.
12976 * testsuite/ver_test_4.sh: New file.
12977 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12978 (check_DATA): Add ver_test_4.syms.
12979 (ver_test_4.syms): New target.
12980 * testsuite/Makefile.in: Rebuild.
12981
12982 * output.cc
12983 (Output_section::Input_section_sort_entry::has_priority): New
12984 function.
12985 (Output_section::Input_section_sort_entry::match_file_name): New
12986 function.
12987 (Output_section::Input_section_sort_entry::match_section_name):
12988 Remove.
12989 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12990 Remove.
12991 (Output_section::Input_section_sort_entry::match_section_file):
12992 Remove.
12993 (Output_section::Input_section_sort_compare::operator()): Rewrite
12994 using new Input_section_sort_entry functions. Sort crtbegin and
12995 crtend first. Sort sections with no priority before sections with
12996 a priority.
12997 * testsuite/initpri1.c (d3): Check j != 4.
12998 (cd5): New constructor/destructor function.
12999 (main): Check j != 2.
13000
13001 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13002 new symbol when resolving, don't call set_is_default.
13003 * testsuite/ver_test_7.cc: New file.
13004 * testsuite/ver_test_7.sh: New file.
13005 * testsuite/Makefile.am (ver_test_7.so): New target.
13006 (ver_test_7.o): New target.
13007 (check_SCRIPTS): Add ver_test_7.sh.
13008 (check_DATA): Add ver_test_7.syms.
13009 (ver_test_7.syms): New target.
13010
13011 2008-03-28 Ian Lance Taylor <iant@google.com>
13012
13013 * layout.cc (Layout::layout): If we see an input section with a
13014 name that needs sorting, set the must_sort flag for the output
13015 section.
13016 (Layout::make_output_section): If the name of the output section
13017 indicates that it might require sorting, set the may_sort flag.
13018 * output.h (Output_section::may_sort_attached_input_sections): New
13019 function.
13020 (Output_section::set_may_sort_attached_input_sections): New
13021 function.
13022 (Output_section::must_sort_attached_input_sections): New
13023 function.
13024 (Output_section::set_must_sort_attached_input_sections): New
13025 function.
13026 (class Output_section): Declare Input_section_sort_entry. Define
13027 Input_section_sort_compare. Declare
13028 sort_attached_input_sections. Add new fields:
13029 may_sort_attached_input_sections_,
13030 must_sort_attached_input_sections_,
13031 attached_input_sections_are_sorted_.
13032 * output.cc (Output_section::Output_section): Initialize new
13033 fields.
13034 (Output_section::add_input_section): Add an entry to
13035 input_sections_ if may_sort or must_sort are true.
13036 (Output_section::set_final_data_size): Call
13037 sort_attached_input_sections if necessary.
13038 (Output_section::Input_section_sort_entry): Define new class.
13039 (Output_section::Input_section_sort_compare::operator()): New
13040 function.
13041 (Output_section::sort_attached_input_sections): New function.
13042 * configure.ac: Check whether the compiler supports constructor
13043 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13044 * testsuite/initpri1.c: New file.
13045 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13046 CONSTRUCTOR_PRIORITY.
13047 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13048 (initpri1_LDFLAGS): New variable.
13049 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13050
13051 2008-03-27 Ian Lance Taylor <iant@google.com>
13052
13053 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13054 * testsuite/common_test_1.c: New file.
13055 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13056 (common_test_1_SOURCES): New variable.
13057 (common_test_1_DEPENDENCIES): New variable.
13058 (common_test_1_LDFLAGS): New variable.
13059
13060 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13061 and commons_ correctly when NAME/VERSION does not override
13062 NAME/NULL.
13063 * testsuite/ver_test_6.c: New file.
13064 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13065 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13066 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13067
13068 2008-03-26 Ian Lance Taylor <iant@google.com>
13069
13070 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13071 of an undefined symbol from a version script.
13072 * testsuite/Makefile.am (ver_test_5.so): New target.
13073 (ver_test_5.o): New target.
13074 (check_SCRIPTS): Add ver_test_5.sh.
13075 (check_DATA): Add ver_test_5.syms.
13076 (ver_test_5.syms): New target.
13077 * testsuite/ver_test_5.cc: New file.
13078 * testsuite/ver_test_5.script: New file.
13079 * testsuite/ver_test_5.sh: New file.
13080 * Makefile.in, testsuite/Makefile.in: Rebuild.
13081
13082 PR gold/5986
13083 Fix problems building gold with gcc 4.3.0.
13084 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13085 (gold_error_at_location, gold_warning_at_location): Use it.
13086 * configure.ac: Check whether we can compile and use a template
13087 function with a printf attribute.
13088 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13089 when jumping over bytes.
13090 * object.cc: Instantiate Object::read_section_data.
13091 * debug.h: Include <cstring>
13092 * dwarf_reader.cc: Include <algorithm>
13093 * main.cc: Include <cstring>.
13094 * options.cc: Include <cstring>.
13095 * output.cc: Include <cstring>.
13096 * script.cc: Include <cstring>.
13097 * script.h: Include <string>.
13098 * symtab.cc: Include <cstring> and <algorithm>.
13099 * target-select.cc: Include <cstring>.
13100 * version.cc: Include <string>.
13101 * testsuite/testmain.cc: Include <cstdlib>.
13102 * configure, config.in: Rebuild.
13103
13104 2008-03-25 Ian Lance Taylor <iant@google.com>
13105
13106 * options.cc: Include "../bfd/bfdver.h".
13107 (options::help): Print bug reporting address.
13108
13109 * version.cc (print_version): Adjust output for current value of
13110 BFD_VERSION_STRING.
13111
13112 * NEWS: New file.
13113
13114 * options.cc (options::help): Print list of supported targets.
13115 * target-select.h: Include <vector>.
13116 (class Target_selector): Make machine_, size_, and is_big_endian_
13117 fields const. Add bfd_name_ and instantiated_target_ fields.
13118 (Target_selector::Target_selector): Add bfd_name parameter.
13119 (Target_selector::recognize): Make non-virtual, call
13120 do_recognize.
13121 (Target_selector::recognize_by_name): Make non-virtual, call
13122 do_recognize_by_name.
13123 (Target_selector::supported_names): New function.
13124 (Target_selector::bfd_name): New function.
13125 (Target_selector::do_instantiate_target): New pure virtual
13126 function.
13127 (Target_selector::do_recognize): New virtual function.
13128 (Target_selector::do_recognize_by_name): New virtual function.
13129 (Target_selector::instantiate_target): New private function.
13130 (supported_target_names): Declare.
13131 * target-select.cc (Target_selector::Target_selector): Update for
13132 new parameter and fields.
13133 (select_target_by_name): Check that the name matches before
13134 calling recognize_by_name.
13135 (supported_target_names): New function.
13136 * i386.cc (class Target_selector_i386): Update Target_selector
13137 constructor call. Remove recognize and recognize_by_name. Add
13138 do_instantiate_target.
13139 * x86_64.cc (class Target_selector_x86_64): Likewise.
13140 * testsuite/testfile.cc (class Target_selector_test): Update for
13141 changes to Target_selector.
13142
13143 * README: Rewrite, with some notes on unsupported features.
13144
13145 2008-03-24 Cary Coutant <ccoutant@google.com>
13146
13147 * i386.cc (Target_i386::Got_type): New enum declaration.
13148 (Target_i386::Scan::local): Updated callers of Output_data_got
13149 member functions.
13150 (Target_i386::Scan::global): Likewise.
13151 (Target_i386::Relocate::relocate): Likewise.
13152 (Target_i386::Relocate::relocate_tls): Likewise.
13153 * object.h (Got_offset_list): New class.
13154 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13155 (Sized_relobj::local_got_offset): Likewise.
13156 (Sized_relobj::set_local_got_offset): Likewise.
13157 (Sized_relobj::local_has_tls_got_offset): Removed.
13158 (Sized_relobj::local_tls_got_offset): Removed.
13159 (Sized_relobj::set_local_tls_got_offset): Removed.
13160 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13161 * output.cc (Output_data_got::add_global): Added got_type parameter.
13162 (Output_data_got::add_global_with_rel): Likewise.
13163 (Output_data_got::add_global_with_rela): Likewise.
13164 (Output_data_got::add_global_pair_with_rel): New function.
13165 (Output_data_got::add_global_pair_with_rela): New function.
13166 (Output_data_got::add_local): Added got_type parameter.
13167 (Output_data_got::add_local_with_rel): Likewise.
13168 (Output_data_got::add_local_with_rela): Likewise.
13169 (Output_data_got::add_local_pair_with_rel): New function.
13170 (Output_data_got::add_local_pair_with_rela): New function.
13171 (Output_data_got::add_global_tls): Removed.
13172 (Output_data_got::add_global_tls_with_rel): Removed.
13173 (Output_data_got::add_global_tls_with_rela): Removed.
13174 (Output_data_got::add_local_tls): Removed.
13175 (Output_data_got::add_local_tls_with_rel): Removed.
13176 (Output_data_got::add_local_tls_with_rela): Removed.
13177 * output.h (Output_data_got::add_global): Added got_type parameter.
13178 (Output_data_got::add_global_with_rel): Likewise.
13179 (Output_data_got::add_global_with_rela): Likewise.
13180 (Output_data_got::add_global_pair_with_rel): New function.
13181 (Output_data_got::add_global_pair_with_rela): New function.
13182 (Output_data_got::add_local): Added got_type parameter.
13183 (Output_data_got::add_local_with_rel): Likewise.
13184 (Output_data_got::add_local_with_rela): Likewise.
13185 (Output_data_got::add_local_pair_with_rel): New function.
13186 (Output_data_got::add_local_pair_with_rela): New function.
13187 (Output_data_got::add_global_tls): Removed.
13188 (Output_data_got::add_global_tls_with_rel): Removed.
13189 (Output_data_got::add_global_tls_with_rela): Removed.
13190 (Output_data_got::add_local_tls): Removed.
13191 (Output_data_got::add_local_tls_with_rel): Removed.
13192 (Output_data_got::add_local_tls_with_rela): Removed.
13193 * resolve.cc (Symbol::override_base_with_special): Removed
13194 reference to has_got_offset_ field.
13195 * symtab.cc (Symbol::init_fields): Replaced initialization
13196 of got_offset_ with got_offsets_. Removed initialization
13197 of has_got_offset_
13198 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13199 (Symbol::got_offset): Likewise.
13200 (Symbol::set_got_offset): Likewise.
13201 (Symbol::has_tls_got_offset): Removed.
13202 (Symbol::tls_got_offset): Removed.
13203 (Symbol::set_tls_got_offset): Removed.
13204 (Symbol::got_offset_): Removed.
13205 (Symbol::tls_mod_got_offset_): Removed.
13206 (Symbol::tls_pair_got_offset_): Removed.
13207 (Symbol::got_offsets_): New field.
13208 (Symbol::has_got_offset): Removed.
13209 (Symbol::has_tls_mod_got_offset): Removed.
13210 (Symbol::has_tls_pair_got_offset): Removed.
13211 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13212 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13213 member functions.
13214 (Target_x86_64::Scan::global): Likewise.
13215 (Target_x86_64::Relocate::relocate): Likewise.
13216 (Target_x86_64::Relocate::relocate_tls): Likewise.
13217
13218 2008-03-25 Ben Elliston <bje@au.ibm.com>
13219
13220 * yyscript.y: Fix spelling error in comment.
13221
13222 2008-03-24 Ian Lance Taylor <iant@google.com>
13223
13224 * options.h (class General_options): Define build_id option.
13225 * layout.h (class Layout): Declare write_build_id, create_note,
13226 create_build_id. Add build_id_note_ member.
13227 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13228 "libiberty.h", "md5.h", "sha1.h".
13229 (Layout::Layout): Initialize eh_frame_data_,
13230 eh_frame_hdr_section_, and build_id_note_.
13231 (Layout::finalize): Call create_build_id.
13232 (Layout::create_note): New function, broken out of
13233 Layout::create_gold_note.
13234 (Layout::create_gold_note): Call create_note.
13235 (Layout::create_build_id): New function.
13236 (Layout::write_build_id): New function.
13237 (Close_task_runner::run): Call write_build_id.
13238
13239 * x86_64.cc: Correct license to GPLv3.
13240
13241 2008-03-23 Ian Lance Taylor <iant@google.com>
13242
13243 * options.cc: Include "demangle.h".
13244 (parse_optional_string): New function.
13245 (parse_long_option): Handle takes_optional_argument.
13246 (parse_short_option): Update dash_z initializer. Handle
13247 takes_optional_argument.
13248 (General_options::General_options): Initialize do_demangle_.
13249 (General_options::finalize): Set do_demangle_. Handle demangling
13250 style.
13251 * options.h (parse_optional_string): Declare.
13252 (struct One_option): Add optional_arg field. Update constructor.
13253 Update call constructor calls. Add takes_optional_argument
13254 function.
13255 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13256 (DEFINE_optional_string): Define.
13257 (General_options::demangle): Change from DEFINE_bool to
13258 DEFINE_optional_string.
13259 (General_options::no_demangle): New function.
13260 (General_options::do_demangle): New function.
13261 (General_options::set_do_demangle): New function.
13262 (General_options::execstack_status_): Move definition to end of
13263 class definition.
13264 (General_options::static_): Likewise.
13265 (General_options::do_demangle_): New field.
13266 * object.cc (big_endian>::get_symbol_location_info): Call
13267 Options::do_demangle, not Options::demangle.
13268 * symtab.cc (demangle): Likewise.
13269
13270 2008-03-22 Ian Lance Taylor <iant@google.com>
13271
13272 * gold.h: Include <cstddef> and <sys/types.h>
13273 * options.h: Include <cstring>.
13274
13275 2008-03-21 Ian Lance Taylor <iant@google.com>
13276
13277 * Added source code to GNU binutils.
This page took 0.339278 seconds and 4 git commands to generate.