gold/
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-05-22 Cary Coutant <ccoutant@google.com>
2
3 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4 object before exporting symbol.
5
6 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
7
8 * testsuite/tls_test.cc: Include "config.h" first.
9 * testsuite/tls_test_c.c: Likewise.
10
11 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
12 Nick Clifton <nickc@redhat.com>
13
14 PR 14072
15 * configure.in: Add check that sysdep.h has been included before
16 any system header files.
17 * configure: Regenerate.
18 * config.in: Regenerate.
19
20 2012-05-14 Cary Coutant <ccoutant@google.com>
21
22 * layout.cc (Layout::make_output_section): Mark .tdata section
23 as RELRO.
24 * testsuite/relro_test.cc: Add a TLS variable.
25
26 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
27
28 PR gold/14091
29 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
30 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
31 R_X86_64_64.
32
33 2012-05-08 Cary Coutant <ccoutant@google.com>
34
35 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
36 (lines_only_debug_sections): Likewise.
37
38 2012-05-02 Roland McGrath <mcgrathr@google.com>
39
40 * nacl.cc: New file.
41 * nacl.h: New file.
42 * Makefile.am (CCFILES, HFILES): Add them.
43 * Makefile.in: Regenerate.
44 * i386.cc (Output_data_plt_i386_nacl): New class.
45 (Output_data_plt_i386_nacl_exec): New class.
46 (Output_data_plt_i386_nacl_dyn): New class.
47 (Target_i386_nacl): New class.
48 (Target_selector_i386_nacl): New class.
49 (target_selector_i386): Use it instead of Target_selector_i386.
50 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
51 (Target_x86_64_nacl): New class.
52 (Target_selector_x86_64_nacl): New class.
53 (target_selector_x86_64, target_selector_x32): Use it instead of
54 Target_selector_x86_64.
55 * arm.cc (Output_data_plt_arm_nacl): New class.
56 (Target_arm_nacl): New class.
57 (Target_selector_arm_nacl): New class.
58 (target_selector_arm, target_selector_armbe): Use it instead of
59 Target_selector_arm.
60
61 * target-select.cc (select_target): Take new Input_file* and off_t
62 arguments, pass them on to recognize method of selector.
63 * object.cc (make_elf_sized_object): Update caller.
64 * parameters.cc (parameters_force_valid_target): Likewise.
65 * incremental.cc (make_sized_incremental_binary): Likewise.
66 * target-select.h: Update decl.
67 (Target_selector::recognize): Take new Input_file* argument,
68 pass it on to do_recognize.
69 (Target_selector::do_recognize): Take new Input_file* argument.
70 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
71 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
72 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
73 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
74
75 * target.h (Target::Target_info): New members isolate_execinstr
76 and rosegment_gap.
77 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
78 * arm.cc (Target_arm::arm_info): Update initializer.
79 * i386.cc (Target_i386::i386_info): Likewise.
80 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
81 * sparc.cc (Target_sparc::sparc_info): Likewise.
82 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
83 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
84 * layout.cc (Layout::attach_allocated_section_to_segment):
85 Take new const Target* argument. If target->isolate_execinstr(), act
86 like --rosegment.
87 (Layout::find_first_load_seg): Take new const Target* argument;
88 if target->isolate_execinstr(), reject PF_X segments.
89 (Layout::relaxation_loop_body): Update caller.
90 (Layout::set_segment_offsets): If target->isolate_execinstr(),
91 reset file offset to zero when we hit LOAD_SEG, and then do a second
92 loop over the segments before LOAD_SEG to reassign offsets after
93 addresses have been determined. Handle target->rosegment_gap().
94 (Layout::attach_section_to_segment): Take new const Target* argument;
95 pass it to attach_allocated_section_to_segment.
96 (Layout::make_output_section): Update caller.
97 (Layout::attach_sections_to_segments): Take new const Target* argument;
98 pass it to attach_section_to_segment.
99 * gold.cc (queue_middle_tasks): Update caller.
100 * layout.h (Layout): Update method decls with new arguments.
101
102 * arm.cc (Target_arm::Target_arm): Take optional argument for the
103 Target_info pointer to use.
104 (Target_arm::do_make_data_plt): New virtual method.
105 (Target_arm::make_data_plt): New method that calls it.
106 (Target_arm::make_plt_entry): Use it.
107 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
108 for the section alignment.
109 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
110 method.
111 (Output_data_plt_arm::first_plt_entry_offset): Call it.
112 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
113 method.
114 (Output_data_plt_arm::get_plt_entry_size): Call it.
115 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
116 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
117 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
118 method.
119 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
120 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
121 method instead of sizeof(plt_entry).
122 (Output_data_plt_arm::add_entry): Likewise.
123 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
124 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
125 than static method.
126 (Target_arm::plt_entry_size): Likewise.
127 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
128 Move to ...
129 (Output_data_plt_arm_standard): ... here, new class.
130 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
131 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
132 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
133
134 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
135 Take additional argument for the PLT entry size.
136 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
137 Use get_plt_entry_size method rather than plt_entry_size variable.
138 (Output_data_plt_x86_64::reserve_slot): Likewise.
139 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
140 (Output_data_plt_x86_64::add_entry): Likewise.
141 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
142 (Output_data_plt_x86_64::address_for_global): Likewise.
143 (Output_data_plt_x86_64::address_for_local): Likewise.
144 (Output_data_plt_x86_64::set_final_data_size): Likewise.
145 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
146 Make method non-static.
147 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
148 method.
149 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
150 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
151 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
152 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
153 virtual method.
154 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
155 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
156 virtual method.
157 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
158 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
159 virtual method.
160 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
161 (Output_data_plt_x86_64::plt_entry_size)
162 (Output_data_plt_x86_64::first_plt_entry)
163 (Output_data_plt_x86_64::plt_entry)
164 (Output_data_plt_x86_64::tlsdesc_plt_entry)
165 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
166 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
167 (Output_data_plt_x86_64_standard): ... here, new class.
168 (Target_x86_64::Target_x86_64): Take optional argument for the
169 Target_info pointer to use.
170 (Target_x86_64::do_make_data_plt): New virtual method.
171 (Target_x86_64::make_data_plt): New method to call it.
172 (Target_x86_64::init_got_plt_for_update): Use that.
173 Call this->plt_->add_eh_frame method here.
174 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
175 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
176 rather than static method.
177 (Target_x86_64::plt_entry_size): Likewise.
178 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
179 rather than plt_entry_size variable. Move guts of PLT filling to...
180 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
181 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
182 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
183
184 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
185 additional argument for the section alignment.
186 Don't do add_eh_frame_for_plt here.
187 (Output_data_plt_i386::first_plt_entry_offset): Make the method
188 non-static. Use get_plt_entry_size method rather than plt_entry_size
189 variable.
190 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
191 method.
192 (Output_data_plt_i386::get_plt_entry_size): Call it.
193 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
194 (Output_data_plt_i386::add_eh_frame): New method to call it.
195 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
196 method.
197 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
198 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
199 method.
200 (Output_data_plt_i386::fill_plt_entry): New method to call it.
201 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
202 method instead of plt_entry_size.
203 (Output_data_plt_i386::plt_entry_size)
204 (Output_data_plt_i386::plt_eh_frame_fde_size)
205 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
206 (Output_data_plt_i386_standard): ... here, new class.
207 (Output_data_plt_i386_exec): New class.
208 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
209 (Output_data_plt_i386_exec::first_plt_entry): ... here.
210 (Output_data_plt_i386::exec_plt_entry): Move to ...
211 (Output_data_plt_i386_exec::plt_entry): ... here.
212 (Output_data_plt_i386_dyn): New class.
213 (Output_data_plt_i386::first_plt_entry): Move to ...
214 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
215 (Output_data_plt_i386::dyn_plt_entry): Move to ...
216 (Output_data_plt_i386_dyn::plt_entry): ... here.
217 (Target_i386::Target_i386): Take optional argument for the Target_info
218 pointer to use.
219 (Target_i386::do_make_data_plt): New virtual method.
220 (Target_i386::make_data_plt): New method to call it.
221 (Target_i386::make_plt_section): Use that.
222 Call this->plt_->add_eh_frame method here.
223 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
224 rather than plt_entry_size variable.
225 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
226 (Output_data_plt_i386::address_for_local): Likewise.
227 (Output_data_plt_i386::do_write): Likewise.
228 Move guts of PLT filling to...
229 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
230 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
231 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
232 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
233
234 2012-05-01 Cary Coutant <ccoutant@google.com>
235
236 * dwarf_reader.cc (Dwarf_die::read_attributes)
237 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
238 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
239 * reduced_debug_output.cc
240 (Output_reduced_debug_info_section::get_die_end): Remove
241 DW_FORM_GNU_ref_index. Add default case.
242
243 2012-04-26 Mark Wielaard <mjw@redhat.com>
244
245 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
246 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
247 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
248 DW_AT_high_pc as offset from DW_AT_low_pc.
249
250 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
251 * testsuite/Makefile.in: Regenerate.
252 * testsuite/gdb_index_test_3.c: New test source file.
253 * testsuite/gdb_index_test_3.sh: New test source file.
254
255 2012-04-25 Ian Lance Taylor <iant@google.com>
256
257 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
258 pointer.
259 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
260 as a class, not a struct.
261 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
262 (Target_arm::apply_cortex_a8_workaround): Likewise.
263 * gc.h: Declare Reloc_types as a struct, not a class.
264 * object.h: Declare Symbols_data as a struct.
265 * reloc.h: Declare Read_relocs_data as a struct.
266 * target.h: Declare Relocate_info as a struct.
267
268 2012-04-24 David S. Miller <davem@davemloft.net>
269
270 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
271 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
272 and R_SPARC_WPLT30.
273
274 2012-04-24 Cary Coutant <ccoutant@google.com>
275
276 * incremental-dump.cc (find_input_containing_global): Replace
277 magic number with symbolic constant.
278 (dump_incremental_inputs): Update version number.
279 * incremental.cc (Output_section_incremental_inputs): Update version
280 number; import symbolic constants from Incremental_inputs_reader.
281 (Incremental_inputs::create_data_sections): Align relocations
282 section correctly for 64-bit targets.
283 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
284 constants; add padding.
285 (Output_section_incremental_inputs::write_header): Add assert for
286 header_size.
287 (Output_section_incremental_inputs::write_input_files): Add assert
288 for input_entry_size.
289 (Output_section_incremental_inputs::write_info_blocks): Add padding;
290 add assert for object_info_size, input_section_entry_size,
291 global_sym_entry_size.
292 * incremental.h (Incremental_inputs_reader): Add symbolic constants
293 for data structure sizes; use them.
294 (Incremental_input_entry_reader): Import symbolic constants from
295 Incremental_inputs_reader; use them.
296
297 2012-04-23 David S. Miller <davem@davemloft.net>
298
299 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
300 and elf_flags_set_.
301 (Target_sparc::Target_sparc): Initialize new fields.
302 (Target_sparc::do_make_elf_object): New function.
303 (Target_sparc::do_adjust_elf_header): New function.
304
305 2012-04-23 Cary Coutant <ccoutant@google.com>
306
307 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
308 CU range table of gdb index.
309
310 2012-04-20 David S. Miller <davem@davemloft.net>
311
312 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
313 instead of false.
314
315 2012-04-16 David S. Miller <davem@davemloft.net>
316
317 * sparc.cc (Target_sparc::got_address): New function.
318 (Sparc_relocate_functions::gdop_hix22): New function.
319 (Sparc_relocate_functions::gdop_lox10): New function.
320 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
321 relocs.
322 (Target_sparc::Scan::local): Likewise if the global symbol is not
323 preemptible and is not IFUNC.
324 (Target_sparc::Relocate::relocate): Perform GOTDATA code
325 transformations for local and non-preemptible non-IFUNC global
326 symbols.
327
328 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
329 writing out 64-bit part of ranges.
330
331 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
332 -fpic and -fpie respectively.
333 * Makefile.in: Regenerate.
334
335 * sparc.cc (class Target_sparc): Add rela_ifunc_.
336 (Target_sparc::Target_sparc): Initialize new field.
337 (Target_sparc::do_plt_section_for_global): New function.
338 (Target_sparc::do_plt_section_for_local): New function.
339 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
340 (Target_sparc::make_plt_section): New function, broken out of
341 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
342 (Target_sparc::make_plt_entry): Call make_plt_section.
343 (Target_sparc::make_local_ifunc_plt_entry): New function.
344 (Target_sparc::rela_ifunc_section): New function.
345 (Target_sparc::plt_section): Remove const.
346 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
347 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
348 and ifunc_count_ fields.
349 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
350 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
351 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
352 (Output_data_plt_sparc::rela_ifunc): New function.
353 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
354 (Output_data_plt_sparc::has_ifunc_section): New function.
355 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
356 (Output_data_plt_sparc::address_for_global): New function.
357 (Output_data_plt_sparc::address_for_local): New function.
358 (Output_data_plt_sparc::plt_index_to_offset): New function.
359 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
360 and entry_count.
361 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
362 entry_count.
363 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
364 R_SPARC_JMP_IREL to switch.
365 (Target_sparc::Scan::check_non_pic): Likewise.
366 (Target_sparc::Scan::local): Handle IFUNC symbols.
367 (Target_sparc::Scan::local): Likewise.
368 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
369 and plt_address_for_local.
370 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
371 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
372
373 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
374 (class Output_data_reloc): Adjust calls to Output_reloc_type.
375 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
376 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
377 global relocs too.
378 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
379 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
380 calls.
381 * sparc.cc (Target_sparc::Scan::global): Likewise.
382 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
383
384 2012-04-16 Cary Coutant <ccoutant@google.com>
385
386 * archive.cc (Library_base::should_include_member): Check for
387 --export-dynamic-symbol.
388 * options.h (class General_options): Add --export-dynamic-symbol.
389 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
390 --export-dynamic-symbol.
391 (Symbol_table::gc_mark_undef_symbols): Likewise.
392 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
393
394 2012-04-12 David S. Miller <davem@davemloft.net>
395
396 * sparc.cc (Reloc::wdisp10): New relocation method.
397 (Reloc::h34): Likewise.
398 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
399 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
400 R_SPARC_WDISP10.
401 (Target_sparc::Scan::local): Likewise.
402 (Target_sparc::Scan::global): Likewise.
403 (Target_sparc::Relocate::relocate): Likewise.
404
405 2012-04-09 Cary Coutant <ccoutant@google.com>
406
407 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
408 low_pc == 0.
409
410 2012-04-06 Ian Lance Taylor <iant@google.com>
411
412 * timer.cc: #include <unistd.h>.
413
414 2012-04-06 Roland McGrath <mcgrathr@google.com>
415
416 * configure.in (AC_CHECK_HEADERS): Add locale.h.
417 * config.in: Regenerate.
418 * configure: Regenerate.
419
420 2012-04-05 Nick Clifton <nickc@redhat.com>
421
422 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
423 (AM_LC_MESSAGES): Add.
424 * aclocal.m4: Regenerate.
425 * config.in: Regenerate.
426 * configure: Regenerate.
427
428 2012-03-21 Cary Coutant <ccoutant@google.com>
429
430 * Makefile.am: Add gdb-index.cc, gdb-index.h.
431 * Makefile.in: Regenerate.
432 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
433 (Sized_elf_reloc_mapper::symbol_section): New function.
434 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
435 (make_elf_reloc_mapper): New function.
436 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
437 (Dwarf_abbrev_table::do_read_abbrevs): New function.
438 (Dwarf_abbrev_table::do_get_abbrev): New function.
439 (Dwarf_ranges_table::read_ranges_table): New function.
440 (Dwarf_ranges_table::read_range_list): New function.
441 (Dwarf_pubnames_table::read_section): New function.
442 (Dwarf_pubnames_table::read_header): New function.
443 (Dwarf_pubnames_table::next_name): New function.
444 (Dwarf_die::Dwarf_die): New function.
445 (Dwarf_die::read_attributes): New function.
446 (Dwarf_die::skip_attributes): New function.
447 (Dwarf_die::set_name): New function.
448 (Dwarf_die::set_linkage_name): New function.
449 (Dwarf_die::attribute): New function.
450 (Dwarf_die::string_attribute): New function.
451 (Dwarf_die::int_attribute): New function.
452 (Dwarf_die::uint_attribute): New function.
453 (Dwarf_die::ref_attribute): New function.
454 (Dwarf_die::child_offset): New function.
455 (Dwarf_die::sibling_offset): New function.
456 (Dwarf_info_reader::check_buffer): New function.
457 (Dwarf_info_reader::parse): New function.
458 (Dwarf_info_reader::do_parse): New function.
459 (Dwarf_info_reader::do_read_string_table): New function.
460 (Dwarf_info_reader::lookup_reloc): New function.
461 (Dwarf_info_reader::get_string): New function.
462 (Dwarf_info_reader::visit_compilation_unit): New function.
463 (Dwarf_info_reader::visit_type_unit): New function.
464 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
465 Sized_elf_reloc_mapper.
466 (Sized_dwarf_line_info::symbol_section): Remove function.
467 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
468 (Sized_dwarf_line_info::read_line_mappings): Remove object
469 parameter, adjust callers.
470 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
471 * dwarf_reader.h: Include <sys/types.h>.
472 (class Track_relocs): Remove forward declaration.
473 (class Elf_reloc_mapper): New class.
474 (class Sized_elf_reloc_mapper): New class.
475 (class Dwarf_abbrev_table): New class.
476 (class Dwarf_range_list): New class.
477 (class Dwarf_ranges_table): New class.
478 (class Dwarf_pubnames_table): New class.
479 (class Dwarf_die): New class.
480 (class Dwarf_info_reader): New class.
481 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
482 (Sized_dwarf_line_info::symbol_section): Remove member function.
483 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
484 base class.
485 * gdb-index.cc: New source file.
486 * gdb-index.h: New source file.
487 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
488 and .debug_types sections, call Layout::add_to_gdb_index.
489 (Sized_relobj_incr::do_section_name): Implement.
490 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
491 return type; Implement.
492 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
493 return type.
494 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
495 parameter list and return type.
496 (Sized_incr_dynobj::do_section_contents): Likewise.
497 * layout.cc: Include gdb-index.h.
498 (Layout::Layout): Initialize gdb_index_data_.
499 (Layout::init_fixed_output_section): Check for .gdb_index section.
500 (Layout::add_to_gdb_index): New function. Instantiate.
501 * layout.h: Add forward declaration for class Gdb_index.
502 (Layout::add_to_gdb_index): New member function.
503 (Layout::gdb_index_data_): New data member.
504 * main.cc: Include gdb-index.h.
505 (main): Print statistics for gdb index.
506 * object.cc (Object::section_contents): Move code into
507 do_section_contents.
508 (need_decompressed_section): Check for sections needed when building
509 gdb index.
510 (build_compressed_section_map): Likewise.
511 (Sized_relobj_file::do_read_symbols): Need local symbols when building
512 gdb index.
513 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
514 sections; call Layout::add_to_gdb_index.
515 (Sized_relobj_file::do_decompressed_section_contents): Call
516 do_section_contents directly.
517 * object.h (Object::do_section_contents): Adjust parameter list and
518 return type.
519 (Object::do_decompressed_section_contents): Call do_section_contents
520 directly.
521 (Sized_relobj_file::do_section_contents): Adjust parameter list and
522 return type.
523 * options.h (class General_options): Add --gdb-index option.
524 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
525 list and return type.
526 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
527 * reloc.h (Track_relocs::checkpoint): New function.
528 (Track_relocs::reset): New function.
529
530 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
531 New test cases.
532 * testsuite/Makefile.in: Regenerate.
533 * testsuite/gdb_index_test.cc: New test source file.
534 * testsuite/gdb_index_test_1.sh: New test source file.
535 * testsuite/gdb_index_test_2.sh: New test source file.
536
537 2012-03-19 Doug Kwan <dougkwan@google.com>
538
539 * arm.cc (Target_arm::do_define_standard_symbols): New method.
540 (Target_arm::do_finalize_sections): Remove code which defines
541 __exidx_start and __exidx_end. Make symbol table parameter
542 anonymous as it is not used.
543 * gold.cc (queue_middle_tasks): Call target hook to define any
544 target-specific symbols.
545 * target.h (Target::define_standard_symbols): New method.
546 (Target::do_define_standard_symbols): Same.
547 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
548 * testsuite/Makefile.in: Regenerate.
549 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
550 and __exidx_end.
551 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
552 relocations are generated for __exidx_start and __exidx_end.
553
554 2012-03-16 Doug Kwan <dougkwan@google.com>
555
556 * testsuite/Makefile.am: Disable test initpri3b.
557 * testsuite/Makefile.in: Regenerate.
558
559 2012-03-15 Doug Kwan <dougkwan@google.com>
560
561 * arm.cc (Target_arm::got_section): Make .got section read-only
562 if -z now is given.
563
564 2012-03-15 Ian Lance Taylor <iant@google.com>
565
566 PR gold/13850
567 * layout.cc (Layout::make_output_section): Correctly mark
568 SHT_INIT_ARRAY, et. al., as relro.
569
570 2012-03-14 Doug Kwan <dougkwan@google.com>
571
572 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
573 dynamic relocations for protected symbols in shared objects.
574
575 2012-03-13 Ian Lance Taylor <iant@google.com>
576
577 * resolve.cc (Symbol_table::resolve): When merging common symbols,
578 keep the larger alignment.
579
580 2012-03-12 Cary Coutant <ccoutant@google.com>
581
582 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
583 handling of DW_LNE_define_file.
584
585 2012-03-12 Cary Coutant <ccoutant@google.com>
586
587 * reduced_debug_output.cc
588 (Output_reduced_debug_info_section::get_die_end): Add new FORM
589 codes to switch.
590
591 2012-02-29 Cary Coutant <ccoutant@google.com>
592
593 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
594
595 2012-02-29 Cary Coutant <ccoutant@google.com>
596
597 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
598 Call Object::decompressed_section_contents.
599 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
600 New dtor.
601 (Sized_dwarf_line_info::buffer_start_): New data member.
602 * merge.cc (Output_merge_data::do_add_input_section): Call
603 Object::decompressed_section_contents.
604 (Output_merge_string::do_add_input_section): Likewise.
605 * object.cc (need_decompressed_section): New function.
606 (build_compressed_section_map): Decompress sections needed later.
607 (Sized_relobj_file::do_decompressed_section_contents): New function.
608 (Sized_relobj_file::do_discard_decompressed_sections): New function.
609 * object.h (Object::decompressed_section_contents): New function.
610 (Object::discard_decompressed_sections): New function.
611 (Object::do_decompressed_section_contents): New function.
612 (Object::do_discard_decompressed_sections): New function.
613 (Compressed_section_info): New type.
614 (Compressed_section_map): Include decompressed section contents.
615 (Sized_relobj_file::do_decompressed_section_contents): New function.
616 (Sized_relobj_file::do_discard_decompressed_sections): New function.
617
618 2012-02-16 Cary Coutant <ccoutant@google.com>
619
620 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
621 * testsuite/Makefile.in: Regenerate.
622
623 2012-02-14 Cary Coutant <ccoutant@google.com>
624
625 * options.cc (General_options::finalize): Disallow -pie and -static.
626
627 2012-02-03 Doug Kwan <dougkwan@google.com>
628
629 * arm.cc (Arm_relocate_functions::abs8,
630 Arm_relocate_functions::abs16): Use
631 Bits::has_signed_unsigned_overflow32.
632 (Arm_relocate_functions::thm_abs8): Correct range of
633 overflow check.
634 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
635 in assertions.
636
637 2012-02-02 Doug Kwan <dougkwan@google.com>
638
639 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
640 position independent outputs, not just shared objects.
641
642 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
643
644 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
645 * configure: Regenerated.
646
647 2012-01-27 Ian Lance Taylor <iant@google.com>
648
649 * reloc.h (Bits): New class with static functions, copied from
650 namespace utils in arm.cc.
651 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
652 instead.
653
654 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
655
656 * incremental.cc (write_info_blocks): Correct relocation offset.
657
658 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
659
660 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
661 (Relocate::tls_gd_to_le): Likewise.
662
663 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
664
665 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
666
667 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
668
669 * configure.ac: Check if -mcmodel=medium works.
670 * configure: Regenerated.
671
672 2012-01-24 Cary Coutant <ccoutant@google.com>
673
674 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
675 definition and ...
676 (read_unsigned_LEB_128_x): ... this new function.
677 (read_signed_LEB_128): Replaced with inline definition and ...
678 (read_signed_LEB_128_x): ... this new function.
679 * int_encoding.h (read_unsigned_LEB_128_x): New function.
680 (read_unsigned_LEB_128): Add inline definition.
681 (read_signed_LEB_128_x): New function.
682 (read_signed_LEB_128): Add inline definition.
683 * testsuite/Makefile.am (leb128_unittest): New unit test.
684 * testsuite/Makefile.in: Regenerate.
685 * testsuite/leb128_unittest.cc: New unit test.
686
687 2012-01-23 Ian Lance Taylor <iant@google.com>
688
689 PR gold/13617
690 * i386.cc (Target_i386::do_code_fill): When using a jmp
691 instruction, pad with nop instructions.
692 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
693
694 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
695
696 * x86_64.cc (gc_process_relocs): Add typename on types used in
697 template.
698 (scan_relocs): Likewise.
699 (relocate_section): Likewise.
700 (apply_relocation): Likewise.
701
702 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
703
704 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
705 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
706 under x32.
707
708 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
709
710 * x86_64.cc: Initial support for x32.
711
712 2012-01-03 Cary Coutant <ccoutant@google.com>
713
714 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
715 Use abstract base class for GOT.
716 * gold/output.h (class Output_data_got_base): New abstract base class.
717 (class Output_data_got): Derive from new base class, adjust ctors.
718 (Output_data_got::reserve_slot): Make virtual; rename to
719 do_reserve_slot; Adjust callers.
720 * gold/target.h (Sized_target::init_got_plt_for_update): Return
721 pointer to abstract base class.
722 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
723
724 2011-12-18 Ian Lance Taylor <iant@google.com>
725
726 * object.h (Relobj::local_symbol_value): New function.
727 (Relobj::local_plt_offset): New function.
728 (Relobj::local_has_got_offset): New function.
729 (Relobj::local_got_offset): New function.
730 (Relobj::set_local_got_offset): New function.
731 (Relobj::do_local_symbol_value): New pure virtual function.
732 (Relobj::do_local_plt_offset): Likewise.
733 (Relobj::do_local_has_got_offset): Likewise.
734 (Relobj::do_local_got_offset): Likewise.
735 (Relobj::do_set_local_got_offset): Likewise.
736 (Sized_relobj::do_local_has_got_offset): Rename from
737 local_has_got_offset.
738 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
739 (Sized_relobj::do_set_local_got_offset): Rename from
740 set_local_got_offset.
741 (Sized_relobj_file::do_local_plt_offset): Rename from
742 local_plt_offset.
743 (Sized_relobj_file::do_local_symbol_value): New function.
744 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
745 local_plt_offset.
746 * output.cc (Output_data_got::Got_entry::write): Change object to
747 Relobj. Use local_symbol_value.
748 (Output_data_got::add_global_with_rel): Change rel_dyn to
749 Output_data_reloc_generic*. Use add_global_generic.
750 (Output_data_got::add_global_with_rela): Remove. Change all
751 callers to use add_global_with_rel.
752 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
753 Output_data_reloc_generic*. Use add_global_generic.
754 (Output_data_got::add_global_pair_with_rela): Remove. Change all
755 callers to use add_global_pair_with_rel.
756 (Output_data_got::add_local): Change object to Relobj*.
757 (Output_data_got::add_local_plt): Likewise.
758 (Output_data_got::add_local_with_rel): Change object to Relobj*,
759 change rel_dyn to Output_data_reloc_generic*. Use
760 add_local_generic.
761 (Output_data_got::add_local_with_rela): Remove. Change all
762 callers to use all_local_with_rel.
763 (Output_data_got::add_local_pair_with_rel): Change object to
764 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
765 add_output_section_generic.
766 (Output_data_got::add_local_pair_with_rela): Remove. Change all
767 callers to use add_local_pair_with_rel.
768 (Output_data_got::reserve_local): Change object to Relobj*.
769 * output.h: (class Output_data_reloc_generic): Add pure virtual
770 declarations for add_global_generic, add_local_generic,
771 add_output_section_generic.
772 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
773 functions for Output_data_reloc_generic. Update declarations for
774 changes listed in output.cc.
775 (class Output_data_got): Change template parameter to got_size.
776 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
777 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
778 function.
779 (Sized_relobj_incr::do_local_plt_offset): New function.
780 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
781 add_global_generic.
782
783 2011-12-17 Cary Coutant <ccoutant@google.com>
784
785 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
786 * resolve.cc (Symbol_table::resolve): Likewise.
787 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
788 arrays.
789 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
790
791 2011-12-16 Ian Lance Taylor <iant@google.com>
792
793 * output.h (Output_data_reloc_generic::add): Only call
794 add_dynamic_reloc if this is a dynamic reloc section.
795
796 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
797
798 PR gold/13505
799 * target-reloc.h (apply_relocation): Replace <64, false> with
800 <size, big_endian>.
801
802 2011-11-25 Nick Clifton <nickc@redhat.com>
803
804 * po/it.po: New Italian translation.
805
806 2011-11-17 Sterling Augustine <saugustine@google.com>
807
808 * script.cc (script_include_directive): Implement.
809 (read_script_file): New local variables name and search_path. Update
810 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
811 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
812 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
813
814 2011-11-11 Sterling Augustine <saugustine@google.com>
815
816 * yyscript.y (section_cmd): Add support for INCLUDE directive.
817 (file_or_sections_cmd): Likewise.
818
819 2011-11-11 Doug Kwan <dougkwan@google.com>
820
821 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
822 if --just-symbols is given.
823
824 2011-11-10 Doug Kwan <dougkwan@google.com>
825
826 PR gold/13362
827 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
828 when processing data relocs.
829 * reloc.h (Relocate_functions::rel_unaligned): New method.
830 (Relocate_functions::pcrel_unaligned): Ditto.
831 (Relocate_functions::rel32_unaligned): Ditto.
832 (Relocate_functions::pcrel32_unaligned): Ditto.
833
834 2011-11-09 Doug Kwan <dougkwan@google.com>
835
836 PR gold/13362
837 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
838 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
839 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
840 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
841 (Relocate_functions::rel_unaligned): New.
842 (Relocate_functions::rel32_unaligned): New.
843 * target-reloc.h (relocate_for_relocatable): Add code to handle
844 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
845 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
846 arm_unaligned_reloc_r): New targets.
847 * testsuite/Makefile.in: Regenerate.
848 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
849 linking.
850
851 2011-11-02 Ian Lance Taylor <iant@google.com>
852
853 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
854 NATIVE_LINKER.
855 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
856 * options.cc (General_options::finalize): Use library search path
857 from configure script if specified. If not native and no sysroot,
858 only search TOOLLIBDIR.
859 * options.h (Search_directory::Search_directory): Change name to
860 const std::string&.
861 (General_options::add_to_library_path_with_sysroot): Change arg to
862 const std::string&.
863 * configure, Makefile.in, config.in: Rebuild.
864
865 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
866
867 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
868 we are working around the ARM1176 Erratum.
869 * options.h (General_options::fix_arm1176): Add option.
870 * testsuite/Makefile.am: Add testcases, and keep current ones
871 working.
872 * testsuite/Makefile.in: Regenerate.
873 * testsuite/arm_fix_1176.s: New file.
874 * testsuite/arm_fix_1176.sh: Likewise.
875
876 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
877
878 * arm.cc (Target_arm::Target_arm): Remove initialisation of
879 may_use_blx_.
880 (Target_arm::may_use_blx): Remove method.
881 (Target_arm::set_may_use_blx): Likewise.
882 (Target_arm::may_use_v4t_interworking): New method.
883 (Target_arm::may_use_v5t_interworking): Likewise.
884 (Target_arm::may_use_blx_): Remove member variable.
885 (Arm_relocate_functions::arm_branch_common): Check for v5T
886 interworking.
887 (Arm_relocate_functions::thumb_branch_common): Likewise.
888 (Reloc_stub::stub_type_for_reloc): Likewise.
889 (Target_arm::do_finalize_sections): Correct interworking checks.
890 * testsuite/Makefile.am: Add new tests.
891 * testsuite/Makefile.in: Regenerate.
892 * testsuite/arm_farcall_arm_arm.s: New test.
893 * testsuite/arm_farcall_arm_arm.sh: Likewise.
894 * testsuite/arm_farcall_arm_thumb.s: Likewise.
895 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
896 * testsuite/arm_farcall_thumb_arm.s: Likewise.
897 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
898 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
899 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
900
901 2011-10-31 Cary Coutant <ccoutant@google.com>
902
903 PR gold/13023
904 * expression.cc (Expression::eval_with_dot): Add
905 is_section_dot_assignment parameter.
906 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
907 absolute and assigning to dot within a section.
908 * script-sections.cc
909 (Output_section_element_assignment::set_section_addresses): Pass
910 dot_section to set_if_absolute.
911 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
912 as is_section_dot_assignment flag to eval_with_dot.
913 (Output_section_element_dot_assignment::set_section_addresses):
914 Likewise.
915 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
916 parameter. Also set value if relative to dot_section; set the
917 symbol's output_section.
918 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
919 parameter. Adjust all callers.
920 (Expression::eval_maybe_dot): Likewise.
921 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
922 Adjust all callers.
923 * testsuite/script_test_2.t: Test assignment of an absolute value
924 to dot within an output section element.
925
926 2011-10-31 Cary Coutant <ccoutant@google.com>
927
928 * options.h (class General_options): Add --[no-]gnu-unique options.
929 * symtab.cc (Symbol_table::sized_write_globals): Convert
930 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
931
932 2011-10-31 Cary Coutant <ccoutant@google.com>
933
934 PR gold/13359
935 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
936 unnecessary assertion.
937 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
938
939 2011-10-31 Sriraman Tallam <tmsriram@google.com>
940
941 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
942 gc_mark_symbol.
943 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
944 gc_mark_symbol.
945 Change to just keep the section associated with symbol.
946 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
947 they are externally visible and --export-dynamic is turned on.
948 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
949
950 2011-10-19 Ian Lance Taylor <iant@google.com>
951
952 PR gold/13163
953 * script-sections.cc
954 (Output_section_element_dot_assignment::needs_output_section): New
955 function.
956
957 2011-10-19 Ian Lance Taylor <iant@google.com>
958
959 PR gold/13204
960 * layout.cc (Layout::segment_precedes): Don't assert failure if a
961 --section-start option was seen.
962 * options.h (General_options::any_section_start): New function.
963
964 2011-10-18 David S. Miller <davem@davemloft.net>
965
966 PR binutils/13301
967 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
968 member to track relocation locations that have moved during TLS
969 reloc optimizations.
970 (Target_sparc::Relocate::Relocate): Initialize to NULL.
971 (Target_sparc::Relocate::relocate): Adjust view down by 4
972 bytes if it matches reloc_adjust_addr_.
973 (Target_sparc::Relocate::relocate_tls): Always move the
974 __tls_get_addr call delay slot instruction forward 4 bytes when
975 performing relaxation.
976
977 2011-10-18 Cary Coutant <ccoutant@google.com>
978
979 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
980 (Output_file::map_no_anonymous): Check for non-zero
981 return code from posix_fallocate.
982
983 2011-10-17 Cary Coutant <ccoutant@google.com>
984
985 PR gold/13245
986 * plugin.cc (is_visible_from_outside): Check for symbols
987 referenced from dynamic objects.
988 * resolve.cc (Symbol_table::resolve): Don't count references
989 from dynamic objects as references from real ELF files.
990 * testsuite/plugin_test_2.sh: Adjust expected result.
991
992 2011-10-17 Cary Coutant <ccoutant@google.com>
993
994 * gold.cc: Include timer.h.
995 (queue_middle_tasks): Stamp time.
996 (queue_final_tasks): Likewise.
997 * main.cc (main): Store timer in parameters. Print timers
998 for each pass.
999 * parameters.cc (Parameters::Parameters): Initialize timer_.
1000 (Parameters::set_timer): New function.
1001 (set_parameters_timer): New function.
1002 * parameters.h (Parameters::set_timer): New function.
1003 (Parameters::timer): New function.
1004 (Parameters::timer_): New data member.
1005 (set_parameters_timer): New function.
1006 * timer.cc (Timer::stamp): New function.
1007 (Timer::get_pass_time): New function.
1008 * timer.h (Timer::stamp): New function.
1009 (Timer::get_pass_time): New function.
1010 (Timer::pass_times_): New data member.
1011
1012 2011-10-17 Cary Coutant <ccoutant@google.com>
1013
1014 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1015 task for members of lib groups.
1016
1017 2011-10-17 Cary Coutant <ccoutant@google.com>
1018
1019 PR gold/13288
1020 * fileread.cc (File_read::find_view): Add assert.
1021 (File_read::make_view): Move bounds check (replace with assert)...
1022 (File_read::find_or_make_view): ... to here.
1023
1024 2011-10-12 Cary Coutant <ccoutant@google.com>
1025
1026 * output.cc (Output_file::open_base_file): Handle case where
1027 ::read returns less than requested size.
1028
1029 2011-10-10 Cary Coutant <ccoutant@google.com>
1030
1031 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1032 Initialize defined_count_.
1033 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1034 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1035 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1036 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1037 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1038 * incremental.h (Sized_relobj_incr::defined_count_): New data
1039 member.
1040 (Sized_incr_dynobj::defined_count_): New data member.
1041 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1042 Return zeroes instead of internal error.
1043
1044 2011-10-10 Cary Coutant <ccoutant@google.com>
1045
1046 PR gold/13249
1047 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1048 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1049 * output.h (class Output_reloc): Add use_plt_offset flag.
1050 (Output_reloc::type_): Adjust size of bit field.
1051 (Output_reloc::use_plt_offset_): New bit field.
1052 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1053 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1054 flag. Adjust all callers.
1055 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1056 creating RELATIVE relocations.
1057
1058 2011-10-10 Nick Clifton <nickc@redhat.com>
1059
1060 * po/es.po: Updated Spanish translation.
1061 * po/fi.po: Updated Finnish translation.
1062
1063 2011-10-03 Diego Novillo <dnovillo@google.com>
1064
1065 * options.cc (parse_uint): Fix dereference of RETVAL.
1066
1067 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1068
1069 * layout.h (section_order_map_): New member.
1070 (get_section_order_map): New member function.
1071 * output.cc (Output_section::add_input_section): Check for patterns
1072 only when --section-ordering-file is specified.
1073 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1074 output_sections have been formed.
1075 * layout.cc (Layout_Layout): Initialize section_order_map_.
1076 * plugin.cc (update_section_order): Store order in order_map. Do not
1077 update the order.
1078 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1079 * testsuite/Makefile.in: Regenerate.
1080 * testsuite/plugin_section_order.c: New file.
1081 * testsuite/plugin_final_layout.cc: New file.
1082 * testsuite/plugin_final_layout.sh: New file.
1083
1084 2011-09-29 Cary Coutant <ccoutant@google.com>
1085
1086 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1087 Check for NULL.
1088 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1089 symbols during incremental update.
1090 (Symbol_table::add_from_dynobj): Likewise.
1091
1092 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1093 Ian Lance Taylor <iant@google.com>
1094
1095 * symtab.cc (Symbol_table::define_special_symbol): Always
1096 canonicalize version string.
1097
1098 2011-09-26 Cary Coutant <ccoutant@google.com>
1099
1100 * gold.cc (queue_initial_tasks): Move option checks ...
1101 * options.cc (General_options::finalize): ... to here. Disable
1102 some options; make others fatal.
1103
1104 2011-09-26 Cary Coutant <ccoutant@google.com>
1105
1106 gcc PR lto/47247
1107 * plugin.cc (get_symbols_v2): New function.
1108 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1109 (is_referenced_from_outside): New function.
1110 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1111 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1112 (get_symbols): Pass version parameter.
1113 (get_symbols_v2): New function.
1114 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1115 parameter.
1116 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1117 (onload): Add LDPT_GET_SYMBOLS_V2.
1118 (all_symbols_read_hook): Use get_symbols_v2; check for
1119 LDPR_PREVAILING_DEF_IRONLY_EXP.
1120 * testsuite/plugin_test_3.sh: Update expected results.
1121
1122 2011-09-23 Simon Baldwin <simonb@google.com>
1123
1124 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1125 configuration options.
1126 * configure: Regenerate.
1127 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1128 * Makefile.in: Regenerate.
1129 * testsuite/Makefile.in: Regenerate.
1130
1131 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1132
1133 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1134
1135 2011-09-19 Cary Coutant <ccoutant@google.com>
1136
1137 * incremental.cc (can_incremental_update): Fix typo in comment.
1138 * incremental.h (can_incremental_update): Likewise.
1139
1140 2011-09-18 Cary Coutant <ccoutant@google.com>
1141
1142 * incremental.cc (can_incremental_update): New function.
1143 * incremental.h (can_incremental_update): New function.
1144 * layout.cc (Layout::init_fixed_output_section): Call it.
1145 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1146 * object.cc (Sized_relobj_file::do_layout): Call
1147 can_incremental_update.
1148
1149 2011-09-13 Cary Coutant <ccoutant@google.com>
1150
1151 * configure.ac: Check for glibc support for gnu_indirect_function
1152 support with static linking, setting automake conditional
1153 IFUNC_STATIC.
1154 * Makefile.in: Regenerate.
1155 * configure: Regenerate.
1156
1157 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1158 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1159 for IFUNC_STATIC.
1160 * testsuite/Makefile.in: Regenerate.
1161
1162 2011-09-13 Cary Coutant <ccoutant@google.com>
1163
1164 * incremental.cc (Sized_relobj_incr::do_layout): Call
1165 report_comdat_group for kept comdat sections.
1166 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1167 * testsuite/Makefile.in: Regenerate.
1168 * testsuite/incr_comdat_test_1.cc: New source file.
1169 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1170 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1171 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1172
1173 2011-09-13 Ian Lance Taylor <iant@google.com>
1174
1175 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1176 variable external_symbols_offset.
1177
1178 2011-09-12 Ian Lance Taylor <iant@google.com>
1179
1180 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1181 triggered if object has no symbols.
1182
1183 2011-09-09 David S. Miller <davem@davemloft.net>
1184
1185 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1186 (Output_fill_debug_line::do_write): Likewise.
1187
1188 2011-08-29 Cary Coutant <ccoutant@google.com>
1189
1190 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1191 casts to match formatting specs.
1192 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1193
1194 2011-08-26 Cary Coutant <ccoutant@google.com>
1195
1196 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1197 remaining hole size when allocating.
1198 (Layout::make_output_section): Set fill methods for debug sections.
1199 * layout.h (Free_list::Free_list_node): Move from private to
1200 public.
1201 (Free_list::set_min_hole_size): New function.
1202 (Free_list::begin, Free_list::end): New functions.
1203 (Free_list::min_hole_): New data member.
1204 * output.cc: Include dwarf.h.
1205 (Output_fill_debug_info::do_minimum_hole_size): New function.
1206 (Output_fill_debug_info::do_write): New function.
1207 (Output_fill_debug_line::do_minimum_hole_size): New function.
1208 (Output_fill_debug_line::do_write): New function.
1209 (Output_section::Output_section): Initialize new data member.
1210 (Output_section::set_final_data_size): Ensure patch space is larger
1211 than minimum hole size.
1212 (Output_section::do_write): Fill holes in debug sections.
1213 * output.h (Output_fill): New class.
1214 (Output_fill_debug_info): New class.
1215 (Output_fill_debug_line): New class.
1216 (Output_section::set_free_space_fill): New function.
1217 (Output_section::free_space_fill_): New data member.
1218 * testsuite/Makefile.am (incremental_test_3): Add
1219 --incremental-patch option.
1220 (incremental_test_4): Likewise.
1221 (incremental_test_5): Likewise.
1222 (incremental_test_6): Likewise.
1223 (incremental_copy_test): Likewise.
1224 (incremental_common_test_1): Likewise.
1225 * testsuite/Makefile.in: Regenerate.
1226
1227 2011-08-26 Nick Clifton <nickc@redhat.com>
1228
1229 * po/es.po: Updated Spanish translation.
1230
1231 2011-08-01 Cary Coutant <ccoutant@google.com>
1232
1233 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1234 * gold/testsuite/Makefile.in: Regenerate.
1235 * gold/testsuite/justsyms_exec.c: New source file.
1236 * gold/testsuite/justsyms_lib.c: New source file.
1237
1238 2011-08-01 Cary Coutant <ccoutant@google.com>
1239
1240 * layout.cc (Layout::set_segment_offsets): Don't realign text
1241 segment if -Ttext was specified.
1242 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1243 file type.
1244 * object.h (Sized_relobj_file::e_type): New function.
1245 (Sized_relobj_file::e_type_): New data member.
1246 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1247 base address for ET_EXEC files.
1248 * target.cc (Target::do_make_elf_object_implementation): Allow
1249 ET_EXEC files with --just-symbols option.
1250
1251 2011-07-28 Cary Coutant <ccoutant@google.com>
1252
1253 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1254 Add thread_number parameter.
1255 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1256 * workqueue-threads.cc
1257 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1258 current thread if its thread number is greater than desired thread
1259 count.
1260 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1261 Add thread_number parameter.
1262 (Workqueue::should_cancel_thread): Likewise.
1263 (Workqueue::find_runnable_or_wait): Pass thread_number to
1264 should_cancel_thread.
1265 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1266 parameter.
1267
1268 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1269
1270 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1271 only after checking if it cannot be forced local.
1272 * symtab.h (is_externally_visible): Check if the symbol is not forced
1273 local.
1274
1275 2011-07-15 Ian Lance Taylor <iant@google.com>
1276
1277 * options.h (class General_options): Add --print-output-format.
1278 Move -EL next to -EB, for better --help output.
1279 * target-select.cc: Include <cstdio>, "options.h", and
1280 "parameters.h".
1281 (Target_selector::do_target_bfd_name): New function.
1282 (print_output_format): New function.
1283 * target-select.h (class Target_selector): Update declarations.
1284 (Target_selector::target_bfd_name): New function.
1285 (print_output_format): Declare.
1286 * main.cc: Include "target-select.h".
1287 (main): Handle --print-output-format.
1288 * gold.cc: Include "target-select.h".
1289 (queue_initial_tasks): Handle --print-output-format when there are
1290 no input files.
1291 * parameters.cc (parameters_force_valid_target): Give a better
1292 error message if -EB/-EL does not match target.
1293 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1294 function.
1295
1296 2011-07-15 Ian Lance Taylor <iant@google.com>
1297
1298 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1299 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1300 (Output_data_plt_i386::do_write): Write address of .dynamic
1301 section to first entry in .got.plt section.
1302 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1303 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1304 Initialize layout_.
1305 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1306 section to first entry in .got.plt section.
1307 * layout.h (Layout::dynamic_section): New function.
1308
1309 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1310
1311 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1312 to claim_file call.
1313 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1314 input_section_position_, and input_section_glob_.
1315 (read_layout_from_file): Call function section_ordering_specified.
1316 * layout.h (is_section_ordering_specified): New function.
1317 (section_ordering_specified): New function.
1318 (section_ordering_specified_): New boolean member.
1319 * main.cc(main): Call load_plugins after layout object is defined.
1320 * output.cc (Output_section::add_input_section): Use
1321 function section_ordering_specified to check if section ordering is
1322 needed.
1323 * output.cc (Output_section::add_relaxed_input_section): Use
1324 function section_ordering_specified to check if section ordering is
1325 needed.
1326 (Output_section::update_section_layout): New function.
1327 (Output_section::sort_attached_input_sections): Check if input section
1328 must be reordered.
1329 * output.h (Output_section::update_section_layout): New function.
1330 * plugin.cc (get_section_count): New function.
1331 (get_section_type): New function.
1332 (get_section_name): New function.
1333 (get_section_contents): New function.
1334 (update_section_order): New function.
1335 (allow_section_ordering): New function.
1336 (Plugin::load): Add the new interfaces to the transfer vector.
1337 (Plugin_manager::load_plugins): New parameter.
1338 (Plugin_manager::all_symbols_read): New parameter.
1339 (Plugin_manager::claim_file): New parameter. Save the elf object for
1340 unclaimed objects.
1341 (Plugin_manager::get_elf_object): New function.
1342 (Plugin_manager::get_view): Change to directly use the bool to check
1343 if get_view is called from claim_file_hook.
1344 * plugin.h (input_objects): New function
1345 (Plugin__manager::load_plugins): New parameter.
1346 (Plugin_manager::claim_file): New parameter.
1347 (Plugin_manager::get_elf_object): New function.
1348 (Plugin_manager::in_claim_file_handler): New function.
1349 (Plugin_manager::in_claim_file_handler_): New member.
1350 (layout): New function.
1351 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1352 handler with an extra parameter. Make the elf object before calling
1353 claim_file handler.
1354 * testsuite/plugin_test.c (get_section_count): New function pointer.
1355 (get_section_type): New function pointer.
1356 (get_section_name): New function pointer.
1357 (get_section_contents): New function pointer.
1358 (update_section_order): New function pointer.
1359 (allow_section_ordering): New function pointer.
1360 (onload): Check if the new interfaces exist.
1361
1362 2011-07-13 Ian Lance Taylor <iant@google.com>
1363
1364 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1365 relro section.
1366 * x86_64.cc (Target_x86_64::got_section): Likewise.
1367 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1368 (relro_now_test_SOURCES): New variable.
1369 (relro_now_test_DEPENDENCIES): New variable.
1370 (relro_now_test_LDFLAGS): New variable.
1371 (relro_now_test_LDADD): New variable.
1372 (relro_now_test.so): New target.
1373 * testsuite/Makefile.in: Rebuild.
1374
1375 2011-07-12 Ian Lance Taylor <iant@google.com>
1376
1377 PR gold/12980
1378 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1379 GLOB_DAT relocation rather than a RELATIVE relocation for a
1380 protected symbol when creating a shared library.
1381 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1382 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1383 * testsuite/protected_main_1.cc (main): Test that protected
1384 function has same address.
1385
1386 2011-07-11 Ian Lance Taylor <iant@google.com>
1387
1388 PR gold/12979
1389 * options.h (class General_options): Add -Bgroup.
1390 * options.cc (General_options::finalize): If -Bgroup is set,
1391 default to --unresolved-symbols=report-all.
1392 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1393 * target-reloc.h (issue_undefined_symbol_error): Handle
1394 --unresolved-symbols=report-all.
1395
1396 2011-07-08 Ian Lance Taylor <iant@google.com>
1397
1398 PR gold/11985
1399 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1400 if linker script discards key sections.
1401 (Layout::create_dynamic_symtab): Likewise.
1402 (Layout::assign_local_dynsym_offsets): Likewise.
1403 (Layout::sized_create_version_sections): Likewise.
1404 (Layout::create_interp): Likewise.
1405 (Layout::finish_dynamic_section): Likewise.
1406 (Layout::set_dynamic_symbol_size): Likewise.
1407
1408 2011-07-08 Ian Lance Taylor <iant@google.com>
1409
1410 PR gold/12386
1411 * options.h (class General_options): Add --unresolved-symbols.
1412 * target-reloc.h (issue_undefined_symbol_error): Check
1413 --unresolved-symbols. Add comments.
1414
1415 2011-07-08 Ian Lance Taylor <iant@google.com>
1416
1417 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1418 expression more complex.
1419
1420 2011-07-08 Ian Lance Taylor <iant@google.com>
1421
1422 PR gold/11317
1423 * target-reloc.h (issue_undefined_symbol_error): New inline
1424 function, broken out of relocate_section.
1425 (relocate_section): Call issue_undefined_symbol_error.
1426 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1427 there is no TLS segment if we are about to issue an undefined
1428 symbol error.
1429 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1430
1431 2011-07-08 Ian Lance Taylor <iant@google.com>
1432
1433 PR gold/12279
1434 * resolve.cc (Symbol_table::should_override): Add fromtype
1435 parameter. Change all callers. Give error when linking together
1436 TLS and non-TLS symbol.
1437 (Symbol_table::should_override_with_special): Add fromtype
1438 parameter. Change all callers.
1439 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1440 there is no TLS segment if we have reported some errors.
1441 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1442
1443 2011-07-08 Ian Lance Taylor <iant@google.com>
1444
1445 PR gold/12372
1446 * target.h (Target::plt_address_for_global): New function.
1447 (Target::plt_address_for_local): New function.
1448 (Target::plt_section_for_global): Remove.
1449 (Target::plt_section_for_local): Remove.
1450 (Target::do_plt_address_for_global): New virtual function.
1451 (Target::do_plt_address_for_local): New virtual function.
1452 (Target::do_plt_section_for_global): Remove.
1453 (Target::do_plt_section_for_local): Remove.
1454 (Target::register_global_plt_entry): Add Symbol_table and Layout
1455 parameters.
1456 * output.cc (Output_data_got::Got_entry::write): Use
1457 plt_address_for_global and plt_address_for_local.
1458 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1459 address of output section.
1460 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1461 got_irelative_, and irelative_count_ fields. Update
1462 declarations.
1463 (Output_data_plt_i386::has_irelative_section): New function.
1464 (Output_data_plt_i386::entry_count): Add irelative_count_.
1465 (Output_data_plt_i386::set_final_data_size): Likewise.
1466 (class Target_i386): Add got_irelative_ and rel_irelative_
1467 fields. Update declarations.
1468 (Target_i386::Target_i386): Initialize new fields.
1469 (Target_i386::do_plt_address_for_global): New function replacing
1470 do_plt_section_for_global.
1471 (Target_i386::do_plt_address_for_local): New function replacing
1472 do_plt_section_for_local.
1473 (Target_i386::got_section): Create got_irelative_.
1474 (Target_i386::rel_irelative_section): New function.
1475 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1476 fields. Don't define __rel_iplt_{start,end}.
1477 (Output_data_plt_i386::add_entry): Add symtab and layout
1478 parameters. Change all callers. Use different PLT and GOT for
1479 IFUNC symbols.
1480 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1481 layout parameters. Change all callers. Use different PLT and
1482 GOT.
1483 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1484 (Output_data_plt_i386::rel_irelative): New function.
1485 (Output_data_plt_i386::address_for_global): New function.
1486 (Output_data_plt_i386::address_for_local): New function.
1487 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1488 IRELATIVE GOT when changing IFUNC GOT entries.
1489 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1490 reloc.
1491 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1492 if we didn't create an IRELATIVE GOT.
1493 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1494 plt_address_for_local.
1495 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1496 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1497 got_irelative_, and irelative_count_ fields. Update
1498 declarations.
1499 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1500 Initialize new fields. Remove symtab parameter. Change all
1501 callers.
1502 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1503 irelative_count_.
1504 (Output_data_plt_x86_64::has_irelative_section): New function.
1505 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1506 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1507 fields. Update declarations.
1508 (Target_x86_64::Target_x86_64): Initialize new fields.
1509 (Target_x86_64::do_plt_address_for_global): New function replacing
1510 do_plt_section_for_global.
1511 (Target_x86_64::do_plt_address_for_local): New function replacing
1512 do_plt_section_for_local.
1513 (Target_x86_64::got_section): Create got_irelative_.
1514 (Target_x86_64::rela_irelative_section): New function.
1515 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1516 all callers. Don't create __rel_iplt_{start,end}.
1517 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1518 parameters. Change all callers. Use different PLT and GOT for
1519 IFUNC symbols.
1520 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1521 layout parameters. Change all callers. Use different PLT and
1522 GOT.
1523 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1524 parameters. Change all callers. Use different PLT and GOT for
1525 IFUNC symbols.
1526 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1527 (Output_data_plt_x86_64::rela_irelative): New function.
1528 (Output_data_plt_x86_64::address_for_global): New function.
1529 (Output_data_plt_x86_64::address_for_local): New function.
1530 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1531 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1532 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1533 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1534 parameters.
1535 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1536 reloc.
1537 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1538 symbols if we didn't create an IRELATIVE GOT.
1539 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1540 plt_address_for_local.
1541 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1542 * testsuite/ifuncvar1.c: New test file.
1543 * testsuite/ifuncvar2.c: New test file.
1544 * testsuite/ifuncvar3.c: New test file.
1545 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1546 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1547 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1548 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1549 * testsuite/Makefile.in: Rebuild.
1550
1551 2011-07-07 Cary Coutant <ccoutant@google.com>
1552
1553 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1554 (two_file_test_1_ndebug.o): Likewise.
1555 (two_file_test_1b_ndebug.o): Likewise.
1556 (two_file_test_2_ndebug.o): Likewise.
1557 (two_file_test_main_ndebug.o): Likewise.
1558 (incremental_test_2): Link with no-debug versions.
1559
1560 2011-07-06 Cary Coutant <ccoutant@google.com>
1561
1562 * gold/incremental.cc
1563 (Output_section_incremental_inputs::write_info_blocks): Check for
1564 hidden and internal symbols.
1565
1566 2011-07-06 Cary Coutant <ccoutant@google.com>
1567
1568 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1569 Check disposition for startup file.
1570 (Incremental_inputs::report_command_line): Ignore
1571 --incremental-startup-unchanged option.
1572 * options.cc (General_options::parse_incremental_startup_unchanged):
1573 New function.
1574 (General_options::General_options): Initialize new data member.
1575 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1576 (General_options): Add --incremental-startup-unchanged option.
1577 (General_options::incremental_startup_disposition): New function.
1578 (General_options::incremental_startup_disposition_): New data member.
1579
1580 2011-07-06 Cary Coutant <ccoutant@google.com>
1581
1582 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1583 input file index to Script_info ctor.
1584 (Sized_incremental_binary::do_file_has_changed): Find the
1585 command-line argument for files named in scripts.
1586 * incremental.h (Script_info::Script_info): New ctor
1587 with input file index.
1588 (Script_info::input_file_index): New function.
1589 (Script_info::input_file_index_): New data member.
1590 (Incremental_binary::get_library): Add const.
1591 (Incremental_binary::get_script_info): Add const.
1592 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1593 * testsuite/Makefile.am (incremental_test_5): New test case.
1594 (incremental_test_6): New test case.
1595 * testsuite/Makefile.in: Regenerate.
1596
1597 2011-07-06 Cary Coutant <ccoutant@google.com>
1598
1599 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1600 debug output when command lines differ.
1601
1602 2011-07-06 Cary Coutant <ccoutant@google.com>
1603
1604 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1605 --incremental-patch option.
1606 * layout.cc (Free_list::allocate): Extend allocation beyond original
1607 end if enabled.
1608 (Layout::make_output_section): Mark sections that should get
1609 patch space.
1610 * options.cc (parse_percent): New function.
1611 * options.h (parse_percent): New function.
1612 (DEFINE_percent): New macro.
1613 (General_options): Add --incremental-patch option.
1614 * output.cc (Output_section::Output_section): Initialize new data
1615 members.
1616 (Output_section::add_input_section): Print section name when out
1617 of patch space.
1618 (Output_section::add_output_section_data): Likewise.
1619 (Output_section::set_final_data_size): Add patch space when
1620 doing --incremental-full.
1621 (Output_section::do_reset_address_and_file_offset): Remove patch
1622 space.
1623 (Output_segment::set_section_list_addresses): Print debug output
1624 only if --incremental-update.
1625 * output.h (Output_section::set_is_patch_space_allowed): New function.
1626 (Output_section::is_patch_space_allowed_): New data member.
1627 (Output_section::patch_space_): New data member.
1628 * parameters.cc (Parameters::incremental_full): New function.
1629 * parameters.h (Parameters::incremental_full): New function
1630 * testsuite/Makefile.am (incremental_test_2): Add test for
1631 --incremental-patch option.
1632 * testsuite/Makefile.in: Regenerate.
1633 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1634 (t18): Remove function body.
1635
1636 2011-07-05 Doug Kwan <dougkwan@google.com>
1637
1638 PR gold/12771
1639 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1640 Arm_Address type for relocation result.
1641 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1642 overflow check.
1643 (Arm_relocate_functions::abs32): Use unaligned access.
1644 (Arm_relocate_functions::rel32): Ditto.
1645 (Arm_relocate_functions::prel31): Ditto.
1646 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1647 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1648 static data relocations.
1649 * testsuite/Makefile.in: Regnerate.
1650 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1651
1652 2011-07-05 Ian Lance Taylor <iant@google.com>
1653
1654 PR gold/12392
1655 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1656 symbols if necessary.
1657 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1658
1659 2011-07-05 Ian Lance Taylor <iant@google.com>
1660
1661 PR gold/12952
1662 * resolve.cc (Symbol::override_base_with_special): Simply override
1663 version with special symbol version, ignoring previous version.
1664
1665 2011-07-05 Ian Lance Taylor <iant@google.com>
1666
1667 * object.cc (Sized_relobj_file::include_section_group): Add
1668 information to comment about signature location.
1669
1670 2011-07-02 Ian Lance Taylor <iant@google.com>
1671
1672 PR gold/12957
1673 * options.h (class General_options): Add -f and -F.
1674 * options.cc (General_options::finalize): Fatal error if -f/-F
1675 are used without -shared.
1676 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1677
1678 2011-07-02 Ian Lance Taylor <iant@google.com>
1679
1680 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1681
1682 2011-07-01 Ian Lance Taylor <iant@google.com>
1683
1684 PR gold/12525
1685 PR gold/12952
1686 * resolve.cc (Symbol::override_base_with_special): Don't override
1687 the version if the overriding symbol has a different name.
1688 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1689 all callers. If we give an error about an undefined version,
1690 define the base version if necessary.
1691 * dynobj.h (class Versions): Update declaration.
1692 * testsuite/weak_alias_test_5.cc: New file.
1693 * testsuite/weak_alias_test.script: New file.
1694 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1695 and versioned_alias have the right value, and call t2.
1696 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1697 weak_alias_test_5.so.
1698 (weak_alias_test_LDADD): Likewise.
1699 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1700 * testsuite/Makefile.in: Rebuild.
1701
1702 2011-07-01 Ian Lance Taylor <iant@google.com>
1703
1704 PR gold/12525
1705 * options.h (class General_options): Support -z notext.
1706 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1707 -Wl,-z,notext.
1708 (two_file_shared_nonpic.so): Likewise.
1709 (two_file_shared_mixed.so): Likewise.
1710 (two_file_shared_mixed_1.so): Likewise.
1711 (weak_undef_lib_nonpic.so): Likewise.
1712 (alt/weak_undef_lib_nonpic.so): Likewise.
1713 (tls_test_shared_nonpic.so): Likewise.
1714 * testsuite/Makefile.in: Rebuild.
1715
1716 2011-07-01 Ian Lance Taylor <iant@google.com>
1717
1718 PR gold/12525
1719 * configure.ac: Test whether static linking works, setting
1720 the automake conditional HAVE_STATIC.
1721 * testsuite/Makefile.am: Disable tests using -static if
1722 HAVE_STATIC is not true.
1723 * configure, testsuite/Makefile.in: Rebuild.
1724
1725 2011-07-01 Ian Lance Taylor <iant@google.com>
1726
1727 PR gold/12525
1728 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1729 Assert if we see DW_EH_PE_indirect.
1730 * target.h (Target::ehframe_datarel_base): New function.
1731 (Target::do_ehframe_datarel_base): New target function.
1732 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1733 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1734 function.
1735
1736 2011-07-01 Ian Lance Taylor <iant@google.com>
1737
1738 PR gold/12571
1739 * options.h (class General_options): Add
1740 --ld-generated-unwind-info.
1741 * ehframe.cc (Fde::write): Add address parameter. Change all
1742 callers. If associated with PLT, fill in address and size.
1743 (Cie::set_output_offset): Only add merge mapping if there is an
1744 object.
1745 (Cie::write): Add address parameter. Change all callers.
1746 (Eh_frame::add_ehframe_for_plt): New function.
1747 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1748 input_offset_ fields into union u_, with new plt field.
1749 (Fde::Fde): Adjust for new union field.
1750 (Fde::Fde) [Output_data version]: New constructor.
1751 (Fde::add_mapping): Only add merge mapping if there is an object.
1752 (class Cie): Update declarations.
1753 (class Eh_frame): Declare add_ehframe_for_plt.
1754 * layout.cc (Layout::layout_eh_frame): Break out code into
1755 make_eh_frame_section, and call it.
1756 (Layout::make_eh_frame_section): New function.
1757 (Layout::add_eh_frame_for_plt): New function.
1758 * layout.h (class Layout): Update declarations.
1759 * merge.cc (Merge_map::add_mapping): Add assertion.
1760 * i386.cc: Include "dwarf.h".
1761 (class Output_data_plt_i386): Make first_plt_entry,
1762 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1763 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1764 and plt_eh_frame_fde.
1765 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1766 boundary. Call add_eh_frame_for_plt if appropriate.
1767 * x86_64.cc: Include "dwarf.h".
1768 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1769 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1770 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1771 and plt_eh_frame_fde.
1772 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1773 appropriate.
1774
1775 2011-06-29 Ian Lance Taylor <iant@google.com>
1776
1777 PR gold/12629
1778 * object.cc (Sized_relobj_file::layout_section): Change shdr
1779 parameter to be const.
1780 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1781 out of do_layout.
1782 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1783 appropriate. Call layout_eh_frame_section.
1784 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1785 sections.
1786 * object.h (class Sized_relobj_file): Update declarations.
1787
1788 2011-06-29 Ian Lance Taylor <iant@google.com>
1789
1790 PR gold/12652
1791 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1792 modifier.
1793 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1794
1795 2011-06-29 Ian Lance Taylor <iant@google.com>
1796
1797 PR gold/12675
1798 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1799 SHT_X86_64_UNWIND.
1800 * layout.cc (Layout::layout_eh_frame): Likewise.
1801
1802 2011-06-29 Ian Lance Taylor <iant@google.com>
1803
1804 PR gold/12695
1805 * layout.cc (Layout::symtab_section_shndx): New function.
1806 * layout.h (class Layout): Declare symtab_section_shndx.
1807 * output.cc (Output_section::write_header): Call it.
1808
1809 2011-06-29 Ian Lance Taylor <iant@google.com>
1810
1811 PR gold/12818
1812 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1813 symbols which are not used in a relocation.
1814
1815 2011-06-28 Ian Lance Taylor <iant@google.com>
1816
1817 PR gold/12898
1818 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1819 script create indistinguishable segments.
1820 (Layout::set_segment_offsets): Use stable_sort when sorting
1821 segments. Pass this to Compare_segments constructor.
1822 * layout.h (class Layout): Make segment_precedes non-static.
1823 (class Compare_segments): Change from struct to class. Add
1824 layout_ field. Add constructor.
1825 * script-sections.cc
1826 (Script_sections::attach_sections_using_phdrs_clause): Rename
1827 local orphan to is_orphan. Don't report failure to put empty
1828 section in segment. On attachment failure, report name of
1829 section, and attach to first PT_LOAD segment.
1830
1831 2011-06-28 Ian Lance Taylor <iant@google.com>
1832
1833 PR gold/12934
1834 * target-select.cc (Target_selector::Target_selector): Add
1835 emulation parameter. Change all callers.
1836 (select_target_by_bfd_name): Rename from select_target_by_name.
1837 Change all callers.
1838 (select_target_by_emulation): New function.
1839 (supported_emulation_names): New function.
1840 * target-select.h (class Target_selector): Add emulation_ field.
1841 Update declarations.
1842 (Target_selector::recognize_by_bfd_name): Rename from
1843 recognize_by_name. Change all callers.
1844 (Target_selector::supported_bfd_names): Rename from
1845 supported_names. Change all callers.
1846 (Target_selector::recognize_by_emulation): New function.
1847 (Target_selector::supported_emulations): New function.
1848 (Target_selector::emulation): New function.
1849 (Target_selector::do_recognize_by_bfd_name): Rename from
1850 do_recognize_by_name. Change all callers.
1851 (Target_selector::do_supported_bfd_names): Rename from
1852 do_supported_names. Change all callers.
1853 (Target_selector::do_recognize_by_emulation): New function.
1854 (Target_selector::do_supported_emulations): New function.
1855 (select_target_by_bfd_name): Change name in declaration.
1856 (select_target_by_emulation): Declare.
1857 (supported_emulation_names): Declare.
1858 * parameters.cc (parameters_force_valid_target): Try to find
1859 target based on emulation from -m option.
1860 * options.h (class General_options): Change doc string for -m.
1861 * options.cc (help): Print emulations.
1862 (General_options::parse_V): Likewise.
1863 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1864 Add emulation parameter. Change all callers.
1865
1866 2011-06-28 Ian Lance Taylor <iant@google.com>
1867
1868 * target.h (class Target): Add osabi_ field.
1869 (Target::osabi): New function.
1870 (Target::set_osabi): New function.
1871 (Target::Target): Initialize osabi_.
1872 (Target::do_adjust_elf_header): Make pure virtual.
1873 (Sized_target::do_adjust_elf_header): Declare.
1874 * target.cc (Sized_target::do_adjust_elf_header): New function.
1875 (class Sized_target): Instantiate all versions.
1876 * freebsd.h (class Target_freebsd): Remove.
1877 (Target_selector_freebsd::do_recognize): Call set_osabi on
1878 Target.
1879 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1880 (Target_selector_freebsd::set_osabi): Remove.
1881 * i386.cc (class Target_i386): Inherit from Sized_target rather
1882 than Target_freebsd.
1883 * x86_64.cc (class Target_x86_64): Likewise.
1884
1885 2011-06-28 Ian Lance Taylor <iant@google.com>
1886
1887 * target.h (Target::can_check_for_function_pointers): Rewrite.
1888 Make non-virtual.
1889 (Target::can_icf_inline_merge_sections): Likewise.
1890 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1891 (Target::Target_info): Add can_icf_inline_merge_sections field.
1892 (Target::do_can_check_for_function_pointers): New virtual
1893 function.
1894 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1895 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1896 from can_check_for_function_pointers, move in file.
1897 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1898 section_may_have_icf_unsafe_poineters, move in file.
1899 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1900 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1901 Rename from can_check_for_function_pointers, move in file.
1902 (Target_i386::can_icf_inline_merge_sections): Remove.
1903 (Target_i386::i386_info): Initialize
1904 can_icf_inline_merge_sections.
1905 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1906 Initialize can_icf_inline_merge_sections.
1907 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1908 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1909 Rename from can_check_for_function_pointers, move in file.
1910 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1911 (Target_x86_64::x86_64_info): Initialize
1912 can_icf_inline_merge_sections.
1913 * testsuite/testfile.cc (Target_test::test_target_info):
1914 Likewise.
1915 * icf.cc (get_section_contents): Correct formatting.
1916
1917 2011-06-27 Ian Lance Taylor <iant@google.com>
1918
1919 * symtab.cc (Symbol::versioned_name): New function.
1920 (Symbol_table::add_to_final_symtab): Use versioned_name when
1921 appropriate.
1922 (Symbol_table::sized_write_symbol): Likewise.
1923 * symtab.h (class Symbol): Declare versioned_name.
1924 * stringpool.h (class Stringpool_template): Add variant of add
1925 which takes a std::basic_string.
1926 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1927 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1928 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1929 (ver_test_12.o): New target.
1930 * testsuite/Makefile.in: Rebuild.
1931
1932 2011-06-27 Doug Kwan <dougkwan@google.com>
1933
1934 * arm.cc (Arm_relocate_functions::thm_jump8,
1935 Arm_relocate_functions::thm_jump11): Use a wider signed
1936 type to compute offset.
1937 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1938 arm_thm_jump8.
1939 * testsuite/Makefile.in: Regenerate.
1940 * testsuite/arm_branch_in_range.sh: Check test results of
1941 arm_thm_jump11 and arm_thm_jump8.
1942 * testsuite/arm_thm_jump11.s: New test source file.
1943 * testsuite/arm_thm_jump11.t: New linker script.
1944 * testsuite/arm_thm_jump8.s: New test source file.
1945 * testsuite/arm_thm_jump8.t: New linker script.
1946
1947 2011-06-24 Ian Lance Taylor <iant@google.com>
1948
1949 * layout.cc: Include "object.h".
1950 (ctors_sections_in_init_array): New static variable.
1951 (Layout::is_ctors_in_init_array): New function.
1952 (Layout::layout): Add entry to ctors_sections_in_init_array if
1953 appropriate.
1954 * layout.h (class Layout): Declare is_ctors_in_init_array.
1955 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1956 is_ctors_reverse_view is set.
1957 (Sized_relobj_file::write_sections): Add layout parameter. Change
1958 all callers. Set is_ctors_reverse_view field of View_size.
1959 (Sized_relobj_file::reverse_words): New function.
1960 * object.h (Sized_relobj_file::View_size): Add
1961 is_ctors_reverse_view field.
1962 (class Sized_relobj_file): Update declarations.
1963 * testsuite/initpri3.c: New test.
1964 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1965 initpri3b.
1966 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1967 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1968 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1969 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1970 * testsuite/Makefile.in: Rebuild.
1971
1972 2011-06-24 Cary Coutant <ccoutant@google.com>
1973
1974 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1975 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1976 (debug_msg_cdebug.err): New targets.
1977 * testsuite/Makefile.in: Regenerate.
1978 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1979 Fix checks for link with shared library.
1980
1981 2011-06-24 Doug Kwan <dougkwan@google.com>
1982
1983 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1984 skip empty text sections.
1985 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1986
1987 2011-06-22 Ian Lance Taylor <iant@google.com>
1988
1989 PR gold/12910
1990 * options.h (class General_options): Add --ctors-in-init-array.
1991 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1992 friends as SHT_PROGBITS for merging sections.
1993 (Layout::layout): Remove special handling of .init_array and
1994 friends. Don't sort if doing relocatable link. Sort for .ctors
1995 and .dtors if ctors_in_init_array.
1996 (Layout::make_output_section): Force correct section types for
1997 .init_array and friends. Don't sort if doing relocatable link,
1998 Don't sort .ctors and .dtors if ctors_in_init_array.
1999 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2000 (Layout::output_section_name): Add relobj parameter. Change all
2001 callers. Handle .ctors. and .dtors. in code rather than table.
2002 Handle .ctors and .dtors if ctors_in_init_array.
2003 (Layout::match_file_name): New function, moved from output.cc.
2004 * layout.h (class Layout): Update declarations.
2005 * output.cc: Include "layout.h".
2006 (Input_section_sort_entry::get_priority): New function.
2007 (Input_section_sort_entry::match_file_name): Just call
2008 Layout::match_file_name.
2009 (Output_section::Input_section_sort_init_fini_compare::operator()):
2010 Handle .ctors and .dtors. Sort by explicit priority rather than
2011 by name.
2012 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2013 * testsuite/initpri2.c: New test.
2014 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2015 (check_PROGRAMS): Add initpri2.
2016 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2017 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2018 * configure, testsuite/Makefile.in: Rebuild.
2019
2020 2011-06-19 Ian Lance Taylor <iant@google.com>
2021
2022 PR gold/12880
2023 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2024 .interp section to a PT_INTERP segment even if we have seen a
2025 --dynamic-linker option. Don't do it if we have seen a PHDRS
2026 clause in a linker script.
2027 (Layout::finalize): Don't create a .interp section if we've
2028 already create a PT_INTERP segment.
2029 (Layout::create_interp): Always call choose_output_section (revert
2030 patch of 2011-06-17). Don't create PT_INTERP segment.
2031 * script-sections.cc
2032 (Script_sections::create_note_and_tls_segments): Add a .interp
2033 section to a PT_INTERP segment even if we have seen a
2034 --dynamic-linker option.
2035
2036 2011-06-18 Ian Lance Taylor <iant@google.com>
2037
2038 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2039 merely because a non-PT_LOAD segment has a dynamic reloc.
2040
2041 2011-06-18 Ian Lance Taylor <iant@google.com>
2042
2043 * layout.cc (Layout::finish_dynamic_section): Don't create
2044 DT_FLAGS entry if not needed.
2045
2046 2011-06-18 Ian Lance Taylor <iant@google.com>
2047
2048 PR gold/12745
2049 * layout.cc (Layout::layout_eh_frame): Correct handling of
2050 writable .eh_frame section.
2051
2052 2011-06-17 Ian Lance Taylor <iant@google.com>
2053
2054 PR gold/12893
2055 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2056 symbol is redefined with the exact same object and value.
2057
2058 2011-06-17 Ian Lance Taylor <iant@google.com>
2059
2060 PR gold/12880
2061 * layout.h (class Layout): Add interp_segment_ field.
2062 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2063 (Layout::attach_allocated_section_to_segment): If making shared
2064 library, put .interp section in PT_INTERP segment.
2065 (Layout::finalize): Also call create_interp if -dynamic-linker
2066 option was used.
2067 (Layout::create_interp): Assert that there is no PT_INTERP
2068 segment. If not using a SECTIONS clause, use make_output_section.
2069 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2070 * script-sections.cc
2071 (Script_sections::create_note_and_tls_segments): If making shared
2072 library, put .interp section in PT_INTERP segment.
2073
2074 2011-06-17 Ian Lance Taylor <iant@google.com>
2075
2076 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2077 when making a shared library.
2078
2079 2011-06-17 Ian Lance Taylor <iant@google.com>
2080
2081 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2082 parameter. Change all callers. Don't issue warning about PC32
2083 against locally defined symbol.
2084
2085 2011-06-16 Ian Lance Taylor <iant@google.com>
2086
2087 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2088 occurs in same object.
2089
2090 2011-06-14 Alan Modra <amodra@gmail.com>
2091
2092 * po/POTFILES.in: Regenerate.
2093
2094 2011-06-09 Ian Lance Taylor <iant@google.com>
2095
2096 * script-sections.cc
2097 (Orphan_output_section::set_section_addresses): For a relocatable
2098 link set address to 0.
2099
2100 2011-06-09 Cary Coutant <ccoutant@google.com>
2101
2102 PR gold/12804
2103 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2104 used with --compress-debug-sections.
2105 * gold/object.cc (Sized_relobj_file::do_layout): Report
2106 uncompressed size of compressed input sections.
2107
2108 2011-06-08 Cary Coutant <ccoutant@google.com>
2109
2110 PR gold/12804
2111 * testsuite/two_file_test_2_v1.cc: Change initialization of
2112 v2 to keep it in .data.
2113
2114 2011-06-07 Cary Coutant <ccoutant@google.com>
2115
2116 * common.cc (Symbol_table::do_allocate_commons_list): Call
2117 gold_fallback.
2118 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2119 (Errors::fallback): New function.
2120 (gold_fallback): New function.
2121 * errors.h (Errors::fallback): New function.
2122 * gold.cc (gold_exit): Change status parameter to enum; adjust
2123 all callers.
2124 (queue_initial_tasks): Call gold_fallback.
2125 * gold.h: Include cstdlib.
2126 (Exit_status): New enum type.
2127 (gold_exit): Change status parameter to enum.
2128 (gold_fallback): New function.
2129 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2130 (Layout::create_symtab_sections): Likewise.
2131 (Layout::create_shdrs): Likewise.
2132 * main.cc (main): Adjust call to gold_exit.
2133 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2134 (Output_data_got::add_got_entry_pair): Likewise.
2135 (Output_section::add_input_section): Likewise.
2136 (Output_section::add_output_section_data): Likewise.
2137 (Output_segment::set_section_list_addresses): Likewise.
2138 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2139
2140 2011-06-07 Cary Coutant <ccoutant@google.com>
2141
2142 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2143 for incremental links.
2144 * output.cc (Output_segment::set_section_list_addresses): Remove
2145 FIXME and test for TLS or BSS.
2146
2147 2011-06-07 Cary Coutant <ccoutant@google.com>
2148
2149 * testsuite/Makefile.am: Add incremental_copy_test,
2150 incremental_common_test_1.
2151 * testsuite/Makefile.in: Regenerate.
2152 * testsuite/common_test_1_v1.c: New source file.
2153 * testsuite/common_test_1_v2.c: New source file.
2154 * testsuite/copy_test_v1.cc: New source file.
2155
2156 2011-06-07 Cary Coutant <ccoutant@google.com>
2157
2158 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2159 update, allocate common from bss section's free list.
2160 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2161 linker-defined symbols.
2162 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2163 Skip GOT and PLT entries that are no longer referenced.
2164 (Output_section_incremental_inputs::write_info_blocks): Mark
2165 linker-defined symbols.
2166 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2167 * output.cc (Output_section::allocate): New function.
2168 * output.h (Output_section::allocate): New function.
2169 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2170 linker-defined symbols.
2171 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2172 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2173 (Symbol::init_base_output_data): Likewise.
2174 (Symbol::init_base_output_segment): Likewise.
2175 (Symbol::init_base_constant): Likewise.
2176 (Sized_symbol::init_output_data): Likewise.
2177 (Sized_symbol::init_output_segment): Likewise.
2178 (Sized_symbol::init_constant): Likewise.
2179 (Symbol_table::do_define_in_output_data): Likewise.
2180 (Symbol_table::do_define_in_output_segment): Likewise.
2181 (Symbol_table::do_define_as_constant): Likewise.
2182 * symtab.h (Symbol::is_predefined): New function.
2183 (Symbol::init_base_output_data): Add is_predefined parameter.
2184 (Symbol::init_base_output_segment): Likewise.
2185 (Symbol::init_base_constant): Likewise.
2186 (Symbol::is_predefined_): New data member.
2187 (Sized_symbol::init_output_data): Add is_predefined parameter.
2188 (Sized_symbol::init_output_segment): Likewise.
2189 (Sized_symbol::init_constant): Likewise.
2190 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2191
2192 2011-06-07 Cary Coutant <ccoutant@google.com>
2193
2194 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2195 instead of emit_copy_reloc.
2196 (Copy_relocs::emit_copy_reloc): Refactor.
2197 (Copy_relocs::make_copy_reloc): New function.
2198 (Copy_relocs::add_copy_reloc): Remove.
2199 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2200 section.
2201 (Copy_relocs::make_copy_reloc): New function.
2202 (Copy_relocs::add_copy_reloc): Remove.
2203 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2204 unchanged input files.
2205 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2206 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2207 Reserve BSS space for COPY relocations.
2208 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2209 (Output_section_incremental_inputs::write_info_blocks): Record
2210 whether a symbol is copied from a shared object.
2211 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2212 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2213 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2214 (Incremental_input_entry_reader::get_output_symbol_index): Add
2215 is_copy parameter.
2216 (Incremental_binary::emit_copy_relocs): New function.
2217 (Incremental_binary::do_emit_copy_relocs): New function.
2218 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2219 new data member.
2220 (Sized_incremental_binary::add_copy_reloc): New function.
2221 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2222 (Sized_incremental_binary::Copy_reloc): New struct.
2223 (Sized_incremental_binary::Copy_relocs): New typedef.
2224 (Sized_incremental_binary::copy_relocs_): New data member.
2225 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2226 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2227 * target.h (Sized_target::emit_copy_reloc): New function.
2228 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2229
2230 2011-06-02 Cary Coutant <ccoutant@google.com>
2231
2232 PR gold/12163
2233 * gold/archive.cc (Archive::Archive): Initialize new data member.
2234 (Archive::include_all_members): Return if archive has already been
2235 included.
2236 * gold/archive.h (Archive::include_all_members_): New data member.
2237
2238 2011-06-02 Nick Clifton <nickc@redhat.com>
2239
2240 * dynobj.h: Fix spelling mistake in comment.
2241 * output.cc: Likewise.
2242
2243 2011-05-31 Doug Kwan <dougkwan@google.com>
2244 Asier Llano
2245
2246 PR gold/12826
2247 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2248 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2249 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2250 redundant arm_exidx_test.so.
2251 * testsuite/Makefile.in: Regenerate.
2252 (check_SCRIPTS): Add pr12826.sh
2253 (check_DATA): Add pr12826.stdout
2254 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2255 * testsuite/pr12826.sh: New file.
2256 * testsuite/pr12826_1.s: Ditto.
2257 * testsuite/pr12826_1.s: Ditto.
2258
2259 2011-05-30 Ian Lance Taylor <iant@google.com>
2260
2261 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2262 sections.
2263
2264 2011-05-29 Ian Lance Taylor <iant@google.com>
2265
2266 PR gold/12804
2267 * testsuite/Makefile.am: Use different file name for two_file_test
2268 temporary file for each incremental test.
2269 * testsuite/Makefile.in: Rebuild.
2270
2271 2011-05-29 Ian Lance Taylor <iant@google.com>
2272
2273 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2274 binary input file is empty.
2275
2276 2011-05-27 Ian Lance Taylor <iant@google.com>
2277
2278 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2279 (ver_test_9.so): Likewise.
2280 * testsuite/Makefile.in: Rebuild.
2281
2282 2011-05-26 Cary Coutant <ccoutant@google.com>
2283
2284 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2285 * incremental.cc (Incremental_inputs::report_input_section): Fix
2286 comment, indentation.
2287 (Incremental_inputs::report_comdat_group): New function.
2288 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2289 of data for incremental input file entry.
2290 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2291 group count, COMDAT group signatures.
2292 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2293 an unchanged input file.
2294 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2295 Initialize new data member.
2296 (Incremental_object_entry::add_comdat_group): New function.
2297 (Incremental_object_entry::get_comdat_group_count): New function.
2298 (Incremental_object_entry::get_comdat_signature_key): New function.
2299 (Incremental_object_entry::groups_): New data member.
2300 (Incremental_inputs::report_comdat_group): New function.
2301 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2302 data for incremental input file entry.
2303 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2304 (Incremental_input_entry_reader::get_input_section): Adjust size of
2305 data for incremental input file entry.
2306 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2307 (Incremental_input_entry_reader::get_comdat_group_signature): New
2308 function.
2309 * object.cc (Sized_relobj::include_section_group): Report kept
2310 COMDAT groups for incremental links.
2311
2312 2011-05-24 David Meyer <pdox@google.com>
2313
2314 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2315 with name parameter. Add found_name parameter.
2316 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2317 * dirsearch.h (class Dirsearch): Update declaration.
2318
2319 2011-05-24 Ian Lance Taylor <iant@google.com>
2320
2321 * archive.cc (Library_base::should_include_member): Pull in object
2322 from archive if it defines the entry symbol.
2323 * parameters.cc (Parameters::entry): New function.
2324 * parameters.h (class Parameters): Declare entry.
2325 * output.h (class Output_file_header): Remove entry_ field.
2326 * output.cc (Output_file_header::Output_file_header): Remove entry
2327 parameter. Change all callers.
2328 (Output_file_header::entry): Use parameters->entry.
2329 * gold.cc (queue_middle_tasks): Likewise.
2330 * plugin.cc (Plugin_hook::run): Likewise.
2331
2332 2011-05-24 Cary Coutant <ccoutant@google.com>
2333
2334 * gold.cc (queue_initial_tasks): Pass incremental base filename
2335 to Output_file::open_base_file; don't print error message.
2336 * incremental-dump.cc (main): Adjust call to
2337 Output_file::open_for_modification.
2338 * incremental-dump.cc (main): Likewise.
2339 * incremental.cc (Incremental_inputs::report_command_line):
2340 Ignore --incremental-base option when comparing command lines.
2341 Ignore parameter when given as separate argument.
2342 * options.h (class General_options): Add --incremental-base.
2343 * output.cc (Output_file::Output_file):
2344 (Output_file::open_base_file): Add base_name and writable parameters;
2345 read base file into new file; print error message here.
2346 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2347 callers.
2348 * output.h (Output_file::open_for_modification): Rename to...
2349 (Output_file::open_base_file): ...this; add base_name and
2350 writable parameters; adjust all callers.
2351 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2352 callers.
2353 * testsuite/Makefile.am (incremental_test_4): Test
2354 --incremental-base.
2355 * testsuite/Makefile.in: Regenerate.
2356
2357 2011-05-24 Cary Coutant <ccoutant@google.com>
2358
2359 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2360 incremental_test_4.
2361 * testsuite/Makefile.in: Regenerate.
2362 * testsuite/two_file_test_1_v1.cc: New test source file.
2363 * testsuite/two_file_test_1b_v1.cc: New test source file.
2364 * testsuite/two_file_test_2_v1.cc: New test source file.
2365
2366 2011-05-24 Cary Coutant <ccoutant@google.com>
2367
2368 * dynobj.h (Dynobj::do_dynobj): New function.
2369 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2370 flag and soname for shared objects.
2371 * incremental.cc (Incremental_inputs::report_object): Make
2372 either Incremental_object_entry or Incremental_dynobj_entry; add
2373 soname to string table.
2374 (Incremental_inputs::report_input_section): Add assertion.
2375 (Output_section_incremental_inputs::set_final_data_size): Adjust
2376 type of input file entry for shared libraries; adjust size of
2377 shared library info entry.
2378 (Output_section_incremental_inputs::write_input_files): Write
2379 as_needed flag for shared libraries.
2380 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2381 of input file entry for shared libraries; write soname.
2382 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2383 soname from incremental info.
2384 * incremental.h (enum Incremental_input_flags): Add
2385 INCREMENTAL_INPUT_AS_NEEDED.
2386 (Incremental_input_entry::Incremental_input_entry): Initialize new
2387 data member.
2388 (Incremental_input_entry::set_as_needed): New function.
2389 (Incremental_input_entry::as_needed): New function.
2390 (Incremental_input_entry::do_dynobj_entry): New function.
2391 (Incremental_input_entry::as_needed_): New data member.
2392 (Incremental_object_entry::Incremental_object_entry): Don't check
2393 for shared library.
2394 (Incremental_object_entry::do_type): Likewise.
2395 (class Incremental_dynobj_entry): New class.
2396 (Incremental_input_entry_reader::as_needed): New function.
2397 (Incremental_input_entry_reader::get_soname): New function.
2398 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2399 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2400 size of shared library info entry.
2401 * layout.cc (Layout::finish_dynamic_section): Don't test for
2402 incremental link when adding DT_NEEDED entries.
2403 * object.h (Object::Object): Initialize new data member.
2404 (Object::dynobj): New function.
2405 (Object::set_as_needed): New function.
2406 (Object::as_needed): New function.
2407 (Object::do_dynobj): New function.
2408 (Object::as_needed_): New data member.
2409
2410 2011-05-24 Cary Coutant <ccoutant@google.com>
2411
2412 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2413 info; adjust display of GOT entries.
2414 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2415 vector of input objects; remove file_status_.
2416 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2417 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2418 got_plt reader; call target hooks to reserve GOT entries.
2419 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2420 of input file info header and GOT info entry.
2421 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2422 relocation info.
2423 (Got_plt_view_info::got_descriptor): Remove.
2424 (Got_plt_view_info::sym_index): New data member.
2425 (Got_plt_view_info::input_index): New data member.
2426 (Local_got_offset_visitor::visit): Write input file index.
2427 (Global_got_offset_visitor::visit): Write 0 for input file index.
2428 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2429 with sym_index and input_index.
2430 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2431 incremental info GOT entry; replace got_descriptor with input_index.
2432 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2433 map from input file index to object.
2434 (Sized_relobj_incr::do_layout): Replace direct data member reference
2435 with accessor function.
2436 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2437 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2438 Adjust size of input file info header.
2439 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2440 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2441 (Incremental_input_entry_reader::get_input_section): Adjust size of
2442 input file info header.
2443 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2444 of incremental info GOT entry.
2445 (Incremental_got_plt_reader::get_got_desc): Remove.
2446 (Incremental_got_plt_reader::get_got_symndx): New function.
2447 (Incremental_got_plt_reader::get_got_input_index): New function.
2448 (Sized_incremental_binary::Sized_incremental_binary): Remove
2449 file_status_; add input_objects_.
2450 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2451 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2452 (Sized_incremental_binary::file_is_unchanged): Remove.
2453 (Sized_incremental_binary::set_input_object): New function.
2454 (Sized_incremental_binary::input_object): New function.
2455 (Sized_incremental_binary::file_status_): Remove.
2456 (Sized_incremental_binary::input_objects_): New data member.
2457 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2458 references.
2459 (Sized_relobj_incr::invalid_address): Move to base class.
2460 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2461 class.
2462 (Sized_relobj_incr::do_output_section_offset): Likewise.
2463 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2464 (Sized_relobj_incr::section_offsets_): Likewise.
2465 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2466 function.
2467 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2468 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2469 with accessor function.
2470 (Sized_relobj_file::do_layout): Likewise.
2471 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2472 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2473 (Sized_relobj_file::compute_final_local_value): Replace refs to
2474 section_offsets_ with accessor function.
2475 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2476 * object.h (Relobj::Relobj): Initialize new data members.
2477 (Relobj::add_dyn_reloc): New function.
2478 (Relobj::first_dyn_reloc): New function.
2479 (Relobj::dyn_reloc_count): New function.
2480 (Relobj::first_dyn_reloc_): New data member.
2481 (Relobj::dyn_reloc_count_): New data member.
2482 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2483 references.
2484 (Sized_relobj::Address): New typedef.
2485 (Sized_relobj::invalid_address): Move here from child class.
2486 (Sized_relobj::Sized_relobj): Initialize new data members.
2487 (Sized_relobj::sized_relobj): New function.
2488 (Sized_relobj::is_output_section_offset_invalid): Move here from
2489 child class.
2490 (Sized_relobj::get_output_section_offset): Likewise.
2491 (Sized_relobj::local_has_got_offset): Likewise.
2492 (Sized_relobj::local_got_offset): Likewise.
2493 (Sized_relobj::set_local_got_offset): Likewise.
2494 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2495 (Sized_relobj::clear_got_offsets): New function.
2496 (Sized_relobj::section_offsets): Move here from child class.
2497 (Sized_relobj::do_output_section_offset): Likewise.
2498 (Sized_relobj::do_set_section_offset): Likewise.
2499 (Sized_relobj::Local_got_offsets): Likewise.
2500 (Sized_relobj::local_got_offsets_): Likewise.
2501 (Sized_relobj::section_offsets_): Likewise.
2502 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2503 references.
2504 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2505 class.
2506 (Sized_relobj_file::sized_relobj): New function
2507 (Sized_relobj_file::local_has_got_offset): Move to base class.
2508 (Sized_relobj_file::local_got_offset): Likewise.
2509 (Sized_relobj_file::set_local_got_offset): Likewise.
2510 (Sized_relobj_file::get_output_section_offset): Likewise.
2511 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2512 (Sized_relobj_file::do_output_section_offset): Likewise.
2513 (Sized_relobj_file::do_set_section_offset): Likewise.
2514 (Sized_relobj_file::Local_got_offsets): Likewise.
2515 (Sized_relobj_file::local_got_offsets_): Likewise.
2516 (Sized_relobj_file::section_offsets_): Likewise.
2517 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2518 (all constructors).
2519 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2520 (Output_reloc::get_symbol_index): Likewise.
2521 (Output_reloc::local_section_offset): Likewise.
2522 (Output_reloc::get_address): Likewise.
2523 (Output_reloc::symbol_value): Likewise.
2524 (Output_data_got::reserve_slot): Move to class definition.
2525 (Output_data_got::reserve_local): New function.
2526 (Output_data_got::reserve_slot_for_global): Remove.
2527 (Output_data_got::reserve_global): New function.
2528 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2529 (all constructors, two instantiations).
2530 (Output_reloc::get_relobj): New function (two instantiations).
2531 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2532 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2533 (Output_data_reloc::add_global): Adjust type of relobj.
2534 (Output_data_reloc::add_global_relative): Likewise.
2535 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2536 (Output_data_reloc::add_local): Likewise.
2537 (Output_data_reloc::add_local_relative): Likewise.
2538 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2539 (Output_data_reloc::add_local_section): Likewise.
2540 (Output_data_reloc::add_output_section): Likewise.
2541 (Output_data_reloc::add_absolute): Likewise.
2542 (Output_data_reloc::add_target_specific): Likewise.
2543 (Output_data_got::reserve_slot): Move definition here.
2544 (Output_data_got::reserve_local): New function.
2545 (Output_data_got::reserve_global): New function.
2546 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2547 section_offsets_ with accessor function.
2548 (Sized_relobj_file::write_sections): Likewise.
2549 (Sized_relobj_file::do_relocate_sections): Likewise.
2550 * target.h (Sized_target::reserve_local_got_entry): New function.
2551 (Sized_target::reserve_global_got_entry): New function.
2552 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2553 (Target_x86_64::reserve_global_got_entry): New function.
2554 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2555
2556 2011-05-23 Cary Coutant <ccoutant@google.com>
2557
2558 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2559 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2560 bit when checking got_type.
2561 * incremental.cc (Sized_incremental_binary::setup_readers):
2562 Store symbol table and string table locations; initialize bit vector
2563 of file status flags.
2564 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2565 unchanged files.
2566 (Sized_incremental_binary::do_process_got_plt): New function.
2567 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2568 (Output_section_incremental_inputs::set_final_data_size): Record
2569 file index for each input file.
2570 (Output_section_incremental_inputs::write_got_plt): Store file index
2571 instead of input entry offset for each GOT entry.
2572 * incremental.h
2573 (Incremental_input_entry::Incremental_input_entry): Initialize new
2574 data member.
2575 (Incremental_input_entry::set_offset): Store file index.
2576 (Incremental_input_entry::get_file_index): New function.
2577 (Incremental_input_entry::file_index_): New data member.
2578 (Incremental_binary::process_got_plt): New function.
2579 (Incremental_binary::do_process_got_plt): New function.
2580 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2581 data members.
2582 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2583 (Sized_incremental_binary::set_file_is_unchanged): New function.
2584 (Sized_incremental_binary::file_is_unchanged): New function.
2585 (Sized_incremental_binary::do_process_got_plt): New function.
2586 (Sized_incremental_binary::file_status_): New data member.
2587 (Sized_incremental_binary::main_symtab_loc_): New data member.
2588 (Sized_incremental_binary::main_strtab_loc_): New data member.
2589 * output.cc (Output_data_got::Got_entry::write): Add case
2590 RESERVED_CODE.
2591 (Output_data_got::add_global): Call add_got_entry.
2592 (Output_data_got::add_global_plt): Likewise.
2593 (Output_data_got::add_global_with_rel): Likewise.
2594 (Output_data_got::add_global_with_rela): Likewise.
2595 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2596 (Output_data_got::add_global_pair_with_rela): Likewise.
2597 (Output_data_got::add_local): Call add_got_entry.
2598 (Output_data_got::add_local_plt): Likewise.
2599 (Output_data_got::add_local_with_rel): Likewise.
2600 (Output_data_got::add_local_with_rela): Likewise.
2601 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2602 (Output_data_got::add_local_pair_with_rela): Likewise.
2603 (Output_data_got::reserve_slot): New function.
2604 (Output_data_got::reserve_slot_for_global): New function.
2605 (Output_data_got::add_got_entry): New function.
2606 (Output_data_got::add_got_entry_pair): New function.
2607 (Output_section::add_output_section_data): Edit FIXME.
2608 * output.h
2609 (Output_section_data_build::Output_section_data_build): New
2610 constructor with size parameter.
2611 (Output_data_space::Output_data_space): Likewise.
2612 (Output_data_got::Output_data_got): Initialize new data member; new
2613 constructor with size parameter.
2614 (Output_data_got::add_constant): Call add_got_entry.
2615 (Output_data_got::reserve_slot): New function.
2616 (Output_data_got::reserve_slot_for_global): New function.
2617 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2618 (Output_data_got::add_got_entry): New function.
2619 (Output_data_got::add_got_entry_pair): New function.
2620 (Output_data_got::free_list_): New data member.
2621 * target.h (Sized_target::init_got_plt_for_update): New function.
2622 (Sized_target::register_global_plt_entry): New function.
2623 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2624 Initialize new data member; call init; add constructor with PLT count.
2625 (Output_data_plt_x86_64::init): New function.
2626 (Output_data_plt_x86_64::add_relocation): New function.
2627 (Output_data_plt_x86_64::reserve_slot): New function.
2628 (Output_data_plt_x86_64::free_list_): New data member.
2629 (Target_x86_64::init_got_plt_for_update): New function.
2630 (Target_x86_64::register_global_plt_entry): New function.
2631 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2632 incremental updates.
2633 (Output_data_plt_x86_64::add_relocation): New function.
2634 * testsuite/object_unittest.cc (Object_test): Set default options.
2635
2636 2011-05-16 Ian Lance Taylor <iant@google.com>
2637
2638 * options.h (class General_options): Make -i a synonym for -r.
2639
2640 2011-05-16 Ian Lance Taylor <iant@google.com>
2641
2642 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2643
2644 2011-05-10 Cary Coutant <ccoutant@google.com>
2645
2646 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2647 strip_all (-s).
2648
2649 2011-05-06 Ian Lance Taylor <iant@google.com>
2650
2651 * layout.cc (Layout::layout): If the output section flags change,
2652 update the ordering.
2653
2654 2011-04-25 Cary Coutant <ccoutant@google.com>
2655
2656 * incremental-dump.cc (dump_incremental_inputs): Print local
2657 symbol info for each input file.
2658 * incremental.cc
2659 (Output_section_incremental_inputs::set_final_data_size): Add local
2660 symbol info to input file entries in incremental info.
2661 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2662 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2663 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2664 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2665 implementation.
2666 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2667 (Sized_incr_relobj::do_relocate): Write the local symbols.
2668 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2669 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2670 Adjust size of input file header.
2671 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2672 (Incremental_inputs_reader::get_local_symbol_count): New function.
2673 (Incremental_inputs_reader::get_input_section): Adjust size of input
2674 file header.
2675 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2676 (Sized_incr_relobj::This): New typedef.
2677 (Sized_incr_relobj::sym_size): New const data member.
2678 (Sized_incr_relobj::Local_symbol): New struct.
2679 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2680 (Sized_incr_relobj::do_local_symbol_offset): New function.
2681 (Sized_incr_relobj::local_symbol_count_): New data member.
2682 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2683 (Sized_incr_relobj::local_symbol_index_): New data member.
2684 (Sized_incr_relobj::local_symbol_offset_): New data member.
2685 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2686 (Sized_incr_relobj::local_symbols_): New data member.
2687 * object.h (Relobj::output_local_symbol_count): New function.
2688 (Relobj::local_symbol_offset): New function.
2689 (Relobj::do_output_local_symbol_count): New function.
2690 (Relobj::do_local_symbol_offset): New function.
2691 (Sized_relobj::do_output_local_symbol_count): New function.
2692 (Sized_relobj::do_local_symbol_offset): New function.
2693
2694 2011-04-22 Vladimir Simonov <sv@sw.ru>
2695
2696 * descriptors.cc (set_close_on_exec): New function.
2697 (Descriptors::open): Use set_close_on_exec.
2698 * output.cc (S_ISLNK): Define if not defined.
2699
2700 2011-04-22 Cary Coutant <ccoutant@google.com>
2701
2702 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2703 global symbol map.
2704 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2705 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2706 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2707 relocations.
2708 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2709 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2710 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2711 * incremental.h
2712 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2713 function.
2714 (Incremental_binary::apply_incremental_relocs): New function.
2715 (Incremental_binary::do_apply_incremental_relocs): New function.
2716 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2717 data member.
2718 (Sized_incremental_binary::add_global_symbol): New function.
2719 (Sized_incremental_binary::global_symbol): New function.
2720 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2721 (Sized_incremental_binary::symbol_map_): New data member.
2722 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2723 * target.h (Sized_target::apply_relocation): New function.
2724 * target-reloc.h (apply_relocation): New function.
2725 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2726
2727 2011-04-22 Doug Kwan <dougkwan@google.com>
2728
2729 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2730 flag of a SHT_ARM_EXIDX section.
2731 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2732 * testsuite/Makefile.in: Regenerate.
2733 * testsuite/arm_exidx_test.s: New file.
2734 * testsuite/arm_exidx_test.sh: Same.
2735
2736 2011-04-20 Cary Coutant <ccoutant@google.com>
2737
2738 PR gold/12689
2739 * archive.h (Incremental_archive_entry::Archive_member):
2740 Initialize arg_serial_ (second constructor).
2741
2742 2011-04-17 Ian Lance Taylor <iant@google.com>
2743
2744 * object.cc (Relocate_info::location): Simplify location string.
2745 * errors.cc (Errors::error_at_location): Don't print program
2746 name.
2747 (Errors::warning_at_location): Likewise.
2748 (Errors::undefined_symbol): Likewise.
2749 * testsuite/debug_msg.sh: Update accordingly.
2750
2751 2011-04-14 Cary Coutant <ccoutant@google.com>
2752
2753 * gold/layout.cc (Layout::symtab_section_offset): New function.
2754 * gold/layout.h (Layout::symtab_section_offset): New function.
2755 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2756
2757 2011-04-12 Ian Lance Taylor <iant@google.com>
2758
2759 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2760 with MREMAP_MAYMOVE.
2761 * output.h (class Output_file): Add map_is_allocated_ field.
2762 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2763 not available, provide stubs. If mremap is not available, #define
2764 it to gold_mremap.
2765 (MREMAP_MAYMOVE): Define if not defined.
2766 (Output_file::Output_file): Initialize map_is_allocated_.
2767 (Output_file::resize): Check map_is_allocated_.
2768 (Output_file::map_anonymous): If mmap fails, use malloc.
2769 (Output_file::unmap): Don't do anything for an anonymous map.
2770 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2771 is not available, provide stubs.
2772 (File_read::View::~View): Use free rather than delete[].
2773 (File_read::make_view): Use malloc rather than new[]. If mmap
2774 fails, use malloc.
2775 (File_read::find_or_make_view): Use malloc rather than new[].
2776 * gold.h: Remove HAVE_REMAP code.
2777 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2778 exists. Rename mremap to gold_mremap. If mmap is not available
2779 don't do anything.
2780 * configure, config.in: Rebuild.
2781
2782 2011-04-11 Ian Lance Taylor <iant@google.com>
2783
2784 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2785 initialize local variable v.
2786
2787 2011-04-11 Cary Coutant <ccoutant@google.com>
2788
2789 * archive.cc (Archive::include_member): Adjust call to
2790 report_object.
2791 (Add_archive_symbols::run): Track argument serial numbers.
2792 (Lib_group::include_member): Likewise.
2793 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2794 * archive.h (Incremental_archive_entry::Archive_member):
2795 Initialize arg_serial_.
2796 (Archive_member::arg_serial_): New data member.
2797 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2798 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2799 incremental link.
2800 (Sized_dynobj::do_for_all_local_got_entries): New function.
2801 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2802 function.
2803 * fileread.cc (get_mtime): New function.
2804 * fileread.h (get_mtime): New function.
2805 * gold.cc (queue_initial_tasks): Check for incremental update.
2806 (process_incremental_input): New function.
2807 (queue_middle_tasks): Don't force valid target for incremental
2808 update.
2809 * incremental-dump.cc (find_input_containing_global): Adjust
2810 size of symbol info entry.
2811 (dump_incremental_inputs): Dump argument serial number and
2812 in_system_directory flag; bias shndx by 1; print symbol names
2813 when dumping per-file symbol lists; use new symbol info readers.
2814 * incremental.cc
2815 (Output_section_incremental_inputs:update_data_size): New function.
2816 (Sized_incremental_binary::setup_readers): Setup input readers
2817 for each input file; build maps for files added from libraries
2818 and scripts.
2819 (Sized_incremental_binary::check_input_args): New function.
2820 (Sized_incremental_binary::do_check_inputs): Build map of argument
2821 serial numbers to input arguments.
2822 (Sized_incremental_binary::do_file_has_changed): Rename
2823 do_file_is_unchanged to this; compare file modification times.
2824 (Sized_incremental_binary::do_init_layout): New function.
2825 (Sized_incremental_binary::do_reserve_layout): New function.
2826 (Sized_incremental_binary::do_get_input_reader): Remove.
2827 (Sized_incremental_binary::get_symtab_view): New function.
2828 (Incremental_checker::can_incrementally_link_output_file): Remove.
2829 (Incremental_inputs::report_command_line): Exclude --debug options.
2830 (Incremental_inputs::report_archive_begin): Add parameter; track
2831 argument serial numbers; don't put input file entry for archive
2832 before archive members.
2833 (Incremental_inputs::report_archive_end): Put input file entry
2834 for archive after archive members.
2835 (Incremental_inputs::report_object): Add parameter; track argument
2836 serial numbers and in_system_directory flag.
2837 (Incremental_inputs::report_script): Add parameter; track argument
2838 serial numbers.
2839 (Output_section_incremental_inputs::set_final_data_size): Adjust
2840 size of symbol info entry; check for forwarding symbols.
2841 (Output_section_incremental_inputs::write_input_files): Write
2842 in_system_directory flag and argument serial number.
2843 (Output_section_incremental_inputs::write_info_blocks): Map section
2844 indices between incremental info and original input file; store
2845 input section index for each symbol.
2846 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2847 change operator() to visit().
2848 (class Global_got_offset_visitor): Likewise.
2849 (class Global_symbol_visitor_got_plt):
2850 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2851 classes.
2852 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2853 (Sized_incr_relobj::do_read_symbols): New function.
2854 (Sized_incr_relobj::do_layout): New function.
2855 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2856 (Sized_incr_relobj::do_add_symbols): New function.
2857 (Sized_incr_relobj::do_should_include_member): New function.
2858 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2859 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2860 (Sized_incr_relobj::do_section_size): New function.
2861 (Sized_incr_relobj::do_section_name): New function.
2862 (Sized_incr_relobj::do_section_contents): New function.
2863 (Sized_incr_relobj::do_section_flags): New function.
2864 (Sized_incr_relobj::do_section_entsize): New function.
2865 (Sized_incr_relobj::do_section_address): New function.
2866 (Sized_incr_relobj::do_section_type): New function.
2867 (Sized_incr_relobj::do_section_link): New function.
2868 (Sized_incr_relobj::do_section_info): New function.
2869 (Sized_incr_relobj::do_section_addralign): New function.
2870 (Sized_incr_relobj::do_initialize_xindex): New function.
2871 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2872 (Sized_incr_relobj::do_read_relocs): New function.
2873 (Sized_incr_relobj::do_gc_process_relocs): New function.
2874 (Sized_incr_relobj::do_scan_relocs): New function.
2875 (Sized_incr_relobj::do_count_local_symbols): New function.
2876 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2877 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2878 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2879 (Sized_incr_relobj::do_relocate): New function.
2880 (Sized_incr_relobj::do_set_section_offset): New function.
2881 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2882 (Sized_incr_dynobj::do_read_symbols): New function.
2883 (Sized_incr_dynobj::do_layout): New function.
2884 (Sized_incr_dynobj::do_add_symbols): New function.
2885 (Sized_incr_dynobj::do_should_include_member): New function.
2886 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2887 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2888 (Sized_incr_dynobj::do_section_size): New function.
2889 (Sized_incr_dynobj::do_section_name): New function.
2890 (Sized_incr_dynobj::do_section_contents): New function.
2891 (Sized_incr_dynobj::do_section_flags): New function.
2892 (Sized_incr_dynobj::do_section_entsize): New function.
2893 (Sized_incr_dynobj::do_section_address): New function.
2894 (Sized_incr_dynobj::do_section_type): New function.
2895 (Sized_incr_dynobj::do_section_link): New function.
2896 (Sized_incr_dynobj::do_section_info): New function.
2897 (Sized_incr_dynobj::do_section_addralign): New function.
2898 (Sized_incr_dynobj::do_initialize_xindex): New function.
2899 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2900 (make_sized_incremental_object): New function.
2901 (Incremental_library::copy_unused_symbols): New function.
2902 (Incremental_library::do_for_all_unused_symbols): New function.
2903 * incremental.h (enum Incremental_input_flags): New type.
2904 (class Incremental_checker): Remove.
2905 (Incremental_input_entry::Incremental_input_entry): Add argument
2906 serial number.
2907 (Incremental_input_entry::arg_serial): New function.
2908 (Incremental_input_entry::set_is_in_system_directory): New function.
2909 (Incremental_input_entry::is_in_system_directory): New function.
2910 (Incremental_input_entry::arg_serial_): New data member.
2911 (Incremental_input_entry::is_in_system_directory_): New data member.
2912 (class Script_info): Move here from script.h.
2913 (Script_info::Script_info): Add filename parameter.
2914 (Script_info::filename): New function.
2915 (Script_info::filename_): New data member.
2916 (Incremental_script_entry::Incremental_script_entry): Add argument
2917 serial number.
2918 (Incremental_object_entry::Incremental_object_entry): Likewise.
2919 (Incremental_object_entry::add_input_section): Build list of input
2920 sections with map to original shndx.
2921 (Incremental_object_entry::get_input_section_index): New function.
2922 (Incremental_object_entry::shndx_): New data member.
2923 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2924 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2925 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2926 serial number.
2927 (Incremental_inputs::report_archive_begin): Likewise.
2928 (Incremental_inputs::report_object): Likewise.
2929 (Incremental_inputs::report_script): Likewise.
2930 (class Incremental_global_symbol_reader): New class.
2931 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2932 and store flags and input file type.
2933 (Incremental_input_entry_reader::arg_serial): New function.
2934 (Incremental_input_entry_reader::type): Extract type from flags.
2935 (Incremental_input_entry_reader::is_in_system_directory): New function.
2936 (Incremental_input_entry_reader::get_input_section_count): Call
2937 accessor function for type.
2938 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2939 function for type; adjust size of global symbol entry.
2940 (Incremental_input_entry_reader::get_global_symbol_count): Call
2941 accessor function for type.
2942 (Incremental_input_entry_reader::get_object_count): Likewise.
2943 (Incremental_input_entry_reader::get_object_offset): Likewise.
2944 (Incremental_input_entry_reader::get_member_count): Likewise.
2945 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2946 (Incremental_input_entry_reader::get_member_offset): Likewise.
2947 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2948 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2949 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2950 (Incremental_input_entry_reader::get_global_symbol_reader): New
2951 function.
2952 (Incremental_input_entry_reader::get_output_symbol_index): New
2953 function.
2954 (Incremental_input_entry_reader::type_): Remove.
2955 (Incremental_input_entry_reader::flags_): New data member.
2956 (Incremental_inputs_reader::input_file_offset): New function.
2957 (Incremental_inputs_reader::input_file_index): New function.
2958 (Incremental_inputs_reader::input_file): Call input_file_offset.
2959 (Incremental_inputs_reader::input_file_at_offset): New function.
2960 (Incremental_relocs_reader::get_r_type): Reformat.
2961 (Incremental_relocs_reader::get_r_shndx): Reformat.
2962 (Incremental_relocs_reader::get_r_offset): Reformat.
2963 (Incremental_relocs_reader::data): New function.
2964 (Incremental_binary::Incremental_binary): Initialize new data members.
2965 (Incremental_binary::check_inputs): Add cmdline parameter.
2966 (Incremental_binary::file_is_unchanged): Remove.
2967 (Input_reader::arg_serial): New function.
2968 (Input_reader::get_unused_symbol_count): New function.
2969 (Input_reader::get_unused_symbol): New function.
2970 (Input_reader::do_arg_serial): New function.
2971 (Input_reader::do_get_unused_symbol_count): New function.
2972 (Input_reader::do_get_unused_symbol): New function.
2973 (Incremental_binary::input_file_count): New function.
2974 (Incremental_binary::get_input_reader): Change signature to use
2975 index instead of filename.
2976 (Incremental_binary::file_has_changed): New function.
2977 (Incremental_binary::get_input_argument): New function.
2978 (Incremental_binary::get_library): New function.
2979 (Incremental_binary::get_script_info): New function.
2980 (Incremental_binary::init_layout): New function.
2981 (Incremental_binary::reserve_layout): New function.
2982 (Incremental_binary::output_file): New function.
2983 (Incremental_binary::do_check_inputs): New function.
2984 (Incremental_binary::do_file_is_unchanged): Remove.
2985 (Incremental_binary::do_file_has_changed): New function.
2986 (Incremental_binary::do_init_layout): New function.
2987 (Incremental_binary::do_reserve_layout): New function.
2988 (Incremental_binary::do_input_file_count): New function.
2989 (Incremental_binary::do_get_input_reader): Change signature.
2990 (Incremental_binary::input_args_map_): New data member.
2991 (Incremental_binary::library_map_): New data member.
2992 (Incremental_binary::script_map_): New data member.
2993 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2994 new data members.
2995 (Sized_incremental_binary::output_section): New function.
2996 (Sized_incremental_binary::inputs_reader): Add const.
2997 (Sized_incremental_binary::symtab_reader): Add const.
2998 (Sized_incremental_binary::relocs_reader): Add const.
2999 (Sized_incremental_binary::got_plt_reader): Add const.
3000 (Sized_incremental_binary::get_symtab_view): New function.
3001 (Sized_incremental_binary::Inputs_reader): New typedef.
3002 (Sized_incremental_binary::Input_entry_reader): New typedef.
3003 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3004 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3005 (Sized_incremental_binary::do_file_has_changed): New function.
3006 (Sized_incremental_binary::do_init_layout): New function.
3007 (Sized_incremental_binary::do_reserve_layout): New function.
3008 (Sized_input_reader::Inputs_reader): Remove.
3009 (Sized_input_reader::Input_entry_reader): Remove.
3010 (Sized_input_reader::do_arg_serial): New function.
3011 (Sized_input_reader::do_get_unused_symbol_count): New function.
3012 (Sized_input_reader::do_get_unused_symbol): New function.
3013 (Sized_incremental_binary::do_input_file_count): New function.
3014 (Sized_incremental_binary::do_get_input_reader): Change signature;
3015 use index instead of filename.
3016 (Sized_incremental_binary::section_map_): New data member.
3017 (Sized_incremental_binary::input_entry_readers_): New data member.
3018 (class Sized_incr_relobj): New class.
3019 (class Sized_incr_dynobj): New class.
3020 (make_sized_incremental_object): New function.
3021 (class Incremental_library): New class.
3022 * layout.cc (Free_list::num_lists): New static data member.
3023 (Free_list::num_nodes): New static data member.
3024 (Free_list::num_removes): New static data member.
3025 (Free_list::num_remove_visits): New static data member.
3026 (Free_list::num_allocates): New static data member.
3027 (Free_list::num_allocate_visits): New static data member.
3028 (Free_list::init): New function.
3029 (Free_list::remove): New function.
3030 (Free_list::allocate): New function.
3031 (Free_list::dump): New function.
3032 (Free_list::print_stats): New function.
3033 (Layout_task_runner::run): Resize output file for incremental updates.
3034 (Layout::Layout): Initialize new data members.
3035 (Layout::set_incremental_base): New function.
3036 (Layout::init_fixed_output_section): New function.
3037 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3038 incremental updates.
3039 (Layout::create_gold_note): Do not create gold note section for
3040 incremental updates.
3041 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3042 for incremental updates.
3043 (Layout::set_section_offsets): For incremental updates, allocate space
3044 from free list.
3045 (Layout::create_symtab_sections): Layout with offsets relative to
3046 start of section; for incremental updates, allocate space from free
3047 list.
3048 (Layout::create_shdrs): For incremental updates, allocate space from
3049 free list.
3050 (Layout::finish_dynamic_section): For incremental updates, do not
3051 check --as-needed (fixed in subsequent patch).
3052 * layout.h (class Free_list): New class.
3053 (Layout::set_incremental_base): New function.
3054 (Layout::incremental_base): New function.
3055 (Layout::init_fixed_output_section): New function.
3056 (Layout::allocate): New function.
3057 (Layout::incremental_base_): New data member.
3058 (Layout::free_list_): New data member.
3059 * main.cc (main): Print Free_list statistics.
3060 * object.cc (Relobj::finalize_incremental_relocs): Add
3061 clear_counts parameter; clear counts only when clear_counts is set.
3062 (Sized_relobj::Sized_relobj): Initialize new base class.
3063 (Sized_relobj::do_layout): Don't report special sections.
3064 (Sized_relobj::do_for_all_local_got_entries): New function.
3065 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3066 symtab_off to all symbol table offsets.
3067 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3068 * object.h (class Got_offset_list): Move to top of file.
3069 (Object::Object): Allow case where input_file == NULL.
3070 (Object::~Object): Likewise.
3071 (Object::input_file): Assert that input_file != NULL.
3072 (Object::lock): Allow case where input_file == NULL.
3073 (Object::unlock): Likewise.
3074 (Object::is_locked): Likewise.
3075 (Object::token): Likewise.
3076 (Object::release): Likewise.
3077 (Object::is_incremental): New function.
3078 (Object::get_mtime): New function.
3079 (Object::for_all_local_got_entries): New function.
3080 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3081 (Object::set_is_in_system_directory): New function.
3082 (Object::is_in_system_directory): New function.
3083 (Object::do_is_incremental): New function.
3084 (Object::do_get_mtime): New function.
3085 (Object::do_for_all_local_got_entries): New function.
3086 (Object::is_in_system_directory_): New data member.
3087 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3088 (class Sized_relobj_base): New class.
3089 (class Sized_relobj): Derive from Sized_relobj_base.
3090 (class Sized_relobj::Symbols): Redeclare from base class.
3091 (class Sized_relobj::local_got_offset_list): Remove.
3092 (class Sized_relobj::Output_sections): Redeclare from base class.
3093 (class Sized_relobj::do_for_all_local_got_entries): New function.
3094 (class Sized_relobj::write_local_symbols): Add offset parameter.
3095 (class Sized_relobj::local_symbol_offset_): Update comment.
3096 (class Sized_relobj::local_dynsym_offset_): Update comment.
3097 * options.cc (Input_arguments::add_file): Remove const.
3098 * options.h (Input_file_argument::Input_file_argument):
3099 Initialize arg_serial_ (all constructors).
3100 (Input_file_argument::set_arg_serial): New function.
3101 (Input_file_argument::arg_serial): New function.
3102 (Input_file_argument::arg_serial_): New data member.
3103 (Input_arguments::Input_arguments): Initialize file_count_.
3104 (Input_arguments::add_file): Remove const.
3105 (Input_arguments::number_of_input_files): New function.
3106 (Input_arguments::file_count_): New data member.
3107 (Command_line::number_of_input_files): Call
3108 Input_arguments::number_of_input_files.
3109 * output.cc (Output_segment_headers::Output_segment_headers):
3110 Set current size.
3111 (Output_section::Input_section::current_data_size): New function.
3112 (Output_section::Output_section): Initialize new data members.
3113 (Output_section::add_input_section): Don't do merge sections for
3114 an incremental link; allocate space from free list for an
3115 incremental update.
3116 (Output_section::add_output_section_data): Allocate space from
3117 free list for an incremental update.
3118 (Output_section::update_data_size): New function.
3119 (Output_section::set_fixed_layout): New function.
3120 (Output_section::reserve): New function.
3121 (Output_segment::set_section_addresses): Remove const.
3122 (Output_segment::set_section_list_addresses): Remove const; allocate
3123 space from free list for an incremental update.
3124 (Output_segment::set_offset): Adjust size of RELRO segment for an
3125 incremental update.
3126 * output.h (Output_data::current_data_size): Move here from
3127 child classes.
3128 (Output_data::pre_finalize_data_size): New function.
3129 (Output_data::update_data_size): New function.
3130 (Output_section_headers::update_data_size): new function.
3131 (Output_section_data_build::current_data_size): Move to Output_data.
3132 (Output_data_strtab::update_data_size): New function.
3133 (Output_section::current_data_size): Move to Output_data.
3134 (Output_section::set_fixed_layout): New function.
3135 (Output_section::has_fixed_layout): New function.
3136 (Output_section::reserve): New function.
3137 (Output_section::update_data_size): New function.
3138 (Output_section::has_fixed_layout_): New data member.
3139 (Output_section::free_list_): New data member.
3140 (Output_segment::set_section_addresses): Remove const.
3141 (Output_segment::set_section_list_addresses): Remove const.
3142 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3143 New function.
3144 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3145 New function.
3146 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3147 parameter when calling Add_symbols constructor; store argument
3148 serial number for members of a lib group.
3149 (Add_symbols::locks): Allow case where token == NULL.
3150 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3151 (Read_member::~Read_member): New function.
3152 (Read_member::is_runnable): New function.
3153 (Read_member::locks): New function.
3154 (Read_member::run): New function.
3155 (Check_script::~Check_script): New function.
3156 (Check_script::is_runnable): New function.
3157 (Check_script::locks): New function.
3158 (Check_script::run): New function.
3159 (Check_library::~Check_library): New function.
3160 (Check_library::is_runnable): New function.
3161 (Check_library::locks): New function.
3162 (Check_library::run): New function.
3163 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3164 (Add_symbols::library_): New data member.
3165 (class Read_member): New class.
3166 (class Check_script): New class.
3167 (class Check_library): New class.
3168 * reloc.cc (Read_relocs::is_runnable): Allow case where
3169 token == NULL.
3170 (Read_relocs::locks): Likewise.
3171 (Scan_relocs::locks): Likewise.
3172 (Relocate_task::locks): Likewise.
3173 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3174 to clear counters.
3175 (Sized_relobj::incremental_relocs_scan): Fix comment.
3176 (Sized_relobj::do_relocate): Pass output file offset to
3177 write_local_symbols.
3178 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3179 from class declaration.
3180 * script.cc (read_input_script): Allocate Script_info; pass
3181 argument serial number to report_script.
3182 * script.h (class Script_info): Move to incremental.h.
3183 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3184 * symtab.h (Symbol_table::add_from_incrobj): New function.
3185 (Symbol_table::set_file_offset): New function.
3186
3187 2011-04-05 Cary Coutant <ccoutant@google.com>
3188
3189 * incremental-dump.cc (dump_incremental_inputs): Change signature
3190 to take a Sized_incremental_binary; change caller. Use readers
3191 in Sized_incremental_binary.
3192 * incremental.cc
3193 (Sized_incremental_binary::find_incremental_inputs_sections):
3194 Rename do_find_incremental_inputs_sections to this.
3195 (Sized_incremental_binary::setup_readers): New function.
3196 (Sized_incremental_binary::do_check_inputs): Check
3197 has_incremental_info_ flag; move setup code to setup_readers;
3198 use input readers.
3199 (Sized_incremental_binary::do_file_is_unchanged): New function.
3200 (Sized_incremental_binary::do_get_input_reader): New function.
3201 * incremental.h (class Incremental_binary): Move to end of file.
3202 (Incremental_binary::file_is_unchanged): New function.
3203 (Incremental_binary::do_file_is_unchanged): New function.
3204 (Incremental_binary::Input_reader): New class.
3205 (Incremental_binary::get_input_reader): New function.
3206 (class Sized_incremental_binary): Move to end of file.
3207 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3208 input section reader classes.
3209 (Sized_incremental_binary::has_incremental_info): New function.
3210 (Sized_incremental_binary::inputs_reader): New function.
3211 (Sized_incremental_binary::symtab_reader): New function.
3212 (Sized_incremental_binary::relocs_reader): New function.
3213 (Sized_incremental_binary::got_plt_reader): New function.
3214 (Sized_incremental_binary::do_file_is_unchanged): New function.
3215 (Sized_incremental_binary::Sized_input_reader): New class.
3216 (Sized_incremental_binary::get_input_reader): New function.
3217 (Sized_incremental_binary::find_incremental_inputs_sections):
3218 Rename do_find_incremental_inputs_sections to this.
3219 (Sized_incremental_binary::setup_readers): New function.
3220 (Sized_incremental_binary::has_incremental_info_): New data member.
3221 (Sized_incremental_binary::inputs_reader_): New data member.
3222 (Sized_incremental_binary::symtab_reader_): New data member.
3223 (Sized_incremental_binary::relocs_reader_): New data member.
3224 (Sized_incremental_binary::got_plt_reader_): New data member.
3225 (Sized_incremental_binary::current_input_file_): New data member.
3226
3227 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3228
3229 PR gold/12640
3230 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3231 violation.
3232
3233 2011-03-30 Cary Coutant <ccoutant@google.com>
3234
3235 * archive.cc (Archive::include_member): Adjust call to report_object.
3236 (Add_archive_symbols::run): Add script_info to call to
3237 report_archive_begin.
3238 (Lib_group::include_member): Adjust call to report_object.
3239 (Add_lib_group_symbols::run): Adjust call to report_object.
3240 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3241 blocks. Add object count for script input files.
3242 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3243 script_info parameter; change all callers.
3244 (Incremental_inputs::report_object): Add script_info parameter;
3245 change all callers.
3246 (Incremental_inputs::report_script): Store backpointer to
3247 incremental info entry.
3248 (Output_section_incremental_inputs::set_final_data_size): Record
3249 additional information for scripts.
3250 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3251 * incremental.h (Incremental_script_entry::add_object): New function.
3252 (Incremental_script_entry::get_object_count): New function.
3253 (Incremental_script_entry::get_object): New function.
3254 (Incremental_script_entry::objects_): New data member; adjust
3255 constructor.
3256 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3257 (Incremental_inputs::report_object): Add script_info parameter.
3258 (Incremental_inputs_reader::get_object_count): New function.
3259 (Incremental_inputs_reader::get_object_offset): New function.
3260 * options.cc (Input_arguments::add_file): Return reference to
3261 new input argument.
3262 * options.h (Input_argument::set_script_info): New function.
3263 (Input_argument::script_info): New function.
3264 (Input_argument::script_info_): New data member; adjust all
3265 constructors.
3266 (Input_file_group::add_file): Return reference to new input argument.
3267 (Input_file_lib::add_file): Likewise.
3268 (Input_arguments::add_file): Likewise.
3269 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3270 * script.cc (Parser_closure::Parser_closure): Add script_info
3271 parameter; adjust all callers.
3272 (Parser_closure::script_info): New function.
3273 (Parser_closure::script_info_): New data member.
3274 (read_input_script): Report scripts earlier to incremental info.
3275 (script_add_file): Set script_info in Input_argument.
3276 (script_add_library): Likewise.
3277 * script.h (Script_options::Script_info): Rewrite class.
3278
3279 2011-03-29 Cary Coutant <ccoutant@google.com>
3280
3281 * archive.cc (Library_base::should_include_member): Move
3282 method here from class Archive.
3283 (Archive::Archive): Initialize base class.
3284 (Archive::should_include_member): Move to base class.
3285 (Archive::do_for_all_unused_symbols): New function.
3286 (Add_archive_symbols::run): Remove redundant access to
3287 incremental_inputs.
3288 (Lib_group::Lib_group): Initialize base class.
3289 (Lib_group::do_filename): New function.
3290 (Lib_group::include_member): Pass pointer to Lib_group to
3291 report_object.
3292 (Lib_group::do_for_all_unused_symbols): New function.
3293 (Add_lib_group_symbols::run): Report archive information for
3294 incremental links.
3295 * archive.h (class Library_base): New base class.
3296 (class Archive): Derive from Library_base.
3297 (Archive::filename): Move to base class.
3298 (Archive::set_incremental_info): Likewise.
3299 (Archive::incremental_info): Likewise.
3300 (Archive::Should_include): Likewise.
3301 (Archive::should_include_member): Likewise.
3302 (Archive::Armap_entry): Remove.
3303 (Archive::Unused_symbol_iterator): Remove.
3304 (Archive::unused_symbols_begin): Remove.
3305 (Archive::unused_symbols_end): Remove.
3306 (Archive::do_filename): New function.
3307 (Archive::do_get_mtime): New function.
3308 (Archive::do_for_all_unused_symbols): New function.
3309 (Archive::task_): Move to base class.
3310 (Archive::incremental_info_): Likewise.
3311 (class Lib_group): Derive from Library_base.
3312 (Lib_group::do_filename): New function.
3313 (Lib_group::do_get_mtime): New function.
3314 (Lib_group::do_for_all_unused_symbols): New function.
3315 (Lib_group::task_): Move to base class.
3316 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3317 function.
3318 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3319 function.
3320 * incremental.cc (Incremental_inputs::report_archive_begin):
3321 Use Library_base; call library's get_mtime; add incremental inputs
3322 entry before members.
3323 (class Unused_symbol_visitor): New class.
3324 (Incremental_inputs::report_archive_end): Use Library_base; use
3325 visitor class to record unused symbols; don't add incremental inputs
3326 entry after members.
3327 (Incremental_inputs::report_object): Use Library_base.
3328 * incremental.h
3329 (Incremental_archive_entry::Incremental_archive_entry): Remove
3330 unused Archive parameter.
3331 (Incremental_inputs::report_archive_begin): Use Library_base.
3332 (Incremental_inputs::report_archive_end): Likewise.
3333 (Incremental_inputs::report_object): Likewise.
3334 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3335 function.
3336 * object.h (Object::for_all_global_symbols): New function.
3337 (Object::do_for_all_global_symbols): New function.
3338 (Sized_relobj::do_for_all_global_symbols): New function.
3339 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3340 function.
3341 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3342 function.
3343
3344 2011-03-27 Ian Lance Taylor <iant@google.com>
3345
3346 * archive.cc (Archive::interpret_header): Return -1 if something
3347 goes wrong. Change callers accordingly.
3348
3349 2011-03-25 Cary Coutant <ccoutant@google.com>
3350
3351 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3352 * testsuite/Makefile.in: Regenerate.
3353
3354 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3355
3356 * plugin.cc (get_view): New.
3357 (Plugin::load): Pass get_view to the plugin.
3358 (Plugin_manager::get_view): New.
3359
3360 2011-03-21 Ian Lance Taylor <iant@google.com>
3361
3362 * testsuite/final_layout.sh: Rewrite to not use dc.
3363 * testsuite/relro_test.sh: Fail if dc is not present.
3364
3365 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3366
3367 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3368 Change == to -eq.
3369 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3370 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3371 Change == to -eq.
3372 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3373 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3374
3375 2011-03-14 Ian Lance Taylor <iant@google.com>
3376
3377 * script-sections.cc (Sort_output_sections::script_compare):
3378 Rename from is_before, change return type.
3379 (Sort_output_sections::operator()): Adjust accordingly.
3380
3381 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3382
3383 PR gold/12572
3384 * testsuite/odr_violation2.cc: Add comment to make all error line
3385 numbers double digits.
3386 * testsuite/debug_msg.sh: Adjust expected errors.
3387
3388 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3389
3390 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3391 but mark earlier ones as non-canonical
3392 (offset_to_iterator): Update search target and example
3393 (do_addr2line): Return extra lines in a vector*
3394 (format_file_lineno): Extract from do_addr2line
3395 (one_addr2line): Add vector* out-param
3396 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3397 when a lineno entry appeared last for its instruction
3398 (Dwarf_line_info): Add vector* out-param
3399 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3400 * symtab.cc (Odr_violation_compare): Include the lineno in the
3401 comparison again.
3402 (linenos_from_loc): New. Combine the canonical line for an
3403 address with its other lines.
3404 (True_if_intersect): New. Helper functor to make
3405 std::set_intersection a query.
3406 (detect_odr_violations): Compare sets of lines instead of just
3407 one line for each function. This became less deterministic, but
3408 has fewer false positives.
3409 * symtab.h: Declarations.
3410 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3411 mix an optimized and non-optimized object in the same binary
3412 (odr_violation2.so): Same.
3413 * testsuite/Makefile.in: Regenerate from Makefile.am.
3414 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3415 * testsuite/debug_msg.sh: Update line numbers and add
3416 assertions.
3417 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3418 non-optimized context.
3419 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3420 isn't inlined, and use OdrDerived in an optimized context.
3421 * testsuite/odr_header1.h: Defines OdrDerived, where
3422 optimization will change the
3423 first-instruction-in-the-destructor's file and line number.
3424 * testsuite/odr_header2.h: Defines OdrBase.
3425
3426 2011-03-09 Ian Lance Taylor <iant@google.com>
3427
3428 * fileread.cc (File_read::clear_views): Don't delete the whole
3429 file view.
3430
3431 2011-03-08 Ian Lance Taylor <iant@google.com>
3432
3433 PR gold/12525
3434 * fileread.cc: #include <climits>.
3435 (GOLD_IOV_MAX): Define.
3436 (File_read::read_multiple): Limit number of entries by iov_max.
3437 * fileread.h (class File_read): Always set max_readv_entries to
3438 128.
3439
3440 2011-03-07 Ian Lance Taylor <iant@google.com>
3441
3442 PR gold/12525
3443 * options.h (class General_options): Add -dy and -dn.
3444
3445 2011-03-02 Cary Coutant <ccoutant@google.com>
3446
3447 * testsuite/script_test_9.t: Add TLS segment.
3448
3449 2011-03-02 Simon Baldwin <simonb@google.com>
3450
3451 * configure.ac: Add check for gnu_indirect_function support in
3452 the toolchain building binutils.
3453 * configure: Rebuild.
3454
3455 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3456
3457 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3458 plugin only symbols.
3459 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3460 in plugin files as not needed in the symbol table.
3461
3462 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3463
3464 * output.cc (Output_section::add_input_section): Delay fill
3465 generation for section ordering.
3466
3467 2011-02-09 Ian Lance Taylor <iant@google.com>
3468
3469 PR gold/12316
3470 * object.h (class Sized_relobj): Remove clear_local_symbols.
3471 * reloc.cc (Sized_relobj::do_relocate): Don't call
3472 clear_local_symbols.
3473
3474 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3475
3476 * plugin.cc (is_visible_from_outside): Return true for symbols
3477 in the -u option.
3478
3479 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3480
3481 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3482 filename.
3483
3484 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3485
3486 * icf.h (is_section_foldable_candidate): Change type of parameter
3487 to std::string.
3488 * icf.cc (Icf::find_identical_sections): Change type of local variable
3489 section_name to be std::string.
3490 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3491
3492 2011-01-25 Ian Lance Taylor <iant@google.com>
3493
3494 * script.cc (script_add_extern): Rewrite to use
3495 add_symbol_reference.
3496
3497 2011-01-25 Doug Kwan <dougkwan@google.com>
3498
3499 * icf.cc (get_section_contents): Always lock section's object.
3500
3501 2011-01-24 Ian Lance Taylor <iant@google.com>
3502
3503 * options.h (class General_options): Accept
3504 --no-detect-odr-violations.
3505
3506 2011-01-24 Ian Lance Taylor <iant@google.com>
3507
3508 * version.cc (version_string): Bump to 1.11.
3509
3510 2011-01-24 Ian Lance Taylor <iant@google.com>
3511
3512 * plugin.cc (class Plugin_rescan): Define new class.
3513 (Plugin_manager::claim_file): Set any_claimed_.
3514 (Plugin_manager::save_archive): New function.
3515 (Plugin_manager::save_input_group): New function.
3516 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3517 necessary.
3518 (Plugin_manager::new_undefined_symbol): New function.
3519 (Plugin_manager::rescan): New function.
3520 (Plugin_manager::rescannable_defines): New function.
3521 (Plugin_manager::add_input_file): Set any_added_.
3522 * plugin.h (class Plugin_manager): define new fields rescannable_,
3523 undefined_symbols_, any_claimed_, and any_added_. Declare
3524 Plugin_rescan as friend. Declare new functions.
3525 (Plugin_manager::Rescannable): Define type.
3526 (Plugin_manager::Rescannable_list): Define type.
3527 (Plugin_manager::Undefined_symbol_list): Define type.
3528 (Plugin_manager::Plugin_manager): Initialize new fields.
3529 * archive.cc (Archive::defines_symbol): New function.
3530 (Add_archive_symbols::run): Pass archive to plugins if any.
3531 * archive.h (class Archive): Declare defines_symbol.
3532 * readsyms.cc (Input_group::~Input_group): New function.
3533 (Finish_group::run): Pass input_group to plugins if any.
3534 * readsyms.h (class Input_group): Declare destructor.
3535 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3536 any.
3537
3538 2011-01-10 Ian Lance Taylor <iant@google.com>
3539
3540 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3541 section as relro.
3542 (Layout::set_segment_offsets): Reset increase_relro before calling
3543 set_section_addresses a second time.
3544
3545 2011-01-04 Cary Coutant <ccoutant@google.com>
3546
3547 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3548 sections before NOBITS sections.
3549
3550 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3551
3552 * version.cc (print_version): Update copyright to 2011.
3553
3554 2010-12-23 Cary Coutant <ccoutant@google.com>
3555
3556 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3557 of OS to this->add. Add OD parameter to second form of the function.
3558
3559 2010-12-20 Ian Lance Taylor <iant@google.com>
3560
3561 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3562 second of two consecutive entries with same offset.
3563
3564 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3565
3566 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3567 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3568 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3569 to avoid unneeded links against $(LDADD).
3570 * testsuite/Makefile.in: Regenerate.
3571
3572 2010-12-15 Ian Lance Taylor <iant@google.com>
3573
3574 PR gold/12324
3575 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3576 for R_X86_64_32 and R_X86_64_PC32.
3577 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3578 ver_matching_def_pic.o.
3579 (ver_matching_def_pic.o): New target.
3580
3581 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3582
3583 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3584 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3585 Move definition before File_read::View member definitions.
3586 (File_read::View::~View): Initialize and hold lock before
3587 updating current_mapped_bytes.
3588
3589 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3590
3591 * dwarf_reader.cc: Remove outdated comment.
3592 * gold-threads.cc: Fix typo in error message.
3593 * archive.cc: Fix typos in comments.
3594 * archive.h: Likewise.
3595 * arm-reloc-property.cc: Likewise.
3596 * arm-reloc-property.h: Likewise.
3597 * arm-reloc.def: Likewise.
3598 * arm.cc: Likewise.
3599 * attributes.h: Likewise.
3600 * cref.cc: Likewise.
3601 * ehframe.cc: Likewise.
3602 * fileread.h: Likewise.
3603 * gold.h: Likewise.
3604 * i386.cc: Likewise.
3605 * icf.cc: Likewise.
3606 * incremental.h: Likewise.
3607 * int_encoding.cc: Likewise.
3608 * layout.h: Likewise.
3609 * main.cc: Likewise.
3610 * merge.h: Likewise.
3611 * object.cc: Likewise.
3612 * object.h: Likewise.
3613 * options.cc: Likewise.
3614 * readsyms.cc: Likewise.
3615 * reduced_debug_output.cc: Likewise.
3616 * reloc.cc: Likewise.
3617 * script-sections.cc: Likewise.
3618 * sparc.cc: Likewise.
3619 * symtab.h: Likewise.
3620 * target-reloc.h: Likewise.
3621 * target.cc: Likewise.
3622 * target.h: Likewise.
3623 * timer.cc: Likewise.
3624 * timer.h: Likewise.
3625 * x86_64.cc: Likewise.
3626
3627 2010-12-09 Cary Coutant <ccoutant@google.com>
3628
3629 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3630 stack.
3631 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3632 parameter; change all callers.
3633 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3634 * options.h (warn_execstack): New option.
3635
3636 2010-12-07 Doug Kwan <dougkwan@google.com>
3637
3638 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3639 like function call relocations.
3640
3641 2010-12-07 Ian Lance Taylor <iant@google.com>
3642
3643 * archive.cc (Archive::get_elf_object_for_member): Permit
3644 punconfigured to be NULL.
3645 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3646 (Archive::include_member): Pass NULL to get_elf_object_for_member
3647 if we searched for the archive and this is the first included
3648 object.
3649
3650 2010-12-01 Ian Lance Taylor <iant@google.com>
3651
3652 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3653 track_relocs_type_ field.
3654 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3655 Set track_relocs_type_.
3656 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3657 contents when using RELA relocs.
3658 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3659 reloc_map_.
3660 * reloc.cc (Track_relocs::next_addend): New function.
3661 * reloc.h (class Track_relocs): Declare next_addend.
3662
3663 2010-12-01 Ian Lance Taylor <iant@google.com>
3664
3665 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3666 virtual destructor.
3667
3668 2010-12-01 Ian Lance Taylor <iant@google.com>
3669
3670 * README: Update compilers known to work and fail.
3671
3672 2010-11-23 Matthias Klose <doko@ubuntu.com>
3673
3674 * configure.in: For --enable-gold, handle value `default' instead of
3675 `both*'. Always install ld as ld.bfd, install as ld if gold is
3676 not the default.
3677 * configure: Regenerate.
3678
3679 2010-11-18 Doug Kwan <dougkwan@google.com>
3680
3681 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3682 and right_alignment to be zero. Store result alignment only if it is
3683 greater than existing alignment.
3684
3685 2010-11-16 Cary Coutant <ccoutant@google.com>
3686
3687 PR gold/12220
3688 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3689 Check for ".zdebug_line".
3690
3691 2010-11-16 Doug Kwan <dougkwan@google.com>
3692 Cary Coutant <ccoutant@google.com>
3693
3694 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3695 by reference; adjust all callers.
3696 * output.cc (Output_segment::set_section_addresses): Adjust references
3697 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3698 list is empty.
3699 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3700 end at page boundary.
3701
3702 2010-11-16 Cary Coutant <ccoutant@google.com>
3703
3704 PR gold/12220
3705 * layout.cc (Layout::choose_output_section): Transform names of
3706 compressed sections even when using a script with a SECTIONS clause.
3707 (Layout::output_section_name): Remove code to transform
3708 compressed debug section names.
3709 * output.cc (Output_section::add_input_section): Use uncompressed
3710 section size when tracking input sections.
3711
3712 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3713
3714 * symtab.h (Symbol::NON_PIC_REF): Remove.
3715 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3716 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3717 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3718 (Symbol::use_plt_offset): Take a flags argument and pass it
3719 directly to needs_dynamic_reloc. Restrict check for undefined
3720 weak symbols to function calls.
3721 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3722 (Target_arm::Scan::global): Use it.
3723 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3724 (Target_arm::Relocate::relocate): Likewise.
3725 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3726 parameter with an r_type parameter. Use get_reference_flags
3727 to get the flags.
3728 (Target_arm::Relocate::relocate): Update accordingly.
3729 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3730 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3731 (Target_i386::Scan::global): Likewise.
3732 (Target_i386::Relocate::relocate): Likewise.
3733 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3734 parameter with an r_type parameter. Use get_reference_flags
3735 to get the flags.
3736 (Target_i386::Relocate::relocate): Update accordingly.
3737 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3738 (Target_powerpc::Scan::global): Use it.
3739 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3740 (Target_powerpc::Relocate::relocate): Likewise.
3741 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3742 (Target_sparc::Scan::global): Use it.
3743 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3744 (Target_sparc::Relocate::relocate): Likewise.
3745 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3746 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3747 (Target_x86_64::Scan::global): Likewise.
3748 (Target_x86_64::Relocate::relocate): Likewise.
3749
3750 2010-11-08 Doug Kwan <dougkwan@google.com>
3751 Cary Coutant <ccoutant@google.com>
3752
3753 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3754 (Arm_exidx_merge_section::section_contents_): New data member.
3755 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3756 (Arm_input_section::~Arm_input_section): De-allocate memory.
3757 (Arm_input_section::original_contents_): New data member.
3758 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3759 in parameters instead of calling Object::section_contents without
3760 locking.
3761 (Arm_output_section::group_section): New parameter TASK. Pass it
3762 to callees that need locking objects.
3763 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3764 to lock EXIDX input sections. Fix a formatting issue. Call
3765 Arm_exidx_merged_section::build_contents to create merged section
3766 contents.
3767 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3768 to lock object of stub table owner.
3769 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3770 TEXT_SIZE to initialize data member TEXT_SIZE_.
3771 (Arm_exidx_input_section::addralign): Fix typo in comment.
3772 (Arm_exidx_input_section::text_size): New method.
3773 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3774 that require locking objects. Lock objects before scanning for stubs
3775 and updating local symbols.
3776 (Arm_input_section<big_endian>::init): Copy contents of original
3777 input section.
3778 (Arm_input_section<big_endian>::do_write): Use saved contents of
3779 original input section instead of calling Object::section_contents
3780 without locking.
3781 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3782 size without calling Object::section_size().
3783 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3784 for size. Allocate a buffer for merged EXIDX entries.
3785 (Arm_exidx_merged_section::build_contents): New method.
3786 (Arm_exidx_merged_section::do_write): Move merge section contents
3787 building code to Arm_exidx_merged_section::build_contetns. Write
3788 out contetns in buffer instead of building it on the fly.
3789 (Arm_relobj::make_exidx_input_section): Also pass text section size
3790 to Arm_exidx_input_section constructor.
3791 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3792 (Arm_dynobj::do_read_symbols): Fix memory leak.
3793 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3794 * target.h: (class Task): Add forward declaration.
3795 (Target::relax): Add new parameter TASK and pass it to
3796 Target::do_relax().
3797 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3798
3799 2010-11-05 Cary Coutant <ccoutant@google.com>
3800
3801 PR gold/10708
3802 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3803 object when reading from the file.
3804 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3805 second layout pass.
3806 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3807 when reading section contents.
3808 (get_section_contents): Likewise.
3809 (icf::find_identical_sections): Likewise.
3810 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3811 object when reading from the file.
3812 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3813 the object when doing deferred section layout.
3814
3815 2010-11-03 Nick Clifton <nickc@redhat.com>
3816
3817 PR gold/12001
3818 * script.h (class Symbol_assignment: name): New member. Returns
3819 the name of the symbol.
3820 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3821 Returns true if the given symbol name is on the list of
3822 assignments wating to be processed.
3823 * archive.cc (should_incldue_member): If the symbol is undefined,
3824 check to see if it is on the list of symbols pending assignment.
3825
3826 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3827
3828 * script-sections.cc (Script_sections::find_memory_region): Check
3829 for a NULL output section pointer.
3830
3831 2010-10-29 Doug Kwan <dougkwan@google.com>
3832
3833 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3834 Output_section::add_relaxed_input_section.
3835 * output.cc (Output_section::add_relaxed_input_section): Add new
3836 arguments LAYOUT and NAME. Set section order index.
3837 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3838 Copy section order index.
3839 * output.h (Output_section::add_relaxed_input_section): Add new
3840 arguments LAYOUT and NAME.
3841
3842 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3843
3844 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3845 NATIVE_OR_CROSS_LINKER.
3846 * testsuite/Makefile.in: Regenerate.
3847
3848 2010-10-20 Doug Kwan <dougkwan@google.com>
3849
3850 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3851 without SHF_LINK_ORDER flags.
3852 * layout.cc (Layout::choose_output_section): Do not filter
3853 SHF_LINK_ORDER flag in a relocatable link.
3854
3855 2010-10-17 Cary Coutant <ccoutant@google.com>
3856
3857 * output.h (Output_segment::set_section_addresses): Change function
3858 signature. Update all callers.
3859 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3860 sections.
3861 (Output_segment::set_section_addresses): Align after last TLS
3862 section. Add padding before last relro section instead of after.
3863
3864 2010-10-17 Doug Kwan <dougkwan@google.com>
3865
3866 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3867 GOT output section to be writable.
3868
3869 2010-10-14 Cary Coutant <ccoutant@google.com>
3870
3871 * debug.h (DEBUG_INCREMENTAL): New flag.
3872 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3873 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3874 mode.
3875 * incremental.cc (report_command_line): Ignore all forms of
3876 --incremental.
3877 * layout.cc (Layout::Layout): Check parameters for incremental link
3878 mode.
3879 * options.cc (General_options::parse_incremental): New function.
3880 (General_options::parse_no_incremental): New function.
3881 (General_options::parse_incremental_full): New function.
3882 (General_options::parse_incremental_update): New function.
3883 (General_options::incremental_mode_): New data member.
3884 (General_options::finalize): Check incremental_mode_.
3885 * options.h (General_options): Update help text for --incremental.
3886 Add --no-incremental, --incremental-full, --incremental-update.
3887 (General_options::Incremental_mode): New enum type.
3888 (General_options::incremental_mode): New function.
3889 (General_options::incremental_mode_): New data member.
3890 * parameters.cc (Parameters::incremental_mode_): New data member.
3891 (Parameters::set_options): Set incremental_mode_.
3892 (Parameters::set_incremental_full): New function.
3893 (Parameters::incremental): New function.
3894 (Parameters::incremental_update): New function.
3895 (set_parameters_incremental_full): New function.
3896 * parameters.h (Parameters::set_incremental_full): New function.
3897 (Parameters::incremental): New function.
3898 (Parameters::incremental_update): New function.
3899 (Parameters::incremental_mode_): New data member.
3900 (set_parameters_incremental_full): New function.
3901 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3902 incremental link mode.
3903 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3904 (Sized_relobj::do_relocate_sections): Likewise.
3905 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3906 option.
3907 * testsuite/Makefile.in: Regenerate.
3908 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3909
3910 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3911
3912 * script-sections.h (class Script_sections): Make
3913 Sections_elements typedef public.
3914 * script-sections.cc (class Sort_output_sections): Add elements_
3915 field. Add constructor which sets it; change all callers.
3916 (Sort_output_sections::is_before): New function.
3917 (Sort_output_sections::operator()): Call is_before.
3918 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3919 conditional.
3920 * testsuite/script_test_10.sh: New test. Test script section
3921 order.
3922 * testsuite/script_test_10.t: Likewise.
3923 * testsuite/script_test_10.s: Likewise.
3924 * testsuite/Makefile.am: Wrap the cross linker tests and the
3925 common tests into NATIVE_OR_CROSS_LINKER.
3926 (check_SCRIPTS): Add script_test_10.sh.
3927 (check_DATA): Add script_test_10.stdout.
3928 (script_test_10.o, script_test_10): New targets.
3929 (script_test_10.stdout): New target.
3930 * configure, testsuite/Makefile.in: Regenerate.
3931
3932 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3933
3934 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3935 error for the deprecated relocations.
3936 (Target_arm::Scan::global): Likewise.
3937 (Target_arm::Relocate::relocate): Likewise.
3938
3939 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3940
3941 * fileread.cc (Input_file::find_file): Initialize *found_name
3942 and *namep when using the fallback search for case 4.
3943
3944 2010-10-11 Cary Coutant <ccoutant@google.com>
3945
3946 * options.h (class General_options): Redefine -z lazy as an alias for
3947 the negation of -z now.
3948
3949 2010-10-11 Ian Lance Taylor <iant@google.com>
3950
3951 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3952 binding.
3953
3954 2010-10-06 Nick Clifton <nickc@redhat.com>
3955
3956 * script-sections.cc(class Memory_region): Remove
3957 current_lma_offset_ field. Rename current_vma_offset_ to
3958 current_offset_. Add last_section_ field.
3959 (Memory_region::get_current_vma_address): Rename to
3960 get_current_address.
3961 (Memory_region::get_current_lma_address): Delete.
3962 (Memory_region::increment_vma_offset): Rename to
3963 increment_offset.
3964 (Memory_region::increment_lma_offset): Delete.
3965 (Memory_region::attributes_compatible): New method. Returns
3966 true if the provided section is compatible with the region.
3967 (Memory_region::get_last_section): New method. Returns the last
3968 section to use the region.
3969 (Memory_region::set_last_section): New method. Stores the last
3970 section to use the region.
3971 (Script_sections::block_in_region): New method. Returns true if
3972 a block of memory is contained within a region.
3973 (Script_sections::find_memory_region): New method. Locates a
3974 memory region to be used to set a VMA or LMA address.
3975 (Output_section_definition::set_section_addresses): Add code to
3976 check for addresses set by memory regions.
3977 (Output_segment::set_section_addresses): Remove memory region
3978 walking code.
3979 (Script_sections::create_segment): Add a warning if a header
3980 segment is created outside of any region.
3981 * script-sections.h (class Script_sections): Add prototypes for
3982 find_memory_region and block_in_region methods.
3983 * testsuite/memory_test.s: Use .long instead of .word.
3984 * testsuite/memory_test.t: Add some more output sections.
3985 * testsuite/memory_test.sh: Update expected output.
3986
3987 2010-10-02 Doug Kwan <dougkwan@google.com>
3988
3989 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3990 defintion to symtab.h
3991 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3992 declaration to defintion.
3993
3994 2010-10-01 Nick Clifton <nickc@redhat.com>
3995
3996 * expression.cc (eval): Replace dummy argument with NULL.
3997 (eval_maybe_dot): Check for a NULL result section pointer.
3998 (Symbol_expression::value): Likewise.
3999 (Dot_expression::value): Likewise.
4000 (BINARY_EXPRESSION): Likewise.
4001 (Max_expression::value): Likewise.
4002 (Min_expression::value): Likewise.
4003 (Absolute_expression::value): Likewise.
4004 (Addr_expression::value_from_output_section): Likewise.
4005 (Loaddddr_expression::value_from_output_section): Likewise.
4006 (Segment_start_expression::value): Likewise.
4007 * script-sections.cc
4008 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4009 argument with NULL.
4010 (Sections_elememt_dot_assignment::set_section_addresses):
4011 Likewise.
4012 (Output_data_expression::do_write_to_buffer): Likewise.
4013 (Output_section_definition::finalize_symbols): Likewise.
4014 (Output_section_definition::set_section_addresses): Likewise.
4015
4016 2010-09-30 Doug Kwan <dougkwan@google.com>
4017
4018 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4019
4020 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4021
4022 * target.h (Target::can_icf_inline_merge_sections): New virtual
4023 function.
4024 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4025 virtual function.
4026 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4027 virtual function.
4028 * icf.cc (get_section_contents): Inline merge sections only when
4029 target allows it.
4030
4031 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4032
4033 * configure: Regenerate.
4034
4035 2010-09-17 Ian Lance Taylor <iant@google.com>
4036
4037 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4038 * testsuite/Makefile.am (memory_test.o): New target.
4039 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4040 memory_test.t.
4041 * testsuite/Makefile.in: Rebuild.
4042
4043 2010-09-17 Doug Kwan <dougkwan@google.com>
4044
4045 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4046 defintion if relocation uses GOT entries of the symbol.
4047 * testsuite/icf_safe_test.sh: Fix test.
4048 * testsuite/icf_safe_so_test.sh: Fix test.
4049
4050 2010-09-16 Cary Coutant <ccoutant@google.com>
4051
4052 * script_sections.cc (class Memory_region): Remove "NULL" from
4053 vector initializations.
4054
4055 2010-09-15 Cary Coutant <ccoutant@google.com>
4056
4057 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4058 Resolve forwarding symbols.
4059
4060 2010-09-15 Doug Kwan <dougkwan@google.com>
4061
4062 * gold/testsuite/script_test_3.t: Add ARM special sections.
4063 * gold/testsuite/script_test_4.t: Same.
4064 * gold/testsuite/script_test_5.t: Same.
4065 * gold/testsuite/script_test_6.t: Same.
4066 * gold/testsuite/script_test_7.t: Same.
4067 * gold/testsuite/script_test_7.t: Same.
4068 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4069
4070 2010-09-14 Cary Coutant <ccoutant@google.com>
4071
4072 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4073 (Target_x86_64::Relocate::relocate_tls): Replace check for
4074 saw_tls_block_reloc_ with test for executable section.
4075
4076 2010-09-12 Cary Coutant <ccoutant@google.com>
4077
4078 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4079 position-independent executables to shared libraries need dynamic
4080 relocations.
4081 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4082 position-independent executables.
4083 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4084 * testsuite/Makefile.in: Regenerate.
4085
4086 2010-09-10 Nick Clifton <nickc@redhat.com>
4087
4088 PR gold/11997
4089 * testsuite/memory_test.t: Discard any sections that are not
4090 needed.
4091
4092 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4093
4094 PR gold/11996
4095 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4096 "This::" to work around a bug in gcc 4.2.
4097
4098 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4099
4100 2010-09-09 Rafael Espindola <espindola@google.com>
4101
4102 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4103 sections with different PF_X flags in the same segment.
4104 (Layout::find_first_load_seg): Search all segments to find the first
4105 one.
4106 * options.h (rosegment): New.
4107
4108 2010-09-08 Rafael Espindola <espindola@google.com>
4109
4110 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4111
4112 2010-09-08 Doug Kwan <dougkwan@google.com>
4113
4114 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4115 (Arm_relobj::do_relocate_sections): Add new parameter for output
4116 file to match the parent.
4117 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4118 of local symbols instead of input values. Update code to track
4119 changes in gold::relocate_section.
4120 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4121 (Sized_relobj::compute_final_local_value_internal): New methods.
4122 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4123 body into private version of Sized_relobj::compute_final_local_value.
4124 Call the inline method.
4125 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4126 merged symbol value if there is one.
4127 (Symbol_value::has_output_value): New method defintiion.
4128 (Sized_relobj::Compute_final_local_value_status): New enum type.
4129 (Sized_relobj::compute_final_local_value): New methods.
4130 (Sized_relobj::compute_final_local_value_internal): New methods.
4131 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4132 and arm_cortex_a8.sh.
4133 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4134 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4135 New tests.
4136 * Makefile.in: Regenerate.
4137 * testsuite/arm_bl_out_of_range.s: Update test.
4138 * testsuite/thumb_bl_out_of_range.s: Ditto.
4139 * testsuite/thumb_blx_out_of_range.s: Ditto.
4140 * testsuite/arm_branch_out_of_range.sh: New file.
4141 * testsuite/arm_cortex_a8.sh: Ditto.
4142 * testsuite/arm_cortex_a8_b.s: Ditto.
4143 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4144 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4145 * testsuite/arm_cortex_a8_bl.s: Ditto.
4146 * testsuite/arm_cortex_a8_blx.s: Ditto.
4147 * testsuite/arm_cortex_a8_local.s: Ditto.
4148 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4149 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4150
4151 2010-09-08 Rafael Espindola <espindola@google.com>
4152
4153 * Makefile.am (memory_test.stdout): Run readelf with -W.
4154 * Makefile.in: Regenerate.
4155 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4156 64 bit output.
4157
4158 2010-09-08 Rafael Espindola <espindola@google.com>
4159
4160 * script-sections.cc (Script_sections::add_memory_region): Convert
4161 field precision to int.
4162 * script.cc (script_set_section_region, script_set_section_region):
4163 Convert field precision to int.
4164
4165 2010-09-08 Rafael Espindola <espindola@google.com>
4166
4167 * arm.cc (do_finalize_sections): Create the __exidx_start and
4168 __exdix_end symbols even when the section is missing.
4169
4170 2010-09-08 Nick Clifton <nickc@redhat.com>
4171
4172 * README: Remove claim that MEMORY is not supported.
4173 * expression.cc (script_exp_function_origin)
4174 (script_exp_function_length): Move from here to ...
4175 * script.cc: ... here.
4176 (script_set_section_region, script_add_memory)
4177 (script_parse_memory_attr, script_include_directive): New
4178 functions.
4179 * script-sections.cc
4180 (class Memory_region): New class.
4181 (class Output_section_definition): Add set_memory_region,
4182 set_section_vma, set_section_lma and get_section_name methods.
4183 (class Script_Sections): Add add_memory_region,
4184 find_memory_region, find_memory_region_origin,
4185 find_memory_region_length and set_memory_region methods.
4186 Have set_section_addresses method walk the list of set memory
4187 regions.
4188 Extend the print methos to display memory regions.
4189 * script-sections.h: Add prototypes for new methods.
4190 Add enum for MEMORY region attributes.
4191 * yyscript.y: Add support for parsing MEMORY regions.
4192 * script-c.h: Add prototypes for new functions.
4193 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4194 * testsuite/Makefile.in: Regenerate.
4195 * testsuite/memory_test.sh: New script.
4196 * testsuite/memory_test.s: New assembler source file.
4197 * testsuite/memory_test.t: New linker script.
4198
4199 2010-08-27 Doug Kwan <dougkwan@google.com>
4200
4201 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4202 reference override an existing dynamic weak reference.
4203 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4204 * testsuite/Makefile.in: Regenerate.
4205 * testsuite/dyn_weak_ref.sh: New file.
4206 * testsuite/dyn_weak_ref_1.c: Ditto.
4207 * testsuite/dyn_weak_ref_2.c: Ditto.
4208
4209 2010-08-27 Ian Lance Taylor <iant@google.com>
4210
4211 * incremental.h (class Incremental_input_entry): Add virtual
4212 destructor.
4213
4214 2010-08-27 Ian Lance Taylor <iant@google.com>
4215
4216 * testsuite/start_lib_test_3.c: Mark t3 as used.
4217
4218 2010-08-27 Nick Clifton <nickc@redhat.com>
4219
4220 * options.cc (version_script): Fix small typo in previous
4221 whitespace tidyup.
4222
4223 2010-08-25 Nick Clifton <nickc@redhat.com>
4224
4225 * archive.cc: Formatting fixes: Remove whitespace between
4226 typename and following asterisk. Remove whitespace between
4227 function name and opening parenthesis.
4228 * archive.h: Likewise.
4229 * arm.cc: Likewise.
4230 * attributes.cc: Likewise.
4231 * attributes.h: Likewise.
4232 * common.cc: Likewise.
4233 * copy-relocs.cc: Likewise.
4234 * dirsearch.h: Likewise.
4235 * dynobj.cc: Likewise.
4236 * ehframe.cc: Likewise.
4237 * ehframe.h: Likewise.
4238 * expression.cc: Likewise.
4239 * fileread.cc: Likewise.
4240 * fileread.h: Likewise.
4241 * gc.h: Likewise.
4242 * gold-threads.cc: Likewise.
4243 * gold.cc: Likewise.
4244 * i386.cc: Likewise.
4245 * icf.h: Likewise.
4246 * incremental-dump.cc: Likewise.
4247 * incremental.cc: Likewise.
4248 * layout.cc: Likewise.
4249 * layout.h: Likewise.
4250 * main.cc: Likewise.
4251 * merge.cc: Likewise.
4252 * merge.h: Likewise.
4253 * object.cc: Likewise.
4254 * object.h: Likewise.
4255 * options.cc: Likewise.
4256 * options.h: Likewise.
4257 * output.cc: Likewise.
4258 * output.h: Likewise.
4259 * plugin.cc: Likewise.
4260 * plugin.h: Likewise.
4261 * powerpc.cc: Likewise.
4262 * reloc.cc: Likewise.
4263 * script-c.h: Likewise.
4264 * script-sections.cc: Likewise.
4265 * script.cc: Likewise.
4266 * stringpool.cc: Likewise.
4267 * symtab.cc: Likewise.
4268 * symtab.h: Likewise.
4269 * target.cc: Likewise.
4270 * timer.cc: Likewise.
4271 * timer.h: Likewise.
4272 * version.cc: Likewise.
4273 * x86_64.cc: Likewise.
4274
4275 2010-08-24 Nick Clifton <nickc@redhat.com>
4276
4277 PR 11899
4278 * layout.cc (segment_precedes): Sort segments by their physical
4279 addresses, if they have been set.
4280
4281 2010-08-23 Cary Coutant <ccoutant@google.com>
4282
4283 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4284 symbols data.
4285 (Lib_group::include_member): Unlock object after deleting its
4286 symbols data.
4287 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4288 the bug fixed here.
4289
4290 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4291 Cary Coutant <ccoutant@google.com>
4292
4293 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4294 constructor, and set_blocker.
4295 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4296 readsyms_blocker_.
4297 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4298 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4299 * testsuite/Makefile.am (start_lib_test): New test case.
4300 * testsuite/Makefile.in: Regenerate.
4301 * testsuite/start_lib_test_main.c: New file.
4302 * testsuite/start_lib_test_1.c: New file.
4303 * testsuite/start_lib_test_2.c: New file.
4304 * testsuite/start_lib_test_3.c: New file.
4305
4306 2010-08-19 Ian Lance Taylor <iant@google.com>
4307
4308 * Makefile.in: Rebuild with automake 1.11.1.
4309 * aclocal.m4: Likewise.
4310 * testsuite/Makefile.in: Likewise.
4311
4312 2010-08-19 Ian Lance Taylor <iant@google.com>
4313
4314 PR 10893
4315 * i386.cc (class Output_data_plt_i386): Update declarations.
4316 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4317 local_ifuncs_ fields.
4318 (Target_i386::do_plt_section_for_global): New function.
4319 (Target_i386::do_plt_section_for_local): New function.
4320 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4321 parameter; change all callers. Initialize global_ifuncs_ and
4322 local_ifuncs_. If doing a static link define __rel_iplt_start and
4323 __rel_iplt_end.
4324 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4325 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4326 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4327 symbols.
4328 (Target_i386::make_plt_section): New function, broken out of
4329 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4330 (Target_i386::make_plt_entry): Call make_plt_section.
4331 (Target_i386::make_local_ifunc_plt_entry): New function.
4332 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4333 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4334 R_386_IRELATIVE to switch.
4335 (Target_i386::Scan::global): Likewise.
4336 (Target_i386::Relocate::relocate): Likewise.
4337 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4338 switch.
4339 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4340 (Target_x86_64::do_plt_section_for_global): New function.
4341 (Target_x86_64::do_plt_section_for_local): New function.
4342 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4343 parameter; change all callers. If doing a static link define
4344 __rela_iplt_start and __rela_iplt_end.
4345 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4346 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4347 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4348 to point to .plt.
4349 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4350 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4351 switch.
4352 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4353 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4354 R_X86_64_IRELATIVE to switch.
4355 (Target_x86_64::Scan::global): Likewise.
4356 (Target_x86_64::Relocate::relocate): Likewise.
4357 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4358 switch.
4359 * target.h (class Target): Add plt_section_for_global and
4360 plt_section_for_local functions. Add do_plt_section_for_global
4361 and do_plt_section_for_local virtual functions.
4362 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4363 clarifying comments.
4364 (Symbol::use_plt_offset): Handle IFUNC symbol.
4365 * object.cc (Sized_relobj::Sized_relobj): Initialize
4366 local_plt_offsets_.
4367 (Sized_relobj::local_has_plt_offset): New function.
4368 (Sized_relobj::local_plt_offset): New function.
4369 (Sized_relobj::set_local_plt_offset): New function.
4370 (Sized_relobj::do_count): Handle IFUNC symbol.
4371 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4372 a bit away from input_shndx_ field. Add set_is_func_symbol and
4373 is_ifunc_symbol functions.
4374 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4375 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4376 local_plt_offsets_ field.
4377 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4378 * output.h (class Output_section_data): Add non-const
4379 output_section function.
4380 (class Output_data_got): Update declarations.
4381 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4382 Add use_plt_offset parameter to global and local constructors.
4383 Change all callers. Change local_sym_index_ field to 31 bits.
4384 Change GSYM_CODE and CONSTANT_CODE accordingly.
4385 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4386 doing a static link don't set sh_link field.
4387 (Output_data_got::Got_entry::write): Use PLT offset if
4388 appropriate.
4389 (Output_data_got::add_global_plt): New function.
4390 (Output_data_got::add_local_plt): New function.
4391 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4392 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4393 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4394 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4395 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4396 IFUNC conditional.
4397 * testsuite/ifunc-sel.h: New file.
4398 * testsuite/ifuncmain1.c: New file.
4399 * testsuite/ifuncmain1vis.c: New file.
4400 * testsuite/ifuncmod1.c: New file.
4401 * testsuite/ifuncdep2.c: New file.
4402 * testsuite/ifuncmain2.c: New file.
4403 * testsuite/ifuncmain3.c: New file.
4404 * testsuite/ifuncmod3.c: New file.
4405 * testsuite/ifuncmain4.c: New file.
4406 * testsuite/ifuncmain5.c: New file.
4407 * testsuite/ifuncmod5.c: New file.
4408 * testsuite/ifuncmain6pie.c: New file.
4409 * testsuite/ifuncmod6.c: New file.
4410 * testsuite/ifuncmain7.c: New file.
4411 * configure, testsuite/Makefile.in: Rebuild.
4412
4413 2010-08-18 Ian Lance Taylor <iant@google.com>
4414
4415 * incremental.cc
4416 (Output_section_incremental_inputs::write_input_files): Add cast
4417 to avoid signed/unsigned comparison warning.
4418 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4419
4420 2010-08-12 Cary Coutant <ccoutant@google.com>
4421
4422 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4423
4424 2010-08-13 Ian Lance Taylor <iant@google.com>
4425
4426 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4427
4428 2010-08-12 Cary Coutant <ccoutant@google.com>
4429 Doug Kwan <dougkwan@google.com>
4430
4431 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4432 defintion overrides non-weak undef, remember that the original undef
4433 is not weak.
4434 * symtab.cc (Symbol_table::sized_write_global): For undef without
4435 an original weak binding, set binding to global in output.
4436 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4437 * testsuite/Makefile.in: Regenerate.
4438 * testsuite/strong_ref_weak_def.sh: New file.
4439 * testsuite/strong_ref_weak_def_1.c: Ditto.
4440 * testsuite/strong_ref_weak_def_2.c: Ditto.
4441
4442 2010-08-12 Cary Coutant <ccoutant@google.com>
4443
4444 * testsuite/incremental_test.sh: Rewrite.
4445 * testsuite/incremental_test_1.c: Rewrite.
4446 * testsuite/incremental_test_2.c: Rewrite.
4447
4448 2010-08-12 Cary Coutant <ccoutant@google.com>
4449
4450 * arm.cc (Target_arm::got_size): Add const.
4451 (Target_arm::got_entry_count): New function.
4452 (Target_arm::plt_entry_count): New function.
4453 (Target_arm::first_plt_entry_offset): New function.
4454 (Target_arm::plt_entry_size): New function.
4455 (Output_data_plt_arm::entry_count): New function.
4456 (Output_data_plt_arm::first_plt_entry_offset): New function.
4457 (Output_data_plt_arm::get_plt_entry_size): New function.
4458 * i386.cc (Target_i386::got_size): Add const.
4459 (Target_i386::got_entry_count): New function.
4460 (Target_i386::plt_entry_count): New function.
4461 (Target_i386::first_plt_entry_offset): New function.
4462 (Target_i386::plt_entry_size): New function.
4463 (Output_data_plt_i386::entry_count): New function.
4464 (Output_data_plt_i386::first_plt_entry_offset): New function.
4465 (Output_data_plt_i386::get_plt_entry_size): New function.
4466 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4467 find_incremental_inputs_sections. Dump incremental_got_plt section.
4468 * incremental.cc: Include target.h.
4469 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4470 parameter. Adjust all callers. Find incremental_got_plt section.
4471 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4472 section.
4473 (Output_section_incremental_inputs::set_final_data_size): Calculate
4474 size of incremental_got_plt section.
4475 (Output_section_incremental_inputs::do_write): Write the
4476 incremental_got_plt section.
4477 (Got_plt_view_info): New struct.
4478 (Local_got_offset_visitor): New class.
4479 (Global_got_offset_visitor): New class.
4480 (Global_symbol_visitor_got_plt): New class.
4481 (Output_section_incremental_inputs::write_got_plt): New function.
4482 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4483 Add parameter. Adjust all callers.
4484 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4485 (Incremental_inputs::got_plt_section): New function.
4486 (Incremental_inputs::got_plt_section_): New data member.
4487 (Incremental_got_plt_reader): New class.
4488 * layout.cc (Layout::create_incremental_info_sections): Add the
4489 incremental_got_plt section.
4490 * object.h (Got_offset_list::get_list): New function.
4491 (Got offset_list::for_all_got_offsets): New function.
4492 (Sized_relobj::local_got_offset_list): New function.
4493 * powerpc.cc (Target_powerpc::got_size): Add const.
4494 (Target_powerpc::got_entry_count): New function.
4495 (Target_powerpc::plt_entry_count): New function.
4496 (Target_powerpc::first_plt_entry_offset): New function.
4497 (Target_powerpc::plt_entry_size): New function.
4498 (Output_data_plt_powerpc::entry_count): New function.
4499 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4500 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4501 * sparc.cc (Target_sparc::got_size): Add const.
4502 (Target_sparc::got_entry_count): New function.
4503 (Target_sparc::plt_entry_count): New function.
4504 (Target_sparc::first_plt_entry_offset): New function.
4505 (Target_sparc::plt_entry_size): New function.
4506 (Output_data_plt_sparc::entry_count): New function.
4507 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4508 (Output_data_plt_sparc::get_plt_entry_size): New function.
4509 * symtab.h (Symbol::got_offset_list): New function.
4510 (Symbol_table::for_all_symbols): New function.
4511 * target.h (Sized_target::got_entry_count): New function.
4512 (Sized_target::plt_entry_count): New function.
4513 (Sized_target::plt_entry_size): New function.
4514 * x86_64.cc (Target_x86_64::got_size): Add const.
4515 (Target_x86_64::got_entry_count): New function.
4516 (Target_x86_64::plt_entry_count): New function.
4517 (Target_x86_64::first_plt_entry_offset): New function.
4518 (Target_x86_64::plt_entry_size): New function.
4519 (Output_data_plt_x86_64::entry_count): New function.
4520 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4521 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4522
4523 2010-08-12 Cary Coutant <ccoutant@google.com>
4524
4525 * archive.cc: Include incremental.h.
4526 (Archive::Archive): Initialize incremental_info_.
4527 (Archive::include_member): Record archive members in incremental info.
4528 (Add_archive_symbols::run): Record begin and end of an archive in
4529 incremental info.
4530 (Lib_group::include_member): Record objects in incremental info.
4531 * archive.h (Incremental_archive_entry): Forward declaration.
4532 (Archive::set_incremental_info): New member function.
4533 (Archive::incremental_info): New member function.
4534 (Archive::Unused_symbol_iterator): New class.
4535 (Archive::unused_symbols_begin): New member function.
4536 (Archive::unused_symbols_end): New member function.
4537 (Archive::incremental_info_): New data member.
4538 * incremental-dump.cc (find_input_containing_global): New function.
4539 (dump_incremental_inputs): Dump new incremental info sections.
4540 * incremental.cc: Include symtab.h.
4541 (Output_section_incremental_inputs): New class.
4542 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4543 new incremental info sections.
4544 (Sized_incremental_binary::do_check_inputs): Likewise.
4545 (Incremental_inputs::report_archive): Remove.
4546 (Incremental_inputs::report_archive_begin): New function.
4547 (Incremental_inputs::report_archive_end): New function.
4548 (Incremental_inputs::report_object): New function.
4549 (Incremental_inputs::finalize_inputs): Remove.
4550 (Incremental_inputs::report_input_section): New function.
4551 (Incremental_inputs::report_script): Rewrite.
4552 (Incremental_inputs::finalize): Do nothing but finalize string table.
4553 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4554 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4555 (Incremental_inputs::create_data_sections): New function.
4556 (Incremental_inputs::relocs_entsize): New function.
4557 (Output_section_incremental_inputs::set_final_data_size): New function.
4558 (Output_section_incremental_inputs::do_write): New function.
4559 (Output_section_incremental_inputs::write_header): New function.
4560 (Output_section_incremental_inputs::write_input_files): New function.
4561 (Output_section_incremental_inputs::write_info_blocks): New function.
4562 (Output_section_incremental_inputs::write_symtab): New function.
4563 * incremental.h (Incremental_script_entry): Forward declaration.
4564 (Incremental_object_entry): Forward declaration.
4565 (Incremental_archive_entry): Forward declaration.
4566 (Incremental_inputs): Forward declaration.
4567 (Incremental_inputs_header_data): Remove.
4568 (Incremental_inputs_header): Remove.
4569 (Incremental_inputs_header_write): Remove.
4570 (Incremental_inputs_entry_data): Remove.
4571 (Incremental_inputs_entry): Remove.
4572 (Incremental_inputs_entry_write): Remove.
4573 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4574 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4575 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4576 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4577 Likewise.
4578 (Incremental_input_entry): New class.
4579 (Incremental_script_entry): New class.
4580 (Incremental_object_entry): New class.
4581 (Incremental_archive_entry): New class.
4582 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4583 (Incremental_inputs::report_inputs): Remove.
4584 (Incremental_inputs::report_archive): Remove.
4585 (Incremental_inputs::report_archive_begin): New function.
4586 (Incremental_inputs::report_archive_end): New function.
4587 (Incremental_inputs::report_object): Change prototype.
4588 (Incremental_inputs::report_input_section): New function.
4589 (Incremental_inputs::report_script): Change prototype.
4590 (Incremental_inputs::get_reloc_count): New function.
4591 (Incremental_inputs::set_reloc_count): New function.
4592 (Incremental_inputs::create_data_sections): New function.
4593 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4594 (Incremental_inputs::inputs_section): New function.
4595 (Incremental_inputs::symtab_section): New function.
4596 (Incremental_inputs::relocs_section): New function.
4597 (Incremental_inputs::get_stringpool): Add const.
4598 (Incremental_inputs::command_line): Add const.
4599 (Incremental_inputs::inputs): Remove.
4600 (Incremental_inputs::command_line_key): New function.
4601 (Incremental_inputs::input_file_count): New function.
4602 (Incremental_inputs::input_files): New function.
4603 (Incremental_inputs::relocs_entsize): New function.
4604 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4605 (Incremental_inputs::finalize_inputs): Remove.
4606 (Incremental_inputs::Input_info): Remove.
4607 (Incremental_inputs::lock_): Remove.
4608 (Incremental_inputs::inputs_): Change type.
4609 (Incremental_inputs::inputs_map_): Remove.
4610 (Incremental_inputs::current_object_entry_): New data member.
4611 (Incremental_inputs::inputs_section_): New data member.
4612 (Incremental_inputs::symtab_section_): New data member.
4613 (Incremental_inputs::relocs_section_): New data member.
4614 (Incremental_inputs::reloc_count_): New data member.
4615 (Incremental_inputs_reader): New class.
4616 (Incremental_symtab_reader): New class.
4617 (Incremental_relocs_reader): New class.
4618 * layout.cc (Layout::finalize): Move finalization of incremental info
4619 and creation of incremental info sections to follow finalization of
4620 symbol table. Set offsets for postprocessing sections.
4621 (Layout::create_incremental_info_sections): Call
4622 Incremental_inputs::create_data_sections. Add incremental symtab
4623 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4624 sections to layout after input sections.
4625 * layout.h (struct Timespec): Forward declaration.
4626 (Layout::incremental_inputs): Add const.
4627 (Layout::create_incremental_info_sections): Add parameter.
4628 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4629 * object.cc: Include incremental.h.
4630 (Relobj::finalize_incremental_relocs): New function.
4631 (Sized_relobj::do_layout): Record input sections in incremental info.
4632 * object.h (Object::output_section): New function.
4633 (Object::output_section_offset): Moved from Relobj.
4634 (Object::get_incremental_reloc_base): New function.
4635 (Object::get_incremental_reloc_count): New function.
4636 (Object::do_output_section): New function.
4637 (Object::do_output_section_offset): Moved from Relobj.
4638 (Object::do_get_incremental_reloc_base): New function.
4639 (Object::do_get_incremental_reloc_count): New function.
4640 (Object::Object): Initialize new data members.
4641 (Relobj::output_section): Renamed do_output_section and moved to
4642 protected.
4643 (Relobj::output_section_offset): Moved to Object.
4644 (Relobj::do_get_incremental_reloc_base): New function.
4645 (Relobj::do_get_incremental_reloc_count): New function.
4646 (Relobj::allocate_incremental_reloc_counts): New function.
4647 (Relobj::count_incremental_reloc): New function.
4648 (Relobj::finalize_incremental_relocs): New function.
4649 (Relobj::next_incremental_reloc_index): New function.
4650 (Relobj::reloc_counts_): New data member.
4651 (Relobj::reloc_bases_): New data member.
4652 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4653 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4654 (Sized_relobj::incremental_relocs_scan): New function.
4655 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4656 (Sized_relobj::incremental_relocs_write): New function.
4657 (Sized_relobj::incremental_relocs_write_reltype): New function.
4658 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4659 incremental link.
4660 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4661 archives and object files elsewhere.
4662 (Add_symbols::run): Report object files here.
4663 (Finish_group::run): Report end of archive at end of group.
4664 * reloc.cc: Include layout.h, incremental.h.
4665 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4666 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4667 (Sized_relobj::incremental_relocs_scan): New function.
4668 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4669 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4670 (Sized_relobj::incremental_relocs_write): New function.
4671 (Sized_relobj::incremental_relocs_write_reltype): New function.
4672 * script.cc (read_input_script): Rewrite test for incremental link.
4673 Change call to Incremental_inputs::report_script.
4674 * symtab.h (Symbol_table::first_global_index): New function.
4675 (Symbol_table::output_count): New function.
4676
4677 2010-08-12 Doug Kwan <dougkwan@google.com>
4678
4679 * arm.cc (Target_arm::merge_object_attributes): Check command line
4680 options --no-wchar-size-warning and --no-enum-size-warning.
4681 * options.h (General_options): Add ld-compatible options
4682 --no-enum-size-warning and --no-wchar-size-warning.
4683
4684 2010-08-04 Ian Lance Taylor <iant@google.com>
4685
4686 * x86_64.cc (Target_x86_64::Scan::local): Use
4687 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4688 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4689 (Target_x86_64::Scan::global): Likewise.
4690 (Target_x86_64::Relocate::relocate): Likewise.
4691 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4692 Likewise.
4693
4694 2010-08-03 Cary Coutant <ccoutant@google.com>
4695
4696 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4697 to reserve space in merged_strings vector. Keep total input size
4698 for stats.
4699 (Output_merge_string::do_print_merge_stats): Print total input size.
4700 * merge.h (Output_merge_string): Add input_size_ field.
4701 * stringpool.cc (Stringpool_template::string_length): Move
4702 implementations out of Stringpool_template class and place in
4703 stringpool.h.
4704 * stringpool.h (string_length): Move out of Stringpool_template.
4705
4706 2010-08-03 Ian Lance Taylor <iant@google.com>
4707
4708 PR 11712
4709 * layout.cc (relaxation_loop_body): If address of load segment is
4710 set, adjust address to include headers if possible.
4711
4712 2010-08-03 Ian Lance Taylor <iant@google.com>
4713
4714 * version.cc (version_string): Bump to 1.10.
4715
4716 2010-08-03 Ian Lance Taylor <iant@google.com>
4717
4718 PR 11805
4719 * layout.h (enum Output_section_order): Define.
4720 (class Layout): Update declarations.
4721 * layout.cc (Layout::get_output_section): Add order parameter.
4722 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4723 is_first_non_relro parameters. Change all callers.
4724 (Layout::choose_output_section): Likewise.
4725 (Layout::add_output_section_data): Likewise.
4726 (Layout::make_output_section): Likewise. Set order.
4727 (Layout::default_section_order): New function.
4728 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4729 * output.cc (Output_section::Output_section): Initialize order_.
4730 Don't initialize deleted fields.
4731 (Output_segment::Output_segment): Don't initialize deleted
4732 fields.
4733 (Output_segment::add_output_section_to_load): New function
4734 replacing add_output_section. Change all callers to call this or
4735 add_output_section_to_nonload.
4736 (Output_segment::add_output_section_to_nonload): New function.
4737 (Output_segment::remove_output_section): Rewrite.
4738 (Output_segment::add_initial_output_data): Likewise.
4739 (Output_segment::has_any_data_sections): Likewise.
4740 (Output_segment::is_first_section_relro): Likewise.
4741 (Output_segment::maximum_alignment): Likewise.
4742 (Output_segment::has_dynamic_reloc): New function replacing
4743 dynamic_reloc_count. Change all callers.
4744 (Output_segment::has_dynamic_reloc_list): New function replacing
4745 dynamic_reloc_count_list. Change all callers.
4746 (Output_segment::set_section_addresses): Rewrite.
4747 (Output_segment::set_offset): Rewrite.
4748 (Output_segment::find_first_and_last_list): Remove.
4749 (Output_segment::set_tls_offsets): Rewrite.
4750 (Output_segment::first_section_load_address): Likewise.
4751 (Output_segment::output_section_count): Likewise.
4752 (Output_segment::section_with_lowest_load_address): Likewise.
4753 (Output_segment::write_section_headers): Likewise.
4754 (Output_segment::print_sections_to_map): Likewise.
4755 * output.h (class Output_data): Remove dynamic_reloc_count_
4756 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4757 (Output_data::add_dynamic_reloc): Rewrite.
4758 (Output_data::has_dynamic_reloc): New function.
4759 (Output_data::dynamic_reloc_count): Remove.
4760 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4761 is_last_relro_, is_first_non_relro_, is_interp_,
4762 is_dynamic_linker_section_ fields. Add order and set_order
4763 functions. Remove is_relro_local, set_is_relro_local,
4764 is_last_relro, set_is_last_relro, is_first_non_relro,
4765 set_is_first_non_relro functions, is_interp, set_is_interp,
4766 is_dynamic_linker_section, and set_is_dynamic_linker_section
4767 functions.
4768 (class Output_segment): Change Output_data_list from std::list to
4769 std:;vector. Add output_lists_ field. Remove output_data_ and
4770 output_bss_ fields. Update declarations.
4771
4772 2010-08-02 Ian Lance Taylor <iant@google.com>
4773
4774 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4775 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4776 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4777
4778 2010-08-02 Ian Lance Taylor <iant@google.com>
4779
4780 PR 11855
4781 * script.cc (Script_options::Script_options): Initialize
4782 symbol_definitions_ and symbol_references_.
4783 (Script_options::add_symbol_assignment): Update
4784 symbol_definitions_ and symbol_references_.
4785 (Script_options::add_symbol_reference): New function.
4786 (script_symbol): New function.
4787 * script.h (class Script_options): Add symbol_definitions_ and
4788 symbol_references_ fields.
4789 (Script_options::referenced_const_iterator): New type.
4790 (Script_options::referenced_begin): New function.
4791 (Script_options::referenced_end): New function.
4792 (Script_options::is_referenced): New function.
4793 (Script_options::any_unreferenced): New function.
4794 * script-c.h (script_symbol): Declare.
4795 * yyscript.y (exp): Call script_symbol.
4796 * symtab.cc: Include "script.h".
4797 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4798 Change all callers. Check symbols referenced by scripts.
4799 (Symbol_table::add_undefined_symbols_from_command_line): Add
4800 layout parameter. Change all callers.
4801 (Symbol_table::do_add_undefined_symbols_from_command_line):
4802 Likewise. Break out loop body. Check symbols referenced by
4803 scripts.
4804 (Symbol_table::add_undefined_symbol_from_command_line): New
4805 function broken out of
4806 do_add_undefined_symbols_from_command_line.
4807 * symtab.h (class Symbol_table): Update declarations.
4808 * archive.cc: Include "layout.h".
4809 (Archive::should_include_member): Add layout parameter. Change
4810 all callers. Check for symbol mentioned in expression.
4811 * archive.h (class Archive): Update declaration.
4812 * object.cc (Sized_relobj::do_should_include_member): Add layout
4813 parameter.
4814 * object.h (Object::should_include_member): Add layout parameter.
4815 Change all callers.
4816 (Object::do_should_include_member): Add layout parameter.
4817 (class Sized_relobj): Update declaration.
4818 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4819 parameter.
4820 * dynobj.h (class Sized_dynobj): Update declaration.
4821 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4822 layout parameter.
4823 * plugin.h (class Sized_pluginobj): Update declaration.
4824
4825 2010-08-02 Ian Lance Taylor <iant@google.com>
4826
4827 PR 11866
4828 * output.cc (Output_segment::set_offset): Search for the first and
4829 last sections rather than assuming that the list is in order.
4830 (Output_segment::find_first_and_last_list): New function.
4831 * output.h (class Output_segment): Update declarations.
4832 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4833 (relro_strip_test_SOURCES): New variable.
4834 (relro_strip_test_DEPENDENCIES): New variable.
4835 (relro_strip_test_LDFLAGS): New variable.
4836 (relro_strip_test_LDADD): New variable.
4837 (relro_strip_test.so): New target.
4838
4839 2010-08-02 Ian Lance Taylor <iant@google.com>
4840
4841 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4842 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4843 (Target_i386::got_tlsdesc_section): New function.
4844 (Target_i386::got_section): Create space for GOT entries for
4845 TLSDESC relocations.
4846 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4847 R_386_TLS_GOTDESC.
4848 (Target_i386::Scan::global): Likewise.
4849 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4850 using TLSDESC GOT.
4851 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4852 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4853 (Target_x86_64::got_tlsdesc_section): New function.
4854 (Target_x86_64::got_section): Create space for GOT entries for
4855 TLSDESC relocations.
4856 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4857 R_386_TLS_GOTDESC.
4858 (Target_x86_64::Scan::global): Likewise.
4859 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4860 using TLSDESC GOT.
4861
4862 2010-08-02 Ian Lance Taylor <iant@google.com>
4863
4864 * testsuite/final_layout.sh: Use dc to convert from hex to
4865 decimal.
4866
4867 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4868
4869 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4870 paramter to the call to gold::gc_process_relocs.
4871 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4872 paramter to the call to gold::gc_process_relocs.
4873 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4874 parameter to the call to gold::gc_process_relocs.
4875 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4876 template parameter to the call to gold::gc_process_relocs.
4877 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4878 paramter to the call to gold::gc_process_relocs.
4879 * gc.h (get_embedded_addend_size): New function.
4880 (gc_process_relocs): Save the size of the reloc for use by ICF.
4881 * icf.cc (get_section_contents): Get the addend from the text section
4882 for SHT_REL relocation sections.
4883 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4884 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4885 * int_encoding.h (read_from_pointer): New overloaded function.
4886 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4887 * testsuite/icf_sht_rel_addend_test.sh: New file.
4888 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4889 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4890
4891 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4892
4893 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4894 * Makefile.in: Regenerate.
4895 * testsuite/Makefile.in: Regenerate.
4896
4897 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4898
4899 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4900 * gold/testsuite/debug_msg.cc: Likewise.
4901 * gold/testsuite/odr_violation1.cc
4902 * gold/testsuite/odr_violation2.cc
4903
4904 2010-07-21 Cary Coutant <ccoutant@google.com>
4905
4906 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4907 string, and length fields.
4908 (Output_merge_string::Merged_strings_list): New type.
4909 (Output_merge_string::Merged_strings_lists): New typedef.
4910 (Output_merge_string): Replace merged_strings_ with
4911 merged_strings_lists_.
4912 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4913 Merged_strings_list per input object and section. Don't store pointer
4914 to the string. Don't store length with each merged string entry.
4915 (Output_merge_string::finalize_merged_data): Loop over list of merged
4916 strings lists. Recompute length of each merged string.
4917
4918 2010-07-15 Cary Coutant <ccoutant@google.com>
4919
4920 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4921 here.
4922
4923 2010-07-14 Ian Lance Taylor <iant@google.com>
4924
4925 * descriptors.cc (Descriptors::open): Report correct name in error
4926 message.
4927
4928 2010-07-13 Doug Kwan <dougkwan@google.com>
4929
4930 * arm.cc (Arm_input_section::Arm_input_section): For a
4931 SHT_ARM_EXIDX section, always keeps the input sections.
4932 (Arm_input_section::set_exidx_section_link): New method.
4933 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4934 has_errors_ to false.
4935 (Arm_exidx_input_section::has_errors,
4936 Arm_exidx_input_section::set_has_errors): New methods.
4937 (Arm_exidx_input_section::has_errors_): New data member.
4938 (Arm_relobj::get_exidx_shndx_list): New method.
4939 (Arm_output_section::append_text_sections_to_list): Do not skip
4940 section without SHF_EXECINSTR.
4941 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4942 errors.
4943 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4944 section header. Make error messages more verbose. Check for
4945 a non-executable section linked to an EXIDX section.
4946 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4947 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4948 check that there is no deferred EXIDX section if we exit early.
4949 Instead of not making an EXIDX section in case of an error, make one
4950 and set the has_errors flag of it.
4951 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4952 in a relocatable link.
4953 (Target_arm::do_relax): Look for the EXIDX output section instead of
4954 assuming that it is called .ARM.exidx.
4955 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4956 section list. Do not check for SHF_EXECINSTR section flags but
4957 skip any input section with errors.
4958 * output.cc (Output_section::Output_section): Initialize
4959 always_keeps_input_sections_ to false.
4960 (Output_section::add_input_section): Check for
4961 always_keeps_input_sections_.
4962 * output.h (Output_section::always_keeps_input_sections,
4963 Output_section::set_always_keeps_input_sections): New methods.
4964 (Output_section::always_keeps_input_sections): New data member.
4965
4966 2010-07-13 Rafael Espindola <espindola@google.com>
4967
4968 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4969 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4970
4971 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4972 Ian Lance Taylor <iant@google.com>
4973
4974 * output.h (Output_section_lookup_maps::add_merge_section):
4975 Correct check of whether value was inserted.
4976 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4977 (Output_section_lookup_maps::add_relaxed_input_section):
4978 Likewise.
4979 * arm.cc (Target_arm::got_section): Remove used local os.
4980 * i386.cc (Target_i386::got_section): Likewise.
4981 * x86_64.cc (Target_x86_64::got_section): Likewise.
4982 * sparc.cc (Target_sparc::got_section): Likewise.
4983 (Target_sparc::relocate): Remove unused local have_got_offset.
4984 * powerpc.cc (Target_powerpc::relocate): Likewise.
4985
4986 2010-07-13 Ian Lance Taylor <iant@google.com>
4987
4988 * compressed_output.cc (zlib_decompress): Fix signature in
4989 !HAVE_ZLIB_H case.
4990
4991 * archive.cc (Archive::include_member): Unlock an external member
4992 of a thin archive. Don't bother to delete an object we know is
4993 NULL.
4994
4995 2010-07-12 Cary Coutant <ccoutant@google.com>
4996
4997 * compressed_output.cc (zlib_decompress): New function.
4998 (get_uncompressed_size): New function.
4999 (decompress_input_section): New function.
5000 * compressed_output.h (get_uncompressed_size): New function.
5001 (decompress_input_section): New function.
5002 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5003 Handle compressed debug sections.
5004 * layout.cc (is_compressed_debug_section): New function.
5005 (Layout::output_section_name): Map compressed section names to
5006 canonical names.
5007 * layout.h (is_compressed_debug_section): New function.
5008 (is_debug_info_section): Recognize compressed debug sections.
5009 * merge.cc: Include compressed_output.h.
5010 (Output_merge_data::do_add_input_section): Handle compressed
5011 debug sections.
5012 (Output_merge_string::do_add_input_section): Handle compressed
5013 debug sections.
5014 * object.cc: Include compressed_output.h.
5015 (Sized_relobj::Sized_relobj): Initialize new data members.
5016 (build_compressed_section_map): New function.
5017 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5018 * object.h (Object::section_is_compressed): New method.
5019 (Object::do_section_is_compressed): New method.
5020 (Sized_relobj::Compressed_section_map): New type.
5021 (Sized_relobj::do_section_is_compressed): New method.
5022 (Sized_relobj::compressed_sections_): New data member.
5023 * output.cc (Output_section::add_input_section): Handle compressed
5024 debug sections.
5025 * reloc.cc: Include compressed_output.h.
5026 (Sized_relobj::write_sections): Handle compressed debug sections.
5027
5028 2010-07-08 Cary Coutant <ccoutant@google.com>
5029
5030 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5031 weak when resolving to a dynamic def.
5032 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5033 for weak undef/dynamic def cases. Adjust callers.
5034 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5035 undef_binding_weak_.
5036 (Symbol_table::sized_write_globals): Adjust symbol binding.
5037 (Symbol_table::sized_write_symbol): Add binding parameter.
5038 * symtab.h (Symbol::set_undef_binding): New method.
5039 (Symbol::is_undef_binding_weak): New method.
5040 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5041 (Symbol_table::should_override): Add new parameter.
5042 (Symbol_table::sized_write_symbol): Add new parameter.
5043
5044 * testsuite/weak_undef_file1.cc: Add new test case.
5045 * testsuite/weak_undef_file2.cc: Fix header comment.
5046 * testsuite/weak_undef_test.cc: Add new test case.
5047
5048 2010-06-29 Doug Kwan <dougkwan@google.com>
5049
5050 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5051 Initialize USE_SYMBOL_.
5052 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5053 definition.
5054 (Arm_reloc_property::uses_symbol_): New data member declaration.
5055 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5056 uses symbol value and symbol is undefined but not weakly undefined.
5057
5058 2010-06-28 Rafael Espindola <espindola@google.com>
5059
5060 * plugin.cc (Plugin::load): Use dlerror.
5061
5062 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5063
5064 * symtab.cc (detect_odr_violations): When reporting an ODR
5065 violation, report an object where the symbol is defined.
5066
5067 2010-06-25 Doug Kwan <dougkwan@google.com>
5068
5069 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5070 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5071 definition.
5072 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5073 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5074 target hook to detect function points.
5075 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5076 * icf.h (Icf::check_section_for_function_pointers): Change type of
5077 parameter SECTION_NAME to const reference to std::string. Use
5078 target hook to determine if section may have unsafe pointers.
5079 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5080 method definition.
5081
5082 2010-06-21 Rafael Espindola <espindola@google.com>
5083
5084 * fileread.cc (Input_file::find_fie): New
5085 (Input_file::open): Use Input_file::find_fie.
5086 * fileread.h (Input_file::find_fie): New
5087 * plugin.cc (set_extra_library_path): New.
5088 (Plugin::load): Add set_extra_library_path to the transfer vector.
5089 (Plugin_manager::set_extra_library_path): New.
5090 (Plugin_manager::add_input_file): Use the extra search path if set.
5091 (set_extra_library_path(): New.
5092 * plugin.h (Plugin_manager): Add set_extra_library_path and
5093 extra_search_path_.
5094
5095 2010-06-19 Cary Coutant <ccoutant@google.com>
5096
5097 * layout.cc (gdb_sections): Add .debug_types.
5098 (lines_only_debug_sections): Likewise.
5099
5100 2010-06-18 Rafael Espindola <espindola@google.com>
5101
5102 * plugin.cc (add_input_file,add_input_library)
5103 (Plugin_manager::add_input_file): Make filename arguments const.
5104 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5105 const.
5106
5107 2010-06-16 Doug Kwan <dougkwan@google.com>
5108
5109 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5110 .ARM.attributes section if we have not merged any input
5111 attributes sections.
5112
5113 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5114
5115 * arm.cc: Allow combining objects with no EABI version
5116 information.
5117
5118 2010-06-15 Rafael Espindola <espindola@google.com>
5119
5120 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5121
5122 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5123
5124 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5125 (struct iovec): Correct !HAVE_READV definition.
5126
5127 2010-06-10 Cary Coutant <ccoutant@google.com>
5128
5129 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5130 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5131 reloc sections.
5132 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5133
5134 PR 11683
5135 * symtab.h (Symbol::is_placeholder): New member function.
5136 * target-reloc.h (relocate_section): Check for placeholder symbols.
5137
5138 * testsuite/Makefile.am (plugin_test_8): New test.
5139 (plugin_test_9): New test.
5140 * testsuite/Makefile.in: Regenerate.
5141
5142 2010-06-09 Nick Clifton <nickc@redhat.com>
5143
5144 * yyscript.y (input_list_element): Allow strings prefixed with
5145 the '-' character. Treat these as libraries.
5146 * script.cc (script_add_library): New function. Adds a library
5147 specified by "-l<name>" found in an input script.
5148 * script-c.h: Add prototype for script_add_library.
5149
5150 2010-06-07 Doug Kwan <dougkwan@google.com>
5151
5152 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5153 Restrict stub-group size to be within long conditional branch
5154 range when working around cortex-A8 erratum.
5155
5156 2010-06-07 Damien Diederen <dd@crosstwine.com>
5157
5158 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5159 #ifdef typo.
5160
5161 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5162
5163 PR gold/11658
5164 * output.cc
5165 (Output_section::Input_section_sort_entry::compare_section_ordering):
5166 Change to return non-zero correctly.
5167 (Output_section::Input_section_sort_section_order_index_compare
5168 ::operator()): Change to fix ambiguity in comparisons.
5169
5170 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5171
5172 * gold.h (is_wildcard_string): New function.
5173 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5174 (Layout::layout_eh_frame): Ditto.
5175 (Layout::find_section_order_index): New method.
5176 (Layout::read_layout_from_file): New method.
5177 * layout.h (Layout::find_section_order_index): New method.
5178 (Layout::read_layout_from_file): New method.
5179 (Layout::input_section_position_): New private member.
5180 (Layout::input_section_glob_): New private member.
5181 * main.cc (main): Call read_layout_from_file here.
5182 * options.h (--section-ordering-file): New option.
5183 * output.cc (Output_section::input_section_order_specified_): New
5184 member.
5185 (Output_section::Output_section): Initialize new member.
5186 (Output_section::add_input_section): Add new parameter.
5187 Keep input sections when --section-ordering-file is used.
5188 (Output_section::set_final_data_size): Sort input sections when
5189 section ordering file is specified.
5190 (Output_section::Input_section_sort_entry): Add new parameter.
5191 Check sorting type.
5192 (Output_section::Input_section_sort_entry::compare_section_ordering):
5193 New method.
5194 (Output_section::Input_section_sort_compare::operator()): Change to
5195 consider section_order_index.
5196 (Output_section::Input_section_sort_init_fini_compare::operator()):
5197 Change to consider section_order_index.
5198 (Output_section::Input_section_sort_section_order_index_compare
5199 ::operator()): New method.
5200 (Output_section::sort_attached_input_sections): Change to sort
5201 according to section order when specified.
5202 (Output_section::add_input_section<32, true>): Add new parameter.
5203 (Output_section::add_input_section<64, true>): Add new parameter.
5204 (Output_section::add_input_section<32, false>): Add new parameter.
5205 (Output_section::add_input_section<64, false>): Add new parameter.
5206 * output.h (Output_section::add_input_section): Add new parameter.
5207 (Output_section::input_section_order_specified): New
5208 method.
5209 (Output_section::set_input_section_order_specified): New method.
5210 (Input_section::Input_section): Initialize section_order_index_.
5211 (Input_section::section_order_index): New method.
5212 (Input_section::set_section_order_index): New method.
5213 (Input_section::section_order_index_): New member.
5214 (Input_section::Input_section_sort_section_order_index_compare): New
5215 struct.
5216 (Output_section::input_section_order_specified_): New member.
5217 * script-sections.cc (is_wildcard_string): Delete and move modified
5218 method to gold.h.
5219 (Output_section_element_input::Output_section_element_input): Modify
5220 call to is_wildcard_string.
5221 (Output_section_element_input::Input_section_pattern
5222 ::Input_section_pattern): Ditto.
5223 (Output_section_element_input::Output_section_element_input): Ditto.
5224 * testsuite/Makefile.am (final_layout): New test case.
5225 * testsuite/Makefile.in: Regenerate.
5226 * testsuite/final_layout.cc: New file.
5227 * testsuite/final_layout.sh: New file.
5228
5229 2010-06-01 Rafael Espindola <espindola@google.com>
5230
5231 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5232
5233 2010-06-01 Rafael Espindola <espindola@google.com>
5234
5235 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5236 visibility of symbols.
5237
5238 2010-05-27 Doug Kwan <dougkwan@google.com>
5239
5240 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5241 from start of output section instead of address for a local symbol
5242 in a merged or relaxed section when doing a relocatable link.
5243
5244 2010-05-26 Rafael Espindola <espindola@google.com>
5245
5246 PR 11604
5247 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5248 adding sections the garbage collector removed.
5249 * gold/testsuite/Makefile.am: Add test.
5250 * gold/testsuite/Makefile.in: Regenerate.
5251 * gold/testsuite/plugin_test_7.sh: New.
5252 * gold/testsuite/plugin_test_7_1.c: New.
5253 * gold/testsuite/plugin_test_7_2.c: New.
5254
5255 2010-05-26 Rafael Espindola <espindola@google.com>
5256
5257 * script-sections.cc (Output_section_definition::set_section_addresses):
5258 Check for --section-start.
5259
5260 2010-05-26 Doug Kwan <dougkwan@google.com>
5261
5262 * arm.cc (Arm_scan_relocatable_relocs): New class.
5263 (Target_arm::relocate_special_relocatable): New method.
5264 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5265 (Arm_relocate_functions::thumb_branch_common): Same.
5266 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5267 instead of Default_scan_relocatable_relocs.
5268 * target-reloc.h (relocate_for_relocatable): Let target handle
5269 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5270 * target.h (Sized_target::relocate_special_relocatable): New method.
5271
5272 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5273
5274 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5275
5276 2010-05-23 Doug Kwan <dougkwan@google.com>
5277
5278 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5279 instead of a cast.
5280 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5281 with a direct branch, not a conditional branch, to a stub.
5282 * merge.cc (Output_merge_base::record_input_section): New method
5283 defintion.
5284 (Output_merge_data::do_add_input_section): Record input section if
5285 keeps-input-sections flag is set.
5286 (Output_merge_string::do_add_input_section): Ditto.
5287 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5288 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5289 INPUT_SECTIONS_.
5290 (Output_merge_base::keeps_input_sections,
5291 Output_merge_base::set_keeps_input_sections,
5292 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5293 method definitions.
5294 (Output_merge_base::Input_sections): New type declaration.
5295 (Output_merge_base::input_sections_begin,
5296 Output_merge_base::input_sections_end,
5297 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5298 (Output_merge_base::bool keeps_input_sections_,
5299 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5300 Output_merge_base::input_sections_): New data members.
5301 (Output_merge_data::do_set_keeps_input_sections): New method
5302 defintion.
5303 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5304 * output.cc (Output_section::Input_section::relobj): Move method
5305 defintion from class declaration to here and handle merge sections.
5306 (Output_section::Input_section::shndx): Ditto.
5307 (Output_section::Output_section): Remove initializations of removed
5308 data members and initialize new data member LOOKUP_MAPS_.
5309 (Output_section::add_input_section): Set keeps-input-sections flag
5310 for a newly created merge output section as appropriate. Adjust code
5311 to use Output_section_lookup_maps class.
5312 (Output_section::add_relaxed_input_section): Adjst code for lookup
5313 maps code refactoring.
5314 (Output_section::add_merge_input_section): Add a new parameter
5315 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5316 class. If adding input section to a newly created merge output
5317 section fails, remove the new merge section.
5318 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5319 Adjust code for use of the Output_section_lookup_maps class.
5320 (Output_section::find_merge_section): Ditto.
5321 (Output_section::build_lookup_maps): New method defintion.
5322 (Output_section::find_relaxed_input_section): Adjust code to use
5323 Output_section_lookup_maps class.
5324 (Output_section::get_input_sections): Export merge sections. Adjust
5325 code to use Output_section_lookup_maps class.
5326 (Output_section:::add_script_input_section): Adjust code to use
5327 Output_section_lookup_maps class. Update lookup maps for merge
5328 sections also.
5329 (Output_section::discard_states): Use Output_section_lookup_maps.
5330 (Output_section::restore_states): Same.
5331 * output.h (Merge_section_properties): Move class defintion out of
5332 Output_section.
5333 (Output_section_lookup_maps): New class.
5334 (Output_section::Input_section::is_merge_section): New method
5335 defintion.
5336 (Output_section::Input_section::relobj): Move defintion out of class
5337 defintion. Declare method only.
5338 (Output_section::Input_section::shndx): Ditto.
5339 (Output_section::Input_section::output_merge_base): New method defintion.
5340 (Output_section::Input_section::u2_.pomb): New union field.
5341 (Output_section::Merge_section_by_properties_map,
5342 Output_section::Output_section_data_by_input_section_map,
5343 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5344 Remove types.
5345 (Output_section::add_merge_input_section): Add new parameter
5346 KEEPS_INPUT_SECTIONS.
5347 (Output_section::build_lookup_maps): New method declaration.
5348 (Output_section::merge_section_map_,
5349 Output_section::merge_section_by_properties_map_,
5350 Output_section::relaxed_input_section_map_,
5351 Output_section::is_relaxed_input_section_map_valid_): Remove data
5352 members.
5353 (Output_section::lookup_maps_): New data member.
5354
5355 2010-05-21 Doug Kwan <dougkwan@google.com>
5356
5357 PR gold/11619
5358 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5359 avoid a compilation error.
5360
5361 2010-05-19 Rafael Espindola <espindola@google.com>
5362
5363 * script-sections.cc (Output_section_definition::allocate_to_segment):
5364 Update the phdrs_list even when the output section is NULL.
5365 * testsuite/Makefile.am: Add test.
5366 * testsuite/Makefile.in: Regenerate.
5367 * testsuite/script_test_9.cc: New.
5368 * testsuite/script_test_9.sh: New.
5369 * testsuite/script_test_9.t: New.
5370
5371 2010-05-19 Doug Kwan <dougkwan@google.com>
5372
5373 * arm.cc (Arm_input_section::original_size): New method.
5374 (Arm_input_section::do_addralign): Add a cast.
5375 (Arm_input_section::do_output_offset): Remove static cast.
5376 (Arm_input_section::original_addralign,
5377 Arm_input_section::original_size_): Change type to uint32_t.
5378 (Arm_input_section::init): Add safe casts for section alignment
5379 and size.
5380 (Arm_input_section::set_final_data_size): Do not set address and
5381 offset of stub table.
5382 (Arm_output_section::fix_exidx_coverage): Change use of of
5383 Output_section::Simple_input_section to that of
5384 Output_section::Input_section.
5385 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5386 except for the first pass.
5387 * output.cc (Output_section::get_input_sections): Change type of
5388 input_sections to std::list<Input_section>.
5389 (Output_section::add_script_input_section): Rename from
5390 Output_section::add_simple_input_section. Change type of SIS
5391 parameter from Simple_input_section to Input_section.
5392 * output.h (Output_section::Simple_input_section): Remove class.
5393 (Output_section::Input_section): Change class visibility to public.
5394 (Output_section::Input_section::addralign): Use stored alignments
5395 for special input sections if set.
5396 (Output_section::Input_section::set_addralign): New method.
5397 (Output_section::get_input_sections): Change parameter type from
5398 list of Simple_input_section to list of Input_section.
5399 (Output_section::add_script_input_section): Rename from
5400 Output_section::add_simple_input_section. Change first parameter's
5401 type from Simple_input_section to Input_section and remove the
5402 second and third parameters.
5403 * script-sections.cc (Input_section::Input_section_list): Change
5404 type to list of Output_section::Input_section/
5405 (Input_section_info::Input_section_info): Change parameter type of
5406 INPUT_SECTION to Output_section::Input_section.
5407 (Input_section_info::input_section): Change return type.
5408 (Input_section_info::input_section_): Change type to
5409 Output_section::Input_section.
5410 (Output_section_element_input::set_section_addresses): Adjust code
5411 to use Output_section::Input_section instead of
5412 Output_section::Simple_input_section. Adjust code for renaming
5413 of Output_section::add_simple_input_section.
5414 (Orphan_output_section::set_section_addresses): Ditto.
5415
5416 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5417
5418 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5419 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5420
5421 2010-05-18 Rafael Espindola <espindola@google.com>
5422
5423 * options.cc (General_options::finalize): Handle -nostdlib.
5424 * options.h (nostdlib): New option.
5425 * script.cc (script_add_search_dir): Handle -nostdlib.
5426
5427 2010-05-12 Doug Kwan <dougkwan@google.com>
5428
5429 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5430 attributes section only if there no attributes section after merging.
5431 (Target_arm::merge_object_attributes): Move value of
5432 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5433 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5434 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5435 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5436 and arm_attr_merge_7.stdout.
5437 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5438 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5439 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5440 arm_attr_merge_7b.o): New rules.
5441 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5442 arm_attr_merge_7
5443 * testsuite/Makefile.in: Regenerate.
5444 * testsuite/arm_attr_merge.sh: New file.
5445 * testsuite/arm_attr_merge_[67][ab].s: Same.
5446
5447 2010-05-05 Nick Clifton <nickc@redhat.com>
5448
5449 * po/es.po: Updated Spanish translation.
5450
5451 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5452
5453 * Makefile.am (install-exec-local): Properly install gold as
5454 default cross linker.
5455 * Makefile.in: Regenerated.
5456
5457 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5458 Nick Clifton <nickc@redhat.com>
5459
5460 * configure.ac (install_as_default): Define and set to false
5461 unless --enable-gold or --enable-gold=both/gold has been
5462 specified.
5463 * configure: Regenerate.
5464
5465 * Makefile.am (install-exec-local): Install the executable as
5466 'ld.gold'. If install_as_default is true then also install it as
5467 'ld'.
5468 * Makefile.in: Regenerated.
5469
5470 2010-04-24 Ian Lance Taylor <iant@google.com>
5471
5472 * layout.cc (Layout::layout_reloc): In relocatable link don't
5473 combine reloc sections for grouped sections.
5474
5475 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5476
5477 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5478 sections that are not ordinary to icf.
5479 * icf.cc (get_section_contents): Handle relocation pointing to section
5480 with no object or shndx information.
5481 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5482 * testsuite/Makefile.in: Regenerate.
5483 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5484 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5485
5486 2010-04-22 Ian Lance Taylor <iant@google.com>
5487
5488 * expression.cc (Expression::Expression_eval_info): Add
5489 result_alignment_pointer field.
5490 (Expression::eval_with_dot): Add result_alignment_pointer
5491 parameter. Change all callers.
5492 (Expression::eval_maybe_dot): Likewise.
5493 (class Binary_expression): Add alignment_pointer parameter to
5494 left_value and right_value. Change all callers.
5495 (BINARY_EXPRESSION): Set result alignment.
5496 (class Trinary_expression): Add alignment_pointer parameter to
5497 arg2_value and arg3_value. Change all callers.
5498 (Trinary_cond::value): Set result alignment.
5499 (Max_expression::value, Min_expression::value): Likewise.
5500 (Align_expression::value): Likewise.
5501 * script-sections.cc (class Sections_element): Add dot_alignment
5502 parameter to set_section_addresses virtual function. Update
5503 instantiations.
5504 (class Output_section_element): Likewise.
5505 (Script_sections::create_segments): Add dot_alignment parameter.
5506 Change all callers.
5507 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5508 (Script_sections::set_phdrs_clause_addresses): Likewise.
5509 * script-sections.h: Update declarations.
5510 * script.h: Update declarations.
5511 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5512 min_p_align.
5513 * testsuite/script_test_3.t: Set large alignment.
5514 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5515 segment has expected alignment.
5516
5517 2010-04-22 Nick Clifton <nickc@redhat.com>
5518
5519 * po/gold.pot: Updated by the Translation project.
5520 * po/vi.po: Updated Vietnamese translation.
5521
5522 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5523
5524 * testsuite/Makefile.am (check_PROGRAMS): Add
5525 icf_virtual_function_folding_test.
5526 * testsuite/Makefile.in: Regenerated.
5527
5528 2010-04-15 Andrew Haley <aph@redhat.com>
5529
5530 * options.h (merge_exidx_entries): New option.
5531 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5532 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5533 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5534 (Target_arm::merge_exidx_entries): New function.
5535 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5536 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5537 to Arm_exidx_fixup constructor.
5538 Add new arg, merge_exidx_entries.
5539 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5540 Arm_output_section::fix_exidx_coverage.
5541
5542 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5543
5544 * icf.cc (get_section_contents): Check for preemptible functions.
5545 Ignore addend when appropriate.
5546 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5547 section folded.
5548 (add_from_relobj): Check for section folded.
5549 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5550 * symtab.h (should_add_dynsym_entry): Add new parameter.
5551 * target-reloc.h (scan_relocs): Check for section folded.
5552 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5553 Check reloc types for function pointers in shared objects.
5554 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5555 case.
5556 (icf_preemptible_functions_test): New test case.
5557 (icf_string_merge_test): New test case.
5558 * testsuite.Makefile.in: Regenerate.
5559 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5560 bar_glob. Refactor code.
5561 * testsuite/icf_preemptible_functions_test.cc: New file.
5562 * testsuite/icf_preemptible_functions_test.sh: New file.
5563 * testsuite/icf_string_merge_test.cc: New file.
5564 * testsuite/icf_string_merge_test.sh: New file.
5565 * testsuite/icf_virtual_function_folding_test.cc: New file.
5566 * testsuite/icf_virtual_function_folding_test.sh: New file.
5567
5568 2010-04-14 Doug Kwan <dougkwan@google.com>
5569
5570 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5571 for local symbol recounting if we remove a section due to ICF.
5572 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5573 there are no regular objects in input.
5574
5575 2010-04-13 Doug Kwan <dougkwan@google.com>
5576
5577 * arm.cc (Arm_input_section::set_final_data_size): Compute
5578 accurate final data size instead of using current data size.
5579
5580 2010-04-09 Doug Kwan <dougkwan@google.com>
5581
5582 * layout.cc (Layout::choose_output_section): Handle script section
5583 types.
5584 (Layout::make_output_section_for_script): Add section type parameter.
5585 Handle script section types.
5586 * layout.h (Layout::make_output_section_for_script): Add section
5587 type parameter.
5588 * output.cc (Output_section::Output_section): Initialize data member
5589 is_noload_.
5590 (Output_section::do_reset_address_and_file_offset): Do not set address
5591 to 0 if section is a NOLOAD section.
5592 * output.h (Output_section::is_noload): New method.
5593 (Output_section::set_is_noload): Ditto.
5594 (Output_section::is_noload_): New data member.
5595 * script-c.h (Script_section_type): New enum type.
5596 (struct Parser_output_section_header): Add new file section_type.
5597 * script-sections.cc (Sections_element::output_section_name): Add
5598 parameter for returning script section type.
5599 (Output_section_definition::output_section_name): Ditto.
5600 (Output_section_definition::section_type)P; New method.
5601 (Output_section_definiton::script_section_type_name): Ditto.
5602 (Output_section_definition::script_section_type_): New data member.
5603 (Output_section_definition::Output_section_definition): Initialize
5604 data member Output_section_definition::script_section_type_.
5605 (Output_section_definition::create_sections): Pass script section type
5606 to Layout::make_output_section_for_script.
5607 (Output_section_definition::output_section_name): Return script
5608 section type to caller.
5609 (Output_section_definition::set_section_address): Do not advance
5610 dot value and load address if section type is NOLOAD. Set address
5611 of NOLOAD sections regardless of section flags.
5612 (Output_section_definition::print): Print section type if it is
5613 not SCRIPT_SECTION_TYPE_NONE.
5614 (Output_section_definition::section_type): New method.
5615 (Output_section_definition::script_section_type_name): Ditto.
5616 (Script_sections::output_section_name): Add new parameter
5617 PSECTION_TYPE for returning script section type. Pass it to
5618 section elements. Handle discard sections.
5619 (Sort_output_sections::operator()): Handle NOLOAD sections.
5620 * script-sections.h (Script_sections::Section_type): New enum type.
5621 (Script_sections::output_section_name): Add a new parameter for
5622 returning script section type.
5623 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5624 INFO and NOLOAD.
5625 * yyscript.y (union): Add new field SECTION_TYPE.
5626 (COPY, DSECT, INFO, NOLOAD): New tokens.
5627 (opt_address_and_section_type): Change type to output_section_header.
5628 (section_type): New non-terminal
5629 (section_header): Handle section type.
5630 (opt_address_and_section_type): Return section type value.
5631
5632 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5633
5634 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5635 * testsuite/plugin_common_test_2.c (foo): Likewise.
5636
5637 2010-04-08 Doug Kwan <dougkwan@google.com>
5638
5639 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5640 Output_merge_data.
5641 * output.cc (Output_section::add_merge_input_section): Simplify
5642 code and return status of Output_merge_base::add_input_section.
5643 Update merge section map only if Output_merge_base::add_input_section
5644 returns true.
5645
5646 2010-04-07 Doug Kwan <dougkwan@google.com>
5647
5648 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5649 if section is marked as containing instructions but has no mapping
5650 symbols.
5651 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5652 correct section index.
5653 (Arm_relobj::find_linked_text_section): Ditto.
5654
5655 2010-04-07 Cary Coutant <ccoutant@google.com>
5656
5657 * archive.cc (include_member): Destroy Read_symbols_data object before
5658 releasing file.
5659 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5660 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5661 (Read_symbols_data::~Read_symbols_data) New destructor.
5662 (Section_relocs::Section_relocs) New constructor.
5663 (Section_relocs::~Section_relocs) New destructor.
5664 (Read_relocs_data::Read_relocs_data) New constructor.
5665 (Read_relocs_data::~Read_relocs_data) New destructor.
5666 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5667 pointers to NULL after deleting.
5668
5669 2010-04-07 Doug Kwan <dougkwan@google.com>
5670
5671 * arm.cc: Replace "endianity" with "endianness" in comments.
5672 (Arm_exidx_cantunwind): Ditto.
5673 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5674 (Arm_relobj::merge_flags_and_attributes): New method.
5675 (Arm_relobj::merge_flags_and_attributes_): New data member.
5676 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5677 (Arm_relobj::scan_sections_for_stubs): Ditto.
5678 (Arm_relobj::do_read_symbols): Check to see if we really want to
5679 merge processor-specific flags and attributes. Exit early if
5680 an object is empty except for section names and the undefined symbol.
5681 (Target_arm::do_finalize_sections): Move check for ELF format to
5682 Arm_relobj::do_read_symbols. Merge processor specific flags and
5683 attributes from a regular object only when we have determined that
5684 it is aapropriate. Do not create an .ARM.attributes section in
5685 output if there is no regular input object.
5686 (Target_arm::merge_processor_specific_flags): Check
5687 --warn-mismatch before printing any error.
5688 (Target_arm::merge_object_attributes): Ditto.
5689 * gold.cc (queue_middle_tasks): Handle the case in which there is
5690 no regular object in input.
5691 * options.cc (General_options::parse_EB): New method.
5692 (General_options::parse_EL): Same.
5693 (General_options::General_options): Initialize endianness_.
5694 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5695 New options.
5696 (General_options::Endianness): New enum.
5697 (General_options::endianness): New method.
5698 (General_options::endianness_): New data member.
5699 * parameters.cc (Parameters::set_options): Check target endianness.
5700 (Parameters::set_target_once): Ditto.
5701 (Parameters::check_target_endianness): New method.
5702 (parameters_force_valid_target): If either -EL or -EB is specified,
5703 use it to define endianness of default target.
5704 * parameters.h (Parameters::check_target_endianness): New method
5705 declaration.
5706 * target.h (class Target): Change "endianity" to "endianness"
5707 in comments.
5708
5709 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5710
5711 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5712 * configure: Regenerate.
5713 * Makefile.in: Regenerate.
5714 * testsuite/Makefile.in: Regenerate.
5715
5716 2010-04-06 Cary Coutant <ccoutant@google.com>
5717
5718 gcc PR lto/42757
5719 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5720 prevailing definitions of common symbols.
5721 * testsuite/plugin_test_6.sh: New test case.
5722 * testsuite/plugin_common_test_1.c: New test case.
5723 * testsuite/plugin_common_test_2.c: New test case.
5724 * testsuite/Makefile.am (plugin_test_6): New test case.
5725 * testsuite/Makefile.in: Regenerate.
5726
5727 2010-04-06 Nick Clifton <nickc@redhat.com>
5728
5729 * po/vi.po: New Vietnamese translation.
5730
5731 2010-03-30 Doug Kwan <dougkwan@google.com>
5732
5733 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5734
5735 2010-03-25 Doug Kwan <dougkwan@google.com>
5736
5737 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5738 to avoid a conversion warning on a 32-bit host.
5739
5740 2010-03-24 Ian Lance Taylor <iant@google.com>
5741
5742 * testsuite/script_test_3.t: Add a TLS segment.
5743 * testsuite/Makefile.am (check_PROGRAMS): Add
5744 tls_phdrs_script_test.
5745 (tls_phdrs_script_test_SOURCES): Define.
5746 (tls_phdrs_script_test_DEPENDENCIES): Define.
5747 (tls_phdrs_script_test_LDFLAGS): Define.
5748 (tls_phdrs_script_test_LDADD): Define.
5749 * testsuite/Makefile.in: Rebuild.
5750
5751 2010-03-23 Cary Coutant <ccoutant@google.com>
5752
5753 * fileread.cc (find_or_make_view): Fix comment.
5754
5755 2010-03-23 Ian Lance Taylor <iant@google.com>
5756
5757 * script-sections.cc (class Orphan_section_placement): Define
5758 PLACE_TLS and PLACE_TLS_BSS.
5759 (Orphan_section_placement::Orphan_section_placement): Initialize
5760 new places.
5761 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5762 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5763 (tls_script_test_SOURCES): Define.
5764 (tls_script_test_DEPENDENCIES): Define.
5765 (tls_script_test_LDFLAGS): Define.
5766 (tls_script_test_LDADD): Define.
5767 * testsuite/Makefile.in: Rebuild.
5768
5769 2010-03-22 Doug Kwan <dougkwan@google.com>
5770
5771 * arm.cc (Arm_relocate_functions::abs8,
5772 Arm_relocate_functions::abs16): Use correct check for overflow
5773 specified in the ARM ELF specs.
5774 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5775 target of a BLX instruction specially.
5776 (Reloc_stub::stub_type_for_reloc): Ditto.
5777 (Relocate::relocate): Use symbolic names instead of numeric relocation
5778 codes to report error.
5779 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5780 workaround.
5781 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5782 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5783 thumb2_blx_out_of_range.stdout
5784 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5785 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5786 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5787 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5788 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5789 thumb2_blx_in_range, thumb2_blx_in_range.o,
5790 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5791 thumb2_blx_out_of_range.o): New rules.
5792 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5793 thumb2_blx_in_range and thumb2_blx_out_of_range.
5794 * testsuite/Makefile.in: Regenerate.
5795 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5796 * testsuite/thumb_blx_in_range.s: New file.
5797 * testsuite/thumb_blx_out_of_range.s: New file.
5798
5799 2010-03-22 Rafael Espindola <espindola@google.com>
5800
5801 * archive.cc (Should_include): Move to archive.h.
5802 (should_include_member): Make it a member of Archive.
5803 (Lib_group): New.
5804 (Add_lib_group_symbols): New.
5805 * archive.h: Include options.h.
5806 (Archive_member): Moved from Archive.
5807 (Should_include): Moved from archive.cc.
5808 (Lib_group): New.
5809 (Add_lib_group_symbols): New.
5810 * dynobj.cc (do_should_include_member): New.
5811 * dynobj.h (do_should_include_member): New.
5812 * gold.cc (queue_initial_tasks): Update call to queue.
5813 * main.cc (main): Print lib group stats.
5814 * object.cc (do_should_include_member): New.
5815 * object.h: Include archive.h.
5816 (Object::should_include_member): New.
5817 (Object::do_should_include_member): New.
5818 (Sized_relobj::do_should_include_member): New.
5819 * options.cc (General_options::parse_start_lib): New.
5820 (General_options::parse_end_lib): New.
5821 (Input_arguments::add_file): Handle lib groups.
5822 (Input_arguments::start_group): Check we are not in a lib.
5823 (Input_arguments::start_lib): New.
5824 (Input_arguments::end_lib): New.
5825 * options.h (General_options): Add start_lib and end_lib.
5826 (Input_argument::lib_): New.
5827 (Input_argument::lib): New.
5828 (Input_argument::is_lib): New.
5829 (Input_file_lib): New.
5830 (Input_arguments::in_lib_): New.
5831 (Input_arguments::in_lib): New.
5832 (Input_arguments::start_lib): New.
5833 (Input_arguments::end_lib_): New.
5834 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5835 in unused members as preempted.
5836 (Sized_pluginobj::do_should_include_member): New.
5837 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5838 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5839 return the blocker.
5840 (Read_symbols::do_whole_lib_group): New.
5841 (Read_symbols::do_lib_group): New.
5842 (Read_symbols::do_read_symbols): Handle lib groups.
5843 (Read_symbols::get_name): Handle lib groups.
5844 * readsyms.h (Read_symbols): Add an archive member pointer.
5845 (Read_symbols::do_whole_lib_group): New.
5846 (Read_symbols::do_lib_group): New.
5847 (Read_symbols::member_): New.
5848 * script.cc (read_input_script): Update call to queue_soon.
5849
5850 2010-03-19 Doug Kwan <dougkwan@google.com>
5851
5852 * arm.cc (Stub_table::Stub_table): Initialize new data members
5853 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5854 (Stub_table::add_reloc_stub): Assign stub offset and update
5855 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5856 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5857 New data members.
5858 (Stub_table::update_data_size_and_addralign): Use
5859 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5860 instead of going over all reloc stubs.
5861 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5862 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5863 Stringpool_template::offset_ to size of Stringpool_char.
5864 (Stringpool_template::new_key_offset): Remove code to initialize
5865 Stringpool_template::offset_.
5866 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5867 Stringpool_template::offset_ to zero.
5868
5869 2010-03-15 Doug Kwan <dougkwan@google.com>
5870
5871 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5872 offset_.
5873 (Stringpool_template::new_key_offset): New method.
5874 (Stringpool_template::add_string): Assign offsets when adding new
5875 strings.
5876 (Stringpool_template::set_string_offsets): Do not set string offsets
5877 when not optimizing.
5878 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5879 member size_.
5880 (Chunked_vector::clear): Clear size_.
5881 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5882 (Chunked_vector::size): Return size_.
5883 (Chunked_vector::push_back): Use size_ to find insert position.
5884 (Chunked_vector::size_): New data member.
5885 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5886 (Stringpool_template::new_key_offset): New method declaration.
5887 (Stringpool_template::offset_): New data member.
5888
5889 2010-03-15 Rafael Espindola <espindola@google.com>
5890
5891 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5892 Add_symbols' constructor.
5893 * readsyms.h (Add_symbols): Remove the input_group member.
5894
5895 2010-03-10 Ian Lance Taylor <iant@google.com>
5896
5897 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5898 target to ask whether a reference to a symbol requires a stack
5899 split.
5900 * target.h (Target::is_call_to_non_split): New function.
5901 (Target::do_is_call_to_non_split): Declare virtual function.
5902 * target.cc: Include "symtab.h".
5903 (Target::do_is_call_to_non_split): New function.
5904 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5905
5906 2010-03-10 Cary Coutant <ccoutant@google.com>
5907
5908 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5909 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5910 (File_read::open[2]): Add whole_file_view_ to list of views.
5911 (File_read::make_view): Remove test of whole_file_view_.
5912 (File_read::find_or_make_view): Create whole_file_view_ if
5913 necessary.
5914 (File_read::clear_views): Replace bool parameter with enum;
5915 adjust all callers. Don't delete views with permanent data;
5916 do delete cached views and views from archives if
5917 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5918 if clearing the corresponding view.
5919 * fileread.h (File_read::Clear_views_mode): New enum.
5920 (File_read::View::is_permanent_view): New method.
5921 (File_read::clear_views): Replace bool parameter
5922 with enum; adjust all callers.
5923 * options.h (General_options): Change keep_files_mapped option;
5924 add map_whole_files.
5925 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5926 releasing the file.
5927 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5928 the file.
5929
5930 2010-03-10 David S. Miller <davem@davemloft.net>
5931
5932 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5933
5934 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5935
5936 * icf.cc (get_section_contents): Add '@' marker after processing the
5937 merge reloc.
5938
5939 2010-03-08 Doug Kwan <dougkwan@google.com>
5940
5941 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5942 due to a conversion warning.
5943 (Arm_relobj::update_output_local_symbol_count): Check for local
5944 symbol with unset output index.
5945
5946 2010-03-05 Ian Lance Taylor <iant@google.com>
5947
5948 * options.h (class General_options): Add --spare-dynamic-tags.
5949 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5950 --spare-dynamic-tags.
5951
5952 2010-03-05 Ian Lance Taylor <iant@google.com>
5953
5954 * incremental.cc: Include "libiberty.h".
5955
5956 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5957
5958 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5959 function, is_info_ member.
5960 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5961 (Versions::Versions): Update caller.
5962 (Versions::define_base_version): Likewise.
5963 (Versions::add_def): Likewise.
5964
5965 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5966
5967 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5968 (Scan::possible_function_pointer_reloc): New function.
5969 (Scan::local_reloc_may_be_function_pointer): Change to call
5970 possible_function_pointer_reloc.
5971 (Scan::global_reloc_may_be_function_pointer): Ditto.
5972 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5973 relocations in ".data.rel.ro._ZTV" section.
5974 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5975 * testsuite/icf_safe_so_test.cc: Ditto.
5976 * testsuite/icf_safe_test.cc: Ditto.
5977 * testsuite/icf_safe_test.sh: Ditto.
5978
5979 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5980 Ian Lance Taylor <iant@google.com>
5981
5982 * target-reloc.h (relocate_section): Check the symbol table index
5983 for -1U before setting the local symbol index.
5984 (scan_relocatable_relocs): If copying the relocation, record that
5985 the local symbol is required.
5986 * object.h (Symbol_value::is_output_symtab_index_set): New
5987 function.
5988 (Symbol_value::may_be_discarded_from_output_symtab): New
5989 function.
5990 (Symbol_value::has_output_symtab_entry): New function.
5991 (Symbol_value::needs_output_symtab_entry): Remove.
5992 (Symbol_value::output_symtab_index): Make sure the symbol index is
5993 set.
5994 (Symbol_value::set_output_symtab_index): Make sure the symbol
5995 index is not set. Make sure the new index is valid.
5996 (Symbol_value::set_must_have_output_symtab_entry): New function.
5997 (Symbol_value::has_output_dynsym_entry): New function.
5998 (Symbol_value::set_output_dynsym_index): Make sure the new index
5999 is valid.
6000 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6001 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6002 local symbol if permitted.
6003 (Sized_relobj::do_finalize_local_symbols): Call
6004 is_output_symtab_index_set rather than needs_output_symtab_entry.
6005 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6006 rather than needs_output_symtab_entry. Call
6007 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6008 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6009 is_output_symtab_index_set rather than needs_output_symtab_entry.
6010 * testsuite/discard_locals_relocatable_test.c: New file.
6011 * testsuite/discard_locals_test.sh: Test -r.
6012 * testsuite/Makefile.am (check_DATA): Add
6013 discard_locals_relocatable_test1.syms,
6014 discard_local_relocatable_test2.syms.
6015 (MOSTLYCLEANFILES): Likewise. Also add
6016 discard_locals_relocatable_test1.lout and
6017 discard_locals_relocatable_test2.out.
6018 (discard_locals_relocatable_test1.syms): New target.
6019 (discard_locals_relocatable_test.o): New target.
6020 (discard_locals_relocatable_test1.out): New target.
6021 (discard_locals_relocatable_test2.syms): New target.
6022 (discard_locals_relocatable_test2.out): New target.
6023 (various): Add missing ../ld-new dependencies.
6024 * testsuite/Makefile.in: Rebuild.
6025
6026 2010-03-03 Nick Clifton <nickc@redhat.com>
6027
6028 * po/fi.po: New Finnish translation.
6029
6030 2010-03-01 Doug Kwan <dougkwan@google.com>
6031
6032 * layout.cc (Layout::Layout): Force section types of .init_array*,
6033 .preinit_array* and .fini_array* sections.
6034 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6035 Fix check of return value of std::string::find.().
6036 (Output_section::Input_section_sort_compare::operator()): Remove
6037 comment about .init_array.
6038 (Output_section::Input_section_sort_init_fini_compare::operator()):
6039 New method.
6040 (Output_section::sort_attached_input_sections): Handle .init_array
6041 and .fini_array specially.
6042 * output.h (Output_section::Inut_section_sort_compare): Update
6043 comment.
6044 (Output_section::Input_section_sort_init_fini_compare): New struct.
6045
6046 2010-02-26 Doug Kwan <dougkwan@google.com>
6047
6048 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6049 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6050 * testsuite/debug_msg.sh: Avoid matching source line number for
6051 use of global variable undef_int.
6052
6053 2010-02-26 Doug Kwan <dougkwan@google.com>
6054
6055 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6056 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6057 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6058 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6059 * options.cc (General_options::General_options): Initialize member
6060 fix_v4bx_.
6061 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6062 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6063 and rm_no_fix_v4bx.stdout
6064 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6065 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6066 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6067 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6068 and arm_no_fix_v4bx.
6069 * Makefile.in: Regenerate.
6070 * testsuite/arm_fix_v4bx.s: New file.
6071 * testsuite/arm_fix_v4bx.sh: Ditto.
6072
6073 2010-02-24 Doug Kwan <dougkwan@google.com>
6074
6075 * arm.cc (Target_arm::got_section): Make the .got section the first
6076 non RELRO section in the data segment.
6077 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6078 suffixes of section names.
6079
6080 2010-02-24 Doug Kwan <dougkwan@google.com>
6081
6082 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6083 flags and attributes merging if an input file is a binary file.
6084 * fileread.cc (Input_file::open): Record format of original file.
6085 * fileread.h (Input_file::Format): New enum type.
6086 (Input_file::Input_file): Initialize data member format_.
6087 (Input_file::format): New method definition.
6088 (Input_file::format_):: New data member.
6089
6090 2010-02-24 Doug Kwan <dougkwan@google.com>
6091
6092 * arm.cc (Arm_output_data_got): New class.
6093 (ARM_TCB_SIZE): New constant
6094 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6095 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6096 If user uses a script with a SECTIONS clause, issue only a warning
6097 for a misplaced EXIDX input section. Otherwise, issue an error.
6098 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6099 garbage collection.
6100 (Target_arm::got_mode_index_entry): Handle static linking.
6101 (Target_arm::Scan::local): Ditto.
6102 (Target_arm::Scan::global): Ditto.
6103 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6104 all incorrectly implemented relocations.
6105 (Target_arm::fix_exidx_coverage): Pass layout to
6106 Arm_output_section::fix_exidx_coverage.
6107 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6108 from ".ARM.exidx." and ".ARM.extab.".
6109
6110 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6111
6112 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6113 section if it does not already exist.
6114 * attributes.cc (Attributes_section_data::Attributes_section_data):
6115 Don't crash if size is zero.
6116
6117 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6118 Ian Lance Taylor <iant@google.com>
6119
6120 * gold.cc (queue_middle_tasks): If no input files were opened,
6121 exit.
6122 * workqueue.h (Task_function::Task_function): Assert that there is
6123 a blocker.
6124
6125 2010-02-22 Doug Kwan <dougkwan@google.com>
6126
6127 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6128 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6129 types to avoid warnings due to different uint64_t implementations
6130 on different hosts.
6131
6132 2010-02-21 Doug Kwan <dougkwan@google.com>
6133
6134 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6135 handling of the maximum backward branch offset.
6136 (Arm_relocate_functions::thumb_branch_common): Ditto.
6137 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6138 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6139 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6140 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6141 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6142 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6143 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6144 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6145 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6146 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6147 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6148 thumb2_bl_out_of_range.o): New rules.
6149 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6150 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6151 thumb2_bl_out_of_range
6152 * testsuite/Makefile.in: Regenerate.
6153 * testsuite/arm_bl_in_range.s: New file.
6154 * testsuite/arm_bl_out_of_range.s: Ditto.
6155 * testsuite/arm_branch_in_range.sh: Ditto.
6156 * testsuite/arm_branch_range.t: Ditto.
6157 * testsuite/thumb2_branch_range.t: Ditto.
6158 * testsuite/thumb_bl_in_range.s: Ditto.
6159 * testsuite/thumb_bl_out_of_range.s: Ditto.
6160 * testsuite/thumb_branch_range.t: Ditto.
6161
6162 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6163
6164 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6165 Add reloc offset information.
6166 * icf.cc (get_section_contents): Change iterators to point to the new
6167 vectors. Add reloc offset information to the contents.
6168 * icf.h (Icf::Sections_reachable_info): New typedef.
6169 (Icf::Sections_reachable_list): New typedef.
6170 (Icf::Offset_info): New typedef.
6171 (Icf::Reloc_info): New struct typedef.
6172 (Icf::Reloc_info_list): New typedef.
6173 (Icf::symbol_reloc_list): Delete method.
6174 (Icf::addend_reloc_list): Delete method.
6175 (Icf::section_reloc_list): Delete method.
6176 (Icf::reloc_info_list): New method.
6177 (Icf::reloc_info_list_): New member.
6178
6179 2010-02-19 Doug Kwan <dougkwan@google.com>
6180
6181 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6182 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6183 * arm.cc (Arm_relocation_functions): New forward declaration.
6184 (Target_arm::Target_arm): Initialize new data members
6185 got_mod_index_offset_ and tls_base_symbol_defined_.
6186 (Target_arm::Relocate::relocate_tls): New method.
6187 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6188 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6189 New methods.
6190 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6191 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6192 (Target_arm::got_mod_index_offset_,
6193 Target_arm::tls_base_symbol_defined_): New data members.
6194 (Target_arm::Scan::local, Target::Scan::global,
6195 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6196 relocations.
6197
6198 2010-02-18 Doug Kwan <dougkwan@google.com>
6199
6200 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6201 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6202 text section as a parameter becuase some broken tools may not set
6203 the link in section header.
6204 (Target_arm::has_got_section): New method.
6205 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6206 without any mapping symbol as data only. Remove warning.
6207 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6208 link in its section header, try to discover the link by inspecting the
6209 REL31 relocation at the beginning of the section.
6210 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6211 in error message.
6212 (Target_arm::Scan::global): Treat any reference to the symbol
6213 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6214
6215 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6216
6217 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6218 (Scan::global_reloc_may_be_function_pointer): New function.
6219 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6220 (Scan::global_reloc_may_be_function_pointer): New function.
6221 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6222 (Scan::global_reloc_may_be_function_pointer): New function.
6223 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6224 (Scan::global_reloc_may_be_function_pointer): New function.
6225 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6226 (Scan::global_reloc_may_be_function_pointer): New function.
6227 (Scan::possible_function_pointer_reloc): New function.
6228 (Target_x86_64::can_check_for_function_pointers): New function.
6229 * gc.h (gc_process_relocs): Scan relocation types to determine if
6230 function pointers were taken for targets that support it.
6231 * icf.cc (Icf::find_identical_sections): Include functions for
6232 folding in safe ICF whose pointer is not taken.
6233 * icf.h (Secn_fptr_taken_set): New typedef.
6234 (fptr_section_id_): New member.
6235 (section_has_function_pointers): New function.
6236 (set_section_has_function_pointers): New function.
6237 (check_section_for_function_pointers): New function.
6238 * options.h: Fix comment for safe ICF option.
6239 * target.h (can_check_for_function_pointers): New function.
6240 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6241 Modify icf_safe_test for X86-64.
6242 * testsuite/Makefile.in: Regenerate.
6243 * testsuite/icf_safe_so_test.cc: New file.
6244 * testsuite/icf_safe_so_test.sh: New file.
6245 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6246 (main): Change to take pointer to function kept_func_3.
6247 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6248 folding is done correctly for X86-64.
6249
6250 2010-02-12 David S. Miller <davem@davemloft.net>
6251
6252 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6253 is_symbolless parameter.
6254 (Output_reloc<SHT_REL>::is_symbolless): New.
6255 (Output_reloc<SHT_REL>::is_symbolless_): New.
6256 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6257 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6258 (Output_reloc<SHT_RELA>::is_symbolless): New.
6259 (Output_data_reloc::add_global): Handle is_symbolless.
6260 (Output_data_reloc::add_global_relative): Likewise.
6261 (Output_data_reloc::add_local): Likewise.
6262 (Output_data_reloc::add_local_relative): Likewise.
6263 (Output_data_reloc::add_symbolless_global_addend): New.
6264 (Output_data_reloc::add_symbolless_local_addend): New.
6265 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6266 is_symbolless.
6267 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6268 instead of ->is_relative_
6269 (Output_reloc::write): Likewise.
6270 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6271 (Output_reloc::write_rel): Simplify.
6272
6273 * sparc.cc (Target_sparc::Scan::local): Use
6274 ->add_symbolless_local_addend as needed.
6275 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6276 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6277 based upon relocation offset.
6278
6279 2010-02-11 Doug Kwan <dougkwan@google.com>
6280
6281 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6282 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6283 beginning of function.
6284 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6285 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6286 parameter is_32bit in calls to should_apply_static_reloc.
6287 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6288 (check_DATA): Add arm_abs_global.stdout.
6289 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6290 arm_abs_global.stdout): New rules.
6291 (MOSTLLYCLEANFILES): Add arm_abs_global
6292 * Makefile.in: Regenerate.
6293 * testsuite/arm_abs_global.s: New file.
6294 * testsuite/arm_abs_global.sh: Ditto.
6295 * testsuite/arm_abs_lib.s: Ditto.
6296
6297 2010-02-11 Ian Lance Taylor <iant@google.com>
6298
6299 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6300 Read_relocs task.
6301 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6302 Allocate_commons_task first.
6303 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6304 task, rather than symtab_lock_.
6305 (Gc_process_relocs::~Gc_process_relocs): New function.
6306 (Gc_process_relocs::is_runnable): Check this_blocker_.
6307 (Gc_process_relocs::locks): Use next_blocker_ rather than
6308 blocker_.
6309 (Scan_relocs::~Scan_relocs): New function.
6310 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6311 symtab_lock_.
6312 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6313 next_blocker_.
6314 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6315 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6316 constructor accordingly.
6317 (class Gc_process_relocs): Likewise.
6318 (class Scan_relocs): Likewise.
6319 * common.h (class Allocate_commons_task): Remove symtab_lock_
6320 field, and corresponding constructor parameter.
6321 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6322 symtab_lock_.
6323 (Allocate_commons_task::locks): Likewise.
6324
6325 2010-02-11 Ian Lance Taylor <iant@google.com>
6326
6327 * gold-threads.h (class Once): Define.
6328 (class Initialize_lock): Rewrite as child of Once.
6329 * gold-threads.cc (class Once_initialize): Define.
6330 (once_pointer_control): New static variable.
6331 (once_pointer, once_arg): New static variables.
6332 (c_run_once): New static function.
6333 (Once::Once, Once::run_once, Once::internal_run): New functions.
6334 (class Initialize_lock_once): Remove.
6335 (initialize_lock_control): Remove.
6336 (initialize_lock_pointer): Remove.
6337 (initialize_lock_once): Remove.
6338 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6339 (Initialize_lock::initialize): Rewrite.
6340 (Initialize_lock::do_run_once): New function.
6341 * archive.cc (Archive::interpret_header): Only clear name if it is
6342 not already empty.
6343 * fileread.cc: Include "gold-threads.h"
6344 (file_counts_lock): New static variable.
6345 (file_counts_initialize_lock): Likewise.
6346 (File_read::release): Only increment counts when using --stats.
6347 Use a lock around the increment.
6348 * parameters.cc (class Set_parameters_target_once): Define.
6349 (set_parameters_target_once): New static variable.
6350 (Parameters::Parameters): Move here from parameters.h.
6351 (Parameters::set_target): Rewrite.
6352 (Parameters::set_target_once): New function.
6353 (Parameters::clear_target): Move here and rewrite.
6354 * parameters.h (class Parameters): Update declarations. Add
6355 set_parameters_target_once_ field.
6356 (Parameters::Parameters): Move to parameters.cc.
6357 (Parameters::clear_target): Likewise.
6358 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6359 task.
6360 (Start_group::~Start_group): New function.
6361 (Start_group::is_runnable): New function.
6362 (Start_group::locks, Start_group::run): New functions.
6363 (Finish_group::run): Change saw_undefined to size_t.
6364 * readsyms.h (class Start_group): Define.
6365 (class Finish_group): Change saw_undefined_ field to size_t.
6366 (Finish_group::Finish_group): Remove saw_undefined and
6367 this_blocker parameters. Change all callers.
6368 (Finish_group::set_saw_undefined): New function.
6369 (Finish_group::set_blocker): New function.
6370 * symtab.h (class Symbol_table): Change saw_undefined to return
6371 size_t. Change saw_undefined_ field to size_t.
6372 * target-select.cc (Set_target_once::do_run_once): New function.
6373 (Target_selector::Target_selector): Initialize set_target_once_
6374 field. Don't initialize lock_ and initialize_lock_ fields.
6375 (Target_selector::instantiate_target): Rewrite.
6376 (Target_selector::set_target): New function.
6377 * target-select.h (class Set_target_once): Define.
6378 (class Target_selector): Update declarations. Make
6379 Set_target_once a friend. Remove lock_ and initialize_lock_
6380 fields. Add set_target_once_ field.
6381
6382 2010-02-10 Ian Lance Taylor <iant@google.com>
6383
6384 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6385 queueing any tasks.
6386 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6387 (queue_middle_tasks): Add all blockers before queueing any tasks.
6388 (queue_final_tasks): Likewise.
6389 * token.h (Task_token::add_blockers): New function.
6390 * object.h (Input_objects::number_of_relobjs): New function.
6391
6392 2010-02-10 Ian Lance Taylor <iant@google.com>
6393
6394 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6395 shared, not if not position independent.
6396 * x86_64.cc (Relocate::relocate_tls): Likewise.
6397 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6398 (tls_pie_pic_test): New target.
6399 * testsuite/Makefile.in: Rebuild.
6400
6401 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6402 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6403 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6404 * testsuite/Makefile.in: Rebuild.
6405
6406 2010-02-09 David S. Miller <davem@davemloft.net>
6407
6408 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6409 R_SPARC_RELATIVE using ->add_local_relative().
6410 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6411
6412 * output.h (Output_data_dynamic::add_section_size): New method
6413 that takes two Output_data objects.
6414 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6415 entry param. Handle it in initializers.
6416 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6417 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6418 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6419 arg.
6420 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6421 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6422 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6423 for dynrel_includes_plt.
6424 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6425 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6426 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6427 before .rela.plt
6428 (Target_sparc::do_finalize_sections): Update to pass true for
6429 dynrel_includes_plt.
6430 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6431 output before .rela.plt
6432 (Target_powerpc::do_finalize_sections): Update to pass true for
6433 dynrel_includes_plt when 32-bit.
6434
6435 2010-02-08 Doug Kwan <dougkwan@google.com>
6436
6437 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6438 method.
6439 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6440 Arm_relobj::scan_section_for_cortex_a8_stubs,
6441 Arm_relobj::do_relocation_section): Instead of calling
6442 Output_section::output_address, use faster
6443 Arm_relobj::simple_input_section_output_address.
6444
6445 2010-02-08 David S. Miller <davem@davemloft.net>
6446
6447 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6448 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6449 relocation helper function.
6450
6451 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6452 just like R_SPARC_GOT{10,13,22}.
6453 (Target_sparc::Scan::local): Likewise.
6454 (Target_sparc::Relocate:relocate): Likewise.
6455
6456 2010-02-06 Ian Lance Taylor <iant@google.com>
6457
6458 * configure.ac: Rewrite targetobjs duplicate removal code to use
6459 only shell constructs.
6460 * configure: Rebuild.
6461
6462 2010-02-05 Doug Kwan <dougkwan@google.com>
6463
6464 PR 11247
6465 * arm.cc (Arm_relobj::section_is_scannable): New method.
6466 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6467 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6468
6469 2010-02-04 Doug Kwan <dougkwan@google.com>
6470
6471 PR 11247
6472 * arm-reloc-property.cc (cstdio): Include.
6473 * configure.ac (targetobjs): Remove duplicates.
6474 * configure: Regenerate.
6475 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6476 big and little endian version for a given address size.
6477
6478 2010-02-03 Doug Kwan <dougkwan@google.com>
6479
6480 * arm-reloc-property.cc
6481 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6482 definition.
6483 * arm-reloc-property.h
6484 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6485 New method definition.
6486 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6487 declaration.
6488 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6489 overflow to N.
6490 (GOT_PREL): Change implemented to Y.
6491 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6492 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6493 (Arm_relocate_functions::movw_abs_nc): Remove method.
6494 (Arm_relocate_functions::movt_abs): Ditto.
6495 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6496 (Arm_relocate_functions::thm_movt_abs): Ditto.
6497 (Arm_relocate_functions::movw_rel_nc): Ditto.
6498 (Arm_relocate_functions::movw_rel): Ditto.
6499 (Arm_relocate_functions::movt_rel): Ditto.
6500 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6501 (Arm_relocate_functions:thm_movw_rel): Ditto.
6502 (Arm_relocate_functions:thm_movt_rel): Ditto.
6503 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6504 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6505 New method definitions.
6506 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6507 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6508 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6509 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6510 (Target_arm::Relocate::relocate): Check for non-static or
6511 unimplemented relocation code and exit early. Change calls to
6512 Target_arm::reloc_uses_thumb_bit and
6513 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6514 instead. Refactor code to handle similar relocations to increase
6515 code sharing. Remove check for unsupported relocation code in switch
6516 statement.
6517 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6518 relocation property table to find out size. Change error message to
6519 print out the name of a relocation code instead of the numeric value.
6520 (Target_arm::scan_reloc_for_stub): Use relocation property table
6521 instead of calling Target_arm::reloc_uses_thumb_bit().
6522
6523 2010-02-02 Doug Kwan <dougkwan@google.com>
6524
6525 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6526 types of relaxed input section.
6527
6528 2010-02-02 Doug Kwan <dougkwan@google.com>
6529
6530 * Makefile.am (HFILES): Add arm-reloc-property.h.
6531 (DEFFILES): New.
6532 (TARGETSOURCES): Add arm-reloc-property.cc
6533 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6534 (libgold_a_SOURCES): $(DEFFILES)
6535 * Makefile.in: Regenerate.
6536 * arm-reloc-property.cc: New file.
6537 * arm-reloc-property.h: New file.
6538 * arm-reloc.def: New file.
6539 * arm.cc: Update comments.
6540 (arm-reloc-property.h): New included header.
6541 (arm_reloc_property_table): New global variable.
6542 (Target_arm::do_select_as_default_target): New method definition.
6543 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6544 arm-reloc-property to targ_extra_obj.
6545 * parameters.cc (set_parameters_target): Call
6546 Target::select_as_default_target().
6547 * target.h (Target::select_as_default_target): New method definition.
6548 (Target::do_select_as_default_target): Same.
6549
6550 2010-02-01 Doug Kwan <dougkwan@google.com>
6551
6552 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6553 first_output_text_section_.
6554 (Arm_exidx_fixup::first_output_text_section): New method definition.
6555 (Arm_exidx_fixup::first_output_text_section_): New data member.
6556 (Arm_exidx_fixup::process_exidx_section): Record the first text
6557 output section seen.
6558 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6559 and entsize in output section header.
6560
6561 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6562
6563 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6564 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6565 (Arm_relocate_functions::thm_alu11): New Method.
6566 (Arm_relocate_functions::thm_pc8): New Method.
6567 (Arm_relocate_functions::thm_pc12): New Method.
6568 (Target_arm::Scan::local): Handle the relocations.
6569 (Target_arm::Scan::global): Likewise.
6570 (Target_arm::Relocate::relocate): Likewise.
6571 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6572
6573 2010-01-29 Doug Kwan <dougkwan@google.com>
6574
6575 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6576 of relocation types as ld.
6577
6578 2010-01-29 Doug Kwan <dougkwan@google.com>
6579
6580 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6581 to public.
6582 (Arm_relocate_functions::thumb_branch_common): Ditto.
6583 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6584 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6585 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6586 Arm_relocate_functions::jump24): Remove.
6587 (Target_arm::Relocate::relocate): Adjust code to call
6588 Arm_relocation_functions::arm_branch_common and
6589 Arm_relocation_functions::thumb_branch_common instead of their removed
6590 wrappers. Merge switch-cases together to reduce source code size.
6591
6592 2010-01-29 Doug Kwan <dougkwan@google.com>
6593
6594 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6595 output_local_symbol_count_needs_update_.
6596 (Arm_relobj::output_local_symbol_count_needs_update,
6597 Arm_relobj::set_output_local_symbol_count_needs_update,
6598 Arm_relobj::update_output_local_symbol_count): New methods.
6599 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6600 member.
6601 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6602 of pointed function as in a R_ARM_PREL31 relocation.
6603 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6604 for output local symbol count updating.
6605 (Target_arm::do_relax): Update output local symbol counts in objects
6606 if necessary.
6607 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6608
6609 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6610
6611 * arm.cc: Added support for the ARM relocations:
6612 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6613 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6614 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6615 movw_prel_nc).
6616 (Arm_relocate_functions::movw_rel): New method.
6617 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6618 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6619 thm_movw_prel_nc).
6620 (Arm_relocate_functions::thm_movw_rel): New method.
6621 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6622 thm_movt_prel).
6623 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6624 relocations.
6625 (Target_arm::Scan::global): Likewise.
6626 (Target_arm::Relocate::relocate): Likewise.
6627 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6628 Likewise.
6629
6630 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6631
6632 * arm.cc: Added support for ARM group relocations.
6633 (Target_arm::reloc_needs_sym_origin): New method.
6634 (Arm_relocate_functions::calc_grp_kn): New method.
6635 (Arm_relocate_functions::calc_grp_residual): New method.
6636 (Arm_relocate_functions::calc_grp_gn): New method.
6637 (Arm_relocate_functions::arm_grp_alu): New Method.
6638 (Arm_relocate_functions::arm_grp_ldr): New Method.
6639 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6640 (Arm_relocate_functions::arm_grp_ldc): New Method.
6641 (Target_arm::Scan::local): Handle the ARM group relocations.
6642 (Target_arm::Scan::global): Likewise.
6643 (Target_arm::Relocate::relocate): Likewise.
6644 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6645 Likewise.
6646
6647 2010-01-26 Doug Kwan <dougkwan@google.com>
6648
6649 * arm.cc (set): Include.
6650 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6651 pointer type.
6652 (Arm_output_section::Text_section_list): New type.
6653 (Arm_output_section::append_text_sections_to_list): New method.
6654 (Arm_output_section::fix_exidx_coverage): Ditto.
6655 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6656 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6657 Relobj::set_section_offset() instead of
6658 Sized_relobj::invalidate_section_offset().
6659 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6660 parameter for section headers. Ignore relocation sections for
6661 unallocated sections and EXIDX sections.
6662 (Target_arm::fix_exidx_coverage): New method.
6663 (Target_arm::output_section_address_less_than): New type.
6664 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6665 linked text section instead of the EXIDX section.
6666 (Arm_output_section::create_stub_group): Add an assertion to check
6667 that this is not an EXIDX output section.
6668 (Arm_output_section::append_text_sections_to_list): New method.
6669 (Arm_output_section::fix_exidx_coverage): Ditto.
6670 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6671 Arm_relobj::section_needs_reloc_stub_scanning.
6672 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6673 first pass.
6674 (Target_arm::fix_exidx_coverage): New method.
6675 * object.h (Relobj::set_output_section): New method.
6676 (Sized_relobj::invalidate_section_offset): Remove method.
6677 (Sized_relobj::do_invalidate_section_offset): Remove method.
6678 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6679
6680 2010-01-25 Doug Kwan <dougkwan@google.com>
6681
6682 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6683 Fix warning due to signed and unsigned comparison on a 32-bit host.
6684
6685 2010-01-22 Doug Kwan <dougkwan@google.com>
6686
6687 * arm.cc (Target_arm::do_relax): Record an output section for section
6688 offset adjustment it contains any stub table that has changed.
6689 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6690 offsets in an output section if necessary.
6691 * output.cc (Output_section::Output_section): Initialize
6692 section_offsets_need_adjustments_.
6693 (Output_section::add_input_section_for_script): Renamed to
6694 Output_section::add_simple_input_section.
6695 (Output_section::save_states): Add a comment.
6696 (Output_section::discard_states): New method defintion.
6697 (Output_section::adjust_section_offsets): Same.
6698 * output.h (Output_section::add_input_section_for_script): Renamed to
6699 Output_section::add_simple_input_section.
6700 (Output_section::discard_states): New method declaration.
6701 (Output_section::adjust_section_offsets): Same.
6702 (Output_section::section_offsets_need_adjustment,
6703 Output_section::set_section_offsets_need_adjustment): New method
6704 definitions.
6705 (Output_section::section_offsets_need_adjustment_): New data member.
6706 * script-sections.cc
6707 (Output_section_element_input::set_section_address): Adjust code for
6708 renaming of Output_section::add_input_section_for_script.
6709 (Orphan_output_section::set_section_address): Same.
6710
6711 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6712
6713 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6714 Fix_v4bx enum values .
6715 * gold/options.h (General_options): New option definitions.
6716 (General_options::fix_v4bx): New method.
6717 (General_options::Fix_v4bx): New enum.
6718 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6719 (General_options::parse_fix_v4bx_interworking): New method.
6720
6721 2010-01-22 Doug Kwan <dougkwan@google.com>
6722
6723 * arm.cc (Arm_exidx_fixup): New class.
6724
6725 2010-01-21 Doug Kwan <dougkwan@google.com>
6726
6727 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6728 classes.
6729 (Arm_exidx_section_offset_map): New type.
6730
6731 2010-01-21 Doug Kwan <dougkwan@google.com>
6732
6733 * arm.cc (Arm_exidx_input_section): New class.
6734 (Arm_relobj::exidx_input_section_by_link,
6735 Arm_relobj::exidx_input_section_by_shndx,
6736 Arm_relobj::make_exidx_input_section): New methods.
6737 (read_arm_attributes_section): Remove.
6738 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6739 information about them.
6740 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6741 to here.
6742
6743 2010-01-20 Doug Kwan <dougkwan@google.com>
6744
6745 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6746 Input_section_specifier to Section_id.
6747 (Target_arm::new_arm_input_section: Adjust code for change of key
6748 type.
6749 (Target_arm::find_arm_input_section): Ditto.
6750 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6751 (Section_id): Remove.
6752 (Garbage_collection::Section_id_hash): Remove.
6753 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6754 (Section_id): Remove.
6755 (Icf::Section_id_hash): Remove.
6756 * object.h (Section_id, Const_section_id, Section_id_hash,
6757 Const_section_id_hash): New type definitions.
6758 * output.cc (Output_section::add_relaxed_input_section): Change to
6759 use Const_section_id instead of Input_section_specifier as key type.
6760 (Output_section::add_merge_input_section): Ditto.
6761 (Output_section::build_relaxation_map): Change to use Section_id
6762 instead of Input_section_specifier as key type.
6763 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6764 Ditto.
6765 (Output_section::convert_input_sections_to_relaxed_sections): Change
6766 to use Const_section_id instead of Input_section_specifier as key type.
6767 (Output_section::find_merge_section): Ditto.
6768 (Output_section::find_relaxed_input_section): Ditto.
6769 * output.h (Input_section_specifier): Remove class.
6770 (Output_section::Output_section_data_by_input_section_map): Change
6771 key type to Const_section_id.
6772 (Output_section::Output_relaxed_input_section_by_input_section_map):
6773 Ditto.
6774 (Output_section::Relaxation_map): Change key type to Section_id.
6775
6776 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6777
6778 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6779 (class Arm_v4bx_stub): New class.
6780 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6781 (Stub_factory::make_arm_v4bx_stub): New method.
6782 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6783 (Stub_table::empty): Handle v4bx stubs.
6784 (Stub_table::add_arm_v4bx_stub): New method.
6785 (Stub_table::find_arm_v4bx_stub): New method.
6786 (Arm_relocate_functions::v4bx): New method.
6787 (Target_arm::fix_v4bx): New method.
6788 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6789 (Stub_table::relocate_stubs): Likewise.
6790 (Stub_table::do_write): Likewise.
6791 (Stub_table::update_data_size_and_addralign): Likewise.
6792 (Stub_table::finalize_stubs): Likewise.
6793 (Target_arm::Scan::local): Likewise.
6794 (Target_arm::Scan::global): Likewise.
6795 (Target_arm::do_finalize_sections): Likewise.
6796 (Target_arm::Relocate::relocate): Likewise.
6797 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6798 Likewise.
6799 (Target_arm::scan_reloc_for_stub): Likewise.
6800 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6801
6802 2010-01-19 Ian Lance Taylor <iant@google.com>
6803
6804 * output.cc (Output_section_headers::do_sized_write): Write large
6805 segment count to sh_info field.
6806 (Output_file_header::do_sized_write): For large segment count,
6807 write PN_XNUM to e_phnum field.
6808
6809 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6810
6811 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6812 (Arm_relocate_functions::thm_jump8): New function.
6813 (Arm_relocate_functions::thm_jump11): New function.
6814 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6815 R_ARM_THM_JUMP11.
6816 (Target_arm::Scan::global): Likewise.
6817 (Target_arm::Relocate::relocate): Likewise.
6818 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6819 Likewise.
6820
6821 2010-01-14 Doug Kwan <dougkwan@google.com>
6822
6823 * arm.cc (map, utility): Include headers.
6824 (Target_arm::apply_cortex_a8_workaround): New method.
6825 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6826 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6827 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6828 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6829 the --[no-]fix-cortex-a8 command line options.
6830 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6831 (Target_arm::relocate_stub): Use addend in instruction template.
6832 * options.h (DEFINE_bool): Set the user-set flag.
6833 (General_options): Add --[no-]-fix-cortex options.
6834 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6835 : Update fast look-up map after conversion.
6836
6837 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6838
6839 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6840 in the first pass of do_layout.
6841
6842 2010-01-13 Doug Kwan <dougkwan@google.com>
6843
6844 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6845 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6846 apparent compiler problem of not folding static constant integral
6847 data members of elfcpp::Elf_sizes<32>.
6848
6849 2010-01-13 Doug Kwan <dougkwan@google.com>
6850
6851 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6852 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6853 Arm_relobj::scan_section_for_cortex_a8_erratum,
6854 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6855 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6856 sections to scan for relocation stubs into a new method
6857 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6858 relocation and Cortex-A8 stub scanning.
6859 (Target_arm::do_relax): Force stubs to be after stubbed sections
6860 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6861 the beginning of a new relaxation pass. Update a comment.
6862 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6863
6864 2010-01-12 Ian Lance Taylor <iant@google.com>
6865
6866 * target-reloc.h (visibility_error): New inline function.
6867 (relocate_section): Call visibility_error.
6868 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6869 (MOSTLYCLEANFILES): Likewise.
6870 (protected_4_pic.o, protected_3.err): New targets.
6871 * testsuite/protected_4.cc: New file.
6872
6873 2010-01-12 Doug Kwan <dougkwan@google.com>
6874
6875 * arm.cc (Cortex_a8_reloc): New class.
6876 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6877 and cortex_a8_relocs_info_.
6878 (Target_arm::fix_cortex_a8): New method definition.
6879 (Target_arm::Cortex_a8_relocs_info): New type.
6880 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6881 New data member declarations.
6882 (Target_arm::scan_reloc_for_stub): Record information about
6883 relocations for THUMB branches that might be exempted from the
6884 Cortex-A8 workaround.
6885 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6886 at the beginning of a relaxation pass.
6887
6888 2010-01-12 Doug Kwan <dougkwan@google.com>
6889
6890 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6891 (Arm_relobj::Mapping_symbol_position,
6892 Arm_reloj::Mapping_symbol_position_less,
6893 Arm_relobj::Mapping_symbols_info): New types.
6894 (Target_arm::is_mapping_symbol_name): New method definition.
6895 (Arm_relobj::do_count_local_symbols): Save information about mapping
6896 symbols.
6897
6898 2010-01-11 Doug Kwan <dougkwan@google.com>
6899
6900 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6901 Arm_relocate_functions::thumb32_branch_upper,
6902 Arm_relocate_functions::thumb32_branch_lower,
6903 Arm_relocate_functions::thumb32_cond_branch_offset,
6904 Arm_relocate_functions::thumb32_cond_branch_upper,
6905 Arm_relocate_functions::thumb32_cond_branch_lower,
6906 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6907 branch offset encoding.
6908 (Arm_relocate_functions::thumb_branch_common): Use new branch
6909 offset encoding methods to avoid code duplication.
6910 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6911 (Stub_addend_reader::operator()): Use new branch encoding method
6912 to avoid code duplication.
6913
6914 2010-01-11 Doug Kwan <dougkwan@google.com>
6915
6916 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6917 (Target_arm::do_finalize_sections): Define special EXIDX section
6918 symbols only if referenced.
6919 * gc.h (Garbage_collection::add_reference): New method.
6920 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6921 code duplication.
6922
6923 2010-01-11 Ian Lance Taylor <iant@google.com>
6924
6925 * script.cc (Version_script_info::build_expression_list_lookup):
6926 Change complaing about duplicate wildcard match from error to
6927 warning.
6928
6929 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6930 of 2009-12-30.
6931 (Version_script_info::Version_script_info): Initialize globs_,
6932 default_version_, default_is_global_, and exact_. Don't
6933 initialize globals_ or locals_.
6934 (Version_script_info::build_lookup_tables): Build local symbols
6935 first.
6936 (Version_script_info::unquote): New function.
6937 (Version_script_info::add_exact_match): New function.
6938 (Version_script_info::build_expression_list_lookup): Remove lookup
6939 parameter. Add is_global parameter. Change all callers. Handle
6940 wildcard pattern specially. Unquote pattern. Call
6941 add_exact_match.
6942 (Version_script_info::get_name_to_match): New function.
6943 (Version_script_info::get_symbol_version): New function.
6944 (Version_script_info::get_symbol_version_helper): Remove.
6945 (Version_script_info::check_unmatched_names): Call unquote.
6946 * script.h (class Version_script_info): Change get_symbol_version
6947 to be non-inline and add is_global parameter; change all callers.
6948 Rewrite symbol_is_local. Update declarations. Define struct
6949 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6950 Remove globals_ and locals_ members. Add exact_, globs_,
6951 default_version_, is_global_.
6952 (Version_script_info::Glob): Remove pattern, add expression and
6953 is_global. Update constructor. Change all callers.
6954 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6955 default version.
6956 (Versions::symbol_section_contents): If a symbol is undefined, or
6957 defined in a dynamic object, set the version index to
6958 VER_NDX_LOCAL.
6959 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6960 symbol_is_local.
6961 (Symbol_table::add_from_pluginobj): Likewise.
6962 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6963
6964 2010-01-11 Doug Kwan <dougkwan@google.com>
6965
6966 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6967 (incremental_dump_LDADD): Add linking option for libintl.
6968 * Makefile.in: Regenerate.
6969
6970 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6971
6972 PR gold/11144
6973 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6974 instead of -Ds.
6975 * testsuite/Makefile.in: Regenerated.
6976
6977 2010-01-10 Doug Kwan <dougkwan@google.com>
6978
6979 * options.h (DEFINE_var): Use parentheses around argument varname__
6980 in macro body to avoid any unintended subsequent substitutions.
6981
6982 2010-01-10 Ian Lance Taylor <iant@google.com>
6983
6984 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6985 candidates before doing symbol resolution.
6986
6987 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6988 ODR candidates if only one is weak.
6989
6990 2010-01-08 Ian Lance Taylor <iant@google.com>
6991
6992 * script.cc (Version_script_info::build_expression_list_lookup):
6993 Don't warn about ambiguous version, just record the ambiguity.
6994 (Version_script_info::get_symbol_version_helper): Give error if
6995 version is ambiguous.
6996
6997 2010-01-08 Doug Kwan <dougkwan@google.com>
6998
6999 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7000 prev_data_size_ and prev_addralign_. Remove initializer for
7001 deleted data member has_been_changed_.
7002 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7003 to determine if the table is empty.
7004 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7005 Remove.
7006 (Stub_table::add_reloc_stub): Define method in class definition
7007 instead of just declaring it there.
7008 (Stub_table::add_cortex_a8_stub): New method definition.
7009 (Stub_table::update_data_size_and_addralign): Ditto.
7010 (Stub_table::finalize_stubs): Ditto.
7011 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7012 (Stub_table::do_addralign_): Return address alignment in the
7013 (Stub_table::do_reset_address_and_file_offset): Define method in
7014 class definition instead of declaring it there. Set current data
7015 size to be the data size of the previous pass.
7016 (Stub_table::set_final_data_size): Use current data size as the
7017 final data size.
7018 (Stub_table::relocate_stub): Change parameter type of stub from
7019 Reloc_stub pointer to Stub pointer.
7020 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7021 (Stub_table::Cortex_a8_stub_list): New typedef.
7022 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7023 Stub_table::prev_addralign_): New data member.
7024 (Arm_relobj::Arm_relobj): Initialize data member
7025 section_has_cortex_a8_workaround_.
7026 (Arm_relobj::section_has_cortex_a8_workaround,
7027 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7028 definitions.
7029 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7030 declarations.
7031 (Target_arm::relocate_stub): Change parameter type of stub from
7032 Reloc_stub pointer to Stub pointer.
7033 (Insn_template::size, Insn_template::alignment): Handle
7034 THUMB16_SPECIAL_TYPE.
7035 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7036 Stub_table::update_data_size_and_addralign,
7037 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7038 definitions.
7039 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7040 (Stub_table::do_write): Ditto.
7041 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7042
7043 2010-01-08 Ian Lance Taylor <iant@google.com>
7044
7045 PR 11108
7046 * symtab.h (class Symbol): Remove fields is_target_special_ and
7047 has_plt_offset_. Add field is_defined_in_discarded_section_.
7048 (Symbol::is_defined_in_discarded_section): New function.
7049 (Symbol::set_is_defined_in_discarded_section): New function.
7050 (Symbol::has_plt_offset): Rewrite.
7051 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7052 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7053 Don't initialize is_target_special_ or has_plt_offset_.
7054 Initialize is_defined_in_discarded_section_.
7055 (Symbol_table::add_from_relobj): If appropriate, set
7056 is_defined_in_discarded_section.
7057 * resolve.cc (Symbol::override_base_with_special): Don't test
7058 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7059 * target-reloc.h (relocate_section): Do special handling for
7060 symbols defined in discarded sections for global symbols as well
7061 as local symbols.
7062
7063 2010-01-08 Ian Lance Taylor <iant@google.com>
7064
7065 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7066 the SHT_SYMTAB case.
7067
7068 2010-01-08 Ian Lance Taylor <iant@google.com>
7069
7070 * object.cc (Sized_relobj::do_layout): Don't get confused if
7071 layout_eh_frame returns NULL.
7072
7073 2010-01-08 Ian Lance Taylor <iant@google.com>
7074
7075 PR 11084
7076 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7077 dynamic symbol table, use the normal symbol table.
7078 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7079 symbol table.
7080
7081 2010-01-08 Ian Lance Taylor <iant@google.com>
7082
7083 PR 11072
7084 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7085 sections.
7086
7087 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7088
7089 * version.cc (print_version): Change to "Copyright 2010".
7090
7091 2010-01-08 Ian Lance Taylor <iant@google.com>
7092
7093 PR 10287
7094 PR 11063
7095 * i386.cc (class Target_i386): Change return type of plt_section
7096 to be non-const.
7097 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7098 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7099 tls_desc_rel_ field.
7100 (Output_data_plt_i386::rel_tls_desc): New function.
7101 (Target_i386::rel_tls_desc_section): New function.
7102 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7103 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7104 R_386_TLS_DESC reloc in rel_tls_desc_section.
7105 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7106 Define struct Tlsdesc_info.
7107 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7108 (Target_x86_64::do_reloc_symbol_index): New function.
7109 (Target_x86_64::add_tlsdesc_info): New function.
7110 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7111 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7112 tlsdesc_rel_ field.
7113 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7114 all callers.
7115 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7116 (Target_x86_64::rela_tlsdesc_section): New function.
7117 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7118 handling.
7119 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7120 (Target_x86_64::do_reloc_addend): New function.
7121 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7122 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7123 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7124 (Output_reloc::type): New function.
7125 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7126 (Output_reloc::is_target_specific): New function.
7127 (Output_reloc::target_arg): New function.
7128 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7129 absolute relocs and target specific relocs.
7130 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7131 add_target_specific.
7132 (class Output_data_reloc) [SHT_RELA]: Likewise.
7133 * output.cc (Output_reloc::Output_reloc): Add four new versions
7134 for absolute relocs and target specific relocs.
7135 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7136 (Output_reloc::get_symbol_index): Likewise.
7137 (Output_reloc::local_section_offset): Check that local_sym_index_
7138 is not TARGET_CODE or 0.
7139 (Output_reloc::symbol_value): Likewise.
7140 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7141 reloc.
7142 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7143 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7144 functions.
7145 * layout.cc (add_target_dynamic_tags): Use output section for
7146 DT_PLTRELSZ and DT_JMPREL.
7147
7148 2010-01-07 Ian Lance Taylor <iant@google.com>
7149
7150 PR 11061
7151 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7152 function.
7153 (class Output_data_reloc_generic): Define.
7154 (class Output_data_reloc_base): Change base class to
7155 Output_data_reloc_generic. Change add() method to call
7156 bump_relative_reloc_count for a relative reloc. Remove
7157 sort_relocs_ field.
7158 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7159 to sort_relocs().
7160 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7161 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7162 appropriate.
7163 * layout.h (class Layout): Update declaration.
7164
7165 2010-01-07 Ian Lance Taylor <iant@google.com>
7166
7167 * output.h (class Output_data): Add const version of
7168 output_section and do_output_section.
7169 (class Output_section_data): Add const version of
7170 do_output_section.
7171 (class Output_section): Likewise.
7172 * layout.cc (Layout::add_target_dynamic_tags): New function.
7173 * layout.h (class Layout): Update declarations.
7174 * arm.cc (Target_arm::do_finalize_sections): Use
7175 add_target_dynamic_tags.
7176 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7177 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7178 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7179 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7180
7181 2010-01-07 Ian Lance Taylor <iant@google.com>
7182
7183 PR 11042
7184 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7185 object as needed.
7186
7187 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7188 Ian Lance Taylor <iant@google.com>
7189
7190 PR 11019
7191 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7192 Xindex::read_symtab_xindex.
7193
7194 2010-01-07 Doug Kwan <dougkwan@google.com>
7195
7196 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7197 (Insn_template::thumb16_bcond_insn): New method declaration.
7198 (Insn_template): Fix spelling.
7199 (Stub::thumb16_special): New method declaration.
7200 (Stub::do_write): Define virtual method which was previously pure
7201 virtual.
7202 (Stub::do_thumb16_special): New method declaration.
7203 (Stub::do_fixed_endian_write): New template member.
7204 (Reloc_stub::do_write): Remove.
7205 (Reloc_stub::do_fixed_endian_write): Remove.
7206 (Cortex_a8_stub): New class definition.
7207 (Stub_factory::make_cortex_a8_stub): New method definition.
7208 (Stub_factory::Stub_factory): Add missing static storage class
7209 qualifier for elf32_arm_stub_a8_veneer_blx.
7210
7211 2010-01-07 Ian Lance Taylor <iant@google.com>
7212
7213 PR 10980
7214 * options.h (class General_options): Add --warn-unresolved-symbols
7215 and --error-unresolved-symbols.
7216 * errors.cc (Errors::undefined_symbol): Implement
7217 --warn-unresolved-symbols.
7218
7219 * options.h (class General_options): Add -z text and -z textoff.
7220 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7221
7222 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7223
7224 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7225 (Garbage_collection::cident_sections): New function.
7226 (Garbage_collection::add_cident_section): New function.
7227 (Garbage_collection::cident_sections_): New member.
7228 (gc_process_relocs): Add references to sections whose names are C
7229 identifiers.
7230 * gold.h (cident_section_start_prefix): New constant.
7231 (cident_section_stop_prefix): New constant.
7232 (is_cident): New function.
7233 * layout.cc (Layout::define_section_symbols): Replace string constants
7234 with the newly defined constants.
7235 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7236 C identifiers.
7237 * testsuite/Makefile.am: Add gc_orphan_section_test.
7238 * testsuite/Makefile.in: Regenerate.
7239 * testsuite/gc_orphan_section_test.cc: New file.
7240 * testsuite/gc_orphan_section_test.sh: New file.
7241
7242 2010-01-06 Ian Lance Taylor <iant@google.com>
7243
7244 PR 10980
7245 * options.h (class General_options): Add --warn-shared-textrel.
7246 * layout.cc (Layout::finish_dynamic_section): Implement
7247 --warn-shared-textrel.
7248
7249 PR 10980
7250 * options.h (class General_options): Add --warn-multiple-gp.
7251
7252 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7253
7254 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7255 $(THREADSLIB) and $(LIBDL).
7256 * Makefile.in: Rebuild.
7257
7258 2010-01-06 Ian Lance Taylor <iant@google.com>
7259
7260 PR 10980
7261 * options.cc (General_options::parse_section_start): New function.
7262 (General_options::section_start): New function.
7263 (General_options::General_options): Initialize all members.
7264 * options.h: Include <map>
7265 (class General_options): Add --section-start. Add section_starts_
7266 member.
7267 * layout.cc (Layout::attach_allocated_section_to_segment): If
7268 --section-start was used, set the address of the segment. Remove
7269 local sort_sections.
7270 (Layout::relaxation_loop_body): If the address of the load segment
7271 has been set by --section-start, don't use it.
7272 * output.h (Output_segment::update_flags_for_output_section): New
7273 function.
7274 * output.cc (Output_segment::add_output_section): Call
7275 update_flags_for_output_section.
7276
7277 2010-01-05 Ian Lance Taylor <iant@google.com>
7278
7279 PR 10980
7280 * options.h (class General_options): Add --undefined-version.
7281 * script.cc (struct Version_expression): Add was_matched_by_symbol
7282 field.
7283 (Version_script_info::matched_symbol): New function.
7284 (Version_script_info::get_symbol_version_helper): Call
7285 matched_symbol.
7286 (Version_script_info::check_unmatched_names): New function.
7287 * script.h (class Version_script_info): Update declarations.
7288 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7289
7290 * options.h (class General_options): Use DEFINE_bool_alias for
7291 allow_multiple_definition.
7292 * resolve.cc (Symbol_table::should_override): Don't test
7293 allow_multiple_definition.
7294
7295 PR 10980
7296 * options.h (class General_options): Add --cref.
7297 * main.cc (main): Print cref table if --cref. Don't close mapfile
7298 until after printing cref table.
7299 * cref.cc: Include "symtab.h".
7300 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7301 (Cref_table_compare::operator()): New function.
7302 (Cref_inputs::gather_cref): New function.
7303 (filecol): New static const.
7304 (Cref_inputs::print_cref): New function.
7305 (Cref::print_cref): New function.
7306 * cref.h: Include <cstdio>.
7307 (class Cref): Update declarations.
7308 * mapfile.h (Mapfile::file): New function.
7309 * object.h (class Object): Define Symbols. Declare virtual
7310 do_get_global_symbols.
7311 (Object::get_global_symbols): New function.
7312 * object.cc (Input_objects::add_object): Pass object to cref_ if
7313 --cref.
7314 (Input_objects::archive_start): Likewise.
7315 (Input_objects::archive_stop): Likewise.
7316 (Input_objects::print_cref): New function.
7317 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7318 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7319 --cref.
7320 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7321 function.
7322 * plugin.h (class Sized_pluginobj): Update declarations.
7323
7324 2010-01-05 Ian Lance Taylor <iant@google.com>
7325
7326 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7327 to is_default_version. Rename insdef to insdefault.
7328 (Symbol_table::add_from_relobj): Rename def to is_default_version
7329 and local to is_forced_local.
7330 (Symbol_table::add_from_pluginobj): Likewise.
7331 (Symbol_table::add_from_dynobj): Likewise.
7332 (Symbol_table::define_special_symbol): Rename insdef to
7333 insdefault.
7334
7335 2010-01-04 Ian Lance Taylor <iant@google.com>
7336
7337 PR 10980
7338 * options.h (class General_options): Add
7339 --allow-multiple-definition and -z muldefs.
7340 * resolve.cc (Symbol_table::should_override): Don't warn about a
7341 multiple symbol definition if --allow-multiple-definition or -z
7342 muldefs.
7343
7344 PR 10980
7345 * options.h (class General_options): Add --add-needed and
7346 --copy-dt-needed-entries. Tweak --as-needed help entry.
7347 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7348 error if --copy-dt-needed-entries aka --add-needed is used and
7349 would cause a change in behaviour.
7350
7351 PR 10980
7352 * options.h (class General_options): Add -G as a short version of
7353 --shared. Add no-op options -assert, -g, and -i.
7354
7355 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7356
7357 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7358 check for .text or .gnu.linkonce.t sections.
7359 * icf.cc (Icf::find_identical_sections): Ditto.
7360 Change the detection for mangled function name within the section
7361 name.
7362 * icf.h (is_section_foldable_candidate): New function.
7363
7364 2009-12-30 Ian Lance Taylor <iant@google.com>
7365
7366 PR 10980
7367 * options.h (class General_options): Permit two dashes with
7368 --retain-symbols-file.
7369
7370 2009-12-30 Ian Lance Taylor <iant@google.com>
7371
7372 PR 10979
7373 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7374 don't put the file header and segment headers in the text
7375 segment.
7376
7377 PR 10979
7378 * common.cc (Sort_commons::operator()): Stabilize sort when both
7379 entries are NULL.
7380 (Symbol_table::do_allocate_commons_list): When allocating common
7381 symbols, skip a symbol which is no longer common.
7382 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7383 an object before checking its type.
7384 * testsuite/common_test_2.c: New file.
7385 * testsuite/common_test_3.c: New file.
7386 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7387 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7388 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7389 (common_test_2_pic.o, common_test_2.so): New targets.
7390 (common_test_3_pic.o, common_test_3.so): New targets.
7391 * testsuite/Makefile.in: Rebuild.
7392
7393 PR 10979
7394 * script.cc (read_input_script): If we see a new SECTIONS clause,
7395 and we have added an input section, give an error.
7396 * layout.h (class Layout): Add have_added_input_section function.
7397 Add have_added_input_section_ field.
7398 * layout.cc (Layout::Layout): Initialize
7399 have_added_input_section_.
7400 (Layout::layout): Set have_added_input_section_.
7401 (Layout::layout_eh_frame): Likewise.
7402
7403 2009-12-30 Ian Lance Taylor <iant@google.com>
7404
7405 PR 10931
7406 * options.h (class General_options): Add --sort-common option.
7407 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7408 * common.cc (Sort_common): Add sort_order parameter to
7409 constructor. Add sort_order_ field.
7410 (Sort_commons::operator): Check sort_order_.
7411 (Symbol_table::allocate_commons): Determine the sort order.
7412 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7413 Change all callers.
7414 (Symbol_table::do_allocate_commons_list): Likewise.
7415
7416 2009-12-30 Ian Lance Taylor <iant@google.com>
7417
7418 PR 10916
7419 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7420 symbols from this object, don't change the visibility of an
7421 undefined symbol.
7422 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7423
7424 2009-12-30 Ian Lance Taylor <iant@google.com>
7425
7426 PR 10861
7427 * script.h (class Version_script_info): Define Language enum.
7428 Update declarations. Define Glob, Exact, and Lookup types. Add
7429 new fields globals_, locals_, and is_finalized_.
7430 * script.cc: Various formatting fixes.
7431 (class Parser_closure): Change language_stack_ from a vector of
7432 std::string to one of Version_script_info::Language. Adjust all
7433 uses accordingly.
7434 (class Lazy_demangler): Remove.
7435 (struct Version_expression): Change language from std::string to
7436 Version_script_info::Language.
7437 (Version_script_info::Version_script_info): New function.
7438 (Version_script_info::~Version_script_info): Don't call clear.
7439 (Version_script_info::finalize): New function.
7440 (Version_script_info::build_lookup_tables): New function.
7441 (Version_script_info::build_expression_list_lookup): New
7442 function.
7443 (Version_script_info::get_symbol_version_helper): Rewrite to use
7444 lookup tables.
7445 (Version_script_info::print_expression_list): Adjust to use
7446 Version_script_info::Language.
7447 (script_push_lex_into_version_mode): Check that the version script
7448 has not been finalized.
7449 (version_script_push_lang): Change language string to
7450 Version_script_info::Language.
7451 * options.cc (Command_line::version_script): New function.
7452 * options.h (class General_options): Add finalize_dynamic_list
7453 function. Change version_script from declaration to definition.
7454 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7455 * testsuite/version_script.map: Remove duplicate def of foo.
7456 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7457 version_script.map.
7458 * testsuite/Makefile.in: Rebuild.
7459
7460 2009-12-30 Ian Lance Taylor <iant@google.com>
7461
7462 PR 10843
7463 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7464 if the input symbol index is 0, make the output symbol index 0.
7465
7466 2009-12-30 Ian Lance Taylor <iant@google.com>
7467
7468 PR 10670
7469 * options.h (class General_options): Add -x/--discard-all.
7470 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7471 --discard-all. If the local symbol needs a dynamic entry, check
7472 that before handling --discard-locals.
7473
7474 2009-12-30 Ian Lance Taylor <iant@google.com>
7475
7476 PR 10450
7477 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7478 flags to PF_R.
7479 (Output_segment::add_output_section): Don't change the flags if
7480 the type is PT_TLS.
7481
7482 PR 10450
7483 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7484 GNU hash table if they need a dynamic value. Otherwise, don't add
7485 them if they are defined in a dynamic object or are forced local.
7486
7487 2009-12-29 Ian Lance Taylor <iant@google.com>
7488
7489 PR 10450
7490 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7491 .gnu.hash table for a 32-bit target.
7492
7493 PR 10450
7494 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7495 regular and a dynamic object only needs a dynamic symbol table
7496 entry if it is externally visible.
7497
7498 PR 10450
7499 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7500 constructor. Add global_offset_table_ field.
7501 (Target_i386::got_section): Set global_offset_table_.
7502 (Target_i386::do_finalize_sections): Set global_offset_table_
7503 size.
7504 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7505 in constructor. Add global_offset_table_ field.
7506 (Target_x86_64::got_section): Set global_offset_table_.
7507 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7508 size.
7509
7510 * layout.cc (Layout::Layout): Initialize increase_relro_.
7511 (Layout::get_output_section): Add is_relro, is_last_relro, and
7512 is_first_non_relro parameters. Change all callers.
7513 (Layout::choose_output_section): Likewise.
7514 (Layout::add_output_section_data): Likewise.
7515 (Layout::make_output_section): Likewise.
7516 (Layout::set_segment_offsets): Clear increase_relro when using a
7517 linker script.
7518 * layout.h (class Layout): Add increase_relro method. Add
7519 increase_relro_ field. Update declarations.
7520 * output.cc (Output_section::Output_section): Initialize
7521 is_last_relro_ and is_first_non_relro_.
7522 (Output_segment::add_output_section): Group relro sections is
7523 do_sort is true. Handle is_last_relro and is_first_non_relro.
7524 (Output_segment::maximum_alignment): Remove relro handling.
7525 (Output_segment::set_section_addresses): Add increase_relro
7526 parameter. Change all callers. Add initial alignment to align
7527 relro sections on separate page. Remove old relro handling.
7528 (Output_segment::set_section_list_addresses): Remove in_relro
7529 parameter. Change all callers.
7530 (Output_segment::set_offset): Add increase parameter. Change all
7531 callers. Remove old relro handling.
7532 * output.h (class Output_section): Add new methods: is_last_relro,
7533 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7534 Add is_last_relro_ and is_first_non_relro_ fields.
7535 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7536 Create separate .got.plt section. Call increase_relro.
7537 * x86_64.cc (Target_x86_64::got_section): Likewise.
7538 * testsuite/relro_script_test.t: Add .got.plt.
7539
7540 PR 10450
7541 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7542 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7543 (Layout::finalize): Call set_dynamic_symbol_size.
7544 (Layout::set_dynamic_symbol_size): New function.
7545 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7546 set_dynamic_symbol_size.
7547
7548 PR 10450
7549 * output.h (class Output_section): Add is_entsize_zero_ field.
7550 * output.cc (Output_section::Output_section): Initialize
7551 is_entsize_zero_.
7552 (Output_section::set_entsize): If two different entsizes are
7553 requested, force it to zero.
7554 (Output_section::add_input_section): Set flags for .debug_str
7555 before updating section flags. Set entsize.
7556 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7557 and SHF_STRING if all input sections have those flags.
7558
7559 2009-12-29 Rafael Espindola <espindola@google.com>
7560
7561 * main.cc (main): Fix the sys time reporting.
7562 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7563 reporting.
7564
7565 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7566
7567 * options.cc (General_options::parse_version): Allow -v to exit
7568 without an error if there is nothing to link.
7569
7570 2009-12-29 Ian Lance Taylor <iant@google.com>
7571
7572 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7573 using a version of gcc before 4.1.
7574 * configure: Rebuild.
7575
7576 2009-12-28 Chris Demetriou <cgd@google.com>
7577
7578 * attributes.cc (Output_attributes_section_data::do_write): Use
7579 std::vector::front rather than std::vector::data.
7580
7581 2009-12-28 Ian Lance Taylor <iant@google.com>
7582
7583 * symtab.h (class Symbol_table): Add enum Defined.
7584 * resolve.cc (Symbol_table::should_override): Add defined
7585 parameter. Change all callers. Test whether object is NULL
7586 before calling a method on it.
7587 (Symbol_table::report_resolve_problem): Add defined parameter.
7588 Change all callers.
7589 (Symbol_table::should_override_with_special): Likewise.
7590 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7591 parameter. Change all callers.
7592 (Symbol_table::do_define_in_output_data): Likewise.
7593 (Symbol_table::define_in_output_segment): Likewise.
7594 (Symbol_table::do_define_in_output_segment): Likewise.
7595 (Symbol_table::define_as_constant): Likewise.
7596 (Symbol_table::do_define_as_constant): Likewise.
7597 * script.h (class Symbol_assignment): Add is_defsym parameter to
7598 constructor; change all callers.
7599 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7600 parameter. Change all callers. Add is_defsym_ field.
7601 (class Parser_closure): Add parsing_defsym parameter to
7602 constructor; change all callers. Add parsing_defsym accessor
7603 function. Add parsing_defsym_ field.
7604
7605 2009-12-28 Ian Lance Taylor <iant@google.com>
7606
7607 * gold.cc (queue_middle_tasks): Fix formatting.
7608 * object.cc (Relobj::is_section_name_included): Likewise.
7609
7610 2009-12-23 Ian Lance Taylor <iant@google.com>
7611
7612 * i386.cc (Target_i386::do_calls_non_split): Recognize
7613 -fsplit-stack prologue for a function with a static chain.
7614 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7615 -fsplit-stack prologue when using %r11.
7616
7617 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7618
7619 * options.cc (General_options::parse_version): Make -v continue and do
7620 the link like GNU ld does.
7621
7622 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7623
7624 * Makefile.am (CCFILES): Add timer.cc.
7625 (HFILES): Add timer.h.
7626 * configure.ac: Check for sysconf and times.
7627 * main.cc: include timer.h.
7628 (main): Use Timer instead of get_run_time.
7629 * timer.cc: New.
7630 * timer.h: New.
7631 * workqueue.cc: include timer.h.
7632 (Workqueue::find_and_run_task):
7633 Report user, sys and wall time.
7634 * Makefile.in: Regenerate.
7635 * config.in: Regenerate.
7636 * configure: Regenerate.
7637
7638 2009-12-16 Doug Kwan <dougkwan@google.com>
7639
7640 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7641 sections.
7642 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7643 relaxed input sections.
7644 * output.cc (Output_section::find_relaxed_input_section): Change
7645 return type to Output_relaxed_input_section pointer. Adjust code
7646 for new type of relaxed_input_section_map_.
7647 * output.h (Output_section::find_relaxed_input_section): Change
7648 return type to Output_relaxed_input_section pointer.
7649 (Output_section::Output_relaxed_input_section_by_input_section_map):
7650 New type.
7651 (Output_section::relaxed_input_section_map_): Change type to
7652 Output_section::Output_relaxed_input_section_by_input_section_map.
7653 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7654 input section.
7655
7656 2009-12-15 Ian Lance Taylor <iant@google.com>
7657
7658 * layout.cc (Layout::create_shstrtab): Only write out after input
7659 sections if we are compressing debug sections.
7660
7661 2009-12-15 Ian Lance Taylor <iant@google.com>
7662
7663 * archive.cc (Archive::add_symbols): Only look up a symbol without
7664 a version if there is, in fact, a version.
7665
7666 2009-12-14 Ian Lance Taylor <iant@google.com>
7667
7668 Revert -Wshadow changes, all changes from:
7669 2009-12-11 Doug Kwan <dougkwan@google.com>
7670 2009-12-11 Nick Clifton <nickc@redhat.com>
7671 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7672
7673 2009-12-11 Doug Kwan <dougkwan@google.com>
7674
7675 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7676 due to -Wshadow.
7677 * attributes.cc (Object_attribute::size): Ditto.
7678 (Attributes_section_data::size): Ditto.
7679 (Attributes_section_data::Attributes_section_data): Ditto.
7680 (Output_attributes_section_data::do_write): Ditto.
7681 * attributes.h (Object_attribute::set_type): Ditto.
7682 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7683
7684 2009-12-11 Nick Clifton <nickc@redhat.com>
7685
7686 * archive.cc: Fix shadowed variable warnings.
7687 * arm.cc: Likewise.
7688 * compressed_output.cc: Likewise.
7689 * compressed_output.h: Likewise.
7690 * configure: Likewise.
7691 * dwarf_reader.cc: Likewise.
7692 * dynobj.cc: Likewise.
7693 * dynobj.h: Likewise.
7694 * ehframe.cc: Likewise.
7695 * ehframe.h: Likewise.
7696 * errors.cc: Likewise.
7697 * expression.cc: Likewise.
7698 * fileread.cc: Likewise.
7699 * fileread.h: Likewise.
7700 * freebsd.h: Likewise.
7701 * i386.cc: Likewise.
7702 * icf.cc: Likewise.
7703 * incremental.h: Likewise.
7704 * layout.cc: Likewise.
7705 * layout.h: Likewise.
7706 * mapfile.cc: Likewise.
7707 * merge.cc: Likewise.
7708 * merge.h: Likewise.
7709 * object.cc: Likewise.
7710 * object.h: Likewise.
7711 * options.h: Likewise.
7712 * output.cc: Likewise.
7713 * output.h: Likewise.
7714 * parameters.cc: Likewise.
7715 * plugin.cc: Likewise.
7716 * powerpc.cc: Likewise.
7717 * reduced_debug_output.cc: Likewise.
7718 * reduced_debug_output.h: Likewise.
7719 * reloc.cc: Likewise.
7720 * reloc.h: Likewise.
7721 * resolve.cc: Likewise.
7722 * script-sections.cc: Likewise.
7723 * script.cc: Likewise.
7724 * script.h: Likewise.
7725 * sparc.cc: Likewise.
7726 * symtab.cc: Likewise.
7727 * symtab.h: Likewise.
7728 * target-select.cc: Likewise.
7729 * target-select.h: Likewise.
7730 * token.h: Likewise.
7731 * workqueue.cc: Likewise.
7732 * workqueue.h: Likewise.
7733 * x86_64.cc: Likewise.
7734
7735 2009-12-10 Doug Kwan <dougkwan@google.com>
7736
7737 * arm.cc (attributes.h): New include.
7738 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7739 (Arm_relobj::~Arm_relobj): Delete object pointed by
7740 attributes_section_data_.
7741 (Arm_relobj::attributes_section_data): New method definition.
7742 (Arm_relobj::attributes_section_data_): New data member declaration.
7743 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7744 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7745 attributes_section_data_.
7746 (Arm_dynobj::attributes_section_data): New method definition.
7747 (Arm_dynobj::attributes_section_data_): New data member declaration.
7748 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7749 initialization value of may_use_blx_ to false.
7750 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7751 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7752 object attributes to compute results instead of hard-coding.
7753 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7754 Target_arm::get_secondary_compatible_arch,
7755 Target_arm::set_secondary_compatible_arch
7756 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7757 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7758 New method declarations.
7759 (Target_arm::get_aeabi_object_attribute): New method definition.
7760 (Target_arm::attributes_section_data_): New data member declaration.
7761 (read_arm_attributes_section): New template definition.
7762 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7763 (Arm_dynobj::do_read_symbols): Ditto.
7764 (Target_arm::do_finalize_sections): Merge attributes sections from
7765 input. Check for BLX use after attributes section merging.
7766 Fix __exidx_start and __exidx_end visibility. Create an
7767 .ARM.attributes section if necessary.
7768 (Target_arm::get_secondary_compatible_arch,
7769 Target_arm::set_secondary_compatible_arch,
7770 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7771 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7772 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7773 New method definitions.
7774
7775 2009-12-09 Ian Lance Taylor <iant@google.com>
7776
7777 * plugin.cc (Plugin::load): Don't cast from void* to a function
7778 pointer.
7779
7780 2009-12-09 Ian Lance Taylor <iant@google.com>
7781
7782 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7783 information fields.
7784
7785 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7786
7787 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7788 Replace two_file_shared_1.so with two_file_shared_2.so.
7789 * testsuite/Makefile.in: Regenerated.
7790
7791 2009-12-08 Doug Kwan <dougkwan@google.com>
7792
7793 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7794 (HFILES): Add attributes.h and int_encoding.h.
7795 * Makefile.in: Regenerate.
7796 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7797 function definitions to int_encoding.cc
7798 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7799 prototypes to int_encoding.h
7800 * reduced_debug_output.cc (int_encoding.h): New include.
7801 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7802 function definitions to int_encoding.cc
7803 (insert_into_vector, read_from_pointer): Move template definitions to
7804 int_encoding.h
7805 * attributes.cc: New file.
7806 * attributes.h: New file.
7807 * int_encoding.cc: New file.
7808 * int_encoding.h: New file.
7809
7810 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7811
7812 PR gold/11055
7813 * incremental-dump.cc (dump_incremental_inputs): New.
7814 (main): Use dump_incremental_inputs.
7815
7816 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7817
7818 PR gold/10893
7819 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7820 checking elfcpp::STT_FUNC.
7821 (Target_i386::Relocate::relocate): Likewise.
7822 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7823
7824 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7825 symbols from shared libraries into normal FUNC symbols.
7826
7827 * symtab.h (Symbol): Add is_func and use it.
7828
7829 2009-12-05 Doug Kwan <dougkwan@google.com>
7830
7831 * arm.cc (Target_arm::arm_info): Initialize new fields
7832 attributes_section and attributes_vendor.
7833 * i386.cc (Target_i386::i386_info): Same.
7834 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7835 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7836 fields attributes_section and attributes_vendor.
7837 * sparc.cc (Target_sparc::sparc_info): Same.
7838 * target.h (Target::attributes_section, Target::attributes_vendor,
7839 Target::is_attributes_section, Target::attribute_arg_type,
7840 Target::attributes_order): New method definitions.
7841 (Target::Target_info::attributes_section,
7842 Target::Target_info::attributes_vendor): New fields.
7843 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7844 virtual method definitions.
7845 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7846 attributes_section and attributes_vendor.
7847 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7848
7849 2009-12-05 Doug Kwan <dougkwan@google.com>
7850
7851 * arm.cc: Update comments about interworking and stub generation.
7852 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7853 considered as non-PIC.
7854 (Arm_relocate_functions::base_abs): Fix formatting.
7855 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7856 of function to use GOT entry address instead of offset.
7857 (Target_arm::Scan::global): Issue an error if a symbol would need a
7858 PLT does not get one because it is untyped. Remove code to create
7859 dynamic symbols for relative branches.
7860 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7861 takes unsigned integer instead of boolean.
7862
7863 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7864
7865 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7866 (two_file_test_LDADD): Likewise.
7867 (common_test_1_LDADD): Likewise.
7868 (exception_test_LDADD) Likewise.
7869 (weak_test_LDADD): Likewise.
7870 (many_sections_test_LDADD): Likewise.
7871 (initpri1_LDADD): Likewise.
7872 (script_test_1_LDADD): Likewise.
7873 (script_test_2_LDADD): Likewise.
7874 (justsyms_LDADD): Likewise.
7875 (binary_test_LDADD): Likewise.
7876 (large_LDADD): Likewise.
7877 * testsuite/Makefile.in: Regenerated.
7878
7879 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7880
7881 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7882 (Symbol_table::override_with_special): Likewise.
7883 (Symbol_table::add_from_object): Likewise.
7884
7885 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7886
7887 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7888 Don't set the data_offset twice.
7889
7890 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7891
7892 * testsuite/Makefile.in: Regenerate.
7893
7894 2009-12-03 Doug Kwan <dougkwan@google.com>
7895
7896 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7897 (Target_arm::do_finalize_sections): Add parameter for symbol table
7898 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7899 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7900 parameter for symbol table pointer.
7901 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7902 an additional parameter for a pointer to symbol table.
7903 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7904 parameter for a symbol table pointer.
7905 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7906 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7907 Ditto.
7908 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7909 parameter for a symbol table pointer.
7910
7911 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7912
7913 * incremental.cc (Incremental_inputs_header)
7914 (Incremental_inputs_header_write, Incremental_inputs_entry)
7915 (Incremental_inputs_entry_write): Move ...
7916 * incremental.h (Incremental_inputs_header)
7917 (Incremental_inputs_header_write, Incremental_inputs_entry)
7918 (Incremental_inputs_entry_write): here.
7919
7920 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7921
7922 * incremental.cc (make_sized_incremental_binary): Set the target.
7923 Error if it is incompatible.
7924 * output.h (Output_file): Add filename method.
7925
7926 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7927
7928 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7929 from the get_* methods.
7930
7931 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7932
7933 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7934 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7935 Write 0 for the data_offset of scripts.
7936
7937 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7938
7939 * testsuite/Makefile.am: Add the incremental_test.sh test.
7940 * testsuite/incremental_test.sh: New.
7941 * testsuite/incremental_test_1.c: New.
7942 * testsuite/incremental_test_2.c: New.
7943
7944 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7945
7946 * incremental-dump.cc (main): Fix typos.
7947
7948 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7949
7950 PR gold/11025
7951 * incremental-dump.cc (main): Use llu to print 64 bit values.
7952
7953 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7954 H.J. Lu <hongjiu.lu@intel.com>
7955
7956 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7957 $(LIBDL).
7958 (incremental_dump_LDADD): Likewise.
7959 * Makefile.in: Regenerated.
7960
7961 2009-11-25 Doug Kwan <dougkwan@google.com>
7962
7963 Revert:
7964
7965 2009-11-25 Doug Kwan <dougkwan@google.com>
7966
7967 * arm.cc (Target_arm::Target_arm): Move method definition
7968 outside of class definition. Add code to handle
7969 --target1-rel, --target1-abs and --target2= options.
7970 (Target_arm::get_reloc_reloc_type): Change method to be
7971 non-static and const.
7972 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7973 New data member declaration.
7974 (Target_arm::Scan::local, Target_arm::Scan::global,
7975 Target_arm::Relocate::relocate,
7976 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7977 Adjust call to Target_arm::get_real_reloc_type.
7978 (Target_arm::get_real_reloc_type): Use command line options
7979 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7980 * options.h (--target1-rel, --target1-abs, --target2): New
7981 ARM-only options.
7982
7983 2009-11-25 Doug Kwan <dougkwan@google.com>
7984
7985 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7986 class definition. Add code to handle --target1-rel, --target1-abs
7987 and --target2= options.
7988 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7989 and const.
7990 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7991 member declaration.
7992 (Target_arm::Scan::local, Target_arm::Scan::global,
7993 Target_arm::Relocate::relocate,
7994 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7995 call to Target_arm::get_real_reloc_type.
7996 (Target_arm::get_real_reloc_type): Use command line options to
7997 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7998 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7999 options.
8000
8001 2009-11-25 Doug Kwan <dougkwan@google.com>
8002
8003 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8004 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8005 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8006 formatting.
8007 (Arm_relocate_functions::thm_call): Replace body with a call to
8008 Arm_relocate_functions::thumb_branch_common.
8009 (Arm_relocate_functions::thm_jump24,
8010 Arm_relocate_functions::thm_xpc22): New method definitions.
8011 (Arm_relocate_functions::thumb_branch_common): New method definition.
8012 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8013 operator.
8014 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8015 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8016
8017 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8018
8019 * Makefile.am: Build incremental-dump
8020 * Makefile.in: Regenerate.
8021 * incremental-dump.cc: New.
8022 * incremental.cc (Incremental_inputs_header_data,
8023 Incremental_inputs_entry_data): Move to incremental.h
8024 * incremental.h: (Incremental_inputs_header_data,
8025 Incremental_inputs_entry_data): Move from incremental.cc
8026
8027 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8028
8029 * incremental.cc (Incremental_inputs_header,
8030 Incremental_inputs_header_write, Incremental_inputs_entry,
8031 Incremental_inputs_entry_write): Add a typedef with the data type.
8032
8033 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8034
8035 * incremental.cc (Incremental_inputs_header,
8036 Incremental_inputs_header_write, Incremental_inputs_entry,
8037 Incremental_inputs_entry_write): Update comment about which
8038 type has the filed descriptions.
8039
8040 2009-11-15 Doug Kwan <dougkwan@google.com>
8041
8042 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8043 (Arm_relocate_functions::arm_branch_common): Change method defintion
8044 in class definition to a method declaration and update list of formal
8045 parameters.
8046 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8047 Arm_relocation_functions::jump24): Adjust call to
8048 Arm_relocate_functions::arm_branch_common. Update list of formal
8049 parameters.
8050 (Arm_relocate_functions::xpc25): New method definition.
8051 (Arm_relocate_functions::arm_branch_common): Move method defintion
8052 out from class definition. Use stubs for mode-switching and extending
8053 branch ranges.
8054 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8055 specially. Change code to enable use of stubs in ARM branches.
8056
8057 2009-11-10 Doug Kwan <dougkwan@google.com>
8058
8059 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8060 in method declaration.
8061 (Target_arm::relocate_stub): New method declaration.
8062 (Target_arm::default_target): Change to return a pointer instead of
8063 a const reference.
8064 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8065 Target_arm::default_target.
8066 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8067 method definition.
8068 (Target_arm::relocate_section): Adjust view.
8069 (Target_arm::relocate_stub): New method definition.
8070
8071 2009-11-10 Doug Kwan <dougkwan@google.com>
8072
8073 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8074 a format warning.
8075 * incremental.cc (open_incremental_binary): Initialized local
8076 variables to avoid warnings.
8077 * object.cc (make_elf_object): Ditto.
8078 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8079 a format warning.
8080
8081 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8082
8083 PR gold/10930
8084 * testsuite/plugin_test.c: Include "config.h".
8085
8086 2009-11-09 Doug Kwan <dougkwan@google.com>
8087
8088 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8089 (arm_symbol_value): Remove.
8090 (Arm_relocate_functions::arm_branch_common,
8091 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8092 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8093 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8094 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8095 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8096 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8097 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8098 Arm_relocate_functions::thm_mobw_abs_nc,
8099 Arm_relocate_functions::thm_mov_abs,
8100 Arm_relocate_functions::movw_prel_nc,
8101 Arm_relocate_functions::thm_movt_abs,
8102 Arm_relocate_functions::movt_prel,
8103 Arm_relocate_functions::thm_movw_prel_nc,
8104 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8105 (Target_arm::Relocate::relocate): Only decompose address into two
8106 parts if relocation type uses the thumb-bit and pass the actual
8107 bit instead of a flag indicating that the thumb-bit is used. Adjust
8108 calls to methods in Arm_relocate_functions for this change.
8109
8110 2009-11-08 Ian Lance Taylor <iant@google.com>
8111
8112 PR 10925
8113 * reloc.cc: Instantiate
8114 Sized_relobj::initialize_input_to_output_maps and
8115 Sized_relobj:free_input_to_output_maps.
8116
8117 2009-11-06 Ian Lance Taylor <iant@google.com>
8118
8119 PR 10876
8120 * defstd.cc (in_segment): Set only_if_ref true for "end".
8121
8122 2009-11-06 Doug Kwan <dougkwan@google.com>
8123
8124 * arm.cc (class Reloc_stub): Correct a comment.
8125 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8126 (Target_arm::scan_section_for_stubs): New method declaration.
8127 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8128 Change methods from private to protected.
8129 (Target_arm::do_may_relax): New method definition.
8130 (Target_arm::do_relax, Target_arm::group_sections,
8131 Target_arm::scan_reloc_for_stub,
8132 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8133 (Target_arm::arm_input_section_map_): New data member declaration.
8134 (Target_arm::scan_reloc_for_stub,
8135 Target_arm::scan_reloc_section_for_stubs,
8136 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8137 Target_arm::do_relax): New method definitions.
8138
8139 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8140
8141 * configure.ac: Check for (struct stat)::st_mtim
8142 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8143 * config.in: Regenerate.
8144 * configure: Regenerate.
8145
8146 2009-11-05 Ian Lance Taylor <iant@google.com>
8147
8148 PR 10910
8149 * output.cc (Output_segment::add_output_section): Add missing
8150 return statement.
8151
8152 2009-11-04 Ian Lance Taylor <iant@google.com>
8153
8154 PR 10880
8155 * object.h (class Object): Add is_needed and set_is_needed
8156 methods. Add is_needed_ field. Make bool fields into bitfields.
8157 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8158 defined in a dynamic object and referenced by a regular object,
8159 set is_needed for the dynamic object.
8160 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8161 if the file is marked with as_needed and it is not needed.
8162
8163 2009-11-04 Ian Lance Taylor <iant@google.com>
8164
8165 PR 10887
8166 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8167 tags if data is discarded by linker script.
8168 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8169 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8170 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8171 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8172
8173 2009-11-04 Ian Lance Taylor <iant@google.com>
8174
8175 * layout.cc (Layout::get_output_section): Add is_interp and
8176 is_dynamic_linker_section parameters. Change all callers.
8177 (Layout::choose_output_section): Likewise.
8178 (Layout::make_output_section): Likewise.
8179 (Layout::add_output_section_data): Add is_dynamic_linker_section
8180 parameter. Change all callers.
8181 * layout.h (class Layout): Update declarations.
8182 * output.h (class Output_section): Add is_interp, set_is_interp,
8183 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8184 Add is_interp_, is_dynamic_linker_section_ fields. Change
8185 generate_code_fills_at_write_ to a bitfield.
8186 * output.cc (Output_section::Output_sections): Initialize new
8187 fields.
8188 (Output_segment::add_output_section): Add do_sort parameter.
8189 Change all callers.
8190
8191 2009-11-03 Ian Lance Taylor <iant@google.com>
8192
8193 PR 10860
8194 * options.h (class General_options): Add --warn-common.
8195 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8196 merging two common symbols.
8197 (Symbol_table::should_override): Handle --warn-common when merging
8198 a common symbol with a defined symbol. Use report_resolve_problem
8199 for multiple definitions.
8200 (Symbol_table::report_resolve_problem): New function.
8201 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8202
8203 2009-11-03 Doug Kwan <dougkwan@google.com>
8204
8205 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8206 stub_factory_.
8207 (Target_arm::stub_factory): New method definition.
8208 (Target_arm::new_arm_input_section,
8209 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8210 Target_arm::reloc_uses_thumb_bit): New method declarations.
8211 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8212 New type definitions.
8213 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8214 member declarations.
8215 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8216 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8217 New method definitions.
8218
8219 2009-11-03 Ian Lance Taylor <iant@google.com>
8220
8221 * options.h (class General_options): Add --warn_constructors.
8222
8223 2009-11-03 Ian Lance Taylor <iant@google.com>
8224
8225 PR 10893
8226 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8227 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8228
8229 2009-11-03 Ian Lance Taylor <iant@google.com>
8230
8231 PR 10895
8232 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8233 --msgid-bugs-address.
8234 (install-pdf): New target.
8235 (install-data_yes): Look up one directory to find mkinstalldirs.
8236
8237 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8238
8239 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8240 tree.
8241
8242 2009-10-30 Doug Kwan <dougkwan@google.com>
8243
8244 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8245
8246 2009-10-30 Doug Kwan <dougkwan@google.com>
8247
8248 * arm.cc (Stub_addend_reader): New struct template definition
8249 and partial specializations.
8250 (Stub_addend_reader::operator()): New method definition for a
8251 partially specialized template.
8252
8253 2009-10-30 Doug Kwan <dougkwan@google.com>
8254
8255 * arm.cc (Arm_relobj::processor_specific_flags): New method
8256 definition.
8257 (Arm_relobj::do_read_symbols): New method declaration.
8258 (Arm_relobj::processor_specific_flags_): New data member declaration.
8259 (Arm_dynobj): New class definition.
8260 (Target_arm::do_finalize_sections): Add input_objects parameter.
8261 (Target_arm::do_adjust_elf_header): New method declaration.
8262 (Target_arm::are_eabi_versions_compatible,
8263 (Target_arm::merge_processor_specific_flags): New method declaration.
8264 (Target_arm::do_make_elf_object): New overloaded method definitions
8265 and declaration.
8266 (Arm_relobj::do_read_symbols): New method definition.
8267 (Arm_dynobj::do_read_symbols): Ditto.
8268 (Target_arm::do_finalize_sections): Add input_objects parameters.
8269 Merge processor-specific flags from all input objects.
8270 (Target_arm::are_eabi_versions_compatible,
8271 Target_arm::merge_processor_specific_flags,
8272 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8273 New method definitions.
8274 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8275 Input_objects pointer type parameter.
8276 * layout.cc (Layout::finalize): Pass input objects to target's.
8277 finalize_sections function.
8278 * output.cc (Output_file_header::do_sized_write): Set ELF file
8279 header's processor-specific flags.
8280 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8281 Input_objects pointer type parameter.
8282 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8283 * target.h (Input_objects): New forward class declaration.
8284 (Target::processor_specific_flags,
8285 Target::are_processor_specific_flags_sect): New method definitions.
8286 (Target::finalize_sections): Add input_objects parameter.
8287 (Target::Target): Initialize processor_specific_flags_ and
8288 are_processor_specific_flags_set_.
8289 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8290 parameter.
8291 (Target::set_processor_specific_flags): New method definition.
8292 (Target::processor_specific_flags_,
8293 Target::are_processor_specific_flags_set_): New data member
8294 declarations.
8295 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8296 Input_objects pointer type parameter.
8297
8298 2009-10-30 Doug Kwan <dougkwan@google.com>
8299
8300 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8301
8302 2009-10-28 Ian Lance Taylor <iant@google.com>
8303
8304 * object.h (class Relobj): Drop options parameter from
8305 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8306 do_scan_relocs, do_relocate. Change all callers.
8307 (class Sized_relobj): Drop options parameters from
8308 do_gc_process_relocs, do_scan_relocs, do_relocate,
8309 do_relocate_sections, relocate_sections, emit_relocs_scan,
8310 emit_relocs_scan_reltype. Change all callers.
8311 (struct Relocate_info): Remove options field and all references to
8312 it.
8313 * reloc.h (class Read_relocs): Remove options constructor
8314 parameter and options_ field. Change all callers.
8315 (class Gc_process_relocs, class Scan_relocs): Likewise.
8316 (class Relocate_task): Likewise.
8317 * target-reloc.h (scan_relocs): Remove options parameter. Change
8318 all callers.
8319 (scan_relocatable_relocs): Likewise.
8320 * target.h (class Sized_target): Remove options parameter from
8321 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8322 all callers.
8323 * gc.h (gc_process_relocs): Remove options parameter. Change all
8324 callers.
8325 * arm.cc: Update functions to remove options parameters.
8326 * i386.cc: Likewise.
8327 * powerpc.cc: Likewise.
8328 * sparc.cc: Likewise.
8329 * x86_64.cc: Likewise.
8330 * testsuite/testfile.cc: Likewise.
8331
8332 2009-10-28 Doug Kwan <dougkwan@google.com>
8333
8334 * arm.cc (Arm_relobj): New class definition.
8335 (Arm_relobj::scan_sections_for_stubs,
8336 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8337 New method definitions.
8338
8339 2009-10-28 Cary Coutant <ccoutant@google.com>
8340
8341 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8342 (Plugin::cleanup_done_): New member.
8343 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8344 (Plugin_manager::cleanup_done_): Remove.
8345 (Plugin_manager::add_input_file): Edit error message.
8346 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8347 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8348
8349 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8350
8351 * fileread.cc: (File_read::View::~View): Use the new
8352 data_ownership_ filed.
8353 (File_read::~File_read): Dispose the new whole_file_view_.
8354 (File_read::open): Mmap the whole file if needed.
8355 (File_read::open): Use whole_file_view_ instead of contents_.
8356 (File_read::find_view): Use whole_file_view_ if applicable.
8357 (File_read::do_read): Use whole_file_view_ instead of contents_.
8358 (File_read::make_view): Use whole_file_view_ instead of contents_,
8359 update File_read::View::View call.
8360 (File_read::find_or_make_view): Update File_read::View::View
8361 call.
8362 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8363 remove contents_
8364 (File_read::View::Data_ownership): New enum.
8365 (File_read::View::View): Replace bool mapped_ with Data_ownership
8366 argument.
8367 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8368 (File_read::View::data_ownership_): New field.
8369 (File_read::contents_): Remove (replaced by whole_file_view_).
8370 (File_read::whole_file_view_): New field.
8371 * options.h (class General_options): Add --keep-files-mapped.
8372
8373 2009-10-27 Cary Coutant <ccoutant@google.com>
8374
8375 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8376 * testsuite/Makefile.am (plugin_test_5): New test case.
8377 * testsuite/Makefile.in: Regenerate.
8378
8379 2009-10-25 Doug Kwan <dougkwan@google.com>
8380
8381 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8382 from private to protected to allow access by child class.
8383 (Sized_relobj::do_relocate_sections): New method declaration.
8384 (Sized_relobj::relocate_sections): Virtualize.
8385 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8386 Sized_relobj::relocate_sections. Instantiate template explicitly
8387 for different target sizes and endianity.
8388
8389 2009-10-24 Doug Kwan <dougkwan@google.com>
8390
8391 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8392 (Arm_input_section::as_arm_input_section): New method.
8393 (Arm_output_section): New class definition.
8394 (Arm_output_section::create_stub_group,
8395 Arm_output_section::group_sections): New method definitions.
8396
8397 2009-10-22 Doug Kwan <dougkwan@google.com>
8398
8399 * arm.cc (Arm_input_section): New class definition.
8400 (Arm_input_section::init, Arm_input_section:do_write,
8401 Arm_input_section::set_final_data_size,
8402 Arm_input_section::do_reset_address_and_file_offset): New method
8403 definitions.
8404
8405 2009-10-21 Doug Kwan <dougkwan@google.com>
8406
8407 * arm.cc (Stub_table, Arm_input_section): New forward class
8408 declarations.
8409 (Stub_table): New class defintion.
8410 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8411 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8412 New method definition.
8413
8414 2009-10-21 Doug Kwan <dougkwan@google.com>
8415
8416 * arm.cc: Update copyright comments.
8417 (Target_arm): New forward class template declaration.
8418 (Arm_address): New type.
8419 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8420 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8421 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8422 constants.
8423 (Insn_template): Same.
8424 (DEF_STUBS): New macro.
8425 (Stub_type): New enum type.
8426 (Stub_template): New class definition.
8427 (Stub): Same.
8428 (Reloc_stub): Same.
8429 (Stub_factory): Same.
8430 (Target_arm::Target_arm): Initialize may_use_blx_ and
8431 should_force_pic_veneer_.
8432 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8433 Target_arm::should_force_pic_veneer,
8434 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8435 Target_arm::using_thumb_only, Target_arm:;default_target): New
8436 method defintions.
8437 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8438 New data member declarations.
8439 (Insn_template::size, Insn_template::alignment): New method defintions.
8440 (Stub_template::Stub_template): New method definition.
8441 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8442 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8443 (Stub_factory::Stub_factory): New method definition.
8444 * gold.h (string_hash): New template.
8445 * output.h (Input_section_specifier::hash_value): Use
8446 gold::string_hash.
8447 (Input_section_specifier::string_hash): Remove.
8448 * stringpool.cc (Stringpool_template::string_hash): Use
8449 gold::string_hash.
8450
8451 2009-10-20 Doug Kwan <dougkwan@google.com>
8452
8453 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8454 symbols of relaxed input sections.
8455 * output.h (Output_section::find_relaxed_input_section): Make
8456 method public.
8457
8458 2009-10-16 Doug Kwan <dougkwan@google.com>
8459
8460 * dynobj.cc (Versions::Versions): Initialize version_script_.
8461 Only insert base version symbol definition for a shared object
8462 if version script defines any version versions.
8463 (Versions::define_base_version): New method definition.
8464 (Versions::add_def): Check that base version is not needed.
8465 (Versions::add_need): Define base version lazily.
8466 * dynobj.h (Versions::define_base_version): New method declaration.
8467 (Versions::needs_base_version_): New data member declaration.
8468 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8469 (check_DATA): Add no_version_test.stdout.
8470 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8471 New make rules.
8472 * testsuite/Makefile.in: Regenerate.
8473 * testsuite/no_version_test.c: New file.
8474 * testsuite/no_version_test.sh: Ditto.
8475
8476 2009-10-16 Doug Kwan <dougkwan@google.com>
8477
8478 * expression.cc (class Segment_start_expression): New class definition.
8479 (Segment_start_expression::value): New method definition.
8480 (script_exp_function_segment_start): Return a new
8481 Segment_start_expression.
8482 * gold/script-c.h (script_saw_segment_start_expression): New function
8483 prototype.
8484 * script-sections.cc (Script_sections::Script_sections): Initialize
8485 SAW_SEGMENT_START_EXPRESSION_ to false.
8486 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8487 and -Tbbs options to specify section addresses if given in
8488 command line and no SEGMENT_START expression is seen in a script.
8489 * script-sections.h (Script_sections::saw_segment_start_expression,
8490 Script_sections::set_saw_segment_start_expression): New method
8491 definition.
8492 (Script_sections::saw_segment_start_expression_): New data member
8493 declaration.
8494 * script.cc (script_saw_segment_start_expression): New function.
8495 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8496 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8497 script_test_7.sh and script_test_8.sh.
8498 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8499 script_test_8.stdout.
8500 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8501 (script_test_6, script_test_6.stdout, script_test_7,
8502 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8503 * Makefile.in: Regenerate.
8504 * testsuite/script_test_6.sh: New file.
8505 * testsuite/script_test_6.t: Same.
8506 * testsuite/script_test_7.sh: Same.
8507 * testsuite/script_test_7.t: Same.
8508 * testsuite/script_test_8.sh: Same.
8509
8510 2009-10-16 Doug Kwan <dougkwan@google.com>
8511
8512 * output.cc (Output_segment::set_section_list_address): Cast
8513 expressions to unsigned long long type to avoid format warnings.
8514
8515 2009-10-15 Ian Lance Taylor <iant@google.com>
8516
8517 * script.cc (Script_options::add_symbol_assignment): Always add a
8518 dot assignment to script_sections_.
8519 * script-sections.cc (Script_sections::add_dot_assignment):
8520 Initialize if necessary.
8521
8522 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8523 program headers with no load segment if there is a linker script.
8524
8525 * layout.cc (Layout::set_segment_offsets): Align the file offset
8526 to the segment aligment for -N or -n with no load segment.
8527 * output.cc (Output_segment::add_output_section): Don't crash if
8528 the first section is a TLS section.
8529 (Output_segment::set_section_list_addresses): Print an error
8530 message if the address moves backward in a linker script.
8531 * script-sections.cc
8532 (Output_section_element_input::set_section_addresses): Don't
8533 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8534 (Orphan_output_section::set_section_addresses): Likewise.
8535
8536 2009-10-15 Doug Kwan <dougkwan@google.com>
8537
8538 * layout.cc (Layout::finish_dynamic_section): Generate tags
8539 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8540 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8541 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8542
8543 2009-10-14 Ian Lance Taylor <iant@google.com>
8544
8545 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8546 fields.
8547 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8548 data_shdr fields of relinfo.
8549 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8550 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8551 R_386_TLS_LDO_32, adjust based on section flags.
8552 (Target_i386::Relocate::fix_up_ldo): Remove.
8553
8554 2009-10-13 Ian Lance Taylor <iant@google.com>
8555
8556 Add support for -pie.
8557 * options.h (class General_options): Add -pie and
8558 --pic-executable.
8559 (General_options::output_is_position_independent): Test -pie.
8560 (General_options::output_is_executable): Return true if not shared
8561 and not relocatable.
8562 (General_options::output_is_pie): Remove.
8563 * options.cc (General_options::finalize): Reject incompatible uses
8564 of -pie.
8565 * gold.cc (queue_middle_tasks): A -pie link is not static.
8566 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8567 * symtab.cc (Symbol::final_value_is_known): Return false if
8568 output_is_position_independent.
8569 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8570 output_is_position_independent.
8571 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8572 output_is_position_independent.
8573 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8574 output_is_position_independent.
8575 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8576 two_file_pie_test.
8577 (basic_pie_test.o, basic_pie_test): New targets.
8578 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8579 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8580 (two_file_pie_test): New target.
8581 * testsuite/Makefile.in: Rebuild.
8582 * README: Remove note saying that -pie is not supported.
8583
8584 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8585
8586 * options.h (class General_options): Add -init and -fini.
8587 * layout.cc (Layout::finish_dynamic_section): Emit
8588 given init and fini functions.
8589
8590 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8591
8592 * gc.h (gc_process_relocs): Check if icf is enabled using new
8593 function.
8594 * gold.cc (queue_initial_tasks): Likewise.
8595 (queue_middle_tasks): Likewise.
8596 * object.cc (do_layout): Likewise.
8597 * symtab.cc (is_section_folded): Likewise.
8598 * main.cc (main): Likewise.
8599 * reloc.cc (Read_relocs::run): Likewise.
8600 (Sized_relobj::do_scan_relocs): Likewise.
8601 * icf.cc (is_function_ctor_or_dtor): New function.
8602 (Icf::find_identical_sections): Check if function is ctor or dtor when
8603 safe icf is chosen.
8604 * options.h (General_options::icf): Change option to be an enum.
8605 (Icf_status): New enum.
8606 (icf_enabled): New method.
8607 (icf_safe_folding): New method.
8608 (set_icf_status): New method.
8609 (icf_status_): New variable.
8610 * (options.cc) (General_options::finalize): Set icf_status_.
8611 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8612 icf_test and icf_keep_unique_test to use the --icf enum flag.
8613 * testsuite/icf_safe_test.sh: New file.
8614 * testsuite/icf_safe_test.cc: New file.
8615
8616 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8617
8618 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8619 includes to gc.h and icf.h.
8620 * arm.cc: Include gc.h.
8621 * gold.cc: Likewise.
8622 * i386.cc: Likewise.
8623 * powerpc.cc: Likewise.
8624 * sparc.cc: Likewise.
8625 * x86_64.cc: Likewise.
8626 * gc.h: Include icf.h.
8627
8628 2009-10-11 Ian Lance Taylor <iant@google.com>
8629
8630 * plugin.cc: Include "gold.h" before other header files.
8631
8632 2009-10-10 Chris Demetriou <cgd@google.com>
8633
8634 * options.h (Input_file_argument::Input_file_type): New enum.
8635 (Input_file_argument::is_lib_): Replace with...
8636 (Input_file_argument::type_): New member.
8637 (Input_file_argument::Input_file_argument): Take Input_file_type
8638 'type' rather than boolean 'is_lib' as second argument.
8639 (Input_file_argument::is_lib): Use type_.
8640 (Input_file_argument::is_searched_file): New function.
8641 (Input_file_argument::may_need_search): Handle is_searched_file.
8642 * options.cc (General_options::parse_library): Support -l:filename.
8643 (General_options::parse_just_symbols): Update for Input_file_argument
8644 changes.
8645 (Command_line::process): Likewise.
8646 * archive.cc (Archive::get_file_and_offset): Likewise.
8647 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8648 * script.cc (read_script_file, script_add_file): Likewise.
8649 * fileread.cc (Input_file::Input_file): Likewise.
8650 (Input_file::will_search_for): Handle is_searched_file.
8651 (Input_file::open): Likewise.
8652 * readsyms.cc (Read_symbols::get_name): Likewise.
8653 * testsuite/Makefile.am (searched_file_test): New test.
8654 * testsuite/Makefile.in: Regenerate.
8655 * testsuite/searched_file_test.cc: New file.
8656 * testsuite/searched_file_test_lib.cc: New file.
8657
8658 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8659 Ian Lance Taylor <iant@google.com>
8660
8661 * descriptor.cc: Include <cstdio> and "binary-io.h".
8662 (Descriptors::open): Open the files in binary mode always.
8663 * script.cc (Lex::get_token): Treat \r as whitespace.
8664
8665 2009-10-09 Ian Lance Taylor <iant@google.com>
8666
8667 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8668
8669 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8670 Ian Lance Taylor <iant@google.com>
8671
8672 * configure.ac: Check for readv function also.
8673 * fileread.cc (readv): Define if not HAVE_READV.
8674 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8675 does not exist.
8676 * config.in: Regenerate.
8677 * configure: Regenerate.
8678
8679 2009-10-09 Doug Kwan <dougkwan@google.com>
8680
8681 * layout.cc (Layout::make_output_section): Call target hook to make
8682 ordinary output section.
8683 (Layout::finalize): Adjust parameter list of call the
8684 Target::may_relax().
8685 * layout.h (class Layout::section_list): New method.
8686 * merge.h (Output_merge_base::entsize): Change visibility to public.
8687 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8688 New methods.
8689 (Output_merge_string::do_is_string): New method.
8690 * object.cc (Sized_relobj::do_setup): renamed from
8691 Sized_relobj::set_up.
8692 * object.h (Sized_relobj::adjust_shndx,
8693 Sized_relobj::initializ_input_to_output_maps,
8694 Sized_relobj::free_input_to_output_maps): Change visibilities to
8695 protected.
8696 (Sized_relobj::setup): Virtualize.
8697 (Sized_relobj::do_setup): New method declaration.
8698 (Sized_relobj::invalidate_section_offset,
8699 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8700 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8701 * options.cc (parse_int): New function.
8702 * options.h (parse_int): New declaration.
8703 (DEFINE_int): New macro.
8704 (stub_group_size): New option.
8705 * output.cc (Output_section::Output_section): Initialize memebers
8706 merge_section_map_, merge_section_by_properties_map_,
8707 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8708 (Output_section::add_input_section): Handled deferred code-fill
8709 generation and remove an old comment.
8710 (Output_section::add_relaxed_input_section): New method definition.
8711 (Output_section::add_merge_input_section): Use merge section by
8712 properties map to speed to search. Update merge section maps
8713 as appropriate.
8714 (Output_section::build_relaxation_map): New method definition.
8715 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8716 Same.
8717 (Output_section::relax_input_section): Renamed to
8718 Output_section::convert_input_sections_to_relaxed_sections and change
8719 interface to take a vector of pointers to relaxed sections.
8720 (Output_section::find_merge_section,
8721 Output_section::find_relaxed_input_section): New method definitions.
8722 (Output_section::is_input_address_mapped,
8723 Output_section::output_offset, Output_section::output_address):
8724 Use output section data maps to speed up searching.
8725 (Output_section::find_starting_output_address): Add comments.
8726 (Output_section::do_write,
8727 Output_section::write_to_postprocessing_buffer): Do code-fill
8728 generation as appropriate.
8729 (Output_section::get_input_sections): Invalidate relaxed input section
8730 map.
8731 (Output_section::restore_states): Adjust type of checkpoint .
8732 Invalidate relaxed input section map.
8733 * output.h (Output_merge_base): New class declaration.
8734 (Input_section_specifier): New class defintion.
8735 (class Output_relaxed_input_section) Change base class to
8736 Output_section_data_build.
8737 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8738 base class initializer.
8739 (Output_section::add_relaxed_input_section): New method declaration.
8740 (Output_section::Input_section): Change visibility to protected.
8741 (Output_section::Input_section::relobj,
8742 Output_section::Input_section::shndx): Handle relaxed input sections.
8743 Output_section::input_sections) Change visibility to protected. Also
8744 define overload to return a non-const pointer.
8745 (Output_section::Merge_section_properties): New class defintion.
8746 (Output_section::Merge_section_by_properties_map,
8747 Output_section::Output_section_data_by_input_section_map,
8748 Output_section::Relaxation_map): New types.
8749 (Output_section::relax_input_section): Rename method to
8750 Output_section::convert_input_sections_to_relaxed_sections and change
8751 interface to take a vector of relaxed section pointers.
8752 (Output_section::find_merge_section,
8753 Output_section::find_relaxed_input_section,
8754 Output_section::build_relaxation_map,
8755 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8756 New method declarations.
8757 (Output_section::merge_section_map_
8758 Output_section::merge_section_by_properties_map_,
8759 Output_section::relaxed_input_section_map_,
8760 Output_section::is_relaxed_input_section_map_valid_,
8761 Output_section::generate_code_fills_at_write_): New data members.
8762 * script-sections.cc
8763 (Output_section_element_input::set_section_addresses): Call
8764 current_data_size and addralign methods of relaxed input sections.
8765 (Orphan_output_section::set_section_addresses): Call current_data_size
8766 and addralign methods of relaxed input sections.
8767 * symtab.cc (Symbol_table::compute_final_value): Extract template
8768 from the body of Symbol_table::sized_finalize_symbol.
8769 (Symbol_table::sized_finalized_symbol): Call
8770 Symbol_table::compute_final_value.
8771 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8772 (Symbol_table::compute_final_value): New templated method declaration.
8773 * target.cc (Target::do_make_output_section): New method defintion.
8774 * target.h (Target::make_output_section): New method declaration.
8775 (Target::relax): Add more parameters for input objects, symbol table
8776 and layout. Adjust call to do_relax.
8777 (Target::do_make_output_section): New method declaration.
8778 (Target::do_relax): Add parameters for input objects, symbol table
8779 and layout.
8780
8781 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8782
8783 * pread.c: Include stdio.h.
8784
8785 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8786
8787 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8788 defined.
8789
8790 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8791
8792 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8793 Change read_shndx type to unsigned int.
8794 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8795 int.
8796 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8797 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8798 Change read_shndx type to unsigned int.
8799 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8800 int.
8801 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8802 * layout.cc (Layout::create_symtab_sections): Cast the result of
8803 local_symcount * symsize to off_t in the gold_assert.
8804
8805 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8806
8807 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8808 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8809 R_ARM_BASE_ABS.
8810 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8811 (Arm_relocate_functions::thm_abs5): New function.
8812 (Arm_relocate_functions::abs12): New function.
8813 (Arm_relocate_functions::abs16): New function.
8814 (Arm_relocate_functions::base_abs): New function.
8815 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8816 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8817 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8818 R_ARM_BASE_ABS.
8819 (Scan::global): Likewise.
8820 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8821 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8822 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8823 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8824 R_ARM_BASE_ABS.
8825
8826 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8827
8828 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8829 (Arm_relocate_functions::movt_prel): New function.
8830 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8831 (Arm_relocate_functions::thm_movt_prel): New function.
8832 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8833 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8834 (Scan::global, Relocate::relocate): Likewise.
8835 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8836
8837 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8838
8839 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8840 Incremental_checker.
8841 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8842 unsigned int.
8843 (class Incremental_inputs_header): New class.
8844 (Incremental_inputs_header_writer): Edit comment.
8845 (Incremental_inputs_entry): New class.
8846 (Incremental_inputs_entry_writer): Edit comment.
8847 (Sized_incremental_binary::do_find_incremental_inputs_section):
8848 Add *strtab_shndx parameter, fill it.
8849 (Sized_incremental_binary::do_check_inputs): New method.
8850 (Incremental_checker::can_incrementally_link_output_file): Use
8851 Sized_incremental_binary::check_inputs.
8852 (Incremental_inputs::report_command_line): Save command line in
8853 command_line_.
8854 * incremental.h:
8855 (Incremental_binary::find_incremental_inputs_section): New
8856 method.
8857 (Incremental_binary::do_find_incremental_inputs_section): Add
8858 strtab_shndx parameter.
8859 (Incremental_binary::do_check_inputs): New pure virtual method.
8860 (Sized_incremental_binary::do_check_inputs): Declare.
8861 (Incremental_checker::Incremental_checker): Add incremental_inputs
8862 parameter, use it to initialize incremental_inputs_.
8863 (Incremental_checker::incremental_inputs_): New field.
8864 (Incremental_checker::command_line): New method.
8865 (Incremental_checker::inputs): New method.
8866 (Incremental_checker::command_line_): New field.
8867
8868 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8869
8870 * incremental.cc: Include <cstdarg> and "target-select.h".
8871 (vexplain_no_incremental): New function.
8872 (explain_no_incremental): New function.
8873 (Incremental_binary::error): New method.
8874 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8875 method.
8876 (make_sized_incremental_binary): New function.
8877 (open_incremental_binary): New function.
8878 (can_incrementally_link_file): Add checks if output is ELF and has
8879 inputs section.
8880 * incremental.h: Include "elfcpp_file.h" and "output.h".
8881 (Incremental_binary): New class.
8882 (Sized_incremental_binary): New class.
8883 (open_incremental_binary): Declare.
8884 * object.cc (is_elf_object): Use
8885 elfcpp::Elf_recognizer::is_elf_file.
8886 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8887 * output.h (Output_file::filesize): New method.
8888
8889 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8890
8891 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8892 New function.
8893 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8894 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8895 function.
8896 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8897 function.
8898 (Arm_relocate_functions::movw_abs_nc): New function.
8899 (Arm_relocate_functions::movt_abs): New function.
8900 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8901 (Arm_relocate_functions::thm_movt_abs): New function.
8902 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8903 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8904 (Scan::global): Likewise.
8905 (Relocate::relocate): Likewise.
8906 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8907
8908 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8909
8910 * arm.cc (Arm_relocate_functions::got_prel) New function.
8911 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8912 (Relocate::relocate): Likewise.
8913 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8914
8915 2009-10-06 Ian Lance Taylor <iant@google.com>
8916
8917 * options.h (class General_options): Define
8918 split_stack_adjust_size parameter.
8919 * object.h (class Object): Add uses_split_stack_ and
8920 has_no_split_stack_ fields. Add uses_split_stack and
8921 has_no_split_stack accessor functions. Declare
8922 handle_split_stack_section.
8923 (class Reloc_symbol_changes): Define.
8924 (class Sized_relobj): Define Function_offsets. Declare
8925 split_stack_adjust, split_stack_adjust_reltype, and
8926 find_functions.
8927 * object.cc (Object::handle_split_stack_section): New function.
8928 (Sized_relobj::do_layout): Call handle_split_stack_section.
8929 * dynobj.cc (Sized_dynobj::do_layout): Call
8930 handle_split_stack_section.
8931 * reloc.cc (Sized_relobj::relocate_sections): Call
8932 split_stack_adjust for executable sections in split_stack
8933 objects. Pass reloc_map to relocate_section.
8934 (Sized_relobj::split_stack_adjust): New function.
8935 (Sized_relobj::split_stack_adjust_reltype): New function.
8936 (Sized_relobj::find_functions): New function.
8937 * target-reloc.h: Include "object.h".
8938 (relocate_section): Add reloc_symbol_changes parameter. Change
8939 all callers.
8940 * target.h (class Target): Add calls_non_split method. Declare
8941 do_calls_non_split virtual method. Declare match_view and
8942 set_view_to_nop.
8943 * target.cc: Include "elfcpp.h".
8944 (Target::do_calls_non_split): New function.
8945 (Target::match_view): New function.
8946 (Target::set_view_to_nop): New function.
8947 * gold.cc (queue_middle_tasks): Give an error if mixing
8948 split-stack and non-split-stack objects with -r.
8949 * i386.cc (Target_i386::relocate_section): Add
8950 reloc_symbol_changes parameter.
8951 (Target_i386::do_calls_non_split): New function.
8952 * x86_64.cc (Target_x86_64::relocate_section): Add
8953 reloc_symbol_changes parameter.
8954 (Target_x86_64::do_calls_non_split): New function.
8955 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8956 parameter.
8957 * powerpc.cc (Target_powerpc::relocate_section): Add
8958 reloc_symbol_changes parameter.
8959 * sparc.cc (Target_sparc::relocate_section): Add
8960 reloc_symbol_changes parameter.
8961 * configure.ac: Call AM_CONDITIONAL for the default target.
8962 * configure: Rebuild.
8963 * testsuite/Makefile.am (TEST_AS): New variable.
8964 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8965 (check_DATA): Add split_i386 and split_x86_64 files.
8966 (SPLIT_DEFSYMS): Define.
8967 (split_i386_[1234n].o): New targets.
8968 (split_i386_[124]): New targets.
8969 (split_i386_[1234r].stdout): New targets.
8970 (split_x86_64_[1234n].o): New targets.
8971 (split_x86_64_[124]): New targets.
8972 (split_x86_64_[1234r].stdout): New targets.
8973 (MOSTLYCLEANFILES): Add new executables.
8974 * testsuite/split_i386.sh: New file.
8975 * testsuite/split_x86_64.sh: New file.
8976 * testsuite/split_i386_1.s: New file.
8977 * testsuite/split_i386_2.s: New file.
8978 * testsuite/split_i386_3.s: New file.
8979 * testsuite/split_i386_4.s: New file.
8980 * testsuite/split_i386_n.s: New file.
8981 * testsuite/split_x86_64_1.s: New file.
8982 * testsuite/split_x86_64_2.s: New file.
8983 * testsuite/split_x86_64_3.s: New file.
8984 * testsuite/split_x86_64_4.s: New file.
8985 * testsuite/split_x86_64_n.s: New file.
8986 * testsuite/testfile.cc (Target_test): Update relocation_section
8987 function.
8988 * testsuite/Makefile.in: Rebuild.
8989
8990 2009-10-06 Ian Lance Taylor <iant@google.com>
8991
8992 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8993 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8994 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8995 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8996 the address on ldo_addrs_.
8997 (Target_i386::Relocate::fix_up_ldo): New function.
8998
8999 2009-10-06 Rafael Espindola <espindola@google.com>
9000
9001 * plugin.cc (add_input_library): New.
9002 (Plugin::load): Add add_input_library to tv.
9003 (Plugin_manager::add_input_file): Add the is_lib argument.
9004 (add_input_file): Update call to Plugin_manager::add_input_file.
9005 (add_input_library): New.
9006 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9007
9008 2009-09-30 Doug Kwan <dougkwan@google.com>
9009
9010 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9011 symbol and call Symbol::may_need_copy_reloc to determine if
9012 a copy reloc is needed.
9013 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9014 nocopyreloc is given in command line.
9015 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9016 given in command line.
9017 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9018 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9019 of the removed Target_i386::may_need_copy_reloc.
9020 * options.h (copyreloc): New option with default value false.
9021 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9022 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9023 instead of the removed Target_powerpc::may_need_copy_reloc.
9024 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9025 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9026 instead of the removed Target_sparc::may_need_copy_reloc.
9027 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9028 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9029 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9030 instead of the removed Target_x86_64::may_need_copy_reloc.
9031
9032 2009-09-30 Ian Lance Taylor <iant@google.com>
9033
9034 * object.h (class Object): Remove target_ field, and target,
9035 sized_target, and set_target methods.
9036 (Object::sized_target): Remove.
9037 (class Sized_relobj): Update declarations. Remove sized_target.
9038 * object.cc (Sized_relobj::setup): Remove target parameter.
9039 Change all callers.
9040 (Input_objects::add_object): Don't do anything with the target.
9041 (make_elf_sized_object): Add punconfigured parameter. Change all
9042 callers. Set or test parameter target.
9043 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9044 Change all callers.
9045 * parameters.cc (Parameters::set_target): Change parameter type to
9046 be non-const.
9047 (Parameters::default_target): Remove.
9048 (set_parameters_target): Change parameter type to be non-const.
9049 (parameters_force_valid_target): New function.
9050 (parameters_clear_target): New function.
9051 * parameters.h (class Parameters): Update declarations. Remove
9052 default_target method. Add sized_target and clear_target
9053 methods. Change target_ to be non-const.
9054 (set_parameters_target): Update declaration.
9055 (parameters_force_valid_target): Declare.
9056 (parameters_clear_target): Declare.
9057 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9058 as NULL if we aren't searching.
9059 (Add_symbols::run): Don't check for compatible target.
9060 * fileread.cc (Input_file::open_binary): Call
9061 parameters_force_valid_target.
9062 * gold.cc (queue_middle_tasks): Likewise.
9063 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9064 set_target on object.
9065 * dynobj.h (class Sized_dynobj): Update declarations.
9066 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9067 make_elf_object returns NULL.
9068 (Archive::include_member): Don't check whether object target is
9069 compatible.
9070 * output.cc (Output_section::add_input_section): Get target from
9071 parameters.
9072 (Output_section::relax_input_section): Likewise.
9073 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9074 parameters.
9075 (Sized_relobj::do_scan_relocs): Likewise.
9076 (Sized_relobj::relocate_sections): Likewise.
9077 * resolve.cc (Symbol_table::resolve): Likewise.
9078 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9079 parameter. Change all callers.
9080 (Symbol_table::add_from_object): Get target from parameters.
9081 (Symbol_table::add_from_relobj): Don't check object target.
9082 (Symbol_table::add_from_dynobj): Likewise.
9083 (Symbol_table::define_special_symbol): Get target from
9084 parameters.
9085 * symtab.h (class Symbol_table): Update declaration.
9086 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9087 parameter. Change all callers. Clear parameter target.
9088 (Binary_test): Test target here.
9089 * testsuite/object_unittest.cc (gold_testsuite): Remove
9090 target_test_pointer parameter. Change all callers.
9091 (Object_test): Test target here.
9092
9093 2009-09-26 Ian Lance Taylor <iant@google.com>
9094
9095 * testsuite/initpri1.c: Don't try to use constructor priorities if
9096 compiling with gcc before 4.3.
9097
9098 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9099
9100 * testsuite/retain_symbols_file_test.sh (check_present): Change
9101 output file name to retain_symbols_file_test.stdout.
9102 (check_absent): Likewise.
9103
9104 2009-09-18 Craig Silverstein <csilvers@google.com>
9105
9106 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9107 * options.cc: Include <cerrno> and <fstream>.
9108 (General_options::finalize): Parse -retain-symbols-file tag.
9109 * options.h: New flag.
9110 (General_options): New method should_retain_symbol, new
9111 variable symbols_to_retain.
9112 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9113 should_retain_symbol map.
9114 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9115 * testsuite/Makefile.in: Regenerate.
9116 * testsuite/retain_symbols_file_test.sh: New file.
9117
9118 2009-09-18 Nick Clifton <nickc@redhat.com>
9119
9120 * po/es.po: Updated Spanish translation.
9121
9122 2009-09-17 Doug Kwan <dougkwan@google.com>
9123
9124 * debug.h (DEBUG_RELAXATION): New constant.
9125 (DEBUG_ALL): Add DEBUG_RELAXATION.
9126 (debug_string_to_enum): Add relaxation debug option.
9127 * layout.cc
9128 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9129 Layout::Relaxation_debug_check::read_sections,
9130 Layout::Relaxation_debug_check::read_sections): New method definitions.
9131 (Layout::Layout): Initialize data members
9132 record_output_section_data_from_scrips_,
9133 script_output_section_data_list_ and relaxation_debug_check_.
9134 (Layout::save_segments, Layout::restore_segments,
9135 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9136 Layout::relaxation_loop_body): New method definitions.
9137 (Layout::finalize): Support relaxation. Move section layout code to
9138 Layout::relaxation_loop_body.
9139 (Layout::set_asection_address_from_script): Move code for orphan
9140 section placement out.
9141 (Layout::place_orphan_sections_in_script): New method definition.
9142 * layout.h (Output_segment_headers, Output_file_header):
9143 New forward class declarations.
9144 (Layout::~Layout): Define.
9145 (Layout::new_output_section_data_from_script): New method definition.
9146 (Layout::place_orphan_sections_in_script): New method declaration.
9147 (Layout::Segment_states): New type declaration.
9148 (Layout::save_segments, Layout::restore_segments,
9149 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9150 Layout::relaxation_loop_body): New method declarations.
9151 (Layout::Output_section_data_list): New type declaration.
9152 (Layout::Relaxation_debug_check): New class definition.
9153 (Layout::record_output_section_data_from_script_,
9154 Layout::script_output_section_data_list_, Layout::segment_states_,
9155 Layout::relaxation_debug_check_): New data members.
9156 * output.cc: (Output_section_headers::do_size): New method definition.
9157 (Output_section_headers::Output_section_headers): Move size
9158 computation to Output_section_headers::do_size.
9159 (Output_segment_headers::do_size): New method definition.
9160 (Output_file_header::Output_file_header): Move size computation to
9161 Output_file_header::do_size and call it.
9162 (Output_file_header::do_size): New method definition.
9163 (Output_data_group::Output_data_group): Adjust call to
9164 Output_section_data.
9165 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9166 (Output_symtab_xindex::do_write): Add array bound check.
9167 (Output_section::Input_section::print_to_mapfile): Handle
9168 RELAXED_INPUT_SECTION_CODE.
9169 (Output_section::Output_section): Initialize data member checkpoint_.
9170 (Output_section::~Output_section): Delete checkpoint object pointed
9171 by checkpoint_.
9172 (Output_section::add_input_section): Always add an Input_section if
9173 relaxing.
9174 (Output_section::add_merge_input_section): Add assert.
9175 (Output_section::relax_input_section): New method definition.
9176 (Output_section::set_final_data_size): Set load address to zero for
9177 an unallocated section.
9178 (Output_section::do_address_and_file_offset_have_reset_values):
9179 New method definition.
9180 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9181 Handle relaxed input section.
9182 (Output_section::sort_attached_input_sections): Checkpoint input
9183 section list lazily.
9184 (Output_section::get_input_sections): Change type of input_sections to
9185 list of Simple_input_section pointers. Checkpoint input section list
9186 lazily. Also handle relaxed input sections.
9187 (Output_section::add_input_section_for_script): Take a reference to
9188 a Simple_input_section object instead of Relobj pointer and section
9189 index as parameter. Handle relaxed input sections.
9190 (Output_section::save_states, Output_section::restore_states): New
9191 method definitions.
9192 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9193 (Output_data::is_data_size_fixed): New method definition.
9194 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9195 if it is fixed.
9196 (Output_data::address_and_file_offset_have_reset_values): New method
9197 definition.
9198 (Output_data::do_address_and_file_offset_have_reset_values): New method
9199 definition.
9200 (Output_data::set_data_size): Check that data size is not fixed.
9201 (Output_data::fix_data_size): New method definition.
9202 (Output_data::is_data_size_fixed_): New data member.
9203 (Output_section_headers::set_final_data_size): New method definition.
9204 (Output_section_headers::do_size): New method declaration.
9205 (Output_segment_headers::set_final_data_size): New method definition.
9206 (Output_segment_headers::do_size): New method declaration.
9207 (Output_file_header::set_final_data_size)::New method definition.
9208 (Output_file_header::do_size)::New method declaration.
9209 (Output_section_data::Output_section_data): Add new parameter
9210 is_data_size_fixed and use it to fix data size.
9211 (Output_data_const::Output_data_const): Adjust call to base class
9212 constructor and fix data size.
9213 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9214 base class constructor and fix data size.
9215 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9216 base class constructor and fix data size.
9217 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9218 class constructor and fix data size.
9219 (Output_data_group::set_final_data_size): New method definition.
9220 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9221 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9222 class constructor and fix data size.
9223 (Output_relaxed_input_section): New class definition.
9224 (Output_section::Simple_input_section): New class definition.
9225 (Output_section::get_input_sections): Adjust parameter list.
9226 (Output_section::add_input_section_for_script): Same.
9227 (Output_section::save_states, Output_section::restore_states,
9228 Output_section::do_address_and_file_offset_have_reset_values,
9229 (Output_section::Input_section::Input_section): Handle
9230 RELAXED_INPUT_SECTION_CODE. Add new overload for
9231 Output_relaxed_input_section.
9232 (Output_section::Input_section::is_input_section,
9233 Output_section::Input_section::set_output_section): Handle relaxed
9234 input section.
9235 (Output_section::Input_section::is_relaxed_input_section,
9236 Output_section::Input_section::output_section_data,
9237 Output_section::Input_section::relaxed_input_section): New method
9238 definitions.
9239 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9240 value.
9241 (Output_section::Input_section::u1_): Update comments.
9242 (Output_section::Input_section::u2_): Add new union member poris.
9243 (Output_section::Checkpoint_output_section): New classs definition.
9244 (Output_section::relax_input_section): New method declaration.
9245 (Output_section::checkpoint_): New data member.
9246 (Output_segment): Update comments.
9247 (Output_segment::Output_segment): Un-privatize copy constructor.
9248 (Output_segment::operator=): Un-privatize.
9249 * script-sections.cc (Output_section_element::Input_section_list):
9250 Change element type to Output_section::Simple_input_section.
9251 (Output_section_element_dot_assignment::set_section_addresses):
9252 Register output section data for relaxation clean up.
9253 (Output_data_exression::Output_data_expression): Adjust call to base
9254 constructor to fix data size.
9255 (Output_section_element_data::set_section_addresses): Register
9256 Output_data_expression object for relaxation clean up.
9257 (struct Input_section_info): Replace Relobj pointer and section index
9258 pair with Output_section::Simple_input_section and Convert struct to a
9259 class.
9260 (Input_section_sorter::operator()): Adjust access to
9261 Input_section_info data member to use accessors.
9262 (Output_section_element_input::set_section_addresses): Use layout
9263 parameter. Adjust code to use Output_section::Simple_input_section
9264 and Input_secction_info classes. Register filler for relaxation
9265 clean up.
9266 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9267 and section index pair with Output_section::Simple_input_section
9268 class. Adjust code accordingly.
9269 (Phdrs_element::release_segment): New method definition.
9270 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9271 segment list.
9272 (Script_sections::release_segments): New method definition.
9273 * gold/script-sections.h (Script_sections::release_segments): New
9274 method declaration.
9275 * gold/target.h (Target::may_relax, Target::relax,
9276 Target::do_may_relax, Target::do_relax): New method definitions.
9277
9278 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9279
9280 * arm.cc (has_signed_unsigned_overflow): New function.
9281 (Arm_relocate_functions::abs8): New function.
9282 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9283 (Target_arm::Scan::global): Likewise.
9284 (Target_arm::relocate::relocate): Likewise.
9285 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9286 Likewise.
9287
9288 2009-09-16 Cary Coutant <ccoutant@google.com>
9289
9290 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9291 * testsuite/Makefile.in: Regenerate.
9292
9293 2009-09-11 Nick Clifton <nickc@redhat.com>
9294
9295 * po/gold.pot: Updated by the Translation project.
9296
9297 2009-09-08 Cary Coutant <ccoutant@google.com>
9298
9299 * output.cc (Output_file::open): Add execute permission to empty file.
9300 * testsuite/Makefile.am (permission_test): New test.
9301 * testsuite/Makefile.in: Regenerate.
9302
9303 2009-09-02 Ian Lance Taylor <iant@google.com>
9304
9305 * output.cc (Output_file::resize): Call map_no_anonymous rather
9306 than map.
9307
9308 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9309
9310 * gold.cc: Include "incremental.h".
9311 (queue_initial_tasks): Call Incremental_checker methods.
9312 * incremental.cc: Include "output.h".
9313 (Incremental_checker::can_incrementally_link_output_file): New
9314 method.
9315 * incremental.h (Incremental_checker): New class.
9316
9317 * output.cc (Output_file::open_for_modification): New method.
9318 (Output_file::map_anonymous): Changed return type to bool. Record
9319 map in base_ field.
9320 (Output_file::map_no_anonymous): New method, broken out of map.
9321 (Output_file::map): Use map_no_anonymous and map_anonymous.
9322 * output.h (class Output_file): Update declarations.
9323
9324 2009-08-24 Cary Coutant <ccoutant@google.com>
9325
9326 * options.h (Command_line::Pre_options): New class.
9327 (Command_line::pre_options): New member.
9328 * options.cc (gold::options::ready_to_register): New variable.
9329 (One_option::register_option): Do nothing if not registering options.
9330 Assert if same short option registered twice.
9331 (General_options::General_options): Turn off option registration when
9332 done constructing.
9333 (Command_line::Pre_options::Pre_options): New constructor.
9334
9335 2009-08-24 Cary Coutant <ccoutant@google.com>
9336
9337 * options.h (General_options::no_keep_memory): Remove incorrect
9338 short option.
9339
9340 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9341
9342 * Makefile.am (am__skiplex, am__skipyacc): New.
9343 * Makefile.in: Regenerate.
9344
9345 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9346
9347 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9348 (INCLUDES): ... this.
9349 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9350 (AM_CPPFLAGS): Renamed from ...
9351 (INCLUDE): ... this.
9352 * Makefile.in, testsuite/Makefile.in: Regenerate.
9353
9354 * Makefile.in: Regenerate.
9355 * aclocal.m4: Likewise.
9356 * config.in: Likewise.
9357 * configure: Likewise.
9358 * testsuite/Makefile.in: Likewise.
9359
9360 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9361 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9362 * Makefile.in: Regenerate.
9363 * testsuite/Makefile.in: Regenerate.
9364
9365 2009-08-19 Cary Coutant <ccoutant@google.com>
9366
9367 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9368 symbols in shared libraries overridden by hidden or internal symbols
9369 in the main program.
9370
9371 2009-08-19 Chris Demetriou <cgd@google.com>
9372
9373 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9374 checking source file names in error messages.
9375
9376 2009-08-18 Doug Kwan <dougkwan@google.com>
9377
9378 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9379 an elcpp::Ehdr as parameter. Adjust call to set_target.
9380 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9381 an elfcpp::Ehdr as parameter.
9382 * object.cc (Object::set_target): Remove the version that looks up
9383 a target and sets it.
9384 (Sized_relobj::setup): Take a Target object instead of
9385 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9386 (make_elf_sized_object): Find target and ask target to
9387 make an ELF object.
9388 * object.h: (Object::set_target): Remove the version that looks up
9389 a target and sets it.
9390 (Sized_relobj::setup): Take a Target object instead of
9391 an elfcpp:Ehdr as parameter.
9392 * target.cc: Include dynobj.h.
9393 (Target::do_make_elf_object_implementation): New.
9394 (Target::do_make_elf_object): New.
9395 * target.h (Target::make_elf_object): New template declaration.
9396 (Target::do_make_elf_object): New method declarations.
9397 (Target::do_make_elf_object_implementation): New template declaration.
9398
9399 2009-08-14 Ian Lance Taylor <iant@google.com>
9400
9401 * gold.h (FUNCTION_NAME): Define.
9402 (gold_unreachable): Use FUNCTION_NAME.
9403
9404 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9405
9406 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9407 symbol in the --keep-unique list is not found.
9408
9409 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9410
9411 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9412 been maked as --keep-unique.
9413 (Icf::unfold_section): New function.
9414 * icf.h (Icf::unfold_section): New function.
9415 * options.h (General_options::keep_unique): New option.
9416 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9417 * testsuite/Makefile.in: Regenerate.
9418 * testsuite/icf_keep_unique_test.sh: New file.
9419 * testsuite/icf_keep_unique_test.cc: New file.
9420
9421 2009-08-12 Cary Coutant <ccoutant@google.com>
9422
9423 PR 10471
9424 * resolve.cc (Symbol_table::resolve): Check for references from
9425 dynamic objects to hidden and internal symbols.
9426 * testsuite/Makefile.am (hidden_test.sh): New test.
9427 * testsuite/Makefile.in: Regenerate.
9428 * testsuite/hidden_test.sh: New script.
9429 * testsuite/hidden_test_1.c: New test source.
9430 * testsuite/hidden_test_main.c: New test source.
9431
9432 2009-08-11 Doug Kwan <dougkwan@google.com>
9433
9434 * arm.cc: Update comments.
9435 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9436 segment to locate the .ARM.exidx section if present.
9437
9438 2009-08-09 Doug Kwan <dougkwan@google.com>
9439
9440 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9441 patch.
9442
9443 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9444 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9445 compiler warnings.
9446
9447 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9448
9449 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9450 valid tls_segment only for non-debug-section relocations.
9451 * testsuite/Makefile.am: Add gc_tls_test.
9452 * testsuite/Makefile.in: Regenerate.
9453 * testsuite/gc_tls_test.cc: New file.
9454 * testsuite/gc_tls_test.sh: New file.
9455
9456 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9457
9458 * icf.cc: New file.
9459 * icf.h: New file.
9460 * Makefile.am (CCFILES): Add icf.cc.
9461 (HFILES): Add icf.h
9462 * Makefile.in: Regenerate.
9463 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9464 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9465 section, symbol and addend information for the relocs.
9466 * gold.cc (queue_middle_tasks): Call identical code folding.
9467 * gold.h: Add defines for multimap.
9468 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9469 to the call of finalize_local_symbols.
9470 * main.cc (main): Create object of class Icf.
9471 * object.cc (Sized_relobj::do_layout): Allow this function to be
9472 called twice during icf.
9473 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9474 to sections marked as identical by icf.
9475 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9476 when available.
9477 (Sized_relobj::do_section_entsize): New function.
9478 * object.h (Object::section_entsize): New function.
9479 (Object::do_section_entsize): New pure virtual function.
9480 (Relobj::finalize_local_symbols): Add new parameter.
9481 (Relobj::do_section_entsize): New function.
9482 * options.h (General_options::icf): New option.
9483 (General_options::icf_iterations): New option.
9484 (General_options::print_icf_sections): New option.
9485 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9486 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9487 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9488 icf.
9489 * symtab.cc (Symbol_table::is_section_folded): New function.
9490 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9491 to sections marked as identical by icf.
9492 * symtab.h (Symbol_table::set_icf): New function.
9493 (Symbol_table::icf): New function.
9494 (Symbol_table::is_section_folded): New function.
9495 (Symbol_table::icf_): New data member.
9496 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9497 * testsuite/Makefile.am: Add commands to build icf_test.
9498 * testsuite/Makefile.in: Regenerate.
9499 * testsuite/icf_test.sh: New file.
9500 * testsuite/icf_test.cc: New file.
9501
9502 2009-07-24 Chris Demetriou <cgd@google.com>
9503
9504 * layout.cc (is_compressible_debug_section): Fix incorrect
9505 comment about compressed section names.
9506
9507 2009-07-20 Ian Lance Taylor <ian@airs.com>
9508
9509 PR 10419
9510 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9511
9512 2009-07-16 Ian Lance Taylor <iant@google.com>
9513
9514 PR 10400
9515 * layout.h: #include <map>.
9516 (class Kept_section): Change from struct to class. Add accessors
9517 and setters. Add section size to Comdat_group mapping. Change
9518 Comdat_group to std::map. Add is_comdat_ field. Add
9519 linkonce_size field in union.
9520 (class Layout): Update declaration of find_or_add_kept_section.
9521 Don't declare find_kept_object.
9522 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9523 parameter. Add object, shndx, is_comdat, and is_group_name
9524 parameters. Change all callers. Adjust for new Kept_section.
9525 (Layout::find_kept_object): Remove.
9526 * object.cc (Sized_relobj::include_section_group): Update use of
9527 Kept_section. Rename secnum to shndx. Only record
9528 Kept_comdat_section if sections are the same size.
9529 (Sized_relobj::include_linkonce_section): Update use of
9530 Kept_section. Only record Kept_comdat_section if sections are the
9531 same size. Set size of linkonce section.
9532 (Sized_relobj::map_to_kept_section): Update call to
9533 get_kept_comdat_section.
9534 * object.h (class Sized_relobj): Rename fields in
9535 Kept_comdat_section to drop trailing underscores; change object
9536 field to Relobj*. Change Kept_comdat_section_table to store
9537 struct rather than pointer.
9538 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9539 Add kept_object and kept_shndx parameters. Change all callers.
9540 (Sized_relobj::get_kept_comdat_section): Change return type to
9541 bool. Add kept_object and kept_shndx parameters. Change all
9542 callers.
9543 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9544 Layout::find_or_add_kept_section.
9545
9546 2009-07-09 Ian Lance Taylor <iant@google.com>
9547
9548 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9549 Reserve space in the hash table.
9550
9551 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9552
9553 * fileread.cc (File_read::get_mtime): New method.
9554 * fileread.h (Timespec): New structure.
9555 (File_read::get_mtime): New method.
9556 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9557 Renamed from timestamp_nsec.
9558 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9559 Elf_Xword.
9560 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9561 timestamp_nsec.
9562 (Incremental_inputs::report_archive): Save mtime; style fix.
9563 (Incremental_inputs::report_obejct): Save mtime; style fix.
9564 (Incremental_inputs::report_script): Save mtime; style fix.
9565 (Incremental_inputs::finalize_inputs): Style fix.
9566 (Incremental_inputs::finalize): Style fix.
9567 (Incremental_inputs::create_input_section_data): Store inputs
9568 mtime.
9569 * incremental.h (Incremental_inputs::report_script): Add mtime
9570 argument.
9571 (Incremental_inputs::Input_info::Input_info): Intialize only one
9572 union member.
9573 (Incremental_inputs::Input_info::archive): Move to nameless
9574 union.
9575 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9576 (Incremental_inputs::Input_info::script): Move to nameless union.
9577 (Incremental_inputs::mtime): New field.
9578 * script.cc (read_input_script): Pass file mtime to
9579 Incremental_input.
9580 * script.h (Script_info::inputs): Style fix.
9581
9582 2009-07-01 Ian Lance Taylor <ian@airs.com>
9583
9584 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9585 instead of 32.
9586
9587 2009-06-24 Ian Lance Taylor <iant@google.com>
9588
9589 PR 10156
9590 * layout.cc (Layout::choose_output_section): If we find an
9591 existing section, update the flags.
9592 (Layout::create_notes): New function, broken out of
9593 Layout::finalize.
9594 (Layout::finalize): Don't create note sections.
9595 (Layout::create_note): Don't crash if linker script discards
9596 section.
9597 (Layout::create_gold_note): Likewise.
9598 (Layout::create_build_id): Likewise. Don't set
9599 after_input_sections on the section.
9600 (Layout::create_executable_stack_info): Remove target parameter.
9601 Change caller.
9602 * layout.h (class Layout): Declare create_notes. Update
9603 declaration of create_executable_stack_info.
9604 * gold.cc (queue_middle_tasks): Call create_notes.
9605 * output.cc (Output_section::update_flags_for_input_section): Move
9606 here from output.h. If SHF_ALLOC flag is newly set, mark address
9607 invalid.
9608 * output.h (Output_data::mark_address_invalid): New function.
9609 (class Output_section): Only declare, not define,
9610 update_flags_for_input_section. Remove set_flags.
9611
9612 2009-06-24 Ian Lance Taylor <iant@google.com>
9613
9614 * script-sections.cc (Output_section_definition::
9615 set_section_addresses): Rename shadowing local load_address to
9616 laddr.
9617
9618 2009-06-24 Ian Lance Taylor <iant@google.com>
9619
9620 PR 10244
9621 * reloc.cc (relocate_sections): Skip empty relocation sections.
9622
9623 2009-06-23 Ian Lance Taylor <iant@google.com>
9624
9625 PR 10156
9626 * layout.cc (Layout::create_note): Use choose_output_section
9627 rather than make_output_section.
9628
9629 2009-06-23 Ian Lance Taylor <iant@google.com>
9630
9631 PR 10237
9632 * options.cc (General_options::parse_V): Set printed_version_.
9633 (General_options::General_options): Initialize printed_version_.
9634 * options.h (class General_options): Add printed_version_ field.
9635 * gold.cc (queue_initial_tasks): If there are no input files,
9636 don't give a fatal error if we printed the version information.
9637 (queue_middle_tasks): If using -r with a shared object, give a
9638 fatal error rather than an ordinary error.
9639
9640 2009-06-23 Ian Lance Taylor <iant@google.com>
9641
9642 PR 10219
9643 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9644 (Layout::make_output_section): Set have_stabstr_section_ if we see
9645 a .stab*str section.
9646 (Layout::finalize): Call link_stabs_sections.
9647 (Layout::link_stabs_sections): New file.
9648 * layout.h (class Layout): Add have_stabstr_section_ field.
9649 Declare link_stabs_sections.
9650
9651 2009-06-23 Doug Kwan <dougkwan@google.com>
9652
9653 * Makefile.am (libgold_a_LIBADD): New.
9654 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9655 * Makefile.in: Regenerate.
9656 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9657 * configure: Regenerate.
9658 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9659 * fileread.cc: Include sys/state.h
9660 * gold.h: Declare memmem and strndup if found missing.
9661 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9662
9663 2009-06-23 Ian Lance Taylor <iant@google.com>
9664
9665 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9666 * configure: Rebuild.
9667
9668 2009-06-23 Ian Lance Taylor <iant@google.com>
9669
9670 PR 10147
9671 * object.cc (Object::section_contents): Don't try to get a view if
9672 the section has length zero.
9673 (Object::handle_gnu_warning_section): If the section is empty, use
9674 the name of the section as the warning.
9675
9676 2009-06-23 Ian Lance Taylor <iant@google.com>
9677
9678 PR 10133
9679 * stringpool.h (class Stringpool_template): Add optimize_ field.
9680 (Stringpool_template::set_optimize): New function.
9681 * stringpool.cc (Stringpool_template::Stringpool_template):
9682 Initialize optimize_ field.
9683 (Stringpool_template::set_string_offsets): Test local optimize
9684 fild rather than parameter.
9685 * layout.cc (Layout::Layout): Call set_optimize on the section
9686 name stringpool.
9687
9688 2009-06-22 Ian Lance Taylor <iant@google.com>
9689
9690 PR 10030
9691 * yyscript.y: Parse TARGET.
9692 * script.cc (script_set_target): New function.
9693 * script-c.h (script_set_target): Declare.
9694 * options.cc (General_options::string_to_object_format): Rename
9695 from string_to_object_format in anonymous namespace. Change
9696 callers.
9697 * options.h (class General_options): Declare
9698 string_to_object_format.
9699
9700 2009-06-22 Ian Lance Taylor <iant@google.com>
9701
9702 * script-sections.cc (Script_sections::create_segments): Don't put
9703 program headers in a PT_LOAD segment if -n or -N.
9704
9705 2009-06-22 Ian Lance Taylor <iant@google.com>
9706
9707 PR 10141
9708 * options.h (class General_options): Add -z lazy and -z now. Sort
9709 -z options into alphabetical order.
9710 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9711
9712 2009-06-21 Ian Lance Taylor <iant@google.com>
9713
9714 * layout.cc (Layout::make_output_section): Call
9715 Target::new_output_section.
9716 (Layout::attach_allocated_section_to_segment): Put large section
9717 sections in a separate load segment with the large segment flag
9718 set.
9719 (Layout::segment_precedes): Sort large data segments after other
9720 load segments.
9721 (align_file_offset): New static function.
9722 (Layout::set_segment_offsets): Use align_file_offset.
9723 * output.h (class Output_section): Add is_small_section_ and
9724 is_large_section_ fields.
9725 (Output_section::is_small_section): New function.
9726 (Output_section::set_is_small_section): New function.
9727 (Output_section::is_large_section): New function.
9728 (Output_section::set_is_large_section): New function.
9729 (Output_section::is_large_data_section): New function.
9730 (class Output_segment): Add is_large_data_segment_ field.
9731 (Output_segment::is_large_data_segment): New function.
9732 (Output_segment::set_is_large_data_segment): New function.
9733 * output.cc (Output_section::Output_section): Initialize new
9734 fields.
9735 (Output_segment::Output_segment): Likewise.
9736 (Output_segment::add_output_section): Add assertion that large
9737 data sections always go in large data segments. Force small data
9738 sections to the end of the list of data sections. Force small BSS
9739 sections to the start of the list of BSS sections. For large BSS
9740 sections to the end of the list of BSS sections.
9741 * symtab.h (class Symbol): Declare is_common_shndx.
9742 (Symbol::is_defined): Check Symbol::is_common_shndx.
9743 (Symbol::is_common): Likewise.
9744 (class Symbol_table): Define enum Commons_section_type. Update
9745 declarations. Add small_commons_ and large_commons_ fields.
9746 * symtab.cc (Symbol::is_common_shndx): New function.
9747 (Symbol_table::Symbol_table): Initialize new fields.
9748 (Symbol_table::add_from_object): Put small and large common
9749 symbols in the right list.
9750 (Symbol_table::sized_finalized_symbol): Check
9751 Symbol::is_common_shndx.
9752 (Symbol_table::sized_write_globals): Likewise.
9753 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9754 common symbol lists. Don't call do_allocate_commons_list if the
9755 list is empty.
9756 (Symbol_table::do_allocate_commons_list): Remove is_tls
9757 parameter. Add comons_section_type parameter. Change all
9758 callers. Handle small and large common symbols.
9759 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9760 Symbol::is_common_shndx.
9761 * resolve.cc (symbol_to_bits): Likewise.
9762 * target.h (Target::small_common_shndx): New function.
9763 (Target::small_common_section_flags): New function.
9764 (Target::large_common_shndx): New function.
9765 (Target::large_common_section_flags): New function.
9766 (Target::new_output_section): New function.
9767 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9768 small_common_section_flags, and large_common_section_flags
9769 fields.
9770 (Target::do_new_output_section): New virtual function.
9771 * arm.cc (Target_arm::arm_info): Initialize new fields.
9772 * i386.cc (Target_i386::i386_info): Likewise.
9773 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9774 Likewise.
9775 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9776 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9777 (Target_x86_64::do_new_output_section): New function.
9778 * configure.ac: Define conditional MCMODEL_MEDIUM.
9779 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9780 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9781 (large_LDFLAGS): Define.
9782 * testsuite/large.c: New file.
9783 * testsuite/testfile.cc (Target_test::test_target_info):
9784 Initialize new fields.
9785 * configure, testsuite/Makefile.in: Rebuild.
9786
9787 2009-06-05 Doug Kwan <dougkwan@google.com>
9788
9789 * Makefile.am (CCFILES): Add target.cc.
9790 * Makefile.in: Regenerate.
9791 * i386.cc (class Target_i386): Define new virtual method to
9792 override do_is_local_label_name in parent.
9793 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9794 local symbols if --discard-locals or -X is given.
9795 * options.h (class General_options): Declare new options
9796 '--discard-locals' and '-X' for discarding locals.
9797 * target.h (class Target): Define new methods is_local_label_name.
9798 Declare new virtual method do_is_local_label_name.
9799 * target.cc: New file.
9800 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9801 (check_SCRIPTS): Add discard_locals_test.sh.
9802 (check_DATA): Add discard_local_tests.syms.
9803 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9804 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9805 * testsuite/Makefile.in: Regenerate.
9806 * testsuite/discard_locals_test.c: New file.
9807 * testsuite/discard_locals_test.sh: Same.
9808
9809 2009-06-05 Doug Kwan <dougkwan@google.com>
9810
9811 * object.cc (Sized_relobj::Sized_relobj): Initialize
9812 discarded_eh_frame_shndx_ to -1U.
9813 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9814 section.
9815 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9816 a discarded .eh_frame section.
9817 (Sized_relobj::do_finalize_local_symbols): Ditto.
9818 * object.h (class Sized_relobj): Declare new member
9819 discarded_eh_frame_shndx_.
9820 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9821 (local_labels_test.o, local_labels_test): New rules.
9822 * testsuite/Makefile.in: Regenerate.
9823
9824 2009-06-04 Doug Kwan <dougkwan@google.com>
9825
9826 * layout.cc (Layout::section_name_mapping): Add mapping for
9827 special ARM sections.
9828
9829 2009-06-03 Doug Kwan <dougkwan@google.com>
9830
9831 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9832 (utils::has_overflow): Same.
9833
9834 2009-06-03 Ian Lance Taylor <iant@google.com>
9835
9836 * layout.cc (Layout::section_name_mapping): New array, replacing
9837 Layout::linkonce_mapping.
9838 (Layout::section_name_mapping_count): New variable, replacing
9839 Layout::linkonce_mapping_count.
9840 (Layout::linkonce_output_name): Remove.
9841 (Layout::output_section_name): Rewrite.
9842 * layout.h (class Layout): Rename Linkonce_mapping to
9843 Section_name_mapping, linkonce_mapping to section_name_mapping,
9844 linkonce_mapping_count to section_name_mapping_count. Don't
9845 declare linkonce_output_name.
9846
9847 2009-06-03 Doug Kwan <dougkwan@google.com>
9848
9849 * gold/arm.cc (namespace utils): New.
9850 (Target_arm::reloc_is_non_pic): Define new method.
9851 (class Arm_relocate_functions): New.
9852 (Target_arm::Relocate::relocate): Handle relocation types used by
9853 Android.
9854
9855 2009-06-03 Ian Lance Taylor <iant@google.com>
9856
9857 * arm.cc (Target_arm::scan::global): Use || instead of |.
9858
9859 2009-06-02 Doug Kwan <dougkwan@google.com>
9860
9861 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9862 issued_non_pic_error_.
9863 (class Target_arm::Scan): Declare new method check_non_pic.
9864 Define new method symbol_needs_plt_entry.
9865 Declare new data member issued_non_pic_error_.
9866 (class Target_arm::Relocate): Declare new method
9867 should_apply_static_reloc.
9868 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9869 (Target_arm::Scan::check_non_pic): Define new method.
9870 (Target_arm::Scan::local): Handle a small subset of reloc types used
9871 by Android.
9872 (Target_arm::Scan::local): Same.
9873 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9874
9875 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9876
9877 * incremental.cc (Incremental_inputs::report_command_line): Filter
9878 out --incremental-* options.
9879
9880 2009-05-29 Doug Kwan <dougkwan@google.com>
9881
9882 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9883 template class.
9884 (class Target_arm): Update comment.
9885 (Target_arm::Target_arm): Initialize new data members GOT_,
9886 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9887 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9888 and Target_arm::rel_dyn_section.
9889 Declare new_enum Target_arm::Got_type.
9890 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9891 and DYNBSS_.
9892 Update commments for member do_dynsym_value.
9893 (Target_arm::got_size, Target_arm::plt_section,
9894 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9895 new methods inside class defintion.
9896 (Target_arm::got_section): Define new method.
9897 (Target_arm::rel_dyn_section): Same.
9898 (Output_data_plt_arm): New template class.
9899 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9900 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9901 (Output_data_plt_arm::add_entry): Same.
9902 (Output_data_plt_arm::first_plt_entry): Define new
9903 static data member for PLT instruction template.
9904 (Output_data_plt_arm::plt_entry): Same.
9905 (Output_data_plt_arm::do_write): Define new method.
9906 (Target_arm::make_plt_entry): Same.
9907 (Target_arm::do_finalize_sections): Same.
9908 (Target_arm::do_dynsym_value): Same.
9909
9910 2009-05-28 Doug Kwan <dougkwan@google.com>
9911
9912 * Makefile.am (TARGETSOURCES): Add arm.cc.
9913 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9914 * Makefile.in: Regenerate.
9915 * arm.cc: New file.
9916 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9917
9918 2009-05-26 Doug Kwan <dougkwan@google.com>
9919
9920 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9921 (General_options::check_excluded_libs): Strip off directories in
9922 archive name before matching like GNU ld does.
9923 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9924 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9925 (exclude_libs_test_LDFLAGS): Add linker option
9926 -Wl,--exclude-libs,libexclude_libs_test_3
9927 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9928 an explicit archive without using -l.
9929 (alt/libexclude_libs_test_3.a): New make rule.
9930 * testsuite/Makefile.in: Regenerate.
9931 * testsuite/exclude_libs_test.c : Declare lib3_default().
9932 (main): Call it.
9933 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9934 * exclude_libs_test_3.c: New file.
9935
9936 2009-05-26 Nick Clifton <nickc@redhat.com>
9937
9938 * po/id.po: New Indonesian translation.
9939 * po/gold.pot: Updated template file.
9940
9941 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9942
9943 * testsuite/Makefile.am: Add -ffunction-sections to compile
9944 gc_comdat_test files. Add -Wl,--gc-sections to build
9945 gc_comdat_test.
9946 * testsuite/Makefile.in: Regenerate.
9947 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9948
9949 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9950
9951 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9952 kept comdat section was garbage collected.
9953 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9954 * testsuite/Makefile.in: Regenerate.
9955 * testsuite/gc_comdat_test.sh: New file.
9956 * testsuite/gc_comdat_test_1.cc: New file.
9957 * testsuite/gc_comdat_test_2.cc: New file.
9958
9959 2009-05-19 Doug Kwan <dougkwan@google.com>
9960
9961 * archive.cc (Archive::Archive): Move constructor from archive.h
9962 to here. Initialize no_export_.
9963 (Archive::get_elf_object_for_member): Set no_export flag of object.
9964 * archive.h (Archive::Archive): Move constructor body to
9965 archive.cc.
9966 (Archive::no_export): New method.
9967 (Archive::no_export_): New field.
9968 * object.h (Object::Object): Initialize no_export_ to false.
9969 (Object::no_export, Object::set_no_export): New methods.
9970 (Object::no_export_): New field.
9971 * options.cc (General_options::parse_exclude_libs): New method.
9972 (General_options::check_excluded_libs) Same.
9973 * options.h (exclude_libs): New option.
9974 (General_options::check_excluded_libs): New method declaration.
9975 (General_options::excluded_libs_): New field.
9976 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9977 default or protected visibility if an object has no-export flag set.
9978 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9979 (check_SCRIPTS): Add exclude_libs_test.sh.
9980 (check_DATA): Add exclude_libs_test.syms.
9981 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9982 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9983 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9984 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9985 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9986 libexclude_libs_test_2.a): New rules.
9987 * testsuite/Makefile.in: Regenerate.
9988 * testsuite/exclude_libs_test.c: New file.
9989 * testsuite/exclude_libs_test.sh: Ditto.
9990 * testsuite/exclude_libs_test_1.c: Ditto.
9991 * testsuite/exclude_libs_test_2.c: Ditto.
9992
9993 2009-05-15 Ian Lance Taylor <iant@google.com>
9994
9995 * configure.ac: Check for declarations for cases where libiberty.h
9996 checks HAVE_DECL_xxx.
9997 * configure, config.in: Rebuild.
9998
9999 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10000
10001 * gold.h (Incremental_argument_list): Remove (invalid) forward
10002 declaration.
10003 * incremental.cc (Incremental_inputs::report_achive): New method.
10004 (Incremental_inputs::report_object): New method.
10005 (Incremental_inputs::report_script): New method.
10006 (Incremental_inputs::finalize_inputs): New method.
10007 (Incremental_inputs::finalize): Call finalize_inputs().
10008 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10009 Create inputs entries.
10010 * incremental.h (Incremental_input_type): New enum.
10011 (Incremental_inputs::Incremental_input): Initialize new fields.
10012 (Incremental_inputs::report_inputs): New method.
10013 (Incremental_inputs::report_achive): New method.
10014 (Incremental_inputs::report_object): New method.
10015 (Incremental_inputs::report_script): New method.
10016 (Incremental_inputs::finalize_inputs): New method.
10017 (Incremental_inputs::Input_info): New struct.
10018 (Incremental_inputs::Input_info_map): New typedef.
10019 (Incremental_inputs::lock_): New field.
10020 (Incremental_inputs::Inputs_): New field.
10021 (Incremental_inputs::Inputs_map): New field.
10022 * main.cc (main): Call Incremental_input::report_inputs.
10023 * options.h (Input_argument_list): Typedef moved from
10024 Input_arguments.
10025 (Input_file_group::Files): Remove, use ::Input_argument_list.
10026 (Input_file_group::Input_argument_list): Remove, use
10027 ::Input_argument_list.
10028 * plugin.cc (Plugin_manager::add_input_file): Add error in
10029 incremental build.
10030 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10031 functions.
10032 * script.cc (read_input_script): Call
10033 Incremental_input::report_script.
10034 * script.h (Script_info): New class.
10035
10036 2009-04-27 Ian Lance Taylor <iant@google.com>
10037
10038 * x86_64.cc (do_adjust_output_section): Set entsize to
10039 plt_entry_size.
10040
10041 2009-04-23 Elliott Hughes <enh@google.com>
10042
10043 * output.cc (Output_file::close): After short writes, continue
10044 writing from the correct offset in the buffer being written.
10045
10046 2009-04-23 Chris Demetriou <cgd@google.com>
10047
10048 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10049 * configure: Regenerate.
10050 * config.in: Regenerate.
10051 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10052 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10053
10054 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10055
10056 * incremental.cc (Incremental_inputs_header_data): Renamed from
10057 Incremental_input_header_data.
10058 (Incremental_inputs_header_data::data_size): New field.
10059 (Incremental_inputs_header_data::put_input_file_count): Renamed
10060 from input_file_count.
10061 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10062 from command_line_offset.
10063 (Incremental_inputs_header_data::put_reserved): Renamed from
10064 put_reserved.
10065 (Incremental_inputs_entry_data): Renamed from
10066 Incremental_input_entry_data.
10067 (Incremental_inputs_entry_data::data_size): New field.
10068 (Incremental_inputs::report_command_line): New method.
10069 (Incremental_inputs::finalize): New method.
10070 (Incremental_inputs::create_incremental_inputs_data): New method.
10071 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10072 * incremental.h: New file.
10073 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10074 (Layout::finalize): Create incremental inputs section in
10075 incremental builds.
10076 (Layout::create_incremental_info_sections): New method.
10077 * layout.h (Layout::incremental_inputs): New method.
10078 (Layout::create_incremental_info_sections): New method.
10079 (Layout::incremental_inputs_): New field.
10080 * main.cc (main): Notify Incremental_input of the command line.
10081
10082 2009-04-01 Ian Lance Taylor <iant@google.com>
10083 Mikolaj Zalewski <mikolajz@google.com>
10084
10085 * gold.h (reserve_unordered_map): Define, three versions, one for
10086 each version of Unordered_map.
10087 * layout.cc (Layout::Layout): Remove options parameter. Add
10088 number_of_input_files parameter. Don't initialize options_.
10089 Initialize number_of_input_files_ and resized_signatures_. Move
10090 sections_are_attached_.
10091 (Layout::layout_group): Reserve space for group_signatures_.
10092 (Layout::find_or_add_kept_section): Change name parameter to be a
10093 reference. Resize signatures_ map when it gets large enough.
10094 (Layout::layout_eh_frame): Use parameters->options() instead of
10095 this->options_.
10096 (Layout::make_output_section): Likewise.
10097 (Layout::attach_allocated_section_to_segment): Likewise.
10098 (Layout::finalize, Layout::create_executable_stack): Likewise.
10099 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10100 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10101 * layout.h (class Layout): Update declarations. Remove options_
10102 field. Add number_of_input_files_ and resized_signatures_
10103 fields. Move sections_are_attached_ field.
10104 * main.cc (main): Pass number of input files to Layout
10105 constructor. Don't pass options.
10106
10107 2009-03-30 Ian Lance Taylor <iant@google.com>
10108
10109 * ffsll.c (ffsll): Correct implementation.
10110
10111 2009-03-27 Ian Lance Taylor <iant@google.com>
10112
10113 * ffsll.c: New file.
10114 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10115 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10116 * ftruncate.c (ftruncate): Declare before definition.
10117 * mremap.c (mremap): Likewise.
10118 * pread.c (pread): Likewise.
10119 * configure, Makefile.in, config.in: Rebuild.
10120
10121 * mremap.c: New file.
10122 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10123 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10124 (mremap): Declare if HAVE_MREMAP is not defined.
10125 * configure, Makefile.in, config.in: Rebuild.
10126
10127 2009-03-27 Cary Coutant <ccoutant@google.com>
10128
10129 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10130 position independent.
10131 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10132 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10133
10134 2009-03-24 Cary Coutant <ccoutant@google.com>
10135
10136 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10137 an executable.
10138 (needs_dynamic_reloc): Likewise.
10139
10140 2009-03-24 Ian Lance Taylor <iant@google.com>
10141
10142 * yyscript.y (file_cmd): Recognize EXTERN.
10143 (extern_name_list, extern_name_list_body): New nonterminals.
10144 * script.cc (script_add_extern): Define.
10145 * script-c.h (script_add_extern): Declare.
10146
10147 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10148
10149 * object.cc (is_elf_object): Define.
10150 * object.h (is_elf_object): Declare.
10151 * archive.cc (Archive::get_elf_object_for_member): Call
10152 is_elf_object.
10153 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10154
10155 2009-03-24 Elliott Hughes <enh@google.com>
10156
10157 * output.cc (Output_file::map_anonymous): Define.
10158 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10159 try an anonymous one. Report the size if the mmap fails.
10160 * output.h (class Output_file): Declare map_anonymous.
10161
10162 2009-03-24 Ian Lance Taylor <iant@google.com>
10163
10164 * target-select.cc (instantiate_target): Don't acquire the lock if
10165 the instantiated_target_ field has already been set.
10166
10167 2009-03-23 Ian Lance Taylor <iant@google.com>
10168
10169 * gold-threads.h (class Initialize_lock): Define.
10170 * gold-threads.cc (class Initialize_lock_once): Define.
10171 (initialize_lock_control): New static variable.
10172 (initialize_lock_pointer): New static variable.
10173 (initialize_lock_once): New static function.
10174 (Initialize_lock::Initialize_lock): Define.
10175 (Initialize_lock::initialize): Define.
10176 * target-select.h: Include "gold-threads.h".
10177 (class Target_selector): Add lock_ and initialize_lock_ fields.
10178 Don't define instantiate_target, just declare it.
10179 * target-select.cc (Target_selector::Target_selector): Initialize
10180 new fields.
10181 (Target_selector::instantiate_target): Define.
10182 * descriptors.h: Include "gold-threads.h".
10183 (class Descriptors): Add initialize_lock_ field.
10184 * descriptors.cc (Descriptors::Descriptors): Initialize new
10185 field.
10186 (Descriptors::open): Use initialize_lock_ field
10187 * errors.h (class Errors): Add initialize_lock_ field.
10188 * errors.cc (Errors::Errors): Initialize new field.
10189 (Errors::initialize_lock): Use initialize_lock_ field.
10190 * powerpc.cc (class Target_selector_powerpc): Remove
10191 instantiated_target_ field. In do_recognize call
10192 instantiate_target rather than do_instantiate_target. In
10193 do_instantiate_target just allocate a new target.
10194 * sparc.cc (class Target_selector_sparc): Likewise.
10195
10196 * freebsd.h: New file.
10197 * i386.cc: Include "freebsd.h".
10198 (Target_i386): Derive from Target_freebsd rather than
10199 Sized_target.
10200 (Target_selector_i386): Derive from Target_selector_freebsd rather
10201 than Target_selector.
10202 * x86_64.cc: Include "freebsd.h".
10203 (Target_x86_64): Derive from Target_freebsd rather than
10204 Sized_target.
10205 (Target_selector_x86_64): Derive from Target_selector_freebsd
10206 rather than Target_selector.
10207 * target.h (class Target): Add adjust_elf_header and
10208 do_adjust_elf_header.
10209 * output.cc (Output_file_header:: do_sized_write): Call target
10210 adjust_elf_header routine.
10211 * configure.tgt: Set targ_osabi.
10212 * configure.ac: Define GOLD_DEFAULT_OSABI.
10213 * parameters.cc (Parameters::default_target): Pass
10214 GOLD_DEFAULT_OSABI to select_target.
10215 * target-select.h (class Target_selector): Make instantiate_target
10216 protected rather than private.
10217 * Makefile.am (HFILES): Add freebsd.h.
10218 * configure, Makefile.in, config.in: Rebuild.
10219
10220 * merge.cc (do_add_input_section): Correct pend value. Change
10221 message about last entry not being null terminated from error to
10222 warning.
10223
10224 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10225
10226 * incremental.cc: New file.
10227 * Makefile.am (CCFILES): Add incremental.cc.
10228 * Makefile.in: Rebuild.
10229
10230 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10231
10232 * layout.cc (Layout::output_section_name): Preserve names
10233 of '.note.' sections.
10234
10235 2009-03-19 Ian Lance Taylor <iant@google.com>
10236
10237 * descriptors.cc (Descriptors::open): Check that the options are
10238 valid before using them.
10239
10240 2009-03-18 Ian Lance Taylor <iant@google.com>
10241
10242 * script-sections.h: Include <list>.
10243 (class Script_sections): Change Sections_elements from std::vector
10244 to std::list. Typedef public Elements_iterator. Add
10245 orphan_section_placement_, data_segment_align_start_, and
10246 saw_data_segment_align_ fields. Remove data_segment_align_index_
10247 field.
10248 * script-sections.cc (class Orphan_section_placement): New class.
10249 (class Sections_element): Add virtual functions is_relro and
10250 orphan_section_init. Remove virtual function place_orphan_here.
10251 (class Output_section_definition): Add is_relro and
10252 orphan_section_init. Remove place_orphan_here.
10253 (class Orphan_output_section): Likewise.
10254 (Script_sections::Script_sections): Update for field changes.
10255 (Script_sections::data_segment_align): Set saw_data_segment_align_
10256 and data_segment_align_start_, not data_segment_align_index.
10257 (Script_sections::data_segment_relro_end): Check
10258 saw_data_segment_align_. Use data_segment_align_start_ rather
10259 than data_segment_align_index_.
10260 (Script_sections::place_orphan): Rewrite to use
10261 Orphan_section_placement.
10262
10263 2009-03-17 Ian Lance Taylor <iant@google.com>
10264
10265 * archive.cc (Archive::add_symbols): Check for a version attached
10266 to the symbol name in the archive map.
10267 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10268 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10269 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10270 (ver_test_11.a): New target.
10271 * testsuite/Makefile.in: Rebuild.
10272
10273 * configure.ac: Check for chsize and posix_fallocate. Replace
10274 ftruncate.
10275 * ftruncate.c: New file, from gnulib.
10276 * output.cc (posix_fallocate): Define dummy version if not
10277 HAVE_POSIX_FALLOCATE.
10278 (Output_file::map): Call posix_fallocate rather than lseek and
10279 write.
10280 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10281 * configure, Makefile.in, config.in: Rebuild.
10282
10283 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10284
10285 * layout.h (Layout::create_note): Add section_name parameter.
10286 * layout.cc (Layout::create_note): Likewise.
10287 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10288
10289 2009-03-17 Ian Lance Taylor <iant@google.com>
10290
10291 * descriptors.cc: Include "options.h".
10292 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10293 (Descriptors::open): Always use O_CLOEXEC when opening a new
10294 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10295 then set FD_CLOEXEC.
10296
10297 * sparc.cc (class Target_sparc): Add has_got_section.
10298 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10299 make sure we have a GOT section.
10300
10301 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10302 (Target_sparc::Scan::local): Likewise.
10303 (Target_sparc::Scan::global): Likewise.
10304 (Target_sparc::Relocate::relocate): Likewise.
10305 (Target_sparc::Relocate::relocate_tls): Likewise.
10306
10307 * symtab.cc (Symbol_table::define_default_version): New function,
10308 broken out of add_from_object.
10309 (Symbol_table::add_from_object): Call define_default_version.
10310 (Symbol_table::define_special_symbol): Add resolve_oldsym
10311 parameter. Change all callers. If the version for a symbol comes
10312 from a version script, resolve it with the symbol with the same
10313 name with no version. Also add the symbol without a version if
10314 appropriate.
10315 (do_define_in_output_data): If resolving with oldsym, don't delete
10316 sym.
10317 (do_define_in_output_segment): Likewise.
10318 (do_define_as_constant): Likewise.
10319 * symtab.h (class Symbol_table): Update declarations.
10320
10321 2009-03-13 Ian Lance Taylor <iant@google.com>
10322
10323 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10324 (Read_symbols::requeue): New function.
10325 (Read_symbols::do_read_symbols): If make_elf_object fails because
10326 the target type is not configured, and the file was searched for,
10327 issue a warning and retry with the next directory.
10328 (Add_symbols::run): If the file has an incompatible format, and
10329 it was searched for, requeue the Read_symbols task. On error,
10330 release the object.
10331 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10332 dirindex parameter to constructor. Change all callers. Declare
10333 incompatible_warning and requeue.
10334 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10335 input_argument_ and input_group_ fields. Add them to
10336 constructor. Change all callers.
10337 (class Read_script): Add dirindex_ field. Add it to constructor.
10338 Change all callers.
10339 * archive.cc (Archive::setup): Remove input_objects parameter.
10340 Change all callers.
10341 (Archive::get_file_and_offset): Likewise.
10342 (Archive::read_all_symbols): Likewise.
10343 (Archive::read_symbols): Likewise.
10344 (Archive::get_elf_object_for_member): Remove input_objects
10345 parameter. Add punconfigured parameter. Change all callers.
10346 (Archive::add_symbols): Change return type to bool. Check return
10347 value of include_member.
10348 (Archive::include_all_members): Likewise.
10349 (Archive::include_member): Change return type to bool. Return
10350 false if first included object has incompatible target. Set
10351 included_member_ field.
10352 (Add_archive_symbols::run): If add_symbols returns false, requeue
10353 Read_symbols task.
10354 * archive.h (class Archive): Add included_member_ field.
10355 Initialize it in constructor. Add input_file and searched_for
10356 methods. Update declarations.
10357 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10358 input_argument_ fields. Add them to constructor. Change all
10359 callers.
10360 * script.cc: Include "target-select.h".
10361 (class Parser_closure): Add skip_on_incompatible_target_ and
10362 found_incompatible_target_ fields. Add
10363 skip_on_incompatible_target parameter to constructor. Change all
10364 callers. Add methods skip_on_incompatible_target,
10365 clear_skip_on_incompatible_target, found_incompatible_target, and
10366 set_found_incompatible_target.
10367 (read_input_script): Add dirindex parameter. Change all callers.
10368 If parser finds an incompatible target, requeue Read_symbols
10369 task.
10370 (script_set_symbol): Clear skip_on_incompatible_target in
10371 closure.
10372 (script_add_assertion, script_parse_option): Likewise.
10373 (script_start_sections, script_add_phdr): Likewise.
10374 (script_check_output_format): New function.
10375 * script.h (read_input_script): Update declaration.
10376 * script-c.h (script_check_output_format): Declare.
10377 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10378 (ignore_cmd): Remove OUTPUT_FORMAT.
10379 * fileread.cc (Input_file::Input_file): Add explicit this.
10380 (Input_file::will_search_for): New function.
10381 (Input_file::open): Add pindex parameter. Change all callers.
10382 * fileread.h (class Input_file): Add input_file_argument method.
10383 Declare will_search_for. Update declarations.
10384 * object.cc (make_elf_object): Add punconfigured parameter.
10385 Change all callers.
10386 * object.h (class Object): Make input_file public. Add
10387 searched_for method.
10388 (make_elf_object): Update declaration.
10389 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10390 restart search.
10391 * dirsearch.h (class Dirsearch): Update declaration.
10392 * options.h (class General_options): Add --warn-search-mismatch.
10393 * parameters.cc (Parameters::is_compatible_target): New function.
10394 * parameters.h (class Parameters): Declare is_compatible_target.
10395 * workqueue.cc (Workqueue::add_blocker): New function.
10396 * workqueue.h (class Workqueue): Declare add_blocker.
10397
10398 * fileread.cc (Input_file::open): Remove options parameter.
10399 Change all callers.
10400 (Input_file::open_binary): Likewise.
10401 * script.cc (read_input_script): Likewise.
10402 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10403 options parameter from constructor. Change all callers.
10404 (class Read_script): Likewise.
10405 * fileread.h (class Input_file): Update declarations.
10406 * script.h (read_input_script): Update declaration.
10407
10408 2009-03-10 Nick Clifton <nickc@redhat.com>
10409
10410 * po/es.po: New Spanish translation.
10411
10412 2009-03-06 Cary Coutant <ccoutant@google.com>
10413
10414 * options.cc (parse_short_option): Keep dash_z from registering itself.
10415
10416 2009-03-03 Ian Lance Taylor <iant@google.com>
10417
10418 PR 9918
10419 * target-reloc.h (relocate_section): Pass output_section to
10420 relocate.
10421 * i386.cc (Target_i386::should_apply_static_reloc): Add
10422 output_section parameter. Change all callers.
10423 (Target_i386::Relocate::relocate): Add output_section parameter.
10424 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10425 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10426 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10427 * testsuite/two_file_shared.sh: New script.
10428 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10429 (check_DATA): Add two_file_shared.dbg.
10430 (two_file_shared.dbg): New target.
10431 * testsuite/Makefile.in: Rebuild.
10432
10433 2009-03-01 Ian Lance Taylor <iant@google.com>
10434
10435 * configure.ac: Check for byteswap.h.
10436 * configure: Rebuild.
10437 * config.in: Rebuild.
10438
10439 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10440
10441 * layout.cc (Layout::find_or_add_kept_section): New function.
10442 (Layout::add_comdat): Removed.
10443 * layout.h (struct Kept_section): Move out of class Layout.
10444 Remove trailing underscores from field names. Add group_sections
10445 field. Rename group_ field to is_group. Change all uses.
10446 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10447 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10448 comdat_groups_ field.
10449 (Sized_relobj::include_section_group): Use
10450 find_or_add_kept_section and Kept_section::group_sections.
10451 (Sized_relobj::include_linkonce_section): Likewise.
10452 * object.cc (class Sized_relobj): Don't define Comdat_group or
10453 Comdat_group_table. Remove find_comdat_group and
10454 add_comdat_group. Remove comdat_groups_ field.
10455 * plugin.cc (include_comdat_group): Use
10456 Layout::find_or_add_kept_section.
10457
10458 2009-02-28 Ian Lance Taylor <iant@google.com>
10459
10460 * README: --gc-sections and map files are now supported. Document
10461 some build requirements.
10462
10463 PR 6992
10464 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10465 relocatable link set the value of the section symbol to zero.
10466 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10467 relocatable link don't include the section address in the local
10468 symbol value.
10469
10470 2009-02-27 Ian Lance Taylor <iant@google.com>
10471
10472 PR 6811
10473 * options.h (class Search_directory): Add is_system_directory.
10474 (class General_options): Declare is_in_system_directory.
10475 * options.cc (get_relative_sysroot): Make static.
10476 (get_default_sysroot): Make static.
10477 (General_optoins::is_in_system_directory): New function.
10478 * fileread.cc (Input_file::is_in_system_directory): New function.
10479 * fileread.h (class Input_file): Declare is_in_system_directory.
10480 * object.h (class Object): Add is_in_system_directory.
10481 (class Input_objects): Remove system_library_directory_ field.
10482 * object.cc (Input_objects::add_object): Don't set
10483 system_library_directory_.
10484 (input_objects::found_in_system_library_directory): Remove.
10485 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10486 parameter. Change all callers.
10487 (Symbol_table::sized_write_globals): Likewise.
10488 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10489 Call Object::is_in_system_directory.
10490 * symtab.h (class Symbol_table): Update declarations.
10491
10492 PR 5990
10493 * descriptors.h (Open_descriptor): Add is_on_stack field.
10494 * descriptors.cc (Descriptors::open): If the descriptor is on the
10495 top of the stack, remove it. Initialize is_on_stack field.
10496 (Descriptors::release): Only add pod to stack if it is not on the
10497 stack already.
10498 (Descriptors::close_some_descriptor): Clear stack_next and
10499 is_on_stack fields.
10500
10501 PR 7091
10502 * output.cc (Output_section::find_starting_output_address): Rename
10503 from starting_output_address; add PADDR parameter; change return
10504 type.
10505 * output.h (class Output_section): Declare
10506 find_starting_output_address instead of starting_output_address.
10507 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10508 section symbol for which we can't find a merge section.
10509
10510 PR 9836
10511 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10512 hidden or internal, force the symbol to be local.
10513 * resolve.cc (Symbol::override_visibility): Define.
10514 (Symbol::override_base): Use override_visibility.
10515 (Symbol_table::resolve): Likewise.
10516 (Symbol::override_base_with_special): Likewise.
10517 (Symbol_table::override_with_special): If the visibility is hidden
10518 or internal, force the symbol to be local.
10519 * symtab.h (class Symbol): Add set_visibility and
10520 override_visibility.
10521 * testsuite/ver_test_1.sh: New file.
10522 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10523 (check_DATA): Add ver_test_1.syms.
10524 (ver_test_1.syms): New target.
10525 * testsuite/Makefile.in: Rebuild.
10526
10527 2009-02-25 Cary Coutant <ccoutant@google.com>
10528
10529 * layout.cc (Layout::choose_output_section): Don't rename sections
10530 when using a linker script that has a SECTIONS clause.
10531 * Makefile.in: Regenerate.
10532
10533 * testsuite/Makefile.am (script_test_5.sh): New test case.
10534 * testsuite/Makefile.in: Regenerate.
10535 * testsuite/script_test_5.cc: New file.
10536 * testsuite/script_test_5.sh: New file.
10537 * testsuite/script_test_5.t: New file.
10538
10539 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10540
10541 * archive.cc (Archive::include_member): Update calls to add_symbols.
10542 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10543 the Layout argument.
10544 * dynobj.h (do_add_symbols): Add the Layout argument.
10545 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10546 Layout argument.
10547 * object.h (Object::add_symbols): Add the Layout argument.
10548 (Object::do_add_symbols): Add the Layout argument.
10549 (Sized_relobj::do_add_symbols): Add the Layout argument.
10550 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10551 Unify the two versions.
10552 (Add_plugin_symbols): Remove.
10553 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10554 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10555 (Add_plugin_symbols): Remove.
10556 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10557 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10558 (Add_symbols::run): Make it work with Pulginobj.
10559
10560 2009-02-06 Ian Lance Taylor <iant@google.com>
10561
10562 * object.cc (Sized_relobj::do_layout): Make info message start
10563 with lower case letter.
10564
10565 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10566
10567 * binary.cc: Fix file comment.
10568
10569 * options.h (enum Incremental_disposition): Define.
10570 (class General_options): Add new options: --incremental,
10571 --incremental_changed, --incremental_unchanged,
10572 --incremental_unknown. Add incremental_disposition_ and
10573 implicit_incremental_ fields.
10574 (General_options::incremental_disposition): New function.
10575 (class Position_dependent_options): Add incremental_disposition
10576 option.
10577 (Position_dependent_options::copy_from_options): Set incremental
10578 dispositions.
10579 * options.cc (General_options::parse_incremental_changed): New
10580 function.
10581 (General_options::parse_incremental_unchanged): New function.
10582 (General_options::parse_incremental_unknown): New function.
10583 (General_options::General_options): Initialize new fields
10584 incremental_disposition_ and implicit_incremental_.
10585 (General_options::finalize): Check for uasge of --incremental-*
10586 without --incremental.
10587
10588 2009-02-06 Chris Demetriou <cgd@google.com>
10589
10590 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10591 pointer and to report location as the file name associated with
10592 the symbol.
10593 (gold_undefined_symbol_at_location): New function to replace the
10594 old gold_undefined_symbol functionality.
10595 * target-reloc.h (relocate_section): Update to use
10596 gold_undefined_symbol_at_location.
10597 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10598 Call gold_undefined_symbol function rather than gold_error.
10599 * errors.h (Errors::undefined_symbol): Take location as a
10600 string, rather than calculating it from a relocation.
10601 * errors.cc (Errors::fatal): Print "fatal error:" before the
10602 formatted message.
10603 (Errors::error, Errors::error_at_location): Print "error: "
10604 before the formatted message.
10605 (Errors::undefined_symbol): Take location as a string, rather
10606 than calculating it from a relocation.
10607 (gold_undefined_symbol_at_location): New function akin to
10608 old gold_undefined_symbol, calculates location from relocation.
10609 (gold_undefined_symbol): Change to take only a Symbol pointer
10610 and to report location as the file name associated with the symbol.
10611 * testsuite/debug_msg.sh: Update for changed error messages.
10612 * testsuite/undef_symbol.sh: Likewise.
10613
10614 2009-02-04 Duncan Sands <baldrick@free.fr>
10615
10616 PR 9812
10617 * reduced_debug_output.h
10618 (Output_reduced_debug_abbrev_section::failed): Use format for
10619 gold_warning.
10620 (Output_reduced_debug_info_section::faild): Likewise.
10621
10622 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10623
10624 * script.cc (Lazy_demangler): New class.
10625 (Version_script_info::get_symbol_version_helper): Demangle a
10626 symbol only once.
10627
10628 2009-01-29 Cary Coutant <ccoutant@google.com>
10629
10630 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10631 to __tls_get_addr.
10632 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10633
10634 2009-01-28 Ian Lance Taylor <iant@google.com>
10635
10636 * version.cc (version_string): Bump to 1.9.
10637
10638 * gold.h: Include <cstring> and <stdint.h>.
10639 * version.cc: Include <cstdio>.
10640 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10641 warning.
10642 * reduced_debug_output.cc (insert_into_vector): Rename from
10643 Insert_into_vector; change all callers. Use Swap_unaligned to
10644 avoid aliasing issue; remove union since it is unnecessary.
10645
10646 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10647
10648 * Makefile.am (CCFILES): Add gc.cc.
10649 (HFILES): Add gc.h.
10650 * Makefile.in: Regenerate.
10651 * gold.cc (Gc_runner): New class.
10652 (queue_initial_tasks): Call garbage collection related tasks
10653 when corresponding options are invoked.
10654 (queue_middle_gc_tasks): New function.
10655 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10656 processed early before laying out sections during garbage collection.
10657 * gold.h (queue_middle_gc_tasks): New function.
10658 (is_prefix_of): Move from "layout.cc".
10659 * i386.cc (Target_i386::gc_process_relocs): New function.
10660 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10661 * main.cc (main): Create object of class "Garbage_collection".
10662 * object.cc (Relobj::copy_symbols_data): New function.
10663 (Relobj::is_section_name_included): New function.
10664 (Sized_relobj::do_layout): Allow this function to be called twice
10665 during garbage collection and defer layout of section during the
10666 first call.
10667 * object.h (Relobj::get_symbols_data): New function.
10668 (Relobj::is_section_name_included): New function.
10669 (Relobj::copy_symbols_data): New function.
10670 (Relobj::set_symbols_data): New function.
10671 (Relobj::get_relocs_data): New function.
10672 (Relobj::set_relocs_data): New function.
10673 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10674 (Relobj::gc_process_relocs): New function.
10675 (Relobj::do_gc_process_relocs): New pure virtual function.
10676 (Relobj::sd_): New data member.
10677 (Sized_relobj::is_output_section_offset_invalid): New function.
10678 (Sized_relobj::do_gc_process_relocs): New function.
10679 * options.h (General_options::gc_sections): Modify to not be a no-op.
10680 (General_options::print_gc_sections): New option.
10681 * plugin.cc (Plugin_finish::run): Remove function call to
10682 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10683 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10684 * reloc.cc (Read_relocs::run): Add task to process relocs and
10685 determine unreferenced sections when doing garbage collection.
10686 (Gc_process_relocs): New class.
10687 (Sized_relobj::do_gc_process_relocs): New function.
10688 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10689 sections that are garbage collected.
10690 * reloc.h (Gc_process_relocs): New class.
10691 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10692 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10693 symbols whose corresponding sections are garbage collected.
10694 (Symbol_table::Symbol_table): Add new parameter for the garbage
10695 collection object.
10696 (Symbol_table::gc_mark_undef_symbols): New function.
10697 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10698 (Symbol_table::gc_mark_dyn_syms): New function.
10699 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10700 as garbage.
10701 (Symbol_table::add_from_object): Likewise.
10702 (Symbol_table::add_from_relobj): When building shared objects, do not
10703 treat externally visible symbols as garbage.
10704 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10705 table information for static and relocatable links.
10706 * symtab.h (Symbol_table::set_gc): New function.
10707 (Symbol_table::gc): New function.
10708 (Symbol_table::gc_mark_undef_symbols): New function.
10709 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10710 (Symbol_table::gc_mark_dyn_syms): New function.
10711 (Symbol_table::gc_): New data member.
10712 * target.h (Sized_target::gc_process_relocs): New pure virtual
10713 function.
10714 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10715 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10716
10717 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10718
10719 * options.h (General_options::gc_sections): Define as a no-op for now.
10720 (General_options::no_keep_memory): Ditto.
10721 (General_options::Bshareable): Define.
10722 * options.cc (General_options::finalize): Honor -Bshareable.
10723
10724 2009-01-20 Andreas Schwab <schwab@suse.de>
10725
10726 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10727 read the value in the contents, since we don't use it. Use the
10728 template endianness when writing.
10729 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10730
10731 2009-01-19 Andreas Schwab <schwab@suse.de>
10732
10733 * configure.tgt (powerpc64-*): Fix targ_obj.
10734
10735 2009-01-15 Ian Lance Taylor <iant@google.com>
10736
10737 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10738 local symbols when stripping all symbols.
10739
10740 2009-01-14 Cary Coutant <ccoutant@google.com>
10741
10742 * output.cc (Output_reloc): Add explicit instantiations.
10743
10744 2009-01-14 Cary Coutant <ccoutant@google.com>
10745
10746 * archive.cc (Archive::get_elf_object_for_member): Remove call
10747 to File_read::claim_for_plugin.
10748 * descriptors.cc (Descriptors::open): Remove reference to
10749 is_claimed.
10750 (Descriptors::claim_for_plugin): Remove.
10751 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10752 (Descriptors::is_claimed): Remove.
10753 (claim_descriptor_for_plugin): Remove.
10754 * fileread.cc (File_read::claim_for_plugin): Remove.
10755 * fileread.h (File_read::claim_for_plugin): Remove.
10756 (File_read::descriptor): Reopen descriptor if necessary.
10757 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10758 (Plugin_manager::all_symbols_read): Add task parameter. Change
10759 all callers.
10760 (Plugin_manager::get_input_file): New function.
10761 (Plugin_manager::release_input_file): New function.
10762 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10763 corresponding data member.
10764 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10765 and pass to base constructor. Change all callers.
10766 (get_input_file, release_input_file): New functions.
10767 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10768 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10769 (Plugin_manager::all_symbols_read): Add task parameter.
10770 (Plugin_manager::get_input_file): New function.
10771 (Plugin_manager::release_input_file): New function.
10772 (Plugin_manager::task_): New data member.
10773 (Pluginobj::Pluginobj): Add filesize parameter.
10774 (Pluginobj::filename): New function.
10775 (Pluginobj::descriptor): New function.
10776 (Pluginobj::filesize): New function.
10777 (Pluginobj::filesize_): New data member.
10778 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10779 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10780 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10781
10782 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10783 with archive libraries.
10784 * testsuite/Makefile.in: Regenerate.
10785 * testsuite/plugin_test.c (struct sym_info): New type.
10786 (get_input_file, release_input_file): New static variables.
10787 (onload): Capture new transfer vector entries.
10788 (claim_file_hook): Stop reading at end of file according to filesize.
10789 Factor out parsing of readelf output into separate function.
10790 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10791 APIs and get the source file name from the symbol table. Convert
10792 source file name to corresponding object file name. Print info
10793 message when adding new input files.
10794 (parse_readelf_line): New function.
10795 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10796 * testsuite/plugin_test_2.sh: Likewise.
10797 * testsuite/plugin_test_3.sh: Likewise.
10798 * testsuite/plugin_test_4.sh: New test case.
10799
10800 2009-01-07 Ian Lance Taylor <iant@google.com>
10801
10802 * version.cc (version_string): Bump to 1.8.
10803
10804 2008-12-23 Cary Coutant <ccoutant@google.com>
10805
10806 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10807 * plugin.cc (Plugin_manager::finish): Rename as
10808 layout_deferred_objects. Move cleanup to separate function.
10809 (Plugin_manager::cleanup): New function.
10810 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10811 separately.
10812 * plugin.h (Plugin_manager::finish): Rename as
10813 layout_deferred_objects.
10814 (Plugin_manager::cleanup): New function.
10815 (Plugin_manager::cleanup_done): New field.
10816
10817 2008-12-23 Cary Coutant <ccoutant@google.com>
10818
10819 * plugin.cc (is_visible_from_outside): New function.
10820 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10821 so we don't return "IR only" status for exported symbols or -r links.
10822
10823 * testsuite/Makefile.am (plugin_test_3): New test case.
10824 * testsuite/Makefile.in: Regenerate.
10825 * testsuite/plugin_test_3.sh: New file.
10826
10827 2008-12-22 Cary Coutant <ccoutant@google.com>
10828
10829 * object.cc (Sized_relobj::layout_section): New function.
10830 (Sized_relobj::do_layout): Defer layout of input sections until after
10831 plugin has provided replacement files.
10832 (Sized_relobj::do_layout_deferred_sections): New function.
10833 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10834 (Relobj::layout_deferred_sections): New function.
10835 (Relobj::do_layout_deferred_sections): New function.
10836 (Sized_relobj::do_layout_deferred_sections): New function.
10837 (Sized_relobj::layout_section): New function.
10838 (Sized_relobj::Deferred_layout): New structure.
10839 (Sized_relobj::deferred_layout_): New field.
10840 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10841 Change all callers. Layout deferred sections.
10842 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10843 references.
10844 (Plugin_hook::run): Move code from do_plugin_hook inline.
10845 (Plugin_hook::do_plugin_hook): Remove.
10846 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10847 (Plugin_manager::finish): Renamed, was cleanup.
10848 (Plugin_manager::should_defer_layout): New function.
10849 (Plugin_manager::add_deferred_layout_object): New function.
10850 (Plugin_manager::Deferred_layout_list): New type.
10851 (Plugin_manager::deferred_layout_objects_): New field.
10852 (Plugin_hook::do_plugin_hook): Remove.
10853
10854 2008-12-17 Ian Lance Taylor <iant@google.com>
10855
10856 * options.h (class General_options): Add --no case for
10857 --export-dynamic.
10858
10859 2008-12-16 Cary Coutant <ccoutant@google.com>
10860
10861 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10862 vector.
10863 (Plugin_manager::claim_file): Create plugin object even if
10864 plugin did not call the add_symbols callback.
10865 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10866 asking for more symbols than were added.
10867 * testsuite/Makefile.am (plugin_test_1): Add test case with
10868 no global symbols.
10869 (empty.syms): New target.
10870 * testsuite/Makefile.in: Regenerate.
10871 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10872 message. Don't call add_symbols if no globals.
10873 (all_symbols_read_hook): Don't provide replacement for empty
10874 claimed file.
10875
10876 2008-12-12 Ian Lance Taylor <iant@google.com>
10877
10878 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10879 r_type == 0 for a local symbol with r_sym == 0.
10880 (scan_relocatable_relocs): Pass r_sym to
10881 local_non_section_strategy.
10882 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10883 r_sym parameter.
10884
10885 * configure.ac: Update test for TLS descriptors: they are
10886 supported as of glibc 2.9.
10887 * configure: Rebuild.
10888
10889 2008-12-11 Ian Lance Taylor <iant@google.com>
10890
10891 PR 7091
10892 * target-reloc.h (Default_scan_relocatable_relocs): For each
10893 function, map r_type == 0 to RELOC_DISCARD.
10894
10895 2008-12-10 Cary Coutant <ccoutant@google.com>
10896
10897 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10898 object to override a kept COMDAT group from a plugin object.
10899
10900 2008-12-09 Ian Lance Taylor <iant@google.com>
10901
10902 PR 7088
10903 * yyscript.y (file_cmd): Handle INPUT.
10904
10905 * testsuite/initpri1.c: Change all declarations to be full
10906 prototypes by adding void, to avoid compiler warnings.
10907
10908 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10909
10910 * options.cc (General_options::parse_plugin_opt): New.
10911 (General_options::add_plugin): The argument now is just the filename.
10912 (General_options::add_plugin_option): New.
10913 * options.h (plugin_opt): New.
10914 (add_plugin): Change argument name.
10915 (add_plugin_option): New.
10916 * plugin.cc (Plugin::load): Don't parse the plugin option.
10917 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10918 (Plugin::add_option): New.
10919 (Plugin::args_): Change type.
10920 (Plugin::filename_): New.
10921 (Plugin_manager::add_plugin_option): New.
10922 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10923 * testsuite/Makefile.in: Regenerate.
10924
10925 2008-12-05 Cary Coutant <ccoutant@google.com>
10926
10927 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10928 Handle --strip-lto-sections option.
10929 * options.h (strip_lto_sections): New option.
10930
10931 2008-12-01 Cary Coutant <ccoutant@google.com>
10932
10933 * plugin.cc (ld_plugin_message): Change format parameter to const.
10934 Fix mismatch between new[] and delete.
10935
10936 2008-11-14 Cary Coutant <ccoutant@google.com>
10937
10938 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10939 instead of -1U.
10940
10941 2008-11-05 Craig Silverstein <csilvers@google.com>
10942
10943 * options.cc (General_options::parse_dynamic_list): New function.
10944 * options.h (General_options): New flags dynamic_list,
10945 dynamic_list_data, dynamic_list_cpp_new, and
10946 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10947 (General_options::in_dynamic_list): New function.
10948 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10949 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10950 (Lex::can_continue_name): Likewise.
10951 (yylex): Likewise.
10952 (read_script_file): New parameter script_options.
10953 (read_dynamic_list): New function.
10954 (Script_options::define_dynamic_list): New function.
10955 (dynamic_list_keyword_parsecodes): New variable.
10956 (dynamic_list_keywords): New variable.
10957 * script.h (Script_options::define_dynamic_list): New function
10958 prototype.
10959 (read_dynamic_list): New function prototype.
10960 * symtab.cc (strprefix): New macro.
10961 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10962 dynamic_list_data, dynamic_list_cpp_new, and
10963 dynamic_list_cpp_typeinfo.
10964 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10965 (dynamic_list_expr): New rule.
10966 (dynamic_list_nodes): Likewise.
10967 (dynamic_list_node): Likewise.
10968 * testsuite/Makefile.am (dynamic_list): New test.
10969 * testsuite/Makefile.in: Regenerated.
10970 * testsuite/dynamic_list.t: New file.
10971 * testsuite/dynamic_list.sh: New file.
10972
10973 2008-11-05 Craig Silverstein <csilvers@google.com>
10974
10975 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10976 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10977 (t11_last): Likewise.
10978 * testsuite/ver_test_6.c (main): Likewise.
10979
10980 2008-10-07 Cary Coutant <ccoutant@google.com>
10981
10982 * options.c (General_options::finalize): Add check for -static and
10983 -shared.
10984 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10985 is not empty.
10986
10987 2008-10-02 Cary Coutant <ccoutant@google.com>
10988
10989 * plugin.cc (make_sized_plugin_object): Fix conditional
10990 compilation to work when not all targets are enabled.
10991
10992 2008-09-29 Cary Coutant <ccoutant@google.com>
10993
10994 * archive.cc (Archive::get_file_and_offset): Use filename instead
10995 of name to get library path.
10996 (Archive::include_member): Unlock external member of a thin archive.
10997
10998 * testsuite/Makefile.am (TEST_AR): New variable.
10999 (thin_archive_test_1): New test.
11000 (thin_archive_test_2): New test.
11001 * testsuite/Makefile.in: Regenerate.
11002 * testsuite/thin_archive_main.cc: New file.
11003 * testsuite/thin_archive_test_1.cc: New file.
11004 * testsuite/thin_archive_test_2.cc: New file.
11005 * testsuite/thin_archive_test_3.cc: New file.
11006 * testsuite/thin_archive_test_4.cc: New file.
11007
11008 2008-09-29 Cary Coutant <ccoutant@google.com>
11009
11010 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11011 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11012 instead of -1U.
11013 (Sized_relobj::do_finalize_local_symbols): Likewise.
11014 (Sized_relobj::map_to_kept_section): Likewise.
11015 * object.h (Sized_relobj::invalid_address): New constant.
11016 (Sized_relobj::do_output_section_offset): Check for invalid_address
11017 and return -1ULL.
11018 * output.cc (Output_reloc::local_section_offset): Use constant
11019 invalid_address instead of -1U.
11020 (Output_reloc::get_address): Likewise.
11021 (Output_section::output_address): Change -1U to -1ULL.
11022 * output.h (Output_reloc::invalid_address): New constant.
11023 * reloc.cc (Sized_relobj::write_sections): Use constant
11024 invalid_address instead of -1U.
11025 (Sized_relobj::relocate_sections): Likewise.
11026 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11027 values for merge sections.
11028 * target-reloc.h (relocate_for_relocatable): Use constant
11029 invalid_address instead of -1U.
11030
11031 2008-09-19 Cary Coutant <ccoutant@google.com>
11032
11033 Add plugin functionality for link-time optimization (LTO).
11034 * configure.ac (plugins): Add --enable-plugins option.
11035 * configure: Regenerate.
11036 * config.in: Regenerate.
11037 * Makefile.am (LIBDL): New variable.
11038 (CCFILES): Add plugin.cc.
11039 (HFILES): Add plugin.h.
11040 (ldadd_var): Add LIBDL.
11041 * Makefile.in: Regenerate.
11042
11043 * archive.cc: Include "plugin.h".
11044 (Archive::setup): Don't preread archive symbols when using a plugin.
11045 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11046 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11047 files.
11048 (Archive::include_member): Add symbols from plugin objects.
11049 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11050 * descriptors.cc (Descriptors::open): Check for file descriptors
11051 abandoned by plugins.
11052 (Descriptors::claim_for_plugin): New function.
11053 * descriptors.h (Descriptors::claim_for_plugin): New function.
11054 (Open_descriptor::is_claimed): New field.
11055 (claim_descriptor_for_plugin): New function.
11056 * fileread.cc (File_read::claim_for_plugin): New function.
11057 * fileread.h (File_read::claim_for_plugin): New function.
11058 (File_read::descriptor): New function.
11059 * gold.cc: Include "plugin.h".
11060 (queue_initial_tasks): Add task to call plugin hooks for generating
11061 new object files.
11062 * main.cc: Include "plugin.h".
11063 (main): Load plugin libraries.
11064 * object.h (Pluginobj): Declare.
11065 (Object::pluginobj): New function.
11066 (Object::do_pluginobj): New function.
11067 (Object::set_target): New function.
11068 * options.cc: Include "plugin.h".
11069 (General_options::parse_plugin): New function.
11070 (General_options::General_options): Initialize plugins_ field.
11071 (General_options::add_plugin): New function.
11072 * options.h (Plugin_manager): Declare.
11073 (General_options): Add --plugin option.
11074 (General_options::has_plugins): New function.
11075 (General_options::plugins): New function.
11076 (General_options::add_plugin): New function.
11077 (General_options::plugins_): New field.
11078 * plugin.cc: New file.
11079 * plugin.h: New file.
11080 * readsyms.cc: Include "plugin.h".
11081 (Read_symbols::do_read_symbols): Check for archive before checking
11082 for ELF file. Call plugin hooks to claim files.
11083 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11084 from a real object file; force override when processing replacement
11085 files.
11086 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11087 (Symbol::init_base_object): Likewise.
11088 (Symbol::init_base_output_data): Likewise.
11089 (Symbol::init_base_output_segment): Likewise.
11090 (Symbol::init_base_constant): Likewise.
11091 (Symbol::init_base_undefined): Likewise.
11092 (Symbol::output_section): Assert that object is not a plugin.
11093 (Symbol_table::add_from_pluginobj): New function.
11094 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11095 undefined.
11096 (Symbol_table::sized_write_globals): Likewise.
11097 (Symbol_table::add_from_pluginobj): Instantiate template.
11098 * symtab.h (Sized_pluginobj): Declare.
11099 (Symbol::in_real_elf): New function.
11100 (Symbol::set_in_real_elf): New function.
11101 (Symbol::in_real_elf_): New field.
11102 (Symbol_table::add_from_pluginobj): New function.
11103
11104 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11105 (LIBDL): New variable.
11106 (LDADD): Add LIBDL.
11107 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11108 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11109 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11110 (MOSTLYCLEANFILES): Likewise.
11111 * testsuite/Makefile.in: Regenerate.
11112 * testsuite/plugin_test.c: New file.
11113 * testsuite/plugin_test_1.sh: New file.
11114 * testsuite/plugin_test_2.sh: New file.
11115
11116 2008-09-16 Ian Lance Taylor <iant@google.com>
11117
11118 * target-reloc.h (relocate_section): Check whether a symbol is
11119 defined by the ABI before reporting an undefined symbol error.
11120 * target.h (Target::is_defined_by_abi): Make parameter const.
11121 (Target::do_is_defined_by_abi): Likewise.
11122 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11123 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11124 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11125 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11126 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11127 * testsuite/Makefile.in: Rebuild.
11128
11129 * fileread.cc (make_view): Add casts to avoid warning.
11130
11131 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11132
11133 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11134 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11135
11136 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11137
11138 * options.h (General_options::output_is_executable): New.
11139 (General_options::output_is_pie): New.
11140 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11141 for shared libraries.
11142 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11143
11144 2008-09-11 Chris Demetriou <cgd@google.com>
11145
11146 * options.h (origin): New -z option.
11147 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11148 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11149 in DT_FLAGS_1.
11150
11151 2008-09-05 Cary Coutant <ccoutant@google.com>
11152
11153 * fileread.cc (File_read::make_view): Add check for attempt to map
11154 beyond end of file.
11155
11156 2008-09-05 Cary Coutant <ccoutant@google.com>
11157
11158 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11159 explicit instantiations.
11160
11161 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11162
11163 PR gold/6858
11164 * options.cc (General_options::finalize): Allow undefined symbols
11165 in shlibs if linking -shared.
11166
11167 PR gold/6859
11168 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11169 symbols as not needing a dynsym entry.
11170
11171 2008-08-20 Craig Silverstein <csilvers@google.com>
11172
11173 * fileread.cc (File_read::open): Do not lock the file unless it
11174 was successfully opened.
11175
11176 2008-08-14 Cary Coutant <ccoutant@google.com>
11177
11178 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11179 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11180 * testsuite/tls_test.cc (struct int128): 128-bit struct
11181 for testing TLS relocs with non-zero addend.
11182 (v12): New TLS variable.
11183 (t12): New test.
11184 (t_last): Add check for v12.
11185 * testsuite/tls_test.h (t12): New function.
11186 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11187
11188 2008-08-13 Ian Lance Taylor <iant@google.com>
11189
11190 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11191 set tls_segment_ or relro_segment_.
11192 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11193 when appropriate.
11194 * output.h (Output_section::clear_is_relro): New function.
11195 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11196 sections specially even when output_data_ is empty.
11197 (Output_segment::maximum_alignment): When first section is relro,
11198 only force alignment for PT_LOAD segments.
11199 * script.cc (script_data_segment_align): New function.
11200 (script_data_segment_relro_end): New function.
11201 * script-c.h (script_data_segment_align): Declare.
11202 (script_data_segment_relro_end): Declare.
11203 * script-sections.h (class Script_sections): Declare
11204 data_segment_align and data_segment_relro_end. Add fields
11205 segment_align_index_ and saw_relro_end_.
11206 * script-sections.cc (class Sections_element): Add set_is_relro
11207 virtual function. Add new bool* parameter to place_orphan_here.
11208 Add get_output_section virtual function.
11209 (class Output_section_definition): Add set_is_relro. Add new
11210 bool* parameter to place_orphan_here. Add get_output_section.
11211 Add is_relro_ field.
11212 (Output_section_definition::Output_section_definition): Initialize
11213 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11214 and is_relro_ fields.
11215 (Output_section_definition::place_orphan_here): Add is_relro
11216 parameter.
11217 (Output_section_definition::set_section_addresses): Set relro for
11218 output section.
11219 (Output_section_definition::alternate_constraint): Likewise.
11220 (class Orphan_output_section): Add new bool* parameter to
11221 place_orphan_here. Add get_output_section.
11222 (Orphan_output_section::place_orphan_here): Add is_relro
11223 parameter.
11224 (Script_sections::Script_sections): Initialize
11225 data_segment_align_index_ and saw_relro_end_.
11226 (Script_sections::data_segment_align): New function.
11227 (Script_sections::data_segment_relro_end): New function.
11228 (Script_sections::place_orphan): Set or clear is_relro.
11229 (Script_sections::set_section_addresses): Force alignment of first
11230 TLS section.
11231 * yyscript.y (exp): Call script_data_segment_align and
11232 script_data_segment_relro_end.
11233 * testsuite/relro_script_test.t: New file.
11234 * testsuite/relro_test.cc (using_script): Declare.
11235 (t1, t2): Test using_script.
11236 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11237 (relro_script_test_SOURCES): Define.
11238 (relro_script_test_DEPENDENCIES): Define.
11239 (relro_script_test_LDFLAGS): Define.
11240 (relro_script_test_LDADD): Define.
11241 (relro_script_test.so): New target.
11242 * testsuite/Makefile.in: Rebuild.
11243
11244 2008-08-06 Cary Coutant <ccoutant@google.com>
11245
11246 * archive.cc (Archive::total_archives, Archive::total_members)
11247 (Archive::total_members_loaded): New variables.
11248 (Archive::setup): Add parameter. Add option to preread
11249 archive symbols.
11250 (Archive::read_armap): Add counter.
11251 (Archive::get_file_and_offset): New function.
11252 (Archive::get_elf_object_for_member): New function.
11253 (Archive::read_all_symbols): New function.
11254 (Archive::read_symbols): New function.
11255 (Archive::add_symbols): Add counters.
11256 (Archive::include_all_members): Use armap to find members if it's
11257 already built.
11258 (Archive::include_member): Skip reading symbols if already read.
11259 Factored code into Archive::get_file_and_offset and
11260 Archive::get_elf_object_for_member. Changed call to
11261 Mapfile::report_include_archive_member.
11262 (Archive::print_stats): New function.
11263 * archive.h: Declare Object and Read_symbols_data classes.
11264 (Archive::Archive): Add initializers for new members.
11265 (Archive::setup): Add parameter.
11266 (Archive::print_stats): New function.
11267 (Archive::total_archives, Archive::total_members)
11268 (Archive::total_members_loaded): New variables.
11269 (Archive::get_file_and_offset): New function.
11270 (Archive::get_elf_object_for_member): New function.
11271 (Archive::read_all_symbols): New function.
11272 (Archive::read_symbols): New function.
11273 (Archive::Archive_member): New class.
11274 (Archive::members_): New member.
11275 (Archive::num_members_): New member.
11276 * main.cc: Include archive.h.
11277 (main): Call Archive::print_stats.
11278 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11279 archive parameter; member_name is now the fully-decorated name.
11280 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11281 * options.h: (General_options): Add --preread-archive-symbols option.
11282 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11283 Archive::setup.
11284
11285 2008-08-04 Ian Lance Taylor <iant@google.com>
11286
11287 * symtab.h (Symbol::use_plt_offset): New function.
11288 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11289 * powerpc.cc (Relocate::relocate): Likewise.
11290 * sparc.cc (Relocate::relocate): Likewise.
11291 * x86_64.cc (Relocate::relocate): Likewise.
11292 * testsuite/weak_plt.sh: New test.
11293 * testsuite/weak_plt_main.cc: New test.
11294 * testsuite/weak_plt_shared.cc: New test.
11295 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11296 (check_PROGRAMS): Add weak_plt.
11297 (check_DATA): Add weak_plt_shared.so.
11298 (weak_plt_main_pic.o, weak_plt): New targets.
11299 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11300 * testsuite/Makefile.in: Rebuild.
11301
11302 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11303 gcctestdir/ld.
11304 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11305 * testsuite/Makefile.in: Rebuild.
11306
11307 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11308
11309 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11310 * Makefile.in: Regenerate.
11311 * po/POTFILES.in: Regenerate.
11312
11313 2008-07-29 Ian Lance Taylor <iant@google.com>
11314
11315 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11316 symbols before other symbols.
11317 * testsuite/script_test_2.cc (test_addr): Declare.
11318 (test_addr_alias): Declare.
11319 (main): Check that test_addr and test_addr_alias have the right
11320 values.
11321 * testsuite/script_test_2.t: Define test_addr_alias and
11322 test_addr.
11323
11324 2008-07-24 Ian Lance Taylor <iant@google.com>
11325
11326 PR 5990
11327 * descriptors.cc: New file.
11328 * descriptors.h: New file.
11329 * gold-threads.h (class Hold_optional_lock): New class.
11330 * fileread.cc: Include "descriptors.h".
11331 (File_read::~File_read): Release descriptor rather than closing
11332 it.
11333 (File_read::open) [file]: Call open_descriptor rather than open.
11334 Set is_descriptor_opened_.
11335 (File_read::open) [memory]: Assert that descriptor is not open.
11336 (File_read::reopen_descriptor): New function.
11337 (File_read::release): Release descriptor.
11338 (File_read::do_read): Make non-const. Reopen descriptor.
11339 (File_read::read): Make non-const.
11340 (File_read::make_view): Reopen descriptor.
11341 (File_read::do_readv): Likewise.
11342 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11343 Update declarations.
11344 * layout.cc: Include "descriptors.h".
11345 (Layout::create_build_id): Use open_descriptor rather than open.
11346 * output.cc: Include "descriptors.h".
11347 (Output_file::open): Use open_descriptor rather than open.
11348 * archive.cc (Archive::const_iterator): Change Archive to be
11349 non-const.
11350 (Archive::begin, Archive::end): Make non-const.
11351 (Archive::count_members): Likewise.
11352 * archive.h (class Archive): Update declarations.
11353 * object.h (Object::read): Make non-const.
11354 * Makefile.am (CCFILES): Add descriptors.cc.
11355 (HFILES): Add descriptors.h.
11356 * Makefile.in: Rebuild.
11357
11358 PR 6716
11359 * gold.h: Always include <clocale>. Add Solaris workarounds
11360 following code in binutils/sysdep.h.
11361
11362 PR 6048
11363 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11364 this->eh_frame_hdr_ is NULL before using it.
11365
11366 * dynobj.cc (Versions::Versions): Update comment.
11367
11368 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11369 the base version name.
11370
11371 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11372 array size plus one.
11373 (Stringpool_template::set_string_offsets): Subtract one from key
11374 before using it as an array index.
11375 (Stringpool_template::get_offset_with_length): Likewise.
11376 (Stringpool_template::write_to_buffer): Likewise.
11377 * stringpool.h (Stringpool_template::get_offset_from_key):
11378 Likewise.
11379
11380 2008-07-23 Ian Lance Taylor <iant@google.com>
11381
11382 PR 6658
11383 * object.h (Merged_symbol_value::value): Do our best to handle a
11384 negative addend.
11385
11386 PR 6647
11387 * script.cc (Version_script_info::get_versions): Don't add empty
11388 version tag to return value.
11389 (Version_script_info::get_symbol_version_helper): Change return
11390 type to bool. Add pversion parameter. Change all callers.
11391 (script_register_vers_node): Don't require a non-NULL tag.
11392 * script.h (class Version_script_info): Update declarations.
11393 (Version_script_info::get_symbol_version): Change return type to
11394 bool. Add version parameter. Change all callers.
11395 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11396 handling. Handle an empty version from a version script.
11397 (Symbol_table::define_special_symbol): Likewise.
11398 * testsuite/ver_test_10.script: New file.
11399 * testsuite/ver_test_10.sh: New file.
11400 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11401 (check_DATA): Add ver_test_10.syms.
11402 (ver_test_10.syms, ver_test_10.so): New target.
11403 * testsuite/Makefile.in: Rebuild.
11404
11405 2008-07-23 Simon Baldwin <simonb@google.com>
11406
11407 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11408 to zero for undefined symbols from dynamic libraries.
11409
11410 2008-07-23 Ian Lance Taylor <iant@google.com>
11411
11412 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11413 Change all callers.
11414 * symtab.h (class Symbol_table): Update declaration.
11415 * testsuite/ver_test_9.cc: New file.
11416 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11417 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11418 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11419 (ver_test_9.so, ver_test_9.o): New targets.
11420 * testsuite/Makefile.in: Rebuild.
11421
11422 2008-07-22 Ian Lance Taylor <iant@google.com>
11423
11424 * options.h (class General_options): Define --check-sections.
11425 * layout.cc (Layout::set_segment_offsets): Handle
11426 --check-sections.
11427
11428 * options.h (class General_options): Define -n/--nmagic and
11429 -N/--omagic.
11430 * options.cc (General_options::finalize): For -n/--nmagic or
11431 -N/--omagic, set -static.
11432 * layout.cc (Layout::attach_allocated_section_to_segment): If
11433 -N/--omagic, don't put read-only and read-write sections in
11434 different segments.
11435 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11436 finding a read-only segment.
11437 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11438 don't set the minimum segment alignment to the common page size,
11439 and don't set the file offset to the address modulo the page size.
11440 * script-sections.cc (Script_sections::create_segments): If
11441 -n/--omagic, don't put read-only and read-write sections in
11442 different segments.
11443
11444 * cref.cc: New file.
11445 * cref.h: New file.
11446 * options.h (class General_options): Add --print-symbol-counts.
11447 * main.cc (main): Issue defined symbol report if requested.
11448 * archive.cc (Archive::interpret_header): Make into a const member
11449 function.
11450 (Archive::add_symbols): Call Input_objects::archive_start and
11451 archive_stop.
11452 (Archive::const_iterator): Define new class.
11453 (Archive::begin, Archive::end): New functions.
11454 (Archive::include_all_members): Rewrite to use iterator.
11455 (Archive::count_members): New function.
11456 * archive.h (class Archive): Update declarations.
11457 (Archive::filename): New function.
11458 * object.cc: Include "cref.h".
11459 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11460 (Sized_relobj::do_get_global_symbol_counts): New function.
11461 (Input_objects::add_object): Add object to cross-referencer.
11462 (Input_objects::archive_start): New function.
11463 (Input_objects::archive_stop): New function.
11464 (Input_objects::print_symbol_counts): New function.
11465 * object.h: Declare Cref and Archive.
11466 (Object::get_global_symbol_counts): New function.
11467 (Object::do_get_global_symbol_counts): New pure virtual function.
11468 (class Sized_relobj): Add defined_count_ field. Update
11469 declarations.
11470 (class Input_objects): Add cref_ field. Update constructor.
11471 Update declarations.
11472 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11473 defined_count_.
11474 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11475 symbol counts.
11476 (Sized_dynobj::do_get_global_symbol_counts): New function.
11477 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11478 defined_count_. Update declarations. Define Symbols typedef.
11479 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11480 parameter. Change all callers.
11481 (Symbol_table::add_from_dynobj): Add sympointers and defined
11482 parameters. Change all callers.
11483 * symtab.h (class Symbol_table): Update declarations.
11484 * Makefile.am (CCFILES): Add cref.cc.
11485 (HFILES): Add cref.h.
11486 * Makefile.in: Rebuild.
11487
11488 2008-07-22 Simon Baldwin <simonb@google.com>
11489
11490 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11491 to zero when writing undefined symbols.
11492
11493 2008-07-22 Ian Lance Taylor <iant@google.com>
11494
11495 * output.cc (Output_section::add_input_section): Don't try to
11496 merge empty merge sections.
11497
11498 2008-07-21 Craig Silverstein <csilvers@google.com>
11499
11500 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11501 Include symbol version in error message.
11502
11503 2008-07-20 Chris Demetriou <cgd@google.com>
11504
11505 * configure.ac (gold_cv_c_random_seed): New configured variable.
11506 (RANDOM_SEED_CFLAGS): New substituted variable.
11507 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11508 * configure: Rebuild.
11509 * Makefile.in: Likewise.
11510 * testsuite/Makefile.in: Likewise.
11511
11512 2008-07-18 Ian Lance Taylor <iant@google.com>
11513
11514 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11515 where we see NAME/NULL and NAME/VERSION as separate symbols.
11516 * testsuite/ver_test_main.cc (main): Call t4.
11517 (t4, t4_2a): Define.
11518 * testsuite/ver_test_2.cc (t4_2): Define.
11519 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11520 * testsuite/ver_test_4.cc (t4_2a): Define.
11521 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11522 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11523
11524 2008-07-17 Ian Lance Taylor <iant@google.com>
11525
11526 * dynobj.cc (Versions::add_def): If we give an error about a
11527 missing version, go ahead and create the version anyhow.
11528
11529 2008-07-10 Ian Lance Taylor <iant@google.com>
11530
11531 Handle output sections with more than 0x7fffffff bytes.
11532 * object.h (class Relobj): Change map_to_output_ to
11533 output_sections_, and just keep a section pointer. Change all
11534 uses. Move comdat group support to Sized_relobj.
11535 (Relobj::is_section_specially_mapped): Remove.
11536 (Relobj::output_section): Remove poff parameter. Change all
11537 callers.
11538 (Relobj::output_section_offset): New function.
11539 (Relobj::set_section_offset): Rewrite.
11540 (Relobj::map_to_output): Remove.
11541 (Relobj::output_sections): New function.
11542 (Relobj::do_output_section_offset): New pure virtual function.
11543 (Relobj::do_set_section_offset): Likewise.
11544 (class Sized_relobj): Add section_offsets_ field. Add comdat
11545 group support from Relobj. Update declarations.
11546 (Sized_relobj::get_output_section_offset): New function.
11547 (Sized_relobj::do_output_section_offset): New function.
11548 (Sized_relobj::do_set_section_offset): New function.
11549 * object.cc (Relobj::output_section_address): Remove.
11550 (Sized_relobj::Sized_relobj): Initialize new fields.
11551 (Sized_relobj::include_section_group): Cast find_kept_object to
11552 Sized_relobj.
11553 (Sized_relobj::include_linkonce_section): Likewise.
11554 (Sized_relobj::do_layout): Use separate arrays for output section
11555 and output offset.
11556 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11557 output_sections.
11558 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11559 output_sections and section_offsets.
11560 (Sized_relobj::write_local_symbols): Likewise.
11561 (map_to_kept_section): Compute output address directly.
11562 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11563 output_sections and section_offsets.
11564 (Sized_relobj::write_sections): Likewise.
11565 (Sized_relobj::relocate_sections): Likewise.
11566 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11567 * output.h (class Output_reloc): Update declarations. Change
11568 u2_.relobj to Sized_relobj*.
11569 (class Output_data_reloc): Change add functions to use
11570 Sized_relobj*.
11571 * output.cc (Output_reloc::Output_reloc): Change relobj to
11572 Sized_relobj*.
11573 (Output_reloc::local_section_offset): Change return type to
11574 Elf_Addr. Use get_output_section_offset.
11575 (Output_reloc::get_address): Likewise.
11576 (Output_section::is_input_address_mapped): Don't call
11577 is_section_specially_mapped.
11578 (Output_section::output_offset): Likewise.
11579 (Output_section::output_address): Likewise.
11580 (Output_section::starting_output_address): Likewise.
11581 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11582 parameter to Sized_relobj*.
11583 (Copy_relocs::need_copy_reloc): Likewise.
11584 (Copy_relocs::save): Likewise.
11585 * copy-relocs.h (class Copy_relocs): Update declarations.
11586 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11587 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11588 * target-reloc.h (relocate_for_relocatable): Change
11589 offset_in_output_section type to Elf_Addr. Change code that uses
11590 it as well.
11591 * layout.cc (Layout::layout): Always set *off.
11592 * mapfile.cc (Mapfile::print_input_section): Use
11593 output_section_offset.
11594 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11595 Sized_relobj*.
11596 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11597 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11598 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11599
11600 2008-07-03 Ian Lance Taylor <iant@google.com>
11601
11602 * layout.cc (Layout::include_section): Do not discard unrecognized
11603 SHT_STRTAB sections.
11604
11605 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11606
11607 * script.cc (Lex::can_continue_name): Make '?' allowable in
11608 version-script names.
11609 * testsuite/version_script.map: Change glob pattern to use '?'
11610
11611 2008-06-30 Manish Singh <yosh@gimp.org>
11612
11613 PR 6585
11614 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11615 Correct typo.
11616
11617 2008-06-30 Ian Lance Taylor <iant@google.com>
11618
11619 PR 6660
11620 PR 6682
11621 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11622 versions]: Don't try to read the value in the contents, since we
11623 don't use it. Use the template endianness when writing.
11624
11625 2008-06-25 Cary Coutant <ccoutant@google.com>
11626
11627 * fileread.cc (File_read::make_view): Assert on zero-length view.
11628 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11629 symbol table when there are no symbols to read.
11630
11631 2008-06-23 Craig Silverstein <csilvers@google.com>
11632
11633 * version.cc (version_string): Bump to 1.7
11634
11635 2008-06-18 Craig Silverstein <csilvers@google.com>
11636
11637 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11638 constant 0xFFFF to type Valtype.
11639 (Powerpc_relocate_functions::rel16_ha): Likewise.
11640
11641 2008-06-17 Ian Lance Taylor <iant@google.com>
11642
11643 * output.h (Output_section::Input_section): Initialize p2align_ to
11644 zero for Output_section_data constructors.
11645 (Output_section::Input_section::addralign): If not an input
11646 section, return the alignment of the Output_section_data.
11647 * testsuite/copy_test.cc: New file.
11648 * testsuite/copy_test_1.cc: New file.
11649 * testsuite/copy_test_2.cc: New file.
11650 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11651 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11652 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11653 (copy_test_1_pic.o, copy_test_1.so): New targets.
11654 (copy_test_2_pic.o, copy_test_2.so): New targets.
11655 * testsuite/Makefile.in: Rebuild.
11656
11657 * script-sections.cc (Script_sections::place_orphan): Initialize
11658 local variable exact.
11659
11660 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11661
11662 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11663
11664 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11665 David S. Miller <davem@davemloft.net>
11666
11667 * powerpc.cc: New file.
11668 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11669 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11670 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11671 * Makefile.in: Rebuild.
11672
11673 2008-06-09 Ian Lance Taylor <iant@google.com>
11674
11675 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11676 <exception>.
11677 (throwing, orig_terminate): New static variables.
11678 (terminate_handler): New static function.
11679 (t2): Set terminate handler.
11680
11681 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11682
11683 PR 6584
11684 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11685 alignment.
11686
11687 2008-05-30 Cary Coutant <ccoutant@google.com>
11688
11689 * archive.cc (Archive::include_all_members) Correct to step
11690 over symbol table and extended name table in thin archives.
11691
11692 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11693
11694 PR 6407
11695 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11696 calculation.
11697
11698 2008-05-28 Caleb Howe <cshowe@google.com>
11699
11700 * reduced_debug_output.cc: New file.
11701 * reduced_debug_output.h: New file.
11702 * options.h (class General_options): Add --strip-debug-non-line.
11703 * options.cc (General_options::finalize): Add strip_debug_non_line
11704 to the strip heirarchy.
11705 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11706 fields.
11707 * layout.cc: Include "reduced_debug_output.h".
11708 (Layout::Layout): Initialize new fields.
11709 (line_only_debug_sections): New static array.
11710 (is_lines_only_debug_sections): New static inline function.
11711 (Layout::include_section): Handle --strip-debug-non-line.
11712 (Layout::make_output_section): If --strip-debug-non-line, build
11713 new output sections for .debug_abbrev and .debug_info.
11714 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11715 gold. Warn about possible overflow.
11716 (read_signed_LEB_128): Likewise.
11717 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11718 (read_signed_LEB_128): Declare.
11719 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11720 (HFILES): Add reduced_debug_output.h.
11721 * Makefile.in: Rebuild.
11722
11723 2008-05-21 Ian Lance Taylor <iant@google.com>
11724
11725 * mapfile.cc: New file.
11726 * mapfile.h: New file.
11727 * options.h (class General_options): Add -M/--print-map and -Map.
11728 * options.cc (General_options::finalize): Make -M equivalent to
11729 -Map -.
11730 * main.cc: Include <cstdio> and "mapfile.h".
11731 (main): Open mapfile if requested.
11732 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11733 constructor. Change caller.
11734 (queue_initial_tasks): Add mapfile parameter. Change caller.
11735 (queue_middle_tasks): Likewise.
11736 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11737 declarations.
11738 * archive.cc: Include "mapfile.h".
11739 (Archive::add_symbols): Add mapfile parameter. Change all
11740 callers. Pass mapfile, symbol, and reason to include_member.
11741 (Archive::include_all_members): Add mapfile parameter. Change all
11742 callers.
11743 (Archive::include_member): Add mapfile, sym, and why parameters.
11744 Change all callers. Report inclusion to map file.
11745 * archive.h: Include "fileread.h".
11746 (class Archive): Update declarations.
11747 (Archive::file): New const method.
11748 (class Add_archive_symbols): Add mapfile_ field. Update
11749 constructor. Change all callers.
11750 * readsyms.h (class Read_symbols): Likewise.
11751 (class Finish_group): Likewise.
11752 (class Read_script): Likewise.
11753 * common.cc: Include "mapfile.h".
11754 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11755 all callers.
11756 (Symbol_table::do_allocate_commons): Likewise.
11757 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11758 symbol allocation to mapfile.
11759 * common.h (class Allocate_commons_task): Add mapfile_ field.
11760 Update constructor. Change all callers.
11761 * symtab.h (class Symbol_table): Update declarations.
11762 * layout.cc: Include "mapfile.h".
11763 (Layout_task_runner::run): Print information to mapfile.
11764 (Layout::create_gold_note): Change Output_data_fixed_space to
11765 Output_data_zero_fill.
11766 (Layout::create_build_id): Likewise.
11767 (Layout::print_to_mapfile): New function.
11768 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11769 constructor. Change caller.
11770 (class Layout): Declare print_to_mapfile.
11771 * output.cc (Output_section::Input_section::print_to_mapfile): New
11772 function.
11773 (Output_section::add_input_section): If producing a map, always
11774 add to input_sections_ list.
11775 (Output_section::do_print_to_mapfile): New function.
11776 (Output_segment::print_sections_to_mapfile): New function.
11777 (Output_segment::print_section_list_to_mapfile): New function.
11778 * output.h: Include "mapfile.h".
11779 (Output_data::print_to_mapfile): New function.
11780 (Output_data::do_print_to_mapfile): New virtual function.
11781 (Output_segment_headers::do_print_to_mapfile): New function.
11782 (Output_file_header::do_print_to_mapfile): New function.
11783 (Output_data_const::do_print_to_mapfile): New function.
11784 (class Output_data_const_buffer): Add map_name_ field. Update
11785 constructor. Change all callers. Add do_print_to_mapfile
11786 function.
11787 (class Output_data_fixed_space): Likewise.
11788 (class Output_data_space): Likewise.
11789 (class Output_data_zero_fill): New class.
11790 (Output_data_strtab::do_print_to_mapfile): New function.
11791 (Output_data_reloc_base::do_print_to_mapfile): New function.
11792 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11793 (Output_data_group::do_print_to_mapfile): New function.
11794 (Output_data_got::do_print_to_mapfile): New function.
11795 (Output_data_dynamic::do_print_to_mapfile): New function.
11796 (Output_symtab_xindex::do_print_to_mapfile): New function.
11797 (class Output_section): Declare do_print_to_mapflie. Declare
11798 print_to_mapfile in Input_section.
11799 (class Output_segment): Declare new functions.
11800 * object.h (Sized_relobj::symbol_count): New function.
11801 * script-sections.cc
11802 (Output_section_element_dot_assignment::set_section_addresses):
11803 Change Output_data_fixed_space to Output_data_zero_fill.
11804 (Output_data_expression::do_print_to_mapfile): New function.
11805 * script.cc (read_input_script): Add mapfile parameter. Change
11806 all callers.
11807 * script.h (read_input_script): Update declaration.
11808 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11809 (Eh_frame::do_print_to_mapfile): New function.
11810 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11811 (Output_merge_string::do_print_to_mapfile): New function.
11812 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11813 function.
11814 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11815 function.
11816 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11817 function.
11818 * Makefile.am (CCFILES): Add mapfile.cc.
11819 (HFILES): Add mapfile.h.
11820 * Makefile.in: Rebuild.
11821
11822 2008-05-19 Ian Lance Taylor <iant@google.com>
11823
11824 * options.h (class General_options): Add -z relro.
11825 * layout.cc (Layout::Layout): Initialize relro_segment_.
11826 (Layout::add_output_section_data): Return the output section.
11827 (Layout::make_output_section): Rcognize relro sections and mark
11828 them appropriately.
11829 (Layout::attach_allocated_section_to_segment): Put relro sections
11830 in a PT_GNU_RELRO segment.
11831 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11832 section as relro.
11833 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11834 PT_TLS segments.
11835 (Layout::linkonce_mapping): Map d.rel.ro.local to
11836 .data.rel.ro.local.
11837 (Layout::output_section_name): Us .data.rel.ro.local for any
11838 section which begins with that.
11839 * layout.h (class Layout): Update add_output_section_data
11840 declaration. Add relro_segment_ field.
11841 * output.cc (Output_section::Output_section): Initialize is_relro_
11842 and is_relro_local_ fields.
11843 (Output_segment::add_output_section): Group relro sections.
11844 (Output_segment::is_first_section_relro): New function.
11845 (Output_segment::maximum_alignment): If there is a relro section,
11846 align the segment to the common page size.
11847 (Output_segment::set_section_addresses): Track whether we are
11848 looking at relro sections. If the last section is a relro
11849 section, align to the common page size.
11850 (Output_segment::set_section_list_addresses): Add in_relro
11851 parameter. Change all callers. Align to the page size when
11852 moving from relro to non-relro section.
11853 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11854 segment.
11855 * output.h (class Output_section): Add is_relro_ and
11856 is_relro_local_ fields.
11857 (Output_section::is_relro): New function.
11858 (Output_section::set_is_relro): New function.
11859 (Output_section::is_relro_local): New function.
11860 (Output_section::set_is_relro_local): New function.
11861 (class Output_segment): Update declarations.
11862 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11863 * sparc.cc (Target_sparc::got_section): Likewise.
11864 * x86_64.cc (Target_x86_64::got_section): Likewise.
11865 * testsuite/relro_test_main.cc: New file.
11866 * testsuite/relro_test.cc: New file.
11867 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11868 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11869 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11870 (relro_test.so, relro_test_pic.o): New targets.
11871 * testsuite/Makefile.in: Rebuild.
11872
11873 2008-05-16 Ian Lance Taylor <iant@google.com>
11874
11875 * output.cc (Output_segment::add_output_section): Remove front
11876 parameter.
11877 * output.h (class Output_segment): Remove
11878 add_initial_output_section and overloaded add_output_section.
11879 Update declaration of remaining add_output_section.
11880 * layout.cc (Layout::create_interp): Call add_output_section
11881 rather than add_initial_output_section.
11882 (Layout::finish_dynamic_section): Likewise.
11883
11884 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11885 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11886 know the dynamic type.
11887 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11888 field. Initialize it in constructor.
11889 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11890 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11891 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11892 reloc.
11893
11894 * output.cc (Output_reloc::get_address): Change return type to
11895 Elf_Addr.
11896 * output.h (class Output_reloc): Update get_address declaration.
11897 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11898 for section addresses.
11899
11900 2008-05-09 Ian Lance Taylor <iant@google.com>
11901
11902 PR 6493
11903 * gold.cc (gold_nomem): Use return value of write.
11904
11905 2008-05-08 Ian Lance Taylor <iant@google.com>
11906
11907 * symtab.c (Symbol::init_base_output_data): Add version
11908 parameter. Change all callers.
11909 (Symbol::init_base_output_segment): Likewise.
11910 (Symbol::init_base_constant): Likewise.
11911 (Symbol::init_base_undefined): Likewise.
11912 (Sized_symbol::init_output_data): Likewise.
11913 (Sized_symbol::init_output_segment): Likewise.
11914 (Sized_symbol::init_constant): Likewise.
11915 (Sized_symbol::init_undefined): Likewise.
11916 (Symbol_table::do_define_in_output_data): If the new symbol has a
11917 version, mark it as the default.
11918 (Symbol_table::do_define_in_output_segment): Likewise.
11919 (Symbol_table::do_define_as_constant): Likewise.
11920 * symtab.h (class Symbol): Update declarations.
11921 (class Sized_symbol): Likewise.
11922 * resolve.cc (Symbol::override_version): New function.
11923 (Symbol::override_base): Call override_version.
11924 (Symbol::override_base_with_special): Likewise.
11925 * testsuite/ver_script_8.script: New file.
11926 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11927 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11928 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11929 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11930
11931 2008-05-06 Ian Lance Taylor <iant@google.com>
11932
11933 PR 6049
11934 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11935 functions.
11936 (class General_options): Remove existing --undefined, and add
11937 --no-undefined instead. Add new --undefined as synonym for -u.
11938 * archive.cc (Archive::add_symbols): Check whether symbol was
11939 named with -u.
11940 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11941 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11942 all uses. Add IS_UNDEFINED. Update declarations to split
11943 different versions of init_base. Declare init_base_undefined.
11944 (Symbol::is_defined): Handle IS_UNDEFINED.
11945 (Symbol::is_undefined): Likewise.
11946 (Symbol::is_weak_undefined): Call is_undefined.
11947 (Symbol::is_absolute): Handle IS_CONSTANT.
11948 (class Sized_symbol): Update declarations to split different
11949 versions of init. Declare init_undefined.
11950 (class Symbol_table): Declare new functions.
11951 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11952 Change all callers.
11953 (Symbol::init_base_output_data): Likewise.
11954 (Symbol::init_base_output_segment): Likewise.
11955 (Symbol::init_base_constant): Likewise.
11956 (Symbol::init_base_undefined): New function.
11957 (Sized_symbol::init_object): Rename from init. Change all
11958 callers.
11959 (Sized_symbol::init_output_data): Likewise.
11960 (Sized_symbol::init_output_segment): Likewise.
11961 (Sized_symbol::init_constant): Likewise.
11962 (Sized_symbol::init_undefined): New function.
11963 (Symbol_table::add_undefined_symbols_from_command_line): New
11964 function.
11965 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11966 function.
11967 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11968 (Symbol::output_section): Likewise.
11969 (Symbol::set_output_section): Likewise.
11970 (Symbol_table::sized_finalize_symbol): Likewise.
11971 (Symbol_table::sized_write_globals): Likewise.
11972 * resolve.cc (Symbol_table::should_override): Likewise.
11973 (Symbol::override_base_with_special): Likewise.
11974
11975 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11976 symbol, change it to have default visibility.
11977 * testsuite/protected_1.cc: New file.
11978 * testsuite/protected_2.cc: New file.
11979 * testsuite/protected_3.cc: New file.
11980 * testsuite/protected_main_1.cc: New file.
11981 * testsuite/protected_main_2.cc: New file.
11982 * testsuite/protected_main_3.cc: New file.
11983 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11984 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11985 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11986 (protected_1.so): New target.
11987 (protected_1_pic.o, protected_2_pic.o): New targets.
11988 (protected_3_pic.o): New target.
11989 (check_PROGRAMS): Add protected_2.
11990 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11991 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11992 * testsuite/Makefile.in: Rebuild.
11993
11994 * options.h (DEFINE_var): Add set_user_set_##varname__.
11995 (DEFINE_bool_alias): New macro.
11996 (class General_options): Define -Bstatic using DEFINE_bool_alias
11997 rather than DEFINE_special. Add --undefined as an alias for -z
11998 defs.
11999 * options.cc (General_options::parse_Bstatic): Remove.
12000
12001 * options.h (class General_options): Add --fatal-warnings.
12002 * main.cc (main): Implement --fatal-warnings.
12003 * errors.h (Errors::warning_count): New function.
12004
12005 * options.h (class General_options): Add -Bsymbolic-functions.
12006 * symtab.h (Symbol::is_preemptible): Check for
12007 -Bsymbolic-functions.
12008
12009 2008-05-05 Ian Lance Taylor <iant@google.com>
12010
12011 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12012 as noVARNAME rather than no-VARNAME.
12013 (class General_options): Add option -z combreloc.
12014 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12015 get_address.
12016 (Output_reloc::sort_before) [SHT_REL]: New function.
12017 (Output_reloc::sort_before) [SHT_RELA]: New function.
12018 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12019 Sort_relocs_comparison.
12020 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12021 parameter. Change all callers.
12022 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12023 sort_relocs parameter. Change all callers.
12024 * output.cc (Output_reloc::get_address): New function, broken out
12025 of write_rel.
12026 (Output_reloc::write_rel): Call it.
12027 (Output_reloc::compare): New function.
12028 (Output_data_reloc_base::do_write): Optionally sort relocs.
12029
12030 * configure.ac: If targ_extra_obj is set, link it in.
12031 * configure.tgt: Initialize all variables.
12032 (x86_64*): Set targ_extra_obj and targ_extra_size.
12033 * configure: Rebuild.
12034
12035 * object.cc (Sized_relobj::include_section_group): Adjust section
12036 indexes read from group data. Build vector to pass to
12037 layout_group.
12038 * layout.cc (Layout::layout_group): Add flags and shndxes
12039 parameters. Remove contents parameter. Change caller. Update
12040 explicit instantiations.
12041 * layout.h (class Layout): Update layout_group declaration.
12042 * output.cc (Output_data_group::Output_data_group): Add flags and
12043 input_shndxes parameters. Remove contents parameter. Change
12044 caller.
12045 (Output_data_group::do_write): Change input_sections_ to
12046 input_shndxes_.
12047 * output.h (class Output_data_group): Update constructor
12048 declaration. Rename input_sections_ to input_shndxes_.
12049 * testsuite/many_sections_test.cc: Add template.
12050
12051 2008-04-30 Cary Coutant <ccoutant@google.com>
12052
12053 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12054
12055 * layout.cc (Layout::include_section): Refactored check for debug
12056 info section.
12057 (Layout::add_comdat): Add new parameters. Change type
12058 of signature parameter. Add object and shndx to signatures table.
12059 (Layout::find_kept_object): New function.
12060 * layout.h: Include <cstring>.
12061 (Layout::is_debug_info_section): New function.
12062 (Layout::add_comdat): Add new parameters.
12063 (Layout::find_kept_object): New function.
12064 (Layout::Kept_section): New struct.
12065 (Layout::Signatures): Change type of map range.
12066 * object.cc (Relobj::output_section_address): New function.
12067 (Sized_relobj::include_section_group): Add new parameters. Change
12068 calls to Layout::add_comdat. Change to build table of kept comdat
12069 groups and table mapping discarded sections to kept sections.
12070 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12071 (Sized_relobj::do_layout): Change calls to include_section_group and
12072 include_linkonce_section.
12073 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12074 value to zero when section is discarded.
12075 (Sized_relobj::map_to_kept_section): New function.
12076 * object.h (Relobj::output_section_address): New function.
12077 (Relobj::Comdat_group): New type.
12078 (Relobj::find_comdat_group): New function.
12079 (Relobj::Comdat_group_table): New type.
12080 (Relobj::Kept_comdat_section): New type.
12081 (Relobj::Kept_comdat_section_table): New type.
12082 (Relobj::add_comdat_group): New function.
12083 (Relobj::set_kept_comdat_section): New function.
12084 (Relobj::get_kept_comdat_section): New function.
12085 (Relobj::comdat_groups_): New field.
12086 (Relobj::kept_comdat_sections_): New field.
12087 (Symbol_value::input_value): Update comment.
12088 (Sized_relobj::map_to_kept_section) New function.
12089 (Sized_relobj::include_linkonce_section): Add new parameter.
12090 * target-reloc.h (Comdat_behavior): New type.
12091 (get_comdat_behavior): New function.
12092 (relocate_section): Add code to map a discarded section to the
12093 corresponding kept section when applying a relocation.
12094
12095 2008-04-30 Craig Silverstein <csilvers@google.com>
12096
12097 * dwarf_reader.cc (next_generation_count): New static var.
12098 (Addr2line_cache_entry): New struct.
12099 (addr2line_cache): New static var.
12100 (Dwarf_line_info::one_addr2line): Added caching.
12101 (Dwarf_line_info::clear_addr2line_cache): New function.
12102 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12103 cache-size parameter.
12104 (Dwarf_line_info::one_addr2line_cache): New function.
12105 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12106 new cache-size argument to one_addr2line(), and clear cache.
12107
12108 2008-04-28 Cary Coutant <ccoutant@google.com>
12109
12110 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12111 R_386_PC8 relocations.
12112
12113 2008-04-23 Ian Lance Taylor <iant@google.com>
12114
12115 * object.cc (Sized_relobj::include_section_group): Check for
12116 invalid section group.
12117
12118 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12119 header size.
12120
12121 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12122 than read for file header.
12123 * archive.cc (Archive::include_member): Likewise.
12124
12125 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12126
12127 * aclocal.m4: Regenerate.
12128 * configure: Regenerate.
12129
12130 2008-04-19 Ian Lance Taylor <iant@google.com>
12131
12132 * version.cc (version_string): Bump to 1.6.
12133
12134 * testsuite/Makefile.am (many_sections_r_test): New target.
12135 (many_sections_r_test_SOURCES): Remove.
12136 (many_sections_r_test_DEPENDENCIES): Remove.
12137 (many_sections_r_test_LDFLAGS): Remove.
12138 (many_sections_r_test_LDADD): Remove.
12139
12140 * object.cc (Sized_relobj::do_add_symbols): Always pass
12141 local_symbol_count_ to add_from_relobj.
12142
12143 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12144 every thousand variables.
12145 * testsuite/Makefile.in: Rebuild.
12146
12147 * object.cc (Xindex::initialize_symtab_xindex): New function.
12148 (Xindex::read_symtab_xindex): New function.
12149 (Xindex::sym_xindex_to_shndx): New function.
12150 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12151 available.
12152 (Sized_relobj::do_initialize_xindex): New function.
12153 (Sized_relobj::do_read_symbols): Adjust section links.
12154 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12155 parameter. Change all callers.
12156 (Sized_relobj::include_section_group): Adjust section links and
12157 symbol section indexes.
12158 (Sized_relobj::do_layout): Adjust section links.
12159 (Sized_relobj::do_count_local_symbols): Adjust section links and
12160 symbol section indexes.
12161 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12162 ordinary and special symbols.
12163 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12164 dynsym_xindex parameters. Change all callers. Adjust section
12165 links. Use SHN_XINDEX when needed.
12166 (Sized_relobj::get_symbol_location_info): Adjust section links.
12167 Don't get fooled by special symbols.
12168 * object.h (class Xindex): Define.
12169 (class Object): Add xindex_ parameter. Declare virtual functoin
12170 do_initialize_xindex.
12171 (Object::adjust_sym_shndx): New function.
12172 (Object::set_xindex): New protected function.
12173 (class Symbol_value): Add is_ordinary_shndx_ field.
12174 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12175 (Symbol_value::value): Assert ordinary section.
12176 (Symbol_value::initialize_input_to_output_map): Likewise.
12177 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12178 Change all callers.
12179 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12180 all callers.
12181 (class Sized_relobj): Update declarations.
12182 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12183 parameter. Change all callers.
12184 (Sized_relobj::adjust_shndx): New function.
12185 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12186 field.
12187 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12188 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12189 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12190 (Sized_dynobj::read_dynsym_section): Adjust section links.
12191 (Sized_dynobj::read_dynamic): Likewise.
12192 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12193 section links.
12194 (Sized_dynobj::do_initialize_xindex): New function.
12195 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12196 do_initialize_xindex.
12197 (Sized_dynobj::adjust_shndx): New function.
12198 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12199 dynsym_xindex_ fields.
12200 (Layout::finalize): Add a call to set_section_indexes before
12201 creating the symtab sections.
12202 (Layout::set_section_indexes): Don't do anything if the section
12203 already has a section index.
12204 (Layout::create_symtab_sections): Add shnum parameter. Change
12205 caller. Create .symtab_shndx section if needed.
12206 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12207 caller.
12208 (Layout::allocated_output_section_count): New function.
12209 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12210 needed.
12211 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12212 fields. Update declarations.
12213 (Layout::symtab_xindex): New function.
12214 (Layout::dynsym_xindex): New function.
12215 (class Write_symbols_task): Add layout_ field.
12216 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12217 Change caller.
12218 * output.cc (Output_section_headers::Output_section_headers): Add
12219 shstrtab_section parameter. Change all callers.
12220 (Output_section_headers::do_sized_write): Store overflow values
12221 for section count and section string table section index in
12222 section header zero.
12223 (Output_file_header::do_sized_write): Check for overflow of
12224 section count and section string table section index.
12225 (Output_symtab_xindex::do_write): New function.
12226 (Output_symtab_xindex::endian_do_write): New function.
12227 * output.h (class Output_section_headers): Add shstrtab_section_.
12228 Update declarations.
12229 (class Output_symtab_xindex): Define.
12230 (Output_section::has_out_shndx): New function.
12231 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12232 field.
12233 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12234 Change all callers.
12235 (Sized_symbol::init): Likewise.
12236 (Symbol::output_section): Check for ordinary symbol.
12237 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12238 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12239 callers.
12240 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12241 Change all callers. Simplify handling of symbols from sections
12242 not included in the link.
12243 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12244 distinction.
12245 (Weak_alias_sorter::operator()): Assert that symbols are
12246 ordinary.
12247 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12248 distinction.
12249 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12250 parameters. Change all callers.
12251 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12252 symbol distinction. Use SHN_XINDEX when needed.
12253 (Symbol_table::write_section_symbol): Add symtab_xindex
12254 parameter. Change all callers.
12255 (Symbol_table::sized_write_section_symbol): Likewise. Use
12256 SHN_XINDEX when needed.
12257 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12258 declarations.
12259 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12260 (Symbol::is_defined): Check is_ordinary.
12261 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12262 (Symbol::is_absolute, Symbol::is_common): Likewise.
12263 (class Sized_symbol): Update declarations.
12264 (class Symbol_table): Update declarations.
12265 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12266 parameters. Change all callers.
12267 (Sized_symbol::override): Likewise.
12268 (Symbol_table::override): Likewise.
12269 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12270 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12271 is_ordinary, and orig_st_shndx parameters. Change all callers.
12272 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12273 to be in an ordinary section.
12274 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12275 object and is_ordinary parameters. Change all callers.
12276 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12277 Change all callers. Don't add undefined or non-ordinary symbols
12278 to reloc_map_.
12279 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12280 Change all callers.
12281 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12282 declarations.
12283 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12284 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12285 (Sized_relobj::relocate_sections): Likewise.
12286 * target-reloc.h (scan_relocs): Adjust section symbol index.
12287 (scan_relocatable_relocs): Likewise.
12288 * i386.cc (Scan::local): Check for ordinary symbols.
12289 * sparc.cc (Scan::local): Likewise.
12290 * x86_64.cc (Scan::local): Likewise.
12291 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12292 to symbol_section_and_value.
12293 * testsuite/many_sections_test.cc: New file.
12294 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12295 (check_PROGRAMS): Add many_sections_test.
12296 (many_sections_test_SOURCES): Define.
12297 (many_sections_test_DEPENDENCIES): Define.
12298 (many_sections_test_LDFLAGS): Define.
12299 (BUILT_SOURCES): Add many_sections_define.h.
12300 (many_sections_define.h): New target.
12301 (BUILT_SOURCES): Add many_sections_check.h.
12302 (many_sections_check.h): New target.
12303 (check_PROGRAMS): Add many_sections_r_test.
12304 (many_sections_r_test_SOURCES): Define.
12305 (many_sections_r_test_DEPENDENCIES): Define.
12306 (many_sections_r_test_LDFLAGS): Define.
12307 (many_sections_r_test_LDADD): Define.
12308 (many_sections_r_test.o): New target.
12309 * testsuite/Makefile.in: Rebuild.
12310
12311 2008-04-17 Cary Coutant <ccoutant@google.com>
12312
12313 * errors.cc (Errors::info): New function.
12314 (gold_info): New function.
12315 * errors.h (Errors::info): New function.
12316 * gold.h (gold_info): New function.
12317 * object.cc (Input_objects::add_object): Print trace output.
12318 * options.cc (options::parse_set): New function.
12319 (General_options::parse_wrap): Deleted.
12320 (General_options::General_options): Deleted initializer.
12321 * options.h (options::String_set): New typedef.
12322 (options::parse_set): New function.
12323 (DEFINE_set): New macro.
12324 (General_options::wrap): Changed to use DEFINE_set. Changed
12325 callers of any_wrap_symbols and is_wrap_symbol.
12326 (General_options::trace, General_options::trace_symbol):
12327 New options.
12328 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12329 (General_options::wrap_symbols_): Deleted.
12330 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12331
12332 2008-04-17 David S. Miller <davem@davemloft.net>
12333
12334 * options.cc (General_options::parse_V): New function.
12335 * options.h: Add entries for -V and -Qy.
12336
12337 2008-04-17 Ian Lance Taylor <iant@google.com>
12338
12339 * common.cc (Symbol_table::allocate_commons): Remove options
12340 parameter. Change caller.
12341 (Symbol_table::do_allocate_commons): Remove options parameter.
12342 Change caller. Just call do_allocate_commons_list twice.
12343 (Symbol_table::do_allocate_commons_list): New function, broken out
12344 of do_allocate_commons.
12345 * common.h (class Allocate_commons_task): Remove options_ field.
12346 Update constructor.
12347 * symtab.cc (Symbol_table::Symbol_table): Initialize
12348 tls_commons_.
12349 (Symbol_table::add_from_object): Put TLS common symbols on
12350 tls_commons_ list.
12351 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12352 which are IN_OUTPUT_DATA.
12353 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12354 allocate_commons and do_allocate_commons declarations. Declare
12355 do_allocate_commons_list.
12356 * gold.cc (queue_middle_tasks): Update creation of
12357 Allocate_commons_task to not pass options.
12358 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12359 (TLS_TEST_C_FLAGS): New variable.
12360 (tls_test_c_pic.o): New target.
12361 (tls_test_shared.so): Link in tls_test_c_pic.o.
12362 (tls_test_c_pic_ie.o): New target.
12363 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12364 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12365 (tls_test_c.o): New target.
12366 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12367 (tls_pic_test_LDADD): Likewise.
12368 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12369 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12370 (tls_test_c_gnu2.o): New target.
12371 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12372 tls_test_c_gnu2.o.
12373 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12374 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12375 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12376 * testsuite/tls_test.cc: Include "config.h".
12377 (t_last): Call t11_last.
12378 * testsuite/tls_test.h (t11, t11_last): Declare.
12379 * testsuite/tls_test_c.c: New file.
12380 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12381 * configure.ac: Check for OpenMP support.
12382 * configure, config.in, Makefile.in: Rebuild.
12383 * testsuite/Makefile.in: Rebuild.
12384
12385 2008-04-16 Cary Coutant <ccoutant@google.com>
12386
12387 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12388 (Target_i386::tls_base_symbol_defined_): New field.
12389 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12390 (Target_i386::Scan::global): Likewise.
12391 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12392 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12393 (Target_x86_64::tls_base_symbol_defined_): New field.
12394 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12395 (Target_x86_64::Scan::global): Likewise.
12396
12397 2008-04-16 Cary Coutant <ccoutant@google.com>
12398
12399 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12400 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12401 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12402 building shared libraries.
12403 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12404 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12405 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12406 * testsuite/Makefile.in: Rebuild.
12407 * testsuite/weak_undef.h: New file.
12408 * testsuite/weak_undef_file1.cc: Add extra test cases.
12409 * testsuite/weak_undef_file2.cc: Likewise.
12410 * testsuite/weak_undef_test.cc: Likewise.
12411
12412 2008-04-16 David S. Miller <davem@davemloft.net>
12413
12414 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12415 Add issued_non_pic_error_ field. Declare check_non_pic.
12416 (Target_sparc::Scan::check_non_pic): New function.
12417 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12418 (Target_sparc::Scan::global): Likewise.
12419
12420 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12421 * configure: Rebuild.
12422
12423 * options.h (DEFINE_enable): New macro.
12424 (new_dtags): New enable option.
12425 (initfirst, interpose, loadfltr, nodefaultlib,
12426 nodelete, nodlopen, nodump): New -z options.
12427 * layout.cc (Layout:finish_dynamic_section): If new
12428 dtags enabled, emit DT_RUNPATH. Also, emit a
12429 DT_FLAGS_1 containing any specified -z flags.
12430
12431 2008-04-16 Ian Lance Taylor <iant@google.com>
12432
12433 * copy-relocs.cc: New file.
12434 * copy-relocs.h: New file.
12435 * reloc.cc: Remove Copy_relocs code.
12436 * reloc.h: Likewise.
12437 * reloc-types.h (struct Reloc_types) [both versions]: Add
12438 get_reloc_addend_noerror.
12439 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12440 variants of add_global which take an addend which must be zero.
12441 * i386.cc: Include "copy-relocs.h".
12442 (class Target_i386): Change type of copy_relocs_ to variable,
12443 update initializer.
12444 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12445 Change all callers.
12446 (Target_i386::do_finalize_sections): Change handling of
12447 copy_relocs_.
12448 * sparc.cc: Include "copy-relocs.h".
12449 (class Target_sparc): Change type of copy_relocs_ to variable,
12450 update initializer.
12451 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12452 Change all callers.
12453 (Target_sparc::do_finalize_sections): Change handling of
12454 copy_relocs_.
12455 * x86_64.cc: Include "copy-relocs.h".
12456 (class Target_x86_64): Change type of copy_relocs_ to variable,
12457 update initializer.
12458 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12459 class. Change all callers.
12460 (Target_x86_64::do_finalize_sections): Change handling of
12461 copy_relocs_.
12462 * Makefile.am (CCFILES): Add copy-relocs.cc.
12463 (HFILES): Add copy-relocs.h.
12464
12465 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12466
12467 * testsuite/script_test_4.sh: Permit leading zeroes.
12468
12469 2008-04-15 Ian Lance Taylor <iant@google.com>
12470
12471 * script-sections.cc (Script_sections::create_segments): Use
12472 header_size_adjustment even when there is enough room for the
12473 headers.
12474 * testsuite/script_test_4.sh: New file.
12475 * testsuite/script_test_4.t: New file.
12476 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12477 (check_DATA): Add script_test_4.stdout.
12478 (MOSTLYCLEANFILES): Likewise.
12479 (script_test_4): New target.
12480 (script_test_4.stdout): New target.
12481 * testsuite/Makefile.in: Rebuild.
12482
12483 * sparc.cc: Add definitions for Output_data_plt_sparc class
12484 constants.
12485
12486 2008-04-14 David S. Miller <davem@davemloft.net>
12487
12488 * sparc.cc: New file.
12489 * Makefile.am (TARGETSOURCES): Add sparc.cc
12490 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12491 * configure.tgt: Document targ_extra_size and
12492 targ_extra_big_endian. Add entries for sparc-* and
12493 sparc64-*.
12494 * configure.ac: Handle targ_extra_size and
12495 targ_extra_big_endian.
12496 * Makefile.in: Rebuild.
12497 * configure: Likewise.
12498 * po/POTFILES.in: Likewise.
12499 * po/gold.pot: Likewise.
12500
12501 2008-04-14 Ian Lance Taylor <iant@google.com>
12502
12503 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12504 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12505 in the name/type/flags to section mapping. Don't call
12506 allocate_output_section.
12507 (Layout::choose_output_section): Change parameter from adjust_name
12508 to is_input_section. Don't permit input sections after sections
12509 are attached to segments. Don't call allocate_output_section.
12510 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12511 not write_enable_output_section.
12512 (Layout::make_output_section): Don't push to
12513 unattached_section_list_ nor call attach_to_segment. Call
12514 attach_section_to_segment if sections are attached.
12515 (Layout::attach_sections_to_segments): New function.
12516 (Layout::attach_section_to_segment): New function.
12517 (Layout::attach_allocated_section_to_segment): Rename from
12518 attach_to_segment. Remove flags parameter.
12519 (Layout::allocate_output_section): Remove function.
12520 (Layout::write_enable_output_section): Remove function.
12521 * layout.h (class Layout): Update for above changes. Add new
12522 field sections_are_attached_.
12523 * output.h (Output_section::update_flags_for_input_section): New
12524 function.
12525 * output.cc (Output_section::add_input_section): Call
12526 update_flags_for_input_section.
12527 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12528
12529 2008-04-11 Cary Coutant <ccoutant@google.com>
12530
12531 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12532 thought unnecessary.
12533 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12534
12535 2008-04-11 Ian Lance Taylor <iant@google.com>
12536
12537 * output.h (class Output_section_data): Remove inline definition
12538 of set_addralign.
12539 * output.cc (Output_section_data::set_addralign): New function.
12540
12541 2008-04-11 Cary Coutant <ccoutant@google.com>
12542
12543 Add support for TLS descriptors for i386 and x86_64.
12544 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12545 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12546 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12547 GOT_TYPE_TLS_DESC.
12548 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12549 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12550 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12551 relocations.
12552 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12553 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12554 Fix problem with initial-exec relocations.
12555 (Target_i386::Relocate::relocate_tls): Likewise.
12556 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12557 relaxation.
12558 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12559 support for section-plus-offset dynamic table entries.
12560 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12561 (Output_data_dynamic::Dynamic_entry): Add support for
12562 section-plus-offset dynamic table entries.
12563 (Output_data_dynamic::Classification): Likewise.
12564 (Output_data_dynamic::classification_): Renamed offset_.
12565 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12566 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12567 (Target_x86_64::make_plt_section): New function.
12568 (Target_x86_64::reserve_tlsdesc_entries): New function.
12569 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12570 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12571 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12572 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12573 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12574 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12575 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12576 add extra PLT entry for TLS descriptors.
12577 (Output_data_plt_x86_64::got_): New field.
12578 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12579 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12580 fields.
12581 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12582 descriptors.
12583 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12584 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12585 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12586 R_386_TLS_DESC_CALL relocations.
12587 (Target_x86_64::Scan::global): Likewise.
12588 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12589 for TLS descriptors.
12590 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12591 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12592 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12593 GD-to-IE relaxation.
12594 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12595 and TLS_DESCRIPTORS.
12596 * Makefile.in: Rebuild.
12597 * configure: Rebuild.
12598 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12599 (tls_test_shared2.so): New target.
12600 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12601 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12602 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12603 (tls_shared_gd_to_ie_test_LDADD): New variable.
12604 (tls_shared_gnu2_gd_to_ie_test): New target.
12605 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12606 New targets.
12607 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12608 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12609 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12610 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12611 (tls_shared_gnu2_test): New target.
12612 (tls_test_gnu2_shared.so): New target.
12613 (tls_shared_gnu2_test_SOURCES): New variable.
12614 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12615 (tls_shared_gnu2_test_LDFLAGS): New variable.
12616 (tls_shared_gnu2_test_LDADD): New variable.
12617 * testsuite/Makefile.in: Rebuild.
12618 * testsuite/Makefile.
12619
12620 2008-04-11 Ian Lance Taylor <iant@google.com>
12621
12622 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12623 justsyms.t.
12624 * testsuite/Makefile.in: Rebuild.
12625
12626 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12627 long.
12628 * testsuite/script_test_2.cc (main): Adjust test.
12629
12630 2008-04-11 David S. Miller <davem@davemloft.net>
12631 Ian Lance Taylor <iant@google.com>
12632
12633 * options.h (General_options): Add entries for '-Y' and
12634 '-relax'.
12635 * options.cc (General_options:finalize): If -Y was used, add those
12636 entries to the library path instead of the default "/lib" and
12637 "/usr/lib".
12638
12639 2008-04-11 David S. Miller <davem@davemloft.net>
12640
12641 * testsuite/justsyms.t: Start at 0x100.
12642 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12643 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12644 long.
12645 * testsuite/script_test_2.cc: Adjust string and section length
12646 checks.
12647
12648 2008-04-09 Ian Lance Taylor <iant@google.com>
12649
12650 PR gold/5996
12651 * script-sections.cc (Sections_element::allocate_to_segment): Add
12652 orphan parameter.
12653 (Output_section_definition::allocate_to_segment): Likewise.
12654 (Orphan_output_section::allocate_to_segment): Likewise.
12655 (Script_sections::attach_sections_using_phdrs_clause): Don't
12656 propagate non-PT_LOAD segments to orphan sections.
12657 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12658 readelf rather than objdump.
12659 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12660 .interp section and PT_INTERP segment are the same size.
12661 * testsuite/Makefile.in: Rebuild.
12662
12663 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12664 aliases for symbols defined in the same object.
12665 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12666 (weak_alias_test_SOURCES): New variable.
12667 (weak_alias_test_DEPENDENCIES): New variable.
12668 (weak_alias_test_LDFLAGS): New variable.
12669 (weak_alias_test_LDADD): New variable.
12670 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12671 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12672 (weak_alias_test_3.o): New target.
12673 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12674 * testsuite/weak_alias_test_main.cc: New file.
12675 * testsuite/weak_alias_test_1.cc: New file.
12676 * testsuite/weak_alias_test_2.cc: New file.
12677 * testsuite/weak_alias_test_3.cc: New file.
12678
12679 2008-04-08 Ian Lance Taylor <iant@google.com>
12680
12681 * options.h (class General_options): Add --noinhibit-exec option.
12682 * main.cc (main): Check --noinhibit-exec.
12683
12684 * options.h (class General_options): Define --wrap as a special
12685 option. Add wrap_symbols_ field.
12686 (General_options::any_wrap_symbols): New function.
12687 (General_options::is_wrap_symbol): New function.
12688 * options.cc (General_options::parse_wrap): New function.
12689 (General_options::General_options): Initialize wrap_symbols_.
12690 * symtab.cc (Symbol_table::wrap_symbol): New function.
12691 (Symbol_table::add_from_object): Handle --wrap.
12692 * symtab.h (class Symbol_table): Declare wrap_symbol.
12693 * target.h (Target::wrap_char): New function.
12694 (Target::Target_info): Add wrap_char field.
12695 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12696 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12697 * testsuite/testfile.cc (Target_test::test_target_info):
12698 Likewise.
12699
12700 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12701 there is one.
12702
12703 * layout.h (class Layout): Add added_eh_frame_data_ field.
12704 * layout.cc (Layout::Layout): Initialize new field.
12705 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12706 output section until we find a section we merged successfully.
12707 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12708 that the size be non-zero.
12709
12710 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12711 qualifier.
12712
12713 2008-04-08 Craig Silverstein <csilvers@google.com>
12714
12715 * configure.ac: Export new conditional variable HAVE_ZLIB.
12716 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12717 on HAVE_ZLIB.
12718 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12719 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12720
12721 2008-04-07 Ian Lance Taylor <iant@google.com>
12722
12723 * version.cc (version_string): Set to "1.5".
12724
12725 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12726 Add issued_non_pic_error_ field. Declare check_non_pic.
12727 (Target_x86_64::Scan::check_non_pic): New function.
12728 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12729 (Target_x86_64::Scan::global): Likewise.
12730
12731 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12732 addend parameter. Change caller. Handle merge sections.
12733 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12734 Address to Addend. Don't add in the result of
12735 local_section_offset, pass down the addend and use the returned
12736 value.
12737 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12738 Update declarations of local_section_offset and symbol_value.
12739 * testsuite/two_file_test_1.cc (t18): New function.
12740 * testsuite/two_file_test_2.cc (f18): New function.
12741 * testsuite/two_file_test_main.cc (main): Call t18.
12742 * testsuite/two_file_test.h (t18, f18): Declare.
12743
12744 * configure.ac: Don't test for objdump, c++filt, or readelf.
12745 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12746 conditionals.
12747 (TEST_READELF): New variable.
12748 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12749 (check_PROGRAMS): Add two_file_strip_test.
12750 (two_file_strip_test): New target.
12751 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12752 (two_file_same_shared_strip_test_SOURCES): New variable.
12753 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12754 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12755 (two_file_same_shared_strip_test_LDADD): New variable.
12756 (two_file_shared_strip.so): New target.
12757 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12758 (ver_test_5.syms, ver_test_7.syms): Likewise.
12759 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12760 (strip_test_3.stdout): Use TEST_OBJDUMP.
12761 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12762
12763 2008-04-04 Cary Coutant <ccoutant@google.com>
12764
12765 * symtab.h (Symbol::is_weak_undefined): New function.
12766 (Symbol::is_strong_undefined): New function.
12767 (Symbol::is_absolute): New function.
12768 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12769 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12770 absolute symbols.
12771 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12772 (weak_undef_test): New target.
12773 * testsuite/Makefile.in: Rebuild.
12774 * testsuite/weak_undef_file1.cc: New file.
12775 * testsuite/weak_undef_file2.cc: New file.
12776 * testsuite/weak_undef_test.cc: New file.
12777
12778 2008-04-03 Craig Silverstein <csilvers@google.com>
12779
12780 * compressed_output.h (class Output_compressed_section): Use
12781 unsigned buffer.
12782 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12783 add zlib header.
12784 (zlib_compressed_suffix): Removed.
12785 (Output_compressed_section::set_final_data_size): Use unsigned
12786 buffers.
12787 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12788 Fix linker invocation.
12789 (flagstest_o_specialfile_and_compress_debug_sections):
12790 Likewise.
12791 * testsuite/Makefile.in: Regenerated.
12792
12793 2008-04-02 David S. Miller <davem@davemloft.net>
12794
12795 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12796 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12797
12798 2008-04-02 Craig Silverstein <csilvers@google.com>
12799
12800 * TODO: New file.
12801
12802 2008-04-02 Ian Lance Taylor <iant@google.com>
12803
12804 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12805 parameters. Update for new key type to views_. Change all
12806 callers.
12807 (File_read::read): Adjust for byteshift in returned view.
12808 (File_read::add_view): New function, broken out of
12809 find_and_make_view.
12810 (File_read::make_view): New function, broken out of
12811 find_and_make_view.
12812 (File_read::find_or_make_view): Add offset and aligned
12813 parameters. Rewrite accordingly. Change all callers.
12814 (File_read::get_view): Add offset and aligned parameters. Adjust
12815 for byteshift in return value.
12816 (File_read::get_lasting_view): Likewise.
12817 * fileread.h (class File_read): Update declarations.
12818 (class File_read::View): Add byteshift_ field. Add byteshift to
12819 constructor. Add byteshift method.
12820 * archive.h (Archive::clear_uncached_views): New function.
12821 (Archive::get_view): Add aligned parameter. Change all callers.
12822 * object.h (Object::get_view): Add aligned parameter. Change all
12823 callers.
12824 (Object::get_lasting_view): Likewise.
12825
12826 * fileread.cc (File_read::release): Don't call clear_views if
12827 there are multiple objects.
12828 * fileread.h (File_read::clear_uncached_views): New function.
12829 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12830 on the archive.
12831
12832 2008-03-31 Cary Coutant <ccoutant@google.com>
12833
12834 Add thin archive support.
12835 * archive.cc (Archive::armagt): New const.
12836 (Archive::setup): Remove task parameter and calls to unlock.
12837 (Archive::unlock_nested_archives): New function.
12838 (Archive::read_header): Add nested_off parameter. Change
12839 all callers.
12840 (Archive::interpret_header): Likewise.
12841 (Archive::include_all_members): Change to handle thin
12842 archives.
12843 (Archive::include_member): Likewise.
12844 * archive.h (Archive::Archive): Add new parameters and
12845 initializers.
12846 (Archive::armagt): New const.
12847 (Archive::setup): Remove task parameter.
12848 (Archive::unlock_nested_archives): New function.
12849 (Archive::read_header): Add nested_off parameter.
12850 (Archive::interpret_header): Likewise.
12851 (Archive::Nested_archive_table): New typedef.
12852 (Archive::is_thin_archive_): New field.
12853 (Archive::nested_archives_): New field.
12854 (Archive::options_): New field.
12855 (Archive::dirpath_): New field.
12856 (Archive::task_): New field.
12857 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12858 for thin archives. Pass additional parameters to
12859 Archive::Archive. Unlock the archive file after calling
12860 Archive::setup.
12861
12862 2008-03-29 Ian Lance Taylor <iant@google.com>
12863
12864 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12865 version symbol to be local.
12866 * testsuite/ver_test_4.sh: New file.
12867 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12868 (check_DATA): Add ver_test_4.syms.
12869 (ver_test_4.syms): New target.
12870 * testsuite/Makefile.in: Rebuild.
12871
12872 * output.cc
12873 (Output_section::Input_section_sort_entry::has_priority): New
12874 function.
12875 (Output_section::Input_section_sort_entry::match_file_name): New
12876 function.
12877 (Output_section::Input_section_sort_entry::match_section_name):
12878 Remove.
12879 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12880 Remove.
12881 (Output_section::Input_section_sort_entry::match_section_file):
12882 Remove.
12883 (Output_section::Input_section_sort_compare::operator()): Rewrite
12884 using new Input_section_sort_entry functions. Sort crtbegin and
12885 crtend first. Sort sections with no priority before sections with
12886 a priority.
12887 * testsuite/initpri1.c (d3): Check j != 4.
12888 (cd5): New constructor/destructor function.
12889 (main): Check j != 2.
12890
12891 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12892 new symbol when resolving, don't call set_is_default.
12893 * testsuite/ver_test_7.cc: New file.
12894 * testsuite/ver_test_7.sh: New file.
12895 * testsuite/Makefile.am (ver_test_7.so): New target.
12896 (ver_test_7.o): New target.
12897 (check_SCRIPTS): Add ver_test_7.sh.
12898 (check_DATA): Add ver_test_7.syms.
12899 (ver_test_7.syms): New target.
12900
12901 2008-03-28 Ian Lance Taylor <iant@google.com>
12902
12903 * layout.cc (Layout::layout): If we see an input section with a
12904 name that needs sorting, set the must_sort flag for the output
12905 section.
12906 (Layout::make_output_section): If the name of the output section
12907 indicates that it might require sorting, set the may_sort flag.
12908 * output.h (Output_section::may_sort_attached_input_sections): New
12909 function.
12910 (Output_section::set_may_sort_attached_input_sections): New
12911 function.
12912 (Output_section::must_sort_attached_input_sections): New
12913 function.
12914 (Output_section::set_must_sort_attached_input_sections): New
12915 function.
12916 (class Output_section): Declare Input_section_sort_entry. Define
12917 Input_section_sort_compare. Declare
12918 sort_attached_input_sections. Add new fields:
12919 may_sort_attached_input_sections_,
12920 must_sort_attached_input_sections_,
12921 attached_input_sections_are_sorted_.
12922 * output.cc (Output_section::Output_section): Initialize new
12923 fields.
12924 (Output_section::add_input_section): Add an entry to
12925 input_sections_ if may_sort or must_sort are true.
12926 (Output_section::set_final_data_size): Call
12927 sort_attached_input_sections if necessary.
12928 (Output_section::Input_section_sort_entry): Define new class.
12929 (Output_section::Input_section_sort_compare::operator()): New
12930 function.
12931 (Output_section::sort_attached_input_sections): New function.
12932 * configure.ac: Check whether the compiler supports constructor
12933 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12934 * testsuite/initpri1.c: New file.
12935 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12936 CONSTRUCTOR_PRIORITY.
12937 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12938 (initpri1_LDFLAGS): New variable.
12939 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12940
12941 2008-03-27 Ian Lance Taylor <iant@google.com>
12942
12943 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12944 * testsuite/common_test_1.c: New file.
12945 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12946 (common_test_1_SOURCES): New variable.
12947 (common_test_1_DEPENDENCIES): New variable.
12948 (common_test_1_LDFLAGS): New variable.
12949
12950 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12951 and commons_ correctly when NAME/VERSION does not override
12952 NAME/NULL.
12953 * testsuite/ver_test_6.c: New file.
12954 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12955 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12956 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12957
12958 2008-03-26 Ian Lance Taylor <iant@google.com>
12959
12960 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12961 of an undefined symbol from a version script.
12962 * testsuite/Makefile.am (ver_test_5.so): New target.
12963 (ver_test_5.o): New target.
12964 (check_SCRIPTS): Add ver_test_5.sh.
12965 (check_DATA): Add ver_test_5.syms.
12966 (ver_test_5.syms): New target.
12967 * testsuite/ver_test_5.cc: New file.
12968 * testsuite/ver_test_5.script: New file.
12969 * testsuite/ver_test_5.sh: New file.
12970 * Makefile.in, testsuite/Makefile.in: Rebuild.
12971
12972 PR gold/5986
12973 Fix problems building gold with gcc 4.3.0.
12974 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12975 (gold_error_at_location, gold_warning_at_location): Use it.
12976 * configure.ac: Check whether we can compile and use a template
12977 function with a printf attribute.
12978 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12979 when jumping over bytes.
12980 * object.cc: Instantiate Object::read_section_data.
12981 * debug.h: Include <cstring>
12982 * dwarf_reader.cc: Include <algorithm>
12983 * main.cc: Include <cstring>.
12984 * options.cc: Include <cstring>.
12985 * output.cc: Include <cstring>.
12986 * script.cc: Include <cstring>.
12987 * script.h: Include <string>.
12988 * symtab.cc: Include <cstring> and <algorithm>.
12989 * target-select.cc: Include <cstring>.
12990 * version.cc: Include <string>.
12991 * testsuite/testmain.cc: Include <cstdlib>.
12992 * configure, config.in: Rebuild.
12993
12994 2008-03-25 Ian Lance Taylor <iant@google.com>
12995
12996 * options.cc: Include "../bfd/bfdver.h".
12997 (options::help): Print bug reporting address.
12998
12999 * version.cc (print_version): Adjust output for current value of
13000 BFD_VERSION_STRING.
13001
13002 * NEWS: New file.
13003
13004 * options.cc (options::help): Print list of supported targets.
13005 * target-select.h: Include <vector>.
13006 (class Target_selector): Make machine_, size_, and is_big_endian_
13007 fields const. Add bfd_name_ and instantiated_target_ fields.
13008 (Target_selector::Target_selector): Add bfd_name parameter.
13009 (Target_selector::recognize): Make non-virtual, call
13010 do_recognize.
13011 (Target_selector::recognize_by_name): Make non-virtual, call
13012 do_recognize_by_name.
13013 (Target_selector::supported_names): New function.
13014 (Target_selector::bfd_name): New function.
13015 (Target_selector::do_instantiate_target): New pure virtual
13016 function.
13017 (Target_selector::do_recognize): New virtual function.
13018 (Target_selector::do_recognize_by_name): New virtual function.
13019 (Target_selector::instantiate_target): New private function.
13020 (supported_target_names): Declare.
13021 * target-select.cc (Target_selector::Target_selector): Update for
13022 new parameter and fields.
13023 (select_target_by_name): Check that the name matches before
13024 calling recognize_by_name.
13025 (supported_target_names): New function.
13026 * i386.cc (class Target_selector_i386): Update Target_selector
13027 constructor call. Remove recognize and recognize_by_name. Add
13028 do_instantiate_target.
13029 * x86_64.cc (class Target_selector_x86_64): Likewise.
13030 * testsuite/testfile.cc (class Target_selector_test): Update for
13031 changes to Target_selector.
13032
13033 * README: Rewrite, with some notes on unsupported features.
13034
13035 2008-03-24 Cary Coutant <ccoutant@google.com>
13036
13037 * i386.cc (Target_i386::Got_type): New enum declaration.
13038 (Target_i386::Scan::local): Updated callers of Output_data_got
13039 member functions.
13040 (Target_i386::Scan::global): Likewise.
13041 (Target_i386::Relocate::relocate): Likewise.
13042 (Target_i386::Relocate::relocate_tls): Likewise.
13043 * object.h (Got_offset_list): New class.
13044 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13045 (Sized_relobj::local_got_offset): Likewise.
13046 (Sized_relobj::set_local_got_offset): Likewise.
13047 (Sized_relobj::local_has_tls_got_offset): Removed.
13048 (Sized_relobj::local_tls_got_offset): Removed.
13049 (Sized_relobj::set_local_tls_got_offset): Removed.
13050 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13051 * output.cc (Output_data_got::add_global): Added got_type parameter.
13052 (Output_data_got::add_global_with_rel): Likewise.
13053 (Output_data_got::add_global_with_rela): Likewise.
13054 (Output_data_got::add_global_pair_with_rel): New function.
13055 (Output_data_got::add_global_pair_with_rela): New function.
13056 (Output_data_got::add_local): Added got_type parameter.
13057 (Output_data_got::add_local_with_rel): Likewise.
13058 (Output_data_got::add_local_with_rela): Likewise.
13059 (Output_data_got::add_local_pair_with_rel): New function.
13060 (Output_data_got::add_local_pair_with_rela): New function.
13061 (Output_data_got::add_global_tls): Removed.
13062 (Output_data_got::add_global_tls_with_rel): Removed.
13063 (Output_data_got::add_global_tls_with_rela): Removed.
13064 (Output_data_got::add_local_tls): Removed.
13065 (Output_data_got::add_local_tls_with_rel): Removed.
13066 (Output_data_got::add_local_tls_with_rela): Removed.
13067 * output.h (Output_data_got::add_global): Added got_type parameter.
13068 (Output_data_got::add_global_with_rel): Likewise.
13069 (Output_data_got::add_global_with_rela): Likewise.
13070 (Output_data_got::add_global_pair_with_rel): New function.
13071 (Output_data_got::add_global_pair_with_rela): New function.
13072 (Output_data_got::add_local): Added got_type parameter.
13073 (Output_data_got::add_local_with_rel): Likewise.
13074 (Output_data_got::add_local_with_rela): Likewise.
13075 (Output_data_got::add_local_pair_with_rel): New function.
13076 (Output_data_got::add_local_pair_with_rela): New function.
13077 (Output_data_got::add_global_tls): Removed.
13078 (Output_data_got::add_global_tls_with_rel): Removed.
13079 (Output_data_got::add_global_tls_with_rela): Removed.
13080 (Output_data_got::add_local_tls): Removed.
13081 (Output_data_got::add_local_tls_with_rel): Removed.
13082 (Output_data_got::add_local_tls_with_rela): Removed.
13083 * resolve.cc (Symbol::override_base_with_special): Removed
13084 reference to has_got_offset_ field.
13085 * symtab.cc (Symbol::init_fields): Replaced initialization
13086 of got_offset_ with got_offsets_. Removed initialization
13087 of has_got_offset_
13088 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13089 (Symbol::got_offset): Likewise.
13090 (Symbol::set_got_offset): Likewise.
13091 (Symbol::has_tls_got_offset): Removed.
13092 (Symbol::tls_got_offset): Removed.
13093 (Symbol::set_tls_got_offset): Removed.
13094 (Symbol::got_offset_): Removed.
13095 (Symbol::tls_mod_got_offset_): Removed.
13096 (Symbol::tls_pair_got_offset_): Removed.
13097 (Symbol::got_offsets_): New field.
13098 (Symbol::has_got_offset): Removed.
13099 (Symbol::has_tls_mod_got_offset): Removed.
13100 (Symbol::has_tls_pair_got_offset): Removed.
13101 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13102 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13103 member functions.
13104 (Target_x86_64::Scan::global): Likewise.
13105 (Target_x86_64::Relocate::relocate): Likewise.
13106 (Target_x86_64::Relocate::relocate_tls): Likewise.
13107
13108 2008-03-25 Ben Elliston <bje@au.ibm.com>
13109
13110 * yyscript.y: Fix spelling error in comment.
13111
13112 2008-03-24 Ian Lance Taylor <iant@google.com>
13113
13114 * options.h (class General_options): Define build_id option.
13115 * layout.h (class Layout): Declare write_build_id, create_note,
13116 create_build_id. Add build_id_note_ member.
13117 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13118 "libiberty.h", "md5.h", "sha1.h".
13119 (Layout::Layout): Initialize eh_frame_data_,
13120 eh_frame_hdr_section_, and build_id_note_.
13121 (Layout::finalize): Call create_build_id.
13122 (Layout::create_note): New function, broken out of
13123 Layout::create_gold_note.
13124 (Layout::create_gold_note): Call create_note.
13125 (Layout::create_build_id): New function.
13126 (Layout::write_build_id): New function.
13127 (Close_task_runner::run): Call write_build_id.
13128
13129 * x86_64.cc: Correct license to GPLv3.
13130
13131 2008-03-23 Ian Lance Taylor <iant@google.com>
13132
13133 * options.cc: Include "demangle.h".
13134 (parse_optional_string): New function.
13135 (parse_long_option): Handle takes_optional_argument.
13136 (parse_short_option): Update dash_z initializer. Handle
13137 takes_optional_argument.
13138 (General_options::General_options): Initialize do_demangle_.
13139 (General_options::finalize): Set do_demangle_. Handle demangling
13140 style.
13141 * options.h (parse_optional_string): Declare.
13142 (struct One_option): Add optional_arg field. Update constructor.
13143 Update call constructor calls. Add takes_optional_argument
13144 function.
13145 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13146 (DEFINE_optional_string): Define.
13147 (General_options::demangle): Change from DEFINE_bool to
13148 DEFINE_optional_string.
13149 (General_options::no_demangle): New function.
13150 (General_options::do_demangle): New function.
13151 (General_options::set_do_demangle): New function.
13152 (General_options::execstack_status_): Move definition to end of
13153 class definition.
13154 (General_options::static_): Likewise.
13155 (General_options::do_demangle_): New field.
13156 * object.cc (big_endian>::get_symbol_location_info): Call
13157 Options::do_demangle, not Options::demangle.
13158 * symtab.cc (demangle): Likewise.
13159
13160 2008-03-22 Ian Lance Taylor <iant@google.com>
13161
13162 * gold.h: Include <cstddef> and <sys/types.h>
13163 * options.h: Include <cstring>.
13164
13165 2008-03-21 Ian Lance Taylor <iant@google.com>
13166
13167 * Added source code to GNU binutils.
This page took 0.29174 seconds and 5 git commands to generate.