2012-07-18 Cary Coutant <ccoutant@google.com>
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-07-18 Cary Coutant <ccoutant@google.com>
2
3 PR gold/14344
4 * configure.ac: Add check for -gpubnames support.
5 * configure: Regenerate.
6 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
7 support; force -gno-pubnames.
8 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
9 support.
10 (gdb_index_test_4): New test.
11 * testsuite/Makefile.in: Regenerate.
12 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
13 * testsuite/gdb_index_test_2.sh: Likewise.
14 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
15 * testsuite/gdb_index_test_4.sh: New script.
16 * testsuite/gdb_index_test_comm.sh: New script with common code;
17 don't look for space after colon.
18
19 2012-07-16 Sriraman Tallam <tmsriram@google.com>
20
21 * gold.cc (queue_middle_tasks): Update function order only after
22 deferred objects due to plugins are processed.
23
24 2012-07-11 Ian Lance Taylor <iant@google.com>
25
26 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
27 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
28 (Target_arm::scan_reloc_for_stub): Likewise.
29 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
30 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
31 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
32 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
33 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
34
35 2012-07-10 Dodji Seketeli <dodji@redhat.com>
36 Ian Lance Taylor <iant@google.com>
37
38 PR gold/14309
39 * configure.ac: Test whether std::tr1::hash<off_t> works.
40 * gold.h: Add a specialization for std::tr1::hash<off_t> if
41 needed.
42 * output.h (class Output_fill): Add virtual destructor.
43 * configure, config.in: Rebuild.
44
45 2012-06-22 Roland McGrath <mcgrathr@google.com>
46
47 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
48
49 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
50
51 * plugin.cc (Plugin::load): Handle position independent executables.
52
53 2012-06-06 Cary Coutant <ccoutant@google.com>
54
55 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
56 add .debug_macro.
57 (lines_only_debug_sections): Likewise.
58 (gdb_fast_lookup_sections): New static array.
59 (is_gdb_debug_section): Rename formal parameter.
60 (is_lines_only_debug_section): Likewise.
61 (is_gdb_fast_lookup_section): New function.
62 (Layout::include_section): Check for ".zdebug_" prefix; pass
63 section name suffix to is_gdb_debug_section, et al.; check for
64 fast-lookup sections when building .gdb_index.
65 * options.h (--strip-debug-gdb): Update GDB version number.
66
67 2012-06-06 Cary Coutant <ccoutant@google.com>
68
69 * configure.ac: Add check for fallocate.
70 * configure: Regenerate.
71 * config.in: Regenerate.
72
73 * options.h (class General_options): Add --mmap-output-file and
74 --posix-fallocate options.
75 * output.cc: (posix_fallocate): Remove; replace with...
76 (gold_fallocate): New function.
77 (Output_file::map_no_anonymous): Call gold_fallocate.
78 (Output_file::map): Check --mmap-output-file option.
79
80 2012-06-05 Jing Yu <jingyu@google.com>
81
82 * gold.h (textdomain): Add do {} to empty while(0).
83 (bindtextdomain): Likewise.
84
85 2012-06-04 Cary Coutant <ccoutant@google.com>
86
87 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
88 has_dynsym_index.
89
90 2012-05-25 Sriraman Tallam <tmsriram@google.com>
91
92 * symtab.cc (Symbol_table::define_special_symbol):
93 Initialize *poldsym to prevent uninitialized variable errors.
94
95 2012-05-23 Cary Coutant <ccoutant@google.com>
96
97 * layout.cc (Layout::section_name_mapping): Add rules to handle
98 exact match on .data.rel.ro.local or .data.rel.ro.
99 (Layout::output_section_name): Check for exact matches.
100
101 2012-05-23 Cary Coutant <ccoutant@google.com>
102
103 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
104 more carefully.
105
106 2012-05-22 Cary Coutant <ccoutant@google.com>
107
108 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
109 object before exporting symbol.
110
111 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
112
113 * testsuite/tls_test.cc: Include "config.h" first.
114 * testsuite/tls_test_c.c: Likewise.
115
116 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
117 Nick Clifton <nickc@redhat.com>
118
119 PR 14072
120 * configure.in: Add check that sysdep.h has been included before
121 any system header files.
122 * configure: Regenerate.
123 * config.in: Regenerate.
124
125 2012-05-14 Cary Coutant <ccoutant@google.com>
126
127 * layout.cc (Layout::make_output_section): Mark .tdata section
128 as RELRO.
129 * testsuite/relro_test.cc: Add a TLS variable.
130
131 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
132
133 PR gold/14091
134 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
135 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
136 R_X86_64_64.
137
138 2012-05-08 Cary Coutant <ccoutant@google.com>
139
140 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
141 (lines_only_debug_sections): Likewise.
142
143 2012-05-02 Roland McGrath <mcgrathr@google.com>
144
145 * nacl.cc: New file.
146 * nacl.h: New file.
147 * Makefile.am (CCFILES, HFILES): Add them.
148 * Makefile.in: Regenerate.
149 * i386.cc (Output_data_plt_i386_nacl): New class.
150 (Output_data_plt_i386_nacl_exec): New class.
151 (Output_data_plt_i386_nacl_dyn): New class.
152 (Target_i386_nacl): New class.
153 (Target_selector_i386_nacl): New class.
154 (target_selector_i386): Use it instead of Target_selector_i386.
155 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
156 (Target_x86_64_nacl): New class.
157 (Target_selector_x86_64_nacl): New class.
158 (target_selector_x86_64, target_selector_x32): Use it instead of
159 Target_selector_x86_64.
160 * arm.cc (Output_data_plt_arm_nacl): New class.
161 (Target_arm_nacl): New class.
162 (Target_selector_arm_nacl): New class.
163 (target_selector_arm, target_selector_armbe): Use it instead of
164 Target_selector_arm.
165
166 * target-select.cc (select_target): Take new Input_file* and off_t
167 arguments, pass them on to recognize method of selector.
168 * object.cc (make_elf_sized_object): Update caller.
169 * parameters.cc (parameters_force_valid_target): Likewise.
170 * incremental.cc (make_sized_incremental_binary): Likewise.
171 * target-select.h: Update decl.
172 (Target_selector::recognize): Take new Input_file* argument,
173 pass it on to do_recognize.
174 (Target_selector::do_recognize): Take new Input_file* argument.
175 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
176 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
177 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
178 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
179
180 * target.h (Target::Target_info): New members isolate_execinstr
181 and rosegment_gap.
182 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
183 * arm.cc (Target_arm::arm_info): Update initializer.
184 * i386.cc (Target_i386::i386_info): Likewise.
185 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
186 * sparc.cc (Target_sparc::sparc_info): Likewise.
187 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
188 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
189 * layout.cc (Layout::attach_allocated_section_to_segment):
190 Take new const Target* argument. If target->isolate_execinstr(), act
191 like --rosegment.
192 (Layout::find_first_load_seg): Take new const Target* argument;
193 if target->isolate_execinstr(), reject PF_X segments.
194 (Layout::relaxation_loop_body): Update caller.
195 (Layout::set_segment_offsets): If target->isolate_execinstr(),
196 reset file offset to zero when we hit LOAD_SEG, and then do a second
197 loop over the segments before LOAD_SEG to reassign offsets after
198 addresses have been determined. Handle target->rosegment_gap().
199 (Layout::attach_section_to_segment): Take new const Target* argument;
200 pass it to attach_allocated_section_to_segment.
201 (Layout::make_output_section): Update caller.
202 (Layout::attach_sections_to_segments): Take new const Target* argument;
203 pass it to attach_section_to_segment.
204 * gold.cc (queue_middle_tasks): Update caller.
205 * layout.h (Layout): Update method decls with new arguments.
206
207 * arm.cc (Target_arm::Target_arm): Take optional argument for the
208 Target_info pointer to use.
209 (Target_arm::do_make_data_plt): New virtual method.
210 (Target_arm::make_data_plt): New method that calls it.
211 (Target_arm::make_plt_entry): Use it.
212 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
213 for the section alignment.
214 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
215 method.
216 (Output_data_plt_arm::first_plt_entry_offset): Call it.
217 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
218 method.
219 (Output_data_plt_arm::get_plt_entry_size): Call it.
220 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
221 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
222 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
223 method.
224 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
225 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
226 method instead of sizeof(plt_entry).
227 (Output_data_plt_arm::add_entry): Likewise.
228 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
229 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
230 than static method.
231 (Target_arm::plt_entry_size): Likewise.
232 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
233 Move to ...
234 (Output_data_plt_arm_standard): ... here, new class.
235 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
236 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
237 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
238
239 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
240 Take additional argument for the PLT entry size.
241 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
242 Use get_plt_entry_size method rather than plt_entry_size variable.
243 (Output_data_plt_x86_64::reserve_slot): Likewise.
244 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
245 (Output_data_plt_x86_64::add_entry): Likewise.
246 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
247 (Output_data_plt_x86_64::address_for_global): Likewise.
248 (Output_data_plt_x86_64::address_for_local): Likewise.
249 (Output_data_plt_x86_64::set_final_data_size): Likewise.
250 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
251 Make method non-static.
252 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
253 method.
254 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
255 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
256 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
257 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
258 virtual method.
259 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
260 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
261 virtual method.
262 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
263 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
264 virtual method.
265 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
266 (Output_data_plt_x86_64::plt_entry_size)
267 (Output_data_plt_x86_64::first_plt_entry)
268 (Output_data_plt_x86_64::plt_entry)
269 (Output_data_plt_x86_64::tlsdesc_plt_entry)
270 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
271 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
272 (Output_data_plt_x86_64_standard): ... here, new class.
273 (Target_x86_64::Target_x86_64): Take optional argument for the
274 Target_info pointer to use.
275 (Target_x86_64::do_make_data_plt): New virtual method.
276 (Target_x86_64::make_data_plt): New method to call it.
277 (Target_x86_64::init_got_plt_for_update): Use that.
278 Call this->plt_->add_eh_frame method here.
279 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
280 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
281 rather than static method.
282 (Target_x86_64::plt_entry_size): Likewise.
283 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
284 rather than plt_entry_size variable. Move guts of PLT filling to...
285 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
286 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
287 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
288
289 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
290 additional argument for the section alignment.
291 Don't do add_eh_frame_for_plt here.
292 (Output_data_plt_i386::first_plt_entry_offset): Make the method
293 non-static. Use get_plt_entry_size method rather than plt_entry_size
294 variable.
295 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
296 method.
297 (Output_data_plt_i386::get_plt_entry_size): Call it.
298 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
299 (Output_data_plt_i386::add_eh_frame): New method to call it.
300 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
301 method.
302 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
303 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
304 method.
305 (Output_data_plt_i386::fill_plt_entry): New method to call it.
306 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
307 method instead of plt_entry_size.
308 (Output_data_plt_i386::plt_entry_size)
309 (Output_data_plt_i386::plt_eh_frame_fde_size)
310 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
311 (Output_data_plt_i386_standard): ... here, new class.
312 (Output_data_plt_i386_exec): New class.
313 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
314 (Output_data_plt_i386_exec::first_plt_entry): ... here.
315 (Output_data_plt_i386::exec_plt_entry): Move to ...
316 (Output_data_plt_i386_exec::plt_entry): ... here.
317 (Output_data_plt_i386_dyn): New class.
318 (Output_data_plt_i386::first_plt_entry): Move to ...
319 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
320 (Output_data_plt_i386::dyn_plt_entry): Move to ...
321 (Output_data_plt_i386_dyn::plt_entry): ... here.
322 (Target_i386::Target_i386): Take optional argument for the Target_info
323 pointer to use.
324 (Target_i386::do_make_data_plt): New virtual method.
325 (Target_i386::make_data_plt): New method to call it.
326 (Target_i386::make_plt_section): Use that.
327 Call this->plt_->add_eh_frame method here.
328 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
329 rather than plt_entry_size variable.
330 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
331 (Output_data_plt_i386::address_for_local): Likewise.
332 (Output_data_plt_i386::do_write): Likewise.
333 Move guts of PLT filling to...
334 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
335 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
336 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
337 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
338
339 2012-05-01 Cary Coutant <ccoutant@google.com>
340
341 * dwarf_reader.cc (Dwarf_die::read_attributes)
342 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
343 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
344 * reduced_debug_output.cc
345 (Output_reduced_debug_info_section::get_die_end): Remove
346 DW_FORM_GNU_ref_index. Add default case.
347
348 2012-04-26 Mark Wielaard <mjw@redhat.com>
349
350 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
351 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
352 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
353 DW_AT_high_pc as offset from DW_AT_low_pc.
354
355 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
356 * testsuite/Makefile.in: Regenerate.
357 * testsuite/gdb_index_test_3.c: New test source file.
358 * testsuite/gdb_index_test_3.sh: New test source file.
359
360 2012-04-25 Ian Lance Taylor <iant@google.com>
361
362 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
363 pointer.
364 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
365 as a class, not a struct.
366 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
367 (Target_arm::apply_cortex_a8_workaround): Likewise.
368 * gc.h: Declare Reloc_types as a struct, not a class.
369 * object.h: Declare Symbols_data as a struct.
370 * reloc.h: Declare Read_relocs_data as a struct.
371 * target.h: Declare Relocate_info as a struct.
372
373 2012-04-24 David S. Miller <davem@davemloft.net>
374
375 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
376 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
377 and R_SPARC_WPLT30.
378
379 2012-04-24 Cary Coutant <ccoutant@google.com>
380
381 * incremental-dump.cc (find_input_containing_global): Replace
382 magic number with symbolic constant.
383 (dump_incremental_inputs): Update version number.
384 * incremental.cc (Output_section_incremental_inputs): Update version
385 number; import symbolic constants from Incremental_inputs_reader.
386 (Incremental_inputs::create_data_sections): Align relocations
387 section correctly for 64-bit targets.
388 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
389 constants; add padding.
390 (Output_section_incremental_inputs::write_header): Add assert for
391 header_size.
392 (Output_section_incremental_inputs::write_input_files): Add assert
393 for input_entry_size.
394 (Output_section_incremental_inputs::write_info_blocks): Add padding;
395 add assert for object_info_size, input_section_entry_size,
396 global_sym_entry_size.
397 * incremental.h (Incremental_inputs_reader): Add symbolic constants
398 for data structure sizes; use them.
399 (Incremental_input_entry_reader): Import symbolic constants from
400 Incremental_inputs_reader; use them.
401
402 2012-04-23 David S. Miller <davem@davemloft.net>
403
404 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
405 and elf_flags_set_.
406 (Target_sparc::Target_sparc): Initialize new fields.
407 (Target_sparc::do_make_elf_object): New function.
408 (Target_sparc::do_adjust_elf_header): New function.
409
410 2012-04-23 Cary Coutant <ccoutant@google.com>
411
412 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
413 CU range table of gdb index.
414
415 2012-04-20 David S. Miller <davem@davemloft.net>
416
417 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
418 instead of false.
419
420 2012-04-16 David S. Miller <davem@davemloft.net>
421
422 * sparc.cc (Target_sparc::got_address): New function.
423 (Sparc_relocate_functions::gdop_hix22): New function.
424 (Sparc_relocate_functions::gdop_lox10): New function.
425 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
426 relocs.
427 (Target_sparc::Scan::local): Likewise if the global symbol is not
428 preemptible and is not IFUNC.
429 (Target_sparc::Relocate::relocate): Perform GOTDATA code
430 transformations for local and non-preemptible non-IFUNC global
431 symbols.
432
433 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
434 writing out 64-bit part of ranges.
435
436 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
437 -fpic and -fpie respectively.
438 * Makefile.in: Regenerate.
439
440 * sparc.cc (class Target_sparc): Add rela_ifunc_.
441 (Target_sparc::Target_sparc): Initialize new field.
442 (Target_sparc::do_plt_section_for_global): New function.
443 (Target_sparc::do_plt_section_for_local): New function.
444 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
445 (Target_sparc::make_plt_section): New function, broken out of
446 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
447 (Target_sparc::make_plt_entry): Call make_plt_section.
448 (Target_sparc::make_local_ifunc_plt_entry): New function.
449 (Target_sparc::rela_ifunc_section): New function.
450 (Target_sparc::plt_section): Remove const.
451 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
452 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
453 and ifunc_count_ fields.
454 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
455 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
456 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
457 (Output_data_plt_sparc::rela_ifunc): New function.
458 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
459 (Output_data_plt_sparc::has_ifunc_section): New function.
460 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
461 (Output_data_plt_sparc::address_for_global): New function.
462 (Output_data_plt_sparc::address_for_local): New function.
463 (Output_data_plt_sparc::plt_index_to_offset): New function.
464 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
465 and entry_count.
466 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
467 entry_count.
468 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
469 R_SPARC_JMP_IREL to switch.
470 (Target_sparc::Scan::check_non_pic): Likewise.
471 (Target_sparc::Scan::local): Handle IFUNC symbols.
472 (Target_sparc::Scan::local): Likewise.
473 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
474 and plt_address_for_local.
475 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
476 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
477
478 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
479 (class Output_data_reloc): Adjust calls to Output_reloc_type.
480 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
481 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
482 global relocs too.
483 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
484 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
485 calls.
486 * sparc.cc (Target_sparc::Scan::global): Likewise.
487 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
488
489 2012-04-16 Cary Coutant <ccoutant@google.com>
490
491 * archive.cc (Library_base::should_include_member): Check for
492 --export-dynamic-symbol.
493 * options.h (class General_options): Add --export-dynamic-symbol.
494 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
495 --export-dynamic-symbol.
496 (Symbol_table::gc_mark_undef_symbols): Likewise.
497 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
498
499 2012-04-12 David S. Miller <davem@davemloft.net>
500
501 * sparc.cc (Reloc::wdisp10): New relocation method.
502 (Reloc::h34): Likewise.
503 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
504 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
505 R_SPARC_WDISP10.
506 (Target_sparc::Scan::local): Likewise.
507 (Target_sparc::Scan::global): Likewise.
508 (Target_sparc::Relocate::relocate): Likewise.
509
510 2012-04-09 Cary Coutant <ccoutant@google.com>
511
512 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
513 low_pc == 0.
514
515 2012-04-06 Ian Lance Taylor <iant@google.com>
516
517 * timer.cc: #include <unistd.h>.
518
519 2012-04-06 Roland McGrath <mcgrathr@google.com>
520
521 * configure.in (AC_CHECK_HEADERS): Add locale.h.
522 * config.in: Regenerate.
523 * configure: Regenerate.
524
525 2012-04-05 Nick Clifton <nickc@redhat.com>
526
527 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
528 (AM_LC_MESSAGES): Add.
529 * aclocal.m4: Regenerate.
530 * config.in: Regenerate.
531 * configure: Regenerate.
532
533 2012-03-21 Cary Coutant <ccoutant@google.com>
534
535 * Makefile.am: Add gdb-index.cc, gdb-index.h.
536 * Makefile.in: Regenerate.
537 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
538 (Sized_elf_reloc_mapper::symbol_section): New function.
539 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
540 (make_elf_reloc_mapper): New function.
541 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
542 (Dwarf_abbrev_table::do_read_abbrevs): New function.
543 (Dwarf_abbrev_table::do_get_abbrev): New function.
544 (Dwarf_ranges_table::read_ranges_table): New function.
545 (Dwarf_ranges_table::read_range_list): New function.
546 (Dwarf_pubnames_table::read_section): New function.
547 (Dwarf_pubnames_table::read_header): New function.
548 (Dwarf_pubnames_table::next_name): New function.
549 (Dwarf_die::Dwarf_die): New function.
550 (Dwarf_die::read_attributes): New function.
551 (Dwarf_die::skip_attributes): New function.
552 (Dwarf_die::set_name): New function.
553 (Dwarf_die::set_linkage_name): New function.
554 (Dwarf_die::attribute): New function.
555 (Dwarf_die::string_attribute): New function.
556 (Dwarf_die::int_attribute): New function.
557 (Dwarf_die::uint_attribute): New function.
558 (Dwarf_die::ref_attribute): New function.
559 (Dwarf_die::child_offset): New function.
560 (Dwarf_die::sibling_offset): New function.
561 (Dwarf_info_reader::check_buffer): New function.
562 (Dwarf_info_reader::parse): New function.
563 (Dwarf_info_reader::do_parse): New function.
564 (Dwarf_info_reader::do_read_string_table): New function.
565 (Dwarf_info_reader::lookup_reloc): New function.
566 (Dwarf_info_reader::get_string): New function.
567 (Dwarf_info_reader::visit_compilation_unit): New function.
568 (Dwarf_info_reader::visit_type_unit): New function.
569 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
570 Sized_elf_reloc_mapper.
571 (Sized_dwarf_line_info::symbol_section): Remove function.
572 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
573 (Sized_dwarf_line_info::read_line_mappings): Remove object
574 parameter, adjust callers.
575 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
576 * dwarf_reader.h: Include <sys/types.h>.
577 (class Track_relocs): Remove forward declaration.
578 (class Elf_reloc_mapper): New class.
579 (class Sized_elf_reloc_mapper): New class.
580 (class Dwarf_abbrev_table): New class.
581 (class Dwarf_range_list): New class.
582 (class Dwarf_ranges_table): New class.
583 (class Dwarf_pubnames_table): New class.
584 (class Dwarf_die): New class.
585 (class Dwarf_info_reader): New class.
586 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
587 (Sized_dwarf_line_info::symbol_section): Remove member function.
588 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
589 base class.
590 * gdb-index.cc: New source file.
591 * gdb-index.h: New source file.
592 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
593 and .debug_types sections, call Layout::add_to_gdb_index.
594 (Sized_relobj_incr::do_section_name): Implement.
595 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
596 return type; Implement.
597 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
598 return type.
599 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
600 parameter list and return type.
601 (Sized_incr_dynobj::do_section_contents): Likewise.
602 * layout.cc: Include gdb-index.h.
603 (Layout::Layout): Initialize gdb_index_data_.
604 (Layout::init_fixed_output_section): Check for .gdb_index section.
605 (Layout::add_to_gdb_index): New function. Instantiate.
606 * layout.h: Add forward declaration for class Gdb_index.
607 (Layout::add_to_gdb_index): New member function.
608 (Layout::gdb_index_data_): New data member.
609 * main.cc: Include gdb-index.h.
610 (main): Print statistics for gdb index.
611 * object.cc (Object::section_contents): Move code into
612 do_section_contents.
613 (need_decompressed_section): Check for sections needed when building
614 gdb index.
615 (build_compressed_section_map): Likewise.
616 (Sized_relobj_file::do_read_symbols): Need local symbols when building
617 gdb index.
618 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
619 sections; call Layout::add_to_gdb_index.
620 (Sized_relobj_file::do_decompressed_section_contents): Call
621 do_section_contents directly.
622 * object.h (Object::do_section_contents): Adjust parameter list and
623 return type.
624 (Object::do_decompressed_section_contents): Call do_section_contents
625 directly.
626 (Sized_relobj_file::do_section_contents): Adjust parameter list and
627 return type.
628 * options.h (class General_options): Add --gdb-index option.
629 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
630 list and return type.
631 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
632 * reloc.h (Track_relocs::checkpoint): New function.
633 (Track_relocs::reset): New function.
634
635 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
636 New test cases.
637 * testsuite/Makefile.in: Regenerate.
638 * testsuite/gdb_index_test.cc: New test source file.
639 * testsuite/gdb_index_test_1.sh: New test source file.
640 * testsuite/gdb_index_test_2.sh: New test source file.
641
642 2012-03-19 Doug Kwan <dougkwan@google.com>
643
644 * arm.cc (Target_arm::do_define_standard_symbols): New method.
645 (Target_arm::do_finalize_sections): Remove code which defines
646 __exidx_start and __exidx_end. Make symbol table parameter
647 anonymous as it is not used.
648 * gold.cc (queue_middle_tasks): Call target hook to define any
649 target-specific symbols.
650 * target.h (Target::define_standard_symbols): New method.
651 (Target::do_define_standard_symbols): Same.
652 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
653 * testsuite/Makefile.in: Regenerate.
654 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
655 and __exidx_end.
656 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
657 relocations are generated for __exidx_start and __exidx_end.
658
659 2012-03-16 Doug Kwan <dougkwan@google.com>
660
661 * testsuite/Makefile.am: Disable test initpri3b.
662 * testsuite/Makefile.in: Regenerate.
663
664 2012-03-15 Doug Kwan <dougkwan@google.com>
665
666 * arm.cc (Target_arm::got_section): Make .got section read-only
667 if -z now is given.
668
669 2012-03-15 Ian Lance Taylor <iant@google.com>
670
671 PR gold/13850
672 * layout.cc (Layout::make_output_section): Correctly mark
673 SHT_INIT_ARRAY, et. al., as relro.
674
675 2012-03-14 Doug Kwan <dougkwan@google.com>
676
677 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
678 dynamic relocations for protected symbols in shared objects.
679
680 2012-03-13 Ian Lance Taylor <iant@google.com>
681
682 * resolve.cc (Symbol_table::resolve): When merging common symbols,
683 keep the larger alignment.
684
685 2012-03-12 Cary Coutant <ccoutant@google.com>
686
687 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
688 handling of DW_LNE_define_file.
689
690 2012-03-12 Cary Coutant <ccoutant@google.com>
691
692 * reduced_debug_output.cc
693 (Output_reduced_debug_info_section::get_die_end): Add new FORM
694 codes to switch.
695
696 2012-02-29 Cary Coutant <ccoutant@google.com>
697
698 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
699
700 2012-02-29 Cary Coutant <ccoutant@google.com>
701
702 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
703 Call Object::decompressed_section_contents.
704 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
705 New dtor.
706 (Sized_dwarf_line_info::buffer_start_): New data member.
707 * merge.cc (Output_merge_data::do_add_input_section): Call
708 Object::decompressed_section_contents.
709 (Output_merge_string::do_add_input_section): Likewise.
710 * object.cc (need_decompressed_section): New function.
711 (build_compressed_section_map): Decompress sections needed later.
712 (Sized_relobj_file::do_decompressed_section_contents): New function.
713 (Sized_relobj_file::do_discard_decompressed_sections): New function.
714 * object.h (Object::decompressed_section_contents): New function.
715 (Object::discard_decompressed_sections): New function.
716 (Object::do_decompressed_section_contents): New function.
717 (Object::do_discard_decompressed_sections): New function.
718 (Compressed_section_info): New type.
719 (Compressed_section_map): Include decompressed section contents.
720 (Sized_relobj_file::do_decompressed_section_contents): New function.
721 (Sized_relobj_file::do_discard_decompressed_sections): New function.
722
723 2012-02-16 Cary Coutant <ccoutant@google.com>
724
725 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
726 * testsuite/Makefile.in: Regenerate.
727
728 2012-02-14 Cary Coutant <ccoutant@google.com>
729
730 * options.cc (General_options::finalize): Disallow -pie and -static.
731
732 2012-02-03 Doug Kwan <dougkwan@google.com>
733
734 * arm.cc (Arm_relocate_functions::abs8,
735 Arm_relocate_functions::abs16): Use
736 Bits::has_signed_unsigned_overflow32.
737 (Arm_relocate_functions::thm_abs8): Correct range of
738 overflow check.
739 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
740 in assertions.
741
742 2012-02-02 Doug Kwan <dougkwan@google.com>
743
744 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
745 position independent outputs, not just shared objects.
746
747 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
748
749 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
750 * configure: Regenerated.
751
752 2012-01-27 Ian Lance Taylor <iant@google.com>
753
754 * reloc.h (Bits): New class with static functions, copied from
755 namespace utils in arm.cc.
756 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
757 instead.
758
759 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
760
761 * incremental.cc (write_info_blocks): Correct relocation offset.
762
763 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
764
765 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
766 (Relocate::tls_gd_to_le): Likewise.
767
768 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
769
770 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
771
772 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
773
774 * configure.ac: Check if -mcmodel=medium works.
775 * configure: Regenerated.
776
777 2012-01-24 Cary Coutant <ccoutant@google.com>
778
779 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
780 definition and ...
781 (read_unsigned_LEB_128_x): ... this new function.
782 (read_signed_LEB_128): Replaced with inline definition and ...
783 (read_signed_LEB_128_x): ... this new function.
784 * int_encoding.h (read_unsigned_LEB_128_x): New function.
785 (read_unsigned_LEB_128): Add inline definition.
786 (read_signed_LEB_128_x): New function.
787 (read_signed_LEB_128): Add inline definition.
788 * testsuite/Makefile.am (leb128_unittest): New unit test.
789 * testsuite/Makefile.in: Regenerate.
790 * testsuite/leb128_unittest.cc: New unit test.
791
792 2012-01-23 Ian Lance Taylor <iant@google.com>
793
794 PR gold/13617
795 * i386.cc (Target_i386::do_code_fill): When using a jmp
796 instruction, pad with nop instructions.
797 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
798
799 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
800
801 * x86_64.cc (gc_process_relocs): Add typename on types used in
802 template.
803 (scan_relocs): Likewise.
804 (relocate_section): Likewise.
805 (apply_relocation): Likewise.
806
807 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
808
809 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
810 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
811 under x32.
812
813 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
814
815 * x86_64.cc: Initial support for x32.
816
817 2012-01-03 Cary Coutant <ccoutant@google.com>
818
819 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
820 Use abstract base class for GOT.
821 * gold/output.h (class Output_data_got_base): New abstract base class.
822 (class Output_data_got): Derive from new base class, adjust ctors.
823 (Output_data_got::reserve_slot): Make virtual; rename to
824 do_reserve_slot; Adjust callers.
825 * gold/target.h (Sized_target::init_got_plt_for_update): Return
826 pointer to abstract base class.
827 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
828
829 2011-12-18 Ian Lance Taylor <iant@google.com>
830
831 * object.h (Relobj::local_symbol_value): New function.
832 (Relobj::local_plt_offset): New function.
833 (Relobj::local_has_got_offset): New function.
834 (Relobj::local_got_offset): New function.
835 (Relobj::set_local_got_offset): New function.
836 (Relobj::do_local_symbol_value): New pure virtual function.
837 (Relobj::do_local_plt_offset): Likewise.
838 (Relobj::do_local_has_got_offset): Likewise.
839 (Relobj::do_local_got_offset): Likewise.
840 (Relobj::do_set_local_got_offset): Likewise.
841 (Sized_relobj::do_local_has_got_offset): Rename from
842 local_has_got_offset.
843 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
844 (Sized_relobj::do_set_local_got_offset): Rename from
845 set_local_got_offset.
846 (Sized_relobj_file::do_local_plt_offset): Rename from
847 local_plt_offset.
848 (Sized_relobj_file::do_local_symbol_value): New function.
849 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
850 local_plt_offset.
851 * output.cc (Output_data_got::Got_entry::write): Change object to
852 Relobj. Use local_symbol_value.
853 (Output_data_got::add_global_with_rel): Change rel_dyn to
854 Output_data_reloc_generic*. Use add_global_generic.
855 (Output_data_got::add_global_with_rela): Remove. Change all
856 callers to use add_global_with_rel.
857 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
858 Output_data_reloc_generic*. Use add_global_generic.
859 (Output_data_got::add_global_pair_with_rela): Remove. Change all
860 callers to use add_global_pair_with_rel.
861 (Output_data_got::add_local): Change object to Relobj*.
862 (Output_data_got::add_local_plt): Likewise.
863 (Output_data_got::add_local_with_rel): Change object to Relobj*,
864 change rel_dyn to Output_data_reloc_generic*. Use
865 add_local_generic.
866 (Output_data_got::add_local_with_rela): Remove. Change all
867 callers to use all_local_with_rel.
868 (Output_data_got::add_local_pair_with_rel): Change object to
869 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
870 add_output_section_generic.
871 (Output_data_got::add_local_pair_with_rela): Remove. Change all
872 callers to use add_local_pair_with_rel.
873 (Output_data_got::reserve_local): Change object to Relobj*.
874 * output.h: (class Output_data_reloc_generic): Add pure virtual
875 declarations for add_global_generic, add_local_generic,
876 add_output_section_generic.
877 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
878 functions for Output_data_reloc_generic. Update declarations for
879 changes listed in output.cc.
880 (class Output_data_got): Change template parameter to got_size.
881 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
882 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
883 function.
884 (Sized_relobj_incr::do_local_plt_offset): New function.
885 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
886 add_global_generic.
887
888 2011-12-17 Cary Coutant <ccoutant@google.com>
889
890 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
891 * resolve.cc (Symbol_table::resolve): Likewise.
892 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
893 arrays.
894 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
895
896 2011-12-16 Ian Lance Taylor <iant@google.com>
897
898 * output.h (Output_data_reloc_generic::add): Only call
899 add_dynamic_reloc if this is a dynamic reloc section.
900
901 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
902
903 PR gold/13505
904 * target-reloc.h (apply_relocation): Replace <64, false> with
905 <size, big_endian>.
906
907 2011-11-25 Nick Clifton <nickc@redhat.com>
908
909 * po/it.po: New Italian translation.
910
911 2011-11-17 Sterling Augustine <saugustine@google.com>
912
913 * script.cc (script_include_directive): Implement.
914 (read_script_file): New local variables name and search_path. Update
915 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
916 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
917 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
918
919 2011-11-11 Sterling Augustine <saugustine@google.com>
920
921 * yyscript.y (section_cmd): Add support for INCLUDE directive.
922 (file_or_sections_cmd): Likewise.
923
924 2011-11-11 Doug Kwan <dougkwan@google.com>
925
926 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
927 if --just-symbols is given.
928
929 2011-11-10 Doug Kwan <dougkwan@google.com>
930
931 PR gold/13362
932 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
933 when processing data relocs.
934 * reloc.h (Relocate_functions::rel_unaligned): New method.
935 (Relocate_functions::pcrel_unaligned): Ditto.
936 (Relocate_functions::rel32_unaligned): Ditto.
937 (Relocate_functions::pcrel32_unaligned): Ditto.
938
939 2011-11-09 Doug Kwan <dougkwan@google.com>
940
941 PR gold/13362
942 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
943 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
944 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
945 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
946 (Relocate_functions::rel_unaligned): New.
947 (Relocate_functions::rel32_unaligned): New.
948 * target-reloc.h (relocate_for_relocatable): Add code to handle
949 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
950 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
951 arm_unaligned_reloc_r): New targets.
952 * testsuite/Makefile.in: Regenerate.
953 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
954 linking.
955
956 2011-11-02 Ian Lance Taylor <iant@google.com>
957
958 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
959 NATIVE_LINKER.
960 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
961 * options.cc (General_options::finalize): Use library search path
962 from configure script if specified. If not native and no sysroot,
963 only search TOOLLIBDIR.
964 * options.h (Search_directory::Search_directory): Change name to
965 const std::string&.
966 (General_options::add_to_library_path_with_sysroot): Change arg to
967 const std::string&.
968 * configure, Makefile.in, config.in: Rebuild.
969
970 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
971
972 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
973 we are working around the ARM1176 Erratum.
974 * options.h (General_options::fix_arm1176): Add option.
975 * testsuite/Makefile.am: Add testcases, and keep current ones
976 working.
977 * testsuite/Makefile.in: Regenerate.
978 * testsuite/arm_fix_1176.s: New file.
979 * testsuite/arm_fix_1176.sh: Likewise.
980
981 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
982
983 * arm.cc (Target_arm::Target_arm): Remove initialisation of
984 may_use_blx_.
985 (Target_arm::may_use_blx): Remove method.
986 (Target_arm::set_may_use_blx): Likewise.
987 (Target_arm::may_use_v4t_interworking): New method.
988 (Target_arm::may_use_v5t_interworking): Likewise.
989 (Target_arm::may_use_blx_): Remove member variable.
990 (Arm_relocate_functions::arm_branch_common): Check for v5T
991 interworking.
992 (Arm_relocate_functions::thumb_branch_common): Likewise.
993 (Reloc_stub::stub_type_for_reloc): Likewise.
994 (Target_arm::do_finalize_sections): Correct interworking checks.
995 * testsuite/Makefile.am: Add new tests.
996 * testsuite/Makefile.in: Regenerate.
997 * testsuite/arm_farcall_arm_arm.s: New test.
998 * testsuite/arm_farcall_arm_arm.sh: Likewise.
999 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1000 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1001 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1002 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1003 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1004 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1005
1006 2011-10-31 Cary Coutant <ccoutant@google.com>
1007
1008 PR gold/13023
1009 * expression.cc (Expression::eval_with_dot): Add
1010 is_section_dot_assignment parameter.
1011 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1012 absolute and assigning to dot within a section.
1013 * script-sections.cc
1014 (Output_section_element_assignment::set_section_addresses): Pass
1015 dot_section to set_if_absolute.
1016 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1017 as is_section_dot_assignment flag to eval_with_dot.
1018 (Output_section_element_dot_assignment::set_section_addresses):
1019 Likewise.
1020 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1021 parameter. Also set value if relative to dot_section; set the
1022 symbol's output_section.
1023 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1024 parameter. Adjust all callers.
1025 (Expression::eval_maybe_dot): Likewise.
1026 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1027 Adjust all callers.
1028 * testsuite/script_test_2.t: Test assignment of an absolute value
1029 to dot within an output section element.
1030
1031 2011-10-31 Cary Coutant <ccoutant@google.com>
1032
1033 * options.h (class General_options): Add --[no-]gnu-unique options.
1034 * symtab.cc (Symbol_table::sized_write_globals): Convert
1035 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1036
1037 2011-10-31 Cary Coutant <ccoutant@google.com>
1038
1039 PR gold/13359
1040 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1041 unnecessary assertion.
1042 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1043
1044 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1045
1046 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1047 gc_mark_symbol.
1048 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1049 gc_mark_symbol.
1050 Change to just keep the section associated with symbol.
1051 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1052 they are externally visible and --export-dynamic is turned on.
1053 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1054
1055 2011-10-19 Ian Lance Taylor <iant@google.com>
1056
1057 PR gold/13163
1058 * script-sections.cc
1059 (Output_section_element_dot_assignment::needs_output_section): New
1060 function.
1061
1062 2011-10-19 Ian Lance Taylor <iant@google.com>
1063
1064 PR gold/13204
1065 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1066 --section-start option was seen.
1067 * options.h (General_options::any_section_start): New function.
1068
1069 2011-10-18 David S. Miller <davem@davemloft.net>
1070
1071 PR binutils/13301
1072 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1073 member to track relocation locations that have moved during TLS
1074 reloc optimizations.
1075 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1076 (Target_sparc::Relocate::relocate): Adjust view down by 4
1077 bytes if it matches reloc_adjust_addr_.
1078 (Target_sparc::Relocate::relocate_tls): Always move the
1079 __tls_get_addr call delay slot instruction forward 4 bytes when
1080 performing relaxation.
1081
1082 2011-10-18 Cary Coutant <ccoutant@google.com>
1083
1084 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1085 (Output_file::map_no_anonymous): Check for non-zero
1086 return code from posix_fallocate.
1087
1088 2011-10-17 Cary Coutant <ccoutant@google.com>
1089
1090 PR gold/13245
1091 * plugin.cc (is_visible_from_outside): Check for symbols
1092 referenced from dynamic objects.
1093 * resolve.cc (Symbol_table::resolve): Don't count references
1094 from dynamic objects as references from real ELF files.
1095 * testsuite/plugin_test_2.sh: Adjust expected result.
1096
1097 2011-10-17 Cary Coutant <ccoutant@google.com>
1098
1099 * gold.cc: Include timer.h.
1100 (queue_middle_tasks): Stamp time.
1101 (queue_final_tasks): Likewise.
1102 * main.cc (main): Store timer in parameters. Print timers
1103 for each pass.
1104 * parameters.cc (Parameters::Parameters): Initialize timer_.
1105 (Parameters::set_timer): New function.
1106 (set_parameters_timer): New function.
1107 * parameters.h (Parameters::set_timer): New function.
1108 (Parameters::timer): New function.
1109 (Parameters::timer_): New data member.
1110 (set_parameters_timer): New function.
1111 * timer.cc (Timer::stamp): New function.
1112 (Timer::get_pass_time): New function.
1113 * timer.h (Timer::stamp): New function.
1114 (Timer::get_pass_time): New function.
1115 (Timer::pass_times_): New data member.
1116
1117 2011-10-17 Cary Coutant <ccoutant@google.com>
1118
1119 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1120 task for members of lib groups.
1121
1122 2011-10-17 Cary Coutant <ccoutant@google.com>
1123
1124 PR gold/13288
1125 * fileread.cc (File_read::find_view): Add assert.
1126 (File_read::make_view): Move bounds check (replace with assert)...
1127 (File_read::find_or_make_view): ... to here.
1128
1129 2011-10-12 Cary Coutant <ccoutant@google.com>
1130
1131 * output.cc (Output_file::open_base_file): Handle case where
1132 ::read returns less than requested size.
1133
1134 2011-10-10 Cary Coutant <ccoutant@google.com>
1135
1136 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1137 Initialize defined_count_.
1138 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1139 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1140 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1141 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1142 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1143 * incremental.h (Sized_relobj_incr::defined_count_): New data
1144 member.
1145 (Sized_incr_dynobj::defined_count_): New data member.
1146 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1147 Return zeroes instead of internal error.
1148
1149 2011-10-10 Cary Coutant <ccoutant@google.com>
1150
1151 PR gold/13249
1152 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1153 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1154 * output.h (class Output_reloc): Add use_plt_offset flag.
1155 (Output_reloc::type_): Adjust size of bit field.
1156 (Output_reloc::use_plt_offset_): New bit field.
1157 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1158 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1159 flag. Adjust all callers.
1160 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1161 creating RELATIVE relocations.
1162
1163 2011-10-10 Nick Clifton <nickc@redhat.com>
1164
1165 * po/es.po: Updated Spanish translation.
1166 * po/fi.po: Updated Finnish translation.
1167
1168 2011-10-03 Diego Novillo <dnovillo@google.com>
1169
1170 * options.cc (parse_uint): Fix dereference of RETVAL.
1171
1172 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1173
1174 * layout.h (section_order_map_): New member.
1175 (get_section_order_map): New member function.
1176 * output.cc (Output_section::add_input_section): Check for patterns
1177 only when --section-ordering-file is specified.
1178 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1179 output_sections have been formed.
1180 * layout.cc (Layout_Layout): Initialize section_order_map_.
1181 * plugin.cc (update_section_order): Store order in order_map. Do not
1182 update the order.
1183 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1184 * testsuite/Makefile.in: Regenerate.
1185 * testsuite/plugin_section_order.c: New file.
1186 * testsuite/plugin_final_layout.cc: New file.
1187 * testsuite/plugin_final_layout.sh: New file.
1188
1189 2011-09-29 Cary Coutant <ccoutant@google.com>
1190
1191 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1192 Check for NULL.
1193 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1194 symbols during incremental update.
1195 (Symbol_table::add_from_dynobj): Likewise.
1196
1197 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1198 Ian Lance Taylor <iant@google.com>
1199
1200 * symtab.cc (Symbol_table::define_special_symbol): Always
1201 canonicalize version string.
1202
1203 2011-09-26 Cary Coutant <ccoutant@google.com>
1204
1205 * gold.cc (queue_initial_tasks): Move option checks ...
1206 * options.cc (General_options::finalize): ... to here. Disable
1207 some options; make others fatal.
1208
1209 2011-09-26 Cary Coutant <ccoutant@google.com>
1210
1211 gcc PR lto/47247
1212 * plugin.cc (get_symbols_v2): New function.
1213 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1214 (is_referenced_from_outside): New function.
1215 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1216 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1217 (get_symbols): Pass version parameter.
1218 (get_symbols_v2): New function.
1219 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1220 parameter.
1221 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1222 (onload): Add LDPT_GET_SYMBOLS_V2.
1223 (all_symbols_read_hook): Use get_symbols_v2; check for
1224 LDPR_PREVAILING_DEF_IRONLY_EXP.
1225 * testsuite/plugin_test_3.sh: Update expected results.
1226
1227 2011-09-23 Simon Baldwin <simonb@google.com>
1228
1229 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1230 configuration options.
1231 * configure: Regenerate.
1232 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1233 * Makefile.in: Regenerate.
1234 * testsuite/Makefile.in: Regenerate.
1235
1236 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1237
1238 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1239
1240 2011-09-19 Cary Coutant <ccoutant@google.com>
1241
1242 * incremental.cc (can_incremental_update): Fix typo in comment.
1243 * incremental.h (can_incremental_update): Likewise.
1244
1245 2011-09-18 Cary Coutant <ccoutant@google.com>
1246
1247 * incremental.cc (can_incremental_update): New function.
1248 * incremental.h (can_incremental_update): New function.
1249 * layout.cc (Layout::init_fixed_output_section): Call it.
1250 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1251 * object.cc (Sized_relobj_file::do_layout): Call
1252 can_incremental_update.
1253
1254 2011-09-13 Cary Coutant <ccoutant@google.com>
1255
1256 * configure.ac: Check for glibc support for gnu_indirect_function
1257 support with static linking, setting automake conditional
1258 IFUNC_STATIC.
1259 * Makefile.in: Regenerate.
1260 * configure: Regenerate.
1261
1262 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1263 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1264 for IFUNC_STATIC.
1265 * testsuite/Makefile.in: Regenerate.
1266
1267 2011-09-13 Cary Coutant <ccoutant@google.com>
1268
1269 * incremental.cc (Sized_relobj_incr::do_layout): Call
1270 report_comdat_group for kept comdat sections.
1271 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1272 * testsuite/Makefile.in: Regenerate.
1273 * testsuite/incr_comdat_test_1.cc: New source file.
1274 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1275 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1276 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1277
1278 2011-09-13 Ian Lance Taylor <iant@google.com>
1279
1280 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1281 variable external_symbols_offset.
1282
1283 2011-09-12 Ian Lance Taylor <iant@google.com>
1284
1285 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1286 triggered if object has no symbols.
1287
1288 2011-09-09 David S. Miller <davem@davemloft.net>
1289
1290 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1291 (Output_fill_debug_line::do_write): Likewise.
1292
1293 2011-08-29 Cary Coutant <ccoutant@google.com>
1294
1295 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1296 casts to match formatting specs.
1297 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1298
1299 2011-08-26 Cary Coutant <ccoutant@google.com>
1300
1301 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1302 remaining hole size when allocating.
1303 (Layout::make_output_section): Set fill methods for debug sections.
1304 * layout.h (Free_list::Free_list_node): Move from private to
1305 public.
1306 (Free_list::set_min_hole_size): New function.
1307 (Free_list::begin, Free_list::end): New functions.
1308 (Free_list::min_hole_): New data member.
1309 * output.cc: Include dwarf.h.
1310 (Output_fill_debug_info::do_minimum_hole_size): New function.
1311 (Output_fill_debug_info::do_write): New function.
1312 (Output_fill_debug_line::do_minimum_hole_size): New function.
1313 (Output_fill_debug_line::do_write): New function.
1314 (Output_section::Output_section): Initialize new data member.
1315 (Output_section::set_final_data_size): Ensure patch space is larger
1316 than minimum hole size.
1317 (Output_section::do_write): Fill holes in debug sections.
1318 * output.h (Output_fill): New class.
1319 (Output_fill_debug_info): New class.
1320 (Output_fill_debug_line): New class.
1321 (Output_section::set_free_space_fill): New function.
1322 (Output_section::free_space_fill_): New data member.
1323 * testsuite/Makefile.am (incremental_test_3): Add
1324 --incremental-patch option.
1325 (incremental_test_4): Likewise.
1326 (incremental_test_5): Likewise.
1327 (incremental_test_6): Likewise.
1328 (incremental_copy_test): Likewise.
1329 (incremental_common_test_1): Likewise.
1330 * testsuite/Makefile.in: Regenerate.
1331
1332 2011-08-26 Nick Clifton <nickc@redhat.com>
1333
1334 * po/es.po: Updated Spanish translation.
1335
1336 2011-08-01 Cary Coutant <ccoutant@google.com>
1337
1338 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1339 * gold/testsuite/Makefile.in: Regenerate.
1340 * gold/testsuite/justsyms_exec.c: New source file.
1341 * gold/testsuite/justsyms_lib.c: New source file.
1342
1343 2011-08-01 Cary Coutant <ccoutant@google.com>
1344
1345 * layout.cc (Layout::set_segment_offsets): Don't realign text
1346 segment if -Ttext was specified.
1347 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1348 file type.
1349 * object.h (Sized_relobj_file::e_type): New function.
1350 (Sized_relobj_file::e_type_): New data member.
1351 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1352 base address for ET_EXEC files.
1353 * target.cc (Target::do_make_elf_object_implementation): Allow
1354 ET_EXEC files with --just-symbols option.
1355
1356 2011-07-28 Cary Coutant <ccoutant@google.com>
1357
1358 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1359 Add thread_number parameter.
1360 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1361 * workqueue-threads.cc
1362 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1363 current thread if its thread number is greater than desired thread
1364 count.
1365 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1366 Add thread_number parameter.
1367 (Workqueue::should_cancel_thread): Likewise.
1368 (Workqueue::find_runnable_or_wait): Pass thread_number to
1369 should_cancel_thread.
1370 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1371 parameter.
1372
1373 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1374
1375 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1376 only after checking if it cannot be forced local.
1377 * symtab.h (is_externally_visible): Check if the symbol is not forced
1378 local.
1379
1380 2011-07-15 Ian Lance Taylor <iant@google.com>
1381
1382 * options.h (class General_options): Add --print-output-format.
1383 Move -EL next to -EB, for better --help output.
1384 * target-select.cc: Include <cstdio>, "options.h", and
1385 "parameters.h".
1386 (Target_selector::do_target_bfd_name): New function.
1387 (print_output_format): New function.
1388 * target-select.h (class Target_selector): Update declarations.
1389 (Target_selector::target_bfd_name): New function.
1390 (print_output_format): Declare.
1391 * main.cc: Include "target-select.h".
1392 (main): Handle --print-output-format.
1393 * gold.cc: Include "target-select.h".
1394 (queue_initial_tasks): Handle --print-output-format when there are
1395 no input files.
1396 * parameters.cc (parameters_force_valid_target): Give a better
1397 error message if -EB/-EL does not match target.
1398 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1399 function.
1400
1401 2011-07-15 Ian Lance Taylor <iant@google.com>
1402
1403 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1404 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1405 (Output_data_plt_i386::do_write): Write address of .dynamic
1406 section to first entry in .got.plt section.
1407 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1408 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1409 Initialize layout_.
1410 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1411 section to first entry in .got.plt section.
1412 * layout.h (Layout::dynamic_section): New function.
1413
1414 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1415
1416 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1417 to claim_file call.
1418 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1419 input_section_position_, and input_section_glob_.
1420 (read_layout_from_file): Call function section_ordering_specified.
1421 * layout.h (is_section_ordering_specified): New function.
1422 (section_ordering_specified): New function.
1423 (section_ordering_specified_): New boolean member.
1424 * main.cc(main): Call load_plugins after layout object is defined.
1425 * output.cc (Output_section::add_input_section): Use
1426 function section_ordering_specified to check if section ordering is
1427 needed.
1428 * output.cc (Output_section::add_relaxed_input_section): Use
1429 function section_ordering_specified to check if section ordering is
1430 needed.
1431 (Output_section::update_section_layout): New function.
1432 (Output_section::sort_attached_input_sections): Check if input section
1433 must be reordered.
1434 * output.h (Output_section::update_section_layout): New function.
1435 * plugin.cc (get_section_count): New function.
1436 (get_section_type): New function.
1437 (get_section_name): New function.
1438 (get_section_contents): New function.
1439 (update_section_order): New function.
1440 (allow_section_ordering): New function.
1441 (Plugin::load): Add the new interfaces to the transfer vector.
1442 (Plugin_manager::load_plugins): New parameter.
1443 (Plugin_manager::all_symbols_read): New parameter.
1444 (Plugin_manager::claim_file): New parameter. Save the elf object for
1445 unclaimed objects.
1446 (Plugin_manager::get_elf_object): New function.
1447 (Plugin_manager::get_view): Change to directly use the bool to check
1448 if get_view is called from claim_file_hook.
1449 * plugin.h (input_objects): New function
1450 (Plugin__manager::load_plugins): New parameter.
1451 (Plugin_manager::claim_file): New parameter.
1452 (Plugin_manager::get_elf_object): New function.
1453 (Plugin_manager::in_claim_file_handler): New function.
1454 (Plugin_manager::in_claim_file_handler_): New member.
1455 (layout): New function.
1456 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1457 handler with an extra parameter. Make the elf object before calling
1458 claim_file handler.
1459 * testsuite/plugin_test.c (get_section_count): New function pointer.
1460 (get_section_type): New function pointer.
1461 (get_section_name): New function pointer.
1462 (get_section_contents): New function pointer.
1463 (update_section_order): New function pointer.
1464 (allow_section_ordering): New function pointer.
1465 (onload): Check if the new interfaces exist.
1466
1467 2011-07-13 Ian Lance Taylor <iant@google.com>
1468
1469 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1470 relro section.
1471 * x86_64.cc (Target_x86_64::got_section): Likewise.
1472 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1473 (relro_now_test_SOURCES): New variable.
1474 (relro_now_test_DEPENDENCIES): New variable.
1475 (relro_now_test_LDFLAGS): New variable.
1476 (relro_now_test_LDADD): New variable.
1477 (relro_now_test.so): New target.
1478 * testsuite/Makefile.in: Rebuild.
1479
1480 2011-07-12 Ian Lance Taylor <iant@google.com>
1481
1482 PR gold/12980
1483 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1484 GLOB_DAT relocation rather than a RELATIVE relocation for a
1485 protected symbol when creating a shared library.
1486 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1487 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1488 * testsuite/protected_main_1.cc (main): Test that protected
1489 function has same address.
1490
1491 2011-07-11 Ian Lance Taylor <iant@google.com>
1492
1493 PR gold/12979
1494 * options.h (class General_options): Add -Bgroup.
1495 * options.cc (General_options::finalize): If -Bgroup is set,
1496 default to --unresolved-symbols=report-all.
1497 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1498 * target-reloc.h (issue_undefined_symbol_error): Handle
1499 --unresolved-symbols=report-all.
1500
1501 2011-07-08 Ian Lance Taylor <iant@google.com>
1502
1503 PR gold/11985
1504 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1505 if linker script discards key sections.
1506 (Layout::create_dynamic_symtab): Likewise.
1507 (Layout::assign_local_dynsym_offsets): Likewise.
1508 (Layout::sized_create_version_sections): Likewise.
1509 (Layout::create_interp): Likewise.
1510 (Layout::finish_dynamic_section): Likewise.
1511 (Layout::set_dynamic_symbol_size): Likewise.
1512
1513 2011-07-08 Ian Lance Taylor <iant@google.com>
1514
1515 PR gold/12386
1516 * options.h (class General_options): Add --unresolved-symbols.
1517 * target-reloc.h (issue_undefined_symbol_error): Check
1518 --unresolved-symbols. Add comments.
1519
1520 2011-07-08 Ian Lance Taylor <iant@google.com>
1521
1522 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1523 expression more complex.
1524
1525 2011-07-08 Ian Lance Taylor <iant@google.com>
1526
1527 PR gold/11317
1528 * target-reloc.h (issue_undefined_symbol_error): New inline
1529 function, broken out of relocate_section.
1530 (relocate_section): Call issue_undefined_symbol_error.
1531 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1532 there is no TLS segment if we are about to issue an undefined
1533 symbol error.
1534 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1535
1536 2011-07-08 Ian Lance Taylor <iant@google.com>
1537
1538 PR gold/12279
1539 * resolve.cc (Symbol_table::should_override): Add fromtype
1540 parameter. Change all callers. Give error when linking together
1541 TLS and non-TLS symbol.
1542 (Symbol_table::should_override_with_special): Add fromtype
1543 parameter. Change all callers.
1544 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1545 there is no TLS segment if we have reported some errors.
1546 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1547
1548 2011-07-08 Ian Lance Taylor <iant@google.com>
1549
1550 PR gold/12372
1551 * target.h (Target::plt_address_for_global): New function.
1552 (Target::plt_address_for_local): New function.
1553 (Target::plt_section_for_global): Remove.
1554 (Target::plt_section_for_local): Remove.
1555 (Target::do_plt_address_for_global): New virtual function.
1556 (Target::do_plt_address_for_local): New virtual function.
1557 (Target::do_plt_section_for_global): Remove.
1558 (Target::do_plt_section_for_local): Remove.
1559 (Target::register_global_plt_entry): Add Symbol_table and Layout
1560 parameters.
1561 * output.cc (Output_data_got::Got_entry::write): Use
1562 plt_address_for_global and plt_address_for_local.
1563 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1564 address of output section.
1565 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1566 got_irelative_, and irelative_count_ fields. Update
1567 declarations.
1568 (Output_data_plt_i386::has_irelative_section): New function.
1569 (Output_data_plt_i386::entry_count): Add irelative_count_.
1570 (Output_data_plt_i386::set_final_data_size): Likewise.
1571 (class Target_i386): Add got_irelative_ and rel_irelative_
1572 fields. Update declarations.
1573 (Target_i386::Target_i386): Initialize new fields.
1574 (Target_i386::do_plt_address_for_global): New function replacing
1575 do_plt_section_for_global.
1576 (Target_i386::do_plt_address_for_local): New function replacing
1577 do_plt_section_for_local.
1578 (Target_i386::got_section): Create got_irelative_.
1579 (Target_i386::rel_irelative_section): New function.
1580 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1581 fields. Don't define __rel_iplt_{start,end}.
1582 (Output_data_plt_i386::add_entry): Add symtab and layout
1583 parameters. Change all callers. Use different PLT and GOT for
1584 IFUNC symbols.
1585 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1586 layout parameters. Change all callers. Use different PLT and
1587 GOT.
1588 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1589 (Output_data_plt_i386::rel_irelative): New function.
1590 (Output_data_plt_i386::address_for_global): New function.
1591 (Output_data_plt_i386::address_for_local): New function.
1592 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1593 IRELATIVE GOT when changing IFUNC GOT entries.
1594 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1595 reloc.
1596 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1597 if we didn't create an IRELATIVE GOT.
1598 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1599 plt_address_for_local.
1600 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1601 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1602 got_irelative_, and irelative_count_ fields. Update
1603 declarations.
1604 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1605 Initialize new fields. Remove symtab parameter. Change all
1606 callers.
1607 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1608 irelative_count_.
1609 (Output_data_plt_x86_64::has_irelative_section): New function.
1610 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1611 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1612 fields. Update declarations.
1613 (Target_x86_64::Target_x86_64): Initialize new fields.
1614 (Target_x86_64::do_plt_address_for_global): New function replacing
1615 do_plt_section_for_global.
1616 (Target_x86_64::do_plt_address_for_local): New function replacing
1617 do_plt_section_for_local.
1618 (Target_x86_64::got_section): Create got_irelative_.
1619 (Target_x86_64::rela_irelative_section): New function.
1620 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1621 all callers. Don't create __rel_iplt_{start,end}.
1622 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1623 parameters. Change all callers. Use different PLT and GOT for
1624 IFUNC symbols.
1625 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1626 layout parameters. Change all callers. Use different PLT and
1627 GOT.
1628 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1629 parameters. Change all callers. Use different PLT and GOT for
1630 IFUNC symbols.
1631 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1632 (Output_data_plt_x86_64::rela_irelative): New function.
1633 (Output_data_plt_x86_64::address_for_global): New function.
1634 (Output_data_plt_x86_64::address_for_local): New function.
1635 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1636 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1637 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1638 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1639 parameters.
1640 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1641 reloc.
1642 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1643 symbols if we didn't create an IRELATIVE GOT.
1644 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1645 plt_address_for_local.
1646 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1647 * testsuite/ifuncvar1.c: New test file.
1648 * testsuite/ifuncvar2.c: New test file.
1649 * testsuite/ifuncvar3.c: New test file.
1650 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1651 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1652 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1653 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1654 * testsuite/Makefile.in: Rebuild.
1655
1656 2011-07-07 Cary Coutant <ccoutant@google.com>
1657
1658 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1659 (two_file_test_1_ndebug.o): Likewise.
1660 (two_file_test_1b_ndebug.o): Likewise.
1661 (two_file_test_2_ndebug.o): Likewise.
1662 (two_file_test_main_ndebug.o): Likewise.
1663 (incremental_test_2): Link with no-debug versions.
1664
1665 2011-07-06 Cary Coutant <ccoutant@google.com>
1666
1667 * gold/incremental.cc
1668 (Output_section_incremental_inputs::write_info_blocks): Check for
1669 hidden and internal symbols.
1670
1671 2011-07-06 Cary Coutant <ccoutant@google.com>
1672
1673 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1674 Check disposition for startup file.
1675 (Incremental_inputs::report_command_line): Ignore
1676 --incremental-startup-unchanged option.
1677 * options.cc (General_options::parse_incremental_startup_unchanged):
1678 New function.
1679 (General_options::General_options): Initialize new data member.
1680 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1681 (General_options): Add --incremental-startup-unchanged option.
1682 (General_options::incremental_startup_disposition): New function.
1683 (General_options::incremental_startup_disposition_): New data member.
1684
1685 2011-07-06 Cary Coutant <ccoutant@google.com>
1686
1687 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1688 input file index to Script_info ctor.
1689 (Sized_incremental_binary::do_file_has_changed): Find the
1690 command-line argument for files named in scripts.
1691 * incremental.h (Script_info::Script_info): New ctor
1692 with input file index.
1693 (Script_info::input_file_index): New function.
1694 (Script_info::input_file_index_): New data member.
1695 (Incremental_binary::get_library): Add const.
1696 (Incremental_binary::get_script_info): Add const.
1697 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1698 * testsuite/Makefile.am (incremental_test_5): New test case.
1699 (incremental_test_6): New test case.
1700 * testsuite/Makefile.in: Regenerate.
1701
1702 2011-07-06 Cary Coutant <ccoutant@google.com>
1703
1704 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1705 debug output when command lines differ.
1706
1707 2011-07-06 Cary Coutant <ccoutant@google.com>
1708
1709 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1710 --incremental-patch option.
1711 * layout.cc (Free_list::allocate): Extend allocation beyond original
1712 end if enabled.
1713 (Layout::make_output_section): Mark sections that should get
1714 patch space.
1715 * options.cc (parse_percent): New function.
1716 * options.h (parse_percent): New function.
1717 (DEFINE_percent): New macro.
1718 (General_options): Add --incremental-patch option.
1719 * output.cc (Output_section::Output_section): Initialize new data
1720 members.
1721 (Output_section::add_input_section): Print section name when out
1722 of patch space.
1723 (Output_section::add_output_section_data): Likewise.
1724 (Output_section::set_final_data_size): Add patch space when
1725 doing --incremental-full.
1726 (Output_section::do_reset_address_and_file_offset): Remove patch
1727 space.
1728 (Output_segment::set_section_list_addresses): Print debug output
1729 only if --incremental-update.
1730 * output.h (Output_section::set_is_patch_space_allowed): New function.
1731 (Output_section::is_patch_space_allowed_): New data member.
1732 (Output_section::patch_space_): New data member.
1733 * parameters.cc (Parameters::incremental_full): New function.
1734 * parameters.h (Parameters::incremental_full): New function
1735 * testsuite/Makefile.am (incremental_test_2): Add test for
1736 --incremental-patch option.
1737 * testsuite/Makefile.in: Regenerate.
1738 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1739 (t18): Remove function body.
1740
1741 2011-07-05 Doug Kwan <dougkwan@google.com>
1742
1743 PR gold/12771
1744 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1745 Arm_Address type for relocation result.
1746 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1747 overflow check.
1748 (Arm_relocate_functions::abs32): Use unaligned access.
1749 (Arm_relocate_functions::rel32): Ditto.
1750 (Arm_relocate_functions::prel31): Ditto.
1751 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1752 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1753 static data relocations.
1754 * testsuite/Makefile.in: Regnerate.
1755 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1756
1757 2011-07-05 Ian Lance Taylor <iant@google.com>
1758
1759 PR gold/12392
1760 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1761 symbols if necessary.
1762 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1763
1764 2011-07-05 Ian Lance Taylor <iant@google.com>
1765
1766 PR gold/12952
1767 * resolve.cc (Symbol::override_base_with_special): Simply override
1768 version with special symbol version, ignoring previous version.
1769
1770 2011-07-05 Ian Lance Taylor <iant@google.com>
1771
1772 * object.cc (Sized_relobj_file::include_section_group): Add
1773 information to comment about signature location.
1774
1775 2011-07-02 Ian Lance Taylor <iant@google.com>
1776
1777 PR gold/12957
1778 * options.h (class General_options): Add -f and -F.
1779 * options.cc (General_options::finalize): Fatal error if -f/-F
1780 are used without -shared.
1781 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1782
1783 2011-07-02 Ian Lance Taylor <iant@google.com>
1784
1785 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1786
1787 2011-07-01 Ian Lance Taylor <iant@google.com>
1788
1789 PR gold/12525
1790 PR gold/12952
1791 * resolve.cc (Symbol::override_base_with_special): Don't override
1792 the version if the overriding symbol has a different name.
1793 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1794 all callers. If we give an error about an undefined version,
1795 define the base version if necessary.
1796 * dynobj.h (class Versions): Update declaration.
1797 * testsuite/weak_alias_test_5.cc: New file.
1798 * testsuite/weak_alias_test.script: New file.
1799 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1800 and versioned_alias have the right value, and call t2.
1801 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1802 weak_alias_test_5.so.
1803 (weak_alias_test_LDADD): Likewise.
1804 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1805 * testsuite/Makefile.in: Rebuild.
1806
1807 2011-07-01 Ian Lance Taylor <iant@google.com>
1808
1809 PR gold/12525
1810 * options.h (class General_options): Support -z notext.
1811 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1812 -Wl,-z,notext.
1813 (two_file_shared_nonpic.so): Likewise.
1814 (two_file_shared_mixed.so): Likewise.
1815 (two_file_shared_mixed_1.so): Likewise.
1816 (weak_undef_lib_nonpic.so): Likewise.
1817 (alt/weak_undef_lib_nonpic.so): Likewise.
1818 (tls_test_shared_nonpic.so): Likewise.
1819 * testsuite/Makefile.in: Rebuild.
1820
1821 2011-07-01 Ian Lance Taylor <iant@google.com>
1822
1823 PR gold/12525
1824 * configure.ac: Test whether static linking works, setting
1825 the automake conditional HAVE_STATIC.
1826 * testsuite/Makefile.am: Disable tests using -static if
1827 HAVE_STATIC is not true.
1828 * configure, testsuite/Makefile.in: Rebuild.
1829
1830 2011-07-01 Ian Lance Taylor <iant@google.com>
1831
1832 PR gold/12525
1833 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1834 Assert if we see DW_EH_PE_indirect.
1835 * target.h (Target::ehframe_datarel_base): New function.
1836 (Target::do_ehframe_datarel_base): New target function.
1837 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1838 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1839 function.
1840
1841 2011-07-01 Ian Lance Taylor <iant@google.com>
1842
1843 PR gold/12571
1844 * options.h (class General_options): Add
1845 --ld-generated-unwind-info.
1846 * ehframe.cc (Fde::write): Add address parameter. Change all
1847 callers. If associated with PLT, fill in address and size.
1848 (Cie::set_output_offset): Only add merge mapping if there is an
1849 object.
1850 (Cie::write): Add address parameter. Change all callers.
1851 (Eh_frame::add_ehframe_for_plt): New function.
1852 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1853 input_offset_ fields into union u_, with new plt field.
1854 (Fde::Fde): Adjust for new union field.
1855 (Fde::Fde) [Output_data version]: New constructor.
1856 (Fde::add_mapping): Only add merge mapping if there is an object.
1857 (class Cie): Update declarations.
1858 (class Eh_frame): Declare add_ehframe_for_plt.
1859 * layout.cc (Layout::layout_eh_frame): Break out code into
1860 make_eh_frame_section, and call it.
1861 (Layout::make_eh_frame_section): New function.
1862 (Layout::add_eh_frame_for_plt): New function.
1863 * layout.h (class Layout): Update declarations.
1864 * merge.cc (Merge_map::add_mapping): Add assertion.
1865 * i386.cc: Include "dwarf.h".
1866 (class Output_data_plt_i386): Make first_plt_entry,
1867 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1868 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1869 and plt_eh_frame_fde.
1870 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1871 boundary. Call add_eh_frame_for_plt if appropriate.
1872 * x86_64.cc: Include "dwarf.h".
1873 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1874 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1875 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1876 and plt_eh_frame_fde.
1877 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1878 appropriate.
1879
1880 2011-06-29 Ian Lance Taylor <iant@google.com>
1881
1882 PR gold/12629
1883 * object.cc (Sized_relobj_file::layout_section): Change shdr
1884 parameter to be const.
1885 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1886 out of do_layout.
1887 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1888 appropriate. Call layout_eh_frame_section.
1889 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1890 sections.
1891 * object.h (class Sized_relobj_file): Update declarations.
1892
1893 2011-06-29 Ian Lance Taylor <iant@google.com>
1894
1895 PR gold/12652
1896 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1897 modifier.
1898 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1899
1900 2011-06-29 Ian Lance Taylor <iant@google.com>
1901
1902 PR gold/12675
1903 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1904 SHT_X86_64_UNWIND.
1905 * layout.cc (Layout::layout_eh_frame): Likewise.
1906
1907 2011-06-29 Ian Lance Taylor <iant@google.com>
1908
1909 PR gold/12695
1910 * layout.cc (Layout::symtab_section_shndx): New function.
1911 * layout.h (class Layout): Declare symtab_section_shndx.
1912 * output.cc (Output_section::write_header): Call it.
1913
1914 2011-06-29 Ian Lance Taylor <iant@google.com>
1915
1916 PR gold/12818
1917 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1918 symbols which are not used in a relocation.
1919
1920 2011-06-28 Ian Lance Taylor <iant@google.com>
1921
1922 PR gold/12898
1923 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1924 script create indistinguishable segments.
1925 (Layout::set_segment_offsets): Use stable_sort when sorting
1926 segments. Pass this to Compare_segments constructor.
1927 * layout.h (class Layout): Make segment_precedes non-static.
1928 (class Compare_segments): Change from struct to class. Add
1929 layout_ field. Add constructor.
1930 * script-sections.cc
1931 (Script_sections::attach_sections_using_phdrs_clause): Rename
1932 local orphan to is_orphan. Don't report failure to put empty
1933 section in segment. On attachment failure, report name of
1934 section, and attach to first PT_LOAD segment.
1935
1936 2011-06-28 Ian Lance Taylor <iant@google.com>
1937
1938 PR gold/12934
1939 * target-select.cc (Target_selector::Target_selector): Add
1940 emulation parameter. Change all callers.
1941 (select_target_by_bfd_name): Rename from select_target_by_name.
1942 Change all callers.
1943 (select_target_by_emulation): New function.
1944 (supported_emulation_names): New function.
1945 * target-select.h (class Target_selector): Add emulation_ field.
1946 Update declarations.
1947 (Target_selector::recognize_by_bfd_name): Rename from
1948 recognize_by_name. Change all callers.
1949 (Target_selector::supported_bfd_names): Rename from
1950 supported_names. Change all callers.
1951 (Target_selector::recognize_by_emulation): New function.
1952 (Target_selector::supported_emulations): New function.
1953 (Target_selector::emulation): New function.
1954 (Target_selector::do_recognize_by_bfd_name): Rename from
1955 do_recognize_by_name. Change all callers.
1956 (Target_selector::do_supported_bfd_names): Rename from
1957 do_supported_names. Change all callers.
1958 (Target_selector::do_recognize_by_emulation): New function.
1959 (Target_selector::do_supported_emulations): New function.
1960 (select_target_by_bfd_name): Change name in declaration.
1961 (select_target_by_emulation): Declare.
1962 (supported_emulation_names): Declare.
1963 * parameters.cc (parameters_force_valid_target): Try to find
1964 target based on emulation from -m option.
1965 * options.h (class General_options): Change doc string for -m.
1966 * options.cc (help): Print emulations.
1967 (General_options::parse_V): Likewise.
1968 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1969 Add emulation parameter. Change all callers.
1970
1971 2011-06-28 Ian Lance Taylor <iant@google.com>
1972
1973 * target.h (class Target): Add osabi_ field.
1974 (Target::osabi): New function.
1975 (Target::set_osabi): New function.
1976 (Target::Target): Initialize osabi_.
1977 (Target::do_adjust_elf_header): Make pure virtual.
1978 (Sized_target::do_adjust_elf_header): Declare.
1979 * target.cc (Sized_target::do_adjust_elf_header): New function.
1980 (class Sized_target): Instantiate all versions.
1981 * freebsd.h (class Target_freebsd): Remove.
1982 (Target_selector_freebsd::do_recognize): Call set_osabi on
1983 Target.
1984 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1985 (Target_selector_freebsd::set_osabi): Remove.
1986 * i386.cc (class Target_i386): Inherit from Sized_target rather
1987 than Target_freebsd.
1988 * x86_64.cc (class Target_x86_64): Likewise.
1989
1990 2011-06-28 Ian Lance Taylor <iant@google.com>
1991
1992 * target.h (Target::can_check_for_function_pointers): Rewrite.
1993 Make non-virtual.
1994 (Target::can_icf_inline_merge_sections): Likewise.
1995 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1996 (Target::Target_info): Add can_icf_inline_merge_sections field.
1997 (Target::do_can_check_for_function_pointers): New virtual
1998 function.
1999 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2000 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2001 from can_check_for_function_pointers, move in file.
2002 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2003 section_may_have_icf_unsafe_poineters, move in file.
2004 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2005 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2006 Rename from can_check_for_function_pointers, move in file.
2007 (Target_i386::can_icf_inline_merge_sections): Remove.
2008 (Target_i386::i386_info): Initialize
2009 can_icf_inline_merge_sections.
2010 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2011 Initialize can_icf_inline_merge_sections.
2012 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2013 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2014 Rename from can_check_for_function_pointers, move in file.
2015 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2016 (Target_x86_64::x86_64_info): Initialize
2017 can_icf_inline_merge_sections.
2018 * testsuite/testfile.cc (Target_test::test_target_info):
2019 Likewise.
2020 * icf.cc (get_section_contents): Correct formatting.
2021
2022 2011-06-27 Ian Lance Taylor <iant@google.com>
2023
2024 * symtab.cc (Symbol::versioned_name): New function.
2025 (Symbol_table::add_to_final_symtab): Use versioned_name when
2026 appropriate.
2027 (Symbol_table::sized_write_symbol): Likewise.
2028 * symtab.h (class Symbol): Declare versioned_name.
2029 * stringpool.h (class Stringpool_template): Add variant of add
2030 which takes a std::basic_string.
2031 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2032 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2033 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2034 (ver_test_12.o): New target.
2035 * testsuite/Makefile.in: Rebuild.
2036
2037 2011-06-27 Doug Kwan <dougkwan@google.com>
2038
2039 * arm.cc (Arm_relocate_functions::thm_jump8,
2040 Arm_relocate_functions::thm_jump11): Use a wider signed
2041 type to compute offset.
2042 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2043 arm_thm_jump8.
2044 * testsuite/Makefile.in: Regenerate.
2045 * testsuite/arm_branch_in_range.sh: Check test results of
2046 arm_thm_jump11 and arm_thm_jump8.
2047 * testsuite/arm_thm_jump11.s: New test source file.
2048 * testsuite/arm_thm_jump11.t: New linker script.
2049 * testsuite/arm_thm_jump8.s: New test source file.
2050 * testsuite/arm_thm_jump8.t: New linker script.
2051
2052 2011-06-24 Ian Lance Taylor <iant@google.com>
2053
2054 * layout.cc: Include "object.h".
2055 (ctors_sections_in_init_array): New static variable.
2056 (Layout::is_ctors_in_init_array): New function.
2057 (Layout::layout): Add entry to ctors_sections_in_init_array if
2058 appropriate.
2059 * layout.h (class Layout): Declare is_ctors_in_init_array.
2060 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2061 is_ctors_reverse_view is set.
2062 (Sized_relobj_file::write_sections): Add layout parameter. Change
2063 all callers. Set is_ctors_reverse_view field of View_size.
2064 (Sized_relobj_file::reverse_words): New function.
2065 * object.h (Sized_relobj_file::View_size): Add
2066 is_ctors_reverse_view field.
2067 (class Sized_relobj_file): Update declarations.
2068 * testsuite/initpri3.c: New test.
2069 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2070 initpri3b.
2071 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2072 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2073 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2074 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2075 * testsuite/Makefile.in: Rebuild.
2076
2077 2011-06-24 Cary Coutant <ccoutant@google.com>
2078
2079 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2080 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2081 (debug_msg_cdebug.err): New targets.
2082 * testsuite/Makefile.in: Regenerate.
2083 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2084 Fix checks for link with shared library.
2085
2086 2011-06-24 Doug Kwan <dougkwan@google.com>
2087
2088 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2089 skip empty text sections.
2090 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2091
2092 2011-06-22 Ian Lance Taylor <iant@google.com>
2093
2094 PR gold/12910
2095 * options.h (class General_options): Add --ctors-in-init-array.
2096 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2097 friends as SHT_PROGBITS for merging sections.
2098 (Layout::layout): Remove special handling of .init_array and
2099 friends. Don't sort if doing relocatable link. Sort for .ctors
2100 and .dtors if ctors_in_init_array.
2101 (Layout::make_output_section): Force correct section types for
2102 .init_array and friends. Don't sort if doing relocatable link,
2103 Don't sort .ctors and .dtors if ctors_in_init_array.
2104 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2105 (Layout::output_section_name): Add relobj parameter. Change all
2106 callers. Handle .ctors. and .dtors. in code rather than table.
2107 Handle .ctors and .dtors if ctors_in_init_array.
2108 (Layout::match_file_name): New function, moved from output.cc.
2109 * layout.h (class Layout): Update declarations.
2110 * output.cc: Include "layout.h".
2111 (Input_section_sort_entry::get_priority): New function.
2112 (Input_section_sort_entry::match_file_name): Just call
2113 Layout::match_file_name.
2114 (Output_section::Input_section_sort_init_fini_compare::operator()):
2115 Handle .ctors and .dtors. Sort by explicit priority rather than
2116 by name.
2117 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2118 * testsuite/initpri2.c: New test.
2119 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2120 (check_PROGRAMS): Add initpri2.
2121 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2122 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2123 * configure, testsuite/Makefile.in: Rebuild.
2124
2125 2011-06-19 Ian Lance Taylor <iant@google.com>
2126
2127 PR gold/12880
2128 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2129 .interp section to a PT_INTERP segment even if we have seen a
2130 --dynamic-linker option. Don't do it if we have seen a PHDRS
2131 clause in a linker script.
2132 (Layout::finalize): Don't create a .interp section if we've
2133 already create a PT_INTERP segment.
2134 (Layout::create_interp): Always call choose_output_section (revert
2135 patch of 2011-06-17). Don't create PT_INTERP segment.
2136 * script-sections.cc
2137 (Script_sections::create_note_and_tls_segments): Add a .interp
2138 section to a PT_INTERP segment even if we have seen a
2139 --dynamic-linker option.
2140
2141 2011-06-18 Ian Lance Taylor <iant@google.com>
2142
2143 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2144 merely because a non-PT_LOAD segment has a dynamic reloc.
2145
2146 2011-06-18 Ian Lance Taylor <iant@google.com>
2147
2148 * layout.cc (Layout::finish_dynamic_section): Don't create
2149 DT_FLAGS entry if not needed.
2150
2151 2011-06-18 Ian Lance Taylor <iant@google.com>
2152
2153 PR gold/12745
2154 * layout.cc (Layout::layout_eh_frame): Correct handling of
2155 writable .eh_frame section.
2156
2157 2011-06-17 Ian Lance Taylor <iant@google.com>
2158
2159 PR gold/12893
2160 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2161 symbol is redefined with the exact same object and value.
2162
2163 2011-06-17 Ian Lance Taylor <iant@google.com>
2164
2165 PR gold/12880
2166 * layout.h (class Layout): Add interp_segment_ field.
2167 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2168 (Layout::attach_allocated_section_to_segment): If making shared
2169 library, put .interp section in PT_INTERP segment.
2170 (Layout::finalize): Also call create_interp if -dynamic-linker
2171 option was used.
2172 (Layout::create_interp): Assert that there is no PT_INTERP
2173 segment. If not using a SECTIONS clause, use make_output_section.
2174 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2175 * script-sections.cc
2176 (Script_sections::create_note_and_tls_segments): If making shared
2177 library, put .interp section in PT_INTERP segment.
2178
2179 2011-06-17 Ian Lance Taylor <iant@google.com>
2180
2181 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2182 when making a shared library.
2183
2184 2011-06-17 Ian Lance Taylor <iant@google.com>
2185
2186 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2187 parameter. Change all callers. Don't issue warning about PC32
2188 against locally defined symbol.
2189
2190 2011-06-16 Ian Lance Taylor <iant@google.com>
2191
2192 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2193 occurs in same object.
2194
2195 2011-06-14 Alan Modra <amodra@gmail.com>
2196
2197 * po/POTFILES.in: Regenerate.
2198
2199 2011-06-09 Ian Lance Taylor <iant@google.com>
2200
2201 * script-sections.cc
2202 (Orphan_output_section::set_section_addresses): For a relocatable
2203 link set address to 0.
2204
2205 2011-06-09 Cary Coutant <ccoutant@google.com>
2206
2207 PR gold/12804
2208 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2209 used with --compress-debug-sections.
2210 * gold/object.cc (Sized_relobj_file::do_layout): Report
2211 uncompressed size of compressed input sections.
2212
2213 2011-06-08 Cary Coutant <ccoutant@google.com>
2214
2215 PR gold/12804
2216 * testsuite/two_file_test_2_v1.cc: Change initialization of
2217 v2 to keep it in .data.
2218
2219 2011-06-07 Cary Coutant <ccoutant@google.com>
2220
2221 * common.cc (Symbol_table::do_allocate_commons_list): Call
2222 gold_fallback.
2223 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2224 (Errors::fallback): New function.
2225 (gold_fallback): New function.
2226 * errors.h (Errors::fallback): New function.
2227 * gold.cc (gold_exit): Change status parameter to enum; adjust
2228 all callers.
2229 (queue_initial_tasks): Call gold_fallback.
2230 * gold.h: Include cstdlib.
2231 (Exit_status): New enum type.
2232 (gold_exit): Change status parameter to enum.
2233 (gold_fallback): New function.
2234 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2235 (Layout::create_symtab_sections): Likewise.
2236 (Layout::create_shdrs): Likewise.
2237 * main.cc (main): Adjust call to gold_exit.
2238 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2239 (Output_data_got::add_got_entry_pair): Likewise.
2240 (Output_section::add_input_section): Likewise.
2241 (Output_section::add_output_section_data): Likewise.
2242 (Output_segment::set_section_list_addresses): Likewise.
2243 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2244
2245 2011-06-07 Cary Coutant <ccoutant@google.com>
2246
2247 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2248 for incremental links.
2249 * output.cc (Output_segment::set_section_list_addresses): Remove
2250 FIXME and test for TLS or BSS.
2251
2252 2011-06-07 Cary Coutant <ccoutant@google.com>
2253
2254 * testsuite/Makefile.am: Add incremental_copy_test,
2255 incremental_common_test_1.
2256 * testsuite/Makefile.in: Regenerate.
2257 * testsuite/common_test_1_v1.c: New source file.
2258 * testsuite/common_test_1_v2.c: New source file.
2259 * testsuite/copy_test_v1.cc: New source file.
2260
2261 2011-06-07 Cary Coutant <ccoutant@google.com>
2262
2263 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2264 update, allocate common from bss section's free list.
2265 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2266 linker-defined symbols.
2267 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2268 Skip GOT and PLT entries that are no longer referenced.
2269 (Output_section_incremental_inputs::write_info_blocks): Mark
2270 linker-defined symbols.
2271 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2272 * output.cc (Output_section::allocate): New function.
2273 * output.h (Output_section::allocate): New function.
2274 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2275 linker-defined symbols.
2276 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2277 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2278 (Symbol::init_base_output_data): Likewise.
2279 (Symbol::init_base_output_segment): Likewise.
2280 (Symbol::init_base_constant): Likewise.
2281 (Sized_symbol::init_output_data): Likewise.
2282 (Sized_symbol::init_output_segment): Likewise.
2283 (Sized_symbol::init_constant): Likewise.
2284 (Symbol_table::do_define_in_output_data): Likewise.
2285 (Symbol_table::do_define_in_output_segment): Likewise.
2286 (Symbol_table::do_define_as_constant): Likewise.
2287 * symtab.h (Symbol::is_predefined): New function.
2288 (Symbol::init_base_output_data): Add is_predefined parameter.
2289 (Symbol::init_base_output_segment): Likewise.
2290 (Symbol::init_base_constant): Likewise.
2291 (Symbol::is_predefined_): New data member.
2292 (Sized_symbol::init_output_data): Add is_predefined parameter.
2293 (Sized_symbol::init_output_segment): Likewise.
2294 (Sized_symbol::init_constant): Likewise.
2295 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2296
2297 2011-06-07 Cary Coutant <ccoutant@google.com>
2298
2299 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2300 instead of emit_copy_reloc.
2301 (Copy_relocs::emit_copy_reloc): Refactor.
2302 (Copy_relocs::make_copy_reloc): New function.
2303 (Copy_relocs::add_copy_reloc): Remove.
2304 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2305 section.
2306 (Copy_relocs::make_copy_reloc): New function.
2307 (Copy_relocs::add_copy_reloc): Remove.
2308 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2309 unchanged input files.
2310 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2311 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2312 Reserve BSS space for COPY relocations.
2313 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2314 (Output_section_incremental_inputs::write_info_blocks): Record
2315 whether a symbol is copied from a shared object.
2316 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2317 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2318 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2319 (Incremental_input_entry_reader::get_output_symbol_index): Add
2320 is_copy parameter.
2321 (Incremental_binary::emit_copy_relocs): New function.
2322 (Incremental_binary::do_emit_copy_relocs): New function.
2323 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2324 new data member.
2325 (Sized_incremental_binary::add_copy_reloc): New function.
2326 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2327 (Sized_incremental_binary::Copy_reloc): New struct.
2328 (Sized_incremental_binary::Copy_relocs): New typedef.
2329 (Sized_incremental_binary::copy_relocs_): New data member.
2330 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2331 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2332 * target.h (Sized_target::emit_copy_reloc): New function.
2333 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2334
2335 2011-06-02 Cary Coutant <ccoutant@google.com>
2336
2337 PR gold/12163
2338 * gold/archive.cc (Archive::Archive): Initialize new data member.
2339 (Archive::include_all_members): Return if archive has already been
2340 included.
2341 * gold/archive.h (Archive::include_all_members_): New data member.
2342
2343 2011-06-02 Nick Clifton <nickc@redhat.com>
2344
2345 * dynobj.h: Fix spelling mistake in comment.
2346 * output.cc: Likewise.
2347
2348 2011-05-31 Doug Kwan <dougkwan@google.com>
2349 Asier Llano
2350
2351 PR gold/12826
2352 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2353 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2354 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2355 redundant arm_exidx_test.so.
2356 * testsuite/Makefile.in: Regenerate.
2357 (check_SCRIPTS): Add pr12826.sh
2358 (check_DATA): Add pr12826.stdout
2359 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2360 * testsuite/pr12826.sh: New file.
2361 * testsuite/pr12826_1.s: Ditto.
2362 * testsuite/pr12826_1.s: Ditto.
2363
2364 2011-05-30 Ian Lance Taylor <iant@google.com>
2365
2366 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2367 sections.
2368
2369 2011-05-29 Ian Lance Taylor <iant@google.com>
2370
2371 PR gold/12804
2372 * testsuite/Makefile.am: Use different file name for two_file_test
2373 temporary file for each incremental test.
2374 * testsuite/Makefile.in: Rebuild.
2375
2376 2011-05-29 Ian Lance Taylor <iant@google.com>
2377
2378 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2379 binary input file is empty.
2380
2381 2011-05-27 Ian Lance Taylor <iant@google.com>
2382
2383 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2384 (ver_test_9.so): Likewise.
2385 * testsuite/Makefile.in: Rebuild.
2386
2387 2011-05-26 Cary Coutant <ccoutant@google.com>
2388
2389 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2390 * incremental.cc (Incremental_inputs::report_input_section): Fix
2391 comment, indentation.
2392 (Incremental_inputs::report_comdat_group): New function.
2393 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2394 of data for incremental input file entry.
2395 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2396 group count, COMDAT group signatures.
2397 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2398 an unchanged input file.
2399 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2400 Initialize new data member.
2401 (Incremental_object_entry::add_comdat_group): New function.
2402 (Incremental_object_entry::get_comdat_group_count): New function.
2403 (Incremental_object_entry::get_comdat_signature_key): New function.
2404 (Incremental_object_entry::groups_): New data member.
2405 (Incremental_inputs::report_comdat_group): New function.
2406 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2407 data for incremental input file entry.
2408 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2409 (Incremental_input_entry_reader::get_input_section): Adjust size of
2410 data for incremental input file entry.
2411 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2412 (Incremental_input_entry_reader::get_comdat_group_signature): New
2413 function.
2414 * object.cc (Sized_relobj::include_section_group): Report kept
2415 COMDAT groups for incremental links.
2416
2417 2011-05-24 David Meyer <pdox@google.com>
2418
2419 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2420 with name parameter. Add found_name parameter.
2421 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2422 * dirsearch.h (class Dirsearch): Update declaration.
2423
2424 2011-05-24 Ian Lance Taylor <iant@google.com>
2425
2426 * archive.cc (Library_base::should_include_member): Pull in object
2427 from archive if it defines the entry symbol.
2428 * parameters.cc (Parameters::entry): New function.
2429 * parameters.h (class Parameters): Declare entry.
2430 * output.h (class Output_file_header): Remove entry_ field.
2431 * output.cc (Output_file_header::Output_file_header): Remove entry
2432 parameter. Change all callers.
2433 (Output_file_header::entry): Use parameters->entry.
2434 * gold.cc (queue_middle_tasks): Likewise.
2435 * plugin.cc (Plugin_hook::run): Likewise.
2436
2437 2011-05-24 Cary Coutant <ccoutant@google.com>
2438
2439 * gold.cc (queue_initial_tasks): Pass incremental base filename
2440 to Output_file::open_base_file; don't print error message.
2441 * incremental-dump.cc (main): Adjust call to
2442 Output_file::open_for_modification.
2443 * incremental-dump.cc (main): Likewise.
2444 * incremental.cc (Incremental_inputs::report_command_line):
2445 Ignore --incremental-base option when comparing command lines.
2446 Ignore parameter when given as separate argument.
2447 * options.h (class General_options): Add --incremental-base.
2448 * output.cc (Output_file::Output_file):
2449 (Output_file::open_base_file): Add base_name and writable parameters;
2450 read base file into new file; print error message here.
2451 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2452 callers.
2453 * output.h (Output_file::open_for_modification): Rename to...
2454 (Output_file::open_base_file): ...this; add base_name and
2455 writable parameters; adjust all callers.
2456 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2457 callers.
2458 * testsuite/Makefile.am (incremental_test_4): Test
2459 --incremental-base.
2460 * testsuite/Makefile.in: Regenerate.
2461
2462 2011-05-24 Cary Coutant <ccoutant@google.com>
2463
2464 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2465 incremental_test_4.
2466 * testsuite/Makefile.in: Regenerate.
2467 * testsuite/two_file_test_1_v1.cc: New test source file.
2468 * testsuite/two_file_test_1b_v1.cc: New test source file.
2469 * testsuite/two_file_test_2_v1.cc: New test source file.
2470
2471 2011-05-24 Cary Coutant <ccoutant@google.com>
2472
2473 * dynobj.h (Dynobj::do_dynobj): New function.
2474 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2475 flag and soname for shared objects.
2476 * incremental.cc (Incremental_inputs::report_object): Make
2477 either Incremental_object_entry or Incremental_dynobj_entry; add
2478 soname to string table.
2479 (Incremental_inputs::report_input_section): Add assertion.
2480 (Output_section_incremental_inputs::set_final_data_size): Adjust
2481 type of input file entry for shared libraries; adjust size of
2482 shared library info entry.
2483 (Output_section_incremental_inputs::write_input_files): Write
2484 as_needed flag for shared libraries.
2485 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2486 of input file entry for shared libraries; write soname.
2487 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2488 soname from incremental info.
2489 * incremental.h (enum Incremental_input_flags): Add
2490 INCREMENTAL_INPUT_AS_NEEDED.
2491 (Incremental_input_entry::Incremental_input_entry): Initialize new
2492 data member.
2493 (Incremental_input_entry::set_as_needed): New function.
2494 (Incremental_input_entry::as_needed): New function.
2495 (Incremental_input_entry::do_dynobj_entry): New function.
2496 (Incremental_input_entry::as_needed_): New data member.
2497 (Incremental_object_entry::Incremental_object_entry): Don't check
2498 for shared library.
2499 (Incremental_object_entry::do_type): Likewise.
2500 (class Incremental_dynobj_entry): New class.
2501 (Incremental_input_entry_reader::as_needed): New function.
2502 (Incremental_input_entry_reader::get_soname): New function.
2503 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2504 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2505 size of shared library info entry.
2506 * layout.cc (Layout::finish_dynamic_section): Don't test for
2507 incremental link when adding DT_NEEDED entries.
2508 * object.h (Object::Object): Initialize new data member.
2509 (Object::dynobj): New function.
2510 (Object::set_as_needed): New function.
2511 (Object::as_needed): New function.
2512 (Object::do_dynobj): New function.
2513 (Object::as_needed_): New data member.
2514
2515 2011-05-24 Cary Coutant <ccoutant@google.com>
2516
2517 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2518 info; adjust display of GOT entries.
2519 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2520 vector of input objects; remove file_status_.
2521 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2522 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2523 got_plt reader; call target hooks to reserve GOT entries.
2524 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2525 of input file info header and GOT info entry.
2526 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2527 relocation info.
2528 (Got_plt_view_info::got_descriptor): Remove.
2529 (Got_plt_view_info::sym_index): New data member.
2530 (Got_plt_view_info::input_index): New data member.
2531 (Local_got_offset_visitor::visit): Write input file index.
2532 (Global_got_offset_visitor::visit): Write 0 for input file index.
2533 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2534 with sym_index and input_index.
2535 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2536 incremental info GOT entry; replace got_descriptor with input_index.
2537 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2538 map from input file index to object.
2539 (Sized_relobj_incr::do_layout): Replace direct data member reference
2540 with accessor function.
2541 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2542 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2543 Adjust size of input file info header.
2544 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2545 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2546 (Incremental_input_entry_reader::get_input_section): Adjust size of
2547 input file info header.
2548 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2549 of incremental info GOT entry.
2550 (Incremental_got_plt_reader::get_got_desc): Remove.
2551 (Incremental_got_plt_reader::get_got_symndx): New function.
2552 (Incremental_got_plt_reader::get_got_input_index): New function.
2553 (Sized_incremental_binary::Sized_incremental_binary): Remove
2554 file_status_; add input_objects_.
2555 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2556 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2557 (Sized_incremental_binary::file_is_unchanged): Remove.
2558 (Sized_incremental_binary::set_input_object): New function.
2559 (Sized_incremental_binary::input_object): New function.
2560 (Sized_incremental_binary::file_status_): Remove.
2561 (Sized_incremental_binary::input_objects_): New data member.
2562 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2563 references.
2564 (Sized_relobj_incr::invalid_address): Move to base class.
2565 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2566 class.
2567 (Sized_relobj_incr::do_output_section_offset): Likewise.
2568 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2569 (Sized_relobj_incr::section_offsets_): Likewise.
2570 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2571 function.
2572 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2573 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2574 with accessor function.
2575 (Sized_relobj_file::do_layout): Likewise.
2576 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2577 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2578 (Sized_relobj_file::compute_final_local_value): Replace refs to
2579 section_offsets_ with accessor function.
2580 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2581 * object.h (Relobj::Relobj): Initialize new data members.
2582 (Relobj::add_dyn_reloc): New function.
2583 (Relobj::first_dyn_reloc): New function.
2584 (Relobj::dyn_reloc_count): New function.
2585 (Relobj::first_dyn_reloc_): New data member.
2586 (Relobj::dyn_reloc_count_): New data member.
2587 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2588 references.
2589 (Sized_relobj::Address): New typedef.
2590 (Sized_relobj::invalid_address): Move here from child class.
2591 (Sized_relobj::Sized_relobj): Initialize new data members.
2592 (Sized_relobj::sized_relobj): New function.
2593 (Sized_relobj::is_output_section_offset_invalid): Move here from
2594 child class.
2595 (Sized_relobj::get_output_section_offset): Likewise.
2596 (Sized_relobj::local_has_got_offset): Likewise.
2597 (Sized_relobj::local_got_offset): Likewise.
2598 (Sized_relobj::set_local_got_offset): Likewise.
2599 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2600 (Sized_relobj::clear_got_offsets): New function.
2601 (Sized_relobj::section_offsets): Move here from child class.
2602 (Sized_relobj::do_output_section_offset): Likewise.
2603 (Sized_relobj::do_set_section_offset): Likewise.
2604 (Sized_relobj::Local_got_offsets): Likewise.
2605 (Sized_relobj::local_got_offsets_): Likewise.
2606 (Sized_relobj::section_offsets_): Likewise.
2607 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2608 references.
2609 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2610 class.
2611 (Sized_relobj_file::sized_relobj): New function
2612 (Sized_relobj_file::local_has_got_offset): Move to base class.
2613 (Sized_relobj_file::local_got_offset): Likewise.
2614 (Sized_relobj_file::set_local_got_offset): Likewise.
2615 (Sized_relobj_file::get_output_section_offset): Likewise.
2616 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2617 (Sized_relobj_file::do_output_section_offset): Likewise.
2618 (Sized_relobj_file::do_set_section_offset): Likewise.
2619 (Sized_relobj_file::Local_got_offsets): Likewise.
2620 (Sized_relobj_file::local_got_offsets_): Likewise.
2621 (Sized_relobj_file::section_offsets_): Likewise.
2622 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2623 (all constructors).
2624 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2625 (Output_reloc::get_symbol_index): Likewise.
2626 (Output_reloc::local_section_offset): Likewise.
2627 (Output_reloc::get_address): Likewise.
2628 (Output_reloc::symbol_value): Likewise.
2629 (Output_data_got::reserve_slot): Move to class definition.
2630 (Output_data_got::reserve_local): New function.
2631 (Output_data_got::reserve_slot_for_global): Remove.
2632 (Output_data_got::reserve_global): New function.
2633 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2634 (all constructors, two instantiations).
2635 (Output_reloc::get_relobj): New function (two instantiations).
2636 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2637 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2638 (Output_data_reloc::add_global): Adjust type of relobj.
2639 (Output_data_reloc::add_global_relative): Likewise.
2640 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2641 (Output_data_reloc::add_local): Likewise.
2642 (Output_data_reloc::add_local_relative): Likewise.
2643 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2644 (Output_data_reloc::add_local_section): Likewise.
2645 (Output_data_reloc::add_output_section): Likewise.
2646 (Output_data_reloc::add_absolute): Likewise.
2647 (Output_data_reloc::add_target_specific): Likewise.
2648 (Output_data_got::reserve_slot): Move definition here.
2649 (Output_data_got::reserve_local): New function.
2650 (Output_data_got::reserve_global): New function.
2651 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2652 section_offsets_ with accessor function.
2653 (Sized_relobj_file::write_sections): Likewise.
2654 (Sized_relobj_file::do_relocate_sections): Likewise.
2655 * target.h (Sized_target::reserve_local_got_entry): New function.
2656 (Sized_target::reserve_global_got_entry): New function.
2657 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2658 (Target_x86_64::reserve_global_got_entry): New function.
2659 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2660
2661 2011-05-23 Cary Coutant <ccoutant@google.com>
2662
2663 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2664 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2665 bit when checking got_type.
2666 * incremental.cc (Sized_incremental_binary::setup_readers):
2667 Store symbol table and string table locations; initialize bit vector
2668 of file status flags.
2669 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2670 unchanged files.
2671 (Sized_incremental_binary::do_process_got_plt): New function.
2672 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2673 (Output_section_incremental_inputs::set_final_data_size): Record
2674 file index for each input file.
2675 (Output_section_incremental_inputs::write_got_plt): Store file index
2676 instead of input entry offset for each GOT entry.
2677 * incremental.h
2678 (Incremental_input_entry::Incremental_input_entry): Initialize new
2679 data member.
2680 (Incremental_input_entry::set_offset): Store file index.
2681 (Incremental_input_entry::get_file_index): New function.
2682 (Incremental_input_entry::file_index_): New data member.
2683 (Incremental_binary::process_got_plt): New function.
2684 (Incremental_binary::do_process_got_plt): New function.
2685 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2686 data members.
2687 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2688 (Sized_incremental_binary::set_file_is_unchanged): New function.
2689 (Sized_incremental_binary::file_is_unchanged): New function.
2690 (Sized_incremental_binary::do_process_got_plt): New function.
2691 (Sized_incremental_binary::file_status_): New data member.
2692 (Sized_incremental_binary::main_symtab_loc_): New data member.
2693 (Sized_incremental_binary::main_strtab_loc_): New data member.
2694 * output.cc (Output_data_got::Got_entry::write): Add case
2695 RESERVED_CODE.
2696 (Output_data_got::add_global): Call add_got_entry.
2697 (Output_data_got::add_global_plt): Likewise.
2698 (Output_data_got::add_global_with_rel): Likewise.
2699 (Output_data_got::add_global_with_rela): Likewise.
2700 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2701 (Output_data_got::add_global_pair_with_rela): Likewise.
2702 (Output_data_got::add_local): Call add_got_entry.
2703 (Output_data_got::add_local_plt): Likewise.
2704 (Output_data_got::add_local_with_rel): Likewise.
2705 (Output_data_got::add_local_with_rela): Likewise.
2706 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2707 (Output_data_got::add_local_pair_with_rela): Likewise.
2708 (Output_data_got::reserve_slot): New function.
2709 (Output_data_got::reserve_slot_for_global): New function.
2710 (Output_data_got::add_got_entry): New function.
2711 (Output_data_got::add_got_entry_pair): New function.
2712 (Output_section::add_output_section_data): Edit FIXME.
2713 * output.h
2714 (Output_section_data_build::Output_section_data_build): New
2715 constructor with size parameter.
2716 (Output_data_space::Output_data_space): Likewise.
2717 (Output_data_got::Output_data_got): Initialize new data member; new
2718 constructor with size parameter.
2719 (Output_data_got::add_constant): Call add_got_entry.
2720 (Output_data_got::reserve_slot): New function.
2721 (Output_data_got::reserve_slot_for_global): New function.
2722 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2723 (Output_data_got::add_got_entry): New function.
2724 (Output_data_got::add_got_entry_pair): New function.
2725 (Output_data_got::free_list_): New data member.
2726 * target.h (Sized_target::init_got_plt_for_update): New function.
2727 (Sized_target::register_global_plt_entry): New function.
2728 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2729 Initialize new data member; call init; add constructor with PLT count.
2730 (Output_data_plt_x86_64::init): New function.
2731 (Output_data_plt_x86_64::add_relocation): New function.
2732 (Output_data_plt_x86_64::reserve_slot): New function.
2733 (Output_data_plt_x86_64::free_list_): New data member.
2734 (Target_x86_64::init_got_plt_for_update): New function.
2735 (Target_x86_64::register_global_plt_entry): New function.
2736 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2737 incremental updates.
2738 (Output_data_plt_x86_64::add_relocation): New function.
2739 * testsuite/object_unittest.cc (Object_test): Set default options.
2740
2741 2011-05-16 Ian Lance Taylor <iant@google.com>
2742
2743 * options.h (class General_options): Make -i a synonym for -r.
2744
2745 2011-05-16 Ian Lance Taylor <iant@google.com>
2746
2747 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2748
2749 2011-05-10 Cary Coutant <ccoutant@google.com>
2750
2751 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2752 strip_all (-s).
2753
2754 2011-05-06 Ian Lance Taylor <iant@google.com>
2755
2756 * layout.cc (Layout::layout): If the output section flags change,
2757 update the ordering.
2758
2759 2011-04-25 Cary Coutant <ccoutant@google.com>
2760
2761 * incremental-dump.cc (dump_incremental_inputs): Print local
2762 symbol info for each input file.
2763 * incremental.cc
2764 (Output_section_incremental_inputs::set_final_data_size): Add local
2765 symbol info to input file entries in incremental info.
2766 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2767 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2768 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2769 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2770 implementation.
2771 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2772 (Sized_incr_relobj::do_relocate): Write the local symbols.
2773 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2774 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2775 Adjust size of input file header.
2776 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2777 (Incremental_inputs_reader::get_local_symbol_count): New function.
2778 (Incremental_inputs_reader::get_input_section): Adjust size of input
2779 file header.
2780 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2781 (Sized_incr_relobj::This): New typedef.
2782 (Sized_incr_relobj::sym_size): New const data member.
2783 (Sized_incr_relobj::Local_symbol): New struct.
2784 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2785 (Sized_incr_relobj::do_local_symbol_offset): New function.
2786 (Sized_incr_relobj::local_symbol_count_): New data member.
2787 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2788 (Sized_incr_relobj::local_symbol_index_): New data member.
2789 (Sized_incr_relobj::local_symbol_offset_): New data member.
2790 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2791 (Sized_incr_relobj::local_symbols_): New data member.
2792 * object.h (Relobj::output_local_symbol_count): New function.
2793 (Relobj::local_symbol_offset): New function.
2794 (Relobj::do_output_local_symbol_count): New function.
2795 (Relobj::do_local_symbol_offset): New function.
2796 (Sized_relobj::do_output_local_symbol_count): New function.
2797 (Sized_relobj::do_local_symbol_offset): New function.
2798
2799 2011-04-22 Vladimir Simonov <sv@sw.ru>
2800
2801 * descriptors.cc (set_close_on_exec): New function.
2802 (Descriptors::open): Use set_close_on_exec.
2803 * output.cc (S_ISLNK): Define if not defined.
2804
2805 2011-04-22 Cary Coutant <ccoutant@google.com>
2806
2807 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2808 global symbol map.
2809 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2810 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2811 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2812 relocations.
2813 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2814 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2815 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2816 * incremental.h
2817 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2818 function.
2819 (Incremental_binary::apply_incremental_relocs): New function.
2820 (Incremental_binary::do_apply_incremental_relocs): New function.
2821 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2822 data member.
2823 (Sized_incremental_binary::add_global_symbol): New function.
2824 (Sized_incremental_binary::global_symbol): New function.
2825 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2826 (Sized_incremental_binary::symbol_map_): New data member.
2827 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2828 * target.h (Sized_target::apply_relocation): New function.
2829 * target-reloc.h (apply_relocation): New function.
2830 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2831
2832 2011-04-22 Doug Kwan <dougkwan@google.com>
2833
2834 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2835 flag of a SHT_ARM_EXIDX section.
2836 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2837 * testsuite/Makefile.in: Regenerate.
2838 * testsuite/arm_exidx_test.s: New file.
2839 * testsuite/arm_exidx_test.sh: Same.
2840
2841 2011-04-20 Cary Coutant <ccoutant@google.com>
2842
2843 PR gold/12689
2844 * archive.h (Incremental_archive_entry::Archive_member):
2845 Initialize arg_serial_ (second constructor).
2846
2847 2011-04-17 Ian Lance Taylor <iant@google.com>
2848
2849 * object.cc (Relocate_info::location): Simplify location string.
2850 * errors.cc (Errors::error_at_location): Don't print program
2851 name.
2852 (Errors::warning_at_location): Likewise.
2853 (Errors::undefined_symbol): Likewise.
2854 * testsuite/debug_msg.sh: Update accordingly.
2855
2856 2011-04-14 Cary Coutant <ccoutant@google.com>
2857
2858 * gold/layout.cc (Layout::symtab_section_offset): New function.
2859 * gold/layout.h (Layout::symtab_section_offset): New function.
2860 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2861
2862 2011-04-12 Ian Lance Taylor <iant@google.com>
2863
2864 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2865 with MREMAP_MAYMOVE.
2866 * output.h (class Output_file): Add map_is_allocated_ field.
2867 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2868 not available, provide stubs. If mremap is not available, #define
2869 it to gold_mremap.
2870 (MREMAP_MAYMOVE): Define if not defined.
2871 (Output_file::Output_file): Initialize map_is_allocated_.
2872 (Output_file::resize): Check map_is_allocated_.
2873 (Output_file::map_anonymous): If mmap fails, use malloc.
2874 (Output_file::unmap): Don't do anything for an anonymous map.
2875 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2876 is not available, provide stubs.
2877 (File_read::View::~View): Use free rather than delete[].
2878 (File_read::make_view): Use malloc rather than new[]. If mmap
2879 fails, use malloc.
2880 (File_read::find_or_make_view): Use malloc rather than new[].
2881 * gold.h: Remove HAVE_REMAP code.
2882 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2883 exists. Rename mremap to gold_mremap. If mmap is not available
2884 don't do anything.
2885 * configure, config.in: Rebuild.
2886
2887 2011-04-11 Ian Lance Taylor <iant@google.com>
2888
2889 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2890 initialize local variable v.
2891
2892 2011-04-11 Cary Coutant <ccoutant@google.com>
2893
2894 * archive.cc (Archive::include_member): Adjust call to
2895 report_object.
2896 (Add_archive_symbols::run): Track argument serial numbers.
2897 (Lib_group::include_member): Likewise.
2898 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2899 * archive.h (Incremental_archive_entry::Archive_member):
2900 Initialize arg_serial_.
2901 (Archive_member::arg_serial_): New data member.
2902 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2903 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2904 incremental link.
2905 (Sized_dynobj::do_for_all_local_got_entries): New function.
2906 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2907 function.
2908 * fileread.cc (get_mtime): New function.
2909 * fileread.h (get_mtime): New function.
2910 * gold.cc (queue_initial_tasks): Check for incremental update.
2911 (process_incremental_input): New function.
2912 (queue_middle_tasks): Don't force valid target for incremental
2913 update.
2914 * incremental-dump.cc (find_input_containing_global): Adjust
2915 size of symbol info entry.
2916 (dump_incremental_inputs): Dump argument serial number and
2917 in_system_directory flag; bias shndx by 1; print symbol names
2918 when dumping per-file symbol lists; use new symbol info readers.
2919 * incremental.cc
2920 (Output_section_incremental_inputs:update_data_size): New function.
2921 (Sized_incremental_binary::setup_readers): Setup input readers
2922 for each input file; build maps for files added from libraries
2923 and scripts.
2924 (Sized_incremental_binary::check_input_args): New function.
2925 (Sized_incremental_binary::do_check_inputs): Build map of argument
2926 serial numbers to input arguments.
2927 (Sized_incremental_binary::do_file_has_changed): Rename
2928 do_file_is_unchanged to this; compare file modification times.
2929 (Sized_incremental_binary::do_init_layout): New function.
2930 (Sized_incremental_binary::do_reserve_layout): New function.
2931 (Sized_incremental_binary::do_get_input_reader): Remove.
2932 (Sized_incremental_binary::get_symtab_view): New function.
2933 (Incremental_checker::can_incrementally_link_output_file): Remove.
2934 (Incremental_inputs::report_command_line): Exclude --debug options.
2935 (Incremental_inputs::report_archive_begin): Add parameter; track
2936 argument serial numbers; don't put input file entry for archive
2937 before archive members.
2938 (Incremental_inputs::report_archive_end): Put input file entry
2939 for archive after archive members.
2940 (Incremental_inputs::report_object): Add parameter; track argument
2941 serial numbers and in_system_directory flag.
2942 (Incremental_inputs::report_script): Add parameter; track argument
2943 serial numbers.
2944 (Output_section_incremental_inputs::set_final_data_size): Adjust
2945 size of symbol info entry; check for forwarding symbols.
2946 (Output_section_incremental_inputs::write_input_files): Write
2947 in_system_directory flag and argument serial number.
2948 (Output_section_incremental_inputs::write_info_blocks): Map section
2949 indices between incremental info and original input file; store
2950 input section index for each symbol.
2951 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2952 change operator() to visit().
2953 (class Global_got_offset_visitor): Likewise.
2954 (class Global_symbol_visitor_got_plt):
2955 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2956 classes.
2957 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2958 (Sized_incr_relobj::do_read_symbols): New function.
2959 (Sized_incr_relobj::do_layout): New function.
2960 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2961 (Sized_incr_relobj::do_add_symbols): New function.
2962 (Sized_incr_relobj::do_should_include_member): New function.
2963 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2964 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2965 (Sized_incr_relobj::do_section_size): New function.
2966 (Sized_incr_relobj::do_section_name): New function.
2967 (Sized_incr_relobj::do_section_contents): New function.
2968 (Sized_incr_relobj::do_section_flags): New function.
2969 (Sized_incr_relobj::do_section_entsize): New function.
2970 (Sized_incr_relobj::do_section_address): New function.
2971 (Sized_incr_relobj::do_section_type): New function.
2972 (Sized_incr_relobj::do_section_link): New function.
2973 (Sized_incr_relobj::do_section_info): New function.
2974 (Sized_incr_relobj::do_section_addralign): New function.
2975 (Sized_incr_relobj::do_initialize_xindex): New function.
2976 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2977 (Sized_incr_relobj::do_read_relocs): New function.
2978 (Sized_incr_relobj::do_gc_process_relocs): New function.
2979 (Sized_incr_relobj::do_scan_relocs): New function.
2980 (Sized_incr_relobj::do_count_local_symbols): New function.
2981 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2982 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2983 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2984 (Sized_incr_relobj::do_relocate): New function.
2985 (Sized_incr_relobj::do_set_section_offset): New function.
2986 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2987 (Sized_incr_dynobj::do_read_symbols): New function.
2988 (Sized_incr_dynobj::do_layout): New function.
2989 (Sized_incr_dynobj::do_add_symbols): New function.
2990 (Sized_incr_dynobj::do_should_include_member): New function.
2991 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2992 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2993 (Sized_incr_dynobj::do_section_size): New function.
2994 (Sized_incr_dynobj::do_section_name): New function.
2995 (Sized_incr_dynobj::do_section_contents): New function.
2996 (Sized_incr_dynobj::do_section_flags): New function.
2997 (Sized_incr_dynobj::do_section_entsize): New function.
2998 (Sized_incr_dynobj::do_section_address): New function.
2999 (Sized_incr_dynobj::do_section_type): New function.
3000 (Sized_incr_dynobj::do_section_link): New function.
3001 (Sized_incr_dynobj::do_section_info): New function.
3002 (Sized_incr_dynobj::do_section_addralign): New function.
3003 (Sized_incr_dynobj::do_initialize_xindex): New function.
3004 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3005 (make_sized_incremental_object): New function.
3006 (Incremental_library::copy_unused_symbols): New function.
3007 (Incremental_library::do_for_all_unused_symbols): New function.
3008 * incremental.h (enum Incremental_input_flags): New type.
3009 (class Incremental_checker): Remove.
3010 (Incremental_input_entry::Incremental_input_entry): Add argument
3011 serial number.
3012 (Incremental_input_entry::arg_serial): New function.
3013 (Incremental_input_entry::set_is_in_system_directory): New function.
3014 (Incremental_input_entry::is_in_system_directory): New function.
3015 (Incremental_input_entry::arg_serial_): New data member.
3016 (Incremental_input_entry::is_in_system_directory_): New data member.
3017 (class Script_info): Move here from script.h.
3018 (Script_info::Script_info): Add filename parameter.
3019 (Script_info::filename): New function.
3020 (Script_info::filename_): New data member.
3021 (Incremental_script_entry::Incremental_script_entry): Add argument
3022 serial number.
3023 (Incremental_object_entry::Incremental_object_entry): Likewise.
3024 (Incremental_object_entry::add_input_section): Build list of input
3025 sections with map to original shndx.
3026 (Incremental_object_entry::get_input_section_index): New function.
3027 (Incremental_object_entry::shndx_): New data member.
3028 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3029 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3030 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3031 serial number.
3032 (Incremental_inputs::report_archive_begin): Likewise.
3033 (Incremental_inputs::report_object): Likewise.
3034 (Incremental_inputs::report_script): Likewise.
3035 (class Incremental_global_symbol_reader): New class.
3036 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3037 and store flags and input file type.
3038 (Incremental_input_entry_reader::arg_serial): New function.
3039 (Incremental_input_entry_reader::type): Extract type from flags.
3040 (Incremental_input_entry_reader::is_in_system_directory): New function.
3041 (Incremental_input_entry_reader::get_input_section_count): Call
3042 accessor function for type.
3043 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3044 function for type; adjust size of global symbol entry.
3045 (Incremental_input_entry_reader::get_global_symbol_count): Call
3046 accessor function for type.
3047 (Incremental_input_entry_reader::get_object_count): Likewise.
3048 (Incremental_input_entry_reader::get_object_offset): Likewise.
3049 (Incremental_input_entry_reader::get_member_count): Likewise.
3050 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3051 (Incremental_input_entry_reader::get_member_offset): Likewise.
3052 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3053 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3054 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3055 (Incremental_input_entry_reader::get_global_symbol_reader): New
3056 function.
3057 (Incremental_input_entry_reader::get_output_symbol_index): New
3058 function.
3059 (Incremental_input_entry_reader::type_): Remove.
3060 (Incremental_input_entry_reader::flags_): New data member.
3061 (Incremental_inputs_reader::input_file_offset): New function.
3062 (Incremental_inputs_reader::input_file_index): New function.
3063 (Incremental_inputs_reader::input_file): Call input_file_offset.
3064 (Incremental_inputs_reader::input_file_at_offset): New function.
3065 (Incremental_relocs_reader::get_r_type): Reformat.
3066 (Incremental_relocs_reader::get_r_shndx): Reformat.
3067 (Incremental_relocs_reader::get_r_offset): Reformat.
3068 (Incremental_relocs_reader::data): New function.
3069 (Incremental_binary::Incremental_binary): Initialize new data members.
3070 (Incremental_binary::check_inputs): Add cmdline parameter.
3071 (Incremental_binary::file_is_unchanged): Remove.
3072 (Input_reader::arg_serial): New function.
3073 (Input_reader::get_unused_symbol_count): New function.
3074 (Input_reader::get_unused_symbol): New function.
3075 (Input_reader::do_arg_serial): New function.
3076 (Input_reader::do_get_unused_symbol_count): New function.
3077 (Input_reader::do_get_unused_symbol): New function.
3078 (Incremental_binary::input_file_count): New function.
3079 (Incremental_binary::get_input_reader): Change signature to use
3080 index instead of filename.
3081 (Incremental_binary::file_has_changed): New function.
3082 (Incremental_binary::get_input_argument): New function.
3083 (Incremental_binary::get_library): New function.
3084 (Incremental_binary::get_script_info): New function.
3085 (Incremental_binary::init_layout): New function.
3086 (Incremental_binary::reserve_layout): New function.
3087 (Incremental_binary::output_file): New function.
3088 (Incremental_binary::do_check_inputs): New function.
3089 (Incremental_binary::do_file_is_unchanged): Remove.
3090 (Incremental_binary::do_file_has_changed): New function.
3091 (Incremental_binary::do_init_layout): New function.
3092 (Incremental_binary::do_reserve_layout): New function.
3093 (Incremental_binary::do_input_file_count): New function.
3094 (Incremental_binary::do_get_input_reader): Change signature.
3095 (Incremental_binary::input_args_map_): New data member.
3096 (Incremental_binary::library_map_): New data member.
3097 (Incremental_binary::script_map_): New data member.
3098 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3099 new data members.
3100 (Sized_incremental_binary::output_section): New function.
3101 (Sized_incremental_binary::inputs_reader): Add const.
3102 (Sized_incremental_binary::symtab_reader): Add const.
3103 (Sized_incremental_binary::relocs_reader): Add const.
3104 (Sized_incremental_binary::got_plt_reader): Add const.
3105 (Sized_incremental_binary::get_symtab_view): New function.
3106 (Sized_incremental_binary::Inputs_reader): New typedef.
3107 (Sized_incremental_binary::Input_entry_reader): New typedef.
3108 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3109 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3110 (Sized_incremental_binary::do_file_has_changed): New function.
3111 (Sized_incremental_binary::do_init_layout): New function.
3112 (Sized_incremental_binary::do_reserve_layout): New function.
3113 (Sized_input_reader::Inputs_reader): Remove.
3114 (Sized_input_reader::Input_entry_reader): Remove.
3115 (Sized_input_reader::do_arg_serial): New function.
3116 (Sized_input_reader::do_get_unused_symbol_count): New function.
3117 (Sized_input_reader::do_get_unused_symbol): New function.
3118 (Sized_incremental_binary::do_input_file_count): New function.
3119 (Sized_incremental_binary::do_get_input_reader): Change signature;
3120 use index instead of filename.
3121 (Sized_incremental_binary::section_map_): New data member.
3122 (Sized_incremental_binary::input_entry_readers_): New data member.
3123 (class Sized_incr_relobj): New class.
3124 (class Sized_incr_dynobj): New class.
3125 (make_sized_incremental_object): New function.
3126 (class Incremental_library): New class.
3127 * layout.cc (Free_list::num_lists): New static data member.
3128 (Free_list::num_nodes): New static data member.
3129 (Free_list::num_removes): New static data member.
3130 (Free_list::num_remove_visits): New static data member.
3131 (Free_list::num_allocates): New static data member.
3132 (Free_list::num_allocate_visits): New static data member.
3133 (Free_list::init): New function.
3134 (Free_list::remove): New function.
3135 (Free_list::allocate): New function.
3136 (Free_list::dump): New function.
3137 (Free_list::print_stats): New function.
3138 (Layout_task_runner::run): Resize output file for incremental updates.
3139 (Layout::Layout): Initialize new data members.
3140 (Layout::set_incremental_base): New function.
3141 (Layout::init_fixed_output_section): New function.
3142 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3143 incremental updates.
3144 (Layout::create_gold_note): Do not create gold note section for
3145 incremental updates.
3146 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3147 for incremental updates.
3148 (Layout::set_section_offsets): For incremental updates, allocate space
3149 from free list.
3150 (Layout::create_symtab_sections): Layout with offsets relative to
3151 start of section; for incremental updates, allocate space from free
3152 list.
3153 (Layout::create_shdrs): For incremental updates, allocate space from
3154 free list.
3155 (Layout::finish_dynamic_section): For incremental updates, do not
3156 check --as-needed (fixed in subsequent patch).
3157 * layout.h (class Free_list): New class.
3158 (Layout::set_incremental_base): New function.
3159 (Layout::incremental_base): New function.
3160 (Layout::init_fixed_output_section): New function.
3161 (Layout::allocate): New function.
3162 (Layout::incremental_base_): New data member.
3163 (Layout::free_list_): New data member.
3164 * main.cc (main): Print Free_list statistics.
3165 * object.cc (Relobj::finalize_incremental_relocs): Add
3166 clear_counts parameter; clear counts only when clear_counts is set.
3167 (Sized_relobj::Sized_relobj): Initialize new base class.
3168 (Sized_relobj::do_layout): Don't report special sections.
3169 (Sized_relobj::do_for_all_local_got_entries): New function.
3170 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3171 symtab_off to all symbol table offsets.
3172 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3173 * object.h (class Got_offset_list): Move to top of file.
3174 (Object::Object): Allow case where input_file == NULL.
3175 (Object::~Object): Likewise.
3176 (Object::input_file): Assert that input_file != NULL.
3177 (Object::lock): Allow case where input_file == NULL.
3178 (Object::unlock): Likewise.
3179 (Object::is_locked): Likewise.
3180 (Object::token): Likewise.
3181 (Object::release): Likewise.
3182 (Object::is_incremental): New function.
3183 (Object::get_mtime): New function.
3184 (Object::for_all_local_got_entries): New function.
3185 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3186 (Object::set_is_in_system_directory): New function.
3187 (Object::is_in_system_directory): New function.
3188 (Object::do_is_incremental): New function.
3189 (Object::do_get_mtime): New function.
3190 (Object::do_for_all_local_got_entries): New function.
3191 (Object::is_in_system_directory_): New data member.
3192 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3193 (class Sized_relobj_base): New class.
3194 (class Sized_relobj): Derive from Sized_relobj_base.
3195 (class Sized_relobj::Symbols): Redeclare from base class.
3196 (class Sized_relobj::local_got_offset_list): Remove.
3197 (class Sized_relobj::Output_sections): Redeclare from base class.
3198 (class Sized_relobj::do_for_all_local_got_entries): New function.
3199 (class Sized_relobj::write_local_symbols): Add offset parameter.
3200 (class Sized_relobj::local_symbol_offset_): Update comment.
3201 (class Sized_relobj::local_dynsym_offset_): Update comment.
3202 * options.cc (Input_arguments::add_file): Remove const.
3203 * options.h (Input_file_argument::Input_file_argument):
3204 Initialize arg_serial_ (all constructors).
3205 (Input_file_argument::set_arg_serial): New function.
3206 (Input_file_argument::arg_serial): New function.
3207 (Input_file_argument::arg_serial_): New data member.
3208 (Input_arguments::Input_arguments): Initialize file_count_.
3209 (Input_arguments::add_file): Remove const.
3210 (Input_arguments::number_of_input_files): New function.
3211 (Input_arguments::file_count_): New data member.
3212 (Command_line::number_of_input_files): Call
3213 Input_arguments::number_of_input_files.
3214 * output.cc (Output_segment_headers::Output_segment_headers):
3215 Set current size.
3216 (Output_section::Input_section::current_data_size): New function.
3217 (Output_section::Output_section): Initialize new data members.
3218 (Output_section::add_input_section): Don't do merge sections for
3219 an incremental link; allocate space from free list for an
3220 incremental update.
3221 (Output_section::add_output_section_data): Allocate space from
3222 free list for an incremental update.
3223 (Output_section::update_data_size): New function.
3224 (Output_section::set_fixed_layout): New function.
3225 (Output_section::reserve): New function.
3226 (Output_segment::set_section_addresses): Remove const.
3227 (Output_segment::set_section_list_addresses): Remove const; allocate
3228 space from free list for an incremental update.
3229 (Output_segment::set_offset): Adjust size of RELRO segment for an
3230 incremental update.
3231 * output.h (Output_data::current_data_size): Move here from
3232 child classes.
3233 (Output_data::pre_finalize_data_size): New function.
3234 (Output_data::update_data_size): New function.
3235 (Output_section_headers::update_data_size): new function.
3236 (Output_section_data_build::current_data_size): Move to Output_data.
3237 (Output_data_strtab::update_data_size): New function.
3238 (Output_section::current_data_size): Move to Output_data.
3239 (Output_section::set_fixed_layout): New function.
3240 (Output_section::has_fixed_layout): New function.
3241 (Output_section::reserve): New function.
3242 (Output_section::update_data_size): New function.
3243 (Output_section::has_fixed_layout_): New data member.
3244 (Output_section::free_list_): New data member.
3245 (Output_segment::set_section_addresses): Remove const.
3246 (Output_segment::set_section_list_addresses): Remove const.
3247 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3248 New function.
3249 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3250 New function.
3251 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3252 parameter when calling Add_symbols constructor; store argument
3253 serial number for members of a lib group.
3254 (Add_symbols::locks): Allow case where token == NULL.
3255 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3256 (Read_member::~Read_member): New function.
3257 (Read_member::is_runnable): New function.
3258 (Read_member::locks): New function.
3259 (Read_member::run): New function.
3260 (Check_script::~Check_script): New function.
3261 (Check_script::is_runnable): New function.
3262 (Check_script::locks): New function.
3263 (Check_script::run): New function.
3264 (Check_library::~Check_library): New function.
3265 (Check_library::is_runnable): New function.
3266 (Check_library::locks): New function.
3267 (Check_library::run): New function.
3268 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3269 (Add_symbols::library_): New data member.
3270 (class Read_member): New class.
3271 (class Check_script): New class.
3272 (class Check_library): New class.
3273 * reloc.cc (Read_relocs::is_runnable): Allow case where
3274 token == NULL.
3275 (Read_relocs::locks): Likewise.
3276 (Scan_relocs::locks): Likewise.
3277 (Relocate_task::locks): Likewise.
3278 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3279 to clear counters.
3280 (Sized_relobj::incremental_relocs_scan): Fix comment.
3281 (Sized_relobj::do_relocate): Pass output file offset to
3282 write_local_symbols.
3283 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3284 from class declaration.
3285 * script.cc (read_input_script): Allocate Script_info; pass
3286 argument serial number to report_script.
3287 * script.h (class Script_info): Move to incremental.h.
3288 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3289 * symtab.h (Symbol_table::add_from_incrobj): New function.
3290 (Symbol_table::set_file_offset): New function.
3291
3292 2011-04-05 Cary Coutant <ccoutant@google.com>
3293
3294 * incremental-dump.cc (dump_incremental_inputs): Change signature
3295 to take a Sized_incremental_binary; change caller. Use readers
3296 in Sized_incremental_binary.
3297 * incremental.cc
3298 (Sized_incremental_binary::find_incremental_inputs_sections):
3299 Rename do_find_incremental_inputs_sections to this.
3300 (Sized_incremental_binary::setup_readers): New function.
3301 (Sized_incremental_binary::do_check_inputs): Check
3302 has_incremental_info_ flag; move setup code to setup_readers;
3303 use input readers.
3304 (Sized_incremental_binary::do_file_is_unchanged): New function.
3305 (Sized_incremental_binary::do_get_input_reader): New function.
3306 * incremental.h (class Incremental_binary): Move to end of file.
3307 (Incremental_binary::file_is_unchanged): New function.
3308 (Incremental_binary::do_file_is_unchanged): New function.
3309 (Incremental_binary::Input_reader): New class.
3310 (Incremental_binary::get_input_reader): New function.
3311 (class Sized_incremental_binary): Move to end of file.
3312 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3313 input section reader classes.
3314 (Sized_incremental_binary::has_incremental_info): New function.
3315 (Sized_incremental_binary::inputs_reader): New function.
3316 (Sized_incremental_binary::symtab_reader): New function.
3317 (Sized_incremental_binary::relocs_reader): New function.
3318 (Sized_incremental_binary::got_plt_reader): New function.
3319 (Sized_incremental_binary::do_file_is_unchanged): New function.
3320 (Sized_incremental_binary::Sized_input_reader): New class.
3321 (Sized_incremental_binary::get_input_reader): New function.
3322 (Sized_incremental_binary::find_incremental_inputs_sections):
3323 Rename do_find_incremental_inputs_sections to this.
3324 (Sized_incremental_binary::setup_readers): New function.
3325 (Sized_incremental_binary::has_incremental_info_): New data member.
3326 (Sized_incremental_binary::inputs_reader_): New data member.
3327 (Sized_incremental_binary::symtab_reader_): New data member.
3328 (Sized_incremental_binary::relocs_reader_): New data member.
3329 (Sized_incremental_binary::got_plt_reader_): New data member.
3330 (Sized_incremental_binary::current_input_file_): New data member.
3331
3332 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3333
3334 PR gold/12640
3335 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3336 violation.
3337
3338 2011-03-30 Cary Coutant <ccoutant@google.com>
3339
3340 * archive.cc (Archive::include_member): Adjust call to report_object.
3341 (Add_archive_symbols::run): Add script_info to call to
3342 report_archive_begin.
3343 (Lib_group::include_member): Adjust call to report_object.
3344 (Add_lib_group_symbols::run): Adjust call to report_object.
3345 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3346 blocks. Add object count for script input files.
3347 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3348 script_info parameter; change all callers.
3349 (Incremental_inputs::report_object): Add script_info parameter;
3350 change all callers.
3351 (Incremental_inputs::report_script): Store backpointer to
3352 incremental info entry.
3353 (Output_section_incremental_inputs::set_final_data_size): Record
3354 additional information for scripts.
3355 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3356 * incremental.h (Incremental_script_entry::add_object): New function.
3357 (Incremental_script_entry::get_object_count): New function.
3358 (Incremental_script_entry::get_object): New function.
3359 (Incremental_script_entry::objects_): New data member; adjust
3360 constructor.
3361 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3362 (Incremental_inputs::report_object): Add script_info parameter.
3363 (Incremental_inputs_reader::get_object_count): New function.
3364 (Incremental_inputs_reader::get_object_offset): New function.
3365 * options.cc (Input_arguments::add_file): Return reference to
3366 new input argument.
3367 * options.h (Input_argument::set_script_info): New function.
3368 (Input_argument::script_info): New function.
3369 (Input_argument::script_info_): New data member; adjust all
3370 constructors.
3371 (Input_file_group::add_file): Return reference to new input argument.
3372 (Input_file_lib::add_file): Likewise.
3373 (Input_arguments::add_file): Likewise.
3374 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3375 * script.cc (Parser_closure::Parser_closure): Add script_info
3376 parameter; adjust all callers.
3377 (Parser_closure::script_info): New function.
3378 (Parser_closure::script_info_): New data member.
3379 (read_input_script): Report scripts earlier to incremental info.
3380 (script_add_file): Set script_info in Input_argument.
3381 (script_add_library): Likewise.
3382 * script.h (Script_options::Script_info): Rewrite class.
3383
3384 2011-03-29 Cary Coutant <ccoutant@google.com>
3385
3386 * archive.cc (Library_base::should_include_member): Move
3387 method here from class Archive.
3388 (Archive::Archive): Initialize base class.
3389 (Archive::should_include_member): Move to base class.
3390 (Archive::do_for_all_unused_symbols): New function.
3391 (Add_archive_symbols::run): Remove redundant access to
3392 incremental_inputs.
3393 (Lib_group::Lib_group): Initialize base class.
3394 (Lib_group::do_filename): New function.
3395 (Lib_group::include_member): Pass pointer to Lib_group to
3396 report_object.
3397 (Lib_group::do_for_all_unused_symbols): New function.
3398 (Add_lib_group_symbols::run): Report archive information for
3399 incremental links.
3400 * archive.h (class Library_base): New base class.
3401 (class Archive): Derive from Library_base.
3402 (Archive::filename): Move to base class.
3403 (Archive::set_incremental_info): Likewise.
3404 (Archive::incremental_info): Likewise.
3405 (Archive::Should_include): Likewise.
3406 (Archive::should_include_member): Likewise.
3407 (Archive::Armap_entry): Remove.
3408 (Archive::Unused_symbol_iterator): Remove.
3409 (Archive::unused_symbols_begin): Remove.
3410 (Archive::unused_symbols_end): Remove.
3411 (Archive::do_filename): New function.
3412 (Archive::do_get_mtime): New function.
3413 (Archive::do_for_all_unused_symbols): New function.
3414 (Archive::task_): Move to base class.
3415 (Archive::incremental_info_): Likewise.
3416 (class Lib_group): Derive from Library_base.
3417 (Lib_group::do_filename): New function.
3418 (Lib_group::do_get_mtime): New function.
3419 (Lib_group::do_for_all_unused_symbols): New function.
3420 (Lib_group::task_): Move to base class.
3421 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3422 function.
3423 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3424 function.
3425 * incremental.cc (Incremental_inputs::report_archive_begin):
3426 Use Library_base; call library's get_mtime; add incremental inputs
3427 entry before members.
3428 (class Unused_symbol_visitor): New class.
3429 (Incremental_inputs::report_archive_end): Use Library_base; use
3430 visitor class to record unused symbols; don't add incremental inputs
3431 entry after members.
3432 (Incremental_inputs::report_object): Use Library_base.
3433 * incremental.h
3434 (Incremental_archive_entry::Incremental_archive_entry): Remove
3435 unused Archive parameter.
3436 (Incremental_inputs::report_archive_begin): Use Library_base.
3437 (Incremental_inputs::report_archive_end): Likewise.
3438 (Incremental_inputs::report_object): Likewise.
3439 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3440 function.
3441 * object.h (Object::for_all_global_symbols): New function.
3442 (Object::do_for_all_global_symbols): New function.
3443 (Sized_relobj::do_for_all_global_symbols): New function.
3444 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3445 function.
3446 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3447 function.
3448
3449 2011-03-27 Ian Lance Taylor <iant@google.com>
3450
3451 * archive.cc (Archive::interpret_header): Return -1 if something
3452 goes wrong. Change callers accordingly.
3453
3454 2011-03-25 Cary Coutant <ccoutant@google.com>
3455
3456 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3457 * testsuite/Makefile.in: Regenerate.
3458
3459 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3460
3461 * plugin.cc (get_view): New.
3462 (Plugin::load): Pass get_view to the plugin.
3463 (Plugin_manager::get_view): New.
3464
3465 2011-03-21 Ian Lance Taylor <iant@google.com>
3466
3467 * testsuite/final_layout.sh: Rewrite to not use dc.
3468 * testsuite/relro_test.sh: Fail if dc is not present.
3469
3470 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3471
3472 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3473 Change == to -eq.
3474 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3475 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3476 Change == to -eq.
3477 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3478 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3479
3480 2011-03-14 Ian Lance Taylor <iant@google.com>
3481
3482 * script-sections.cc (Sort_output_sections::script_compare):
3483 Rename from is_before, change return type.
3484 (Sort_output_sections::operator()): Adjust accordingly.
3485
3486 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3487
3488 PR gold/12572
3489 * testsuite/odr_violation2.cc: Add comment to make all error line
3490 numbers double digits.
3491 * testsuite/debug_msg.sh: Adjust expected errors.
3492
3493 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3494
3495 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3496 but mark earlier ones as non-canonical
3497 (offset_to_iterator): Update search target and example
3498 (do_addr2line): Return extra lines in a vector*
3499 (format_file_lineno): Extract from do_addr2line
3500 (one_addr2line): Add vector* out-param
3501 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3502 when a lineno entry appeared last for its instruction
3503 (Dwarf_line_info): Add vector* out-param
3504 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3505 * symtab.cc (Odr_violation_compare): Include the lineno in the
3506 comparison again.
3507 (linenos_from_loc): New. Combine the canonical line for an
3508 address with its other lines.
3509 (True_if_intersect): New. Helper functor to make
3510 std::set_intersection a query.
3511 (detect_odr_violations): Compare sets of lines instead of just
3512 one line for each function. This became less deterministic, but
3513 has fewer false positives.
3514 * symtab.h: Declarations.
3515 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3516 mix an optimized and non-optimized object in the same binary
3517 (odr_violation2.so): Same.
3518 * testsuite/Makefile.in: Regenerate from Makefile.am.
3519 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3520 * testsuite/debug_msg.sh: Update line numbers and add
3521 assertions.
3522 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3523 non-optimized context.
3524 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3525 isn't inlined, and use OdrDerived in an optimized context.
3526 * testsuite/odr_header1.h: Defines OdrDerived, where
3527 optimization will change the
3528 first-instruction-in-the-destructor's file and line number.
3529 * testsuite/odr_header2.h: Defines OdrBase.
3530
3531 2011-03-09 Ian Lance Taylor <iant@google.com>
3532
3533 * fileread.cc (File_read::clear_views): Don't delete the whole
3534 file view.
3535
3536 2011-03-08 Ian Lance Taylor <iant@google.com>
3537
3538 PR gold/12525
3539 * fileread.cc: #include <climits>.
3540 (GOLD_IOV_MAX): Define.
3541 (File_read::read_multiple): Limit number of entries by iov_max.
3542 * fileread.h (class File_read): Always set max_readv_entries to
3543 128.
3544
3545 2011-03-07 Ian Lance Taylor <iant@google.com>
3546
3547 PR gold/12525
3548 * options.h (class General_options): Add -dy and -dn.
3549
3550 2011-03-02 Cary Coutant <ccoutant@google.com>
3551
3552 * testsuite/script_test_9.t: Add TLS segment.
3553
3554 2011-03-02 Simon Baldwin <simonb@google.com>
3555
3556 * configure.ac: Add check for gnu_indirect_function support in
3557 the toolchain building binutils.
3558 * configure: Rebuild.
3559
3560 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3561
3562 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3563 plugin only symbols.
3564 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3565 in plugin files as not needed in the symbol table.
3566
3567 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3568
3569 * output.cc (Output_section::add_input_section): Delay fill
3570 generation for section ordering.
3571
3572 2011-02-09 Ian Lance Taylor <iant@google.com>
3573
3574 PR gold/12316
3575 * object.h (class Sized_relobj): Remove clear_local_symbols.
3576 * reloc.cc (Sized_relobj::do_relocate): Don't call
3577 clear_local_symbols.
3578
3579 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3580
3581 * plugin.cc (is_visible_from_outside): Return true for symbols
3582 in the -u option.
3583
3584 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3585
3586 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3587 filename.
3588
3589 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3590
3591 * icf.h (is_section_foldable_candidate): Change type of parameter
3592 to std::string.
3593 * icf.cc (Icf::find_identical_sections): Change type of local variable
3594 section_name to be std::string.
3595 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3596
3597 2011-01-25 Ian Lance Taylor <iant@google.com>
3598
3599 * script.cc (script_add_extern): Rewrite to use
3600 add_symbol_reference.
3601
3602 2011-01-25 Doug Kwan <dougkwan@google.com>
3603
3604 * icf.cc (get_section_contents): Always lock section's object.
3605
3606 2011-01-24 Ian Lance Taylor <iant@google.com>
3607
3608 * options.h (class General_options): Accept
3609 --no-detect-odr-violations.
3610
3611 2011-01-24 Ian Lance Taylor <iant@google.com>
3612
3613 * version.cc (version_string): Bump to 1.11.
3614
3615 2011-01-24 Ian Lance Taylor <iant@google.com>
3616
3617 * plugin.cc (class Plugin_rescan): Define new class.
3618 (Plugin_manager::claim_file): Set any_claimed_.
3619 (Plugin_manager::save_archive): New function.
3620 (Plugin_manager::save_input_group): New function.
3621 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3622 necessary.
3623 (Plugin_manager::new_undefined_symbol): New function.
3624 (Plugin_manager::rescan): New function.
3625 (Plugin_manager::rescannable_defines): New function.
3626 (Plugin_manager::add_input_file): Set any_added_.
3627 * plugin.h (class Plugin_manager): define new fields rescannable_,
3628 undefined_symbols_, any_claimed_, and any_added_. Declare
3629 Plugin_rescan as friend. Declare new functions.
3630 (Plugin_manager::Rescannable): Define type.
3631 (Plugin_manager::Rescannable_list): Define type.
3632 (Plugin_manager::Undefined_symbol_list): Define type.
3633 (Plugin_manager::Plugin_manager): Initialize new fields.
3634 * archive.cc (Archive::defines_symbol): New function.
3635 (Add_archive_symbols::run): Pass archive to plugins if any.
3636 * archive.h (class Archive): Declare defines_symbol.
3637 * readsyms.cc (Input_group::~Input_group): New function.
3638 (Finish_group::run): Pass input_group to plugins if any.
3639 * readsyms.h (class Input_group): Declare destructor.
3640 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3641 any.
3642
3643 2011-01-10 Ian Lance Taylor <iant@google.com>
3644
3645 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3646 section as relro.
3647 (Layout::set_segment_offsets): Reset increase_relro before calling
3648 set_section_addresses a second time.
3649
3650 2011-01-04 Cary Coutant <ccoutant@google.com>
3651
3652 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3653 sections before NOBITS sections.
3654
3655 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3656
3657 * version.cc (print_version): Update copyright to 2011.
3658
3659 2010-12-23 Cary Coutant <ccoutant@google.com>
3660
3661 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3662 of OS to this->add. Add OD parameter to second form of the function.
3663
3664 2010-12-20 Ian Lance Taylor <iant@google.com>
3665
3666 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3667 second of two consecutive entries with same offset.
3668
3669 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3670
3671 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3672 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3673 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3674 to avoid unneeded links against $(LDADD).
3675 * testsuite/Makefile.in: Regenerate.
3676
3677 2010-12-15 Ian Lance Taylor <iant@google.com>
3678
3679 PR gold/12324
3680 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3681 for R_X86_64_32 and R_X86_64_PC32.
3682 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3683 ver_matching_def_pic.o.
3684 (ver_matching_def_pic.o): New target.
3685
3686 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3687
3688 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3689 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3690 Move definition before File_read::View member definitions.
3691 (File_read::View::~View): Initialize and hold lock before
3692 updating current_mapped_bytes.
3693
3694 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3695
3696 * dwarf_reader.cc: Remove outdated comment.
3697 * gold-threads.cc: Fix typo in error message.
3698 * archive.cc: Fix typos in comments.
3699 * archive.h: Likewise.
3700 * arm-reloc-property.cc: Likewise.
3701 * arm-reloc-property.h: Likewise.
3702 * arm-reloc.def: Likewise.
3703 * arm.cc: Likewise.
3704 * attributes.h: Likewise.
3705 * cref.cc: Likewise.
3706 * ehframe.cc: Likewise.
3707 * fileread.h: Likewise.
3708 * gold.h: Likewise.
3709 * i386.cc: Likewise.
3710 * icf.cc: Likewise.
3711 * incremental.h: Likewise.
3712 * int_encoding.cc: Likewise.
3713 * layout.h: Likewise.
3714 * main.cc: Likewise.
3715 * merge.h: Likewise.
3716 * object.cc: Likewise.
3717 * object.h: Likewise.
3718 * options.cc: Likewise.
3719 * readsyms.cc: Likewise.
3720 * reduced_debug_output.cc: Likewise.
3721 * reloc.cc: Likewise.
3722 * script-sections.cc: Likewise.
3723 * sparc.cc: Likewise.
3724 * symtab.h: Likewise.
3725 * target-reloc.h: Likewise.
3726 * target.cc: Likewise.
3727 * target.h: Likewise.
3728 * timer.cc: Likewise.
3729 * timer.h: Likewise.
3730 * x86_64.cc: Likewise.
3731
3732 2010-12-09 Cary Coutant <ccoutant@google.com>
3733
3734 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3735 stack.
3736 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3737 parameter; change all callers.
3738 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3739 * options.h (warn_execstack): New option.
3740
3741 2010-12-07 Doug Kwan <dougkwan@google.com>
3742
3743 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3744 like function call relocations.
3745
3746 2010-12-07 Ian Lance Taylor <iant@google.com>
3747
3748 * archive.cc (Archive::get_elf_object_for_member): Permit
3749 punconfigured to be NULL.
3750 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3751 (Archive::include_member): Pass NULL to get_elf_object_for_member
3752 if we searched for the archive and this is the first included
3753 object.
3754
3755 2010-12-01 Ian Lance Taylor <iant@google.com>
3756
3757 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3758 track_relocs_type_ field.
3759 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3760 Set track_relocs_type_.
3761 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3762 contents when using RELA relocs.
3763 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3764 reloc_map_.
3765 * reloc.cc (Track_relocs::next_addend): New function.
3766 * reloc.h (class Track_relocs): Declare next_addend.
3767
3768 2010-12-01 Ian Lance Taylor <iant@google.com>
3769
3770 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3771 virtual destructor.
3772
3773 2010-12-01 Ian Lance Taylor <iant@google.com>
3774
3775 * README: Update compilers known to work and fail.
3776
3777 2010-11-23 Matthias Klose <doko@ubuntu.com>
3778
3779 * configure.in: For --enable-gold, handle value `default' instead of
3780 `both*'. Always install ld as ld.bfd, install as ld if gold is
3781 not the default.
3782 * configure: Regenerate.
3783
3784 2010-11-18 Doug Kwan <dougkwan@google.com>
3785
3786 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3787 and right_alignment to be zero. Store result alignment only if it is
3788 greater than existing alignment.
3789
3790 2010-11-16 Cary Coutant <ccoutant@google.com>
3791
3792 PR gold/12220
3793 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3794 Check for ".zdebug_line".
3795
3796 2010-11-16 Doug Kwan <dougkwan@google.com>
3797 Cary Coutant <ccoutant@google.com>
3798
3799 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3800 by reference; adjust all callers.
3801 * output.cc (Output_segment::set_section_addresses): Adjust references
3802 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3803 list is empty.
3804 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3805 end at page boundary.
3806
3807 2010-11-16 Cary Coutant <ccoutant@google.com>
3808
3809 PR gold/12220
3810 * layout.cc (Layout::choose_output_section): Transform names of
3811 compressed sections even when using a script with a SECTIONS clause.
3812 (Layout::output_section_name): Remove code to transform
3813 compressed debug section names.
3814 * output.cc (Output_section::add_input_section): Use uncompressed
3815 section size when tracking input sections.
3816
3817 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3818
3819 * symtab.h (Symbol::NON_PIC_REF): Remove.
3820 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3821 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3822 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3823 (Symbol::use_plt_offset): Take a flags argument and pass it
3824 directly to needs_dynamic_reloc. Restrict check for undefined
3825 weak symbols to function calls.
3826 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3827 (Target_arm::Scan::global): Use it.
3828 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3829 (Target_arm::Relocate::relocate): Likewise.
3830 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3831 parameter with an r_type parameter. Use get_reference_flags
3832 to get the flags.
3833 (Target_arm::Relocate::relocate): Update accordingly.
3834 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3835 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3836 (Target_i386::Scan::global): Likewise.
3837 (Target_i386::Relocate::relocate): Likewise.
3838 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3839 parameter with an r_type parameter. Use get_reference_flags
3840 to get the flags.
3841 (Target_i386::Relocate::relocate): Update accordingly.
3842 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3843 (Target_powerpc::Scan::global): Use it.
3844 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3845 (Target_powerpc::Relocate::relocate): Likewise.
3846 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3847 (Target_sparc::Scan::global): Use it.
3848 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3849 (Target_sparc::Relocate::relocate): Likewise.
3850 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3851 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3852 (Target_x86_64::Scan::global): Likewise.
3853 (Target_x86_64::Relocate::relocate): Likewise.
3854
3855 2010-11-08 Doug Kwan <dougkwan@google.com>
3856 Cary Coutant <ccoutant@google.com>
3857
3858 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3859 (Arm_exidx_merge_section::section_contents_): New data member.
3860 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3861 (Arm_input_section::~Arm_input_section): De-allocate memory.
3862 (Arm_input_section::original_contents_): New data member.
3863 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3864 in parameters instead of calling Object::section_contents without
3865 locking.
3866 (Arm_output_section::group_section): New parameter TASK. Pass it
3867 to callees that need locking objects.
3868 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3869 to lock EXIDX input sections. Fix a formatting issue. Call
3870 Arm_exidx_merged_section::build_contents to create merged section
3871 contents.
3872 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3873 to lock object of stub table owner.
3874 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3875 TEXT_SIZE to initialize data member TEXT_SIZE_.
3876 (Arm_exidx_input_section::addralign): Fix typo in comment.
3877 (Arm_exidx_input_section::text_size): New method.
3878 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3879 that require locking objects. Lock objects before scanning for stubs
3880 and updating local symbols.
3881 (Arm_input_section<big_endian>::init): Copy contents of original
3882 input section.
3883 (Arm_input_section<big_endian>::do_write): Use saved contents of
3884 original input section instead of calling Object::section_contents
3885 without locking.
3886 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3887 size without calling Object::section_size().
3888 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3889 for size. Allocate a buffer for merged EXIDX entries.
3890 (Arm_exidx_merged_section::build_contents): New method.
3891 (Arm_exidx_merged_section::do_write): Move merge section contents
3892 building code to Arm_exidx_merged_section::build_contetns. Write
3893 out contetns in buffer instead of building it on the fly.
3894 (Arm_relobj::make_exidx_input_section): Also pass text section size
3895 to Arm_exidx_input_section constructor.
3896 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3897 (Arm_dynobj::do_read_symbols): Fix memory leak.
3898 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3899 * target.h: (class Task): Add forward declaration.
3900 (Target::relax): Add new parameter TASK and pass it to
3901 Target::do_relax().
3902 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3903
3904 2010-11-05 Cary Coutant <ccoutant@google.com>
3905
3906 PR gold/10708
3907 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3908 object when reading from the file.
3909 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3910 second layout pass.
3911 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3912 when reading section contents.
3913 (get_section_contents): Likewise.
3914 (icf::find_identical_sections): Likewise.
3915 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3916 object when reading from the file.
3917 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3918 the object when doing deferred section layout.
3919
3920 2010-11-03 Nick Clifton <nickc@redhat.com>
3921
3922 PR gold/12001
3923 * script.h (class Symbol_assignment: name): New member. Returns
3924 the name of the symbol.
3925 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3926 Returns true if the given symbol name is on the list of
3927 assignments wating to be processed.
3928 * archive.cc (should_incldue_member): If the symbol is undefined,
3929 check to see if it is on the list of symbols pending assignment.
3930
3931 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3932
3933 * script-sections.cc (Script_sections::find_memory_region): Check
3934 for a NULL output section pointer.
3935
3936 2010-10-29 Doug Kwan <dougkwan@google.com>
3937
3938 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3939 Output_section::add_relaxed_input_section.
3940 * output.cc (Output_section::add_relaxed_input_section): Add new
3941 arguments LAYOUT and NAME. Set section order index.
3942 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3943 Copy section order index.
3944 * output.h (Output_section::add_relaxed_input_section): Add new
3945 arguments LAYOUT and NAME.
3946
3947 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3948
3949 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3950 NATIVE_OR_CROSS_LINKER.
3951 * testsuite/Makefile.in: Regenerate.
3952
3953 2010-10-20 Doug Kwan <dougkwan@google.com>
3954
3955 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3956 without SHF_LINK_ORDER flags.
3957 * layout.cc (Layout::choose_output_section): Do not filter
3958 SHF_LINK_ORDER flag in a relocatable link.
3959
3960 2010-10-17 Cary Coutant <ccoutant@google.com>
3961
3962 * output.h (Output_segment::set_section_addresses): Change function
3963 signature. Update all callers.
3964 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3965 sections.
3966 (Output_segment::set_section_addresses): Align after last TLS
3967 section. Add padding before last relro section instead of after.
3968
3969 2010-10-17 Doug Kwan <dougkwan@google.com>
3970
3971 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3972 GOT output section to be writable.
3973
3974 2010-10-14 Cary Coutant <ccoutant@google.com>
3975
3976 * debug.h (DEBUG_INCREMENTAL): New flag.
3977 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3978 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3979 mode.
3980 * incremental.cc (report_command_line): Ignore all forms of
3981 --incremental.
3982 * layout.cc (Layout::Layout): Check parameters for incremental link
3983 mode.
3984 * options.cc (General_options::parse_incremental): New function.
3985 (General_options::parse_no_incremental): New function.
3986 (General_options::parse_incremental_full): New function.
3987 (General_options::parse_incremental_update): New function.
3988 (General_options::incremental_mode_): New data member.
3989 (General_options::finalize): Check incremental_mode_.
3990 * options.h (General_options): Update help text for --incremental.
3991 Add --no-incremental, --incremental-full, --incremental-update.
3992 (General_options::Incremental_mode): New enum type.
3993 (General_options::incremental_mode): New function.
3994 (General_options::incremental_mode_): New data member.
3995 * parameters.cc (Parameters::incremental_mode_): New data member.
3996 (Parameters::set_options): Set incremental_mode_.
3997 (Parameters::set_incremental_full): New function.
3998 (Parameters::incremental): New function.
3999 (Parameters::incremental_update): New function.
4000 (set_parameters_incremental_full): New function.
4001 * parameters.h (Parameters::set_incremental_full): New function.
4002 (Parameters::incremental): New function.
4003 (Parameters::incremental_update): New function.
4004 (Parameters::incremental_mode_): New data member.
4005 (set_parameters_incremental_full): New function.
4006 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4007 incremental link mode.
4008 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4009 (Sized_relobj::do_relocate_sections): Likewise.
4010 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4011 option.
4012 * testsuite/Makefile.in: Regenerate.
4013 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4014
4015 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4016
4017 * script-sections.h (class Script_sections): Make
4018 Sections_elements typedef public.
4019 * script-sections.cc (class Sort_output_sections): Add elements_
4020 field. Add constructor which sets it; change all callers.
4021 (Sort_output_sections::is_before): New function.
4022 (Sort_output_sections::operator()): Call is_before.
4023 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4024 conditional.
4025 * testsuite/script_test_10.sh: New test. Test script section
4026 order.
4027 * testsuite/script_test_10.t: Likewise.
4028 * testsuite/script_test_10.s: Likewise.
4029 * testsuite/Makefile.am: Wrap the cross linker tests and the
4030 common tests into NATIVE_OR_CROSS_LINKER.
4031 (check_SCRIPTS): Add script_test_10.sh.
4032 (check_DATA): Add script_test_10.stdout.
4033 (script_test_10.o, script_test_10): New targets.
4034 (script_test_10.stdout): New target.
4035 * configure, testsuite/Makefile.in: Regenerate.
4036
4037 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4038
4039 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4040 error for the deprecated relocations.
4041 (Target_arm::Scan::global): Likewise.
4042 (Target_arm::Relocate::relocate): Likewise.
4043
4044 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4045
4046 * fileread.cc (Input_file::find_file): Initialize *found_name
4047 and *namep when using the fallback search for case 4.
4048
4049 2010-10-11 Cary Coutant <ccoutant@google.com>
4050
4051 * options.h (class General_options): Redefine -z lazy as an alias for
4052 the negation of -z now.
4053
4054 2010-10-11 Ian Lance Taylor <iant@google.com>
4055
4056 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4057 binding.
4058
4059 2010-10-06 Nick Clifton <nickc@redhat.com>
4060
4061 * script-sections.cc(class Memory_region): Remove
4062 current_lma_offset_ field. Rename current_vma_offset_ to
4063 current_offset_. Add last_section_ field.
4064 (Memory_region::get_current_vma_address): Rename to
4065 get_current_address.
4066 (Memory_region::get_current_lma_address): Delete.
4067 (Memory_region::increment_vma_offset): Rename to
4068 increment_offset.
4069 (Memory_region::increment_lma_offset): Delete.
4070 (Memory_region::attributes_compatible): New method. Returns
4071 true if the provided section is compatible with the region.
4072 (Memory_region::get_last_section): New method. Returns the last
4073 section to use the region.
4074 (Memory_region::set_last_section): New method. Stores the last
4075 section to use the region.
4076 (Script_sections::block_in_region): New method. Returns true if
4077 a block of memory is contained within a region.
4078 (Script_sections::find_memory_region): New method. Locates a
4079 memory region to be used to set a VMA or LMA address.
4080 (Output_section_definition::set_section_addresses): Add code to
4081 check for addresses set by memory regions.
4082 (Output_segment::set_section_addresses): Remove memory region
4083 walking code.
4084 (Script_sections::create_segment): Add a warning if a header
4085 segment is created outside of any region.
4086 * script-sections.h (class Script_sections): Add prototypes for
4087 find_memory_region and block_in_region methods.
4088 * testsuite/memory_test.s: Use .long instead of .word.
4089 * testsuite/memory_test.t: Add some more output sections.
4090 * testsuite/memory_test.sh: Update expected output.
4091
4092 2010-10-02 Doug Kwan <dougkwan@google.com>
4093
4094 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4095 defintion to symtab.h
4096 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4097 declaration to defintion.
4098
4099 2010-10-01 Nick Clifton <nickc@redhat.com>
4100
4101 * expression.cc (eval): Replace dummy argument with NULL.
4102 (eval_maybe_dot): Check for a NULL result section pointer.
4103 (Symbol_expression::value): Likewise.
4104 (Dot_expression::value): Likewise.
4105 (BINARY_EXPRESSION): Likewise.
4106 (Max_expression::value): Likewise.
4107 (Min_expression::value): Likewise.
4108 (Absolute_expression::value): Likewise.
4109 (Addr_expression::value_from_output_section): Likewise.
4110 (Loaddddr_expression::value_from_output_section): Likewise.
4111 (Segment_start_expression::value): Likewise.
4112 * script-sections.cc
4113 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4114 argument with NULL.
4115 (Sections_elememt_dot_assignment::set_section_addresses):
4116 Likewise.
4117 (Output_data_expression::do_write_to_buffer): Likewise.
4118 (Output_section_definition::finalize_symbols): Likewise.
4119 (Output_section_definition::set_section_addresses): Likewise.
4120
4121 2010-09-30 Doug Kwan <dougkwan@google.com>
4122
4123 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4124
4125 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4126
4127 * target.h (Target::can_icf_inline_merge_sections): New virtual
4128 function.
4129 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4130 virtual function.
4131 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4132 virtual function.
4133 * icf.cc (get_section_contents): Inline merge sections only when
4134 target allows it.
4135
4136 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4137
4138 * configure: Regenerate.
4139
4140 2010-09-17 Ian Lance Taylor <iant@google.com>
4141
4142 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4143 * testsuite/Makefile.am (memory_test.o): New target.
4144 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4145 memory_test.t.
4146 * testsuite/Makefile.in: Rebuild.
4147
4148 2010-09-17 Doug Kwan <dougkwan@google.com>
4149
4150 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4151 defintion if relocation uses GOT entries of the symbol.
4152 * testsuite/icf_safe_test.sh: Fix test.
4153 * testsuite/icf_safe_so_test.sh: Fix test.
4154
4155 2010-09-16 Cary Coutant <ccoutant@google.com>
4156
4157 * script_sections.cc (class Memory_region): Remove "NULL" from
4158 vector initializations.
4159
4160 2010-09-15 Cary Coutant <ccoutant@google.com>
4161
4162 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4163 Resolve forwarding symbols.
4164
4165 2010-09-15 Doug Kwan <dougkwan@google.com>
4166
4167 * gold/testsuite/script_test_3.t: Add ARM special sections.
4168 * gold/testsuite/script_test_4.t: Same.
4169 * gold/testsuite/script_test_5.t: Same.
4170 * gold/testsuite/script_test_6.t: Same.
4171 * gold/testsuite/script_test_7.t: Same.
4172 * gold/testsuite/script_test_7.t: Same.
4173 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4174
4175 2010-09-14 Cary Coutant <ccoutant@google.com>
4176
4177 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4178 (Target_x86_64::Relocate::relocate_tls): Replace check for
4179 saw_tls_block_reloc_ with test for executable section.
4180
4181 2010-09-12 Cary Coutant <ccoutant@google.com>
4182
4183 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4184 position-independent executables to shared libraries need dynamic
4185 relocations.
4186 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4187 position-independent executables.
4188 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4189 * testsuite/Makefile.in: Regenerate.
4190
4191 2010-09-10 Nick Clifton <nickc@redhat.com>
4192
4193 PR gold/11997
4194 * testsuite/memory_test.t: Discard any sections that are not
4195 needed.
4196
4197 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4198
4199 PR gold/11996
4200 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4201 "This::" to work around a bug in gcc 4.2.
4202
4203 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4204
4205 2010-09-09 Rafael Espindola <espindola@google.com>
4206
4207 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4208 sections with different PF_X flags in the same segment.
4209 (Layout::find_first_load_seg): Search all segments to find the first
4210 one.
4211 * options.h (rosegment): New.
4212
4213 2010-09-08 Rafael Espindola <espindola@google.com>
4214
4215 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4216
4217 2010-09-08 Doug Kwan <dougkwan@google.com>
4218
4219 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4220 (Arm_relobj::do_relocate_sections): Add new parameter for output
4221 file to match the parent.
4222 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4223 of local symbols instead of input values. Update code to track
4224 changes in gold::relocate_section.
4225 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4226 (Sized_relobj::compute_final_local_value_internal): New methods.
4227 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4228 body into private version of Sized_relobj::compute_final_local_value.
4229 Call the inline method.
4230 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4231 merged symbol value if there is one.
4232 (Symbol_value::has_output_value): New method defintiion.
4233 (Sized_relobj::Compute_final_local_value_status): New enum type.
4234 (Sized_relobj::compute_final_local_value): New methods.
4235 (Sized_relobj::compute_final_local_value_internal): New methods.
4236 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4237 and arm_cortex_a8.sh.
4238 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4239 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4240 New tests.
4241 * Makefile.in: Regenerate.
4242 * testsuite/arm_bl_out_of_range.s: Update test.
4243 * testsuite/thumb_bl_out_of_range.s: Ditto.
4244 * testsuite/thumb_blx_out_of_range.s: Ditto.
4245 * testsuite/arm_branch_out_of_range.sh: New file.
4246 * testsuite/arm_cortex_a8.sh: Ditto.
4247 * testsuite/arm_cortex_a8_b.s: Ditto.
4248 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4249 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4250 * testsuite/arm_cortex_a8_bl.s: Ditto.
4251 * testsuite/arm_cortex_a8_blx.s: Ditto.
4252 * testsuite/arm_cortex_a8_local.s: Ditto.
4253 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4254 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4255
4256 2010-09-08 Rafael Espindola <espindola@google.com>
4257
4258 * Makefile.am (memory_test.stdout): Run readelf with -W.
4259 * Makefile.in: Regenerate.
4260 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4261 64 bit output.
4262
4263 2010-09-08 Rafael Espindola <espindola@google.com>
4264
4265 * script-sections.cc (Script_sections::add_memory_region): Convert
4266 field precision to int.
4267 * script.cc (script_set_section_region, script_set_section_region):
4268 Convert field precision to int.
4269
4270 2010-09-08 Rafael Espindola <espindola@google.com>
4271
4272 * arm.cc (do_finalize_sections): Create the __exidx_start and
4273 __exdix_end symbols even when the section is missing.
4274
4275 2010-09-08 Nick Clifton <nickc@redhat.com>
4276
4277 * README: Remove claim that MEMORY is not supported.
4278 * expression.cc (script_exp_function_origin)
4279 (script_exp_function_length): Move from here to ...
4280 * script.cc: ... here.
4281 (script_set_section_region, script_add_memory)
4282 (script_parse_memory_attr, script_include_directive): New
4283 functions.
4284 * script-sections.cc
4285 (class Memory_region): New class.
4286 (class Output_section_definition): Add set_memory_region,
4287 set_section_vma, set_section_lma and get_section_name methods.
4288 (class Script_Sections): Add add_memory_region,
4289 find_memory_region, find_memory_region_origin,
4290 find_memory_region_length and set_memory_region methods.
4291 Have set_section_addresses method walk the list of set memory
4292 regions.
4293 Extend the print methos to display memory regions.
4294 * script-sections.h: Add prototypes for new methods.
4295 Add enum for MEMORY region attributes.
4296 * yyscript.y: Add support for parsing MEMORY regions.
4297 * script-c.h: Add prototypes for new functions.
4298 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4299 * testsuite/Makefile.in: Regenerate.
4300 * testsuite/memory_test.sh: New script.
4301 * testsuite/memory_test.s: New assembler source file.
4302 * testsuite/memory_test.t: New linker script.
4303
4304 2010-08-27 Doug Kwan <dougkwan@google.com>
4305
4306 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4307 reference override an existing dynamic weak reference.
4308 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4309 * testsuite/Makefile.in: Regenerate.
4310 * testsuite/dyn_weak_ref.sh: New file.
4311 * testsuite/dyn_weak_ref_1.c: Ditto.
4312 * testsuite/dyn_weak_ref_2.c: Ditto.
4313
4314 2010-08-27 Ian Lance Taylor <iant@google.com>
4315
4316 * incremental.h (class Incremental_input_entry): Add virtual
4317 destructor.
4318
4319 2010-08-27 Ian Lance Taylor <iant@google.com>
4320
4321 * testsuite/start_lib_test_3.c: Mark t3 as used.
4322
4323 2010-08-27 Nick Clifton <nickc@redhat.com>
4324
4325 * options.cc (version_script): Fix small typo in previous
4326 whitespace tidyup.
4327
4328 2010-08-25 Nick Clifton <nickc@redhat.com>
4329
4330 * archive.cc: Formatting fixes: Remove whitespace between
4331 typename and following asterisk. Remove whitespace between
4332 function name and opening parenthesis.
4333 * archive.h: Likewise.
4334 * arm.cc: Likewise.
4335 * attributes.cc: Likewise.
4336 * attributes.h: Likewise.
4337 * common.cc: Likewise.
4338 * copy-relocs.cc: Likewise.
4339 * dirsearch.h: Likewise.
4340 * dynobj.cc: Likewise.
4341 * ehframe.cc: Likewise.
4342 * ehframe.h: Likewise.
4343 * expression.cc: Likewise.
4344 * fileread.cc: Likewise.
4345 * fileread.h: Likewise.
4346 * gc.h: Likewise.
4347 * gold-threads.cc: Likewise.
4348 * gold.cc: Likewise.
4349 * i386.cc: Likewise.
4350 * icf.h: Likewise.
4351 * incremental-dump.cc: Likewise.
4352 * incremental.cc: Likewise.
4353 * layout.cc: Likewise.
4354 * layout.h: Likewise.
4355 * main.cc: Likewise.
4356 * merge.cc: Likewise.
4357 * merge.h: Likewise.
4358 * object.cc: Likewise.
4359 * object.h: Likewise.
4360 * options.cc: Likewise.
4361 * options.h: Likewise.
4362 * output.cc: Likewise.
4363 * output.h: Likewise.
4364 * plugin.cc: Likewise.
4365 * plugin.h: Likewise.
4366 * powerpc.cc: Likewise.
4367 * reloc.cc: Likewise.
4368 * script-c.h: Likewise.
4369 * script-sections.cc: Likewise.
4370 * script.cc: Likewise.
4371 * stringpool.cc: Likewise.
4372 * symtab.cc: Likewise.
4373 * symtab.h: Likewise.
4374 * target.cc: Likewise.
4375 * timer.cc: Likewise.
4376 * timer.h: Likewise.
4377 * version.cc: Likewise.
4378 * x86_64.cc: Likewise.
4379
4380 2010-08-24 Nick Clifton <nickc@redhat.com>
4381
4382 PR 11899
4383 * layout.cc (segment_precedes): Sort segments by their physical
4384 addresses, if they have been set.
4385
4386 2010-08-23 Cary Coutant <ccoutant@google.com>
4387
4388 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4389 symbols data.
4390 (Lib_group::include_member): Unlock object after deleting its
4391 symbols data.
4392 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4393 the bug fixed here.
4394
4395 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4396 Cary Coutant <ccoutant@google.com>
4397
4398 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4399 constructor, and set_blocker.
4400 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4401 readsyms_blocker_.
4402 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4403 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4404 * testsuite/Makefile.am (start_lib_test): New test case.
4405 * testsuite/Makefile.in: Regenerate.
4406 * testsuite/start_lib_test_main.c: New file.
4407 * testsuite/start_lib_test_1.c: New file.
4408 * testsuite/start_lib_test_2.c: New file.
4409 * testsuite/start_lib_test_3.c: New file.
4410
4411 2010-08-19 Ian Lance Taylor <iant@google.com>
4412
4413 * Makefile.in: Rebuild with automake 1.11.1.
4414 * aclocal.m4: Likewise.
4415 * testsuite/Makefile.in: Likewise.
4416
4417 2010-08-19 Ian Lance Taylor <iant@google.com>
4418
4419 PR 10893
4420 * i386.cc (class Output_data_plt_i386): Update declarations.
4421 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4422 local_ifuncs_ fields.
4423 (Target_i386::do_plt_section_for_global): New function.
4424 (Target_i386::do_plt_section_for_local): New function.
4425 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4426 parameter; change all callers. Initialize global_ifuncs_ and
4427 local_ifuncs_. If doing a static link define __rel_iplt_start and
4428 __rel_iplt_end.
4429 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4430 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4431 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4432 symbols.
4433 (Target_i386::make_plt_section): New function, broken out of
4434 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4435 (Target_i386::make_plt_entry): Call make_plt_section.
4436 (Target_i386::make_local_ifunc_plt_entry): New function.
4437 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4438 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4439 R_386_IRELATIVE to switch.
4440 (Target_i386::Scan::global): Likewise.
4441 (Target_i386::Relocate::relocate): Likewise.
4442 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4443 switch.
4444 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4445 (Target_x86_64::do_plt_section_for_global): New function.
4446 (Target_x86_64::do_plt_section_for_local): New function.
4447 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4448 parameter; change all callers. If doing a static link define
4449 __rela_iplt_start and __rela_iplt_end.
4450 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4451 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4452 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4453 to point to .plt.
4454 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4455 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4456 switch.
4457 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4458 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4459 R_X86_64_IRELATIVE to switch.
4460 (Target_x86_64::Scan::global): Likewise.
4461 (Target_x86_64::Relocate::relocate): Likewise.
4462 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4463 switch.
4464 * target.h (class Target): Add plt_section_for_global and
4465 plt_section_for_local functions. Add do_plt_section_for_global
4466 and do_plt_section_for_local virtual functions.
4467 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4468 clarifying comments.
4469 (Symbol::use_plt_offset): Handle IFUNC symbol.
4470 * object.cc (Sized_relobj::Sized_relobj): Initialize
4471 local_plt_offsets_.
4472 (Sized_relobj::local_has_plt_offset): New function.
4473 (Sized_relobj::local_plt_offset): New function.
4474 (Sized_relobj::set_local_plt_offset): New function.
4475 (Sized_relobj::do_count): Handle IFUNC symbol.
4476 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4477 a bit away from input_shndx_ field. Add set_is_func_symbol and
4478 is_ifunc_symbol functions.
4479 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4480 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4481 local_plt_offsets_ field.
4482 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4483 * output.h (class Output_section_data): Add non-const
4484 output_section function.
4485 (class Output_data_got): Update declarations.
4486 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4487 Add use_plt_offset parameter to global and local constructors.
4488 Change all callers. Change local_sym_index_ field to 31 bits.
4489 Change GSYM_CODE and CONSTANT_CODE accordingly.
4490 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4491 doing a static link don't set sh_link field.
4492 (Output_data_got::Got_entry::write): Use PLT offset if
4493 appropriate.
4494 (Output_data_got::add_global_plt): New function.
4495 (Output_data_got::add_local_plt): New function.
4496 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4497 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4498 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4499 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4500 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4501 IFUNC conditional.
4502 * testsuite/ifunc-sel.h: New file.
4503 * testsuite/ifuncmain1.c: New file.
4504 * testsuite/ifuncmain1vis.c: New file.
4505 * testsuite/ifuncmod1.c: New file.
4506 * testsuite/ifuncdep2.c: New file.
4507 * testsuite/ifuncmain2.c: New file.
4508 * testsuite/ifuncmain3.c: New file.
4509 * testsuite/ifuncmod3.c: New file.
4510 * testsuite/ifuncmain4.c: New file.
4511 * testsuite/ifuncmain5.c: New file.
4512 * testsuite/ifuncmod5.c: New file.
4513 * testsuite/ifuncmain6pie.c: New file.
4514 * testsuite/ifuncmod6.c: New file.
4515 * testsuite/ifuncmain7.c: New file.
4516 * configure, testsuite/Makefile.in: Rebuild.
4517
4518 2010-08-18 Ian Lance Taylor <iant@google.com>
4519
4520 * incremental.cc
4521 (Output_section_incremental_inputs::write_input_files): Add cast
4522 to avoid signed/unsigned comparison warning.
4523 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4524
4525 2010-08-12 Cary Coutant <ccoutant@google.com>
4526
4527 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4528
4529 2010-08-13 Ian Lance Taylor <iant@google.com>
4530
4531 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4532
4533 2010-08-12 Cary Coutant <ccoutant@google.com>
4534 Doug Kwan <dougkwan@google.com>
4535
4536 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4537 defintion overrides non-weak undef, remember that the original undef
4538 is not weak.
4539 * symtab.cc (Symbol_table::sized_write_global): For undef without
4540 an original weak binding, set binding to global in output.
4541 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4542 * testsuite/Makefile.in: Regenerate.
4543 * testsuite/strong_ref_weak_def.sh: New file.
4544 * testsuite/strong_ref_weak_def_1.c: Ditto.
4545 * testsuite/strong_ref_weak_def_2.c: Ditto.
4546
4547 2010-08-12 Cary Coutant <ccoutant@google.com>
4548
4549 * testsuite/incremental_test.sh: Rewrite.
4550 * testsuite/incremental_test_1.c: Rewrite.
4551 * testsuite/incremental_test_2.c: Rewrite.
4552
4553 2010-08-12 Cary Coutant <ccoutant@google.com>
4554
4555 * arm.cc (Target_arm::got_size): Add const.
4556 (Target_arm::got_entry_count): New function.
4557 (Target_arm::plt_entry_count): New function.
4558 (Target_arm::first_plt_entry_offset): New function.
4559 (Target_arm::plt_entry_size): New function.
4560 (Output_data_plt_arm::entry_count): New function.
4561 (Output_data_plt_arm::first_plt_entry_offset): New function.
4562 (Output_data_plt_arm::get_plt_entry_size): New function.
4563 * i386.cc (Target_i386::got_size): Add const.
4564 (Target_i386::got_entry_count): New function.
4565 (Target_i386::plt_entry_count): New function.
4566 (Target_i386::first_plt_entry_offset): New function.
4567 (Target_i386::plt_entry_size): New function.
4568 (Output_data_plt_i386::entry_count): New function.
4569 (Output_data_plt_i386::first_plt_entry_offset): New function.
4570 (Output_data_plt_i386::get_plt_entry_size): New function.
4571 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4572 find_incremental_inputs_sections. Dump incremental_got_plt section.
4573 * incremental.cc: Include target.h.
4574 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4575 parameter. Adjust all callers. Find incremental_got_plt section.
4576 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4577 section.
4578 (Output_section_incremental_inputs::set_final_data_size): Calculate
4579 size of incremental_got_plt section.
4580 (Output_section_incremental_inputs::do_write): Write the
4581 incremental_got_plt section.
4582 (Got_plt_view_info): New struct.
4583 (Local_got_offset_visitor): New class.
4584 (Global_got_offset_visitor): New class.
4585 (Global_symbol_visitor_got_plt): New class.
4586 (Output_section_incremental_inputs::write_got_plt): New function.
4587 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4588 Add parameter. Adjust all callers.
4589 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4590 (Incremental_inputs::got_plt_section): New function.
4591 (Incremental_inputs::got_plt_section_): New data member.
4592 (Incremental_got_plt_reader): New class.
4593 * layout.cc (Layout::create_incremental_info_sections): Add the
4594 incremental_got_plt section.
4595 * object.h (Got_offset_list::get_list): New function.
4596 (Got offset_list::for_all_got_offsets): New function.
4597 (Sized_relobj::local_got_offset_list): New function.
4598 * powerpc.cc (Target_powerpc::got_size): Add const.
4599 (Target_powerpc::got_entry_count): New function.
4600 (Target_powerpc::plt_entry_count): New function.
4601 (Target_powerpc::first_plt_entry_offset): New function.
4602 (Target_powerpc::plt_entry_size): New function.
4603 (Output_data_plt_powerpc::entry_count): New function.
4604 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4605 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4606 * sparc.cc (Target_sparc::got_size): Add const.
4607 (Target_sparc::got_entry_count): New function.
4608 (Target_sparc::plt_entry_count): New function.
4609 (Target_sparc::first_plt_entry_offset): New function.
4610 (Target_sparc::plt_entry_size): New function.
4611 (Output_data_plt_sparc::entry_count): New function.
4612 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4613 (Output_data_plt_sparc::get_plt_entry_size): New function.
4614 * symtab.h (Symbol::got_offset_list): New function.
4615 (Symbol_table::for_all_symbols): New function.
4616 * target.h (Sized_target::got_entry_count): New function.
4617 (Sized_target::plt_entry_count): New function.
4618 (Sized_target::plt_entry_size): New function.
4619 * x86_64.cc (Target_x86_64::got_size): Add const.
4620 (Target_x86_64::got_entry_count): New function.
4621 (Target_x86_64::plt_entry_count): New function.
4622 (Target_x86_64::first_plt_entry_offset): New function.
4623 (Target_x86_64::plt_entry_size): New function.
4624 (Output_data_plt_x86_64::entry_count): New function.
4625 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4626 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4627
4628 2010-08-12 Cary Coutant <ccoutant@google.com>
4629
4630 * archive.cc: Include incremental.h.
4631 (Archive::Archive): Initialize incremental_info_.
4632 (Archive::include_member): Record archive members in incremental info.
4633 (Add_archive_symbols::run): Record begin and end of an archive in
4634 incremental info.
4635 (Lib_group::include_member): Record objects in incremental info.
4636 * archive.h (Incremental_archive_entry): Forward declaration.
4637 (Archive::set_incremental_info): New member function.
4638 (Archive::incremental_info): New member function.
4639 (Archive::Unused_symbol_iterator): New class.
4640 (Archive::unused_symbols_begin): New member function.
4641 (Archive::unused_symbols_end): New member function.
4642 (Archive::incremental_info_): New data member.
4643 * incremental-dump.cc (find_input_containing_global): New function.
4644 (dump_incremental_inputs): Dump new incremental info sections.
4645 * incremental.cc: Include symtab.h.
4646 (Output_section_incremental_inputs): New class.
4647 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4648 new incremental info sections.
4649 (Sized_incremental_binary::do_check_inputs): Likewise.
4650 (Incremental_inputs::report_archive): Remove.
4651 (Incremental_inputs::report_archive_begin): New function.
4652 (Incremental_inputs::report_archive_end): New function.
4653 (Incremental_inputs::report_object): New function.
4654 (Incremental_inputs::finalize_inputs): Remove.
4655 (Incremental_inputs::report_input_section): New function.
4656 (Incremental_inputs::report_script): Rewrite.
4657 (Incremental_inputs::finalize): Do nothing but finalize string table.
4658 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4659 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4660 (Incremental_inputs::create_data_sections): New function.
4661 (Incremental_inputs::relocs_entsize): New function.
4662 (Output_section_incremental_inputs::set_final_data_size): New function.
4663 (Output_section_incremental_inputs::do_write): New function.
4664 (Output_section_incremental_inputs::write_header): New function.
4665 (Output_section_incremental_inputs::write_input_files): New function.
4666 (Output_section_incremental_inputs::write_info_blocks): New function.
4667 (Output_section_incremental_inputs::write_symtab): New function.
4668 * incremental.h (Incremental_script_entry): Forward declaration.
4669 (Incremental_object_entry): Forward declaration.
4670 (Incremental_archive_entry): Forward declaration.
4671 (Incremental_inputs): Forward declaration.
4672 (Incremental_inputs_header_data): Remove.
4673 (Incremental_inputs_header): Remove.
4674 (Incremental_inputs_header_write): Remove.
4675 (Incremental_inputs_entry_data): Remove.
4676 (Incremental_inputs_entry): Remove.
4677 (Incremental_inputs_entry_write): Remove.
4678 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4679 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4680 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4681 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4682 Likewise.
4683 (Incremental_input_entry): New class.
4684 (Incremental_script_entry): New class.
4685 (Incremental_object_entry): New class.
4686 (Incremental_archive_entry): New class.
4687 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4688 (Incremental_inputs::report_inputs): Remove.
4689 (Incremental_inputs::report_archive): Remove.
4690 (Incremental_inputs::report_archive_begin): New function.
4691 (Incremental_inputs::report_archive_end): New function.
4692 (Incremental_inputs::report_object): Change prototype.
4693 (Incremental_inputs::report_input_section): New function.
4694 (Incremental_inputs::report_script): Change prototype.
4695 (Incremental_inputs::get_reloc_count): New function.
4696 (Incremental_inputs::set_reloc_count): New function.
4697 (Incremental_inputs::create_data_sections): New function.
4698 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4699 (Incremental_inputs::inputs_section): New function.
4700 (Incremental_inputs::symtab_section): New function.
4701 (Incremental_inputs::relocs_section): New function.
4702 (Incremental_inputs::get_stringpool): Add const.
4703 (Incremental_inputs::command_line): Add const.
4704 (Incremental_inputs::inputs): Remove.
4705 (Incremental_inputs::command_line_key): New function.
4706 (Incremental_inputs::input_file_count): New function.
4707 (Incremental_inputs::input_files): New function.
4708 (Incremental_inputs::relocs_entsize): New function.
4709 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4710 (Incremental_inputs::finalize_inputs): Remove.
4711 (Incremental_inputs::Input_info): Remove.
4712 (Incremental_inputs::lock_): Remove.
4713 (Incremental_inputs::inputs_): Change type.
4714 (Incremental_inputs::inputs_map_): Remove.
4715 (Incremental_inputs::current_object_entry_): New data member.
4716 (Incremental_inputs::inputs_section_): New data member.
4717 (Incremental_inputs::symtab_section_): New data member.
4718 (Incremental_inputs::relocs_section_): New data member.
4719 (Incremental_inputs::reloc_count_): New data member.
4720 (Incremental_inputs_reader): New class.
4721 (Incremental_symtab_reader): New class.
4722 (Incremental_relocs_reader): New class.
4723 * layout.cc (Layout::finalize): Move finalization of incremental info
4724 and creation of incremental info sections to follow finalization of
4725 symbol table. Set offsets for postprocessing sections.
4726 (Layout::create_incremental_info_sections): Call
4727 Incremental_inputs::create_data_sections. Add incremental symtab
4728 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4729 sections to layout after input sections.
4730 * layout.h (struct Timespec): Forward declaration.
4731 (Layout::incremental_inputs): Add const.
4732 (Layout::create_incremental_info_sections): Add parameter.
4733 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4734 * object.cc: Include incremental.h.
4735 (Relobj::finalize_incremental_relocs): New function.
4736 (Sized_relobj::do_layout): Record input sections in incremental info.
4737 * object.h (Object::output_section): New function.
4738 (Object::output_section_offset): Moved from Relobj.
4739 (Object::get_incremental_reloc_base): New function.
4740 (Object::get_incremental_reloc_count): New function.
4741 (Object::do_output_section): New function.
4742 (Object::do_output_section_offset): Moved from Relobj.
4743 (Object::do_get_incremental_reloc_base): New function.
4744 (Object::do_get_incremental_reloc_count): New function.
4745 (Object::Object): Initialize new data members.
4746 (Relobj::output_section): Renamed do_output_section and moved to
4747 protected.
4748 (Relobj::output_section_offset): Moved to Object.
4749 (Relobj::do_get_incremental_reloc_base): New function.
4750 (Relobj::do_get_incremental_reloc_count): New function.
4751 (Relobj::allocate_incremental_reloc_counts): New function.
4752 (Relobj::count_incremental_reloc): New function.
4753 (Relobj::finalize_incremental_relocs): New function.
4754 (Relobj::next_incremental_reloc_index): New function.
4755 (Relobj::reloc_counts_): New data member.
4756 (Relobj::reloc_bases_): New data member.
4757 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4758 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4759 (Sized_relobj::incremental_relocs_scan): New function.
4760 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4761 (Sized_relobj::incremental_relocs_write): New function.
4762 (Sized_relobj::incremental_relocs_write_reltype): New function.
4763 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4764 incremental link.
4765 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4766 archives and object files elsewhere.
4767 (Add_symbols::run): Report object files here.
4768 (Finish_group::run): Report end of archive at end of group.
4769 * reloc.cc: Include layout.h, incremental.h.
4770 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4771 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4772 (Sized_relobj::incremental_relocs_scan): New function.
4773 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4774 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4775 (Sized_relobj::incremental_relocs_write): New function.
4776 (Sized_relobj::incremental_relocs_write_reltype): New function.
4777 * script.cc (read_input_script): Rewrite test for incremental link.
4778 Change call to Incremental_inputs::report_script.
4779 * symtab.h (Symbol_table::first_global_index): New function.
4780 (Symbol_table::output_count): New function.
4781
4782 2010-08-12 Doug Kwan <dougkwan@google.com>
4783
4784 * arm.cc (Target_arm::merge_object_attributes): Check command line
4785 options --no-wchar-size-warning and --no-enum-size-warning.
4786 * options.h (General_options): Add ld-compatible options
4787 --no-enum-size-warning and --no-wchar-size-warning.
4788
4789 2010-08-04 Ian Lance Taylor <iant@google.com>
4790
4791 * x86_64.cc (Target_x86_64::Scan::local): Use
4792 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4793 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4794 (Target_x86_64::Scan::global): Likewise.
4795 (Target_x86_64::Relocate::relocate): Likewise.
4796 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4797 Likewise.
4798
4799 2010-08-03 Cary Coutant <ccoutant@google.com>
4800
4801 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4802 to reserve space in merged_strings vector. Keep total input size
4803 for stats.
4804 (Output_merge_string::do_print_merge_stats): Print total input size.
4805 * merge.h (Output_merge_string): Add input_size_ field.
4806 * stringpool.cc (Stringpool_template::string_length): Move
4807 implementations out of Stringpool_template class and place in
4808 stringpool.h.
4809 * stringpool.h (string_length): Move out of Stringpool_template.
4810
4811 2010-08-03 Ian Lance Taylor <iant@google.com>
4812
4813 PR 11712
4814 * layout.cc (relaxation_loop_body): If address of load segment is
4815 set, adjust address to include headers if possible.
4816
4817 2010-08-03 Ian Lance Taylor <iant@google.com>
4818
4819 * version.cc (version_string): Bump to 1.10.
4820
4821 2010-08-03 Ian Lance Taylor <iant@google.com>
4822
4823 PR 11805
4824 * layout.h (enum Output_section_order): Define.
4825 (class Layout): Update declarations.
4826 * layout.cc (Layout::get_output_section): Add order parameter.
4827 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4828 is_first_non_relro parameters. Change all callers.
4829 (Layout::choose_output_section): Likewise.
4830 (Layout::add_output_section_data): Likewise.
4831 (Layout::make_output_section): Likewise. Set order.
4832 (Layout::default_section_order): New function.
4833 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4834 * output.cc (Output_section::Output_section): Initialize order_.
4835 Don't initialize deleted fields.
4836 (Output_segment::Output_segment): Don't initialize deleted
4837 fields.
4838 (Output_segment::add_output_section_to_load): New function
4839 replacing add_output_section. Change all callers to call this or
4840 add_output_section_to_nonload.
4841 (Output_segment::add_output_section_to_nonload): New function.
4842 (Output_segment::remove_output_section): Rewrite.
4843 (Output_segment::add_initial_output_data): Likewise.
4844 (Output_segment::has_any_data_sections): Likewise.
4845 (Output_segment::is_first_section_relro): Likewise.
4846 (Output_segment::maximum_alignment): Likewise.
4847 (Output_segment::has_dynamic_reloc): New function replacing
4848 dynamic_reloc_count. Change all callers.
4849 (Output_segment::has_dynamic_reloc_list): New function replacing
4850 dynamic_reloc_count_list. Change all callers.
4851 (Output_segment::set_section_addresses): Rewrite.
4852 (Output_segment::set_offset): Rewrite.
4853 (Output_segment::find_first_and_last_list): Remove.
4854 (Output_segment::set_tls_offsets): Rewrite.
4855 (Output_segment::first_section_load_address): Likewise.
4856 (Output_segment::output_section_count): Likewise.
4857 (Output_segment::section_with_lowest_load_address): Likewise.
4858 (Output_segment::write_section_headers): Likewise.
4859 (Output_segment::print_sections_to_map): Likewise.
4860 * output.h (class Output_data): Remove dynamic_reloc_count_
4861 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4862 (Output_data::add_dynamic_reloc): Rewrite.
4863 (Output_data::has_dynamic_reloc): New function.
4864 (Output_data::dynamic_reloc_count): Remove.
4865 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4866 is_last_relro_, is_first_non_relro_, is_interp_,
4867 is_dynamic_linker_section_ fields. Add order and set_order
4868 functions. Remove is_relro_local, set_is_relro_local,
4869 is_last_relro, set_is_last_relro, is_first_non_relro,
4870 set_is_first_non_relro functions, is_interp, set_is_interp,
4871 is_dynamic_linker_section, and set_is_dynamic_linker_section
4872 functions.
4873 (class Output_segment): Change Output_data_list from std::list to
4874 std:;vector. Add output_lists_ field. Remove output_data_ and
4875 output_bss_ fields. Update declarations.
4876
4877 2010-08-02 Ian Lance Taylor <iant@google.com>
4878
4879 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4880 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4881 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4882
4883 2010-08-02 Ian Lance Taylor <iant@google.com>
4884
4885 PR 11855
4886 * script.cc (Script_options::Script_options): Initialize
4887 symbol_definitions_ and symbol_references_.
4888 (Script_options::add_symbol_assignment): Update
4889 symbol_definitions_ and symbol_references_.
4890 (Script_options::add_symbol_reference): New function.
4891 (script_symbol): New function.
4892 * script.h (class Script_options): Add symbol_definitions_ and
4893 symbol_references_ fields.
4894 (Script_options::referenced_const_iterator): New type.
4895 (Script_options::referenced_begin): New function.
4896 (Script_options::referenced_end): New function.
4897 (Script_options::is_referenced): New function.
4898 (Script_options::any_unreferenced): New function.
4899 * script-c.h (script_symbol): Declare.
4900 * yyscript.y (exp): Call script_symbol.
4901 * symtab.cc: Include "script.h".
4902 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4903 Change all callers. Check symbols referenced by scripts.
4904 (Symbol_table::add_undefined_symbols_from_command_line): Add
4905 layout parameter. Change all callers.
4906 (Symbol_table::do_add_undefined_symbols_from_command_line):
4907 Likewise. Break out loop body. Check symbols referenced by
4908 scripts.
4909 (Symbol_table::add_undefined_symbol_from_command_line): New
4910 function broken out of
4911 do_add_undefined_symbols_from_command_line.
4912 * symtab.h (class Symbol_table): Update declarations.
4913 * archive.cc: Include "layout.h".
4914 (Archive::should_include_member): Add layout parameter. Change
4915 all callers. Check for symbol mentioned in expression.
4916 * archive.h (class Archive): Update declaration.
4917 * object.cc (Sized_relobj::do_should_include_member): Add layout
4918 parameter.
4919 * object.h (Object::should_include_member): Add layout parameter.
4920 Change all callers.
4921 (Object::do_should_include_member): Add layout parameter.
4922 (class Sized_relobj): Update declaration.
4923 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4924 parameter.
4925 * dynobj.h (class Sized_dynobj): Update declaration.
4926 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4927 layout parameter.
4928 * plugin.h (class Sized_pluginobj): Update declaration.
4929
4930 2010-08-02 Ian Lance Taylor <iant@google.com>
4931
4932 PR 11866
4933 * output.cc (Output_segment::set_offset): Search for the first and
4934 last sections rather than assuming that the list is in order.
4935 (Output_segment::find_first_and_last_list): New function.
4936 * output.h (class Output_segment): Update declarations.
4937 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4938 (relro_strip_test_SOURCES): New variable.
4939 (relro_strip_test_DEPENDENCIES): New variable.
4940 (relro_strip_test_LDFLAGS): New variable.
4941 (relro_strip_test_LDADD): New variable.
4942 (relro_strip_test.so): New target.
4943
4944 2010-08-02 Ian Lance Taylor <iant@google.com>
4945
4946 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4947 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4948 (Target_i386::got_tlsdesc_section): New function.
4949 (Target_i386::got_section): Create space for GOT entries for
4950 TLSDESC relocations.
4951 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4952 R_386_TLS_GOTDESC.
4953 (Target_i386::Scan::global): Likewise.
4954 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4955 using TLSDESC GOT.
4956 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4957 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4958 (Target_x86_64::got_tlsdesc_section): New function.
4959 (Target_x86_64::got_section): Create space for GOT entries for
4960 TLSDESC relocations.
4961 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4962 R_386_TLS_GOTDESC.
4963 (Target_x86_64::Scan::global): Likewise.
4964 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4965 using TLSDESC GOT.
4966
4967 2010-08-02 Ian Lance Taylor <iant@google.com>
4968
4969 * testsuite/final_layout.sh: Use dc to convert from hex to
4970 decimal.
4971
4972 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4973
4974 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4975 paramter to the call to gold::gc_process_relocs.
4976 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4977 paramter to the call to gold::gc_process_relocs.
4978 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4979 parameter to the call to gold::gc_process_relocs.
4980 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4981 template parameter to the call to gold::gc_process_relocs.
4982 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4983 paramter to the call to gold::gc_process_relocs.
4984 * gc.h (get_embedded_addend_size): New function.
4985 (gc_process_relocs): Save the size of the reloc for use by ICF.
4986 * icf.cc (get_section_contents): Get the addend from the text section
4987 for SHT_REL relocation sections.
4988 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4989 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4990 * int_encoding.h (read_from_pointer): New overloaded function.
4991 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4992 * testsuite/icf_sht_rel_addend_test.sh: New file.
4993 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4994 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4995
4996 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4997
4998 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4999 * Makefile.in: Regenerate.
5000 * testsuite/Makefile.in: Regenerate.
5001
5002 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5003
5004 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5005 * gold/testsuite/debug_msg.cc: Likewise.
5006 * gold/testsuite/odr_violation1.cc
5007 * gold/testsuite/odr_violation2.cc
5008
5009 2010-07-21 Cary Coutant <ccoutant@google.com>
5010
5011 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5012 string, and length fields.
5013 (Output_merge_string::Merged_strings_list): New type.
5014 (Output_merge_string::Merged_strings_lists): New typedef.
5015 (Output_merge_string): Replace merged_strings_ with
5016 merged_strings_lists_.
5017 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5018 Merged_strings_list per input object and section. Don't store pointer
5019 to the string. Don't store length with each merged string entry.
5020 (Output_merge_string::finalize_merged_data): Loop over list of merged
5021 strings lists. Recompute length of each merged string.
5022
5023 2010-07-15 Cary Coutant <ccoutant@google.com>
5024
5025 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5026 here.
5027
5028 2010-07-14 Ian Lance Taylor <iant@google.com>
5029
5030 * descriptors.cc (Descriptors::open): Report correct name in error
5031 message.
5032
5033 2010-07-13 Doug Kwan <dougkwan@google.com>
5034
5035 * arm.cc (Arm_input_section::Arm_input_section): For a
5036 SHT_ARM_EXIDX section, always keeps the input sections.
5037 (Arm_input_section::set_exidx_section_link): New method.
5038 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5039 has_errors_ to false.
5040 (Arm_exidx_input_section::has_errors,
5041 Arm_exidx_input_section::set_has_errors): New methods.
5042 (Arm_exidx_input_section::has_errors_): New data member.
5043 (Arm_relobj::get_exidx_shndx_list): New method.
5044 (Arm_output_section::append_text_sections_to_list): Do not skip
5045 section without SHF_EXECINSTR.
5046 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5047 errors.
5048 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5049 section header. Make error messages more verbose. Check for
5050 a non-executable section linked to an EXIDX section.
5051 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5052 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5053 check that there is no deferred EXIDX section if we exit early.
5054 Instead of not making an EXIDX section in case of an error, make one
5055 and set the has_errors flag of it.
5056 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5057 in a relocatable link.
5058 (Target_arm::do_relax): Look for the EXIDX output section instead of
5059 assuming that it is called .ARM.exidx.
5060 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5061 section list. Do not check for SHF_EXECINSTR section flags but
5062 skip any input section with errors.
5063 * output.cc (Output_section::Output_section): Initialize
5064 always_keeps_input_sections_ to false.
5065 (Output_section::add_input_section): Check for
5066 always_keeps_input_sections_.
5067 * output.h (Output_section::always_keeps_input_sections,
5068 Output_section::set_always_keeps_input_sections): New methods.
5069 (Output_section::always_keeps_input_sections): New data member.
5070
5071 2010-07-13 Rafael Espindola <espindola@google.com>
5072
5073 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5074 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5075
5076 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5077 Ian Lance Taylor <iant@google.com>
5078
5079 * output.h (Output_section_lookup_maps::add_merge_section):
5080 Correct check of whether value was inserted.
5081 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5082 (Output_section_lookup_maps::add_relaxed_input_section):
5083 Likewise.
5084 * arm.cc (Target_arm::got_section): Remove used local os.
5085 * i386.cc (Target_i386::got_section): Likewise.
5086 * x86_64.cc (Target_x86_64::got_section): Likewise.
5087 * sparc.cc (Target_sparc::got_section): Likewise.
5088 (Target_sparc::relocate): Remove unused local have_got_offset.
5089 * powerpc.cc (Target_powerpc::relocate): Likewise.
5090
5091 2010-07-13 Ian Lance Taylor <iant@google.com>
5092
5093 * compressed_output.cc (zlib_decompress): Fix signature in
5094 !HAVE_ZLIB_H case.
5095
5096 * archive.cc (Archive::include_member): Unlock an external member
5097 of a thin archive. Don't bother to delete an object we know is
5098 NULL.
5099
5100 2010-07-12 Cary Coutant <ccoutant@google.com>
5101
5102 * compressed_output.cc (zlib_decompress): New function.
5103 (get_uncompressed_size): New function.
5104 (decompress_input_section): New function.
5105 * compressed_output.h (get_uncompressed_size): New function.
5106 (decompress_input_section): New function.
5107 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5108 Handle compressed debug sections.
5109 * layout.cc (is_compressed_debug_section): New function.
5110 (Layout::output_section_name): Map compressed section names to
5111 canonical names.
5112 * layout.h (is_compressed_debug_section): New function.
5113 (is_debug_info_section): Recognize compressed debug sections.
5114 * merge.cc: Include compressed_output.h.
5115 (Output_merge_data::do_add_input_section): Handle compressed
5116 debug sections.
5117 (Output_merge_string::do_add_input_section): Handle compressed
5118 debug sections.
5119 * object.cc: Include compressed_output.h.
5120 (Sized_relobj::Sized_relobj): Initialize new data members.
5121 (build_compressed_section_map): New function.
5122 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5123 * object.h (Object::section_is_compressed): New method.
5124 (Object::do_section_is_compressed): New method.
5125 (Sized_relobj::Compressed_section_map): New type.
5126 (Sized_relobj::do_section_is_compressed): New method.
5127 (Sized_relobj::compressed_sections_): New data member.
5128 * output.cc (Output_section::add_input_section): Handle compressed
5129 debug sections.
5130 * reloc.cc: Include compressed_output.h.
5131 (Sized_relobj::write_sections): Handle compressed debug sections.
5132
5133 2010-07-08 Cary Coutant <ccoutant@google.com>
5134
5135 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5136 weak when resolving to a dynamic def.
5137 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5138 for weak undef/dynamic def cases. Adjust callers.
5139 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5140 undef_binding_weak_.
5141 (Symbol_table::sized_write_globals): Adjust symbol binding.
5142 (Symbol_table::sized_write_symbol): Add binding parameter.
5143 * symtab.h (Symbol::set_undef_binding): New method.
5144 (Symbol::is_undef_binding_weak): New method.
5145 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5146 (Symbol_table::should_override): Add new parameter.
5147 (Symbol_table::sized_write_symbol): Add new parameter.
5148
5149 * testsuite/weak_undef_file1.cc: Add new test case.
5150 * testsuite/weak_undef_file2.cc: Fix header comment.
5151 * testsuite/weak_undef_test.cc: Add new test case.
5152
5153 2010-06-29 Doug Kwan <dougkwan@google.com>
5154
5155 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5156 Initialize USE_SYMBOL_.
5157 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5158 definition.
5159 (Arm_reloc_property::uses_symbol_): New data member declaration.
5160 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5161 uses symbol value and symbol is undefined but not weakly undefined.
5162
5163 2010-06-28 Rafael Espindola <espindola@google.com>
5164
5165 * plugin.cc (Plugin::load): Use dlerror.
5166
5167 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5168
5169 * symtab.cc (detect_odr_violations): When reporting an ODR
5170 violation, report an object where the symbol is defined.
5171
5172 2010-06-25 Doug Kwan <dougkwan@google.com>
5173
5174 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5175 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5176 definition.
5177 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5178 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5179 target hook to detect function points.
5180 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5181 * icf.h (Icf::check_section_for_function_pointers): Change type of
5182 parameter SECTION_NAME to const reference to std::string. Use
5183 target hook to determine if section may have unsafe pointers.
5184 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5185 method definition.
5186
5187 2010-06-21 Rafael Espindola <espindola@google.com>
5188
5189 * fileread.cc (Input_file::find_fie): New
5190 (Input_file::open): Use Input_file::find_fie.
5191 * fileread.h (Input_file::find_fie): New
5192 * plugin.cc (set_extra_library_path): New.
5193 (Plugin::load): Add set_extra_library_path to the transfer vector.
5194 (Plugin_manager::set_extra_library_path): New.
5195 (Plugin_manager::add_input_file): Use the extra search path if set.
5196 (set_extra_library_path(): New.
5197 * plugin.h (Plugin_manager): Add set_extra_library_path and
5198 extra_search_path_.
5199
5200 2010-06-19 Cary Coutant <ccoutant@google.com>
5201
5202 * layout.cc (gdb_sections): Add .debug_types.
5203 (lines_only_debug_sections): Likewise.
5204
5205 2010-06-18 Rafael Espindola <espindola@google.com>
5206
5207 * plugin.cc (add_input_file,add_input_library)
5208 (Plugin_manager::add_input_file): Make filename arguments const.
5209 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5210 const.
5211
5212 2010-06-16 Doug Kwan <dougkwan@google.com>
5213
5214 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5215 .ARM.attributes section if we have not merged any input
5216 attributes sections.
5217
5218 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5219
5220 * arm.cc: Allow combining objects with no EABI version
5221 information.
5222
5223 2010-06-15 Rafael Espindola <espindola@google.com>
5224
5225 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5226
5227 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5228
5229 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5230 (struct iovec): Correct !HAVE_READV definition.
5231
5232 2010-06-10 Cary Coutant <ccoutant@google.com>
5233
5234 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5235 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5236 reloc sections.
5237 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5238
5239 PR 11683
5240 * symtab.h (Symbol::is_placeholder): New member function.
5241 * target-reloc.h (relocate_section): Check for placeholder symbols.
5242
5243 * testsuite/Makefile.am (plugin_test_8): New test.
5244 (plugin_test_9): New test.
5245 * testsuite/Makefile.in: Regenerate.
5246
5247 2010-06-09 Nick Clifton <nickc@redhat.com>
5248
5249 * yyscript.y (input_list_element): Allow strings prefixed with
5250 the '-' character. Treat these as libraries.
5251 * script.cc (script_add_library): New function. Adds a library
5252 specified by "-l<name>" found in an input script.
5253 * script-c.h: Add prototype for script_add_library.
5254
5255 2010-06-07 Doug Kwan <dougkwan@google.com>
5256
5257 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5258 Restrict stub-group size to be within long conditional branch
5259 range when working around cortex-A8 erratum.
5260
5261 2010-06-07 Damien Diederen <dd@crosstwine.com>
5262
5263 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5264 #ifdef typo.
5265
5266 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5267
5268 PR gold/11658
5269 * output.cc
5270 (Output_section::Input_section_sort_entry::compare_section_ordering):
5271 Change to return non-zero correctly.
5272 (Output_section::Input_section_sort_section_order_index_compare
5273 ::operator()): Change to fix ambiguity in comparisons.
5274
5275 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5276
5277 * gold.h (is_wildcard_string): New function.
5278 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5279 (Layout::layout_eh_frame): Ditto.
5280 (Layout::find_section_order_index): New method.
5281 (Layout::read_layout_from_file): New method.
5282 * layout.h (Layout::find_section_order_index): New method.
5283 (Layout::read_layout_from_file): New method.
5284 (Layout::input_section_position_): New private member.
5285 (Layout::input_section_glob_): New private member.
5286 * main.cc (main): Call read_layout_from_file here.
5287 * options.h (--section-ordering-file): New option.
5288 * output.cc (Output_section::input_section_order_specified_): New
5289 member.
5290 (Output_section::Output_section): Initialize new member.
5291 (Output_section::add_input_section): Add new parameter.
5292 Keep input sections when --section-ordering-file is used.
5293 (Output_section::set_final_data_size): Sort input sections when
5294 section ordering file is specified.
5295 (Output_section::Input_section_sort_entry): Add new parameter.
5296 Check sorting type.
5297 (Output_section::Input_section_sort_entry::compare_section_ordering):
5298 New method.
5299 (Output_section::Input_section_sort_compare::operator()): Change to
5300 consider section_order_index.
5301 (Output_section::Input_section_sort_init_fini_compare::operator()):
5302 Change to consider section_order_index.
5303 (Output_section::Input_section_sort_section_order_index_compare
5304 ::operator()): New method.
5305 (Output_section::sort_attached_input_sections): Change to sort
5306 according to section order when specified.
5307 (Output_section::add_input_section<32, true>): Add new parameter.
5308 (Output_section::add_input_section<64, true>): Add new parameter.
5309 (Output_section::add_input_section<32, false>): Add new parameter.
5310 (Output_section::add_input_section<64, false>): Add new parameter.
5311 * output.h (Output_section::add_input_section): Add new parameter.
5312 (Output_section::input_section_order_specified): New
5313 method.
5314 (Output_section::set_input_section_order_specified): New method.
5315 (Input_section::Input_section): Initialize section_order_index_.
5316 (Input_section::section_order_index): New method.
5317 (Input_section::set_section_order_index): New method.
5318 (Input_section::section_order_index_): New member.
5319 (Input_section::Input_section_sort_section_order_index_compare): New
5320 struct.
5321 (Output_section::input_section_order_specified_): New member.
5322 * script-sections.cc (is_wildcard_string): Delete and move modified
5323 method to gold.h.
5324 (Output_section_element_input::Output_section_element_input): Modify
5325 call to is_wildcard_string.
5326 (Output_section_element_input::Input_section_pattern
5327 ::Input_section_pattern): Ditto.
5328 (Output_section_element_input::Output_section_element_input): Ditto.
5329 * testsuite/Makefile.am (final_layout): New test case.
5330 * testsuite/Makefile.in: Regenerate.
5331 * testsuite/final_layout.cc: New file.
5332 * testsuite/final_layout.sh: New file.
5333
5334 2010-06-01 Rafael Espindola <espindola@google.com>
5335
5336 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5337
5338 2010-06-01 Rafael Espindola <espindola@google.com>
5339
5340 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5341 visibility of symbols.
5342
5343 2010-05-27 Doug Kwan <dougkwan@google.com>
5344
5345 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5346 from start of output section instead of address for a local symbol
5347 in a merged or relaxed section when doing a relocatable link.
5348
5349 2010-05-26 Rafael Espindola <espindola@google.com>
5350
5351 PR 11604
5352 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5353 adding sections the garbage collector removed.
5354 * gold/testsuite/Makefile.am: Add test.
5355 * gold/testsuite/Makefile.in: Regenerate.
5356 * gold/testsuite/plugin_test_7.sh: New.
5357 * gold/testsuite/plugin_test_7_1.c: New.
5358 * gold/testsuite/plugin_test_7_2.c: New.
5359
5360 2010-05-26 Rafael Espindola <espindola@google.com>
5361
5362 * script-sections.cc (Output_section_definition::set_section_addresses):
5363 Check for --section-start.
5364
5365 2010-05-26 Doug Kwan <dougkwan@google.com>
5366
5367 * arm.cc (Arm_scan_relocatable_relocs): New class.
5368 (Target_arm::relocate_special_relocatable): New method.
5369 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5370 (Arm_relocate_functions::thumb_branch_common): Same.
5371 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5372 instead of Default_scan_relocatable_relocs.
5373 * target-reloc.h (relocate_for_relocatable): Let target handle
5374 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5375 * target.h (Sized_target::relocate_special_relocatable): New method.
5376
5377 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5378
5379 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5380
5381 2010-05-23 Doug Kwan <dougkwan@google.com>
5382
5383 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5384 instead of a cast.
5385 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5386 with a direct branch, not a conditional branch, to a stub.
5387 * merge.cc (Output_merge_base::record_input_section): New method
5388 defintion.
5389 (Output_merge_data::do_add_input_section): Record input section if
5390 keeps-input-sections flag is set.
5391 (Output_merge_string::do_add_input_section): Ditto.
5392 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5393 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5394 INPUT_SECTIONS_.
5395 (Output_merge_base::keeps_input_sections,
5396 Output_merge_base::set_keeps_input_sections,
5397 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5398 method definitions.
5399 (Output_merge_base::Input_sections): New type declaration.
5400 (Output_merge_base::input_sections_begin,
5401 Output_merge_base::input_sections_end,
5402 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5403 (Output_merge_base::bool keeps_input_sections_,
5404 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5405 Output_merge_base::input_sections_): New data members.
5406 (Output_merge_data::do_set_keeps_input_sections): New method
5407 defintion.
5408 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5409 * output.cc (Output_section::Input_section::relobj): Move method
5410 defintion from class declaration to here and handle merge sections.
5411 (Output_section::Input_section::shndx): Ditto.
5412 (Output_section::Output_section): Remove initializations of removed
5413 data members and initialize new data member LOOKUP_MAPS_.
5414 (Output_section::add_input_section): Set keeps-input-sections flag
5415 for a newly created merge output section as appropriate. Adjust code
5416 to use Output_section_lookup_maps class.
5417 (Output_section::add_relaxed_input_section): Adjst code for lookup
5418 maps code refactoring.
5419 (Output_section::add_merge_input_section): Add a new parameter
5420 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5421 class. If adding input section to a newly created merge output
5422 section fails, remove the new merge section.
5423 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5424 Adjust code for use of the Output_section_lookup_maps class.
5425 (Output_section::find_merge_section): Ditto.
5426 (Output_section::build_lookup_maps): New method defintion.
5427 (Output_section::find_relaxed_input_section): Adjust code to use
5428 Output_section_lookup_maps class.
5429 (Output_section::get_input_sections): Export merge sections. Adjust
5430 code to use Output_section_lookup_maps class.
5431 (Output_section:::add_script_input_section): Adjust code to use
5432 Output_section_lookup_maps class. Update lookup maps for merge
5433 sections also.
5434 (Output_section::discard_states): Use Output_section_lookup_maps.
5435 (Output_section::restore_states): Same.
5436 * output.h (Merge_section_properties): Move class defintion out of
5437 Output_section.
5438 (Output_section_lookup_maps): New class.
5439 (Output_section::Input_section::is_merge_section): New method
5440 defintion.
5441 (Output_section::Input_section::relobj): Move defintion out of class
5442 defintion. Declare method only.
5443 (Output_section::Input_section::shndx): Ditto.
5444 (Output_section::Input_section::output_merge_base): New method defintion.
5445 (Output_section::Input_section::u2_.pomb): New union field.
5446 (Output_section::Merge_section_by_properties_map,
5447 Output_section::Output_section_data_by_input_section_map,
5448 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5449 Remove types.
5450 (Output_section::add_merge_input_section): Add new parameter
5451 KEEPS_INPUT_SECTIONS.
5452 (Output_section::build_lookup_maps): New method declaration.
5453 (Output_section::merge_section_map_,
5454 Output_section::merge_section_by_properties_map_,
5455 Output_section::relaxed_input_section_map_,
5456 Output_section::is_relaxed_input_section_map_valid_): Remove data
5457 members.
5458 (Output_section::lookup_maps_): New data member.
5459
5460 2010-05-21 Doug Kwan <dougkwan@google.com>
5461
5462 PR gold/11619
5463 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5464 avoid a compilation error.
5465
5466 2010-05-19 Rafael Espindola <espindola@google.com>
5467
5468 * script-sections.cc (Output_section_definition::allocate_to_segment):
5469 Update the phdrs_list even when the output section is NULL.
5470 * testsuite/Makefile.am: Add test.
5471 * testsuite/Makefile.in: Regenerate.
5472 * testsuite/script_test_9.cc: New.
5473 * testsuite/script_test_9.sh: New.
5474 * testsuite/script_test_9.t: New.
5475
5476 2010-05-19 Doug Kwan <dougkwan@google.com>
5477
5478 * arm.cc (Arm_input_section::original_size): New method.
5479 (Arm_input_section::do_addralign): Add a cast.
5480 (Arm_input_section::do_output_offset): Remove static cast.
5481 (Arm_input_section::original_addralign,
5482 Arm_input_section::original_size_): Change type to uint32_t.
5483 (Arm_input_section::init): Add safe casts for section alignment
5484 and size.
5485 (Arm_input_section::set_final_data_size): Do not set address and
5486 offset of stub table.
5487 (Arm_output_section::fix_exidx_coverage): Change use of of
5488 Output_section::Simple_input_section to that of
5489 Output_section::Input_section.
5490 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5491 except for the first pass.
5492 * output.cc (Output_section::get_input_sections): Change type of
5493 input_sections to std::list<Input_section>.
5494 (Output_section::add_script_input_section): Rename from
5495 Output_section::add_simple_input_section. Change type of SIS
5496 parameter from Simple_input_section to Input_section.
5497 * output.h (Output_section::Simple_input_section): Remove class.
5498 (Output_section::Input_section): Change class visibility to public.
5499 (Output_section::Input_section::addralign): Use stored alignments
5500 for special input sections if set.
5501 (Output_section::Input_section::set_addralign): New method.
5502 (Output_section::get_input_sections): Change parameter type from
5503 list of Simple_input_section to list of Input_section.
5504 (Output_section::add_script_input_section): Rename from
5505 Output_section::add_simple_input_section. Change first parameter's
5506 type from Simple_input_section to Input_section and remove the
5507 second and third parameters.
5508 * script-sections.cc (Input_section::Input_section_list): Change
5509 type to list of Output_section::Input_section/
5510 (Input_section_info::Input_section_info): Change parameter type of
5511 INPUT_SECTION to Output_section::Input_section.
5512 (Input_section_info::input_section): Change return type.
5513 (Input_section_info::input_section_): Change type to
5514 Output_section::Input_section.
5515 (Output_section_element_input::set_section_addresses): Adjust code
5516 to use Output_section::Input_section instead of
5517 Output_section::Simple_input_section. Adjust code for renaming
5518 of Output_section::add_simple_input_section.
5519 (Orphan_output_section::set_section_addresses): Ditto.
5520
5521 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5522
5523 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5524 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5525
5526 2010-05-18 Rafael Espindola <espindola@google.com>
5527
5528 * options.cc (General_options::finalize): Handle -nostdlib.
5529 * options.h (nostdlib): New option.
5530 * script.cc (script_add_search_dir): Handle -nostdlib.
5531
5532 2010-05-12 Doug Kwan <dougkwan@google.com>
5533
5534 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5535 attributes section only if there no attributes section after merging.
5536 (Target_arm::merge_object_attributes): Move value of
5537 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5538 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5539 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5540 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5541 and arm_attr_merge_7.stdout.
5542 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5543 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5544 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5545 arm_attr_merge_7b.o): New rules.
5546 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5547 arm_attr_merge_7
5548 * testsuite/Makefile.in: Regenerate.
5549 * testsuite/arm_attr_merge.sh: New file.
5550 * testsuite/arm_attr_merge_[67][ab].s: Same.
5551
5552 2010-05-05 Nick Clifton <nickc@redhat.com>
5553
5554 * po/es.po: Updated Spanish translation.
5555
5556 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5557
5558 * Makefile.am (install-exec-local): Properly install gold as
5559 default cross linker.
5560 * Makefile.in: Regenerated.
5561
5562 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5563 Nick Clifton <nickc@redhat.com>
5564
5565 * configure.ac (install_as_default): Define and set to false
5566 unless --enable-gold or --enable-gold=both/gold has been
5567 specified.
5568 * configure: Regenerate.
5569
5570 * Makefile.am (install-exec-local): Install the executable as
5571 'ld.gold'. If install_as_default is true then also install it as
5572 'ld'.
5573 * Makefile.in: Regenerated.
5574
5575 2010-04-24 Ian Lance Taylor <iant@google.com>
5576
5577 * layout.cc (Layout::layout_reloc): In relocatable link don't
5578 combine reloc sections for grouped sections.
5579
5580 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5581
5582 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5583 sections that are not ordinary to icf.
5584 * icf.cc (get_section_contents): Handle relocation pointing to section
5585 with no object or shndx information.
5586 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5587 * testsuite/Makefile.in: Regenerate.
5588 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5589 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5590
5591 2010-04-22 Ian Lance Taylor <iant@google.com>
5592
5593 * expression.cc (Expression::Expression_eval_info): Add
5594 result_alignment_pointer field.
5595 (Expression::eval_with_dot): Add result_alignment_pointer
5596 parameter. Change all callers.
5597 (Expression::eval_maybe_dot): Likewise.
5598 (class Binary_expression): Add alignment_pointer parameter to
5599 left_value and right_value. Change all callers.
5600 (BINARY_EXPRESSION): Set result alignment.
5601 (class Trinary_expression): Add alignment_pointer parameter to
5602 arg2_value and arg3_value. Change all callers.
5603 (Trinary_cond::value): Set result alignment.
5604 (Max_expression::value, Min_expression::value): Likewise.
5605 (Align_expression::value): Likewise.
5606 * script-sections.cc (class Sections_element): Add dot_alignment
5607 parameter to set_section_addresses virtual function. Update
5608 instantiations.
5609 (class Output_section_element): Likewise.
5610 (Script_sections::create_segments): Add dot_alignment parameter.
5611 Change all callers.
5612 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5613 (Script_sections::set_phdrs_clause_addresses): Likewise.
5614 * script-sections.h: Update declarations.
5615 * script.h: Update declarations.
5616 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5617 min_p_align.
5618 * testsuite/script_test_3.t: Set large alignment.
5619 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5620 segment has expected alignment.
5621
5622 2010-04-22 Nick Clifton <nickc@redhat.com>
5623
5624 * po/gold.pot: Updated by the Translation project.
5625 * po/vi.po: Updated Vietnamese translation.
5626
5627 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5628
5629 * testsuite/Makefile.am (check_PROGRAMS): Add
5630 icf_virtual_function_folding_test.
5631 * testsuite/Makefile.in: Regenerated.
5632
5633 2010-04-15 Andrew Haley <aph@redhat.com>
5634
5635 * options.h (merge_exidx_entries): New option.
5636 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5637 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5638 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5639 (Target_arm::merge_exidx_entries): New function.
5640 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5641 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5642 to Arm_exidx_fixup constructor.
5643 Add new arg, merge_exidx_entries.
5644 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5645 Arm_output_section::fix_exidx_coverage.
5646
5647 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5648
5649 * icf.cc (get_section_contents): Check for preemptible functions.
5650 Ignore addend when appropriate.
5651 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5652 section folded.
5653 (add_from_relobj): Check for section folded.
5654 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5655 * symtab.h (should_add_dynsym_entry): Add new parameter.
5656 * target-reloc.h (scan_relocs): Check for section folded.
5657 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5658 Check reloc types for function pointers in shared objects.
5659 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5660 case.
5661 (icf_preemptible_functions_test): New test case.
5662 (icf_string_merge_test): New test case.
5663 * testsuite.Makefile.in: Regenerate.
5664 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5665 bar_glob. Refactor code.
5666 * testsuite/icf_preemptible_functions_test.cc: New file.
5667 * testsuite/icf_preemptible_functions_test.sh: New file.
5668 * testsuite/icf_string_merge_test.cc: New file.
5669 * testsuite/icf_string_merge_test.sh: New file.
5670 * testsuite/icf_virtual_function_folding_test.cc: New file.
5671 * testsuite/icf_virtual_function_folding_test.sh: New file.
5672
5673 2010-04-14 Doug Kwan <dougkwan@google.com>
5674
5675 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5676 for local symbol recounting if we remove a section due to ICF.
5677 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5678 there are no regular objects in input.
5679
5680 2010-04-13 Doug Kwan <dougkwan@google.com>
5681
5682 * arm.cc (Arm_input_section::set_final_data_size): Compute
5683 accurate final data size instead of using current data size.
5684
5685 2010-04-09 Doug Kwan <dougkwan@google.com>
5686
5687 * layout.cc (Layout::choose_output_section): Handle script section
5688 types.
5689 (Layout::make_output_section_for_script): Add section type parameter.
5690 Handle script section types.
5691 * layout.h (Layout::make_output_section_for_script): Add section
5692 type parameter.
5693 * output.cc (Output_section::Output_section): Initialize data member
5694 is_noload_.
5695 (Output_section::do_reset_address_and_file_offset): Do not set address
5696 to 0 if section is a NOLOAD section.
5697 * output.h (Output_section::is_noload): New method.
5698 (Output_section::set_is_noload): Ditto.
5699 (Output_section::is_noload_): New data member.
5700 * script-c.h (Script_section_type): New enum type.
5701 (struct Parser_output_section_header): Add new file section_type.
5702 * script-sections.cc (Sections_element::output_section_name): Add
5703 parameter for returning script section type.
5704 (Output_section_definition::output_section_name): Ditto.
5705 (Output_section_definition::section_type)P; New method.
5706 (Output_section_definiton::script_section_type_name): Ditto.
5707 (Output_section_definition::script_section_type_): New data member.
5708 (Output_section_definition::Output_section_definition): Initialize
5709 data member Output_section_definition::script_section_type_.
5710 (Output_section_definition::create_sections): Pass script section type
5711 to Layout::make_output_section_for_script.
5712 (Output_section_definition::output_section_name): Return script
5713 section type to caller.
5714 (Output_section_definition::set_section_address): Do not advance
5715 dot value and load address if section type is NOLOAD. Set address
5716 of NOLOAD sections regardless of section flags.
5717 (Output_section_definition::print): Print section type if it is
5718 not SCRIPT_SECTION_TYPE_NONE.
5719 (Output_section_definition::section_type): New method.
5720 (Output_section_definition::script_section_type_name): Ditto.
5721 (Script_sections::output_section_name): Add new parameter
5722 PSECTION_TYPE for returning script section type. Pass it to
5723 section elements. Handle discard sections.
5724 (Sort_output_sections::operator()): Handle NOLOAD sections.
5725 * script-sections.h (Script_sections::Section_type): New enum type.
5726 (Script_sections::output_section_name): Add a new parameter for
5727 returning script section type.
5728 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5729 INFO and NOLOAD.
5730 * yyscript.y (union): Add new field SECTION_TYPE.
5731 (COPY, DSECT, INFO, NOLOAD): New tokens.
5732 (opt_address_and_section_type): Change type to output_section_header.
5733 (section_type): New non-terminal
5734 (section_header): Handle section type.
5735 (opt_address_and_section_type): Return section type value.
5736
5737 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5738
5739 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5740 * testsuite/plugin_common_test_2.c (foo): Likewise.
5741
5742 2010-04-08 Doug Kwan <dougkwan@google.com>
5743
5744 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5745 Output_merge_data.
5746 * output.cc (Output_section::add_merge_input_section): Simplify
5747 code and return status of Output_merge_base::add_input_section.
5748 Update merge section map only if Output_merge_base::add_input_section
5749 returns true.
5750
5751 2010-04-07 Doug Kwan <dougkwan@google.com>
5752
5753 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5754 if section is marked as containing instructions but has no mapping
5755 symbols.
5756 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5757 correct section index.
5758 (Arm_relobj::find_linked_text_section): Ditto.
5759
5760 2010-04-07 Cary Coutant <ccoutant@google.com>
5761
5762 * archive.cc (include_member): Destroy Read_symbols_data object before
5763 releasing file.
5764 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5765 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5766 (Read_symbols_data::~Read_symbols_data) New destructor.
5767 (Section_relocs::Section_relocs) New constructor.
5768 (Section_relocs::~Section_relocs) New destructor.
5769 (Read_relocs_data::Read_relocs_data) New constructor.
5770 (Read_relocs_data::~Read_relocs_data) New destructor.
5771 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5772 pointers to NULL after deleting.
5773
5774 2010-04-07 Doug Kwan <dougkwan@google.com>
5775
5776 * arm.cc: Replace "endianity" with "endianness" in comments.
5777 (Arm_exidx_cantunwind): Ditto.
5778 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5779 (Arm_relobj::merge_flags_and_attributes): New method.
5780 (Arm_relobj::merge_flags_and_attributes_): New data member.
5781 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5782 (Arm_relobj::scan_sections_for_stubs): Ditto.
5783 (Arm_relobj::do_read_symbols): Check to see if we really want to
5784 merge processor-specific flags and attributes. Exit early if
5785 an object is empty except for section names and the undefined symbol.
5786 (Target_arm::do_finalize_sections): Move check for ELF format to
5787 Arm_relobj::do_read_symbols. Merge processor specific flags and
5788 attributes from a regular object only when we have determined that
5789 it is aapropriate. Do not create an .ARM.attributes section in
5790 output if there is no regular input object.
5791 (Target_arm::merge_processor_specific_flags): Check
5792 --warn-mismatch before printing any error.
5793 (Target_arm::merge_object_attributes): Ditto.
5794 * gold.cc (queue_middle_tasks): Handle the case in which there is
5795 no regular object in input.
5796 * options.cc (General_options::parse_EB): New method.
5797 (General_options::parse_EL): Same.
5798 (General_options::General_options): Initialize endianness_.
5799 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5800 New options.
5801 (General_options::Endianness): New enum.
5802 (General_options::endianness): New method.
5803 (General_options::endianness_): New data member.
5804 * parameters.cc (Parameters::set_options): Check target endianness.
5805 (Parameters::set_target_once): Ditto.
5806 (Parameters::check_target_endianness): New method.
5807 (parameters_force_valid_target): If either -EL or -EB is specified,
5808 use it to define endianness of default target.
5809 * parameters.h (Parameters::check_target_endianness): New method
5810 declaration.
5811 * target.h (class Target): Change "endianity" to "endianness"
5812 in comments.
5813
5814 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5815
5816 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5817 * configure: Regenerate.
5818 * Makefile.in: Regenerate.
5819 * testsuite/Makefile.in: Regenerate.
5820
5821 2010-04-06 Cary Coutant <ccoutant@google.com>
5822
5823 gcc PR lto/42757
5824 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5825 prevailing definitions of common symbols.
5826 * testsuite/plugin_test_6.sh: New test case.
5827 * testsuite/plugin_common_test_1.c: New test case.
5828 * testsuite/plugin_common_test_2.c: New test case.
5829 * testsuite/Makefile.am (plugin_test_6): New test case.
5830 * testsuite/Makefile.in: Regenerate.
5831
5832 2010-04-06 Nick Clifton <nickc@redhat.com>
5833
5834 * po/vi.po: New Vietnamese translation.
5835
5836 2010-03-30 Doug Kwan <dougkwan@google.com>
5837
5838 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5839
5840 2010-03-25 Doug Kwan <dougkwan@google.com>
5841
5842 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5843 to avoid a conversion warning on a 32-bit host.
5844
5845 2010-03-24 Ian Lance Taylor <iant@google.com>
5846
5847 * testsuite/script_test_3.t: Add a TLS segment.
5848 * testsuite/Makefile.am (check_PROGRAMS): Add
5849 tls_phdrs_script_test.
5850 (tls_phdrs_script_test_SOURCES): Define.
5851 (tls_phdrs_script_test_DEPENDENCIES): Define.
5852 (tls_phdrs_script_test_LDFLAGS): Define.
5853 (tls_phdrs_script_test_LDADD): Define.
5854 * testsuite/Makefile.in: Rebuild.
5855
5856 2010-03-23 Cary Coutant <ccoutant@google.com>
5857
5858 * fileread.cc (find_or_make_view): Fix comment.
5859
5860 2010-03-23 Ian Lance Taylor <iant@google.com>
5861
5862 * script-sections.cc (class Orphan_section_placement): Define
5863 PLACE_TLS and PLACE_TLS_BSS.
5864 (Orphan_section_placement::Orphan_section_placement): Initialize
5865 new places.
5866 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5867 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5868 (tls_script_test_SOURCES): Define.
5869 (tls_script_test_DEPENDENCIES): Define.
5870 (tls_script_test_LDFLAGS): Define.
5871 (tls_script_test_LDADD): Define.
5872 * testsuite/Makefile.in: Rebuild.
5873
5874 2010-03-22 Doug Kwan <dougkwan@google.com>
5875
5876 * arm.cc (Arm_relocate_functions::abs8,
5877 Arm_relocate_functions::abs16): Use correct check for overflow
5878 specified in the ARM ELF specs.
5879 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5880 target of a BLX instruction specially.
5881 (Reloc_stub::stub_type_for_reloc): Ditto.
5882 (Relocate::relocate): Use symbolic names instead of numeric relocation
5883 codes to report error.
5884 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5885 workaround.
5886 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5887 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5888 thumb2_blx_out_of_range.stdout
5889 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5890 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5891 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5892 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5893 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5894 thumb2_blx_in_range, thumb2_blx_in_range.o,
5895 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5896 thumb2_blx_out_of_range.o): New rules.
5897 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5898 thumb2_blx_in_range and thumb2_blx_out_of_range.
5899 * testsuite/Makefile.in: Regenerate.
5900 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5901 * testsuite/thumb_blx_in_range.s: New file.
5902 * testsuite/thumb_blx_out_of_range.s: New file.
5903
5904 2010-03-22 Rafael Espindola <espindola@google.com>
5905
5906 * archive.cc (Should_include): Move to archive.h.
5907 (should_include_member): Make it a member of Archive.
5908 (Lib_group): New.
5909 (Add_lib_group_symbols): New.
5910 * archive.h: Include options.h.
5911 (Archive_member): Moved from Archive.
5912 (Should_include): Moved from archive.cc.
5913 (Lib_group): New.
5914 (Add_lib_group_symbols): New.
5915 * dynobj.cc (do_should_include_member): New.
5916 * dynobj.h (do_should_include_member): New.
5917 * gold.cc (queue_initial_tasks): Update call to queue.
5918 * main.cc (main): Print lib group stats.
5919 * object.cc (do_should_include_member): New.
5920 * object.h: Include archive.h.
5921 (Object::should_include_member): New.
5922 (Object::do_should_include_member): New.
5923 (Sized_relobj::do_should_include_member): New.
5924 * options.cc (General_options::parse_start_lib): New.
5925 (General_options::parse_end_lib): New.
5926 (Input_arguments::add_file): Handle lib groups.
5927 (Input_arguments::start_group): Check we are not in a lib.
5928 (Input_arguments::start_lib): New.
5929 (Input_arguments::end_lib): New.
5930 * options.h (General_options): Add start_lib and end_lib.
5931 (Input_argument::lib_): New.
5932 (Input_argument::lib): New.
5933 (Input_argument::is_lib): New.
5934 (Input_file_lib): New.
5935 (Input_arguments::in_lib_): New.
5936 (Input_arguments::in_lib): New.
5937 (Input_arguments::start_lib): New.
5938 (Input_arguments::end_lib_): New.
5939 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5940 in unused members as preempted.
5941 (Sized_pluginobj::do_should_include_member): New.
5942 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5943 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5944 return the blocker.
5945 (Read_symbols::do_whole_lib_group): New.
5946 (Read_symbols::do_lib_group): New.
5947 (Read_symbols::do_read_symbols): Handle lib groups.
5948 (Read_symbols::get_name): Handle lib groups.
5949 * readsyms.h (Read_symbols): Add an archive member pointer.
5950 (Read_symbols::do_whole_lib_group): New.
5951 (Read_symbols::do_lib_group): New.
5952 (Read_symbols::member_): New.
5953 * script.cc (read_input_script): Update call to queue_soon.
5954
5955 2010-03-19 Doug Kwan <dougkwan@google.com>
5956
5957 * arm.cc (Stub_table::Stub_table): Initialize new data members
5958 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5959 (Stub_table::add_reloc_stub): Assign stub offset and update
5960 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5961 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5962 New data members.
5963 (Stub_table::update_data_size_and_addralign): Use
5964 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5965 instead of going over all reloc stubs.
5966 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5967 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5968 Stringpool_template::offset_ to size of Stringpool_char.
5969 (Stringpool_template::new_key_offset): Remove code to initialize
5970 Stringpool_template::offset_.
5971 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5972 Stringpool_template::offset_ to zero.
5973
5974 2010-03-15 Doug Kwan <dougkwan@google.com>
5975
5976 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5977 offset_.
5978 (Stringpool_template::new_key_offset): New method.
5979 (Stringpool_template::add_string): Assign offsets when adding new
5980 strings.
5981 (Stringpool_template::set_string_offsets): Do not set string offsets
5982 when not optimizing.
5983 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5984 member size_.
5985 (Chunked_vector::clear): Clear size_.
5986 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5987 (Chunked_vector::size): Return size_.
5988 (Chunked_vector::push_back): Use size_ to find insert position.
5989 (Chunked_vector::size_): New data member.
5990 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5991 (Stringpool_template::new_key_offset): New method declaration.
5992 (Stringpool_template::offset_): New data member.
5993
5994 2010-03-15 Rafael Espindola <espindola@google.com>
5995
5996 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5997 Add_symbols' constructor.
5998 * readsyms.h (Add_symbols): Remove the input_group member.
5999
6000 2010-03-10 Ian Lance Taylor <iant@google.com>
6001
6002 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6003 target to ask whether a reference to a symbol requires a stack
6004 split.
6005 * target.h (Target::is_call_to_non_split): New function.
6006 (Target::do_is_call_to_non_split): Declare virtual function.
6007 * target.cc: Include "symtab.h".
6008 (Target::do_is_call_to_non_split): New function.
6009 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6010
6011 2010-03-10 Cary Coutant <ccoutant@google.com>
6012
6013 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6014 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6015 (File_read::open[2]): Add whole_file_view_ to list of views.
6016 (File_read::make_view): Remove test of whole_file_view_.
6017 (File_read::find_or_make_view): Create whole_file_view_ if
6018 necessary.
6019 (File_read::clear_views): Replace bool parameter with enum;
6020 adjust all callers. Don't delete views with permanent data;
6021 do delete cached views and views from archives if
6022 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6023 if clearing the corresponding view.
6024 * fileread.h (File_read::Clear_views_mode): New enum.
6025 (File_read::View::is_permanent_view): New method.
6026 (File_read::clear_views): Replace bool parameter
6027 with enum; adjust all callers.
6028 * options.h (General_options): Change keep_files_mapped option;
6029 add map_whole_files.
6030 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6031 releasing the file.
6032 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6033 the file.
6034
6035 2010-03-10 David S. Miller <davem@davemloft.net>
6036
6037 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6038
6039 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6040
6041 * icf.cc (get_section_contents): Add '@' marker after processing the
6042 merge reloc.
6043
6044 2010-03-08 Doug Kwan <dougkwan@google.com>
6045
6046 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6047 due to a conversion warning.
6048 (Arm_relobj::update_output_local_symbol_count): Check for local
6049 symbol with unset output index.
6050
6051 2010-03-05 Ian Lance Taylor <iant@google.com>
6052
6053 * options.h (class General_options): Add --spare-dynamic-tags.
6054 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6055 --spare-dynamic-tags.
6056
6057 2010-03-05 Ian Lance Taylor <iant@google.com>
6058
6059 * incremental.cc: Include "libiberty.h".
6060
6061 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6062
6063 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6064 function, is_info_ member.
6065 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6066 (Versions::Versions): Update caller.
6067 (Versions::define_base_version): Likewise.
6068 (Versions::add_def): Likewise.
6069
6070 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6071
6072 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6073 (Scan::possible_function_pointer_reloc): New function.
6074 (Scan::local_reloc_may_be_function_pointer): Change to call
6075 possible_function_pointer_reloc.
6076 (Scan::global_reloc_may_be_function_pointer): Ditto.
6077 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6078 relocations in ".data.rel.ro._ZTV" section.
6079 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6080 * testsuite/icf_safe_so_test.cc: Ditto.
6081 * testsuite/icf_safe_test.cc: Ditto.
6082 * testsuite/icf_safe_test.sh: Ditto.
6083
6084 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6085 Ian Lance Taylor <iant@google.com>
6086
6087 * target-reloc.h (relocate_section): Check the symbol table index
6088 for -1U before setting the local symbol index.
6089 (scan_relocatable_relocs): If copying the relocation, record that
6090 the local symbol is required.
6091 * object.h (Symbol_value::is_output_symtab_index_set): New
6092 function.
6093 (Symbol_value::may_be_discarded_from_output_symtab): New
6094 function.
6095 (Symbol_value::has_output_symtab_entry): New function.
6096 (Symbol_value::needs_output_symtab_entry): Remove.
6097 (Symbol_value::output_symtab_index): Make sure the symbol index is
6098 set.
6099 (Symbol_value::set_output_symtab_index): Make sure the symbol
6100 index is not set. Make sure the new index is valid.
6101 (Symbol_value::set_must_have_output_symtab_entry): New function.
6102 (Symbol_value::has_output_dynsym_entry): New function.
6103 (Symbol_value::set_output_dynsym_index): Make sure the new index
6104 is valid.
6105 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6106 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6107 local symbol if permitted.
6108 (Sized_relobj::do_finalize_local_symbols): Call
6109 is_output_symtab_index_set rather than needs_output_symtab_entry.
6110 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6111 rather than needs_output_symtab_entry. Call
6112 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6113 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6114 is_output_symtab_index_set rather than needs_output_symtab_entry.
6115 * testsuite/discard_locals_relocatable_test.c: New file.
6116 * testsuite/discard_locals_test.sh: Test -r.
6117 * testsuite/Makefile.am (check_DATA): Add
6118 discard_locals_relocatable_test1.syms,
6119 discard_local_relocatable_test2.syms.
6120 (MOSTLYCLEANFILES): Likewise. Also add
6121 discard_locals_relocatable_test1.lout and
6122 discard_locals_relocatable_test2.out.
6123 (discard_locals_relocatable_test1.syms): New target.
6124 (discard_locals_relocatable_test.o): New target.
6125 (discard_locals_relocatable_test1.out): New target.
6126 (discard_locals_relocatable_test2.syms): New target.
6127 (discard_locals_relocatable_test2.out): New target.
6128 (various): Add missing ../ld-new dependencies.
6129 * testsuite/Makefile.in: Rebuild.
6130
6131 2010-03-03 Nick Clifton <nickc@redhat.com>
6132
6133 * po/fi.po: New Finnish translation.
6134
6135 2010-03-01 Doug Kwan <dougkwan@google.com>
6136
6137 * layout.cc (Layout::Layout): Force section types of .init_array*,
6138 .preinit_array* and .fini_array* sections.
6139 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6140 Fix check of return value of std::string::find.().
6141 (Output_section::Input_section_sort_compare::operator()): Remove
6142 comment about .init_array.
6143 (Output_section::Input_section_sort_init_fini_compare::operator()):
6144 New method.
6145 (Output_section::sort_attached_input_sections): Handle .init_array
6146 and .fini_array specially.
6147 * output.h (Output_section::Inut_section_sort_compare): Update
6148 comment.
6149 (Output_section::Input_section_sort_init_fini_compare): New struct.
6150
6151 2010-02-26 Doug Kwan <dougkwan@google.com>
6152
6153 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6154 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6155 * testsuite/debug_msg.sh: Avoid matching source line number for
6156 use of global variable undef_int.
6157
6158 2010-02-26 Doug Kwan <dougkwan@google.com>
6159
6160 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6161 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6162 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6163 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6164 * options.cc (General_options::General_options): Initialize member
6165 fix_v4bx_.
6166 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6167 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6168 and rm_no_fix_v4bx.stdout
6169 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6170 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6171 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6172 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6173 and arm_no_fix_v4bx.
6174 * Makefile.in: Regenerate.
6175 * testsuite/arm_fix_v4bx.s: New file.
6176 * testsuite/arm_fix_v4bx.sh: Ditto.
6177
6178 2010-02-24 Doug Kwan <dougkwan@google.com>
6179
6180 * arm.cc (Target_arm::got_section): Make the .got section the first
6181 non RELRO section in the data segment.
6182 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6183 suffixes of section names.
6184
6185 2010-02-24 Doug Kwan <dougkwan@google.com>
6186
6187 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6188 flags and attributes merging if an input file is a binary file.
6189 * fileread.cc (Input_file::open): Record format of original file.
6190 * fileread.h (Input_file::Format): New enum type.
6191 (Input_file::Input_file): Initialize data member format_.
6192 (Input_file::format): New method definition.
6193 (Input_file::format_):: New data member.
6194
6195 2010-02-24 Doug Kwan <dougkwan@google.com>
6196
6197 * arm.cc (Arm_output_data_got): New class.
6198 (ARM_TCB_SIZE): New constant
6199 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6200 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6201 If user uses a script with a SECTIONS clause, issue only a warning
6202 for a misplaced EXIDX input section. Otherwise, issue an error.
6203 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6204 garbage collection.
6205 (Target_arm::got_mode_index_entry): Handle static linking.
6206 (Target_arm::Scan::local): Ditto.
6207 (Target_arm::Scan::global): Ditto.
6208 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6209 all incorrectly implemented relocations.
6210 (Target_arm::fix_exidx_coverage): Pass layout to
6211 Arm_output_section::fix_exidx_coverage.
6212 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6213 from ".ARM.exidx." and ".ARM.extab.".
6214
6215 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6216
6217 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6218 section if it does not already exist.
6219 * attributes.cc (Attributes_section_data::Attributes_section_data):
6220 Don't crash if size is zero.
6221
6222 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6223 Ian Lance Taylor <iant@google.com>
6224
6225 * gold.cc (queue_middle_tasks): If no input files were opened,
6226 exit.
6227 * workqueue.h (Task_function::Task_function): Assert that there is
6228 a blocker.
6229
6230 2010-02-22 Doug Kwan <dougkwan@google.com>
6231
6232 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6233 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6234 types to avoid warnings due to different uint64_t implementations
6235 on different hosts.
6236
6237 2010-02-21 Doug Kwan <dougkwan@google.com>
6238
6239 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6240 handling of the maximum backward branch offset.
6241 (Arm_relocate_functions::thumb_branch_common): Ditto.
6242 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6243 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6244 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6245 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6246 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6247 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6248 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6249 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6250 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6251 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6252 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6253 thumb2_bl_out_of_range.o): New rules.
6254 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6255 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6256 thumb2_bl_out_of_range
6257 * testsuite/Makefile.in: Regenerate.
6258 * testsuite/arm_bl_in_range.s: New file.
6259 * testsuite/arm_bl_out_of_range.s: Ditto.
6260 * testsuite/arm_branch_in_range.sh: Ditto.
6261 * testsuite/arm_branch_range.t: Ditto.
6262 * testsuite/thumb2_branch_range.t: Ditto.
6263 * testsuite/thumb_bl_in_range.s: Ditto.
6264 * testsuite/thumb_bl_out_of_range.s: Ditto.
6265 * testsuite/thumb_branch_range.t: Ditto.
6266
6267 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6268
6269 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6270 Add reloc offset information.
6271 * icf.cc (get_section_contents): Change iterators to point to the new
6272 vectors. Add reloc offset information to the contents.
6273 * icf.h (Icf::Sections_reachable_info): New typedef.
6274 (Icf::Sections_reachable_list): New typedef.
6275 (Icf::Offset_info): New typedef.
6276 (Icf::Reloc_info): New struct typedef.
6277 (Icf::Reloc_info_list): New typedef.
6278 (Icf::symbol_reloc_list): Delete method.
6279 (Icf::addend_reloc_list): Delete method.
6280 (Icf::section_reloc_list): Delete method.
6281 (Icf::reloc_info_list): New method.
6282 (Icf::reloc_info_list_): New member.
6283
6284 2010-02-19 Doug Kwan <dougkwan@google.com>
6285
6286 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6287 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6288 * arm.cc (Arm_relocation_functions): New forward declaration.
6289 (Target_arm::Target_arm): Initialize new data members
6290 got_mod_index_offset_ and tls_base_symbol_defined_.
6291 (Target_arm::Relocate::relocate_tls): New method.
6292 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6293 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6294 New methods.
6295 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6296 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6297 (Target_arm::got_mod_index_offset_,
6298 Target_arm::tls_base_symbol_defined_): New data members.
6299 (Target_arm::Scan::local, Target::Scan::global,
6300 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6301 relocations.
6302
6303 2010-02-18 Doug Kwan <dougkwan@google.com>
6304
6305 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6306 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6307 text section as a parameter becuase some broken tools may not set
6308 the link in section header.
6309 (Target_arm::has_got_section): New method.
6310 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6311 without any mapping symbol as data only. Remove warning.
6312 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6313 link in its section header, try to discover the link by inspecting the
6314 REL31 relocation at the beginning of the section.
6315 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6316 in error message.
6317 (Target_arm::Scan::global): Treat any reference to the symbol
6318 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6319
6320 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6321
6322 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6323 (Scan::global_reloc_may_be_function_pointer): New function.
6324 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6325 (Scan::global_reloc_may_be_function_pointer): New function.
6326 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6327 (Scan::global_reloc_may_be_function_pointer): New function.
6328 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6329 (Scan::global_reloc_may_be_function_pointer): New function.
6330 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6331 (Scan::global_reloc_may_be_function_pointer): New function.
6332 (Scan::possible_function_pointer_reloc): New function.
6333 (Target_x86_64::can_check_for_function_pointers): New function.
6334 * gc.h (gc_process_relocs): Scan relocation types to determine if
6335 function pointers were taken for targets that support it.
6336 * icf.cc (Icf::find_identical_sections): Include functions for
6337 folding in safe ICF whose pointer is not taken.
6338 * icf.h (Secn_fptr_taken_set): New typedef.
6339 (fptr_section_id_): New member.
6340 (section_has_function_pointers): New function.
6341 (set_section_has_function_pointers): New function.
6342 (check_section_for_function_pointers): New function.
6343 * options.h: Fix comment for safe ICF option.
6344 * target.h (can_check_for_function_pointers): New function.
6345 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6346 Modify icf_safe_test for X86-64.
6347 * testsuite/Makefile.in: Regenerate.
6348 * testsuite/icf_safe_so_test.cc: New file.
6349 * testsuite/icf_safe_so_test.sh: New file.
6350 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6351 (main): Change to take pointer to function kept_func_3.
6352 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6353 folding is done correctly for X86-64.
6354
6355 2010-02-12 David S. Miller <davem@davemloft.net>
6356
6357 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6358 is_symbolless parameter.
6359 (Output_reloc<SHT_REL>::is_symbolless): New.
6360 (Output_reloc<SHT_REL>::is_symbolless_): New.
6361 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6362 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6363 (Output_reloc<SHT_RELA>::is_symbolless): New.
6364 (Output_data_reloc::add_global): Handle is_symbolless.
6365 (Output_data_reloc::add_global_relative): Likewise.
6366 (Output_data_reloc::add_local): Likewise.
6367 (Output_data_reloc::add_local_relative): Likewise.
6368 (Output_data_reloc::add_symbolless_global_addend): New.
6369 (Output_data_reloc::add_symbolless_local_addend): New.
6370 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6371 is_symbolless.
6372 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6373 instead of ->is_relative_
6374 (Output_reloc::write): Likewise.
6375 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6376 (Output_reloc::write_rel): Simplify.
6377
6378 * sparc.cc (Target_sparc::Scan::local): Use
6379 ->add_symbolless_local_addend as needed.
6380 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6381 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6382 based upon relocation offset.
6383
6384 2010-02-11 Doug Kwan <dougkwan@google.com>
6385
6386 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6387 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6388 beginning of function.
6389 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6390 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6391 parameter is_32bit in calls to should_apply_static_reloc.
6392 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6393 (check_DATA): Add arm_abs_global.stdout.
6394 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6395 arm_abs_global.stdout): New rules.
6396 (MOSTLLYCLEANFILES): Add arm_abs_global
6397 * Makefile.in: Regenerate.
6398 * testsuite/arm_abs_global.s: New file.
6399 * testsuite/arm_abs_global.sh: Ditto.
6400 * testsuite/arm_abs_lib.s: Ditto.
6401
6402 2010-02-11 Ian Lance Taylor <iant@google.com>
6403
6404 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6405 Read_relocs task.
6406 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6407 Allocate_commons_task first.
6408 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6409 task, rather than symtab_lock_.
6410 (Gc_process_relocs::~Gc_process_relocs): New function.
6411 (Gc_process_relocs::is_runnable): Check this_blocker_.
6412 (Gc_process_relocs::locks): Use next_blocker_ rather than
6413 blocker_.
6414 (Scan_relocs::~Scan_relocs): New function.
6415 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6416 symtab_lock_.
6417 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6418 next_blocker_.
6419 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6420 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6421 constructor accordingly.
6422 (class Gc_process_relocs): Likewise.
6423 (class Scan_relocs): Likewise.
6424 * common.h (class Allocate_commons_task): Remove symtab_lock_
6425 field, and corresponding constructor parameter.
6426 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6427 symtab_lock_.
6428 (Allocate_commons_task::locks): Likewise.
6429
6430 2010-02-11 Ian Lance Taylor <iant@google.com>
6431
6432 * gold-threads.h (class Once): Define.
6433 (class Initialize_lock): Rewrite as child of Once.
6434 * gold-threads.cc (class Once_initialize): Define.
6435 (once_pointer_control): New static variable.
6436 (once_pointer, once_arg): New static variables.
6437 (c_run_once): New static function.
6438 (Once::Once, Once::run_once, Once::internal_run): New functions.
6439 (class Initialize_lock_once): Remove.
6440 (initialize_lock_control): Remove.
6441 (initialize_lock_pointer): Remove.
6442 (initialize_lock_once): Remove.
6443 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6444 (Initialize_lock::initialize): Rewrite.
6445 (Initialize_lock::do_run_once): New function.
6446 * archive.cc (Archive::interpret_header): Only clear name if it is
6447 not already empty.
6448 * fileread.cc: Include "gold-threads.h"
6449 (file_counts_lock): New static variable.
6450 (file_counts_initialize_lock): Likewise.
6451 (File_read::release): Only increment counts when using --stats.
6452 Use a lock around the increment.
6453 * parameters.cc (class Set_parameters_target_once): Define.
6454 (set_parameters_target_once): New static variable.
6455 (Parameters::Parameters): Move here from parameters.h.
6456 (Parameters::set_target): Rewrite.
6457 (Parameters::set_target_once): New function.
6458 (Parameters::clear_target): Move here and rewrite.
6459 * parameters.h (class Parameters): Update declarations. Add
6460 set_parameters_target_once_ field.
6461 (Parameters::Parameters): Move to parameters.cc.
6462 (Parameters::clear_target): Likewise.
6463 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6464 task.
6465 (Start_group::~Start_group): New function.
6466 (Start_group::is_runnable): New function.
6467 (Start_group::locks, Start_group::run): New functions.
6468 (Finish_group::run): Change saw_undefined to size_t.
6469 * readsyms.h (class Start_group): Define.
6470 (class Finish_group): Change saw_undefined_ field to size_t.
6471 (Finish_group::Finish_group): Remove saw_undefined and
6472 this_blocker parameters. Change all callers.
6473 (Finish_group::set_saw_undefined): New function.
6474 (Finish_group::set_blocker): New function.
6475 * symtab.h (class Symbol_table): Change saw_undefined to return
6476 size_t. Change saw_undefined_ field to size_t.
6477 * target-select.cc (Set_target_once::do_run_once): New function.
6478 (Target_selector::Target_selector): Initialize set_target_once_
6479 field. Don't initialize lock_ and initialize_lock_ fields.
6480 (Target_selector::instantiate_target): Rewrite.
6481 (Target_selector::set_target): New function.
6482 * target-select.h (class Set_target_once): Define.
6483 (class Target_selector): Update declarations. Make
6484 Set_target_once a friend. Remove lock_ and initialize_lock_
6485 fields. Add set_target_once_ field.
6486
6487 2010-02-10 Ian Lance Taylor <iant@google.com>
6488
6489 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6490 queueing any tasks.
6491 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6492 (queue_middle_tasks): Add all blockers before queueing any tasks.
6493 (queue_final_tasks): Likewise.
6494 * token.h (Task_token::add_blockers): New function.
6495 * object.h (Input_objects::number_of_relobjs): New function.
6496
6497 2010-02-10 Ian Lance Taylor <iant@google.com>
6498
6499 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6500 shared, not if not position independent.
6501 * x86_64.cc (Relocate::relocate_tls): Likewise.
6502 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6503 (tls_pie_pic_test): New target.
6504 * testsuite/Makefile.in: Rebuild.
6505
6506 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6507 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6508 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6509 * testsuite/Makefile.in: Rebuild.
6510
6511 2010-02-09 David S. Miller <davem@davemloft.net>
6512
6513 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6514 R_SPARC_RELATIVE using ->add_local_relative().
6515 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6516
6517 * output.h (Output_data_dynamic::add_section_size): New method
6518 that takes two Output_data objects.
6519 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6520 entry param. Handle it in initializers.
6521 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6522 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6523 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6524 arg.
6525 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6526 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6527 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6528 for dynrel_includes_plt.
6529 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6530 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6531 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6532 before .rela.plt
6533 (Target_sparc::do_finalize_sections): Update to pass true for
6534 dynrel_includes_plt.
6535 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6536 output before .rela.plt
6537 (Target_powerpc::do_finalize_sections): Update to pass true for
6538 dynrel_includes_plt when 32-bit.
6539
6540 2010-02-08 Doug Kwan <dougkwan@google.com>
6541
6542 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6543 method.
6544 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6545 Arm_relobj::scan_section_for_cortex_a8_stubs,
6546 Arm_relobj::do_relocation_section): Instead of calling
6547 Output_section::output_address, use faster
6548 Arm_relobj::simple_input_section_output_address.
6549
6550 2010-02-08 David S. Miller <davem@davemloft.net>
6551
6552 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6553 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6554 relocation helper function.
6555
6556 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6557 just like R_SPARC_GOT{10,13,22}.
6558 (Target_sparc::Scan::local): Likewise.
6559 (Target_sparc::Relocate:relocate): Likewise.
6560
6561 2010-02-06 Ian Lance Taylor <iant@google.com>
6562
6563 * configure.ac: Rewrite targetobjs duplicate removal code to use
6564 only shell constructs.
6565 * configure: Rebuild.
6566
6567 2010-02-05 Doug Kwan <dougkwan@google.com>
6568
6569 PR 11247
6570 * arm.cc (Arm_relobj::section_is_scannable): New method.
6571 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6572 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6573
6574 2010-02-04 Doug Kwan <dougkwan@google.com>
6575
6576 PR 11247
6577 * arm-reloc-property.cc (cstdio): Include.
6578 * configure.ac (targetobjs): Remove duplicates.
6579 * configure: Regenerate.
6580 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6581 big and little endian version for a given address size.
6582
6583 2010-02-03 Doug Kwan <dougkwan@google.com>
6584
6585 * arm-reloc-property.cc
6586 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6587 definition.
6588 * arm-reloc-property.h
6589 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6590 New method definition.
6591 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6592 declaration.
6593 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6594 overflow to N.
6595 (GOT_PREL): Change implemented to Y.
6596 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6597 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6598 (Arm_relocate_functions::movw_abs_nc): Remove method.
6599 (Arm_relocate_functions::movt_abs): Ditto.
6600 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6601 (Arm_relocate_functions::thm_movt_abs): Ditto.
6602 (Arm_relocate_functions::movw_rel_nc): Ditto.
6603 (Arm_relocate_functions::movw_rel): Ditto.
6604 (Arm_relocate_functions::movt_rel): Ditto.
6605 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6606 (Arm_relocate_functions:thm_movw_rel): Ditto.
6607 (Arm_relocate_functions:thm_movt_rel): Ditto.
6608 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6609 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6610 New method definitions.
6611 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6612 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6613 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6614 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6615 (Target_arm::Relocate::relocate): Check for non-static or
6616 unimplemented relocation code and exit early. Change calls to
6617 Target_arm::reloc_uses_thumb_bit and
6618 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6619 instead. Refactor code to handle similar relocations to increase
6620 code sharing. Remove check for unsupported relocation code in switch
6621 statement.
6622 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6623 relocation property table to find out size. Change error message to
6624 print out the name of a relocation code instead of the numeric value.
6625 (Target_arm::scan_reloc_for_stub): Use relocation property table
6626 instead of calling Target_arm::reloc_uses_thumb_bit().
6627
6628 2010-02-02 Doug Kwan <dougkwan@google.com>
6629
6630 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6631 types of relaxed input section.
6632
6633 2010-02-02 Doug Kwan <dougkwan@google.com>
6634
6635 * Makefile.am (HFILES): Add arm-reloc-property.h.
6636 (DEFFILES): New.
6637 (TARGETSOURCES): Add arm-reloc-property.cc
6638 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6639 (libgold_a_SOURCES): $(DEFFILES)
6640 * Makefile.in: Regenerate.
6641 * arm-reloc-property.cc: New file.
6642 * arm-reloc-property.h: New file.
6643 * arm-reloc.def: New file.
6644 * arm.cc: Update comments.
6645 (arm-reloc-property.h): New included header.
6646 (arm_reloc_property_table): New global variable.
6647 (Target_arm::do_select_as_default_target): New method definition.
6648 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6649 arm-reloc-property to targ_extra_obj.
6650 * parameters.cc (set_parameters_target): Call
6651 Target::select_as_default_target().
6652 * target.h (Target::select_as_default_target): New method definition.
6653 (Target::do_select_as_default_target): Same.
6654
6655 2010-02-01 Doug Kwan <dougkwan@google.com>
6656
6657 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6658 first_output_text_section_.
6659 (Arm_exidx_fixup::first_output_text_section): New method definition.
6660 (Arm_exidx_fixup::first_output_text_section_): New data member.
6661 (Arm_exidx_fixup::process_exidx_section): Record the first text
6662 output section seen.
6663 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6664 and entsize in output section header.
6665
6666 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6667
6668 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6669 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6670 (Arm_relocate_functions::thm_alu11): New Method.
6671 (Arm_relocate_functions::thm_pc8): New Method.
6672 (Arm_relocate_functions::thm_pc12): New Method.
6673 (Target_arm::Scan::local): Handle the relocations.
6674 (Target_arm::Scan::global): Likewise.
6675 (Target_arm::Relocate::relocate): Likewise.
6676 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6677
6678 2010-01-29 Doug Kwan <dougkwan@google.com>
6679
6680 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6681 of relocation types as ld.
6682
6683 2010-01-29 Doug Kwan <dougkwan@google.com>
6684
6685 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6686 to public.
6687 (Arm_relocate_functions::thumb_branch_common): Ditto.
6688 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6689 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6690 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6691 Arm_relocate_functions::jump24): Remove.
6692 (Target_arm::Relocate::relocate): Adjust code to call
6693 Arm_relocation_functions::arm_branch_common and
6694 Arm_relocation_functions::thumb_branch_common instead of their removed
6695 wrappers. Merge switch-cases together to reduce source code size.
6696
6697 2010-01-29 Doug Kwan <dougkwan@google.com>
6698
6699 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6700 output_local_symbol_count_needs_update_.
6701 (Arm_relobj::output_local_symbol_count_needs_update,
6702 Arm_relobj::set_output_local_symbol_count_needs_update,
6703 Arm_relobj::update_output_local_symbol_count): New methods.
6704 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6705 member.
6706 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6707 of pointed function as in a R_ARM_PREL31 relocation.
6708 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6709 for output local symbol count updating.
6710 (Target_arm::do_relax): Update output local symbol counts in objects
6711 if necessary.
6712 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6713
6714 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6715
6716 * arm.cc: Added support for the ARM relocations:
6717 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6718 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6719 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6720 movw_prel_nc).
6721 (Arm_relocate_functions::movw_rel): New method.
6722 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6723 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6724 thm_movw_prel_nc).
6725 (Arm_relocate_functions::thm_movw_rel): New method.
6726 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6727 thm_movt_prel).
6728 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6729 relocations.
6730 (Target_arm::Scan::global): Likewise.
6731 (Target_arm::Relocate::relocate): Likewise.
6732 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6733 Likewise.
6734
6735 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6736
6737 * arm.cc: Added support for ARM group relocations.
6738 (Target_arm::reloc_needs_sym_origin): New method.
6739 (Arm_relocate_functions::calc_grp_kn): New method.
6740 (Arm_relocate_functions::calc_grp_residual): New method.
6741 (Arm_relocate_functions::calc_grp_gn): New method.
6742 (Arm_relocate_functions::arm_grp_alu): New Method.
6743 (Arm_relocate_functions::arm_grp_ldr): New Method.
6744 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6745 (Arm_relocate_functions::arm_grp_ldc): New Method.
6746 (Target_arm::Scan::local): Handle the ARM group relocations.
6747 (Target_arm::Scan::global): Likewise.
6748 (Target_arm::Relocate::relocate): Likewise.
6749 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6750 Likewise.
6751
6752 2010-01-26 Doug Kwan <dougkwan@google.com>
6753
6754 * arm.cc (set): Include.
6755 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6756 pointer type.
6757 (Arm_output_section::Text_section_list): New type.
6758 (Arm_output_section::append_text_sections_to_list): New method.
6759 (Arm_output_section::fix_exidx_coverage): Ditto.
6760 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6761 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6762 Relobj::set_section_offset() instead of
6763 Sized_relobj::invalidate_section_offset().
6764 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6765 parameter for section headers. Ignore relocation sections for
6766 unallocated sections and EXIDX sections.
6767 (Target_arm::fix_exidx_coverage): New method.
6768 (Target_arm::output_section_address_less_than): New type.
6769 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6770 linked text section instead of the EXIDX section.
6771 (Arm_output_section::create_stub_group): Add an assertion to check
6772 that this is not an EXIDX output section.
6773 (Arm_output_section::append_text_sections_to_list): New method.
6774 (Arm_output_section::fix_exidx_coverage): Ditto.
6775 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6776 Arm_relobj::section_needs_reloc_stub_scanning.
6777 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6778 first pass.
6779 (Target_arm::fix_exidx_coverage): New method.
6780 * object.h (Relobj::set_output_section): New method.
6781 (Sized_relobj::invalidate_section_offset): Remove method.
6782 (Sized_relobj::do_invalidate_section_offset): Remove method.
6783 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6784
6785 2010-01-25 Doug Kwan <dougkwan@google.com>
6786
6787 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6788 Fix warning due to signed and unsigned comparison on a 32-bit host.
6789
6790 2010-01-22 Doug Kwan <dougkwan@google.com>
6791
6792 * arm.cc (Target_arm::do_relax): Record an output section for section
6793 offset adjustment it contains any stub table that has changed.
6794 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6795 offsets in an output section if necessary.
6796 * output.cc (Output_section::Output_section): Initialize
6797 section_offsets_need_adjustments_.
6798 (Output_section::add_input_section_for_script): Renamed to
6799 Output_section::add_simple_input_section.
6800 (Output_section::save_states): Add a comment.
6801 (Output_section::discard_states): New method defintion.
6802 (Output_section::adjust_section_offsets): Same.
6803 * output.h (Output_section::add_input_section_for_script): Renamed to
6804 Output_section::add_simple_input_section.
6805 (Output_section::discard_states): New method declaration.
6806 (Output_section::adjust_section_offsets): Same.
6807 (Output_section::section_offsets_need_adjustment,
6808 Output_section::set_section_offsets_need_adjustment): New method
6809 definitions.
6810 (Output_section::section_offsets_need_adjustment_): New data member.
6811 * script-sections.cc
6812 (Output_section_element_input::set_section_address): Adjust code for
6813 renaming of Output_section::add_input_section_for_script.
6814 (Orphan_output_section::set_section_address): Same.
6815
6816 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6817
6818 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6819 Fix_v4bx enum values .
6820 * gold/options.h (General_options): New option definitions.
6821 (General_options::fix_v4bx): New method.
6822 (General_options::Fix_v4bx): New enum.
6823 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6824 (General_options::parse_fix_v4bx_interworking): New method.
6825
6826 2010-01-22 Doug Kwan <dougkwan@google.com>
6827
6828 * arm.cc (Arm_exidx_fixup): New class.
6829
6830 2010-01-21 Doug Kwan <dougkwan@google.com>
6831
6832 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6833 classes.
6834 (Arm_exidx_section_offset_map): New type.
6835
6836 2010-01-21 Doug Kwan <dougkwan@google.com>
6837
6838 * arm.cc (Arm_exidx_input_section): New class.
6839 (Arm_relobj::exidx_input_section_by_link,
6840 Arm_relobj::exidx_input_section_by_shndx,
6841 Arm_relobj::make_exidx_input_section): New methods.
6842 (read_arm_attributes_section): Remove.
6843 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6844 information about them.
6845 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6846 to here.
6847
6848 2010-01-20 Doug Kwan <dougkwan@google.com>
6849
6850 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6851 Input_section_specifier to Section_id.
6852 (Target_arm::new_arm_input_section: Adjust code for change of key
6853 type.
6854 (Target_arm::find_arm_input_section): Ditto.
6855 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6856 (Section_id): Remove.
6857 (Garbage_collection::Section_id_hash): Remove.
6858 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6859 (Section_id): Remove.
6860 (Icf::Section_id_hash): Remove.
6861 * object.h (Section_id, Const_section_id, Section_id_hash,
6862 Const_section_id_hash): New type definitions.
6863 * output.cc (Output_section::add_relaxed_input_section): Change to
6864 use Const_section_id instead of Input_section_specifier as key type.
6865 (Output_section::add_merge_input_section): Ditto.
6866 (Output_section::build_relaxation_map): Change to use Section_id
6867 instead of Input_section_specifier as key type.
6868 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6869 Ditto.
6870 (Output_section::convert_input_sections_to_relaxed_sections): Change
6871 to use Const_section_id instead of Input_section_specifier as key type.
6872 (Output_section::find_merge_section): Ditto.
6873 (Output_section::find_relaxed_input_section): Ditto.
6874 * output.h (Input_section_specifier): Remove class.
6875 (Output_section::Output_section_data_by_input_section_map): Change
6876 key type to Const_section_id.
6877 (Output_section::Output_relaxed_input_section_by_input_section_map):
6878 Ditto.
6879 (Output_section::Relaxation_map): Change key type to Section_id.
6880
6881 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6882
6883 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6884 (class Arm_v4bx_stub): New class.
6885 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6886 (Stub_factory::make_arm_v4bx_stub): New method.
6887 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6888 (Stub_table::empty): Handle v4bx stubs.
6889 (Stub_table::add_arm_v4bx_stub): New method.
6890 (Stub_table::find_arm_v4bx_stub): New method.
6891 (Arm_relocate_functions::v4bx): New method.
6892 (Target_arm::fix_v4bx): New method.
6893 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6894 (Stub_table::relocate_stubs): Likewise.
6895 (Stub_table::do_write): Likewise.
6896 (Stub_table::update_data_size_and_addralign): Likewise.
6897 (Stub_table::finalize_stubs): Likewise.
6898 (Target_arm::Scan::local): Likewise.
6899 (Target_arm::Scan::global): Likewise.
6900 (Target_arm::do_finalize_sections): Likewise.
6901 (Target_arm::Relocate::relocate): Likewise.
6902 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6903 Likewise.
6904 (Target_arm::scan_reloc_for_stub): Likewise.
6905 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6906
6907 2010-01-19 Ian Lance Taylor <iant@google.com>
6908
6909 * output.cc (Output_section_headers::do_sized_write): Write large
6910 segment count to sh_info field.
6911 (Output_file_header::do_sized_write): For large segment count,
6912 write PN_XNUM to e_phnum field.
6913
6914 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6915
6916 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6917 (Arm_relocate_functions::thm_jump8): New function.
6918 (Arm_relocate_functions::thm_jump11): New function.
6919 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6920 R_ARM_THM_JUMP11.
6921 (Target_arm::Scan::global): Likewise.
6922 (Target_arm::Relocate::relocate): Likewise.
6923 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6924 Likewise.
6925
6926 2010-01-14 Doug Kwan <dougkwan@google.com>
6927
6928 * arm.cc (map, utility): Include headers.
6929 (Target_arm::apply_cortex_a8_workaround): New method.
6930 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6931 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6932 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6933 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6934 the --[no-]fix-cortex-a8 command line options.
6935 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6936 (Target_arm::relocate_stub): Use addend in instruction template.
6937 * options.h (DEFINE_bool): Set the user-set flag.
6938 (General_options): Add --[no-]-fix-cortex options.
6939 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6940 : Update fast look-up map after conversion.
6941
6942 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6943
6944 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6945 in the first pass of do_layout.
6946
6947 2010-01-13 Doug Kwan <dougkwan@google.com>
6948
6949 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6950 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6951 apparent compiler problem of not folding static constant integral
6952 data members of elfcpp::Elf_sizes<32>.
6953
6954 2010-01-13 Doug Kwan <dougkwan@google.com>
6955
6956 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6957 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6958 Arm_relobj::scan_section_for_cortex_a8_erratum,
6959 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6960 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6961 sections to scan for relocation stubs into a new method
6962 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6963 relocation and Cortex-A8 stub scanning.
6964 (Target_arm::do_relax): Force stubs to be after stubbed sections
6965 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6966 the beginning of a new relaxation pass. Update a comment.
6967 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6968
6969 2010-01-12 Ian Lance Taylor <iant@google.com>
6970
6971 * target-reloc.h (visibility_error): New inline function.
6972 (relocate_section): Call visibility_error.
6973 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6974 (MOSTLYCLEANFILES): Likewise.
6975 (protected_4_pic.o, protected_3.err): New targets.
6976 * testsuite/protected_4.cc: New file.
6977
6978 2010-01-12 Doug Kwan <dougkwan@google.com>
6979
6980 * arm.cc (Cortex_a8_reloc): New class.
6981 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6982 and cortex_a8_relocs_info_.
6983 (Target_arm::fix_cortex_a8): New method definition.
6984 (Target_arm::Cortex_a8_relocs_info): New type.
6985 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6986 New data member declarations.
6987 (Target_arm::scan_reloc_for_stub): Record information about
6988 relocations for THUMB branches that might be exempted from the
6989 Cortex-A8 workaround.
6990 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6991 at the beginning of a relaxation pass.
6992
6993 2010-01-12 Doug Kwan <dougkwan@google.com>
6994
6995 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6996 (Arm_relobj::Mapping_symbol_position,
6997 Arm_reloj::Mapping_symbol_position_less,
6998 Arm_relobj::Mapping_symbols_info): New types.
6999 (Target_arm::is_mapping_symbol_name): New method definition.
7000 (Arm_relobj::do_count_local_symbols): Save information about mapping
7001 symbols.
7002
7003 2010-01-11 Doug Kwan <dougkwan@google.com>
7004
7005 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7006 Arm_relocate_functions::thumb32_branch_upper,
7007 Arm_relocate_functions::thumb32_branch_lower,
7008 Arm_relocate_functions::thumb32_cond_branch_offset,
7009 Arm_relocate_functions::thumb32_cond_branch_upper,
7010 Arm_relocate_functions::thumb32_cond_branch_lower,
7011 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7012 branch offset encoding.
7013 (Arm_relocate_functions::thumb_branch_common): Use new branch
7014 offset encoding methods to avoid code duplication.
7015 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7016 (Stub_addend_reader::operator()): Use new branch encoding method
7017 to avoid code duplication.
7018
7019 2010-01-11 Doug Kwan <dougkwan@google.com>
7020
7021 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7022 (Target_arm::do_finalize_sections): Define special EXIDX section
7023 symbols only if referenced.
7024 * gc.h (Garbage_collection::add_reference): New method.
7025 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7026 code duplication.
7027
7028 2010-01-11 Ian Lance Taylor <iant@google.com>
7029
7030 * script.cc (Version_script_info::build_expression_list_lookup):
7031 Change complaing about duplicate wildcard match from error to
7032 warning.
7033
7034 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7035 of 2009-12-30.
7036 (Version_script_info::Version_script_info): Initialize globs_,
7037 default_version_, default_is_global_, and exact_. Don't
7038 initialize globals_ or locals_.
7039 (Version_script_info::build_lookup_tables): Build local symbols
7040 first.
7041 (Version_script_info::unquote): New function.
7042 (Version_script_info::add_exact_match): New function.
7043 (Version_script_info::build_expression_list_lookup): Remove lookup
7044 parameter. Add is_global parameter. Change all callers. Handle
7045 wildcard pattern specially. Unquote pattern. Call
7046 add_exact_match.
7047 (Version_script_info::get_name_to_match): New function.
7048 (Version_script_info::get_symbol_version): New function.
7049 (Version_script_info::get_symbol_version_helper): Remove.
7050 (Version_script_info::check_unmatched_names): Call unquote.
7051 * script.h (class Version_script_info): Change get_symbol_version
7052 to be non-inline and add is_global parameter; change all callers.
7053 Rewrite symbol_is_local. Update declarations. Define struct
7054 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7055 Remove globals_ and locals_ members. Add exact_, globs_,
7056 default_version_, is_global_.
7057 (Version_script_info::Glob): Remove pattern, add expression and
7058 is_global. Update constructor. Change all callers.
7059 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7060 default version.
7061 (Versions::symbol_section_contents): If a symbol is undefined, or
7062 defined in a dynamic object, set the version index to
7063 VER_NDX_LOCAL.
7064 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7065 symbol_is_local.
7066 (Symbol_table::add_from_pluginobj): Likewise.
7067 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7068
7069 2010-01-11 Doug Kwan <dougkwan@google.com>
7070
7071 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7072 (incremental_dump_LDADD): Add linking option for libintl.
7073 * Makefile.in: Regenerate.
7074
7075 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7076
7077 PR gold/11144
7078 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7079 instead of -Ds.
7080 * testsuite/Makefile.in: Regenerated.
7081
7082 2010-01-10 Doug Kwan <dougkwan@google.com>
7083
7084 * options.h (DEFINE_var): Use parentheses around argument varname__
7085 in macro body to avoid any unintended subsequent substitutions.
7086
7087 2010-01-10 Ian Lance Taylor <iant@google.com>
7088
7089 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7090 candidates before doing symbol resolution.
7091
7092 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7093 ODR candidates if only one is weak.
7094
7095 2010-01-08 Ian Lance Taylor <iant@google.com>
7096
7097 * script.cc (Version_script_info::build_expression_list_lookup):
7098 Don't warn about ambiguous version, just record the ambiguity.
7099 (Version_script_info::get_symbol_version_helper): Give error if
7100 version is ambiguous.
7101
7102 2010-01-08 Doug Kwan <dougkwan@google.com>
7103
7104 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7105 prev_data_size_ and prev_addralign_. Remove initializer for
7106 deleted data member has_been_changed_.
7107 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7108 to determine if the table is empty.
7109 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7110 Remove.
7111 (Stub_table::add_reloc_stub): Define method in class definition
7112 instead of just declaring it there.
7113 (Stub_table::add_cortex_a8_stub): New method definition.
7114 (Stub_table::update_data_size_and_addralign): Ditto.
7115 (Stub_table::finalize_stubs): Ditto.
7116 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7117 (Stub_table::do_addralign_): Return address alignment in the
7118 (Stub_table::do_reset_address_and_file_offset): Define method in
7119 class definition instead of declaring it there. Set current data
7120 size to be the data size of the previous pass.
7121 (Stub_table::set_final_data_size): Use current data size as the
7122 final data size.
7123 (Stub_table::relocate_stub): Change parameter type of stub from
7124 Reloc_stub pointer to Stub pointer.
7125 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7126 (Stub_table::Cortex_a8_stub_list): New typedef.
7127 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7128 Stub_table::prev_addralign_): New data member.
7129 (Arm_relobj::Arm_relobj): Initialize data member
7130 section_has_cortex_a8_workaround_.
7131 (Arm_relobj::section_has_cortex_a8_workaround,
7132 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7133 definitions.
7134 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7135 declarations.
7136 (Target_arm::relocate_stub): Change parameter type of stub from
7137 Reloc_stub pointer to Stub pointer.
7138 (Insn_template::size, Insn_template::alignment): Handle
7139 THUMB16_SPECIAL_TYPE.
7140 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7141 Stub_table::update_data_size_and_addralign,
7142 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7143 definitions.
7144 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7145 (Stub_table::do_write): Ditto.
7146 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7147
7148 2010-01-08 Ian Lance Taylor <iant@google.com>
7149
7150 PR 11108
7151 * symtab.h (class Symbol): Remove fields is_target_special_ and
7152 has_plt_offset_. Add field is_defined_in_discarded_section_.
7153 (Symbol::is_defined_in_discarded_section): New function.
7154 (Symbol::set_is_defined_in_discarded_section): New function.
7155 (Symbol::has_plt_offset): Rewrite.
7156 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7157 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7158 Don't initialize is_target_special_ or has_plt_offset_.
7159 Initialize is_defined_in_discarded_section_.
7160 (Symbol_table::add_from_relobj): If appropriate, set
7161 is_defined_in_discarded_section.
7162 * resolve.cc (Symbol::override_base_with_special): Don't test
7163 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7164 * target-reloc.h (relocate_section): Do special handling for
7165 symbols defined in discarded sections for global symbols as well
7166 as local symbols.
7167
7168 2010-01-08 Ian Lance Taylor <iant@google.com>
7169
7170 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7171 the SHT_SYMTAB case.
7172
7173 2010-01-08 Ian Lance Taylor <iant@google.com>
7174
7175 * object.cc (Sized_relobj::do_layout): Don't get confused if
7176 layout_eh_frame returns NULL.
7177
7178 2010-01-08 Ian Lance Taylor <iant@google.com>
7179
7180 PR 11084
7181 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7182 dynamic symbol table, use the normal symbol table.
7183 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7184 symbol table.
7185
7186 2010-01-08 Ian Lance Taylor <iant@google.com>
7187
7188 PR 11072
7189 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7190 sections.
7191
7192 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7193
7194 * version.cc (print_version): Change to "Copyright 2010".
7195
7196 2010-01-08 Ian Lance Taylor <iant@google.com>
7197
7198 PR 10287
7199 PR 11063
7200 * i386.cc (class Target_i386): Change return type of plt_section
7201 to be non-const.
7202 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7203 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7204 tls_desc_rel_ field.
7205 (Output_data_plt_i386::rel_tls_desc): New function.
7206 (Target_i386::rel_tls_desc_section): New function.
7207 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7208 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7209 R_386_TLS_DESC reloc in rel_tls_desc_section.
7210 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7211 Define struct Tlsdesc_info.
7212 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7213 (Target_x86_64::do_reloc_symbol_index): New function.
7214 (Target_x86_64::add_tlsdesc_info): New function.
7215 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7216 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7217 tlsdesc_rel_ field.
7218 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7219 all callers.
7220 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7221 (Target_x86_64::rela_tlsdesc_section): New function.
7222 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7223 handling.
7224 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7225 (Target_x86_64::do_reloc_addend): New function.
7226 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7227 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7228 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7229 (Output_reloc::type): New function.
7230 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7231 (Output_reloc::is_target_specific): New function.
7232 (Output_reloc::target_arg): New function.
7233 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7234 absolute relocs and target specific relocs.
7235 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7236 add_target_specific.
7237 (class Output_data_reloc) [SHT_RELA]: Likewise.
7238 * output.cc (Output_reloc::Output_reloc): Add four new versions
7239 for absolute relocs and target specific relocs.
7240 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7241 (Output_reloc::get_symbol_index): Likewise.
7242 (Output_reloc::local_section_offset): Check that local_sym_index_
7243 is not TARGET_CODE or 0.
7244 (Output_reloc::symbol_value): Likewise.
7245 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7246 reloc.
7247 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7248 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7249 functions.
7250 * layout.cc (add_target_dynamic_tags): Use output section for
7251 DT_PLTRELSZ and DT_JMPREL.
7252
7253 2010-01-07 Ian Lance Taylor <iant@google.com>
7254
7255 PR 11061
7256 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7257 function.
7258 (class Output_data_reloc_generic): Define.
7259 (class Output_data_reloc_base): Change base class to
7260 Output_data_reloc_generic. Change add() method to call
7261 bump_relative_reloc_count for a relative reloc. Remove
7262 sort_relocs_ field.
7263 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7264 to sort_relocs().
7265 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7266 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7267 appropriate.
7268 * layout.h (class Layout): Update declaration.
7269
7270 2010-01-07 Ian Lance Taylor <iant@google.com>
7271
7272 * output.h (class Output_data): Add const version of
7273 output_section and do_output_section.
7274 (class Output_section_data): Add const version of
7275 do_output_section.
7276 (class Output_section): Likewise.
7277 * layout.cc (Layout::add_target_dynamic_tags): New function.
7278 * layout.h (class Layout): Update declarations.
7279 * arm.cc (Target_arm::do_finalize_sections): Use
7280 add_target_dynamic_tags.
7281 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7282 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7283 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7284 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7285
7286 2010-01-07 Ian Lance Taylor <iant@google.com>
7287
7288 PR 11042
7289 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7290 object as needed.
7291
7292 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7293 Ian Lance Taylor <iant@google.com>
7294
7295 PR 11019
7296 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7297 Xindex::read_symtab_xindex.
7298
7299 2010-01-07 Doug Kwan <dougkwan@google.com>
7300
7301 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7302 (Insn_template::thumb16_bcond_insn): New method declaration.
7303 (Insn_template): Fix spelling.
7304 (Stub::thumb16_special): New method declaration.
7305 (Stub::do_write): Define virtual method which was previously pure
7306 virtual.
7307 (Stub::do_thumb16_special): New method declaration.
7308 (Stub::do_fixed_endian_write): New template member.
7309 (Reloc_stub::do_write): Remove.
7310 (Reloc_stub::do_fixed_endian_write): Remove.
7311 (Cortex_a8_stub): New class definition.
7312 (Stub_factory::make_cortex_a8_stub): New method definition.
7313 (Stub_factory::Stub_factory): Add missing static storage class
7314 qualifier for elf32_arm_stub_a8_veneer_blx.
7315
7316 2010-01-07 Ian Lance Taylor <iant@google.com>
7317
7318 PR 10980
7319 * options.h (class General_options): Add --warn-unresolved-symbols
7320 and --error-unresolved-symbols.
7321 * errors.cc (Errors::undefined_symbol): Implement
7322 --warn-unresolved-symbols.
7323
7324 * options.h (class General_options): Add -z text and -z textoff.
7325 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7326
7327 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7328
7329 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7330 (Garbage_collection::cident_sections): New function.
7331 (Garbage_collection::add_cident_section): New function.
7332 (Garbage_collection::cident_sections_): New member.
7333 (gc_process_relocs): Add references to sections whose names are C
7334 identifiers.
7335 * gold.h (cident_section_start_prefix): New constant.
7336 (cident_section_stop_prefix): New constant.
7337 (is_cident): New function.
7338 * layout.cc (Layout::define_section_symbols): Replace string constants
7339 with the newly defined constants.
7340 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7341 C identifiers.
7342 * testsuite/Makefile.am: Add gc_orphan_section_test.
7343 * testsuite/Makefile.in: Regenerate.
7344 * testsuite/gc_orphan_section_test.cc: New file.
7345 * testsuite/gc_orphan_section_test.sh: New file.
7346
7347 2010-01-06 Ian Lance Taylor <iant@google.com>
7348
7349 PR 10980
7350 * options.h (class General_options): Add --warn-shared-textrel.
7351 * layout.cc (Layout::finish_dynamic_section): Implement
7352 --warn-shared-textrel.
7353
7354 PR 10980
7355 * options.h (class General_options): Add --warn-multiple-gp.
7356
7357 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7358
7359 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7360 $(THREADSLIB) and $(LIBDL).
7361 * Makefile.in: Rebuild.
7362
7363 2010-01-06 Ian Lance Taylor <iant@google.com>
7364
7365 PR 10980
7366 * options.cc (General_options::parse_section_start): New function.
7367 (General_options::section_start): New function.
7368 (General_options::General_options): Initialize all members.
7369 * options.h: Include <map>
7370 (class General_options): Add --section-start. Add section_starts_
7371 member.
7372 * layout.cc (Layout::attach_allocated_section_to_segment): If
7373 --section-start was used, set the address of the segment. Remove
7374 local sort_sections.
7375 (Layout::relaxation_loop_body): If the address of the load segment
7376 has been set by --section-start, don't use it.
7377 * output.h (Output_segment::update_flags_for_output_section): New
7378 function.
7379 * output.cc (Output_segment::add_output_section): Call
7380 update_flags_for_output_section.
7381
7382 2010-01-05 Ian Lance Taylor <iant@google.com>
7383
7384 PR 10980
7385 * options.h (class General_options): Add --undefined-version.
7386 * script.cc (struct Version_expression): Add was_matched_by_symbol
7387 field.
7388 (Version_script_info::matched_symbol): New function.
7389 (Version_script_info::get_symbol_version_helper): Call
7390 matched_symbol.
7391 (Version_script_info::check_unmatched_names): New function.
7392 * script.h (class Version_script_info): Update declarations.
7393 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7394
7395 * options.h (class General_options): Use DEFINE_bool_alias for
7396 allow_multiple_definition.
7397 * resolve.cc (Symbol_table::should_override): Don't test
7398 allow_multiple_definition.
7399
7400 PR 10980
7401 * options.h (class General_options): Add --cref.
7402 * main.cc (main): Print cref table if --cref. Don't close mapfile
7403 until after printing cref table.
7404 * cref.cc: Include "symtab.h".
7405 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7406 (Cref_table_compare::operator()): New function.
7407 (Cref_inputs::gather_cref): New function.
7408 (filecol): New static const.
7409 (Cref_inputs::print_cref): New function.
7410 (Cref::print_cref): New function.
7411 * cref.h: Include <cstdio>.
7412 (class Cref): Update declarations.
7413 * mapfile.h (Mapfile::file): New function.
7414 * object.h (class Object): Define Symbols. Declare virtual
7415 do_get_global_symbols.
7416 (Object::get_global_symbols): New function.
7417 * object.cc (Input_objects::add_object): Pass object to cref_ if
7418 --cref.
7419 (Input_objects::archive_start): Likewise.
7420 (Input_objects::archive_stop): Likewise.
7421 (Input_objects::print_cref): New function.
7422 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7423 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7424 --cref.
7425 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7426 function.
7427 * plugin.h (class Sized_pluginobj): Update declarations.
7428
7429 2010-01-05 Ian Lance Taylor <iant@google.com>
7430
7431 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7432 to is_default_version. Rename insdef to insdefault.
7433 (Symbol_table::add_from_relobj): Rename def to is_default_version
7434 and local to is_forced_local.
7435 (Symbol_table::add_from_pluginobj): Likewise.
7436 (Symbol_table::add_from_dynobj): Likewise.
7437 (Symbol_table::define_special_symbol): Rename insdef to
7438 insdefault.
7439
7440 2010-01-04 Ian Lance Taylor <iant@google.com>
7441
7442 PR 10980
7443 * options.h (class General_options): Add
7444 --allow-multiple-definition and -z muldefs.
7445 * resolve.cc (Symbol_table::should_override): Don't warn about a
7446 multiple symbol definition if --allow-multiple-definition or -z
7447 muldefs.
7448
7449 PR 10980
7450 * options.h (class General_options): Add --add-needed and
7451 --copy-dt-needed-entries. Tweak --as-needed help entry.
7452 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7453 error if --copy-dt-needed-entries aka --add-needed is used and
7454 would cause a change in behaviour.
7455
7456 PR 10980
7457 * options.h (class General_options): Add -G as a short version of
7458 --shared. Add no-op options -assert, -g, and -i.
7459
7460 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7461
7462 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7463 check for .text or .gnu.linkonce.t sections.
7464 * icf.cc (Icf::find_identical_sections): Ditto.
7465 Change the detection for mangled function name within the section
7466 name.
7467 * icf.h (is_section_foldable_candidate): New function.
7468
7469 2009-12-30 Ian Lance Taylor <iant@google.com>
7470
7471 PR 10980
7472 * options.h (class General_options): Permit two dashes with
7473 --retain-symbols-file.
7474
7475 2009-12-30 Ian Lance Taylor <iant@google.com>
7476
7477 PR 10979
7478 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7479 don't put the file header and segment headers in the text
7480 segment.
7481
7482 PR 10979
7483 * common.cc (Sort_commons::operator()): Stabilize sort when both
7484 entries are NULL.
7485 (Symbol_table::do_allocate_commons_list): When allocating common
7486 symbols, skip a symbol which is no longer common.
7487 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7488 an object before checking its type.
7489 * testsuite/common_test_2.c: New file.
7490 * testsuite/common_test_3.c: New file.
7491 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7492 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7493 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7494 (common_test_2_pic.o, common_test_2.so): New targets.
7495 (common_test_3_pic.o, common_test_3.so): New targets.
7496 * testsuite/Makefile.in: Rebuild.
7497
7498 PR 10979
7499 * script.cc (read_input_script): If we see a new SECTIONS clause,
7500 and we have added an input section, give an error.
7501 * layout.h (class Layout): Add have_added_input_section function.
7502 Add have_added_input_section_ field.
7503 * layout.cc (Layout::Layout): Initialize
7504 have_added_input_section_.
7505 (Layout::layout): Set have_added_input_section_.
7506 (Layout::layout_eh_frame): Likewise.
7507
7508 2009-12-30 Ian Lance Taylor <iant@google.com>
7509
7510 PR 10931
7511 * options.h (class General_options): Add --sort-common option.
7512 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7513 * common.cc (Sort_common): Add sort_order parameter to
7514 constructor. Add sort_order_ field.
7515 (Sort_commons::operator): Check sort_order_.
7516 (Symbol_table::allocate_commons): Determine the sort order.
7517 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7518 Change all callers.
7519 (Symbol_table::do_allocate_commons_list): Likewise.
7520
7521 2009-12-30 Ian Lance Taylor <iant@google.com>
7522
7523 PR 10916
7524 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7525 symbols from this object, don't change the visibility of an
7526 undefined symbol.
7527 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7528
7529 2009-12-30 Ian Lance Taylor <iant@google.com>
7530
7531 PR 10861
7532 * script.h (class Version_script_info): Define Language enum.
7533 Update declarations. Define Glob, Exact, and Lookup types. Add
7534 new fields globals_, locals_, and is_finalized_.
7535 * script.cc: Various formatting fixes.
7536 (class Parser_closure): Change language_stack_ from a vector of
7537 std::string to one of Version_script_info::Language. Adjust all
7538 uses accordingly.
7539 (class Lazy_demangler): Remove.
7540 (struct Version_expression): Change language from std::string to
7541 Version_script_info::Language.
7542 (Version_script_info::Version_script_info): New function.
7543 (Version_script_info::~Version_script_info): Don't call clear.
7544 (Version_script_info::finalize): New function.
7545 (Version_script_info::build_lookup_tables): New function.
7546 (Version_script_info::build_expression_list_lookup): New
7547 function.
7548 (Version_script_info::get_symbol_version_helper): Rewrite to use
7549 lookup tables.
7550 (Version_script_info::print_expression_list): Adjust to use
7551 Version_script_info::Language.
7552 (script_push_lex_into_version_mode): Check that the version script
7553 has not been finalized.
7554 (version_script_push_lang): Change language string to
7555 Version_script_info::Language.
7556 * options.cc (Command_line::version_script): New function.
7557 * options.h (class General_options): Add finalize_dynamic_list
7558 function. Change version_script from declaration to definition.
7559 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7560 * testsuite/version_script.map: Remove duplicate def of foo.
7561 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7562 version_script.map.
7563 * testsuite/Makefile.in: Rebuild.
7564
7565 2009-12-30 Ian Lance Taylor <iant@google.com>
7566
7567 PR 10843
7568 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7569 if the input symbol index is 0, make the output symbol index 0.
7570
7571 2009-12-30 Ian Lance Taylor <iant@google.com>
7572
7573 PR 10670
7574 * options.h (class General_options): Add -x/--discard-all.
7575 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7576 --discard-all. If the local symbol needs a dynamic entry, check
7577 that before handling --discard-locals.
7578
7579 2009-12-30 Ian Lance Taylor <iant@google.com>
7580
7581 PR 10450
7582 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7583 flags to PF_R.
7584 (Output_segment::add_output_section): Don't change the flags if
7585 the type is PT_TLS.
7586
7587 PR 10450
7588 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7589 GNU hash table if they need a dynamic value. Otherwise, don't add
7590 them if they are defined in a dynamic object or are forced local.
7591
7592 2009-12-29 Ian Lance Taylor <iant@google.com>
7593
7594 PR 10450
7595 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7596 .gnu.hash table for a 32-bit target.
7597
7598 PR 10450
7599 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7600 regular and a dynamic object only needs a dynamic symbol table
7601 entry if it is externally visible.
7602
7603 PR 10450
7604 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7605 constructor. Add global_offset_table_ field.
7606 (Target_i386::got_section): Set global_offset_table_.
7607 (Target_i386::do_finalize_sections): Set global_offset_table_
7608 size.
7609 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7610 in constructor. Add global_offset_table_ field.
7611 (Target_x86_64::got_section): Set global_offset_table_.
7612 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7613 size.
7614
7615 * layout.cc (Layout::Layout): Initialize increase_relro_.
7616 (Layout::get_output_section): Add is_relro, is_last_relro, and
7617 is_first_non_relro parameters. Change all callers.
7618 (Layout::choose_output_section): Likewise.
7619 (Layout::add_output_section_data): Likewise.
7620 (Layout::make_output_section): Likewise.
7621 (Layout::set_segment_offsets): Clear increase_relro when using a
7622 linker script.
7623 * layout.h (class Layout): Add increase_relro method. Add
7624 increase_relro_ field. Update declarations.
7625 * output.cc (Output_section::Output_section): Initialize
7626 is_last_relro_ and is_first_non_relro_.
7627 (Output_segment::add_output_section): Group relro sections is
7628 do_sort is true. Handle is_last_relro and is_first_non_relro.
7629 (Output_segment::maximum_alignment): Remove relro handling.
7630 (Output_segment::set_section_addresses): Add increase_relro
7631 parameter. Change all callers. Add initial alignment to align
7632 relro sections on separate page. Remove old relro handling.
7633 (Output_segment::set_section_list_addresses): Remove in_relro
7634 parameter. Change all callers.
7635 (Output_segment::set_offset): Add increase parameter. Change all
7636 callers. Remove old relro handling.
7637 * output.h (class Output_section): Add new methods: is_last_relro,
7638 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7639 Add is_last_relro_ and is_first_non_relro_ fields.
7640 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7641 Create separate .got.plt section. Call increase_relro.
7642 * x86_64.cc (Target_x86_64::got_section): Likewise.
7643 * testsuite/relro_script_test.t: Add .got.plt.
7644
7645 PR 10450
7646 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7647 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7648 (Layout::finalize): Call set_dynamic_symbol_size.
7649 (Layout::set_dynamic_symbol_size): New function.
7650 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7651 set_dynamic_symbol_size.
7652
7653 PR 10450
7654 * output.h (class Output_section): Add is_entsize_zero_ field.
7655 * output.cc (Output_section::Output_section): Initialize
7656 is_entsize_zero_.
7657 (Output_section::set_entsize): If two different entsizes are
7658 requested, force it to zero.
7659 (Output_section::add_input_section): Set flags for .debug_str
7660 before updating section flags. Set entsize.
7661 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7662 and SHF_STRING if all input sections have those flags.
7663
7664 2009-12-29 Rafael Espindola <espindola@google.com>
7665
7666 * main.cc (main): Fix the sys time reporting.
7667 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7668 reporting.
7669
7670 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7671
7672 * options.cc (General_options::parse_version): Allow -v to exit
7673 without an error if there is nothing to link.
7674
7675 2009-12-29 Ian Lance Taylor <iant@google.com>
7676
7677 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7678 using a version of gcc before 4.1.
7679 * configure: Rebuild.
7680
7681 2009-12-28 Chris Demetriou <cgd@google.com>
7682
7683 * attributes.cc (Output_attributes_section_data::do_write): Use
7684 std::vector::front rather than std::vector::data.
7685
7686 2009-12-28 Ian Lance Taylor <iant@google.com>
7687
7688 * symtab.h (class Symbol_table): Add enum Defined.
7689 * resolve.cc (Symbol_table::should_override): Add defined
7690 parameter. Change all callers. Test whether object is NULL
7691 before calling a method on it.
7692 (Symbol_table::report_resolve_problem): Add defined parameter.
7693 Change all callers.
7694 (Symbol_table::should_override_with_special): Likewise.
7695 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7696 parameter. Change all callers.
7697 (Symbol_table::do_define_in_output_data): Likewise.
7698 (Symbol_table::define_in_output_segment): Likewise.
7699 (Symbol_table::do_define_in_output_segment): Likewise.
7700 (Symbol_table::define_as_constant): Likewise.
7701 (Symbol_table::do_define_as_constant): Likewise.
7702 * script.h (class Symbol_assignment): Add is_defsym parameter to
7703 constructor; change all callers.
7704 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7705 parameter. Change all callers. Add is_defsym_ field.
7706 (class Parser_closure): Add parsing_defsym parameter to
7707 constructor; change all callers. Add parsing_defsym accessor
7708 function. Add parsing_defsym_ field.
7709
7710 2009-12-28 Ian Lance Taylor <iant@google.com>
7711
7712 * gold.cc (queue_middle_tasks): Fix formatting.
7713 * object.cc (Relobj::is_section_name_included): Likewise.
7714
7715 2009-12-23 Ian Lance Taylor <iant@google.com>
7716
7717 * i386.cc (Target_i386::do_calls_non_split): Recognize
7718 -fsplit-stack prologue for a function with a static chain.
7719 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7720 -fsplit-stack prologue when using %r11.
7721
7722 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7723
7724 * options.cc (General_options::parse_version): Make -v continue and do
7725 the link like GNU ld does.
7726
7727 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7728
7729 * Makefile.am (CCFILES): Add timer.cc.
7730 (HFILES): Add timer.h.
7731 * configure.ac: Check for sysconf and times.
7732 * main.cc: include timer.h.
7733 (main): Use Timer instead of get_run_time.
7734 * timer.cc: New.
7735 * timer.h: New.
7736 * workqueue.cc: include timer.h.
7737 (Workqueue::find_and_run_task):
7738 Report user, sys and wall time.
7739 * Makefile.in: Regenerate.
7740 * config.in: Regenerate.
7741 * configure: Regenerate.
7742
7743 2009-12-16 Doug Kwan <dougkwan@google.com>
7744
7745 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7746 sections.
7747 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7748 relaxed input sections.
7749 * output.cc (Output_section::find_relaxed_input_section): Change
7750 return type to Output_relaxed_input_section pointer. Adjust code
7751 for new type of relaxed_input_section_map_.
7752 * output.h (Output_section::find_relaxed_input_section): Change
7753 return type to Output_relaxed_input_section pointer.
7754 (Output_section::Output_relaxed_input_section_by_input_section_map):
7755 New type.
7756 (Output_section::relaxed_input_section_map_): Change type to
7757 Output_section::Output_relaxed_input_section_by_input_section_map.
7758 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7759 input section.
7760
7761 2009-12-15 Ian Lance Taylor <iant@google.com>
7762
7763 * layout.cc (Layout::create_shstrtab): Only write out after input
7764 sections if we are compressing debug sections.
7765
7766 2009-12-15 Ian Lance Taylor <iant@google.com>
7767
7768 * archive.cc (Archive::add_symbols): Only look up a symbol without
7769 a version if there is, in fact, a version.
7770
7771 2009-12-14 Ian Lance Taylor <iant@google.com>
7772
7773 Revert -Wshadow changes, all changes from:
7774 2009-12-11 Doug Kwan <dougkwan@google.com>
7775 2009-12-11 Nick Clifton <nickc@redhat.com>
7776 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7777
7778 2009-12-11 Doug Kwan <dougkwan@google.com>
7779
7780 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7781 due to -Wshadow.
7782 * attributes.cc (Object_attribute::size): Ditto.
7783 (Attributes_section_data::size): Ditto.
7784 (Attributes_section_data::Attributes_section_data): Ditto.
7785 (Output_attributes_section_data::do_write): Ditto.
7786 * attributes.h (Object_attribute::set_type): Ditto.
7787 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7788
7789 2009-12-11 Nick Clifton <nickc@redhat.com>
7790
7791 * archive.cc: Fix shadowed variable warnings.
7792 * arm.cc: Likewise.
7793 * compressed_output.cc: Likewise.
7794 * compressed_output.h: Likewise.
7795 * configure: Likewise.
7796 * dwarf_reader.cc: Likewise.
7797 * dynobj.cc: Likewise.
7798 * dynobj.h: Likewise.
7799 * ehframe.cc: Likewise.
7800 * ehframe.h: Likewise.
7801 * errors.cc: Likewise.
7802 * expression.cc: Likewise.
7803 * fileread.cc: Likewise.
7804 * fileread.h: Likewise.
7805 * freebsd.h: Likewise.
7806 * i386.cc: Likewise.
7807 * icf.cc: Likewise.
7808 * incremental.h: Likewise.
7809 * layout.cc: Likewise.
7810 * layout.h: Likewise.
7811 * mapfile.cc: Likewise.
7812 * merge.cc: Likewise.
7813 * merge.h: Likewise.
7814 * object.cc: Likewise.
7815 * object.h: Likewise.
7816 * options.h: Likewise.
7817 * output.cc: Likewise.
7818 * output.h: Likewise.
7819 * parameters.cc: Likewise.
7820 * plugin.cc: Likewise.
7821 * powerpc.cc: Likewise.
7822 * reduced_debug_output.cc: Likewise.
7823 * reduced_debug_output.h: Likewise.
7824 * reloc.cc: Likewise.
7825 * reloc.h: Likewise.
7826 * resolve.cc: Likewise.
7827 * script-sections.cc: Likewise.
7828 * script.cc: Likewise.
7829 * script.h: Likewise.
7830 * sparc.cc: Likewise.
7831 * symtab.cc: Likewise.
7832 * symtab.h: Likewise.
7833 * target-select.cc: Likewise.
7834 * target-select.h: Likewise.
7835 * token.h: Likewise.
7836 * workqueue.cc: Likewise.
7837 * workqueue.h: Likewise.
7838 * x86_64.cc: Likewise.
7839
7840 2009-12-10 Doug Kwan <dougkwan@google.com>
7841
7842 * arm.cc (attributes.h): New include.
7843 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7844 (Arm_relobj::~Arm_relobj): Delete object pointed by
7845 attributes_section_data_.
7846 (Arm_relobj::attributes_section_data): New method definition.
7847 (Arm_relobj::attributes_section_data_): New data member declaration.
7848 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7849 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7850 attributes_section_data_.
7851 (Arm_dynobj::attributes_section_data): New method definition.
7852 (Arm_dynobj::attributes_section_data_): New data member declaration.
7853 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7854 initialization value of may_use_blx_ to false.
7855 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7856 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7857 object attributes to compute results instead of hard-coding.
7858 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7859 Target_arm::get_secondary_compatible_arch,
7860 Target_arm::set_secondary_compatible_arch
7861 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7862 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7863 New method declarations.
7864 (Target_arm::get_aeabi_object_attribute): New method definition.
7865 (Target_arm::attributes_section_data_): New data member declaration.
7866 (read_arm_attributes_section): New template definition.
7867 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7868 (Arm_dynobj::do_read_symbols): Ditto.
7869 (Target_arm::do_finalize_sections): Merge attributes sections from
7870 input. Check for BLX use after attributes section merging.
7871 Fix __exidx_start and __exidx_end visibility. Create an
7872 .ARM.attributes section if necessary.
7873 (Target_arm::get_secondary_compatible_arch,
7874 Target_arm::set_secondary_compatible_arch,
7875 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7876 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7877 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7878 New method definitions.
7879
7880 2009-12-09 Ian Lance Taylor <iant@google.com>
7881
7882 * plugin.cc (Plugin::load): Don't cast from void* to a function
7883 pointer.
7884
7885 2009-12-09 Ian Lance Taylor <iant@google.com>
7886
7887 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7888 information fields.
7889
7890 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7891
7892 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7893 Replace two_file_shared_1.so with two_file_shared_2.so.
7894 * testsuite/Makefile.in: Regenerated.
7895
7896 2009-12-08 Doug Kwan <dougkwan@google.com>
7897
7898 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7899 (HFILES): Add attributes.h and int_encoding.h.
7900 * Makefile.in: Regenerate.
7901 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7902 function definitions to int_encoding.cc
7903 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7904 prototypes to int_encoding.h
7905 * reduced_debug_output.cc (int_encoding.h): New include.
7906 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7907 function definitions to int_encoding.cc
7908 (insert_into_vector, read_from_pointer): Move template definitions to
7909 int_encoding.h
7910 * attributes.cc: New file.
7911 * attributes.h: New file.
7912 * int_encoding.cc: New file.
7913 * int_encoding.h: New file.
7914
7915 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7916
7917 PR gold/11055
7918 * incremental-dump.cc (dump_incremental_inputs): New.
7919 (main): Use dump_incremental_inputs.
7920
7921 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7922
7923 PR gold/10893
7924 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7925 checking elfcpp::STT_FUNC.
7926 (Target_i386::Relocate::relocate): Likewise.
7927 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7928
7929 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7930 symbols from shared libraries into normal FUNC symbols.
7931
7932 * symtab.h (Symbol): Add is_func and use it.
7933
7934 2009-12-05 Doug Kwan <dougkwan@google.com>
7935
7936 * arm.cc (Target_arm::arm_info): Initialize new fields
7937 attributes_section and attributes_vendor.
7938 * i386.cc (Target_i386::i386_info): Same.
7939 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7940 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7941 fields attributes_section and attributes_vendor.
7942 * sparc.cc (Target_sparc::sparc_info): Same.
7943 * target.h (Target::attributes_section, Target::attributes_vendor,
7944 Target::is_attributes_section, Target::attribute_arg_type,
7945 Target::attributes_order): New method definitions.
7946 (Target::Target_info::attributes_section,
7947 Target::Target_info::attributes_vendor): New fields.
7948 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7949 virtual method definitions.
7950 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7951 attributes_section and attributes_vendor.
7952 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7953
7954 2009-12-05 Doug Kwan <dougkwan@google.com>
7955
7956 * arm.cc: Update comments about interworking and stub generation.
7957 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7958 considered as non-PIC.
7959 (Arm_relocate_functions::base_abs): Fix formatting.
7960 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7961 of function to use GOT entry address instead of offset.
7962 (Target_arm::Scan::global): Issue an error if a symbol would need a
7963 PLT does not get one because it is untyped. Remove code to create
7964 dynamic symbols for relative branches.
7965 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7966 takes unsigned integer instead of boolean.
7967
7968 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7969
7970 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7971 (two_file_test_LDADD): Likewise.
7972 (common_test_1_LDADD): Likewise.
7973 (exception_test_LDADD) Likewise.
7974 (weak_test_LDADD): Likewise.
7975 (many_sections_test_LDADD): Likewise.
7976 (initpri1_LDADD): Likewise.
7977 (script_test_1_LDADD): Likewise.
7978 (script_test_2_LDADD): Likewise.
7979 (justsyms_LDADD): Likewise.
7980 (binary_test_LDADD): Likewise.
7981 (large_LDADD): Likewise.
7982 * testsuite/Makefile.in: Regenerated.
7983
7984 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7985
7986 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7987 (Symbol_table::override_with_special): Likewise.
7988 (Symbol_table::add_from_object): Likewise.
7989
7990 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7991
7992 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7993 Don't set the data_offset twice.
7994
7995 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7996
7997 * testsuite/Makefile.in: Regenerate.
7998
7999 2009-12-03 Doug Kwan <dougkwan@google.com>
8000
8001 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8002 (Target_arm::do_finalize_sections): Add parameter for symbol table
8003 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8004 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8005 parameter for symbol table pointer.
8006 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8007 an additional parameter for a pointer to symbol table.
8008 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8009 parameter for a symbol table pointer.
8010 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8011 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8012 Ditto.
8013 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8014 parameter for a symbol table pointer.
8015
8016 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8017
8018 * incremental.cc (Incremental_inputs_header)
8019 (Incremental_inputs_header_write, Incremental_inputs_entry)
8020 (Incremental_inputs_entry_write): Move ...
8021 * incremental.h (Incremental_inputs_header)
8022 (Incremental_inputs_header_write, Incremental_inputs_entry)
8023 (Incremental_inputs_entry_write): here.
8024
8025 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8026
8027 * incremental.cc (make_sized_incremental_binary): Set the target.
8028 Error if it is incompatible.
8029 * output.h (Output_file): Add filename method.
8030
8031 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8032
8033 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8034 from the get_* methods.
8035
8036 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8037
8038 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8039 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8040 Write 0 for the data_offset of scripts.
8041
8042 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8043
8044 * testsuite/Makefile.am: Add the incremental_test.sh test.
8045 * testsuite/incremental_test.sh: New.
8046 * testsuite/incremental_test_1.c: New.
8047 * testsuite/incremental_test_2.c: New.
8048
8049 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8050
8051 * incremental-dump.cc (main): Fix typos.
8052
8053 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8054
8055 PR gold/11025
8056 * incremental-dump.cc (main): Use llu to print 64 bit values.
8057
8058 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8059 H.J. Lu <hongjiu.lu@intel.com>
8060
8061 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8062 $(LIBDL).
8063 (incremental_dump_LDADD): Likewise.
8064 * Makefile.in: Regenerated.
8065
8066 2009-11-25 Doug Kwan <dougkwan@google.com>
8067
8068 Revert:
8069
8070 2009-11-25 Doug Kwan <dougkwan@google.com>
8071
8072 * arm.cc (Target_arm::Target_arm): Move method definition
8073 outside of class definition. Add code to handle
8074 --target1-rel, --target1-abs and --target2= options.
8075 (Target_arm::get_reloc_reloc_type): Change method to be
8076 non-static and const.
8077 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8078 New data member declaration.
8079 (Target_arm::Scan::local, Target_arm::Scan::global,
8080 Target_arm::Relocate::relocate,
8081 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8082 Adjust call to Target_arm::get_real_reloc_type.
8083 (Target_arm::get_real_reloc_type): Use command line options
8084 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8085 * options.h (--target1-rel, --target1-abs, --target2): New
8086 ARM-only options.
8087
8088 2009-11-25 Doug Kwan <dougkwan@google.com>
8089
8090 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8091 class definition. Add code to handle --target1-rel, --target1-abs
8092 and --target2= options.
8093 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8094 and const.
8095 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8096 member declaration.
8097 (Target_arm::Scan::local, Target_arm::Scan::global,
8098 Target_arm::Relocate::relocate,
8099 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8100 call to Target_arm::get_real_reloc_type.
8101 (Target_arm::get_real_reloc_type): Use command line options to
8102 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8103 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8104 options.
8105
8106 2009-11-25 Doug Kwan <dougkwan@google.com>
8107
8108 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8109 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8110 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8111 formatting.
8112 (Arm_relocate_functions::thm_call): Replace body with a call to
8113 Arm_relocate_functions::thumb_branch_common.
8114 (Arm_relocate_functions::thm_jump24,
8115 Arm_relocate_functions::thm_xpc22): New method definitions.
8116 (Arm_relocate_functions::thumb_branch_common): New method definition.
8117 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8118 operator.
8119 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8120 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8121
8122 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8123
8124 * Makefile.am: Build incremental-dump
8125 * Makefile.in: Regenerate.
8126 * incremental-dump.cc: New.
8127 * incremental.cc (Incremental_inputs_header_data,
8128 Incremental_inputs_entry_data): Move to incremental.h
8129 * incremental.h: (Incremental_inputs_header_data,
8130 Incremental_inputs_entry_data): Move from incremental.cc
8131
8132 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8133
8134 * incremental.cc (Incremental_inputs_header,
8135 Incremental_inputs_header_write, Incremental_inputs_entry,
8136 Incremental_inputs_entry_write): Add a typedef with the data type.
8137
8138 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8139
8140 * incremental.cc (Incremental_inputs_header,
8141 Incremental_inputs_header_write, Incremental_inputs_entry,
8142 Incremental_inputs_entry_write): Update comment about which
8143 type has the filed descriptions.
8144
8145 2009-11-15 Doug Kwan <dougkwan@google.com>
8146
8147 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8148 (Arm_relocate_functions::arm_branch_common): Change method defintion
8149 in class definition to a method declaration and update list of formal
8150 parameters.
8151 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8152 Arm_relocation_functions::jump24): Adjust call to
8153 Arm_relocate_functions::arm_branch_common. Update list of formal
8154 parameters.
8155 (Arm_relocate_functions::xpc25): New method definition.
8156 (Arm_relocate_functions::arm_branch_common): Move method defintion
8157 out from class definition. Use stubs for mode-switching and extending
8158 branch ranges.
8159 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8160 specially. Change code to enable use of stubs in ARM branches.
8161
8162 2009-11-10 Doug Kwan <dougkwan@google.com>
8163
8164 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8165 in method declaration.
8166 (Target_arm::relocate_stub): New method declaration.
8167 (Target_arm::default_target): Change to return a pointer instead of
8168 a const reference.
8169 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8170 Target_arm::default_target.
8171 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8172 method definition.
8173 (Target_arm::relocate_section): Adjust view.
8174 (Target_arm::relocate_stub): New method definition.
8175
8176 2009-11-10 Doug Kwan <dougkwan@google.com>
8177
8178 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8179 a format warning.
8180 * incremental.cc (open_incremental_binary): Initialized local
8181 variables to avoid warnings.
8182 * object.cc (make_elf_object): Ditto.
8183 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8184 a format warning.
8185
8186 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8187
8188 PR gold/10930
8189 * testsuite/plugin_test.c: Include "config.h".
8190
8191 2009-11-09 Doug Kwan <dougkwan@google.com>
8192
8193 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8194 (arm_symbol_value): Remove.
8195 (Arm_relocate_functions::arm_branch_common,
8196 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8197 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8198 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8199 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8200 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8201 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8202 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8203 Arm_relocate_functions::thm_mobw_abs_nc,
8204 Arm_relocate_functions::thm_mov_abs,
8205 Arm_relocate_functions::movw_prel_nc,
8206 Arm_relocate_functions::thm_movt_abs,
8207 Arm_relocate_functions::movt_prel,
8208 Arm_relocate_functions::thm_movw_prel_nc,
8209 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8210 (Target_arm::Relocate::relocate): Only decompose address into two
8211 parts if relocation type uses the thumb-bit and pass the actual
8212 bit instead of a flag indicating that the thumb-bit is used. Adjust
8213 calls to methods in Arm_relocate_functions for this change.
8214
8215 2009-11-08 Ian Lance Taylor <iant@google.com>
8216
8217 PR 10925
8218 * reloc.cc: Instantiate
8219 Sized_relobj::initialize_input_to_output_maps and
8220 Sized_relobj:free_input_to_output_maps.
8221
8222 2009-11-06 Ian Lance Taylor <iant@google.com>
8223
8224 PR 10876
8225 * defstd.cc (in_segment): Set only_if_ref true for "end".
8226
8227 2009-11-06 Doug Kwan <dougkwan@google.com>
8228
8229 * arm.cc (class Reloc_stub): Correct a comment.
8230 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8231 (Target_arm::scan_section_for_stubs): New method declaration.
8232 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8233 Change methods from private to protected.
8234 (Target_arm::do_may_relax): New method definition.
8235 (Target_arm::do_relax, Target_arm::group_sections,
8236 Target_arm::scan_reloc_for_stub,
8237 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8238 (Target_arm::arm_input_section_map_): New data member declaration.
8239 (Target_arm::scan_reloc_for_stub,
8240 Target_arm::scan_reloc_section_for_stubs,
8241 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8242 Target_arm::do_relax): New method definitions.
8243
8244 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8245
8246 * configure.ac: Check for (struct stat)::st_mtim
8247 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8248 * config.in: Regenerate.
8249 * configure: Regenerate.
8250
8251 2009-11-05 Ian Lance Taylor <iant@google.com>
8252
8253 PR 10910
8254 * output.cc (Output_segment::add_output_section): Add missing
8255 return statement.
8256
8257 2009-11-04 Ian Lance Taylor <iant@google.com>
8258
8259 PR 10880
8260 * object.h (class Object): Add is_needed and set_is_needed
8261 methods. Add is_needed_ field. Make bool fields into bitfields.
8262 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8263 defined in a dynamic object and referenced by a regular object,
8264 set is_needed for the dynamic object.
8265 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8266 if the file is marked with as_needed and it is not needed.
8267
8268 2009-11-04 Ian Lance Taylor <iant@google.com>
8269
8270 PR 10887
8271 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8272 tags if data is discarded by linker script.
8273 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8274 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8275 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8276 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8277
8278 2009-11-04 Ian Lance Taylor <iant@google.com>
8279
8280 * layout.cc (Layout::get_output_section): Add is_interp and
8281 is_dynamic_linker_section parameters. Change all callers.
8282 (Layout::choose_output_section): Likewise.
8283 (Layout::make_output_section): Likewise.
8284 (Layout::add_output_section_data): Add is_dynamic_linker_section
8285 parameter. Change all callers.
8286 * layout.h (class Layout): Update declarations.
8287 * output.h (class Output_section): Add is_interp, set_is_interp,
8288 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8289 Add is_interp_, is_dynamic_linker_section_ fields. Change
8290 generate_code_fills_at_write_ to a bitfield.
8291 * output.cc (Output_section::Output_sections): Initialize new
8292 fields.
8293 (Output_segment::add_output_section): Add do_sort parameter.
8294 Change all callers.
8295
8296 2009-11-03 Ian Lance Taylor <iant@google.com>
8297
8298 PR 10860
8299 * options.h (class General_options): Add --warn-common.
8300 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8301 merging two common symbols.
8302 (Symbol_table::should_override): Handle --warn-common when merging
8303 a common symbol with a defined symbol. Use report_resolve_problem
8304 for multiple definitions.
8305 (Symbol_table::report_resolve_problem): New function.
8306 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8307
8308 2009-11-03 Doug Kwan <dougkwan@google.com>
8309
8310 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8311 stub_factory_.
8312 (Target_arm::stub_factory): New method definition.
8313 (Target_arm::new_arm_input_section,
8314 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8315 Target_arm::reloc_uses_thumb_bit): New method declarations.
8316 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8317 New type definitions.
8318 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8319 member declarations.
8320 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8321 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8322 New method definitions.
8323
8324 2009-11-03 Ian Lance Taylor <iant@google.com>
8325
8326 * options.h (class General_options): Add --warn_constructors.
8327
8328 2009-11-03 Ian Lance Taylor <iant@google.com>
8329
8330 PR 10893
8331 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8332 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8333
8334 2009-11-03 Ian Lance Taylor <iant@google.com>
8335
8336 PR 10895
8337 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8338 --msgid-bugs-address.
8339 (install-pdf): New target.
8340 (install-data_yes): Look up one directory to find mkinstalldirs.
8341
8342 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8343
8344 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8345 tree.
8346
8347 2009-10-30 Doug Kwan <dougkwan@google.com>
8348
8349 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8350
8351 2009-10-30 Doug Kwan <dougkwan@google.com>
8352
8353 * arm.cc (Stub_addend_reader): New struct template definition
8354 and partial specializations.
8355 (Stub_addend_reader::operator()): New method definition for a
8356 partially specialized template.
8357
8358 2009-10-30 Doug Kwan <dougkwan@google.com>
8359
8360 * arm.cc (Arm_relobj::processor_specific_flags): New method
8361 definition.
8362 (Arm_relobj::do_read_symbols): New method declaration.
8363 (Arm_relobj::processor_specific_flags_): New data member declaration.
8364 (Arm_dynobj): New class definition.
8365 (Target_arm::do_finalize_sections): Add input_objects parameter.
8366 (Target_arm::do_adjust_elf_header): New method declaration.
8367 (Target_arm::are_eabi_versions_compatible,
8368 (Target_arm::merge_processor_specific_flags): New method declaration.
8369 (Target_arm::do_make_elf_object): New overloaded method definitions
8370 and declaration.
8371 (Arm_relobj::do_read_symbols): New method definition.
8372 (Arm_dynobj::do_read_symbols): Ditto.
8373 (Target_arm::do_finalize_sections): Add input_objects parameters.
8374 Merge processor-specific flags from all input objects.
8375 (Target_arm::are_eabi_versions_compatible,
8376 Target_arm::merge_processor_specific_flags,
8377 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8378 New method definitions.
8379 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8380 Input_objects pointer type parameter.
8381 * layout.cc (Layout::finalize): Pass input objects to target's.
8382 finalize_sections function.
8383 * output.cc (Output_file_header::do_sized_write): Set ELF file
8384 header's processor-specific flags.
8385 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8386 Input_objects pointer type parameter.
8387 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8388 * target.h (Input_objects): New forward class declaration.
8389 (Target::processor_specific_flags,
8390 Target::are_processor_specific_flags_sect): New method definitions.
8391 (Target::finalize_sections): Add input_objects parameter.
8392 (Target::Target): Initialize processor_specific_flags_ and
8393 are_processor_specific_flags_set_.
8394 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8395 parameter.
8396 (Target::set_processor_specific_flags): New method definition.
8397 (Target::processor_specific_flags_,
8398 Target::are_processor_specific_flags_set_): New data member
8399 declarations.
8400 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8401 Input_objects pointer type parameter.
8402
8403 2009-10-30 Doug Kwan <dougkwan@google.com>
8404
8405 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8406
8407 2009-10-28 Ian Lance Taylor <iant@google.com>
8408
8409 * object.h (class Relobj): Drop options parameter from
8410 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8411 do_scan_relocs, do_relocate. Change all callers.
8412 (class Sized_relobj): Drop options parameters from
8413 do_gc_process_relocs, do_scan_relocs, do_relocate,
8414 do_relocate_sections, relocate_sections, emit_relocs_scan,
8415 emit_relocs_scan_reltype. Change all callers.
8416 (struct Relocate_info): Remove options field and all references to
8417 it.
8418 * reloc.h (class Read_relocs): Remove options constructor
8419 parameter and options_ field. Change all callers.
8420 (class Gc_process_relocs, class Scan_relocs): Likewise.
8421 (class Relocate_task): Likewise.
8422 * target-reloc.h (scan_relocs): Remove options parameter. Change
8423 all callers.
8424 (scan_relocatable_relocs): Likewise.
8425 * target.h (class Sized_target): Remove options parameter from
8426 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8427 all callers.
8428 * gc.h (gc_process_relocs): Remove options parameter. Change all
8429 callers.
8430 * arm.cc: Update functions to remove options parameters.
8431 * i386.cc: Likewise.
8432 * powerpc.cc: Likewise.
8433 * sparc.cc: Likewise.
8434 * x86_64.cc: Likewise.
8435 * testsuite/testfile.cc: Likewise.
8436
8437 2009-10-28 Doug Kwan <dougkwan@google.com>
8438
8439 * arm.cc (Arm_relobj): New class definition.
8440 (Arm_relobj::scan_sections_for_stubs,
8441 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8442 New method definitions.
8443
8444 2009-10-28 Cary Coutant <ccoutant@google.com>
8445
8446 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8447 (Plugin::cleanup_done_): New member.
8448 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8449 (Plugin_manager::cleanup_done_): Remove.
8450 (Plugin_manager::add_input_file): Edit error message.
8451 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8452 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8453
8454 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8455
8456 * fileread.cc: (File_read::View::~View): Use the new
8457 data_ownership_ filed.
8458 (File_read::~File_read): Dispose the new whole_file_view_.
8459 (File_read::open): Mmap the whole file if needed.
8460 (File_read::open): Use whole_file_view_ instead of contents_.
8461 (File_read::find_view): Use whole_file_view_ if applicable.
8462 (File_read::do_read): Use whole_file_view_ instead of contents_.
8463 (File_read::make_view): Use whole_file_view_ instead of contents_,
8464 update File_read::View::View call.
8465 (File_read::find_or_make_view): Update File_read::View::View
8466 call.
8467 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8468 remove contents_
8469 (File_read::View::Data_ownership): New enum.
8470 (File_read::View::View): Replace bool mapped_ with Data_ownership
8471 argument.
8472 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8473 (File_read::View::data_ownership_): New field.
8474 (File_read::contents_): Remove (replaced by whole_file_view_).
8475 (File_read::whole_file_view_): New field.
8476 * options.h (class General_options): Add --keep-files-mapped.
8477
8478 2009-10-27 Cary Coutant <ccoutant@google.com>
8479
8480 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8481 * testsuite/Makefile.am (plugin_test_5): New test case.
8482 * testsuite/Makefile.in: Regenerate.
8483
8484 2009-10-25 Doug Kwan <dougkwan@google.com>
8485
8486 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8487 from private to protected to allow access by child class.
8488 (Sized_relobj::do_relocate_sections): New method declaration.
8489 (Sized_relobj::relocate_sections): Virtualize.
8490 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8491 Sized_relobj::relocate_sections. Instantiate template explicitly
8492 for different target sizes and endianity.
8493
8494 2009-10-24 Doug Kwan <dougkwan@google.com>
8495
8496 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8497 (Arm_input_section::as_arm_input_section): New method.
8498 (Arm_output_section): New class definition.
8499 (Arm_output_section::create_stub_group,
8500 Arm_output_section::group_sections): New method definitions.
8501
8502 2009-10-22 Doug Kwan <dougkwan@google.com>
8503
8504 * arm.cc (Arm_input_section): New class definition.
8505 (Arm_input_section::init, Arm_input_section:do_write,
8506 Arm_input_section::set_final_data_size,
8507 Arm_input_section::do_reset_address_and_file_offset): New method
8508 definitions.
8509
8510 2009-10-21 Doug Kwan <dougkwan@google.com>
8511
8512 * arm.cc (Stub_table, Arm_input_section): New forward class
8513 declarations.
8514 (Stub_table): New class defintion.
8515 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8516 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8517 New method definition.
8518
8519 2009-10-21 Doug Kwan <dougkwan@google.com>
8520
8521 * arm.cc: Update copyright comments.
8522 (Target_arm): New forward class template declaration.
8523 (Arm_address): New type.
8524 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8525 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8526 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8527 constants.
8528 (Insn_template): Same.
8529 (DEF_STUBS): New macro.
8530 (Stub_type): New enum type.
8531 (Stub_template): New class definition.
8532 (Stub): Same.
8533 (Reloc_stub): Same.
8534 (Stub_factory): Same.
8535 (Target_arm::Target_arm): Initialize may_use_blx_ and
8536 should_force_pic_veneer_.
8537 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8538 Target_arm::should_force_pic_veneer,
8539 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8540 Target_arm::using_thumb_only, Target_arm:;default_target): New
8541 method defintions.
8542 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8543 New data member declarations.
8544 (Insn_template::size, Insn_template::alignment): New method defintions.
8545 (Stub_template::Stub_template): New method definition.
8546 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8547 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8548 (Stub_factory::Stub_factory): New method definition.
8549 * gold.h (string_hash): New template.
8550 * output.h (Input_section_specifier::hash_value): Use
8551 gold::string_hash.
8552 (Input_section_specifier::string_hash): Remove.
8553 * stringpool.cc (Stringpool_template::string_hash): Use
8554 gold::string_hash.
8555
8556 2009-10-20 Doug Kwan <dougkwan@google.com>
8557
8558 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8559 symbols of relaxed input sections.
8560 * output.h (Output_section::find_relaxed_input_section): Make
8561 method public.
8562
8563 2009-10-16 Doug Kwan <dougkwan@google.com>
8564
8565 * dynobj.cc (Versions::Versions): Initialize version_script_.
8566 Only insert base version symbol definition for a shared object
8567 if version script defines any version versions.
8568 (Versions::define_base_version): New method definition.
8569 (Versions::add_def): Check that base version is not needed.
8570 (Versions::add_need): Define base version lazily.
8571 * dynobj.h (Versions::define_base_version): New method declaration.
8572 (Versions::needs_base_version_): New data member declaration.
8573 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8574 (check_DATA): Add no_version_test.stdout.
8575 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8576 New make rules.
8577 * testsuite/Makefile.in: Regenerate.
8578 * testsuite/no_version_test.c: New file.
8579 * testsuite/no_version_test.sh: Ditto.
8580
8581 2009-10-16 Doug Kwan <dougkwan@google.com>
8582
8583 * expression.cc (class Segment_start_expression): New class definition.
8584 (Segment_start_expression::value): New method definition.
8585 (script_exp_function_segment_start): Return a new
8586 Segment_start_expression.
8587 * gold/script-c.h (script_saw_segment_start_expression): New function
8588 prototype.
8589 * script-sections.cc (Script_sections::Script_sections): Initialize
8590 SAW_SEGMENT_START_EXPRESSION_ to false.
8591 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8592 and -Tbbs options to specify section addresses if given in
8593 command line and no SEGMENT_START expression is seen in a script.
8594 * script-sections.h (Script_sections::saw_segment_start_expression,
8595 Script_sections::set_saw_segment_start_expression): New method
8596 definition.
8597 (Script_sections::saw_segment_start_expression_): New data member
8598 declaration.
8599 * script.cc (script_saw_segment_start_expression): New function.
8600 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8601 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8602 script_test_7.sh and script_test_8.sh.
8603 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8604 script_test_8.stdout.
8605 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8606 (script_test_6, script_test_6.stdout, script_test_7,
8607 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8608 * Makefile.in: Regenerate.
8609 * testsuite/script_test_6.sh: New file.
8610 * testsuite/script_test_6.t: Same.
8611 * testsuite/script_test_7.sh: Same.
8612 * testsuite/script_test_7.t: Same.
8613 * testsuite/script_test_8.sh: Same.
8614
8615 2009-10-16 Doug Kwan <dougkwan@google.com>
8616
8617 * output.cc (Output_segment::set_section_list_address): Cast
8618 expressions to unsigned long long type to avoid format warnings.
8619
8620 2009-10-15 Ian Lance Taylor <iant@google.com>
8621
8622 * script.cc (Script_options::add_symbol_assignment): Always add a
8623 dot assignment to script_sections_.
8624 * script-sections.cc (Script_sections::add_dot_assignment):
8625 Initialize if necessary.
8626
8627 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8628 program headers with no load segment if there is a linker script.
8629
8630 * layout.cc (Layout::set_segment_offsets): Align the file offset
8631 to the segment aligment for -N or -n with no load segment.
8632 * output.cc (Output_segment::add_output_section): Don't crash if
8633 the first section is a TLS section.
8634 (Output_segment::set_section_list_addresses): Print an error
8635 message if the address moves backward in a linker script.
8636 * script-sections.cc
8637 (Output_section_element_input::set_section_addresses): Don't
8638 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8639 (Orphan_output_section::set_section_addresses): Likewise.
8640
8641 2009-10-15 Doug Kwan <dougkwan@google.com>
8642
8643 * layout.cc (Layout::finish_dynamic_section): Generate tags
8644 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8645 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8646 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8647
8648 2009-10-14 Ian Lance Taylor <iant@google.com>
8649
8650 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8651 fields.
8652 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8653 data_shdr fields of relinfo.
8654 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8655 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8656 R_386_TLS_LDO_32, adjust based on section flags.
8657 (Target_i386::Relocate::fix_up_ldo): Remove.
8658
8659 2009-10-13 Ian Lance Taylor <iant@google.com>
8660
8661 Add support for -pie.
8662 * options.h (class General_options): Add -pie and
8663 --pic-executable.
8664 (General_options::output_is_position_independent): Test -pie.
8665 (General_options::output_is_executable): Return true if not shared
8666 and not relocatable.
8667 (General_options::output_is_pie): Remove.
8668 * options.cc (General_options::finalize): Reject incompatible uses
8669 of -pie.
8670 * gold.cc (queue_middle_tasks): A -pie link is not static.
8671 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8672 * symtab.cc (Symbol::final_value_is_known): Return false if
8673 output_is_position_independent.
8674 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8675 output_is_position_independent.
8676 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8677 output_is_position_independent.
8678 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8679 output_is_position_independent.
8680 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8681 two_file_pie_test.
8682 (basic_pie_test.o, basic_pie_test): New targets.
8683 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8684 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8685 (two_file_pie_test): New target.
8686 * testsuite/Makefile.in: Rebuild.
8687 * README: Remove note saying that -pie is not supported.
8688
8689 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8690
8691 * options.h (class General_options): Add -init and -fini.
8692 * layout.cc (Layout::finish_dynamic_section): Emit
8693 given init and fini functions.
8694
8695 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8696
8697 * gc.h (gc_process_relocs): Check if icf is enabled using new
8698 function.
8699 * gold.cc (queue_initial_tasks): Likewise.
8700 (queue_middle_tasks): Likewise.
8701 * object.cc (do_layout): Likewise.
8702 * symtab.cc (is_section_folded): Likewise.
8703 * main.cc (main): Likewise.
8704 * reloc.cc (Read_relocs::run): Likewise.
8705 (Sized_relobj::do_scan_relocs): Likewise.
8706 * icf.cc (is_function_ctor_or_dtor): New function.
8707 (Icf::find_identical_sections): Check if function is ctor or dtor when
8708 safe icf is chosen.
8709 * options.h (General_options::icf): Change option to be an enum.
8710 (Icf_status): New enum.
8711 (icf_enabled): New method.
8712 (icf_safe_folding): New method.
8713 (set_icf_status): New method.
8714 (icf_status_): New variable.
8715 * (options.cc) (General_options::finalize): Set icf_status_.
8716 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8717 icf_test and icf_keep_unique_test to use the --icf enum flag.
8718 * testsuite/icf_safe_test.sh: New file.
8719 * testsuite/icf_safe_test.cc: New file.
8720
8721 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8722
8723 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8724 includes to gc.h and icf.h.
8725 * arm.cc: Include gc.h.
8726 * gold.cc: Likewise.
8727 * i386.cc: Likewise.
8728 * powerpc.cc: Likewise.
8729 * sparc.cc: Likewise.
8730 * x86_64.cc: Likewise.
8731 * gc.h: Include icf.h.
8732
8733 2009-10-11 Ian Lance Taylor <iant@google.com>
8734
8735 * plugin.cc: Include "gold.h" before other header files.
8736
8737 2009-10-10 Chris Demetriou <cgd@google.com>
8738
8739 * options.h (Input_file_argument::Input_file_type): New enum.
8740 (Input_file_argument::is_lib_): Replace with...
8741 (Input_file_argument::type_): New member.
8742 (Input_file_argument::Input_file_argument): Take Input_file_type
8743 'type' rather than boolean 'is_lib' as second argument.
8744 (Input_file_argument::is_lib): Use type_.
8745 (Input_file_argument::is_searched_file): New function.
8746 (Input_file_argument::may_need_search): Handle is_searched_file.
8747 * options.cc (General_options::parse_library): Support -l:filename.
8748 (General_options::parse_just_symbols): Update for Input_file_argument
8749 changes.
8750 (Command_line::process): Likewise.
8751 * archive.cc (Archive::get_file_and_offset): Likewise.
8752 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8753 * script.cc (read_script_file, script_add_file): Likewise.
8754 * fileread.cc (Input_file::Input_file): Likewise.
8755 (Input_file::will_search_for): Handle is_searched_file.
8756 (Input_file::open): Likewise.
8757 * readsyms.cc (Read_symbols::get_name): Likewise.
8758 * testsuite/Makefile.am (searched_file_test): New test.
8759 * testsuite/Makefile.in: Regenerate.
8760 * testsuite/searched_file_test.cc: New file.
8761 * testsuite/searched_file_test_lib.cc: New file.
8762
8763 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8764 Ian Lance Taylor <iant@google.com>
8765
8766 * descriptor.cc: Include <cstdio> and "binary-io.h".
8767 (Descriptors::open): Open the files in binary mode always.
8768 * script.cc (Lex::get_token): Treat \r as whitespace.
8769
8770 2009-10-09 Ian Lance Taylor <iant@google.com>
8771
8772 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8773
8774 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8775 Ian Lance Taylor <iant@google.com>
8776
8777 * configure.ac: Check for readv function also.
8778 * fileread.cc (readv): Define if not HAVE_READV.
8779 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8780 does not exist.
8781 * config.in: Regenerate.
8782 * configure: Regenerate.
8783
8784 2009-10-09 Doug Kwan <dougkwan@google.com>
8785
8786 * layout.cc (Layout::make_output_section): Call target hook to make
8787 ordinary output section.
8788 (Layout::finalize): Adjust parameter list of call the
8789 Target::may_relax().
8790 * layout.h (class Layout::section_list): New method.
8791 * merge.h (Output_merge_base::entsize): Change visibility to public.
8792 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8793 New methods.
8794 (Output_merge_string::do_is_string): New method.
8795 * object.cc (Sized_relobj::do_setup): renamed from
8796 Sized_relobj::set_up.
8797 * object.h (Sized_relobj::adjust_shndx,
8798 Sized_relobj::initializ_input_to_output_maps,
8799 Sized_relobj::free_input_to_output_maps): Change visibilities to
8800 protected.
8801 (Sized_relobj::setup): Virtualize.
8802 (Sized_relobj::do_setup): New method declaration.
8803 (Sized_relobj::invalidate_section_offset,
8804 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8805 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8806 * options.cc (parse_int): New function.
8807 * options.h (parse_int): New declaration.
8808 (DEFINE_int): New macro.
8809 (stub_group_size): New option.
8810 * output.cc (Output_section::Output_section): Initialize memebers
8811 merge_section_map_, merge_section_by_properties_map_,
8812 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8813 (Output_section::add_input_section): Handled deferred code-fill
8814 generation and remove an old comment.
8815 (Output_section::add_relaxed_input_section): New method definition.
8816 (Output_section::add_merge_input_section): Use merge section by
8817 properties map to speed to search. Update merge section maps
8818 as appropriate.
8819 (Output_section::build_relaxation_map): New method definition.
8820 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8821 Same.
8822 (Output_section::relax_input_section): Renamed to
8823 Output_section::convert_input_sections_to_relaxed_sections and change
8824 interface to take a vector of pointers to relaxed sections.
8825 (Output_section::find_merge_section,
8826 Output_section::find_relaxed_input_section): New method definitions.
8827 (Output_section::is_input_address_mapped,
8828 Output_section::output_offset, Output_section::output_address):
8829 Use output section data maps to speed up searching.
8830 (Output_section::find_starting_output_address): Add comments.
8831 (Output_section::do_write,
8832 Output_section::write_to_postprocessing_buffer): Do code-fill
8833 generation as appropriate.
8834 (Output_section::get_input_sections): Invalidate relaxed input section
8835 map.
8836 (Output_section::restore_states): Adjust type of checkpoint .
8837 Invalidate relaxed input section map.
8838 * output.h (Output_merge_base): New class declaration.
8839 (Input_section_specifier): New class defintion.
8840 (class Output_relaxed_input_section) Change base class to
8841 Output_section_data_build.
8842 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8843 base class initializer.
8844 (Output_section::add_relaxed_input_section): New method declaration.
8845 (Output_section::Input_section): Change visibility to protected.
8846 (Output_section::Input_section::relobj,
8847 Output_section::Input_section::shndx): Handle relaxed input sections.
8848 Output_section::input_sections) Change visibility to protected. Also
8849 define overload to return a non-const pointer.
8850 (Output_section::Merge_section_properties): New class defintion.
8851 (Output_section::Merge_section_by_properties_map,
8852 Output_section::Output_section_data_by_input_section_map,
8853 Output_section::Relaxation_map): New types.
8854 (Output_section::relax_input_section): Rename method to
8855 Output_section::convert_input_sections_to_relaxed_sections and change
8856 interface to take a vector of relaxed section pointers.
8857 (Output_section::find_merge_section,
8858 Output_section::find_relaxed_input_section,
8859 Output_section::build_relaxation_map,
8860 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8861 New method declarations.
8862 (Output_section::merge_section_map_
8863 Output_section::merge_section_by_properties_map_,
8864 Output_section::relaxed_input_section_map_,
8865 Output_section::is_relaxed_input_section_map_valid_,
8866 Output_section::generate_code_fills_at_write_): New data members.
8867 * script-sections.cc
8868 (Output_section_element_input::set_section_addresses): Call
8869 current_data_size and addralign methods of relaxed input sections.
8870 (Orphan_output_section::set_section_addresses): Call current_data_size
8871 and addralign methods of relaxed input sections.
8872 * symtab.cc (Symbol_table::compute_final_value): Extract template
8873 from the body of Symbol_table::sized_finalize_symbol.
8874 (Symbol_table::sized_finalized_symbol): Call
8875 Symbol_table::compute_final_value.
8876 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8877 (Symbol_table::compute_final_value): New templated method declaration.
8878 * target.cc (Target::do_make_output_section): New method defintion.
8879 * target.h (Target::make_output_section): New method declaration.
8880 (Target::relax): Add more parameters for input objects, symbol table
8881 and layout. Adjust call to do_relax.
8882 (Target::do_make_output_section): New method declaration.
8883 (Target::do_relax): Add parameters for input objects, symbol table
8884 and layout.
8885
8886 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8887
8888 * pread.c: Include stdio.h.
8889
8890 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8891
8892 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8893 defined.
8894
8895 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8896
8897 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8898 Change read_shndx type to unsigned int.
8899 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8900 int.
8901 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8902 * dwarf_reader.h (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 * layout.cc (Layout::create_symtab_sections): Cast the result of
8908 local_symcount * symsize to off_t in the gold_assert.
8909
8910 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8911
8912 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8913 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8914 R_ARM_BASE_ABS.
8915 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8916 (Arm_relocate_functions::thm_abs5): New function.
8917 (Arm_relocate_functions::abs12): New function.
8918 (Arm_relocate_functions::abs16): New function.
8919 (Arm_relocate_functions::base_abs): New function.
8920 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8921 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8922 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8923 R_ARM_BASE_ABS.
8924 (Scan::global): Likewise.
8925 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8926 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8927 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8928 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8929 R_ARM_BASE_ABS.
8930
8931 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8932
8933 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8934 (Arm_relocate_functions::movt_prel): New function.
8935 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8936 (Arm_relocate_functions::thm_movt_prel): New function.
8937 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8938 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8939 (Scan::global, Relocate::relocate): Likewise.
8940 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8941
8942 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8943
8944 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8945 Incremental_checker.
8946 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8947 unsigned int.
8948 (class Incremental_inputs_header): New class.
8949 (Incremental_inputs_header_writer): Edit comment.
8950 (Incremental_inputs_entry): New class.
8951 (Incremental_inputs_entry_writer): Edit comment.
8952 (Sized_incremental_binary::do_find_incremental_inputs_section):
8953 Add *strtab_shndx parameter, fill it.
8954 (Sized_incremental_binary::do_check_inputs): New method.
8955 (Incremental_checker::can_incrementally_link_output_file): Use
8956 Sized_incremental_binary::check_inputs.
8957 (Incremental_inputs::report_command_line): Save command line in
8958 command_line_.
8959 * incremental.h:
8960 (Incremental_binary::find_incremental_inputs_section): New
8961 method.
8962 (Incremental_binary::do_find_incremental_inputs_section): Add
8963 strtab_shndx parameter.
8964 (Incremental_binary::do_check_inputs): New pure virtual method.
8965 (Sized_incremental_binary::do_check_inputs): Declare.
8966 (Incremental_checker::Incremental_checker): Add incremental_inputs
8967 parameter, use it to initialize incremental_inputs_.
8968 (Incremental_checker::incremental_inputs_): New field.
8969 (Incremental_checker::command_line): New method.
8970 (Incremental_checker::inputs): New method.
8971 (Incremental_checker::command_line_): New field.
8972
8973 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8974
8975 * incremental.cc: Include <cstdarg> and "target-select.h".
8976 (vexplain_no_incremental): New function.
8977 (explain_no_incremental): New function.
8978 (Incremental_binary::error): New method.
8979 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8980 method.
8981 (make_sized_incremental_binary): New function.
8982 (open_incremental_binary): New function.
8983 (can_incrementally_link_file): Add checks if output is ELF and has
8984 inputs section.
8985 * incremental.h: Include "elfcpp_file.h" and "output.h".
8986 (Incremental_binary): New class.
8987 (Sized_incremental_binary): New class.
8988 (open_incremental_binary): Declare.
8989 * object.cc (is_elf_object): Use
8990 elfcpp::Elf_recognizer::is_elf_file.
8991 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8992 * output.h (Output_file::filesize): New method.
8993
8994 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8995
8996 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8997 New function.
8998 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8999 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9000 function.
9001 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9002 function.
9003 (Arm_relocate_functions::movw_abs_nc): New function.
9004 (Arm_relocate_functions::movt_abs): New function.
9005 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9006 (Arm_relocate_functions::thm_movt_abs): New function.
9007 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9008 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9009 (Scan::global): Likewise.
9010 (Relocate::relocate): Likewise.
9011 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9012
9013 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9014
9015 * arm.cc (Arm_relocate_functions::got_prel) New function.
9016 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9017 (Relocate::relocate): Likewise.
9018 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9019
9020 2009-10-06 Ian Lance Taylor <iant@google.com>
9021
9022 * options.h (class General_options): Define
9023 split_stack_adjust_size parameter.
9024 * object.h (class Object): Add uses_split_stack_ and
9025 has_no_split_stack_ fields. Add uses_split_stack and
9026 has_no_split_stack accessor functions. Declare
9027 handle_split_stack_section.
9028 (class Reloc_symbol_changes): Define.
9029 (class Sized_relobj): Define Function_offsets. Declare
9030 split_stack_adjust, split_stack_adjust_reltype, and
9031 find_functions.
9032 * object.cc (Object::handle_split_stack_section): New function.
9033 (Sized_relobj::do_layout): Call handle_split_stack_section.
9034 * dynobj.cc (Sized_dynobj::do_layout): Call
9035 handle_split_stack_section.
9036 * reloc.cc (Sized_relobj::relocate_sections): Call
9037 split_stack_adjust for executable sections in split_stack
9038 objects. Pass reloc_map to relocate_section.
9039 (Sized_relobj::split_stack_adjust): New function.
9040 (Sized_relobj::split_stack_adjust_reltype): New function.
9041 (Sized_relobj::find_functions): New function.
9042 * target-reloc.h: Include "object.h".
9043 (relocate_section): Add reloc_symbol_changes parameter. Change
9044 all callers.
9045 * target.h (class Target): Add calls_non_split method. Declare
9046 do_calls_non_split virtual method. Declare match_view and
9047 set_view_to_nop.
9048 * target.cc: Include "elfcpp.h".
9049 (Target::do_calls_non_split): New function.
9050 (Target::match_view): New function.
9051 (Target::set_view_to_nop): New function.
9052 * gold.cc (queue_middle_tasks): Give an error if mixing
9053 split-stack and non-split-stack objects with -r.
9054 * i386.cc (Target_i386::relocate_section): Add
9055 reloc_symbol_changes parameter.
9056 (Target_i386::do_calls_non_split): New function.
9057 * x86_64.cc (Target_x86_64::relocate_section): Add
9058 reloc_symbol_changes parameter.
9059 (Target_x86_64::do_calls_non_split): New function.
9060 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9061 parameter.
9062 * powerpc.cc (Target_powerpc::relocate_section): Add
9063 reloc_symbol_changes parameter.
9064 * sparc.cc (Target_sparc::relocate_section): Add
9065 reloc_symbol_changes parameter.
9066 * configure.ac: Call AM_CONDITIONAL for the default target.
9067 * configure: Rebuild.
9068 * testsuite/Makefile.am (TEST_AS): New variable.
9069 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9070 (check_DATA): Add split_i386 and split_x86_64 files.
9071 (SPLIT_DEFSYMS): Define.
9072 (split_i386_[1234n].o): New targets.
9073 (split_i386_[124]): New targets.
9074 (split_i386_[1234r].stdout): New targets.
9075 (split_x86_64_[1234n].o): New targets.
9076 (split_x86_64_[124]): New targets.
9077 (split_x86_64_[1234r].stdout): New targets.
9078 (MOSTLYCLEANFILES): Add new executables.
9079 * testsuite/split_i386.sh: New file.
9080 * testsuite/split_x86_64.sh: New file.
9081 * testsuite/split_i386_1.s: New file.
9082 * testsuite/split_i386_2.s: New file.
9083 * testsuite/split_i386_3.s: New file.
9084 * testsuite/split_i386_4.s: New file.
9085 * testsuite/split_i386_n.s: New file.
9086 * testsuite/split_x86_64_1.s: New file.
9087 * testsuite/split_x86_64_2.s: New file.
9088 * testsuite/split_x86_64_3.s: New file.
9089 * testsuite/split_x86_64_4.s: New file.
9090 * testsuite/split_x86_64_n.s: New file.
9091 * testsuite/testfile.cc (Target_test): Update relocation_section
9092 function.
9093 * testsuite/Makefile.in: Rebuild.
9094
9095 2009-10-06 Ian Lance Taylor <iant@google.com>
9096
9097 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9098 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9099 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9100 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9101 the address on ldo_addrs_.
9102 (Target_i386::Relocate::fix_up_ldo): New function.
9103
9104 2009-10-06 Rafael Espindola <espindola@google.com>
9105
9106 * plugin.cc (add_input_library): New.
9107 (Plugin::load): Add add_input_library to tv.
9108 (Plugin_manager::add_input_file): Add the is_lib argument.
9109 (add_input_file): Update call to Plugin_manager::add_input_file.
9110 (add_input_library): New.
9111 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9112
9113 2009-09-30 Doug Kwan <dougkwan@google.com>
9114
9115 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9116 symbol and call Symbol::may_need_copy_reloc to determine if
9117 a copy reloc is needed.
9118 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9119 nocopyreloc is given in command line.
9120 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9121 given in command line.
9122 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9123 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9124 of the removed Target_i386::may_need_copy_reloc.
9125 * options.h (copyreloc): New option with default value false.
9126 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9127 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9128 instead of the removed Target_powerpc::may_need_copy_reloc.
9129 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9130 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9131 instead of the removed Target_sparc::may_need_copy_reloc.
9132 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9133 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9134 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9135 instead of the removed Target_x86_64::may_need_copy_reloc.
9136
9137 2009-09-30 Ian Lance Taylor <iant@google.com>
9138
9139 * object.h (class Object): Remove target_ field, and target,
9140 sized_target, and set_target methods.
9141 (Object::sized_target): Remove.
9142 (class Sized_relobj): Update declarations. Remove sized_target.
9143 * object.cc (Sized_relobj::setup): Remove target parameter.
9144 Change all callers.
9145 (Input_objects::add_object): Don't do anything with the target.
9146 (make_elf_sized_object): Add punconfigured parameter. Change all
9147 callers. Set or test parameter target.
9148 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9149 Change all callers.
9150 * parameters.cc (Parameters::set_target): Change parameter type to
9151 be non-const.
9152 (Parameters::default_target): Remove.
9153 (set_parameters_target): Change parameter type to be non-const.
9154 (parameters_force_valid_target): New function.
9155 (parameters_clear_target): New function.
9156 * parameters.h (class Parameters): Update declarations. Remove
9157 default_target method. Add sized_target and clear_target
9158 methods. Change target_ to be non-const.
9159 (set_parameters_target): Update declaration.
9160 (parameters_force_valid_target): Declare.
9161 (parameters_clear_target): Declare.
9162 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9163 as NULL if we aren't searching.
9164 (Add_symbols::run): Don't check for compatible target.
9165 * fileread.cc (Input_file::open_binary): Call
9166 parameters_force_valid_target.
9167 * gold.cc (queue_middle_tasks): Likewise.
9168 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9169 set_target on object.
9170 * dynobj.h (class Sized_dynobj): Update declarations.
9171 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9172 make_elf_object returns NULL.
9173 (Archive::include_member): Don't check whether object target is
9174 compatible.
9175 * output.cc (Output_section::add_input_section): Get target from
9176 parameters.
9177 (Output_section::relax_input_section): Likewise.
9178 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9179 parameters.
9180 (Sized_relobj::do_scan_relocs): Likewise.
9181 (Sized_relobj::relocate_sections): Likewise.
9182 * resolve.cc (Symbol_table::resolve): Likewise.
9183 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9184 parameter. Change all callers.
9185 (Symbol_table::add_from_object): Get target from parameters.
9186 (Symbol_table::add_from_relobj): Don't check object target.
9187 (Symbol_table::add_from_dynobj): Likewise.
9188 (Symbol_table::define_special_symbol): Get target from
9189 parameters.
9190 * symtab.h (class Symbol_table): Update declaration.
9191 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9192 parameter. Change all callers. Clear parameter target.
9193 (Binary_test): Test target here.
9194 * testsuite/object_unittest.cc (gold_testsuite): Remove
9195 target_test_pointer parameter. Change all callers.
9196 (Object_test): Test target here.
9197
9198 2009-09-26 Ian Lance Taylor <iant@google.com>
9199
9200 * testsuite/initpri1.c: Don't try to use constructor priorities if
9201 compiling with gcc before 4.3.
9202
9203 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9204
9205 * testsuite/retain_symbols_file_test.sh (check_present): Change
9206 output file name to retain_symbols_file_test.stdout.
9207 (check_absent): Likewise.
9208
9209 2009-09-18 Craig Silverstein <csilvers@google.com>
9210
9211 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9212 * options.cc: Include <cerrno> and <fstream>.
9213 (General_options::finalize): Parse -retain-symbols-file tag.
9214 * options.h: New flag.
9215 (General_options): New method should_retain_symbol, new
9216 variable symbols_to_retain.
9217 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9218 should_retain_symbol map.
9219 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9220 * testsuite/Makefile.in: Regenerate.
9221 * testsuite/retain_symbols_file_test.sh: New file.
9222
9223 2009-09-18 Nick Clifton <nickc@redhat.com>
9224
9225 * po/es.po: Updated Spanish translation.
9226
9227 2009-09-17 Doug Kwan <dougkwan@google.com>
9228
9229 * debug.h (DEBUG_RELAXATION): New constant.
9230 (DEBUG_ALL): Add DEBUG_RELAXATION.
9231 (debug_string_to_enum): Add relaxation debug option.
9232 * layout.cc
9233 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9234 Layout::Relaxation_debug_check::read_sections,
9235 Layout::Relaxation_debug_check::read_sections): New method definitions.
9236 (Layout::Layout): Initialize data members
9237 record_output_section_data_from_scrips_,
9238 script_output_section_data_list_ and relaxation_debug_check_.
9239 (Layout::save_segments, Layout::restore_segments,
9240 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9241 Layout::relaxation_loop_body): New method definitions.
9242 (Layout::finalize): Support relaxation. Move section layout code to
9243 Layout::relaxation_loop_body.
9244 (Layout::set_asection_address_from_script): Move code for orphan
9245 section placement out.
9246 (Layout::place_orphan_sections_in_script): New method definition.
9247 * layout.h (Output_segment_headers, Output_file_header):
9248 New forward class declarations.
9249 (Layout::~Layout): Define.
9250 (Layout::new_output_section_data_from_script): New method definition.
9251 (Layout::place_orphan_sections_in_script): New method declaration.
9252 (Layout::Segment_states): New type declaration.
9253 (Layout::save_segments, Layout::restore_segments,
9254 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9255 Layout::relaxation_loop_body): New method declarations.
9256 (Layout::Output_section_data_list): New type declaration.
9257 (Layout::Relaxation_debug_check): New class definition.
9258 (Layout::record_output_section_data_from_script_,
9259 Layout::script_output_section_data_list_, Layout::segment_states_,
9260 Layout::relaxation_debug_check_): New data members.
9261 * output.cc: (Output_section_headers::do_size): New method definition.
9262 (Output_section_headers::Output_section_headers): Move size
9263 computation to Output_section_headers::do_size.
9264 (Output_segment_headers::do_size): New method definition.
9265 (Output_file_header::Output_file_header): Move size computation to
9266 Output_file_header::do_size and call it.
9267 (Output_file_header::do_size): New method definition.
9268 (Output_data_group::Output_data_group): Adjust call to
9269 Output_section_data.
9270 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9271 (Output_symtab_xindex::do_write): Add array bound check.
9272 (Output_section::Input_section::print_to_mapfile): Handle
9273 RELAXED_INPUT_SECTION_CODE.
9274 (Output_section::Output_section): Initialize data member checkpoint_.
9275 (Output_section::~Output_section): Delete checkpoint object pointed
9276 by checkpoint_.
9277 (Output_section::add_input_section): Always add an Input_section if
9278 relaxing.
9279 (Output_section::add_merge_input_section): Add assert.
9280 (Output_section::relax_input_section): New method definition.
9281 (Output_section::set_final_data_size): Set load address to zero for
9282 an unallocated section.
9283 (Output_section::do_address_and_file_offset_have_reset_values):
9284 New method definition.
9285 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9286 Handle relaxed input section.
9287 (Output_section::sort_attached_input_sections): Checkpoint input
9288 section list lazily.
9289 (Output_section::get_input_sections): Change type of input_sections to
9290 list of Simple_input_section pointers. Checkpoint input section list
9291 lazily. Also handle relaxed input sections.
9292 (Output_section::add_input_section_for_script): Take a reference to
9293 a Simple_input_section object instead of Relobj pointer and section
9294 index as parameter. Handle relaxed input sections.
9295 (Output_section::save_states, Output_section::restore_states): New
9296 method definitions.
9297 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9298 (Output_data::is_data_size_fixed): New method definition.
9299 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9300 if it is fixed.
9301 (Output_data::address_and_file_offset_have_reset_values): New method
9302 definition.
9303 (Output_data::do_address_and_file_offset_have_reset_values): New method
9304 definition.
9305 (Output_data::set_data_size): Check that data size is not fixed.
9306 (Output_data::fix_data_size): New method definition.
9307 (Output_data::is_data_size_fixed_): New data member.
9308 (Output_section_headers::set_final_data_size): New method definition.
9309 (Output_section_headers::do_size): New method declaration.
9310 (Output_segment_headers::set_final_data_size): New method definition.
9311 (Output_segment_headers::do_size): New method declaration.
9312 (Output_file_header::set_final_data_size)::New method definition.
9313 (Output_file_header::do_size)::New method declaration.
9314 (Output_section_data::Output_section_data): Add new parameter
9315 is_data_size_fixed and use it to fix data size.
9316 (Output_data_const::Output_data_const): Adjust call to base class
9317 constructor and fix data size.
9318 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9319 base class constructor and fix data size.
9320 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9321 base class constructor and fix data size.
9322 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9323 class constructor and fix data size.
9324 (Output_data_group::set_final_data_size): New method definition.
9325 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9326 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9327 class constructor and fix data size.
9328 (Output_relaxed_input_section): New class definition.
9329 (Output_section::Simple_input_section): New class definition.
9330 (Output_section::get_input_sections): Adjust parameter list.
9331 (Output_section::add_input_section_for_script): Same.
9332 (Output_section::save_states, Output_section::restore_states,
9333 Output_section::do_address_and_file_offset_have_reset_values,
9334 (Output_section::Input_section::Input_section): Handle
9335 RELAXED_INPUT_SECTION_CODE. Add new overload for
9336 Output_relaxed_input_section.
9337 (Output_section::Input_section::is_input_section,
9338 Output_section::Input_section::set_output_section): Handle relaxed
9339 input section.
9340 (Output_section::Input_section::is_relaxed_input_section,
9341 Output_section::Input_section::output_section_data,
9342 Output_section::Input_section::relaxed_input_section): New method
9343 definitions.
9344 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9345 value.
9346 (Output_section::Input_section::u1_): Update comments.
9347 (Output_section::Input_section::u2_): Add new union member poris.
9348 (Output_section::Checkpoint_output_section): New classs definition.
9349 (Output_section::relax_input_section): New method declaration.
9350 (Output_section::checkpoint_): New data member.
9351 (Output_segment): Update comments.
9352 (Output_segment::Output_segment): Un-privatize copy constructor.
9353 (Output_segment::operator=): Un-privatize.
9354 * script-sections.cc (Output_section_element::Input_section_list):
9355 Change element type to Output_section::Simple_input_section.
9356 (Output_section_element_dot_assignment::set_section_addresses):
9357 Register output section data for relaxation clean up.
9358 (Output_data_exression::Output_data_expression): Adjust call to base
9359 constructor to fix data size.
9360 (Output_section_element_data::set_section_addresses): Register
9361 Output_data_expression object for relaxation clean up.
9362 (struct Input_section_info): Replace Relobj pointer and section index
9363 pair with Output_section::Simple_input_section and Convert struct to a
9364 class.
9365 (Input_section_sorter::operator()): Adjust access to
9366 Input_section_info data member to use accessors.
9367 (Output_section_element_input::set_section_addresses): Use layout
9368 parameter. Adjust code to use Output_section::Simple_input_section
9369 and Input_secction_info classes. Register filler for relaxation
9370 clean up.
9371 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9372 and section index pair with Output_section::Simple_input_section
9373 class. Adjust code accordingly.
9374 (Phdrs_element::release_segment): New method definition.
9375 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9376 segment list.
9377 (Script_sections::release_segments): New method definition.
9378 * gold/script-sections.h (Script_sections::release_segments): New
9379 method declaration.
9380 * gold/target.h (Target::may_relax, Target::relax,
9381 Target::do_may_relax, Target::do_relax): New method definitions.
9382
9383 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9384
9385 * arm.cc (has_signed_unsigned_overflow): New function.
9386 (Arm_relocate_functions::abs8): New function.
9387 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9388 (Target_arm::Scan::global): Likewise.
9389 (Target_arm::relocate::relocate): Likewise.
9390 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9391 Likewise.
9392
9393 2009-09-16 Cary Coutant <ccoutant@google.com>
9394
9395 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9396 * testsuite/Makefile.in: Regenerate.
9397
9398 2009-09-11 Nick Clifton <nickc@redhat.com>
9399
9400 * po/gold.pot: Updated by the Translation project.
9401
9402 2009-09-08 Cary Coutant <ccoutant@google.com>
9403
9404 * output.cc (Output_file::open): Add execute permission to empty file.
9405 * testsuite/Makefile.am (permission_test): New test.
9406 * testsuite/Makefile.in: Regenerate.
9407
9408 2009-09-02 Ian Lance Taylor <iant@google.com>
9409
9410 * output.cc (Output_file::resize): Call map_no_anonymous rather
9411 than map.
9412
9413 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9414
9415 * gold.cc: Include "incremental.h".
9416 (queue_initial_tasks): Call Incremental_checker methods.
9417 * incremental.cc: Include "output.h".
9418 (Incremental_checker::can_incrementally_link_output_file): New
9419 method.
9420 * incremental.h (Incremental_checker): New class.
9421
9422 * output.cc (Output_file::open_for_modification): New method.
9423 (Output_file::map_anonymous): Changed return type to bool. Record
9424 map in base_ field.
9425 (Output_file::map_no_anonymous): New method, broken out of map.
9426 (Output_file::map): Use map_no_anonymous and map_anonymous.
9427 * output.h (class Output_file): Update declarations.
9428
9429 2009-08-24 Cary Coutant <ccoutant@google.com>
9430
9431 * options.h (Command_line::Pre_options): New class.
9432 (Command_line::pre_options): New member.
9433 * options.cc (gold::options::ready_to_register): New variable.
9434 (One_option::register_option): Do nothing if not registering options.
9435 Assert if same short option registered twice.
9436 (General_options::General_options): Turn off option registration when
9437 done constructing.
9438 (Command_line::Pre_options::Pre_options): New constructor.
9439
9440 2009-08-24 Cary Coutant <ccoutant@google.com>
9441
9442 * options.h (General_options::no_keep_memory): Remove incorrect
9443 short option.
9444
9445 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9446
9447 * Makefile.am (am__skiplex, am__skipyacc): New.
9448 * Makefile.in: Regenerate.
9449
9450 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9451
9452 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9453 (INCLUDES): ... this.
9454 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9455 (AM_CPPFLAGS): Renamed from ...
9456 (INCLUDE): ... this.
9457 * Makefile.in, testsuite/Makefile.in: Regenerate.
9458
9459 * Makefile.in: Regenerate.
9460 * aclocal.m4: Likewise.
9461 * config.in: Likewise.
9462 * configure: Likewise.
9463 * testsuite/Makefile.in: Likewise.
9464
9465 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9466 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9467 * Makefile.in: Regenerate.
9468 * testsuite/Makefile.in: Regenerate.
9469
9470 2009-08-19 Cary Coutant <ccoutant@google.com>
9471
9472 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9473 symbols in shared libraries overridden by hidden or internal symbols
9474 in the main program.
9475
9476 2009-08-19 Chris Demetriou <cgd@google.com>
9477
9478 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9479 checking source file names in error messages.
9480
9481 2009-08-18 Doug Kwan <dougkwan@google.com>
9482
9483 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9484 an elcpp::Ehdr as parameter. Adjust call to set_target.
9485 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9486 an elfcpp::Ehdr as parameter.
9487 * object.cc (Object::set_target): Remove the version that looks up
9488 a target and sets it.
9489 (Sized_relobj::setup): Take a Target object instead of
9490 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9491 (make_elf_sized_object): Find target and ask target to
9492 make an ELF object.
9493 * object.h: (Object::set_target): Remove the version that looks up
9494 a target and sets it.
9495 (Sized_relobj::setup): Take a Target object instead of
9496 an elfcpp:Ehdr as parameter.
9497 * target.cc: Include dynobj.h.
9498 (Target::do_make_elf_object_implementation): New.
9499 (Target::do_make_elf_object): New.
9500 * target.h (Target::make_elf_object): New template declaration.
9501 (Target::do_make_elf_object): New method declarations.
9502 (Target::do_make_elf_object_implementation): New template declaration.
9503
9504 2009-08-14 Ian Lance Taylor <iant@google.com>
9505
9506 * gold.h (FUNCTION_NAME): Define.
9507 (gold_unreachable): Use FUNCTION_NAME.
9508
9509 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9510
9511 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9512 symbol in the --keep-unique list is not found.
9513
9514 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9515
9516 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9517 been maked as --keep-unique.
9518 (Icf::unfold_section): New function.
9519 * icf.h (Icf::unfold_section): New function.
9520 * options.h (General_options::keep_unique): New option.
9521 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9522 * testsuite/Makefile.in: Regenerate.
9523 * testsuite/icf_keep_unique_test.sh: New file.
9524 * testsuite/icf_keep_unique_test.cc: New file.
9525
9526 2009-08-12 Cary Coutant <ccoutant@google.com>
9527
9528 PR 10471
9529 * resolve.cc (Symbol_table::resolve): Check for references from
9530 dynamic objects to hidden and internal symbols.
9531 * testsuite/Makefile.am (hidden_test.sh): New test.
9532 * testsuite/Makefile.in: Regenerate.
9533 * testsuite/hidden_test.sh: New script.
9534 * testsuite/hidden_test_1.c: New test source.
9535 * testsuite/hidden_test_main.c: New test source.
9536
9537 2009-08-11 Doug Kwan <dougkwan@google.com>
9538
9539 * arm.cc: Update comments.
9540 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9541 segment to locate the .ARM.exidx section if present.
9542
9543 2009-08-09 Doug Kwan <dougkwan@google.com>
9544
9545 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9546 patch.
9547
9548 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9549 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9550 compiler warnings.
9551
9552 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9553
9554 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9555 valid tls_segment only for non-debug-section relocations.
9556 * testsuite/Makefile.am: Add gc_tls_test.
9557 * testsuite/Makefile.in: Regenerate.
9558 * testsuite/gc_tls_test.cc: New file.
9559 * testsuite/gc_tls_test.sh: New file.
9560
9561 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9562
9563 * icf.cc: New file.
9564 * icf.h: New file.
9565 * Makefile.am (CCFILES): Add icf.cc.
9566 (HFILES): Add icf.h
9567 * Makefile.in: Regenerate.
9568 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9569 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9570 section, symbol and addend information for the relocs.
9571 * gold.cc (queue_middle_tasks): Call identical code folding.
9572 * gold.h: Add defines for multimap.
9573 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9574 to the call of finalize_local_symbols.
9575 * main.cc (main): Create object of class Icf.
9576 * object.cc (Sized_relobj::do_layout): Allow this function to be
9577 called twice during icf.
9578 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9579 to sections marked as identical by icf.
9580 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9581 when available.
9582 (Sized_relobj::do_section_entsize): New function.
9583 * object.h (Object::section_entsize): New function.
9584 (Object::do_section_entsize): New pure virtual function.
9585 (Relobj::finalize_local_symbols): Add new parameter.
9586 (Relobj::do_section_entsize): New function.
9587 * options.h (General_options::icf): New option.
9588 (General_options::icf_iterations): New option.
9589 (General_options::print_icf_sections): New option.
9590 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9591 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9592 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9593 icf.
9594 * symtab.cc (Symbol_table::is_section_folded): New function.
9595 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9596 to sections marked as identical by icf.
9597 * symtab.h (Symbol_table::set_icf): New function.
9598 (Symbol_table::icf): New function.
9599 (Symbol_table::is_section_folded): New function.
9600 (Symbol_table::icf_): New data member.
9601 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9602 * testsuite/Makefile.am: Add commands to build icf_test.
9603 * testsuite/Makefile.in: Regenerate.
9604 * testsuite/icf_test.sh: New file.
9605 * testsuite/icf_test.cc: New file.
9606
9607 2009-07-24 Chris Demetriou <cgd@google.com>
9608
9609 * layout.cc (is_compressible_debug_section): Fix incorrect
9610 comment about compressed section names.
9611
9612 2009-07-20 Ian Lance Taylor <ian@airs.com>
9613
9614 PR 10419
9615 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9616
9617 2009-07-16 Ian Lance Taylor <iant@google.com>
9618
9619 PR 10400
9620 * layout.h: #include <map>.
9621 (class Kept_section): Change from struct to class. Add accessors
9622 and setters. Add section size to Comdat_group mapping. Change
9623 Comdat_group to std::map. Add is_comdat_ field. Add
9624 linkonce_size field in union.
9625 (class Layout): Update declaration of find_or_add_kept_section.
9626 Don't declare find_kept_object.
9627 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9628 parameter. Add object, shndx, is_comdat, and is_group_name
9629 parameters. Change all callers. Adjust for new Kept_section.
9630 (Layout::find_kept_object): Remove.
9631 * object.cc (Sized_relobj::include_section_group): Update use of
9632 Kept_section. Rename secnum to shndx. Only record
9633 Kept_comdat_section if sections are the same size.
9634 (Sized_relobj::include_linkonce_section): Update use of
9635 Kept_section. Only record Kept_comdat_section if sections are the
9636 same size. Set size of linkonce section.
9637 (Sized_relobj::map_to_kept_section): Update call to
9638 get_kept_comdat_section.
9639 * object.h (class Sized_relobj): Rename fields in
9640 Kept_comdat_section to drop trailing underscores; change object
9641 field to Relobj*. Change Kept_comdat_section_table to store
9642 struct rather than pointer.
9643 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9644 Add kept_object and kept_shndx parameters. Change all callers.
9645 (Sized_relobj::get_kept_comdat_section): Change return type to
9646 bool. Add kept_object and kept_shndx parameters. Change all
9647 callers.
9648 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9649 Layout::find_or_add_kept_section.
9650
9651 2009-07-09 Ian Lance Taylor <iant@google.com>
9652
9653 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9654 Reserve space in the hash table.
9655
9656 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9657
9658 * fileread.cc (File_read::get_mtime): New method.
9659 * fileread.h (Timespec): New structure.
9660 (File_read::get_mtime): New method.
9661 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9662 Renamed from timestamp_nsec.
9663 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9664 Elf_Xword.
9665 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9666 timestamp_nsec.
9667 (Incremental_inputs::report_archive): Save mtime; style fix.
9668 (Incremental_inputs::report_obejct): Save mtime; style fix.
9669 (Incremental_inputs::report_script): Save mtime; style fix.
9670 (Incremental_inputs::finalize_inputs): Style fix.
9671 (Incremental_inputs::finalize): Style fix.
9672 (Incremental_inputs::create_input_section_data): Store inputs
9673 mtime.
9674 * incremental.h (Incremental_inputs::report_script): Add mtime
9675 argument.
9676 (Incremental_inputs::Input_info::Input_info): Intialize only one
9677 union member.
9678 (Incremental_inputs::Input_info::archive): Move to nameless
9679 union.
9680 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9681 (Incremental_inputs::Input_info::script): Move to nameless union.
9682 (Incremental_inputs::mtime): New field.
9683 * script.cc (read_input_script): Pass file mtime to
9684 Incremental_input.
9685 * script.h (Script_info::inputs): Style fix.
9686
9687 2009-07-01 Ian Lance Taylor <ian@airs.com>
9688
9689 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9690 instead of 32.
9691
9692 2009-06-24 Ian Lance Taylor <iant@google.com>
9693
9694 PR 10156
9695 * layout.cc (Layout::choose_output_section): If we find an
9696 existing section, update the flags.
9697 (Layout::create_notes): New function, broken out of
9698 Layout::finalize.
9699 (Layout::finalize): Don't create note sections.
9700 (Layout::create_note): Don't crash if linker script discards
9701 section.
9702 (Layout::create_gold_note): Likewise.
9703 (Layout::create_build_id): Likewise. Don't set
9704 after_input_sections on the section.
9705 (Layout::create_executable_stack_info): Remove target parameter.
9706 Change caller.
9707 * layout.h (class Layout): Declare create_notes. Update
9708 declaration of create_executable_stack_info.
9709 * gold.cc (queue_middle_tasks): Call create_notes.
9710 * output.cc (Output_section::update_flags_for_input_section): Move
9711 here from output.h. If SHF_ALLOC flag is newly set, mark address
9712 invalid.
9713 * output.h (Output_data::mark_address_invalid): New function.
9714 (class Output_section): Only declare, not define,
9715 update_flags_for_input_section. Remove set_flags.
9716
9717 2009-06-24 Ian Lance Taylor <iant@google.com>
9718
9719 * script-sections.cc (Output_section_definition::
9720 set_section_addresses): Rename shadowing local load_address to
9721 laddr.
9722
9723 2009-06-24 Ian Lance Taylor <iant@google.com>
9724
9725 PR 10244
9726 * reloc.cc (relocate_sections): Skip empty relocation sections.
9727
9728 2009-06-23 Ian Lance Taylor <iant@google.com>
9729
9730 PR 10156
9731 * layout.cc (Layout::create_note): Use choose_output_section
9732 rather than make_output_section.
9733
9734 2009-06-23 Ian Lance Taylor <iant@google.com>
9735
9736 PR 10237
9737 * options.cc (General_options::parse_V): Set printed_version_.
9738 (General_options::General_options): Initialize printed_version_.
9739 * options.h (class General_options): Add printed_version_ field.
9740 * gold.cc (queue_initial_tasks): If there are no input files,
9741 don't give a fatal error if we printed the version information.
9742 (queue_middle_tasks): If using -r with a shared object, give a
9743 fatal error rather than an ordinary error.
9744
9745 2009-06-23 Ian Lance Taylor <iant@google.com>
9746
9747 PR 10219
9748 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9749 (Layout::make_output_section): Set have_stabstr_section_ if we see
9750 a .stab*str section.
9751 (Layout::finalize): Call link_stabs_sections.
9752 (Layout::link_stabs_sections): New file.
9753 * layout.h (class Layout): Add have_stabstr_section_ field.
9754 Declare link_stabs_sections.
9755
9756 2009-06-23 Doug Kwan <dougkwan@google.com>
9757
9758 * Makefile.am (libgold_a_LIBADD): New.
9759 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9760 * Makefile.in: Regenerate.
9761 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9762 * configure: Regenerate.
9763 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9764 * fileread.cc: Include sys/state.h
9765 * gold.h: Declare memmem and strndup if found missing.
9766 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9767
9768 2009-06-23 Ian Lance Taylor <iant@google.com>
9769
9770 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9771 * configure: Rebuild.
9772
9773 2009-06-23 Ian Lance Taylor <iant@google.com>
9774
9775 PR 10147
9776 * object.cc (Object::section_contents): Don't try to get a view if
9777 the section has length zero.
9778 (Object::handle_gnu_warning_section): If the section is empty, use
9779 the name of the section as the warning.
9780
9781 2009-06-23 Ian Lance Taylor <iant@google.com>
9782
9783 PR 10133
9784 * stringpool.h (class Stringpool_template): Add optimize_ field.
9785 (Stringpool_template::set_optimize): New function.
9786 * stringpool.cc (Stringpool_template::Stringpool_template):
9787 Initialize optimize_ field.
9788 (Stringpool_template::set_string_offsets): Test local optimize
9789 fild rather than parameter.
9790 * layout.cc (Layout::Layout): Call set_optimize on the section
9791 name stringpool.
9792
9793 2009-06-22 Ian Lance Taylor <iant@google.com>
9794
9795 PR 10030
9796 * yyscript.y: Parse TARGET.
9797 * script.cc (script_set_target): New function.
9798 * script-c.h (script_set_target): Declare.
9799 * options.cc (General_options::string_to_object_format): Rename
9800 from string_to_object_format in anonymous namespace. Change
9801 callers.
9802 * options.h (class General_options): Declare
9803 string_to_object_format.
9804
9805 2009-06-22 Ian Lance Taylor <iant@google.com>
9806
9807 * script-sections.cc (Script_sections::create_segments): Don't put
9808 program headers in a PT_LOAD segment if -n or -N.
9809
9810 2009-06-22 Ian Lance Taylor <iant@google.com>
9811
9812 PR 10141
9813 * options.h (class General_options): Add -z lazy and -z now. Sort
9814 -z options into alphabetical order.
9815 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9816
9817 2009-06-21 Ian Lance Taylor <iant@google.com>
9818
9819 * layout.cc (Layout::make_output_section): Call
9820 Target::new_output_section.
9821 (Layout::attach_allocated_section_to_segment): Put large section
9822 sections in a separate load segment with the large segment flag
9823 set.
9824 (Layout::segment_precedes): Sort large data segments after other
9825 load segments.
9826 (align_file_offset): New static function.
9827 (Layout::set_segment_offsets): Use align_file_offset.
9828 * output.h (class Output_section): Add is_small_section_ and
9829 is_large_section_ fields.
9830 (Output_section::is_small_section): New function.
9831 (Output_section::set_is_small_section): New function.
9832 (Output_section::is_large_section): New function.
9833 (Output_section::set_is_large_section): New function.
9834 (Output_section::is_large_data_section): New function.
9835 (class Output_segment): Add is_large_data_segment_ field.
9836 (Output_segment::is_large_data_segment): New function.
9837 (Output_segment::set_is_large_data_segment): New function.
9838 * output.cc (Output_section::Output_section): Initialize new
9839 fields.
9840 (Output_segment::Output_segment): Likewise.
9841 (Output_segment::add_output_section): Add assertion that large
9842 data sections always go in large data segments. Force small data
9843 sections to the end of the list of data sections. Force small BSS
9844 sections to the start of the list of BSS sections. For large BSS
9845 sections to the end of the list of BSS sections.
9846 * symtab.h (class Symbol): Declare is_common_shndx.
9847 (Symbol::is_defined): Check Symbol::is_common_shndx.
9848 (Symbol::is_common): Likewise.
9849 (class Symbol_table): Define enum Commons_section_type. Update
9850 declarations. Add small_commons_ and large_commons_ fields.
9851 * symtab.cc (Symbol::is_common_shndx): New function.
9852 (Symbol_table::Symbol_table): Initialize new fields.
9853 (Symbol_table::add_from_object): Put small and large common
9854 symbols in the right list.
9855 (Symbol_table::sized_finalized_symbol): Check
9856 Symbol::is_common_shndx.
9857 (Symbol_table::sized_write_globals): Likewise.
9858 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9859 common symbol lists. Don't call do_allocate_commons_list if the
9860 list is empty.
9861 (Symbol_table::do_allocate_commons_list): Remove is_tls
9862 parameter. Add comons_section_type parameter. Change all
9863 callers. Handle small and large common symbols.
9864 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9865 Symbol::is_common_shndx.
9866 * resolve.cc (symbol_to_bits): Likewise.
9867 * target.h (Target::small_common_shndx): New function.
9868 (Target::small_common_section_flags): New function.
9869 (Target::large_common_shndx): New function.
9870 (Target::large_common_section_flags): New function.
9871 (Target::new_output_section): New function.
9872 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9873 small_common_section_flags, and large_common_section_flags
9874 fields.
9875 (Target::do_new_output_section): New virtual function.
9876 * arm.cc (Target_arm::arm_info): Initialize new fields.
9877 * i386.cc (Target_i386::i386_info): Likewise.
9878 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9879 Likewise.
9880 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9881 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9882 (Target_x86_64::do_new_output_section): New function.
9883 * configure.ac: Define conditional MCMODEL_MEDIUM.
9884 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9885 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9886 (large_LDFLAGS): Define.
9887 * testsuite/large.c: New file.
9888 * testsuite/testfile.cc (Target_test::test_target_info):
9889 Initialize new fields.
9890 * configure, testsuite/Makefile.in: Rebuild.
9891
9892 2009-06-05 Doug Kwan <dougkwan@google.com>
9893
9894 * Makefile.am (CCFILES): Add target.cc.
9895 * Makefile.in: Regenerate.
9896 * i386.cc (class Target_i386): Define new virtual method to
9897 override do_is_local_label_name in parent.
9898 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9899 local symbols if --discard-locals or -X is given.
9900 * options.h (class General_options): Declare new options
9901 '--discard-locals' and '-X' for discarding locals.
9902 * target.h (class Target): Define new methods is_local_label_name.
9903 Declare new virtual method do_is_local_label_name.
9904 * target.cc: New file.
9905 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9906 (check_SCRIPTS): Add discard_locals_test.sh.
9907 (check_DATA): Add discard_local_tests.syms.
9908 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9909 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9910 * testsuite/Makefile.in: Regenerate.
9911 * testsuite/discard_locals_test.c: New file.
9912 * testsuite/discard_locals_test.sh: Same.
9913
9914 2009-06-05 Doug Kwan <dougkwan@google.com>
9915
9916 * object.cc (Sized_relobj::Sized_relobj): Initialize
9917 discarded_eh_frame_shndx_ to -1U.
9918 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9919 section.
9920 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9921 a discarded .eh_frame section.
9922 (Sized_relobj::do_finalize_local_symbols): Ditto.
9923 * object.h (class Sized_relobj): Declare new member
9924 discarded_eh_frame_shndx_.
9925 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9926 (local_labels_test.o, local_labels_test): New rules.
9927 * testsuite/Makefile.in: Regenerate.
9928
9929 2009-06-04 Doug Kwan <dougkwan@google.com>
9930
9931 * layout.cc (Layout::section_name_mapping): Add mapping for
9932 special ARM sections.
9933
9934 2009-06-03 Doug Kwan <dougkwan@google.com>
9935
9936 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9937 (utils::has_overflow): Same.
9938
9939 2009-06-03 Ian Lance Taylor <iant@google.com>
9940
9941 * layout.cc (Layout::section_name_mapping): New array, replacing
9942 Layout::linkonce_mapping.
9943 (Layout::section_name_mapping_count): New variable, replacing
9944 Layout::linkonce_mapping_count.
9945 (Layout::linkonce_output_name): Remove.
9946 (Layout::output_section_name): Rewrite.
9947 * layout.h (class Layout): Rename Linkonce_mapping to
9948 Section_name_mapping, linkonce_mapping to section_name_mapping,
9949 linkonce_mapping_count to section_name_mapping_count. Don't
9950 declare linkonce_output_name.
9951
9952 2009-06-03 Doug Kwan <dougkwan@google.com>
9953
9954 * gold/arm.cc (namespace utils): New.
9955 (Target_arm::reloc_is_non_pic): Define new method.
9956 (class Arm_relocate_functions): New.
9957 (Target_arm::Relocate::relocate): Handle relocation types used by
9958 Android.
9959
9960 2009-06-03 Ian Lance Taylor <iant@google.com>
9961
9962 * arm.cc (Target_arm::scan::global): Use || instead of |.
9963
9964 2009-06-02 Doug Kwan <dougkwan@google.com>
9965
9966 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9967 issued_non_pic_error_.
9968 (class Target_arm::Scan): Declare new method check_non_pic.
9969 Define new method symbol_needs_plt_entry.
9970 Declare new data member issued_non_pic_error_.
9971 (class Target_arm::Relocate): Declare new method
9972 should_apply_static_reloc.
9973 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9974 (Target_arm::Scan::check_non_pic): Define new method.
9975 (Target_arm::Scan::local): Handle a small subset of reloc types used
9976 by Android.
9977 (Target_arm::Scan::local): Same.
9978 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9979
9980 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9981
9982 * incremental.cc (Incremental_inputs::report_command_line): Filter
9983 out --incremental-* options.
9984
9985 2009-05-29 Doug Kwan <dougkwan@google.com>
9986
9987 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9988 template class.
9989 (class Target_arm): Update comment.
9990 (Target_arm::Target_arm): Initialize new data members GOT_,
9991 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9992 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9993 and Target_arm::rel_dyn_section.
9994 Declare new_enum Target_arm::Got_type.
9995 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9996 and DYNBSS_.
9997 Update commments for member do_dynsym_value.
9998 (Target_arm::got_size, Target_arm::plt_section,
9999 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10000 new methods inside class defintion.
10001 (Target_arm::got_section): Define new method.
10002 (Target_arm::rel_dyn_section): Same.
10003 (Output_data_plt_arm): New template class.
10004 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10005 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10006 (Output_data_plt_arm::add_entry): Same.
10007 (Output_data_plt_arm::first_plt_entry): Define new
10008 static data member for PLT instruction template.
10009 (Output_data_plt_arm::plt_entry): Same.
10010 (Output_data_plt_arm::do_write): Define new method.
10011 (Target_arm::make_plt_entry): Same.
10012 (Target_arm::do_finalize_sections): Same.
10013 (Target_arm::do_dynsym_value): Same.
10014
10015 2009-05-28 Doug Kwan <dougkwan@google.com>
10016
10017 * Makefile.am (TARGETSOURCES): Add arm.cc.
10018 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10019 * Makefile.in: Regenerate.
10020 * arm.cc: New file.
10021 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10022
10023 2009-05-26 Doug Kwan <dougkwan@google.com>
10024
10025 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10026 (General_options::check_excluded_libs): Strip off directories in
10027 archive name before matching like GNU ld does.
10028 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10029 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10030 (exclude_libs_test_LDFLAGS): Add linker option
10031 -Wl,--exclude-libs,libexclude_libs_test_3
10032 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10033 an explicit archive without using -l.
10034 (alt/libexclude_libs_test_3.a): New make rule.
10035 * testsuite/Makefile.in: Regenerate.
10036 * testsuite/exclude_libs_test.c : Declare lib3_default().
10037 (main): Call it.
10038 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10039 * exclude_libs_test_3.c: New file.
10040
10041 2009-05-26 Nick Clifton <nickc@redhat.com>
10042
10043 * po/id.po: New Indonesian translation.
10044 * po/gold.pot: Updated template file.
10045
10046 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10047
10048 * testsuite/Makefile.am: Add -ffunction-sections to compile
10049 gc_comdat_test files. Add -Wl,--gc-sections to build
10050 gc_comdat_test.
10051 * testsuite/Makefile.in: Regenerate.
10052 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10053
10054 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10055
10056 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10057 kept comdat section was garbage collected.
10058 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10059 * testsuite/Makefile.in: Regenerate.
10060 * testsuite/gc_comdat_test.sh: New file.
10061 * testsuite/gc_comdat_test_1.cc: New file.
10062 * testsuite/gc_comdat_test_2.cc: New file.
10063
10064 2009-05-19 Doug Kwan <dougkwan@google.com>
10065
10066 * archive.cc (Archive::Archive): Move constructor from archive.h
10067 to here. Initialize no_export_.
10068 (Archive::get_elf_object_for_member): Set no_export flag of object.
10069 * archive.h (Archive::Archive): Move constructor body to
10070 archive.cc.
10071 (Archive::no_export): New method.
10072 (Archive::no_export_): New field.
10073 * object.h (Object::Object): Initialize no_export_ to false.
10074 (Object::no_export, Object::set_no_export): New methods.
10075 (Object::no_export_): New field.
10076 * options.cc (General_options::parse_exclude_libs): New method.
10077 (General_options::check_excluded_libs) Same.
10078 * options.h (exclude_libs): New option.
10079 (General_options::check_excluded_libs): New method declaration.
10080 (General_options::excluded_libs_): New field.
10081 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10082 default or protected visibility if an object has no-export flag set.
10083 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10084 (check_SCRIPTS): Add exclude_libs_test.sh.
10085 (check_DATA): Add exclude_libs_test.syms.
10086 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10087 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10088 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10089 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10090 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10091 libexclude_libs_test_2.a): New rules.
10092 * testsuite/Makefile.in: Regenerate.
10093 * testsuite/exclude_libs_test.c: New file.
10094 * testsuite/exclude_libs_test.sh: Ditto.
10095 * testsuite/exclude_libs_test_1.c: Ditto.
10096 * testsuite/exclude_libs_test_2.c: Ditto.
10097
10098 2009-05-15 Ian Lance Taylor <iant@google.com>
10099
10100 * configure.ac: Check for declarations for cases where libiberty.h
10101 checks HAVE_DECL_xxx.
10102 * configure, config.in: Rebuild.
10103
10104 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10105
10106 * gold.h (Incremental_argument_list): Remove (invalid) forward
10107 declaration.
10108 * incremental.cc (Incremental_inputs::report_achive): New method.
10109 (Incremental_inputs::report_object): New method.
10110 (Incremental_inputs::report_script): New method.
10111 (Incremental_inputs::finalize_inputs): New method.
10112 (Incremental_inputs::finalize): Call finalize_inputs().
10113 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10114 Create inputs entries.
10115 * incremental.h (Incremental_input_type): New enum.
10116 (Incremental_inputs::Incremental_input): Initialize new fields.
10117 (Incremental_inputs::report_inputs): New method.
10118 (Incremental_inputs::report_achive): New method.
10119 (Incremental_inputs::report_object): New method.
10120 (Incremental_inputs::report_script): New method.
10121 (Incremental_inputs::finalize_inputs): New method.
10122 (Incremental_inputs::Input_info): New struct.
10123 (Incremental_inputs::Input_info_map): New typedef.
10124 (Incremental_inputs::lock_): New field.
10125 (Incremental_inputs::Inputs_): New field.
10126 (Incremental_inputs::Inputs_map): New field.
10127 * main.cc (main): Call Incremental_input::report_inputs.
10128 * options.h (Input_argument_list): Typedef moved from
10129 Input_arguments.
10130 (Input_file_group::Files): Remove, use ::Input_argument_list.
10131 (Input_file_group::Input_argument_list): Remove, use
10132 ::Input_argument_list.
10133 * plugin.cc (Plugin_manager::add_input_file): Add error in
10134 incremental build.
10135 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10136 functions.
10137 * script.cc (read_input_script): Call
10138 Incremental_input::report_script.
10139 * script.h (Script_info): New class.
10140
10141 2009-04-27 Ian Lance Taylor <iant@google.com>
10142
10143 * x86_64.cc (do_adjust_output_section): Set entsize to
10144 plt_entry_size.
10145
10146 2009-04-23 Elliott Hughes <enh@google.com>
10147
10148 * output.cc (Output_file::close): After short writes, continue
10149 writing from the correct offset in the buffer being written.
10150
10151 2009-04-23 Chris Demetriou <cgd@google.com>
10152
10153 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10154 * configure: Regenerate.
10155 * config.in: Regenerate.
10156 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10157 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10158
10159 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10160
10161 * incremental.cc (Incremental_inputs_header_data): Renamed from
10162 Incremental_input_header_data.
10163 (Incremental_inputs_header_data::data_size): New field.
10164 (Incremental_inputs_header_data::put_input_file_count): Renamed
10165 from input_file_count.
10166 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10167 from command_line_offset.
10168 (Incremental_inputs_header_data::put_reserved): Renamed from
10169 put_reserved.
10170 (Incremental_inputs_entry_data): Renamed from
10171 Incremental_input_entry_data.
10172 (Incremental_inputs_entry_data::data_size): New field.
10173 (Incremental_inputs::report_command_line): New method.
10174 (Incremental_inputs::finalize): New method.
10175 (Incremental_inputs::create_incremental_inputs_data): New method.
10176 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10177 * incremental.h: New file.
10178 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10179 (Layout::finalize): Create incremental inputs section in
10180 incremental builds.
10181 (Layout::create_incremental_info_sections): New method.
10182 * layout.h (Layout::incremental_inputs): New method.
10183 (Layout::create_incremental_info_sections): New method.
10184 (Layout::incremental_inputs_): New field.
10185 * main.cc (main): Notify Incremental_input of the command line.
10186
10187 2009-04-01 Ian Lance Taylor <iant@google.com>
10188 Mikolaj Zalewski <mikolajz@google.com>
10189
10190 * gold.h (reserve_unordered_map): Define, three versions, one for
10191 each version of Unordered_map.
10192 * layout.cc (Layout::Layout): Remove options parameter. Add
10193 number_of_input_files parameter. Don't initialize options_.
10194 Initialize number_of_input_files_ and resized_signatures_. Move
10195 sections_are_attached_.
10196 (Layout::layout_group): Reserve space for group_signatures_.
10197 (Layout::find_or_add_kept_section): Change name parameter to be a
10198 reference. Resize signatures_ map when it gets large enough.
10199 (Layout::layout_eh_frame): Use parameters->options() instead of
10200 this->options_.
10201 (Layout::make_output_section): Likewise.
10202 (Layout::attach_allocated_section_to_segment): Likewise.
10203 (Layout::finalize, Layout::create_executable_stack): Likewise.
10204 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10205 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10206 * layout.h (class Layout): Update declarations. Remove options_
10207 field. Add number_of_input_files_ and resized_signatures_
10208 fields. Move sections_are_attached_ field.
10209 * main.cc (main): Pass number of input files to Layout
10210 constructor. Don't pass options.
10211
10212 2009-03-30 Ian Lance Taylor <iant@google.com>
10213
10214 * ffsll.c (ffsll): Correct implementation.
10215
10216 2009-03-27 Ian Lance Taylor <iant@google.com>
10217
10218 * ffsll.c: New file.
10219 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10220 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10221 * ftruncate.c (ftruncate): Declare before definition.
10222 * mremap.c (mremap): Likewise.
10223 * pread.c (pread): Likewise.
10224 * configure, Makefile.in, config.in: Rebuild.
10225
10226 * mremap.c: New file.
10227 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10228 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10229 (mremap): Declare if HAVE_MREMAP is not defined.
10230 * configure, Makefile.in, config.in: Rebuild.
10231
10232 2009-03-27 Cary Coutant <ccoutant@google.com>
10233
10234 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10235 position independent.
10236 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10237 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10238
10239 2009-03-24 Cary Coutant <ccoutant@google.com>
10240
10241 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10242 an executable.
10243 (needs_dynamic_reloc): Likewise.
10244
10245 2009-03-24 Ian Lance Taylor <iant@google.com>
10246
10247 * yyscript.y (file_cmd): Recognize EXTERN.
10248 (extern_name_list, extern_name_list_body): New nonterminals.
10249 * script.cc (script_add_extern): Define.
10250 * script-c.h (script_add_extern): Declare.
10251
10252 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10253
10254 * object.cc (is_elf_object): Define.
10255 * object.h (is_elf_object): Declare.
10256 * archive.cc (Archive::get_elf_object_for_member): Call
10257 is_elf_object.
10258 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10259
10260 2009-03-24 Elliott Hughes <enh@google.com>
10261
10262 * output.cc (Output_file::map_anonymous): Define.
10263 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10264 try an anonymous one. Report the size if the mmap fails.
10265 * output.h (class Output_file): Declare map_anonymous.
10266
10267 2009-03-24 Ian Lance Taylor <iant@google.com>
10268
10269 * target-select.cc (instantiate_target): Don't acquire the lock if
10270 the instantiated_target_ field has already been set.
10271
10272 2009-03-23 Ian Lance Taylor <iant@google.com>
10273
10274 * gold-threads.h (class Initialize_lock): Define.
10275 * gold-threads.cc (class Initialize_lock_once): Define.
10276 (initialize_lock_control): New static variable.
10277 (initialize_lock_pointer): New static variable.
10278 (initialize_lock_once): New static function.
10279 (Initialize_lock::Initialize_lock): Define.
10280 (Initialize_lock::initialize): Define.
10281 * target-select.h: Include "gold-threads.h".
10282 (class Target_selector): Add lock_ and initialize_lock_ fields.
10283 Don't define instantiate_target, just declare it.
10284 * target-select.cc (Target_selector::Target_selector): Initialize
10285 new fields.
10286 (Target_selector::instantiate_target): Define.
10287 * descriptors.h: Include "gold-threads.h".
10288 (class Descriptors): Add initialize_lock_ field.
10289 * descriptors.cc (Descriptors::Descriptors): Initialize new
10290 field.
10291 (Descriptors::open): Use initialize_lock_ field
10292 * errors.h (class Errors): Add initialize_lock_ field.
10293 * errors.cc (Errors::Errors): Initialize new field.
10294 (Errors::initialize_lock): Use initialize_lock_ field.
10295 * powerpc.cc (class Target_selector_powerpc): Remove
10296 instantiated_target_ field. In do_recognize call
10297 instantiate_target rather than do_instantiate_target. In
10298 do_instantiate_target just allocate a new target.
10299 * sparc.cc (class Target_selector_sparc): Likewise.
10300
10301 * freebsd.h: New file.
10302 * i386.cc: Include "freebsd.h".
10303 (Target_i386): Derive from Target_freebsd rather than
10304 Sized_target.
10305 (Target_selector_i386): Derive from Target_selector_freebsd rather
10306 than Target_selector.
10307 * x86_64.cc: Include "freebsd.h".
10308 (Target_x86_64): Derive from Target_freebsd rather than
10309 Sized_target.
10310 (Target_selector_x86_64): Derive from Target_selector_freebsd
10311 rather than Target_selector.
10312 * target.h (class Target): Add adjust_elf_header and
10313 do_adjust_elf_header.
10314 * output.cc (Output_file_header:: do_sized_write): Call target
10315 adjust_elf_header routine.
10316 * configure.tgt: Set targ_osabi.
10317 * configure.ac: Define GOLD_DEFAULT_OSABI.
10318 * parameters.cc (Parameters::default_target): Pass
10319 GOLD_DEFAULT_OSABI to select_target.
10320 * target-select.h (class Target_selector): Make instantiate_target
10321 protected rather than private.
10322 * Makefile.am (HFILES): Add freebsd.h.
10323 * configure, Makefile.in, config.in: Rebuild.
10324
10325 * merge.cc (do_add_input_section): Correct pend value. Change
10326 message about last entry not being null terminated from error to
10327 warning.
10328
10329 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10330
10331 * incremental.cc: New file.
10332 * Makefile.am (CCFILES): Add incremental.cc.
10333 * Makefile.in: Rebuild.
10334
10335 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10336
10337 * layout.cc (Layout::output_section_name): Preserve names
10338 of '.note.' sections.
10339
10340 2009-03-19 Ian Lance Taylor <iant@google.com>
10341
10342 * descriptors.cc (Descriptors::open): Check that the options are
10343 valid before using them.
10344
10345 2009-03-18 Ian Lance Taylor <iant@google.com>
10346
10347 * script-sections.h: Include <list>.
10348 (class Script_sections): Change Sections_elements from std::vector
10349 to std::list. Typedef public Elements_iterator. Add
10350 orphan_section_placement_, data_segment_align_start_, and
10351 saw_data_segment_align_ fields. Remove data_segment_align_index_
10352 field.
10353 * script-sections.cc (class Orphan_section_placement): New class.
10354 (class Sections_element): Add virtual functions is_relro and
10355 orphan_section_init. Remove virtual function place_orphan_here.
10356 (class Output_section_definition): Add is_relro and
10357 orphan_section_init. Remove place_orphan_here.
10358 (class Orphan_output_section): Likewise.
10359 (Script_sections::Script_sections): Update for field changes.
10360 (Script_sections::data_segment_align): Set saw_data_segment_align_
10361 and data_segment_align_start_, not data_segment_align_index.
10362 (Script_sections::data_segment_relro_end): Check
10363 saw_data_segment_align_. Use data_segment_align_start_ rather
10364 than data_segment_align_index_.
10365 (Script_sections::place_orphan): Rewrite to use
10366 Orphan_section_placement.
10367
10368 2009-03-17 Ian Lance Taylor <iant@google.com>
10369
10370 * archive.cc (Archive::add_symbols): Check for a version attached
10371 to the symbol name in the archive map.
10372 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10373 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10374 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10375 (ver_test_11.a): New target.
10376 * testsuite/Makefile.in: Rebuild.
10377
10378 * configure.ac: Check for chsize and posix_fallocate. Replace
10379 ftruncate.
10380 * ftruncate.c: New file, from gnulib.
10381 * output.cc (posix_fallocate): Define dummy version if not
10382 HAVE_POSIX_FALLOCATE.
10383 (Output_file::map): Call posix_fallocate rather than lseek and
10384 write.
10385 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10386 * configure, Makefile.in, config.in: Rebuild.
10387
10388 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10389
10390 * layout.h (Layout::create_note): Add section_name parameter.
10391 * layout.cc (Layout::create_note): Likewise.
10392 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10393
10394 2009-03-17 Ian Lance Taylor <iant@google.com>
10395
10396 * descriptors.cc: Include "options.h".
10397 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10398 (Descriptors::open): Always use O_CLOEXEC when opening a new
10399 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10400 then set FD_CLOEXEC.
10401
10402 * sparc.cc (class Target_sparc): Add has_got_section.
10403 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10404 make sure we have a GOT section.
10405
10406 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10407 (Target_sparc::Scan::local): Likewise.
10408 (Target_sparc::Scan::global): Likewise.
10409 (Target_sparc::Relocate::relocate): Likewise.
10410 (Target_sparc::Relocate::relocate_tls): Likewise.
10411
10412 * symtab.cc (Symbol_table::define_default_version): New function,
10413 broken out of add_from_object.
10414 (Symbol_table::add_from_object): Call define_default_version.
10415 (Symbol_table::define_special_symbol): Add resolve_oldsym
10416 parameter. Change all callers. If the version for a symbol comes
10417 from a version script, resolve it with the symbol with the same
10418 name with no version. Also add the symbol without a version if
10419 appropriate.
10420 (do_define_in_output_data): If resolving with oldsym, don't delete
10421 sym.
10422 (do_define_in_output_segment): Likewise.
10423 (do_define_as_constant): Likewise.
10424 * symtab.h (class Symbol_table): Update declarations.
10425
10426 2009-03-13 Ian Lance Taylor <iant@google.com>
10427
10428 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10429 (Read_symbols::requeue): New function.
10430 (Read_symbols::do_read_symbols): If make_elf_object fails because
10431 the target type is not configured, and the file was searched for,
10432 issue a warning and retry with the next directory.
10433 (Add_symbols::run): If the file has an incompatible format, and
10434 it was searched for, requeue the Read_symbols task. On error,
10435 release the object.
10436 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10437 dirindex parameter to constructor. Change all callers. Declare
10438 incompatible_warning and requeue.
10439 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10440 input_argument_ and input_group_ fields. Add them to
10441 constructor. Change all callers.
10442 (class Read_script): Add dirindex_ field. Add it to constructor.
10443 Change all callers.
10444 * archive.cc (Archive::setup): Remove input_objects parameter.
10445 Change all callers.
10446 (Archive::get_file_and_offset): Likewise.
10447 (Archive::read_all_symbols): Likewise.
10448 (Archive::read_symbols): Likewise.
10449 (Archive::get_elf_object_for_member): Remove input_objects
10450 parameter. Add punconfigured parameter. Change all callers.
10451 (Archive::add_symbols): Change return type to bool. Check return
10452 value of include_member.
10453 (Archive::include_all_members): Likewise.
10454 (Archive::include_member): Change return type to bool. Return
10455 false if first included object has incompatible target. Set
10456 included_member_ field.
10457 (Add_archive_symbols::run): If add_symbols returns false, requeue
10458 Read_symbols task.
10459 * archive.h (class Archive): Add included_member_ field.
10460 Initialize it in constructor. Add input_file and searched_for
10461 methods. Update declarations.
10462 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10463 input_argument_ fields. Add them to constructor. Change all
10464 callers.
10465 * script.cc: Include "target-select.h".
10466 (class Parser_closure): Add skip_on_incompatible_target_ and
10467 found_incompatible_target_ fields. Add
10468 skip_on_incompatible_target parameter to constructor. Change all
10469 callers. Add methods skip_on_incompatible_target,
10470 clear_skip_on_incompatible_target, found_incompatible_target, and
10471 set_found_incompatible_target.
10472 (read_input_script): Add dirindex parameter. Change all callers.
10473 If parser finds an incompatible target, requeue Read_symbols
10474 task.
10475 (script_set_symbol): Clear skip_on_incompatible_target in
10476 closure.
10477 (script_add_assertion, script_parse_option): Likewise.
10478 (script_start_sections, script_add_phdr): Likewise.
10479 (script_check_output_format): New function.
10480 * script.h (read_input_script): Update declaration.
10481 * script-c.h (script_check_output_format): Declare.
10482 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10483 (ignore_cmd): Remove OUTPUT_FORMAT.
10484 * fileread.cc (Input_file::Input_file): Add explicit this.
10485 (Input_file::will_search_for): New function.
10486 (Input_file::open): Add pindex parameter. Change all callers.
10487 * fileread.h (class Input_file): Add input_file_argument method.
10488 Declare will_search_for. Update declarations.
10489 * object.cc (make_elf_object): Add punconfigured parameter.
10490 Change all callers.
10491 * object.h (class Object): Make input_file public. Add
10492 searched_for method.
10493 (make_elf_object): Update declaration.
10494 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10495 restart search.
10496 * dirsearch.h (class Dirsearch): Update declaration.
10497 * options.h (class General_options): Add --warn-search-mismatch.
10498 * parameters.cc (Parameters::is_compatible_target): New function.
10499 * parameters.h (class Parameters): Declare is_compatible_target.
10500 * workqueue.cc (Workqueue::add_blocker): New function.
10501 * workqueue.h (class Workqueue): Declare add_blocker.
10502
10503 * fileread.cc (Input_file::open): Remove options parameter.
10504 Change all callers.
10505 (Input_file::open_binary): Likewise.
10506 * script.cc (read_input_script): Likewise.
10507 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10508 options parameter from constructor. Change all callers.
10509 (class Read_script): Likewise.
10510 * fileread.h (class Input_file): Update declarations.
10511 * script.h (read_input_script): Update declaration.
10512
10513 2009-03-10 Nick Clifton <nickc@redhat.com>
10514
10515 * po/es.po: New Spanish translation.
10516
10517 2009-03-06 Cary Coutant <ccoutant@google.com>
10518
10519 * options.cc (parse_short_option): Keep dash_z from registering itself.
10520
10521 2009-03-03 Ian Lance Taylor <iant@google.com>
10522
10523 PR 9918
10524 * target-reloc.h (relocate_section): Pass output_section to
10525 relocate.
10526 * i386.cc (Target_i386::should_apply_static_reloc): Add
10527 output_section parameter. Change all callers.
10528 (Target_i386::Relocate::relocate): Add output_section parameter.
10529 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10530 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10531 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10532 * testsuite/two_file_shared.sh: New script.
10533 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10534 (check_DATA): Add two_file_shared.dbg.
10535 (two_file_shared.dbg): New target.
10536 * testsuite/Makefile.in: Rebuild.
10537
10538 2009-03-01 Ian Lance Taylor <iant@google.com>
10539
10540 * configure.ac: Check for byteswap.h.
10541 * configure: Rebuild.
10542 * config.in: Rebuild.
10543
10544 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10545
10546 * layout.cc (Layout::find_or_add_kept_section): New function.
10547 (Layout::add_comdat): Removed.
10548 * layout.h (struct Kept_section): Move out of class Layout.
10549 Remove trailing underscores from field names. Add group_sections
10550 field. Rename group_ field to is_group. Change all uses.
10551 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10552 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10553 comdat_groups_ field.
10554 (Sized_relobj::include_section_group): Use
10555 find_or_add_kept_section and Kept_section::group_sections.
10556 (Sized_relobj::include_linkonce_section): Likewise.
10557 * object.cc (class Sized_relobj): Don't define Comdat_group or
10558 Comdat_group_table. Remove find_comdat_group and
10559 add_comdat_group. Remove comdat_groups_ field.
10560 * plugin.cc (include_comdat_group): Use
10561 Layout::find_or_add_kept_section.
10562
10563 2009-02-28 Ian Lance Taylor <iant@google.com>
10564
10565 * README: --gc-sections and map files are now supported. Document
10566 some build requirements.
10567
10568 PR 6992
10569 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10570 relocatable link set the value of the section symbol to zero.
10571 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10572 relocatable link don't include the section address in the local
10573 symbol value.
10574
10575 2009-02-27 Ian Lance Taylor <iant@google.com>
10576
10577 PR 6811
10578 * options.h (class Search_directory): Add is_system_directory.
10579 (class General_options): Declare is_in_system_directory.
10580 * options.cc (get_relative_sysroot): Make static.
10581 (get_default_sysroot): Make static.
10582 (General_optoins::is_in_system_directory): New function.
10583 * fileread.cc (Input_file::is_in_system_directory): New function.
10584 * fileread.h (class Input_file): Declare is_in_system_directory.
10585 * object.h (class Object): Add is_in_system_directory.
10586 (class Input_objects): Remove system_library_directory_ field.
10587 * object.cc (Input_objects::add_object): Don't set
10588 system_library_directory_.
10589 (input_objects::found_in_system_library_directory): Remove.
10590 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10591 parameter. Change all callers.
10592 (Symbol_table::sized_write_globals): Likewise.
10593 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10594 Call Object::is_in_system_directory.
10595 * symtab.h (class Symbol_table): Update declarations.
10596
10597 PR 5990
10598 * descriptors.h (Open_descriptor): Add is_on_stack field.
10599 * descriptors.cc (Descriptors::open): If the descriptor is on the
10600 top of the stack, remove it. Initialize is_on_stack field.
10601 (Descriptors::release): Only add pod to stack if it is not on the
10602 stack already.
10603 (Descriptors::close_some_descriptor): Clear stack_next and
10604 is_on_stack fields.
10605
10606 PR 7091
10607 * output.cc (Output_section::find_starting_output_address): Rename
10608 from starting_output_address; add PADDR parameter; change return
10609 type.
10610 * output.h (class Output_section): Declare
10611 find_starting_output_address instead of starting_output_address.
10612 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10613 section symbol for which we can't find a merge section.
10614
10615 PR 9836
10616 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10617 hidden or internal, force the symbol to be local.
10618 * resolve.cc (Symbol::override_visibility): Define.
10619 (Symbol::override_base): Use override_visibility.
10620 (Symbol_table::resolve): Likewise.
10621 (Symbol::override_base_with_special): Likewise.
10622 (Symbol_table::override_with_special): If the visibility is hidden
10623 or internal, force the symbol to be local.
10624 * symtab.h (class Symbol): Add set_visibility and
10625 override_visibility.
10626 * testsuite/ver_test_1.sh: New file.
10627 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10628 (check_DATA): Add ver_test_1.syms.
10629 (ver_test_1.syms): New target.
10630 * testsuite/Makefile.in: Rebuild.
10631
10632 2009-02-25 Cary Coutant <ccoutant@google.com>
10633
10634 * layout.cc (Layout::choose_output_section): Don't rename sections
10635 when using a linker script that has a SECTIONS clause.
10636 * Makefile.in: Regenerate.
10637
10638 * testsuite/Makefile.am (script_test_5.sh): New test case.
10639 * testsuite/Makefile.in: Regenerate.
10640 * testsuite/script_test_5.cc: New file.
10641 * testsuite/script_test_5.sh: New file.
10642 * testsuite/script_test_5.t: New file.
10643
10644 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10645
10646 * archive.cc (Archive::include_member): Update calls to add_symbols.
10647 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10648 the Layout argument.
10649 * dynobj.h (do_add_symbols): Add the Layout argument.
10650 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10651 Layout argument.
10652 * object.h (Object::add_symbols): Add the Layout argument.
10653 (Object::do_add_symbols): Add the Layout argument.
10654 (Sized_relobj::do_add_symbols): Add the Layout argument.
10655 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10656 Unify the two versions.
10657 (Add_plugin_symbols): Remove.
10658 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10659 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10660 (Add_plugin_symbols): Remove.
10661 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10662 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10663 (Add_symbols::run): Make it work with Pulginobj.
10664
10665 2009-02-06 Ian Lance Taylor <iant@google.com>
10666
10667 * object.cc (Sized_relobj::do_layout): Make info message start
10668 with lower case letter.
10669
10670 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10671
10672 * binary.cc: Fix file comment.
10673
10674 * options.h (enum Incremental_disposition): Define.
10675 (class General_options): Add new options: --incremental,
10676 --incremental_changed, --incremental_unchanged,
10677 --incremental_unknown. Add incremental_disposition_ and
10678 implicit_incremental_ fields.
10679 (General_options::incremental_disposition): New function.
10680 (class Position_dependent_options): Add incremental_disposition
10681 option.
10682 (Position_dependent_options::copy_from_options): Set incremental
10683 dispositions.
10684 * options.cc (General_options::parse_incremental_changed): New
10685 function.
10686 (General_options::parse_incremental_unchanged): New function.
10687 (General_options::parse_incremental_unknown): New function.
10688 (General_options::General_options): Initialize new fields
10689 incremental_disposition_ and implicit_incremental_.
10690 (General_options::finalize): Check for uasge of --incremental-*
10691 without --incremental.
10692
10693 2009-02-06 Chris Demetriou <cgd@google.com>
10694
10695 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10696 pointer and to report location as the file name associated with
10697 the symbol.
10698 (gold_undefined_symbol_at_location): New function to replace the
10699 old gold_undefined_symbol functionality.
10700 * target-reloc.h (relocate_section): Update to use
10701 gold_undefined_symbol_at_location.
10702 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10703 Call gold_undefined_symbol function rather than gold_error.
10704 * errors.h (Errors::undefined_symbol): Take location as a
10705 string, rather than calculating it from a relocation.
10706 * errors.cc (Errors::fatal): Print "fatal error:" before the
10707 formatted message.
10708 (Errors::error, Errors::error_at_location): Print "error: "
10709 before the formatted message.
10710 (Errors::undefined_symbol): Take location as a string, rather
10711 than calculating it from a relocation.
10712 (gold_undefined_symbol_at_location): New function akin to
10713 old gold_undefined_symbol, calculates location from relocation.
10714 (gold_undefined_symbol): Change to take only a Symbol pointer
10715 and to report location as the file name associated with the symbol.
10716 * testsuite/debug_msg.sh: Update for changed error messages.
10717 * testsuite/undef_symbol.sh: Likewise.
10718
10719 2009-02-04 Duncan Sands <baldrick@free.fr>
10720
10721 PR 9812
10722 * reduced_debug_output.h
10723 (Output_reduced_debug_abbrev_section::failed): Use format for
10724 gold_warning.
10725 (Output_reduced_debug_info_section::faild): Likewise.
10726
10727 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10728
10729 * script.cc (Lazy_demangler): New class.
10730 (Version_script_info::get_symbol_version_helper): Demangle a
10731 symbol only once.
10732
10733 2009-01-29 Cary Coutant <ccoutant@google.com>
10734
10735 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10736 to __tls_get_addr.
10737 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10738
10739 2009-01-28 Ian Lance Taylor <iant@google.com>
10740
10741 * version.cc (version_string): Bump to 1.9.
10742
10743 * gold.h: Include <cstring> and <stdint.h>.
10744 * version.cc: Include <cstdio>.
10745 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10746 warning.
10747 * reduced_debug_output.cc (insert_into_vector): Rename from
10748 Insert_into_vector; change all callers. Use Swap_unaligned to
10749 avoid aliasing issue; remove union since it is unnecessary.
10750
10751 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10752
10753 * Makefile.am (CCFILES): Add gc.cc.
10754 (HFILES): Add gc.h.
10755 * Makefile.in: Regenerate.
10756 * gold.cc (Gc_runner): New class.
10757 (queue_initial_tasks): Call garbage collection related tasks
10758 when corresponding options are invoked.
10759 (queue_middle_gc_tasks): New function.
10760 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10761 processed early before laying out sections during garbage collection.
10762 * gold.h (queue_middle_gc_tasks): New function.
10763 (is_prefix_of): Move from "layout.cc".
10764 * i386.cc (Target_i386::gc_process_relocs): New function.
10765 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10766 * main.cc (main): Create object of class "Garbage_collection".
10767 * object.cc (Relobj::copy_symbols_data): New function.
10768 (Relobj::is_section_name_included): New function.
10769 (Sized_relobj::do_layout): Allow this function to be called twice
10770 during garbage collection and defer layout of section during the
10771 first call.
10772 * object.h (Relobj::get_symbols_data): New function.
10773 (Relobj::is_section_name_included): New function.
10774 (Relobj::copy_symbols_data): New function.
10775 (Relobj::set_symbols_data): New function.
10776 (Relobj::get_relocs_data): New function.
10777 (Relobj::set_relocs_data): New function.
10778 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10779 (Relobj::gc_process_relocs): New function.
10780 (Relobj::do_gc_process_relocs): New pure virtual function.
10781 (Relobj::sd_): New data member.
10782 (Sized_relobj::is_output_section_offset_invalid): New function.
10783 (Sized_relobj::do_gc_process_relocs): New function.
10784 * options.h (General_options::gc_sections): Modify to not be a no-op.
10785 (General_options::print_gc_sections): New option.
10786 * plugin.cc (Plugin_finish::run): Remove function call to
10787 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10788 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10789 * reloc.cc (Read_relocs::run): Add task to process relocs and
10790 determine unreferenced sections when doing garbage collection.
10791 (Gc_process_relocs): New class.
10792 (Sized_relobj::do_gc_process_relocs): New function.
10793 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10794 sections that are garbage collected.
10795 * reloc.h (Gc_process_relocs): New class.
10796 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10797 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10798 symbols whose corresponding sections are garbage collected.
10799 (Symbol_table::Symbol_table): Add new parameter for the garbage
10800 collection object.
10801 (Symbol_table::gc_mark_undef_symbols): New function.
10802 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10803 (Symbol_table::gc_mark_dyn_syms): New function.
10804 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10805 as garbage.
10806 (Symbol_table::add_from_object): Likewise.
10807 (Symbol_table::add_from_relobj): When building shared objects, do not
10808 treat externally visible symbols as garbage.
10809 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10810 table information for static and relocatable links.
10811 * symtab.h (Symbol_table::set_gc): New function.
10812 (Symbol_table::gc): New function.
10813 (Symbol_table::gc_mark_undef_symbols): New function.
10814 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10815 (Symbol_table::gc_mark_dyn_syms): New function.
10816 (Symbol_table::gc_): New data member.
10817 * target.h (Sized_target::gc_process_relocs): New pure virtual
10818 function.
10819 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10820 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10821
10822 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10823
10824 * options.h (General_options::gc_sections): Define as a no-op for now.
10825 (General_options::no_keep_memory): Ditto.
10826 (General_options::Bshareable): Define.
10827 * options.cc (General_options::finalize): Honor -Bshareable.
10828
10829 2009-01-20 Andreas Schwab <schwab@suse.de>
10830
10831 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10832 read the value in the contents, since we don't use it. Use the
10833 template endianness when writing.
10834 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10835
10836 2009-01-19 Andreas Schwab <schwab@suse.de>
10837
10838 * configure.tgt (powerpc64-*): Fix targ_obj.
10839
10840 2009-01-15 Ian Lance Taylor <iant@google.com>
10841
10842 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10843 local symbols when stripping all symbols.
10844
10845 2009-01-14 Cary Coutant <ccoutant@google.com>
10846
10847 * output.cc (Output_reloc): Add explicit instantiations.
10848
10849 2009-01-14 Cary Coutant <ccoutant@google.com>
10850
10851 * archive.cc (Archive::get_elf_object_for_member): Remove call
10852 to File_read::claim_for_plugin.
10853 * descriptors.cc (Descriptors::open): Remove reference to
10854 is_claimed.
10855 (Descriptors::claim_for_plugin): Remove.
10856 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10857 (Descriptors::is_claimed): Remove.
10858 (claim_descriptor_for_plugin): Remove.
10859 * fileread.cc (File_read::claim_for_plugin): Remove.
10860 * fileread.h (File_read::claim_for_plugin): Remove.
10861 (File_read::descriptor): Reopen descriptor if necessary.
10862 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10863 (Plugin_manager::all_symbols_read): Add task parameter. Change
10864 all callers.
10865 (Plugin_manager::get_input_file): New function.
10866 (Plugin_manager::release_input_file): New function.
10867 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10868 corresponding data member.
10869 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10870 and pass to base constructor. Change all callers.
10871 (get_input_file, release_input_file): New functions.
10872 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10873 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10874 (Plugin_manager::all_symbols_read): Add task parameter.
10875 (Plugin_manager::get_input_file): New function.
10876 (Plugin_manager::release_input_file): New function.
10877 (Plugin_manager::task_): New data member.
10878 (Pluginobj::Pluginobj): Add filesize parameter.
10879 (Pluginobj::filename): New function.
10880 (Pluginobj::descriptor): New function.
10881 (Pluginobj::filesize): New function.
10882 (Pluginobj::filesize_): New data member.
10883 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10884 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10885 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10886
10887 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10888 with archive libraries.
10889 * testsuite/Makefile.in: Regenerate.
10890 * testsuite/plugin_test.c (struct sym_info): New type.
10891 (get_input_file, release_input_file): New static variables.
10892 (onload): Capture new transfer vector entries.
10893 (claim_file_hook): Stop reading at end of file according to filesize.
10894 Factor out parsing of readelf output into separate function.
10895 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10896 APIs and get the source file name from the symbol table. Convert
10897 source file name to corresponding object file name. Print info
10898 message when adding new input files.
10899 (parse_readelf_line): New function.
10900 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10901 * testsuite/plugin_test_2.sh: Likewise.
10902 * testsuite/plugin_test_3.sh: Likewise.
10903 * testsuite/plugin_test_4.sh: New test case.
10904
10905 2009-01-07 Ian Lance Taylor <iant@google.com>
10906
10907 * version.cc (version_string): Bump to 1.8.
10908
10909 2008-12-23 Cary Coutant <ccoutant@google.com>
10910
10911 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10912 * plugin.cc (Plugin_manager::finish): Rename as
10913 layout_deferred_objects. Move cleanup to separate function.
10914 (Plugin_manager::cleanup): New function.
10915 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10916 separately.
10917 * plugin.h (Plugin_manager::finish): Rename as
10918 layout_deferred_objects.
10919 (Plugin_manager::cleanup): New function.
10920 (Plugin_manager::cleanup_done): New field.
10921
10922 2008-12-23 Cary Coutant <ccoutant@google.com>
10923
10924 * plugin.cc (is_visible_from_outside): New function.
10925 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10926 so we don't return "IR only" status for exported symbols or -r links.
10927
10928 * testsuite/Makefile.am (plugin_test_3): New test case.
10929 * testsuite/Makefile.in: Regenerate.
10930 * testsuite/plugin_test_3.sh: New file.
10931
10932 2008-12-22 Cary Coutant <ccoutant@google.com>
10933
10934 * object.cc (Sized_relobj::layout_section): New function.
10935 (Sized_relobj::do_layout): Defer layout of input sections until after
10936 plugin has provided replacement files.
10937 (Sized_relobj::do_layout_deferred_sections): New function.
10938 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10939 (Relobj::layout_deferred_sections): New function.
10940 (Relobj::do_layout_deferred_sections): New function.
10941 (Sized_relobj::do_layout_deferred_sections): New function.
10942 (Sized_relobj::layout_section): New function.
10943 (Sized_relobj::Deferred_layout): New structure.
10944 (Sized_relobj::deferred_layout_): New field.
10945 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10946 Change all callers. Layout deferred sections.
10947 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10948 references.
10949 (Plugin_hook::run): Move code from do_plugin_hook inline.
10950 (Plugin_hook::do_plugin_hook): Remove.
10951 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10952 (Plugin_manager::finish): Renamed, was cleanup.
10953 (Plugin_manager::should_defer_layout): New function.
10954 (Plugin_manager::add_deferred_layout_object): New function.
10955 (Plugin_manager::Deferred_layout_list): New type.
10956 (Plugin_manager::deferred_layout_objects_): New field.
10957 (Plugin_hook::do_plugin_hook): Remove.
10958
10959 2008-12-17 Ian Lance Taylor <iant@google.com>
10960
10961 * options.h (class General_options): Add --no case for
10962 --export-dynamic.
10963
10964 2008-12-16 Cary Coutant <ccoutant@google.com>
10965
10966 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10967 vector.
10968 (Plugin_manager::claim_file): Create plugin object even if
10969 plugin did not call the add_symbols callback.
10970 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10971 asking for more symbols than were added.
10972 * testsuite/Makefile.am (plugin_test_1): Add test case with
10973 no global symbols.
10974 (empty.syms): New target.
10975 * testsuite/Makefile.in: Regenerate.
10976 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10977 message. Don't call add_symbols if no globals.
10978 (all_symbols_read_hook): Don't provide replacement for empty
10979 claimed file.
10980
10981 2008-12-12 Ian Lance Taylor <iant@google.com>
10982
10983 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10984 r_type == 0 for a local symbol with r_sym == 0.
10985 (scan_relocatable_relocs): Pass r_sym to
10986 local_non_section_strategy.
10987 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10988 r_sym parameter.
10989
10990 * configure.ac: Update test for TLS descriptors: they are
10991 supported as of glibc 2.9.
10992 * configure: Rebuild.
10993
10994 2008-12-11 Ian Lance Taylor <iant@google.com>
10995
10996 PR 7091
10997 * target-reloc.h (Default_scan_relocatable_relocs): For each
10998 function, map r_type == 0 to RELOC_DISCARD.
10999
11000 2008-12-10 Cary Coutant <ccoutant@google.com>
11001
11002 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11003 object to override a kept COMDAT group from a plugin object.
11004
11005 2008-12-09 Ian Lance Taylor <iant@google.com>
11006
11007 PR 7088
11008 * yyscript.y (file_cmd): Handle INPUT.
11009
11010 * testsuite/initpri1.c: Change all declarations to be full
11011 prototypes by adding void, to avoid compiler warnings.
11012
11013 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11014
11015 * options.cc (General_options::parse_plugin_opt): New.
11016 (General_options::add_plugin): The argument now is just the filename.
11017 (General_options::add_plugin_option): New.
11018 * options.h (plugin_opt): New.
11019 (add_plugin): Change argument name.
11020 (add_plugin_option): New.
11021 * plugin.cc (Plugin::load): Don't parse the plugin option.
11022 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11023 (Plugin::add_option): New.
11024 (Plugin::args_): Change type.
11025 (Plugin::filename_): New.
11026 (Plugin_manager::add_plugin_option): New.
11027 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11028 * testsuite/Makefile.in: Regenerate.
11029
11030 2008-12-05 Cary Coutant <ccoutant@google.com>
11031
11032 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11033 Handle --strip-lto-sections option.
11034 * options.h (strip_lto_sections): New option.
11035
11036 2008-12-01 Cary Coutant <ccoutant@google.com>
11037
11038 * plugin.cc (ld_plugin_message): Change format parameter to const.
11039 Fix mismatch between new[] and delete.
11040
11041 2008-11-14 Cary Coutant <ccoutant@google.com>
11042
11043 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11044 instead of -1U.
11045
11046 2008-11-05 Craig Silverstein <csilvers@google.com>
11047
11048 * options.cc (General_options::parse_dynamic_list): New function.
11049 * options.h (General_options): New flags dynamic_list,
11050 dynamic_list_data, dynamic_list_cpp_new, and
11051 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11052 (General_options::in_dynamic_list): New function.
11053 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11054 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11055 (Lex::can_continue_name): Likewise.
11056 (yylex): Likewise.
11057 (read_script_file): New parameter script_options.
11058 (read_dynamic_list): New function.
11059 (Script_options::define_dynamic_list): New function.
11060 (dynamic_list_keyword_parsecodes): New variable.
11061 (dynamic_list_keywords): New variable.
11062 * script.h (Script_options::define_dynamic_list): New function
11063 prototype.
11064 (read_dynamic_list): New function prototype.
11065 * symtab.cc (strprefix): New macro.
11066 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11067 dynamic_list_data, dynamic_list_cpp_new, and
11068 dynamic_list_cpp_typeinfo.
11069 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11070 (dynamic_list_expr): New rule.
11071 (dynamic_list_nodes): Likewise.
11072 (dynamic_list_node): Likewise.
11073 * testsuite/Makefile.am (dynamic_list): New test.
11074 * testsuite/Makefile.in: Regenerated.
11075 * testsuite/dynamic_list.t: New file.
11076 * testsuite/dynamic_list.sh: New file.
11077
11078 2008-11-05 Craig Silverstein <csilvers@google.com>
11079
11080 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11081 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11082 (t11_last): Likewise.
11083 * testsuite/ver_test_6.c (main): Likewise.
11084
11085 2008-10-07 Cary Coutant <ccoutant@google.com>
11086
11087 * options.c (General_options::finalize): Add check for -static and
11088 -shared.
11089 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11090 is not empty.
11091
11092 2008-10-02 Cary Coutant <ccoutant@google.com>
11093
11094 * plugin.cc (make_sized_plugin_object): Fix conditional
11095 compilation to work when not all targets are enabled.
11096
11097 2008-09-29 Cary Coutant <ccoutant@google.com>
11098
11099 * archive.cc (Archive::get_file_and_offset): Use filename instead
11100 of name to get library path.
11101 (Archive::include_member): Unlock external member of a thin archive.
11102
11103 * testsuite/Makefile.am (TEST_AR): New variable.
11104 (thin_archive_test_1): New test.
11105 (thin_archive_test_2): New test.
11106 * testsuite/Makefile.in: Regenerate.
11107 * testsuite/thin_archive_main.cc: New file.
11108 * testsuite/thin_archive_test_1.cc: New file.
11109 * testsuite/thin_archive_test_2.cc: New file.
11110 * testsuite/thin_archive_test_3.cc: New file.
11111 * testsuite/thin_archive_test_4.cc: New file.
11112
11113 2008-09-29 Cary Coutant <ccoutant@google.com>
11114
11115 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11116 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11117 instead of -1U.
11118 (Sized_relobj::do_finalize_local_symbols): Likewise.
11119 (Sized_relobj::map_to_kept_section): Likewise.
11120 * object.h (Sized_relobj::invalid_address): New constant.
11121 (Sized_relobj::do_output_section_offset): Check for invalid_address
11122 and return -1ULL.
11123 * output.cc (Output_reloc::local_section_offset): Use constant
11124 invalid_address instead of -1U.
11125 (Output_reloc::get_address): Likewise.
11126 (Output_section::output_address): Change -1U to -1ULL.
11127 * output.h (Output_reloc::invalid_address): New constant.
11128 * reloc.cc (Sized_relobj::write_sections): Use constant
11129 invalid_address instead of -1U.
11130 (Sized_relobj::relocate_sections): Likewise.
11131 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11132 values for merge sections.
11133 * target-reloc.h (relocate_for_relocatable): Use constant
11134 invalid_address instead of -1U.
11135
11136 2008-09-19 Cary Coutant <ccoutant@google.com>
11137
11138 Add plugin functionality for link-time optimization (LTO).
11139 * configure.ac (plugins): Add --enable-plugins option.
11140 * configure: Regenerate.
11141 * config.in: Regenerate.
11142 * Makefile.am (LIBDL): New variable.
11143 (CCFILES): Add plugin.cc.
11144 (HFILES): Add plugin.h.
11145 (ldadd_var): Add LIBDL.
11146 * Makefile.in: Regenerate.
11147
11148 * archive.cc: Include "plugin.h".
11149 (Archive::setup): Don't preread archive symbols when using a plugin.
11150 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11151 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11152 files.
11153 (Archive::include_member): Add symbols from plugin objects.
11154 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11155 * descriptors.cc (Descriptors::open): Check for file descriptors
11156 abandoned by plugins.
11157 (Descriptors::claim_for_plugin): New function.
11158 * descriptors.h (Descriptors::claim_for_plugin): New function.
11159 (Open_descriptor::is_claimed): New field.
11160 (claim_descriptor_for_plugin): New function.
11161 * fileread.cc (File_read::claim_for_plugin): New function.
11162 * fileread.h (File_read::claim_for_plugin): New function.
11163 (File_read::descriptor): New function.
11164 * gold.cc: Include "plugin.h".
11165 (queue_initial_tasks): Add task to call plugin hooks for generating
11166 new object files.
11167 * main.cc: Include "plugin.h".
11168 (main): Load plugin libraries.
11169 * object.h (Pluginobj): Declare.
11170 (Object::pluginobj): New function.
11171 (Object::do_pluginobj): New function.
11172 (Object::set_target): New function.
11173 * options.cc: Include "plugin.h".
11174 (General_options::parse_plugin): New function.
11175 (General_options::General_options): Initialize plugins_ field.
11176 (General_options::add_plugin): New function.
11177 * options.h (Plugin_manager): Declare.
11178 (General_options): Add --plugin option.
11179 (General_options::has_plugins): New function.
11180 (General_options::plugins): New function.
11181 (General_options::add_plugin): New function.
11182 (General_options::plugins_): New field.
11183 * plugin.cc: New file.
11184 * plugin.h: New file.
11185 * readsyms.cc: Include "plugin.h".
11186 (Read_symbols::do_read_symbols): Check for archive before checking
11187 for ELF file. Call plugin hooks to claim files.
11188 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11189 from a real object file; force override when processing replacement
11190 files.
11191 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11192 (Symbol::init_base_object): Likewise.
11193 (Symbol::init_base_output_data): Likewise.
11194 (Symbol::init_base_output_segment): Likewise.
11195 (Symbol::init_base_constant): Likewise.
11196 (Symbol::init_base_undefined): Likewise.
11197 (Symbol::output_section): Assert that object is not a plugin.
11198 (Symbol_table::add_from_pluginobj): New function.
11199 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11200 undefined.
11201 (Symbol_table::sized_write_globals): Likewise.
11202 (Symbol_table::add_from_pluginobj): Instantiate template.
11203 * symtab.h (Sized_pluginobj): Declare.
11204 (Symbol::in_real_elf): New function.
11205 (Symbol::set_in_real_elf): New function.
11206 (Symbol::in_real_elf_): New field.
11207 (Symbol_table::add_from_pluginobj): New function.
11208
11209 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11210 (LIBDL): New variable.
11211 (LDADD): Add LIBDL.
11212 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11213 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11214 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11215 (MOSTLYCLEANFILES): Likewise.
11216 * testsuite/Makefile.in: Regenerate.
11217 * testsuite/plugin_test.c: New file.
11218 * testsuite/plugin_test_1.sh: New file.
11219 * testsuite/plugin_test_2.sh: New file.
11220
11221 2008-09-16 Ian Lance Taylor <iant@google.com>
11222
11223 * target-reloc.h (relocate_section): Check whether a symbol is
11224 defined by the ABI before reporting an undefined symbol error.
11225 * target.h (Target::is_defined_by_abi): Make parameter const.
11226 (Target::do_is_defined_by_abi): Likewise.
11227 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11228 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11229 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11230 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11231 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11232 * testsuite/Makefile.in: Rebuild.
11233
11234 * fileread.cc (make_view): Add casts to avoid warning.
11235
11236 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11237
11238 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11239 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11240
11241 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11242
11243 * options.h (General_options::output_is_executable): New.
11244 (General_options::output_is_pie): New.
11245 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11246 for shared libraries.
11247 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11248
11249 2008-09-11 Chris Demetriou <cgd@google.com>
11250
11251 * options.h (origin): New -z option.
11252 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11253 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11254 in DT_FLAGS_1.
11255
11256 2008-09-05 Cary Coutant <ccoutant@google.com>
11257
11258 * fileread.cc (File_read::make_view): Add check for attempt to map
11259 beyond end of file.
11260
11261 2008-09-05 Cary Coutant <ccoutant@google.com>
11262
11263 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11264 explicit instantiations.
11265
11266 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11267
11268 PR gold/6858
11269 * options.cc (General_options::finalize): Allow undefined symbols
11270 in shlibs if linking -shared.
11271
11272 PR gold/6859
11273 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11274 symbols as not needing a dynsym entry.
11275
11276 2008-08-20 Craig Silverstein <csilvers@google.com>
11277
11278 * fileread.cc (File_read::open): Do not lock the file unless it
11279 was successfully opened.
11280
11281 2008-08-14 Cary Coutant <ccoutant@google.com>
11282
11283 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11284 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11285 * testsuite/tls_test.cc (struct int128): 128-bit struct
11286 for testing TLS relocs with non-zero addend.
11287 (v12): New TLS variable.
11288 (t12): New test.
11289 (t_last): Add check for v12.
11290 * testsuite/tls_test.h (t12): New function.
11291 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11292
11293 2008-08-13 Ian Lance Taylor <iant@google.com>
11294
11295 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11296 set tls_segment_ or relro_segment_.
11297 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11298 when appropriate.
11299 * output.h (Output_section::clear_is_relro): New function.
11300 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11301 sections specially even when output_data_ is empty.
11302 (Output_segment::maximum_alignment): When first section is relro,
11303 only force alignment for PT_LOAD segments.
11304 * script.cc (script_data_segment_align): New function.
11305 (script_data_segment_relro_end): New function.
11306 * script-c.h (script_data_segment_align): Declare.
11307 (script_data_segment_relro_end): Declare.
11308 * script-sections.h (class Script_sections): Declare
11309 data_segment_align and data_segment_relro_end. Add fields
11310 segment_align_index_ and saw_relro_end_.
11311 * script-sections.cc (class Sections_element): Add set_is_relro
11312 virtual function. Add new bool* parameter to place_orphan_here.
11313 Add get_output_section virtual function.
11314 (class Output_section_definition): Add set_is_relro. Add new
11315 bool* parameter to place_orphan_here. Add get_output_section.
11316 Add is_relro_ field.
11317 (Output_section_definition::Output_section_definition): Initialize
11318 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11319 and is_relro_ fields.
11320 (Output_section_definition::place_orphan_here): Add is_relro
11321 parameter.
11322 (Output_section_definition::set_section_addresses): Set relro for
11323 output section.
11324 (Output_section_definition::alternate_constraint): Likewise.
11325 (class Orphan_output_section): Add new bool* parameter to
11326 place_orphan_here. Add get_output_section.
11327 (Orphan_output_section::place_orphan_here): Add is_relro
11328 parameter.
11329 (Script_sections::Script_sections): Initialize
11330 data_segment_align_index_ and saw_relro_end_.
11331 (Script_sections::data_segment_align): New function.
11332 (Script_sections::data_segment_relro_end): New function.
11333 (Script_sections::place_orphan): Set or clear is_relro.
11334 (Script_sections::set_section_addresses): Force alignment of first
11335 TLS section.
11336 * yyscript.y (exp): Call script_data_segment_align and
11337 script_data_segment_relro_end.
11338 * testsuite/relro_script_test.t: New file.
11339 * testsuite/relro_test.cc (using_script): Declare.
11340 (t1, t2): Test using_script.
11341 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11342 (relro_script_test_SOURCES): Define.
11343 (relro_script_test_DEPENDENCIES): Define.
11344 (relro_script_test_LDFLAGS): Define.
11345 (relro_script_test_LDADD): Define.
11346 (relro_script_test.so): New target.
11347 * testsuite/Makefile.in: Rebuild.
11348
11349 2008-08-06 Cary Coutant <ccoutant@google.com>
11350
11351 * archive.cc (Archive::total_archives, Archive::total_members)
11352 (Archive::total_members_loaded): New variables.
11353 (Archive::setup): Add parameter. Add option to preread
11354 archive symbols.
11355 (Archive::read_armap): Add counter.
11356 (Archive::get_file_and_offset): New function.
11357 (Archive::get_elf_object_for_member): New function.
11358 (Archive::read_all_symbols): New function.
11359 (Archive::read_symbols): New function.
11360 (Archive::add_symbols): Add counters.
11361 (Archive::include_all_members): Use armap to find members if it's
11362 already built.
11363 (Archive::include_member): Skip reading symbols if already read.
11364 Factored code into Archive::get_file_and_offset and
11365 Archive::get_elf_object_for_member. Changed call to
11366 Mapfile::report_include_archive_member.
11367 (Archive::print_stats): New function.
11368 * archive.h: Declare Object and Read_symbols_data classes.
11369 (Archive::Archive): Add initializers for new members.
11370 (Archive::setup): Add parameter.
11371 (Archive::print_stats): New function.
11372 (Archive::total_archives, Archive::total_members)
11373 (Archive::total_members_loaded): New variables.
11374 (Archive::get_file_and_offset): New function.
11375 (Archive::get_elf_object_for_member): New function.
11376 (Archive::read_all_symbols): New function.
11377 (Archive::read_symbols): New function.
11378 (Archive::Archive_member): New class.
11379 (Archive::members_): New member.
11380 (Archive::num_members_): New member.
11381 * main.cc: Include archive.h.
11382 (main): Call Archive::print_stats.
11383 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11384 archive parameter; member_name is now the fully-decorated name.
11385 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11386 * options.h: (General_options): Add --preread-archive-symbols option.
11387 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11388 Archive::setup.
11389
11390 2008-08-04 Ian Lance Taylor <iant@google.com>
11391
11392 * symtab.h (Symbol::use_plt_offset): New function.
11393 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11394 * powerpc.cc (Relocate::relocate): Likewise.
11395 * sparc.cc (Relocate::relocate): Likewise.
11396 * x86_64.cc (Relocate::relocate): Likewise.
11397 * testsuite/weak_plt.sh: New test.
11398 * testsuite/weak_plt_main.cc: New test.
11399 * testsuite/weak_plt_shared.cc: New test.
11400 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11401 (check_PROGRAMS): Add weak_plt.
11402 (check_DATA): Add weak_plt_shared.so.
11403 (weak_plt_main_pic.o, weak_plt): New targets.
11404 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11405 * testsuite/Makefile.in: Rebuild.
11406
11407 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11408 gcctestdir/ld.
11409 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11410 * testsuite/Makefile.in: Rebuild.
11411
11412 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11413
11414 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11415 * Makefile.in: Regenerate.
11416 * po/POTFILES.in: Regenerate.
11417
11418 2008-07-29 Ian Lance Taylor <iant@google.com>
11419
11420 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11421 symbols before other symbols.
11422 * testsuite/script_test_2.cc (test_addr): Declare.
11423 (test_addr_alias): Declare.
11424 (main): Check that test_addr and test_addr_alias have the right
11425 values.
11426 * testsuite/script_test_2.t: Define test_addr_alias and
11427 test_addr.
11428
11429 2008-07-24 Ian Lance Taylor <iant@google.com>
11430
11431 PR 5990
11432 * descriptors.cc: New file.
11433 * descriptors.h: New file.
11434 * gold-threads.h (class Hold_optional_lock): New class.
11435 * fileread.cc: Include "descriptors.h".
11436 (File_read::~File_read): Release descriptor rather than closing
11437 it.
11438 (File_read::open) [file]: Call open_descriptor rather than open.
11439 Set is_descriptor_opened_.
11440 (File_read::open) [memory]: Assert that descriptor is not open.
11441 (File_read::reopen_descriptor): New function.
11442 (File_read::release): Release descriptor.
11443 (File_read::do_read): Make non-const. Reopen descriptor.
11444 (File_read::read): Make non-const.
11445 (File_read::make_view): Reopen descriptor.
11446 (File_read::do_readv): Likewise.
11447 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11448 Update declarations.
11449 * layout.cc: Include "descriptors.h".
11450 (Layout::create_build_id): Use open_descriptor rather than open.
11451 * output.cc: Include "descriptors.h".
11452 (Output_file::open): Use open_descriptor rather than open.
11453 * archive.cc (Archive::const_iterator): Change Archive to be
11454 non-const.
11455 (Archive::begin, Archive::end): Make non-const.
11456 (Archive::count_members): Likewise.
11457 * archive.h (class Archive): Update declarations.
11458 * object.h (Object::read): Make non-const.
11459 * Makefile.am (CCFILES): Add descriptors.cc.
11460 (HFILES): Add descriptors.h.
11461 * Makefile.in: Rebuild.
11462
11463 PR 6716
11464 * gold.h: Always include <clocale>. Add Solaris workarounds
11465 following code in binutils/sysdep.h.
11466
11467 PR 6048
11468 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11469 this->eh_frame_hdr_ is NULL before using it.
11470
11471 * dynobj.cc (Versions::Versions): Update comment.
11472
11473 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11474 the base version name.
11475
11476 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11477 array size plus one.
11478 (Stringpool_template::set_string_offsets): Subtract one from key
11479 before using it as an array index.
11480 (Stringpool_template::get_offset_with_length): Likewise.
11481 (Stringpool_template::write_to_buffer): Likewise.
11482 * stringpool.h (Stringpool_template::get_offset_from_key):
11483 Likewise.
11484
11485 2008-07-23 Ian Lance Taylor <iant@google.com>
11486
11487 PR 6658
11488 * object.h (Merged_symbol_value::value): Do our best to handle a
11489 negative addend.
11490
11491 PR 6647
11492 * script.cc (Version_script_info::get_versions): Don't add empty
11493 version tag to return value.
11494 (Version_script_info::get_symbol_version_helper): Change return
11495 type to bool. Add pversion parameter. Change all callers.
11496 (script_register_vers_node): Don't require a non-NULL tag.
11497 * script.h (class Version_script_info): Update declarations.
11498 (Version_script_info::get_symbol_version): Change return type to
11499 bool. Add version parameter. Change all callers.
11500 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11501 handling. Handle an empty version from a version script.
11502 (Symbol_table::define_special_symbol): Likewise.
11503 * testsuite/ver_test_10.script: New file.
11504 * testsuite/ver_test_10.sh: New file.
11505 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11506 (check_DATA): Add ver_test_10.syms.
11507 (ver_test_10.syms, ver_test_10.so): New target.
11508 * testsuite/Makefile.in: Rebuild.
11509
11510 2008-07-23 Simon Baldwin <simonb@google.com>
11511
11512 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11513 to zero for undefined symbols from dynamic libraries.
11514
11515 2008-07-23 Ian Lance Taylor <iant@google.com>
11516
11517 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11518 Change all callers.
11519 * symtab.h (class Symbol_table): Update declaration.
11520 * testsuite/ver_test_9.cc: New file.
11521 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11522 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11523 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11524 (ver_test_9.so, ver_test_9.o): New targets.
11525 * testsuite/Makefile.in: Rebuild.
11526
11527 2008-07-22 Ian Lance Taylor <iant@google.com>
11528
11529 * options.h (class General_options): Define --check-sections.
11530 * layout.cc (Layout::set_segment_offsets): Handle
11531 --check-sections.
11532
11533 * options.h (class General_options): Define -n/--nmagic and
11534 -N/--omagic.
11535 * options.cc (General_options::finalize): For -n/--nmagic or
11536 -N/--omagic, set -static.
11537 * layout.cc (Layout::attach_allocated_section_to_segment): If
11538 -N/--omagic, don't put read-only and read-write sections in
11539 different segments.
11540 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11541 finding a read-only segment.
11542 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11543 don't set the minimum segment alignment to the common page size,
11544 and don't set the file offset to the address modulo the page size.
11545 * script-sections.cc (Script_sections::create_segments): If
11546 -n/--omagic, don't put read-only and read-write sections in
11547 different segments.
11548
11549 * cref.cc: New file.
11550 * cref.h: New file.
11551 * options.h (class General_options): Add --print-symbol-counts.
11552 * main.cc (main): Issue defined symbol report if requested.
11553 * archive.cc (Archive::interpret_header): Make into a const member
11554 function.
11555 (Archive::add_symbols): Call Input_objects::archive_start and
11556 archive_stop.
11557 (Archive::const_iterator): Define new class.
11558 (Archive::begin, Archive::end): New functions.
11559 (Archive::include_all_members): Rewrite to use iterator.
11560 (Archive::count_members): New function.
11561 * archive.h (class Archive): Update declarations.
11562 (Archive::filename): New function.
11563 * object.cc: Include "cref.h".
11564 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11565 (Sized_relobj::do_get_global_symbol_counts): New function.
11566 (Input_objects::add_object): Add object to cross-referencer.
11567 (Input_objects::archive_start): New function.
11568 (Input_objects::archive_stop): New function.
11569 (Input_objects::print_symbol_counts): New function.
11570 * object.h: Declare Cref and Archive.
11571 (Object::get_global_symbol_counts): New function.
11572 (Object::do_get_global_symbol_counts): New pure virtual function.
11573 (class Sized_relobj): Add defined_count_ field. Update
11574 declarations.
11575 (class Input_objects): Add cref_ field. Update constructor.
11576 Update declarations.
11577 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11578 defined_count_.
11579 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11580 symbol counts.
11581 (Sized_dynobj::do_get_global_symbol_counts): New function.
11582 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11583 defined_count_. Update declarations. Define Symbols typedef.
11584 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11585 parameter. Change all callers.
11586 (Symbol_table::add_from_dynobj): Add sympointers and defined
11587 parameters. Change all callers.
11588 * symtab.h (class Symbol_table): Update declarations.
11589 * Makefile.am (CCFILES): Add cref.cc.
11590 (HFILES): Add cref.h.
11591 * Makefile.in: Rebuild.
11592
11593 2008-07-22 Simon Baldwin <simonb@google.com>
11594
11595 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11596 to zero when writing undefined symbols.
11597
11598 2008-07-22 Ian Lance Taylor <iant@google.com>
11599
11600 * output.cc (Output_section::add_input_section): Don't try to
11601 merge empty merge sections.
11602
11603 2008-07-21 Craig Silverstein <csilvers@google.com>
11604
11605 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11606 Include symbol version in error message.
11607
11608 2008-07-20 Chris Demetriou <cgd@google.com>
11609
11610 * configure.ac (gold_cv_c_random_seed): New configured variable.
11611 (RANDOM_SEED_CFLAGS): New substituted variable.
11612 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11613 * configure: Rebuild.
11614 * Makefile.in: Likewise.
11615 * testsuite/Makefile.in: Likewise.
11616
11617 2008-07-18 Ian Lance Taylor <iant@google.com>
11618
11619 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11620 where we see NAME/NULL and NAME/VERSION as separate symbols.
11621 * testsuite/ver_test_main.cc (main): Call t4.
11622 (t4, t4_2a): Define.
11623 * testsuite/ver_test_2.cc (t4_2): Define.
11624 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11625 * testsuite/ver_test_4.cc (t4_2a): Define.
11626 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11627 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11628
11629 2008-07-17 Ian Lance Taylor <iant@google.com>
11630
11631 * dynobj.cc (Versions::add_def): If we give an error about a
11632 missing version, go ahead and create the version anyhow.
11633
11634 2008-07-10 Ian Lance Taylor <iant@google.com>
11635
11636 Handle output sections with more than 0x7fffffff bytes.
11637 * object.h (class Relobj): Change map_to_output_ to
11638 output_sections_, and just keep a section pointer. Change all
11639 uses. Move comdat group support to Sized_relobj.
11640 (Relobj::is_section_specially_mapped): Remove.
11641 (Relobj::output_section): Remove poff parameter. Change all
11642 callers.
11643 (Relobj::output_section_offset): New function.
11644 (Relobj::set_section_offset): Rewrite.
11645 (Relobj::map_to_output): Remove.
11646 (Relobj::output_sections): New function.
11647 (Relobj::do_output_section_offset): New pure virtual function.
11648 (Relobj::do_set_section_offset): Likewise.
11649 (class Sized_relobj): Add section_offsets_ field. Add comdat
11650 group support from Relobj. Update declarations.
11651 (Sized_relobj::get_output_section_offset): New function.
11652 (Sized_relobj::do_output_section_offset): New function.
11653 (Sized_relobj::do_set_section_offset): New function.
11654 * object.cc (Relobj::output_section_address): Remove.
11655 (Sized_relobj::Sized_relobj): Initialize new fields.
11656 (Sized_relobj::include_section_group): Cast find_kept_object to
11657 Sized_relobj.
11658 (Sized_relobj::include_linkonce_section): Likewise.
11659 (Sized_relobj::do_layout): Use separate arrays for output section
11660 and output offset.
11661 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11662 output_sections.
11663 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11664 output_sections and section_offsets.
11665 (Sized_relobj::write_local_symbols): Likewise.
11666 (map_to_kept_section): Compute output address directly.
11667 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11668 output_sections and section_offsets.
11669 (Sized_relobj::write_sections): Likewise.
11670 (Sized_relobj::relocate_sections): Likewise.
11671 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11672 * output.h (class Output_reloc): Update declarations. Change
11673 u2_.relobj to Sized_relobj*.
11674 (class Output_data_reloc): Change add functions to use
11675 Sized_relobj*.
11676 * output.cc (Output_reloc::Output_reloc): Change relobj to
11677 Sized_relobj*.
11678 (Output_reloc::local_section_offset): Change return type to
11679 Elf_Addr. Use get_output_section_offset.
11680 (Output_reloc::get_address): Likewise.
11681 (Output_section::is_input_address_mapped): Don't call
11682 is_section_specially_mapped.
11683 (Output_section::output_offset): Likewise.
11684 (Output_section::output_address): Likewise.
11685 (Output_section::starting_output_address): Likewise.
11686 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11687 parameter to Sized_relobj*.
11688 (Copy_relocs::need_copy_reloc): Likewise.
11689 (Copy_relocs::save): Likewise.
11690 * copy-relocs.h (class Copy_relocs): Update declarations.
11691 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11692 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11693 * target-reloc.h (relocate_for_relocatable): Change
11694 offset_in_output_section type to Elf_Addr. Change code that uses
11695 it as well.
11696 * layout.cc (Layout::layout): Always set *off.
11697 * mapfile.cc (Mapfile::print_input_section): Use
11698 output_section_offset.
11699 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11700 Sized_relobj*.
11701 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11702 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11703 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11704
11705 2008-07-03 Ian Lance Taylor <iant@google.com>
11706
11707 * layout.cc (Layout::include_section): Do not discard unrecognized
11708 SHT_STRTAB sections.
11709
11710 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11711
11712 * script.cc (Lex::can_continue_name): Make '?' allowable in
11713 version-script names.
11714 * testsuite/version_script.map: Change glob pattern to use '?'
11715
11716 2008-06-30 Manish Singh <yosh@gimp.org>
11717
11718 PR 6585
11719 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11720 Correct typo.
11721
11722 2008-06-30 Ian Lance Taylor <iant@google.com>
11723
11724 PR 6660
11725 PR 6682
11726 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11727 versions]: Don't try to read the value in the contents, since we
11728 don't use it. Use the template endianness when writing.
11729
11730 2008-06-25 Cary Coutant <ccoutant@google.com>
11731
11732 * fileread.cc (File_read::make_view): Assert on zero-length view.
11733 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11734 symbol table when there are no symbols to read.
11735
11736 2008-06-23 Craig Silverstein <csilvers@google.com>
11737
11738 * version.cc (version_string): Bump to 1.7
11739
11740 2008-06-18 Craig Silverstein <csilvers@google.com>
11741
11742 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11743 constant 0xFFFF to type Valtype.
11744 (Powerpc_relocate_functions::rel16_ha): Likewise.
11745
11746 2008-06-17 Ian Lance Taylor <iant@google.com>
11747
11748 * output.h (Output_section::Input_section): Initialize p2align_ to
11749 zero for Output_section_data constructors.
11750 (Output_section::Input_section::addralign): If not an input
11751 section, return the alignment of the Output_section_data.
11752 * testsuite/copy_test.cc: New file.
11753 * testsuite/copy_test_1.cc: New file.
11754 * testsuite/copy_test_2.cc: New file.
11755 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11756 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11757 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11758 (copy_test_1_pic.o, copy_test_1.so): New targets.
11759 (copy_test_2_pic.o, copy_test_2.so): New targets.
11760 * testsuite/Makefile.in: Rebuild.
11761
11762 * script-sections.cc (Script_sections::place_orphan): Initialize
11763 local variable exact.
11764
11765 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11766
11767 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11768
11769 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11770 David S. Miller <davem@davemloft.net>
11771
11772 * powerpc.cc: New file.
11773 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11774 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11775 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11776 * Makefile.in: Rebuild.
11777
11778 2008-06-09 Ian Lance Taylor <iant@google.com>
11779
11780 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11781 <exception>.
11782 (throwing, orig_terminate): New static variables.
11783 (terminate_handler): New static function.
11784 (t2): Set terminate handler.
11785
11786 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11787
11788 PR 6584
11789 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11790 alignment.
11791
11792 2008-05-30 Cary Coutant <ccoutant@google.com>
11793
11794 * archive.cc (Archive::include_all_members) Correct to step
11795 over symbol table and extended name table in thin archives.
11796
11797 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11798
11799 PR 6407
11800 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11801 calculation.
11802
11803 2008-05-28 Caleb Howe <cshowe@google.com>
11804
11805 * reduced_debug_output.cc: New file.
11806 * reduced_debug_output.h: New file.
11807 * options.h (class General_options): Add --strip-debug-non-line.
11808 * options.cc (General_options::finalize): Add strip_debug_non_line
11809 to the strip heirarchy.
11810 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11811 fields.
11812 * layout.cc: Include "reduced_debug_output.h".
11813 (Layout::Layout): Initialize new fields.
11814 (line_only_debug_sections): New static array.
11815 (is_lines_only_debug_sections): New static inline function.
11816 (Layout::include_section): Handle --strip-debug-non-line.
11817 (Layout::make_output_section): If --strip-debug-non-line, build
11818 new output sections for .debug_abbrev and .debug_info.
11819 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11820 gold. Warn about possible overflow.
11821 (read_signed_LEB_128): Likewise.
11822 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11823 (read_signed_LEB_128): Declare.
11824 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11825 (HFILES): Add reduced_debug_output.h.
11826 * Makefile.in: Rebuild.
11827
11828 2008-05-21 Ian Lance Taylor <iant@google.com>
11829
11830 * mapfile.cc: New file.
11831 * mapfile.h: New file.
11832 * options.h (class General_options): Add -M/--print-map and -Map.
11833 * options.cc (General_options::finalize): Make -M equivalent to
11834 -Map -.
11835 * main.cc: Include <cstdio> and "mapfile.h".
11836 (main): Open mapfile if requested.
11837 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11838 constructor. Change caller.
11839 (queue_initial_tasks): Add mapfile parameter. Change caller.
11840 (queue_middle_tasks): Likewise.
11841 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11842 declarations.
11843 * archive.cc: Include "mapfile.h".
11844 (Archive::add_symbols): Add mapfile parameter. Change all
11845 callers. Pass mapfile, symbol, and reason to include_member.
11846 (Archive::include_all_members): Add mapfile parameter. Change all
11847 callers.
11848 (Archive::include_member): Add mapfile, sym, and why parameters.
11849 Change all callers. Report inclusion to map file.
11850 * archive.h: Include "fileread.h".
11851 (class Archive): Update declarations.
11852 (Archive::file): New const method.
11853 (class Add_archive_symbols): Add mapfile_ field. Update
11854 constructor. Change all callers.
11855 * readsyms.h (class Read_symbols): Likewise.
11856 (class Finish_group): Likewise.
11857 (class Read_script): Likewise.
11858 * common.cc: Include "mapfile.h".
11859 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11860 all callers.
11861 (Symbol_table::do_allocate_commons): Likewise.
11862 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11863 symbol allocation to mapfile.
11864 * common.h (class Allocate_commons_task): Add mapfile_ field.
11865 Update constructor. Change all callers.
11866 * symtab.h (class Symbol_table): Update declarations.
11867 * layout.cc: Include "mapfile.h".
11868 (Layout_task_runner::run): Print information to mapfile.
11869 (Layout::create_gold_note): Change Output_data_fixed_space to
11870 Output_data_zero_fill.
11871 (Layout::create_build_id): Likewise.
11872 (Layout::print_to_mapfile): New function.
11873 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11874 constructor. Change caller.
11875 (class Layout): Declare print_to_mapfile.
11876 * output.cc (Output_section::Input_section::print_to_mapfile): New
11877 function.
11878 (Output_section::add_input_section): If producing a map, always
11879 add to input_sections_ list.
11880 (Output_section::do_print_to_mapfile): New function.
11881 (Output_segment::print_sections_to_mapfile): New function.
11882 (Output_segment::print_section_list_to_mapfile): New function.
11883 * output.h: Include "mapfile.h".
11884 (Output_data::print_to_mapfile): New function.
11885 (Output_data::do_print_to_mapfile): New virtual function.
11886 (Output_segment_headers::do_print_to_mapfile): New function.
11887 (Output_file_header::do_print_to_mapfile): New function.
11888 (Output_data_const::do_print_to_mapfile): New function.
11889 (class Output_data_const_buffer): Add map_name_ field. Update
11890 constructor. Change all callers. Add do_print_to_mapfile
11891 function.
11892 (class Output_data_fixed_space): Likewise.
11893 (class Output_data_space): Likewise.
11894 (class Output_data_zero_fill): New class.
11895 (Output_data_strtab::do_print_to_mapfile): New function.
11896 (Output_data_reloc_base::do_print_to_mapfile): New function.
11897 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11898 (Output_data_group::do_print_to_mapfile): New function.
11899 (Output_data_got::do_print_to_mapfile): New function.
11900 (Output_data_dynamic::do_print_to_mapfile): New function.
11901 (Output_symtab_xindex::do_print_to_mapfile): New function.
11902 (class Output_section): Declare do_print_to_mapflie. Declare
11903 print_to_mapfile in Input_section.
11904 (class Output_segment): Declare new functions.
11905 * object.h (Sized_relobj::symbol_count): New function.
11906 * script-sections.cc
11907 (Output_section_element_dot_assignment::set_section_addresses):
11908 Change Output_data_fixed_space to Output_data_zero_fill.
11909 (Output_data_expression::do_print_to_mapfile): New function.
11910 * script.cc (read_input_script): Add mapfile parameter. Change
11911 all callers.
11912 * script.h (read_input_script): Update declaration.
11913 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11914 (Eh_frame::do_print_to_mapfile): New function.
11915 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11916 (Output_merge_string::do_print_to_mapfile): New function.
11917 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11918 function.
11919 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11920 function.
11921 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11922 function.
11923 * Makefile.am (CCFILES): Add mapfile.cc.
11924 (HFILES): Add mapfile.h.
11925 * Makefile.in: Rebuild.
11926
11927 2008-05-19 Ian Lance Taylor <iant@google.com>
11928
11929 * options.h (class General_options): Add -z relro.
11930 * layout.cc (Layout::Layout): Initialize relro_segment_.
11931 (Layout::add_output_section_data): Return the output section.
11932 (Layout::make_output_section): Rcognize relro sections and mark
11933 them appropriately.
11934 (Layout::attach_allocated_section_to_segment): Put relro sections
11935 in a PT_GNU_RELRO segment.
11936 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11937 section as relro.
11938 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11939 PT_TLS segments.
11940 (Layout::linkonce_mapping): Map d.rel.ro.local to
11941 .data.rel.ro.local.
11942 (Layout::output_section_name): Us .data.rel.ro.local for any
11943 section which begins with that.
11944 * layout.h (class Layout): Update add_output_section_data
11945 declaration. Add relro_segment_ field.
11946 * output.cc (Output_section::Output_section): Initialize is_relro_
11947 and is_relro_local_ fields.
11948 (Output_segment::add_output_section): Group relro sections.
11949 (Output_segment::is_first_section_relro): New function.
11950 (Output_segment::maximum_alignment): If there is a relro section,
11951 align the segment to the common page size.
11952 (Output_segment::set_section_addresses): Track whether we are
11953 looking at relro sections. If the last section is a relro
11954 section, align to the common page size.
11955 (Output_segment::set_section_list_addresses): Add in_relro
11956 parameter. Change all callers. Align to the page size when
11957 moving from relro to non-relro section.
11958 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11959 segment.
11960 * output.h (class Output_section): Add is_relro_ and
11961 is_relro_local_ fields.
11962 (Output_section::is_relro): New function.
11963 (Output_section::set_is_relro): New function.
11964 (Output_section::is_relro_local): New function.
11965 (Output_section::set_is_relro_local): New function.
11966 (class Output_segment): Update declarations.
11967 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11968 * sparc.cc (Target_sparc::got_section): Likewise.
11969 * x86_64.cc (Target_x86_64::got_section): Likewise.
11970 * testsuite/relro_test_main.cc: New file.
11971 * testsuite/relro_test.cc: New file.
11972 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11973 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11974 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11975 (relro_test.so, relro_test_pic.o): New targets.
11976 * testsuite/Makefile.in: Rebuild.
11977
11978 2008-05-16 Ian Lance Taylor <iant@google.com>
11979
11980 * output.cc (Output_segment::add_output_section): Remove front
11981 parameter.
11982 * output.h (class Output_segment): Remove
11983 add_initial_output_section and overloaded add_output_section.
11984 Update declaration of remaining add_output_section.
11985 * layout.cc (Layout::create_interp): Call add_output_section
11986 rather than add_initial_output_section.
11987 (Layout::finish_dynamic_section): Likewise.
11988
11989 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11990 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11991 know the dynamic type.
11992 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11993 field. Initialize it in constructor.
11994 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11995 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11996 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11997 reloc.
11998
11999 * output.cc (Output_reloc::get_address): Change return type to
12000 Elf_Addr.
12001 * output.h (class Output_reloc): Update get_address declaration.
12002 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12003 for section addresses.
12004
12005 2008-05-09 Ian Lance Taylor <iant@google.com>
12006
12007 PR 6493
12008 * gold.cc (gold_nomem): Use return value of write.
12009
12010 2008-05-08 Ian Lance Taylor <iant@google.com>
12011
12012 * symtab.c (Symbol::init_base_output_data): Add version
12013 parameter. Change all callers.
12014 (Symbol::init_base_output_segment): Likewise.
12015 (Symbol::init_base_constant): Likewise.
12016 (Symbol::init_base_undefined): Likewise.
12017 (Sized_symbol::init_output_data): Likewise.
12018 (Sized_symbol::init_output_segment): Likewise.
12019 (Sized_symbol::init_constant): Likewise.
12020 (Sized_symbol::init_undefined): Likewise.
12021 (Symbol_table::do_define_in_output_data): If the new symbol has a
12022 version, mark it as the default.
12023 (Symbol_table::do_define_in_output_segment): Likewise.
12024 (Symbol_table::do_define_as_constant): Likewise.
12025 * symtab.h (class Symbol): Update declarations.
12026 (class Sized_symbol): Likewise.
12027 * resolve.cc (Symbol::override_version): New function.
12028 (Symbol::override_base): Call override_version.
12029 (Symbol::override_base_with_special): Likewise.
12030 * testsuite/ver_script_8.script: New file.
12031 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12032 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12033 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12034 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12035
12036 2008-05-06 Ian Lance Taylor <iant@google.com>
12037
12038 PR 6049
12039 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12040 functions.
12041 (class General_options): Remove existing --undefined, and add
12042 --no-undefined instead. Add new --undefined as synonym for -u.
12043 * archive.cc (Archive::add_symbols): Check whether symbol was
12044 named with -u.
12045 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12046 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12047 all uses. Add IS_UNDEFINED. Update declarations to split
12048 different versions of init_base. Declare init_base_undefined.
12049 (Symbol::is_defined): Handle IS_UNDEFINED.
12050 (Symbol::is_undefined): Likewise.
12051 (Symbol::is_weak_undefined): Call is_undefined.
12052 (Symbol::is_absolute): Handle IS_CONSTANT.
12053 (class Sized_symbol): Update declarations to split different
12054 versions of init. Declare init_undefined.
12055 (class Symbol_table): Declare new functions.
12056 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12057 Change all callers.
12058 (Symbol::init_base_output_data): Likewise.
12059 (Symbol::init_base_output_segment): Likewise.
12060 (Symbol::init_base_constant): Likewise.
12061 (Symbol::init_base_undefined): New function.
12062 (Sized_symbol::init_object): Rename from init. Change all
12063 callers.
12064 (Sized_symbol::init_output_data): Likewise.
12065 (Sized_symbol::init_output_segment): Likewise.
12066 (Sized_symbol::init_constant): Likewise.
12067 (Sized_symbol::init_undefined): New function.
12068 (Symbol_table::add_undefined_symbols_from_command_line): New
12069 function.
12070 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12071 function.
12072 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12073 (Symbol::output_section): Likewise.
12074 (Symbol::set_output_section): Likewise.
12075 (Symbol_table::sized_finalize_symbol): Likewise.
12076 (Symbol_table::sized_write_globals): Likewise.
12077 * resolve.cc (Symbol_table::should_override): Likewise.
12078 (Symbol::override_base_with_special): Likewise.
12079
12080 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12081 symbol, change it to have default visibility.
12082 * testsuite/protected_1.cc: New file.
12083 * testsuite/protected_2.cc: New file.
12084 * testsuite/protected_3.cc: New file.
12085 * testsuite/protected_main_1.cc: New file.
12086 * testsuite/protected_main_2.cc: New file.
12087 * testsuite/protected_main_3.cc: New file.
12088 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12089 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12090 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12091 (protected_1.so): New target.
12092 (protected_1_pic.o, protected_2_pic.o): New targets.
12093 (protected_3_pic.o): New target.
12094 (check_PROGRAMS): Add protected_2.
12095 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12096 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12097 * testsuite/Makefile.in: Rebuild.
12098
12099 * options.h (DEFINE_var): Add set_user_set_##varname__.
12100 (DEFINE_bool_alias): New macro.
12101 (class General_options): Define -Bstatic using DEFINE_bool_alias
12102 rather than DEFINE_special. Add --undefined as an alias for -z
12103 defs.
12104 * options.cc (General_options::parse_Bstatic): Remove.
12105
12106 * options.h (class General_options): Add --fatal-warnings.
12107 * main.cc (main): Implement --fatal-warnings.
12108 * errors.h (Errors::warning_count): New function.
12109
12110 * options.h (class General_options): Add -Bsymbolic-functions.
12111 * symtab.h (Symbol::is_preemptible): Check for
12112 -Bsymbolic-functions.
12113
12114 2008-05-05 Ian Lance Taylor <iant@google.com>
12115
12116 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12117 as noVARNAME rather than no-VARNAME.
12118 (class General_options): Add option -z combreloc.
12119 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12120 get_address.
12121 (Output_reloc::sort_before) [SHT_REL]: New function.
12122 (Output_reloc::sort_before) [SHT_RELA]: New function.
12123 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12124 Sort_relocs_comparison.
12125 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12126 parameter. Change all callers.
12127 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12128 sort_relocs parameter. Change all callers.
12129 * output.cc (Output_reloc::get_address): New function, broken out
12130 of write_rel.
12131 (Output_reloc::write_rel): Call it.
12132 (Output_reloc::compare): New function.
12133 (Output_data_reloc_base::do_write): Optionally sort relocs.
12134
12135 * configure.ac: If targ_extra_obj is set, link it in.
12136 * configure.tgt: Initialize all variables.
12137 (x86_64*): Set targ_extra_obj and targ_extra_size.
12138 * configure: Rebuild.
12139
12140 * object.cc (Sized_relobj::include_section_group): Adjust section
12141 indexes read from group data. Build vector to pass to
12142 layout_group.
12143 * layout.cc (Layout::layout_group): Add flags and shndxes
12144 parameters. Remove contents parameter. Change caller. Update
12145 explicit instantiations.
12146 * layout.h (class Layout): Update layout_group declaration.
12147 * output.cc (Output_data_group::Output_data_group): Add flags and
12148 input_shndxes parameters. Remove contents parameter. Change
12149 caller.
12150 (Output_data_group::do_write): Change input_sections_ to
12151 input_shndxes_.
12152 * output.h (class Output_data_group): Update constructor
12153 declaration. Rename input_sections_ to input_shndxes_.
12154 * testsuite/many_sections_test.cc: Add template.
12155
12156 2008-04-30 Cary Coutant <ccoutant@google.com>
12157
12158 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12159
12160 * layout.cc (Layout::include_section): Refactored check for debug
12161 info section.
12162 (Layout::add_comdat): Add new parameters. Change type
12163 of signature parameter. Add object and shndx to signatures table.
12164 (Layout::find_kept_object): New function.
12165 * layout.h: Include <cstring>.
12166 (Layout::is_debug_info_section): New function.
12167 (Layout::add_comdat): Add new parameters.
12168 (Layout::find_kept_object): New function.
12169 (Layout::Kept_section): New struct.
12170 (Layout::Signatures): Change type of map range.
12171 * object.cc (Relobj::output_section_address): New function.
12172 (Sized_relobj::include_section_group): Add new parameters. Change
12173 calls to Layout::add_comdat. Change to build table of kept comdat
12174 groups and table mapping discarded sections to kept sections.
12175 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12176 (Sized_relobj::do_layout): Change calls to include_section_group and
12177 include_linkonce_section.
12178 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12179 value to zero when section is discarded.
12180 (Sized_relobj::map_to_kept_section): New function.
12181 * object.h (Relobj::output_section_address): New function.
12182 (Relobj::Comdat_group): New type.
12183 (Relobj::find_comdat_group): New function.
12184 (Relobj::Comdat_group_table): New type.
12185 (Relobj::Kept_comdat_section): New type.
12186 (Relobj::Kept_comdat_section_table): New type.
12187 (Relobj::add_comdat_group): New function.
12188 (Relobj::set_kept_comdat_section): New function.
12189 (Relobj::get_kept_comdat_section): New function.
12190 (Relobj::comdat_groups_): New field.
12191 (Relobj::kept_comdat_sections_): New field.
12192 (Symbol_value::input_value): Update comment.
12193 (Sized_relobj::map_to_kept_section) New function.
12194 (Sized_relobj::include_linkonce_section): Add new parameter.
12195 * target-reloc.h (Comdat_behavior): New type.
12196 (get_comdat_behavior): New function.
12197 (relocate_section): Add code to map a discarded section to the
12198 corresponding kept section when applying a relocation.
12199
12200 2008-04-30 Craig Silverstein <csilvers@google.com>
12201
12202 * dwarf_reader.cc (next_generation_count): New static var.
12203 (Addr2line_cache_entry): New struct.
12204 (addr2line_cache): New static var.
12205 (Dwarf_line_info::one_addr2line): Added caching.
12206 (Dwarf_line_info::clear_addr2line_cache): New function.
12207 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12208 cache-size parameter.
12209 (Dwarf_line_info::one_addr2line_cache): New function.
12210 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12211 new cache-size argument to one_addr2line(), and clear cache.
12212
12213 2008-04-28 Cary Coutant <ccoutant@google.com>
12214
12215 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12216 R_386_PC8 relocations.
12217
12218 2008-04-23 Ian Lance Taylor <iant@google.com>
12219
12220 * object.cc (Sized_relobj::include_section_group): Check for
12221 invalid section group.
12222
12223 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12224 header size.
12225
12226 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12227 than read for file header.
12228 * archive.cc (Archive::include_member): Likewise.
12229
12230 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12231
12232 * aclocal.m4: Regenerate.
12233 * configure: Regenerate.
12234
12235 2008-04-19 Ian Lance Taylor <iant@google.com>
12236
12237 * version.cc (version_string): Bump to 1.6.
12238
12239 * testsuite/Makefile.am (many_sections_r_test): New target.
12240 (many_sections_r_test_SOURCES): Remove.
12241 (many_sections_r_test_DEPENDENCIES): Remove.
12242 (many_sections_r_test_LDFLAGS): Remove.
12243 (many_sections_r_test_LDADD): Remove.
12244
12245 * object.cc (Sized_relobj::do_add_symbols): Always pass
12246 local_symbol_count_ to add_from_relobj.
12247
12248 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12249 every thousand variables.
12250 * testsuite/Makefile.in: Rebuild.
12251
12252 * object.cc (Xindex::initialize_symtab_xindex): New function.
12253 (Xindex::read_symtab_xindex): New function.
12254 (Xindex::sym_xindex_to_shndx): New function.
12255 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12256 available.
12257 (Sized_relobj::do_initialize_xindex): New function.
12258 (Sized_relobj::do_read_symbols): Adjust section links.
12259 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12260 parameter. Change all callers.
12261 (Sized_relobj::include_section_group): Adjust section links and
12262 symbol section indexes.
12263 (Sized_relobj::do_layout): Adjust section links.
12264 (Sized_relobj::do_count_local_symbols): Adjust section links and
12265 symbol section indexes.
12266 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12267 ordinary and special symbols.
12268 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12269 dynsym_xindex parameters. Change all callers. Adjust section
12270 links. Use SHN_XINDEX when needed.
12271 (Sized_relobj::get_symbol_location_info): Adjust section links.
12272 Don't get fooled by special symbols.
12273 * object.h (class Xindex): Define.
12274 (class Object): Add xindex_ parameter. Declare virtual functoin
12275 do_initialize_xindex.
12276 (Object::adjust_sym_shndx): New function.
12277 (Object::set_xindex): New protected function.
12278 (class Symbol_value): Add is_ordinary_shndx_ field.
12279 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12280 (Symbol_value::value): Assert ordinary section.
12281 (Symbol_value::initialize_input_to_output_map): Likewise.
12282 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12283 Change all callers.
12284 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12285 all callers.
12286 (class Sized_relobj): Update declarations.
12287 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12288 parameter. Change all callers.
12289 (Sized_relobj::adjust_shndx): New function.
12290 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12291 field.
12292 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12293 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12294 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12295 (Sized_dynobj::read_dynsym_section): Adjust section links.
12296 (Sized_dynobj::read_dynamic): Likewise.
12297 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12298 section links.
12299 (Sized_dynobj::do_initialize_xindex): New function.
12300 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12301 do_initialize_xindex.
12302 (Sized_dynobj::adjust_shndx): New function.
12303 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12304 dynsym_xindex_ fields.
12305 (Layout::finalize): Add a call to set_section_indexes before
12306 creating the symtab sections.
12307 (Layout::set_section_indexes): Don't do anything if the section
12308 already has a section index.
12309 (Layout::create_symtab_sections): Add shnum parameter. Change
12310 caller. Create .symtab_shndx section if needed.
12311 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12312 caller.
12313 (Layout::allocated_output_section_count): New function.
12314 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12315 needed.
12316 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12317 fields. Update declarations.
12318 (Layout::symtab_xindex): New function.
12319 (Layout::dynsym_xindex): New function.
12320 (class Write_symbols_task): Add layout_ field.
12321 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12322 Change caller.
12323 * output.cc (Output_section_headers::Output_section_headers): Add
12324 shstrtab_section parameter. Change all callers.
12325 (Output_section_headers::do_sized_write): Store overflow values
12326 for section count and section string table section index in
12327 section header zero.
12328 (Output_file_header::do_sized_write): Check for overflow of
12329 section count and section string table section index.
12330 (Output_symtab_xindex::do_write): New function.
12331 (Output_symtab_xindex::endian_do_write): New function.
12332 * output.h (class Output_section_headers): Add shstrtab_section_.
12333 Update declarations.
12334 (class Output_symtab_xindex): Define.
12335 (Output_section::has_out_shndx): New function.
12336 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12337 field.
12338 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12339 Change all callers.
12340 (Sized_symbol::init): Likewise.
12341 (Symbol::output_section): Check for ordinary symbol.
12342 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12343 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12344 callers.
12345 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12346 Change all callers. Simplify handling of symbols from sections
12347 not included in the link.
12348 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12349 distinction.
12350 (Weak_alias_sorter::operator()): Assert that symbols are
12351 ordinary.
12352 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12353 distinction.
12354 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12355 parameters. Change all callers.
12356 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12357 symbol distinction. Use SHN_XINDEX when needed.
12358 (Symbol_table::write_section_symbol): Add symtab_xindex
12359 parameter. Change all callers.
12360 (Symbol_table::sized_write_section_symbol): Likewise. Use
12361 SHN_XINDEX when needed.
12362 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12363 declarations.
12364 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12365 (Symbol::is_defined): Check is_ordinary.
12366 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12367 (Symbol::is_absolute, Symbol::is_common): Likewise.
12368 (class Sized_symbol): Update declarations.
12369 (class Symbol_table): Update declarations.
12370 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12371 parameters. Change all callers.
12372 (Sized_symbol::override): Likewise.
12373 (Symbol_table::override): Likewise.
12374 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12375 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12376 is_ordinary, and orig_st_shndx parameters. Change all callers.
12377 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12378 to be in an ordinary section.
12379 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12380 object and is_ordinary parameters. Change all callers.
12381 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12382 Change all callers. Don't add undefined or non-ordinary symbols
12383 to reloc_map_.
12384 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12385 Change all callers.
12386 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12387 declarations.
12388 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12389 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12390 (Sized_relobj::relocate_sections): Likewise.
12391 * target-reloc.h (scan_relocs): Adjust section symbol index.
12392 (scan_relocatable_relocs): Likewise.
12393 * i386.cc (Scan::local): Check for ordinary symbols.
12394 * sparc.cc (Scan::local): Likewise.
12395 * x86_64.cc (Scan::local): Likewise.
12396 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12397 to symbol_section_and_value.
12398 * testsuite/many_sections_test.cc: New file.
12399 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12400 (check_PROGRAMS): Add many_sections_test.
12401 (many_sections_test_SOURCES): Define.
12402 (many_sections_test_DEPENDENCIES): Define.
12403 (many_sections_test_LDFLAGS): Define.
12404 (BUILT_SOURCES): Add many_sections_define.h.
12405 (many_sections_define.h): New target.
12406 (BUILT_SOURCES): Add many_sections_check.h.
12407 (many_sections_check.h): New target.
12408 (check_PROGRAMS): Add many_sections_r_test.
12409 (many_sections_r_test_SOURCES): Define.
12410 (many_sections_r_test_DEPENDENCIES): Define.
12411 (many_sections_r_test_LDFLAGS): Define.
12412 (many_sections_r_test_LDADD): Define.
12413 (many_sections_r_test.o): New target.
12414 * testsuite/Makefile.in: Rebuild.
12415
12416 2008-04-17 Cary Coutant <ccoutant@google.com>
12417
12418 * errors.cc (Errors::info): New function.
12419 (gold_info): New function.
12420 * errors.h (Errors::info): New function.
12421 * gold.h (gold_info): New function.
12422 * object.cc (Input_objects::add_object): Print trace output.
12423 * options.cc (options::parse_set): New function.
12424 (General_options::parse_wrap): Deleted.
12425 (General_options::General_options): Deleted initializer.
12426 * options.h (options::String_set): New typedef.
12427 (options::parse_set): New function.
12428 (DEFINE_set): New macro.
12429 (General_options::wrap): Changed to use DEFINE_set. Changed
12430 callers of any_wrap_symbols and is_wrap_symbol.
12431 (General_options::trace, General_options::trace_symbol):
12432 New options.
12433 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12434 (General_options::wrap_symbols_): Deleted.
12435 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12436
12437 2008-04-17 David S. Miller <davem@davemloft.net>
12438
12439 * options.cc (General_options::parse_V): New function.
12440 * options.h: Add entries for -V and -Qy.
12441
12442 2008-04-17 Ian Lance Taylor <iant@google.com>
12443
12444 * common.cc (Symbol_table::allocate_commons): Remove options
12445 parameter. Change caller.
12446 (Symbol_table::do_allocate_commons): Remove options parameter.
12447 Change caller. Just call do_allocate_commons_list twice.
12448 (Symbol_table::do_allocate_commons_list): New function, broken out
12449 of do_allocate_commons.
12450 * common.h (class Allocate_commons_task): Remove options_ field.
12451 Update constructor.
12452 * symtab.cc (Symbol_table::Symbol_table): Initialize
12453 tls_commons_.
12454 (Symbol_table::add_from_object): Put TLS common symbols on
12455 tls_commons_ list.
12456 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12457 which are IN_OUTPUT_DATA.
12458 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12459 allocate_commons and do_allocate_commons declarations. Declare
12460 do_allocate_commons_list.
12461 * gold.cc (queue_middle_tasks): Update creation of
12462 Allocate_commons_task to not pass options.
12463 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12464 (TLS_TEST_C_FLAGS): New variable.
12465 (tls_test_c_pic.o): New target.
12466 (tls_test_shared.so): Link in tls_test_c_pic.o.
12467 (tls_test_c_pic_ie.o): New target.
12468 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12469 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12470 (tls_test_c.o): New target.
12471 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12472 (tls_pic_test_LDADD): Likewise.
12473 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12474 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12475 (tls_test_c_gnu2.o): New target.
12476 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12477 tls_test_c_gnu2.o.
12478 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12479 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12480 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12481 * testsuite/tls_test.cc: Include "config.h".
12482 (t_last): Call t11_last.
12483 * testsuite/tls_test.h (t11, t11_last): Declare.
12484 * testsuite/tls_test_c.c: New file.
12485 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12486 * configure.ac: Check for OpenMP support.
12487 * configure, config.in, Makefile.in: Rebuild.
12488 * testsuite/Makefile.in: Rebuild.
12489
12490 2008-04-16 Cary Coutant <ccoutant@google.com>
12491
12492 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12493 (Target_i386::tls_base_symbol_defined_): New field.
12494 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12495 (Target_i386::Scan::global): Likewise.
12496 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12497 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12498 (Target_x86_64::tls_base_symbol_defined_): New field.
12499 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12500 (Target_x86_64::Scan::global): Likewise.
12501
12502 2008-04-16 Cary Coutant <ccoutant@google.com>
12503
12504 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12505 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12506 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12507 building shared libraries.
12508 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12509 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12510 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12511 * testsuite/Makefile.in: Rebuild.
12512 * testsuite/weak_undef.h: New file.
12513 * testsuite/weak_undef_file1.cc: Add extra test cases.
12514 * testsuite/weak_undef_file2.cc: Likewise.
12515 * testsuite/weak_undef_test.cc: Likewise.
12516
12517 2008-04-16 David S. Miller <davem@davemloft.net>
12518
12519 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12520 Add issued_non_pic_error_ field. Declare check_non_pic.
12521 (Target_sparc::Scan::check_non_pic): New function.
12522 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12523 (Target_sparc::Scan::global): Likewise.
12524
12525 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12526 * configure: Rebuild.
12527
12528 * options.h (DEFINE_enable): New macro.
12529 (new_dtags): New enable option.
12530 (initfirst, interpose, loadfltr, nodefaultlib,
12531 nodelete, nodlopen, nodump): New -z options.
12532 * layout.cc (Layout:finish_dynamic_section): If new
12533 dtags enabled, emit DT_RUNPATH. Also, emit a
12534 DT_FLAGS_1 containing any specified -z flags.
12535
12536 2008-04-16 Ian Lance Taylor <iant@google.com>
12537
12538 * copy-relocs.cc: New file.
12539 * copy-relocs.h: New file.
12540 * reloc.cc: Remove Copy_relocs code.
12541 * reloc.h: Likewise.
12542 * reloc-types.h (struct Reloc_types) [both versions]: Add
12543 get_reloc_addend_noerror.
12544 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12545 variants of add_global which take an addend which must be zero.
12546 * i386.cc: Include "copy-relocs.h".
12547 (class Target_i386): Change type of copy_relocs_ to variable,
12548 update initializer.
12549 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12550 Change all callers.
12551 (Target_i386::do_finalize_sections): Change handling of
12552 copy_relocs_.
12553 * sparc.cc: Include "copy-relocs.h".
12554 (class Target_sparc): Change type of copy_relocs_ to variable,
12555 update initializer.
12556 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12557 Change all callers.
12558 (Target_sparc::do_finalize_sections): Change handling of
12559 copy_relocs_.
12560 * x86_64.cc: Include "copy-relocs.h".
12561 (class Target_x86_64): Change type of copy_relocs_ to variable,
12562 update initializer.
12563 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12564 class. Change all callers.
12565 (Target_x86_64::do_finalize_sections): Change handling of
12566 copy_relocs_.
12567 * Makefile.am (CCFILES): Add copy-relocs.cc.
12568 (HFILES): Add copy-relocs.h.
12569
12570 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12571
12572 * testsuite/script_test_4.sh: Permit leading zeroes.
12573
12574 2008-04-15 Ian Lance Taylor <iant@google.com>
12575
12576 * script-sections.cc (Script_sections::create_segments): Use
12577 header_size_adjustment even when there is enough room for the
12578 headers.
12579 * testsuite/script_test_4.sh: New file.
12580 * testsuite/script_test_4.t: New file.
12581 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12582 (check_DATA): Add script_test_4.stdout.
12583 (MOSTLYCLEANFILES): Likewise.
12584 (script_test_4): New target.
12585 (script_test_4.stdout): New target.
12586 * testsuite/Makefile.in: Rebuild.
12587
12588 * sparc.cc: Add definitions for Output_data_plt_sparc class
12589 constants.
12590
12591 2008-04-14 David S. Miller <davem@davemloft.net>
12592
12593 * sparc.cc: New file.
12594 * Makefile.am (TARGETSOURCES): Add sparc.cc
12595 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12596 * configure.tgt: Document targ_extra_size and
12597 targ_extra_big_endian. Add entries for sparc-* and
12598 sparc64-*.
12599 * configure.ac: Handle targ_extra_size and
12600 targ_extra_big_endian.
12601 * Makefile.in: Rebuild.
12602 * configure: Likewise.
12603 * po/POTFILES.in: Likewise.
12604 * po/gold.pot: Likewise.
12605
12606 2008-04-14 Ian Lance Taylor <iant@google.com>
12607
12608 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12609 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12610 in the name/type/flags to section mapping. Don't call
12611 allocate_output_section.
12612 (Layout::choose_output_section): Change parameter from adjust_name
12613 to is_input_section. Don't permit input sections after sections
12614 are attached to segments. Don't call allocate_output_section.
12615 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12616 not write_enable_output_section.
12617 (Layout::make_output_section): Don't push to
12618 unattached_section_list_ nor call attach_to_segment. Call
12619 attach_section_to_segment if sections are attached.
12620 (Layout::attach_sections_to_segments): New function.
12621 (Layout::attach_section_to_segment): New function.
12622 (Layout::attach_allocated_section_to_segment): Rename from
12623 attach_to_segment. Remove flags parameter.
12624 (Layout::allocate_output_section): Remove function.
12625 (Layout::write_enable_output_section): Remove function.
12626 * layout.h (class Layout): Update for above changes. Add new
12627 field sections_are_attached_.
12628 * output.h (Output_section::update_flags_for_input_section): New
12629 function.
12630 * output.cc (Output_section::add_input_section): Call
12631 update_flags_for_input_section.
12632 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12633
12634 2008-04-11 Cary Coutant <ccoutant@google.com>
12635
12636 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12637 thought unnecessary.
12638 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12639
12640 2008-04-11 Ian Lance Taylor <iant@google.com>
12641
12642 * output.h (class Output_section_data): Remove inline definition
12643 of set_addralign.
12644 * output.cc (Output_section_data::set_addralign): New function.
12645
12646 2008-04-11 Cary Coutant <ccoutant@google.com>
12647
12648 Add support for TLS descriptors for i386 and x86_64.
12649 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12650 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12651 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12652 GOT_TYPE_TLS_DESC.
12653 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12654 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12655 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12656 relocations.
12657 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12658 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12659 Fix problem with initial-exec relocations.
12660 (Target_i386::Relocate::relocate_tls): Likewise.
12661 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12662 relaxation.
12663 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12664 support for section-plus-offset dynamic table entries.
12665 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12666 (Output_data_dynamic::Dynamic_entry): Add support for
12667 section-plus-offset dynamic table entries.
12668 (Output_data_dynamic::Classification): Likewise.
12669 (Output_data_dynamic::classification_): Renamed offset_.
12670 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12671 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12672 (Target_x86_64::make_plt_section): New function.
12673 (Target_x86_64::reserve_tlsdesc_entries): New function.
12674 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12675 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12676 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12677 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12678 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12679 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12680 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12681 add extra PLT entry for TLS descriptors.
12682 (Output_data_plt_x86_64::got_): New field.
12683 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12684 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12685 fields.
12686 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12687 descriptors.
12688 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12689 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12690 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12691 R_386_TLS_DESC_CALL relocations.
12692 (Target_x86_64::Scan::global): Likewise.
12693 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12694 for TLS descriptors.
12695 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12696 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12697 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12698 GD-to-IE relaxation.
12699 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12700 and TLS_DESCRIPTORS.
12701 * Makefile.in: Rebuild.
12702 * configure: Rebuild.
12703 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12704 (tls_test_shared2.so): New target.
12705 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12706 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12707 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12708 (tls_shared_gd_to_ie_test_LDADD): New variable.
12709 (tls_shared_gnu2_gd_to_ie_test): New target.
12710 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12711 New targets.
12712 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12713 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12714 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12715 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12716 (tls_shared_gnu2_test): New target.
12717 (tls_test_gnu2_shared.so): New target.
12718 (tls_shared_gnu2_test_SOURCES): New variable.
12719 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12720 (tls_shared_gnu2_test_LDFLAGS): New variable.
12721 (tls_shared_gnu2_test_LDADD): New variable.
12722 * testsuite/Makefile.in: Rebuild.
12723 * testsuite/Makefile.
12724
12725 2008-04-11 Ian Lance Taylor <iant@google.com>
12726
12727 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12728 justsyms.t.
12729 * testsuite/Makefile.in: Rebuild.
12730
12731 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12732 long.
12733 * testsuite/script_test_2.cc (main): Adjust test.
12734
12735 2008-04-11 David S. Miller <davem@davemloft.net>
12736 Ian Lance Taylor <iant@google.com>
12737
12738 * options.h (General_options): Add entries for '-Y' and
12739 '-relax'.
12740 * options.cc (General_options:finalize): If -Y was used, add those
12741 entries to the library path instead of the default "/lib" and
12742 "/usr/lib".
12743
12744 2008-04-11 David S. Miller <davem@davemloft.net>
12745
12746 * testsuite/justsyms.t: Start at 0x100.
12747 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12748 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12749 long.
12750 * testsuite/script_test_2.cc: Adjust string and section length
12751 checks.
12752
12753 2008-04-09 Ian Lance Taylor <iant@google.com>
12754
12755 PR gold/5996
12756 * script-sections.cc (Sections_element::allocate_to_segment): Add
12757 orphan parameter.
12758 (Output_section_definition::allocate_to_segment): Likewise.
12759 (Orphan_output_section::allocate_to_segment): Likewise.
12760 (Script_sections::attach_sections_using_phdrs_clause): Don't
12761 propagate non-PT_LOAD segments to orphan sections.
12762 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12763 readelf rather than objdump.
12764 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12765 .interp section and PT_INTERP segment are the same size.
12766 * testsuite/Makefile.in: Rebuild.
12767
12768 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12769 aliases for symbols defined in the same object.
12770 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12771 (weak_alias_test_SOURCES): New variable.
12772 (weak_alias_test_DEPENDENCIES): New variable.
12773 (weak_alias_test_LDFLAGS): New variable.
12774 (weak_alias_test_LDADD): New variable.
12775 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12776 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12777 (weak_alias_test_3.o): New target.
12778 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12779 * testsuite/weak_alias_test_main.cc: New file.
12780 * testsuite/weak_alias_test_1.cc: New file.
12781 * testsuite/weak_alias_test_2.cc: New file.
12782 * testsuite/weak_alias_test_3.cc: New file.
12783
12784 2008-04-08 Ian Lance Taylor <iant@google.com>
12785
12786 * options.h (class General_options): Add --noinhibit-exec option.
12787 * main.cc (main): Check --noinhibit-exec.
12788
12789 * options.h (class General_options): Define --wrap as a special
12790 option. Add wrap_symbols_ field.
12791 (General_options::any_wrap_symbols): New function.
12792 (General_options::is_wrap_symbol): New function.
12793 * options.cc (General_options::parse_wrap): New function.
12794 (General_options::General_options): Initialize wrap_symbols_.
12795 * symtab.cc (Symbol_table::wrap_symbol): New function.
12796 (Symbol_table::add_from_object): Handle --wrap.
12797 * symtab.h (class Symbol_table): Declare wrap_symbol.
12798 * target.h (Target::wrap_char): New function.
12799 (Target::Target_info): Add wrap_char field.
12800 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12801 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12802 * testsuite/testfile.cc (Target_test::test_target_info):
12803 Likewise.
12804
12805 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12806 there is one.
12807
12808 * layout.h (class Layout): Add added_eh_frame_data_ field.
12809 * layout.cc (Layout::Layout): Initialize new field.
12810 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12811 output section until we find a section we merged successfully.
12812 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12813 that the size be non-zero.
12814
12815 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12816 qualifier.
12817
12818 2008-04-08 Craig Silverstein <csilvers@google.com>
12819
12820 * configure.ac: Export new conditional variable HAVE_ZLIB.
12821 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12822 on HAVE_ZLIB.
12823 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12824 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12825
12826 2008-04-07 Ian Lance Taylor <iant@google.com>
12827
12828 * version.cc (version_string): Set to "1.5".
12829
12830 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12831 Add issued_non_pic_error_ field. Declare check_non_pic.
12832 (Target_x86_64::Scan::check_non_pic): New function.
12833 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12834 (Target_x86_64::Scan::global): Likewise.
12835
12836 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12837 addend parameter. Change caller. Handle merge sections.
12838 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12839 Address to Addend. Don't add in the result of
12840 local_section_offset, pass down the addend and use the returned
12841 value.
12842 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12843 Update declarations of local_section_offset and symbol_value.
12844 * testsuite/two_file_test_1.cc (t18): New function.
12845 * testsuite/two_file_test_2.cc (f18): New function.
12846 * testsuite/two_file_test_main.cc (main): Call t18.
12847 * testsuite/two_file_test.h (t18, f18): Declare.
12848
12849 * configure.ac: Don't test for objdump, c++filt, or readelf.
12850 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12851 conditionals.
12852 (TEST_READELF): New variable.
12853 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12854 (check_PROGRAMS): Add two_file_strip_test.
12855 (two_file_strip_test): New target.
12856 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12857 (two_file_same_shared_strip_test_SOURCES): New variable.
12858 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12859 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12860 (two_file_same_shared_strip_test_LDADD): New variable.
12861 (two_file_shared_strip.so): New target.
12862 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12863 (ver_test_5.syms, ver_test_7.syms): Likewise.
12864 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12865 (strip_test_3.stdout): Use TEST_OBJDUMP.
12866 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12867
12868 2008-04-04 Cary Coutant <ccoutant@google.com>
12869
12870 * symtab.h (Symbol::is_weak_undefined): New function.
12871 (Symbol::is_strong_undefined): New function.
12872 (Symbol::is_absolute): New function.
12873 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12874 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12875 absolute symbols.
12876 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12877 (weak_undef_test): New target.
12878 * testsuite/Makefile.in: Rebuild.
12879 * testsuite/weak_undef_file1.cc: New file.
12880 * testsuite/weak_undef_file2.cc: New file.
12881 * testsuite/weak_undef_test.cc: New file.
12882
12883 2008-04-03 Craig Silverstein <csilvers@google.com>
12884
12885 * compressed_output.h (class Output_compressed_section): Use
12886 unsigned buffer.
12887 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12888 add zlib header.
12889 (zlib_compressed_suffix): Removed.
12890 (Output_compressed_section::set_final_data_size): Use unsigned
12891 buffers.
12892 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12893 Fix linker invocation.
12894 (flagstest_o_specialfile_and_compress_debug_sections):
12895 Likewise.
12896 * testsuite/Makefile.in: Regenerated.
12897
12898 2008-04-02 David S. Miller <davem@davemloft.net>
12899
12900 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12901 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12902
12903 2008-04-02 Craig Silverstein <csilvers@google.com>
12904
12905 * TODO: New file.
12906
12907 2008-04-02 Ian Lance Taylor <iant@google.com>
12908
12909 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12910 parameters. Update for new key type to views_. Change all
12911 callers.
12912 (File_read::read): Adjust for byteshift in returned view.
12913 (File_read::add_view): New function, broken out of
12914 find_and_make_view.
12915 (File_read::make_view): New function, broken out of
12916 find_and_make_view.
12917 (File_read::find_or_make_view): Add offset and aligned
12918 parameters. Rewrite accordingly. Change all callers.
12919 (File_read::get_view): Add offset and aligned parameters. Adjust
12920 for byteshift in return value.
12921 (File_read::get_lasting_view): Likewise.
12922 * fileread.h (class File_read): Update declarations.
12923 (class File_read::View): Add byteshift_ field. Add byteshift to
12924 constructor. Add byteshift method.
12925 * archive.h (Archive::clear_uncached_views): New function.
12926 (Archive::get_view): Add aligned parameter. Change all callers.
12927 * object.h (Object::get_view): Add aligned parameter. Change all
12928 callers.
12929 (Object::get_lasting_view): Likewise.
12930
12931 * fileread.cc (File_read::release): Don't call clear_views if
12932 there are multiple objects.
12933 * fileread.h (File_read::clear_uncached_views): New function.
12934 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12935 on the archive.
12936
12937 2008-03-31 Cary Coutant <ccoutant@google.com>
12938
12939 Add thin archive support.
12940 * archive.cc (Archive::armagt): New const.
12941 (Archive::setup): Remove task parameter and calls to unlock.
12942 (Archive::unlock_nested_archives): New function.
12943 (Archive::read_header): Add nested_off parameter. Change
12944 all callers.
12945 (Archive::interpret_header): Likewise.
12946 (Archive::include_all_members): Change to handle thin
12947 archives.
12948 (Archive::include_member): Likewise.
12949 * archive.h (Archive::Archive): Add new parameters and
12950 initializers.
12951 (Archive::armagt): New const.
12952 (Archive::setup): Remove task parameter.
12953 (Archive::unlock_nested_archives): New function.
12954 (Archive::read_header): Add nested_off parameter.
12955 (Archive::interpret_header): Likewise.
12956 (Archive::Nested_archive_table): New typedef.
12957 (Archive::is_thin_archive_): New field.
12958 (Archive::nested_archives_): New field.
12959 (Archive::options_): New field.
12960 (Archive::dirpath_): New field.
12961 (Archive::task_): New field.
12962 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12963 for thin archives. Pass additional parameters to
12964 Archive::Archive. Unlock the archive file after calling
12965 Archive::setup.
12966
12967 2008-03-29 Ian Lance Taylor <iant@google.com>
12968
12969 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12970 version symbol to be local.
12971 * testsuite/ver_test_4.sh: New file.
12972 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12973 (check_DATA): Add ver_test_4.syms.
12974 (ver_test_4.syms): New target.
12975 * testsuite/Makefile.in: Rebuild.
12976
12977 * output.cc
12978 (Output_section::Input_section_sort_entry::has_priority): New
12979 function.
12980 (Output_section::Input_section_sort_entry::match_file_name): New
12981 function.
12982 (Output_section::Input_section_sort_entry::match_section_name):
12983 Remove.
12984 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12985 Remove.
12986 (Output_section::Input_section_sort_entry::match_section_file):
12987 Remove.
12988 (Output_section::Input_section_sort_compare::operator()): Rewrite
12989 using new Input_section_sort_entry functions. Sort crtbegin and
12990 crtend first. Sort sections with no priority before sections with
12991 a priority.
12992 * testsuite/initpri1.c (d3): Check j != 4.
12993 (cd5): New constructor/destructor function.
12994 (main): Check j != 2.
12995
12996 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12997 new symbol when resolving, don't call set_is_default.
12998 * testsuite/ver_test_7.cc: New file.
12999 * testsuite/ver_test_7.sh: New file.
13000 * testsuite/Makefile.am (ver_test_7.so): New target.
13001 (ver_test_7.o): New target.
13002 (check_SCRIPTS): Add ver_test_7.sh.
13003 (check_DATA): Add ver_test_7.syms.
13004 (ver_test_7.syms): New target.
13005
13006 2008-03-28 Ian Lance Taylor <iant@google.com>
13007
13008 * layout.cc (Layout::layout): If we see an input section with a
13009 name that needs sorting, set the must_sort flag for the output
13010 section.
13011 (Layout::make_output_section): If the name of the output section
13012 indicates that it might require sorting, set the may_sort flag.
13013 * output.h (Output_section::may_sort_attached_input_sections): New
13014 function.
13015 (Output_section::set_may_sort_attached_input_sections): New
13016 function.
13017 (Output_section::must_sort_attached_input_sections): New
13018 function.
13019 (Output_section::set_must_sort_attached_input_sections): New
13020 function.
13021 (class Output_section): Declare Input_section_sort_entry. Define
13022 Input_section_sort_compare. Declare
13023 sort_attached_input_sections. Add new fields:
13024 may_sort_attached_input_sections_,
13025 must_sort_attached_input_sections_,
13026 attached_input_sections_are_sorted_.
13027 * output.cc (Output_section::Output_section): Initialize new
13028 fields.
13029 (Output_section::add_input_section): Add an entry to
13030 input_sections_ if may_sort or must_sort are true.
13031 (Output_section::set_final_data_size): Call
13032 sort_attached_input_sections if necessary.
13033 (Output_section::Input_section_sort_entry): Define new class.
13034 (Output_section::Input_section_sort_compare::operator()): New
13035 function.
13036 (Output_section::sort_attached_input_sections): New function.
13037 * configure.ac: Check whether the compiler supports constructor
13038 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13039 * testsuite/initpri1.c: New file.
13040 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13041 CONSTRUCTOR_PRIORITY.
13042 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13043 (initpri1_LDFLAGS): New variable.
13044 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13045
13046 2008-03-27 Ian Lance Taylor <iant@google.com>
13047
13048 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13049 * testsuite/common_test_1.c: New file.
13050 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13051 (common_test_1_SOURCES): New variable.
13052 (common_test_1_DEPENDENCIES): New variable.
13053 (common_test_1_LDFLAGS): New variable.
13054
13055 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13056 and commons_ correctly when NAME/VERSION does not override
13057 NAME/NULL.
13058 * testsuite/ver_test_6.c: New file.
13059 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13060 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13061 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13062
13063 2008-03-26 Ian Lance Taylor <iant@google.com>
13064
13065 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13066 of an undefined symbol from a version script.
13067 * testsuite/Makefile.am (ver_test_5.so): New target.
13068 (ver_test_5.o): New target.
13069 (check_SCRIPTS): Add ver_test_5.sh.
13070 (check_DATA): Add ver_test_5.syms.
13071 (ver_test_5.syms): New target.
13072 * testsuite/ver_test_5.cc: New file.
13073 * testsuite/ver_test_5.script: New file.
13074 * testsuite/ver_test_5.sh: New file.
13075 * Makefile.in, testsuite/Makefile.in: Rebuild.
13076
13077 PR gold/5986
13078 Fix problems building gold with gcc 4.3.0.
13079 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13080 (gold_error_at_location, gold_warning_at_location): Use it.
13081 * configure.ac: Check whether we can compile and use a template
13082 function with a printf attribute.
13083 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13084 when jumping over bytes.
13085 * object.cc: Instantiate Object::read_section_data.
13086 * debug.h: Include <cstring>
13087 * dwarf_reader.cc: Include <algorithm>
13088 * main.cc: Include <cstring>.
13089 * options.cc: Include <cstring>.
13090 * output.cc: Include <cstring>.
13091 * script.cc: Include <cstring>.
13092 * script.h: Include <string>.
13093 * symtab.cc: Include <cstring> and <algorithm>.
13094 * target-select.cc: Include <cstring>.
13095 * version.cc: Include <string>.
13096 * testsuite/testmain.cc: Include <cstdlib>.
13097 * configure, config.in: Rebuild.
13098
13099 2008-03-25 Ian Lance Taylor <iant@google.com>
13100
13101 * options.cc: Include "../bfd/bfdver.h".
13102 (options::help): Print bug reporting address.
13103
13104 * version.cc (print_version): Adjust output for current value of
13105 BFD_VERSION_STRING.
13106
13107 * NEWS: New file.
13108
13109 * options.cc (options::help): Print list of supported targets.
13110 * target-select.h: Include <vector>.
13111 (class Target_selector): Make machine_, size_, and is_big_endian_
13112 fields const. Add bfd_name_ and instantiated_target_ fields.
13113 (Target_selector::Target_selector): Add bfd_name parameter.
13114 (Target_selector::recognize): Make non-virtual, call
13115 do_recognize.
13116 (Target_selector::recognize_by_name): Make non-virtual, call
13117 do_recognize_by_name.
13118 (Target_selector::supported_names): New function.
13119 (Target_selector::bfd_name): New function.
13120 (Target_selector::do_instantiate_target): New pure virtual
13121 function.
13122 (Target_selector::do_recognize): New virtual function.
13123 (Target_selector::do_recognize_by_name): New virtual function.
13124 (Target_selector::instantiate_target): New private function.
13125 (supported_target_names): Declare.
13126 * target-select.cc (Target_selector::Target_selector): Update for
13127 new parameter and fields.
13128 (select_target_by_name): Check that the name matches before
13129 calling recognize_by_name.
13130 (supported_target_names): New function.
13131 * i386.cc (class Target_selector_i386): Update Target_selector
13132 constructor call. Remove recognize and recognize_by_name. Add
13133 do_instantiate_target.
13134 * x86_64.cc (class Target_selector_x86_64): Likewise.
13135 * testsuite/testfile.cc (class Target_selector_test): Update for
13136 changes to Target_selector.
13137
13138 * README: Rewrite, with some notes on unsupported features.
13139
13140 2008-03-24 Cary Coutant <ccoutant@google.com>
13141
13142 * i386.cc (Target_i386::Got_type): New enum declaration.
13143 (Target_i386::Scan::local): Updated callers of Output_data_got
13144 member functions.
13145 (Target_i386::Scan::global): Likewise.
13146 (Target_i386::Relocate::relocate): Likewise.
13147 (Target_i386::Relocate::relocate_tls): Likewise.
13148 * object.h (Got_offset_list): New class.
13149 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13150 (Sized_relobj::local_got_offset): Likewise.
13151 (Sized_relobj::set_local_got_offset): Likewise.
13152 (Sized_relobj::local_has_tls_got_offset): Removed.
13153 (Sized_relobj::local_tls_got_offset): Removed.
13154 (Sized_relobj::set_local_tls_got_offset): Removed.
13155 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13156 * output.cc (Output_data_got::add_global): Added got_type parameter.
13157 (Output_data_got::add_global_with_rel): Likewise.
13158 (Output_data_got::add_global_with_rela): Likewise.
13159 (Output_data_got::add_global_pair_with_rel): New function.
13160 (Output_data_got::add_global_pair_with_rela): New function.
13161 (Output_data_got::add_local): Added got_type parameter.
13162 (Output_data_got::add_local_with_rel): Likewise.
13163 (Output_data_got::add_local_with_rela): Likewise.
13164 (Output_data_got::add_local_pair_with_rel): New function.
13165 (Output_data_got::add_local_pair_with_rela): New function.
13166 (Output_data_got::add_global_tls): Removed.
13167 (Output_data_got::add_global_tls_with_rel): Removed.
13168 (Output_data_got::add_global_tls_with_rela): Removed.
13169 (Output_data_got::add_local_tls): Removed.
13170 (Output_data_got::add_local_tls_with_rel): Removed.
13171 (Output_data_got::add_local_tls_with_rela): Removed.
13172 * output.h (Output_data_got::add_global): Added got_type parameter.
13173 (Output_data_got::add_global_with_rel): Likewise.
13174 (Output_data_got::add_global_with_rela): Likewise.
13175 (Output_data_got::add_global_pair_with_rel): New function.
13176 (Output_data_got::add_global_pair_with_rela): New function.
13177 (Output_data_got::add_local): Added got_type parameter.
13178 (Output_data_got::add_local_with_rel): Likewise.
13179 (Output_data_got::add_local_with_rela): Likewise.
13180 (Output_data_got::add_local_pair_with_rel): New function.
13181 (Output_data_got::add_local_pair_with_rela): New function.
13182 (Output_data_got::add_global_tls): Removed.
13183 (Output_data_got::add_global_tls_with_rel): Removed.
13184 (Output_data_got::add_global_tls_with_rela): Removed.
13185 (Output_data_got::add_local_tls): Removed.
13186 (Output_data_got::add_local_tls_with_rel): Removed.
13187 (Output_data_got::add_local_tls_with_rela): Removed.
13188 * resolve.cc (Symbol::override_base_with_special): Removed
13189 reference to has_got_offset_ field.
13190 * symtab.cc (Symbol::init_fields): Replaced initialization
13191 of got_offset_ with got_offsets_. Removed initialization
13192 of has_got_offset_
13193 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13194 (Symbol::got_offset): Likewise.
13195 (Symbol::set_got_offset): Likewise.
13196 (Symbol::has_tls_got_offset): Removed.
13197 (Symbol::tls_got_offset): Removed.
13198 (Symbol::set_tls_got_offset): Removed.
13199 (Symbol::got_offset_): Removed.
13200 (Symbol::tls_mod_got_offset_): Removed.
13201 (Symbol::tls_pair_got_offset_): Removed.
13202 (Symbol::got_offsets_): New field.
13203 (Symbol::has_got_offset): Removed.
13204 (Symbol::has_tls_mod_got_offset): Removed.
13205 (Symbol::has_tls_pair_got_offset): Removed.
13206 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13207 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13208 member functions.
13209 (Target_x86_64::Scan::global): Likewise.
13210 (Target_x86_64::Relocate::relocate): Likewise.
13211 (Target_x86_64::Relocate::relocate_tls): Likewise.
13212
13213 2008-03-25 Ben Elliston <bje@au.ibm.com>
13214
13215 * yyscript.y: Fix spelling error in comment.
13216
13217 2008-03-24 Ian Lance Taylor <iant@google.com>
13218
13219 * options.h (class General_options): Define build_id option.
13220 * layout.h (class Layout): Declare write_build_id, create_note,
13221 create_build_id. Add build_id_note_ member.
13222 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13223 "libiberty.h", "md5.h", "sha1.h".
13224 (Layout::Layout): Initialize eh_frame_data_,
13225 eh_frame_hdr_section_, and build_id_note_.
13226 (Layout::finalize): Call create_build_id.
13227 (Layout::create_note): New function, broken out of
13228 Layout::create_gold_note.
13229 (Layout::create_gold_note): Call create_note.
13230 (Layout::create_build_id): New function.
13231 (Layout::write_build_id): New function.
13232 (Close_task_runner::run): Call write_build_id.
13233
13234 * x86_64.cc: Correct license to GPLv3.
13235
13236 2008-03-23 Ian Lance Taylor <iant@google.com>
13237
13238 * options.cc: Include "demangle.h".
13239 (parse_optional_string): New function.
13240 (parse_long_option): Handle takes_optional_argument.
13241 (parse_short_option): Update dash_z initializer. Handle
13242 takes_optional_argument.
13243 (General_options::General_options): Initialize do_demangle_.
13244 (General_options::finalize): Set do_demangle_. Handle demangling
13245 style.
13246 * options.h (parse_optional_string): Declare.
13247 (struct One_option): Add optional_arg field. Update constructor.
13248 Update call constructor calls. Add takes_optional_argument
13249 function.
13250 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13251 (DEFINE_optional_string): Define.
13252 (General_options::demangle): Change from DEFINE_bool to
13253 DEFINE_optional_string.
13254 (General_options::no_demangle): New function.
13255 (General_options::do_demangle): New function.
13256 (General_options::set_do_demangle): New function.
13257 (General_options::execstack_status_): Move definition to end of
13258 class definition.
13259 (General_options::static_): Likewise.
13260 (General_options::do_demangle_): New field.
13261 * object.cc (big_endian>::get_symbol_location_info): Call
13262 Options::do_demangle, not Options::demangle.
13263 * symtab.cc (demangle): Likewise.
13264
13265 2008-03-22 Ian Lance Taylor <iant@google.com>
13266
13267 * gold.h: Include <cstddef> and <sys/types.h>
13268 * options.h: Include <cstring>.
13269
13270 2008-03-21 Ian Lance Taylor <iant@google.com>
13271
13272 * Added source code to GNU binutils.
This page took 0.280199 seconds and 5 git commands to generate.