Check gdbarch_ptr_bit for x32 core dump
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2
3 PR gold/14091
4 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
5 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
6 R_X86_64_64.
7
8 2012-05-08 Cary Coutant <ccoutant@google.com>
9
10 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
11 (lines_only_debug_sections): Likewise.
12
13 2012-05-02 Roland McGrath <mcgrathr@google.com>
14
15 * nacl.cc: New file.
16 * nacl.h: New file.
17 * Makefile.am (CCFILES, HFILES): Add them.
18 * Makefile.in: Regenerate.
19 * i386.cc (Output_data_plt_i386_nacl): New class.
20 (Output_data_plt_i386_nacl_exec): New class.
21 (Output_data_plt_i386_nacl_dyn): New class.
22 (Target_i386_nacl): New class.
23 (Target_selector_i386_nacl): New class.
24 (target_selector_i386): Use it instead of Target_selector_i386.
25 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
26 (Target_x86_64_nacl): New class.
27 (Target_selector_x86_64_nacl): New class.
28 (target_selector_x86_64, target_selector_x32): Use it instead of
29 Target_selector_x86_64.
30 * arm.cc (Output_data_plt_arm_nacl): New class.
31 (Target_arm_nacl): New class.
32 (Target_selector_arm_nacl): New class.
33 (target_selector_arm, target_selector_armbe): Use it instead of
34 Target_selector_arm.
35
36 * target-select.cc (select_target): Take new Input_file* and off_t
37 arguments, pass them on to recognize method of selector.
38 * object.cc (make_elf_sized_object): Update caller.
39 * parameters.cc (parameters_force_valid_target): Likewise.
40 * incremental.cc (make_sized_incremental_binary): Likewise.
41 * target-select.h: Update decl.
42 (Target_selector::recognize): Take new Input_file* argument,
43 pass it on to do_recognize.
44 (Target_selector::do_recognize): Take new Input_file* argument.
45 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
46 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
47 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
48 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
49
50 * target.h (Target::Target_info): New members isolate_execinstr
51 and rosegment_gap.
52 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
53 * arm.cc (Target_arm::arm_info): Update initializer.
54 * i386.cc (Target_i386::i386_info): Likewise.
55 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
56 * sparc.cc (Target_sparc::sparc_info): Likewise.
57 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
58 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
59 * layout.cc (Layout::attach_allocated_section_to_segment):
60 Take new const Target* argument. If target->isolate_execinstr(), act
61 like --rosegment.
62 (Layout::find_first_load_seg): Take new const Target* argument;
63 if target->isolate_execinstr(), reject PF_X segments.
64 (Layout::relaxation_loop_body): Update caller.
65 (Layout::set_segment_offsets): If target->isolate_execinstr(),
66 reset file offset to zero when we hit LOAD_SEG, and then do a second
67 loop over the segments before LOAD_SEG to reassign offsets after
68 addresses have been determined. Handle target->rosegment_gap().
69 (Layout::attach_section_to_segment): Take new const Target* argument;
70 pass it to attach_allocated_section_to_segment.
71 (Layout::make_output_section): Update caller.
72 (Layout::attach_sections_to_segments): Take new const Target* argument;
73 pass it to attach_section_to_segment.
74 * gold.cc (queue_middle_tasks): Update caller.
75 * layout.h (Layout): Update method decls with new arguments.
76
77 * arm.cc (Target_arm::Target_arm): Take optional argument for the
78 Target_info pointer to use.
79 (Target_arm::do_make_data_plt): New virtual method.
80 (Target_arm::make_data_plt): New method that calls it.
81 (Target_arm::make_plt_entry): Use it.
82 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
83 for the section alignment.
84 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
85 method.
86 (Output_data_plt_arm::first_plt_entry_offset): Call it.
87 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
88 method.
89 (Output_data_plt_arm::get_plt_entry_size): Call it.
90 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
91 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
92 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
93 method.
94 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
95 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
96 method instead of sizeof(plt_entry).
97 (Output_data_plt_arm::add_entry): Likewise.
98 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
99 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
100 than static method.
101 (Target_arm::plt_entry_size): Likewise.
102 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
103 Move to ...
104 (Output_data_plt_arm_standard): ... here, new class.
105 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
106 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
107 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
108
109 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
110 Take additional argument for the PLT entry size.
111 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
112 Use get_plt_entry_size method rather than plt_entry_size variable.
113 (Output_data_plt_x86_64::reserve_slot): Likewise.
114 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
115 (Output_data_plt_x86_64::add_entry): Likewise.
116 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
117 (Output_data_plt_x86_64::address_for_global): Likewise.
118 (Output_data_plt_x86_64::address_for_local): Likewise.
119 (Output_data_plt_x86_64::set_final_data_size): Likewise.
120 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
121 Make method non-static.
122 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
123 method.
124 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
125 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
126 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
127 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
128 virtual method.
129 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
130 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
131 virtual method.
132 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
133 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
134 virtual method.
135 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
136 (Output_data_plt_x86_64::plt_entry_size)
137 (Output_data_plt_x86_64::first_plt_entry)
138 (Output_data_plt_x86_64::plt_entry)
139 (Output_data_plt_x86_64::tlsdesc_plt_entry)
140 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
141 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
142 (Output_data_plt_x86_64_standard): ... here, new class.
143 (Target_x86_64::Target_x86_64): Take optional argument for the
144 Target_info pointer to use.
145 (Target_x86_64::do_make_data_plt): New virtual method.
146 (Target_x86_64::make_data_plt): New method to call it.
147 (Target_x86_64::init_got_plt_for_update): Use that.
148 Call this->plt_->add_eh_frame method here.
149 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
150 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
151 rather than static method.
152 (Target_x86_64::plt_entry_size): Likewise.
153 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
154 rather than plt_entry_size variable. Move guts of PLT filling to...
155 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
156 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
157 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
158
159 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
160 additional argument for the section alignment.
161 Don't do add_eh_frame_for_plt here.
162 (Output_data_plt_i386::first_plt_entry_offset): Make the method
163 non-static. Use get_plt_entry_size method rather than plt_entry_size
164 variable.
165 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
166 method.
167 (Output_data_plt_i386::get_plt_entry_size): Call it.
168 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
169 (Output_data_plt_i386::add_eh_frame): New method to call it.
170 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
171 method.
172 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
173 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
174 method.
175 (Output_data_plt_i386::fill_plt_entry): New method to call it.
176 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
177 method instead of plt_entry_size.
178 (Output_data_plt_i386::plt_entry_size)
179 (Output_data_plt_i386::plt_eh_frame_fde_size)
180 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
181 (Output_data_plt_i386_standard): ... here, new class.
182 (Output_data_plt_i386_exec): New class.
183 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
184 (Output_data_plt_i386_exec::first_plt_entry): ... here.
185 (Output_data_plt_i386::exec_plt_entry): Move to ...
186 (Output_data_plt_i386_exec::plt_entry): ... here.
187 (Output_data_plt_i386_dyn): New class.
188 (Output_data_plt_i386::first_plt_entry): Move to ...
189 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
190 (Output_data_plt_i386::dyn_plt_entry): Move to ...
191 (Output_data_plt_i386_dyn::plt_entry): ... here.
192 (Target_i386::Target_i386): Take optional argument for the Target_info
193 pointer to use.
194 (Target_i386::do_make_data_plt): New virtual method.
195 (Target_i386::make_data_plt): New method to call it.
196 (Target_i386::make_plt_section): Use that.
197 Call this->plt_->add_eh_frame method here.
198 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
199 rather than plt_entry_size variable.
200 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
201 (Output_data_plt_i386::address_for_local): Likewise.
202 (Output_data_plt_i386::do_write): Likewise.
203 Move guts of PLT filling to...
204 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
205 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
206 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
207 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
208
209 2012-05-01 Cary Coutant <ccoutant@google.com>
210
211 * dwarf_reader.cc (Dwarf_die::read_attributes)
212 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
213 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
214 * reduced_debug_output.cc
215 (Output_reduced_debug_info_section::get_die_end): Remove
216 DW_FORM_GNU_ref_index. Add default case.
217
218 2012-04-26 Mark Wielaard <mjw@redhat.com>
219
220 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
221 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
222 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
223 DW_AT_high_pc as offset from DW_AT_low_pc.
224
225 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
226 * testsuite/Makefile.in: Regenerate.
227 * testsuite/gdb_index_test_3.c: New test source file.
228 * testsuite/gdb_index_test_3.sh: New test source file.
229
230 2012-04-25 Ian Lance Taylor <iant@google.com>
231
232 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
233 pointer.
234 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
235 as a class, not a struct.
236 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
237 (Target_arm::apply_cortex_a8_workaround): Likewise.
238 * gc.h: Declare Reloc_types as a struct, not a class.
239 * object.h: Declare Symbols_data as a struct.
240 * reloc.h: Declare Read_relocs_data as a struct.
241 * target.h: Declare Relocate_info as a struct.
242
243 2012-04-24 David S. Miller <davem@davemloft.net>
244
245 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
246 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
247 and R_SPARC_WPLT30.
248
249 2012-04-24 Cary Coutant <ccoutant@google.com>
250
251 * incremental-dump.cc (find_input_containing_global): Replace
252 magic number with symbolic constant.
253 (dump_incremental_inputs): Update version number.
254 * incremental.cc (Output_section_incremental_inputs): Update version
255 number; import symbolic constants from Incremental_inputs_reader.
256 (Incremental_inputs::create_data_sections): Align relocations
257 section correctly for 64-bit targets.
258 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
259 constants; add padding.
260 (Output_section_incremental_inputs::write_header): Add assert for
261 header_size.
262 (Output_section_incremental_inputs::write_input_files): Add assert
263 for input_entry_size.
264 (Output_section_incremental_inputs::write_info_blocks): Add padding;
265 add assert for object_info_size, input_section_entry_size,
266 global_sym_entry_size.
267 * incremental.h (Incremental_inputs_reader): Add symbolic constants
268 for data structure sizes; use them.
269 (Incremental_input_entry_reader): Import symbolic constants from
270 Incremental_inputs_reader; use them.
271
272 2012-04-23 David S. Miller <davem@davemloft.net>
273
274 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
275 and elf_flags_set_.
276 (Target_sparc::Target_sparc): Initialize new fields.
277 (Target_sparc::do_make_elf_object): New function.
278 (Target_sparc::do_adjust_elf_header): New function.
279
280 2012-04-23 Cary Coutant <ccoutant@google.com>
281
282 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
283 CU range table of gdb index.
284
285 2012-04-20 David S. Miller <davem@davemloft.net>
286
287 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
288 instead of false.
289
290 2012-04-16 David S. Miller <davem@davemloft.net>
291
292 * sparc.cc (Target_sparc::got_address): New function.
293 (Sparc_relocate_functions::gdop_hix22): New function.
294 (Sparc_relocate_functions::gdop_lox10): New function.
295 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
296 relocs.
297 (Target_sparc::Scan::local): Likewise if the global symbol is not
298 preemptible and is not IFUNC.
299 (Target_sparc::Relocate::relocate): Perform GOTDATA code
300 transformations for local and non-preemptible non-IFUNC global
301 symbols.
302
303 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
304 writing out 64-bit part of ranges.
305
306 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
307 -fpic and -fpie respectively.
308 * Makefile.in: Regenerate.
309
310 * sparc.cc (class Target_sparc): Add rela_ifunc_.
311 (Target_sparc::Target_sparc): Initialize new field.
312 (Target_sparc::do_plt_section_for_global): New function.
313 (Target_sparc::do_plt_section_for_local): New function.
314 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
315 (Target_sparc::make_plt_section): New function, broken out of
316 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
317 (Target_sparc::make_plt_entry): Call make_plt_section.
318 (Target_sparc::make_local_ifunc_plt_entry): New function.
319 (Target_sparc::rela_ifunc_section): New function.
320 (Target_sparc::plt_section): Remove const.
321 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
322 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
323 and ifunc_count_ fields.
324 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
325 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
326 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
327 (Output_data_plt_sparc::rela_ifunc): New function.
328 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
329 (Output_data_plt_sparc::has_ifunc_section): New function.
330 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
331 (Output_data_plt_sparc::address_for_global): New function.
332 (Output_data_plt_sparc::address_for_local): New function.
333 (Output_data_plt_sparc::plt_index_to_offset): New function.
334 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
335 and entry_count.
336 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
337 entry_count.
338 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
339 R_SPARC_JMP_IREL to switch.
340 (Target_sparc::Scan::check_non_pic): Likewise.
341 (Target_sparc::Scan::local): Handle IFUNC symbols.
342 (Target_sparc::Scan::local): Likewise.
343 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
344 and plt_address_for_local.
345 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
346 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
347
348 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
349 (class Output_data_reloc): Adjust calls to Output_reloc_type.
350 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
351 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
352 global relocs too.
353 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
354 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
355 calls.
356 * sparc.cc (Target_sparc::Scan::global): Likewise.
357 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
358
359 2012-04-16 Cary Coutant <ccoutant@google.com>
360
361 * archive.cc (Library_base::should_include_member): Check for
362 --export-dynamic-symbol.
363 * options.h (class General_options): Add --export-dynamic-symbol.
364 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
365 --export-dynamic-symbol.
366 (Symbol_table::gc_mark_undef_symbols): Likewise.
367 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
368
369 2012-04-12 David S. Miller <davem@davemloft.net>
370
371 * sparc.cc (Reloc::wdisp10): New relocation method.
372 (Reloc::h34): Likewise.
373 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
374 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
375 R_SPARC_WDISP10.
376 (Target_sparc::Scan::local): Likewise.
377 (Target_sparc::Scan::global): Likewise.
378 (Target_sparc::Relocate::relocate): Likewise.
379
380 2012-04-09 Cary Coutant <ccoutant@google.com>
381
382 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
383 low_pc == 0.
384
385 2012-04-06 Ian Lance Taylor <iant@google.com>
386
387 * timer.cc: #include <unistd.h>.
388
389 2012-04-06 Roland McGrath <mcgrathr@google.com>
390
391 * configure.in (AC_CHECK_HEADERS): Add locale.h.
392 * config.in: Regenerate.
393 * configure: Regenerate.
394
395 2012-04-05 Nick Clifton <nickc@redhat.com>
396
397 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
398 (AM_LC_MESSAGES): Add.
399 * aclocal.m4: Regenerate.
400 * config.in: Regenerate.
401 * configure: Regenerate.
402
403 2012-03-21 Cary Coutant <ccoutant@google.com>
404
405 * Makefile.am: Add gdb-index.cc, gdb-index.h.
406 * Makefile.in: Regenerate.
407 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
408 (Sized_elf_reloc_mapper::symbol_section): New function.
409 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
410 (make_elf_reloc_mapper): New function.
411 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
412 (Dwarf_abbrev_table::do_read_abbrevs): New function.
413 (Dwarf_abbrev_table::do_get_abbrev): New function.
414 (Dwarf_ranges_table::read_ranges_table): New function.
415 (Dwarf_ranges_table::read_range_list): New function.
416 (Dwarf_pubnames_table::read_section): New function.
417 (Dwarf_pubnames_table::read_header): New function.
418 (Dwarf_pubnames_table::next_name): New function.
419 (Dwarf_die::Dwarf_die): New function.
420 (Dwarf_die::read_attributes): New function.
421 (Dwarf_die::skip_attributes): New function.
422 (Dwarf_die::set_name): New function.
423 (Dwarf_die::set_linkage_name): New function.
424 (Dwarf_die::attribute): New function.
425 (Dwarf_die::string_attribute): New function.
426 (Dwarf_die::int_attribute): New function.
427 (Dwarf_die::uint_attribute): New function.
428 (Dwarf_die::ref_attribute): New function.
429 (Dwarf_die::child_offset): New function.
430 (Dwarf_die::sibling_offset): New function.
431 (Dwarf_info_reader::check_buffer): New function.
432 (Dwarf_info_reader::parse): New function.
433 (Dwarf_info_reader::do_parse): New function.
434 (Dwarf_info_reader::do_read_string_table): New function.
435 (Dwarf_info_reader::lookup_reloc): New function.
436 (Dwarf_info_reader::get_string): New function.
437 (Dwarf_info_reader::visit_compilation_unit): New function.
438 (Dwarf_info_reader::visit_type_unit): New function.
439 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
440 Sized_elf_reloc_mapper.
441 (Sized_dwarf_line_info::symbol_section): Remove function.
442 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
443 (Sized_dwarf_line_info::read_line_mappings): Remove object
444 parameter, adjust callers.
445 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
446 * dwarf_reader.h: Include <sys/types.h>.
447 (class Track_relocs): Remove forward declaration.
448 (class Elf_reloc_mapper): New class.
449 (class Sized_elf_reloc_mapper): New class.
450 (class Dwarf_abbrev_table): New class.
451 (class Dwarf_range_list): New class.
452 (class Dwarf_ranges_table): New class.
453 (class Dwarf_pubnames_table): New class.
454 (class Dwarf_die): New class.
455 (class Dwarf_info_reader): New class.
456 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
457 (Sized_dwarf_line_info::symbol_section): Remove member function.
458 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
459 base class.
460 * gdb-index.cc: New source file.
461 * gdb-index.h: New source file.
462 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
463 and .debug_types sections, call Layout::add_to_gdb_index.
464 (Sized_relobj_incr::do_section_name): Implement.
465 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
466 return type; Implement.
467 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
468 return type.
469 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
470 parameter list and return type.
471 (Sized_incr_dynobj::do_section_contents): Likewise.
472 * layout.cc: Include gdb-index.h.
473 (Layout::Layout): Initialize gdb_index_data_.
474 (Layout::init_fixed_output_section): Check for .gdb_index section.
475 (Layout::add_to_gdb_index): New function. Instantiate.
476 * layout.h: Add forward declaration for class Gdb_index.
477 (Layout::add_to_gdb_index): New member function.
478 (Layout::gdb_index_data_): New data member.
479 * main.cc: Include gdb-index.h.
480 (main): Print statistics for gdb index.
481 * object.cc (Object::section_contents): Move code into
482 do_section_contents.
483 (need_decompressed_section): Check for sections needed when building
484 gdb index.
485 (build_compressed_section_map): Likewise.
486 (Sized_relobj_file::do_read_symbols): Need local symbols when building
487 gdb index.
488 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
489 sections; call Layout::add_to_gdb_index.
490 (Sized_relobj_file::do_decompressed_section_contents): Call
491 do_section_contents directly.
492 * object.h (Object::do_section_contents): Adjust parameter list and
493 return type.
494 (Object::do_decompressed_section_contents): Call do_section_contents
495 directly.
496 (Sized_relobj_file::do_section_contents): Adjust parameter list and
497 return type.
498 * options.h (class General_options): Add --gdb-index option.
499 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
500 list and return type.
501 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
502 * reloc.h (Track_relocs::checkpoint): New function.
503 (Track_relocs::reset): New function.
504
505 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
506 New test cases.
507 * testsuite/Makefile.in: Regenerate.
508 * testsuite/gdb_index_test.cc: New test source file.
509 * testsuite/gdb_index_test_1.sh: New test source file.
510 * testsuite/gdb_index_test_2.sh: New test source file.
511
512 2012-03-19 Doug Kwan <dougkwan@google.com>
513
514 * arm.cc (Target_arm::do_define_standard_symbols): New method.
515 (Target_arm::do_finalize_sections): Remove code which defines
516 __exidx_start and __exidx_end. Make symbol table parameter
517 anonymous as it is not used.
518 * gold.cc (queue_middle_tasks): Call target hook to define any
519 target-specific symbols.
520 * target.h (Target::define_standard_symbols): New method.
521 (Target::do_define_standard_symbols): Same.
522 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
523 * testsuite/Makefile.in: Regenerate.
524 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
525 and __exidx_end.
526 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
527 relocations are generated for __exidx_start and __exidx_end.
528
529 2012-03-16 Doug Kwan <dougkwan@google.com>
530
531 * testsuite/Makefile.am: Disable test initpri3b.
532 * testsuite/Makefile.in: Regenerate.
533
534 2012-03-15 Doug Kwan <dougkwan@google.com>
535
536 * arm.cc (Target_arm::got_section): Make .got section read-only
537 if -z now is given.
538
539 2012-03-15 Ian Lance Taylor <iant@google.com>
540
541 PR gold/13850
542 * layout.cc (Layout::make_output_section): Correctly mark
543 SHT_INIT_ARRAY, et. al., as relro.
544
545 2012-03-14 Doug Kwan <dougkwan@google.com>
546
547 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
548 dynamic relocations for protected symbols in shared objects.
549
550 2012-03-13 Ian Lance Taylor <iant@google.com>
551
552 * resolve.cc (Symbol_table::resolve): When merging common symbols,
553 keep the larger alignment.
554
555 2012-03-12 Cary Coutant <ccoutant@google.com>
556
557 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
558 handling of DW_LNE_define_file.
559
560 2012-03-12 Cary Coutant <ccoutant@google.com>
561
562 * reduced_debug_output.cc
563 (Output_reduced_debug_info_section::get_die_end): Add new FORM
564 codes to switch.
565
566 2012-02-29 Cary Coutant <ccoutant@google.com>
567
568 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
569
570 2012-02-29 Cary Coutant <ccoutant@google.com>
571
572 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
573 Call Object::decompressed_section_contents.
574 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
575 New dtor.
576 (Sized_dwarf_line_info::buffer_start_): New data member.
577 * merge.cc (Output_merge_data::do_add_input_section): Call
578 Object::decompressed_section_contents.
579 (Output_merge_string::do_add_input_section): Likewise.
580 * object.cc (need_decompressed_section): New function.
581 (build_compressed_section_map): Decompress sections needed later.
582 (Sized_relobj_file::do_decompressed_section_contents): New function.
583 (Sized_relobj_file::do_discard_decompressed_sections): New function.
584 * object.h (Object::decompressed_section_contents): New function.
585 (Object::discard_decompressed_sections): New function.
586 (Object::do_decompressed_section_contents): New function.
587 (Object::do_discard_decompressed_sections): New function.
588 (Compressed_section_info): New type.
589 (Compressed_section_map): Include decompressed section contents.
590 (Sized_relobj_file::do_decompressed_section_contents): New function.
591 (Sized_relobj_file::do_discard_decompressed_sections): New function.
592
593 2012-02-16 Cary Coutant <ccoutant@google.com>
594
595 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
596 * testsuite/Makefile.in: Regenerate.
597
598 2012-02-14 Cary Coutant <ccoutant@google.com>
599
600 * options.cc (General_options::finalize): Disallow -pie and -static.
601
602 2012-02-03 Doug Kwan <dougkwan@google.com>
603
604 * arm.cc (Arm_relocate_functions::abs8,
605 Arm_relocate_functions::abs16): Use
606 Bits::has_signed_unsigned_overflow32.
607 (Arm_relocate_functions::thm_abs8): Correct range of
608 overflow check.
609 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
610 in assertions.
611
612 2012-02-02 Doug Kwan <dougkwan@google.com>
613
614 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
615 position independent outputs, not just shared objects.
616
617 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
618
619 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
620 * configure: Regenerated.
621
622 2012-01-27 Ian Lance Taylor <iant@google.com>
623
624 * reloc.h (Bits): New class with static functions, copied from
625 namespace utils in arm.cc.
626 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
627 instead.
628
629 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
630
631 * incremental.cc (write_info_blocks): Correct relocation offset.
632
633 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
634
635 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
636 (Relocate::tls_gd_to_le): Likewise.
637
638 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
639
640 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
641
642 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
643
644 * configure.ac: Check if -mcmodel=medium works.
645 * configure: Regenerated.
646
647 2012-01-24 Cary Coutant <ccoutant@google.com>
648
649 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
650 definition and ...
651 (read_unsigned_LEB_128_x): ... this new function.
652 (read_signed_LEB_128): Replaced with inline definition and ...
653 (read_signed_LEB_128_x): ... this new function.
654 * int_encoding.h (read_unsigned_LEB_128_x): New function.
655 (read_unsigned_LEB_128): Add inline definition.
656 (read_signed_LEB_128_x): New function.
657 (read_signed_LEB_128): Add inline definition.
658 * testsuite/Makefile.am (leb128_unittest): New unit test.
659 * testsuite/Makefile.in: Regenerate.
660 * testsuite/leb128_unittest.cc: New unit test.
661
662 2012-01-23 Ian Lance Taylor <iant@google.com>
663
664 PR gold/13617
665 * i386.cc (Target_i386::do_code_fill): When using a jmp
666 instruction, pad with nop instructions.
667 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
668
669 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
670
671 * x86_64.cc (gc_process_relocs): Add typename on types used in
672 template.
673 (scan_relocs): Likewise.
674 (relocate_section): Likewise.
675 (apply_relocation): Likewise.
676
677 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
678
679 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
680 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
681 under x32.
682
683 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
684
685 * x86_64.cc: Initial support for x32.
686
687 2012-01-03 Cary Coutant <ccoutant@google.com>
688
689 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
690 Use abstract base class for GOT.
691 * gold/output.h (class Output_data_got_base): New abstract base class.
692 (class Output_data_got): Derive from new base class, adjust ctors.
693 (Output_data_got::reserve_slot): Make virtual; rename to
694 do_reserve_slot; Adjust callers.
695 * gold/target.h (Sized_target::init_got_plt_for_update): Return
696 pointer to abstract base class.
697 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
698
699 2011-12-18 Ian Lance Taylor <iant@google.com>
700
701 * object.h (Relobj::local_symbol_value): New function.
702 (Relobj::local_plt_offset): New function.
703 (Relobj::local_has_got_offset): New function.
704 (Relobj::local_got_offset): New function.
705 (Relobj::set_local_got_offset): New function.
706 (Relobj::do_local_symbol_value): New pure virtual function.
707 (Relobj::do_local_plt_offset): Likewise.
708 (Relobj::do_local_has_got_offset): Likewise.
709 (Relobj::do_local_got_offset): Likewise.
710 (Relobj::do_set_local_got_offset): Likewise.
711 (Sized_relobj::do_local_has_got_offset): Rename from
712 local_has_got_offset.
713 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
714 (Sized_relobj::do_set_local_got_offset): Rename from
715 set_local_got_offset.
716 (Sized_relobj_file::do_local_plt_offset): Rename from
717 local_plt_offset.
718 (Sized_relobj_file::do_local_symbol_value): New function.
719 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
720 local_plt_offset.
721 * output.cc (Output_data_got::Got_entry::write): Change object to
722 Relobj. Use local_symbol_value.
723 (Output_data_got::add_global_with_rel): Change rel_dyn to
724 Output_data_reloc_generic*. Use add_global_generic.
725 (Output_data_got::add_global_with_rela): Remove. Change all
726 callers to use add_global_with_rel.
727 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
728 Output_data_reloc_generic*. Use add_global_generic.
729 (Output_data_got::add_global_pair_with_rela): Remove. Change all
730 callers to use add_global_pair_with_rel.
731 (Output_data_got::add_local): Change object to Relobj*.
732 (Output_data_got::add_local_plt): Likewise.
733 (Output_data_got::add_local_with_rel): Change object to Relobj*,
734 change rel_dyn to Output_data_reloc_generic*. Use
735 add_local_generic.
736 (Output_data_got::add_local_with_rela): Remove. Change all
737 callers to use all_local_with_rel.
738 (Output_data_got::add_local_pair_with_rel): Change object to
739 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
740 add_output_section_generic.
741 (Output_data_got::add_local_pair_with_rela): Remove. Change all
742 callers to use add_local_pair_with_rel.
743 (Output_data_got::reserve_local): Change object to Relobj*.
744 * output.h: (class Output_data_reloc_generic): Add pure virtual
745 declarations for add_global_generic, add_local_generic,
746 add_output_section_generic.
747 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
748 functions for Output_data_reloc_generic. Update declarations for
749 changes listed in output.cc.
750 (class Output_data_got): Change template parameter to got_size.
751 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
752 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
753 function.
754 (Sized_relobj_incr::do_local_plt_offset): New function.
755 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
756 add_global_generic.
757
758 2011-12-17 Cary Coutant <ccoutant@google.com>
759
760 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
761 * resolve.cc (Symbol_table::resolve): Likewise.
762 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
763 arrays.
764 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
765
766 2011-12-16 Ian Lance Taylor <iant@google.com>
767
768 * output.h (Output_data_reloc_generic::add): Only call
769 add_dynamic_reloc if this is a dynamic reloc section.
770
771 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
772
773 PR gold/13505
774 * target-reloc.h (apply_relocation): Replace <64, false> with
775 <size, big_endian>.
776
777 2011-11-25 Nick Clifton <nickc@redhat.com>
778
779 * po/it.po: New Italian translation.
780
781 2011-11-17 Sterling Augustine <saugustine@google.com>
782
783 * script.cc (script_include_directive): Implement.
784 (read_script_file): New local variables name and search_path. Update
785 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
786 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
787 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
788
789 2011-11-11 Sterling Augustine <saugustine@google.com>
790
791 * yyscript.y (section_cmd): Add support for INCLUDE directive.
792 (file_or_sections_cmd): Likewise.
793
794 2011-11-11 Doug Kwan <dougkwan@google.com>
795
796 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
797 if --just-symbols is given.
798
799 2011-11-10 Doug Kwan <dougkwan@google.com>
800
801 PR gold/13362
802 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
803 when processing data relocs.
804 * reloc.h (Relocate_functions::rel_unaligned): New method.
805 (Relocate_functions::pcrel_unaligned): Ditto.
806 (Relocate_functions::rel32_unaligned): Ditto.
807 (Relocate_functions::pcrel32_unaligned): Ditto.
808
809 2011-11-09 Doug Kwan <dougkwan@google.com>
810
811 PR gold/13362
812 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
813 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
814 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
815 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
816 (Relocate_functions::rel_unaligned): New.
817 (Relocate_functions::rel32_unaligned): New.
818 * target-reloc.h (relocate_for_relocatable): Add code to handle
819 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
820 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
821 arm_unaligned_reloc_r): New targets.
822 * testsuite/Makefile.in: Regenerate.
823 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
824 linking.
825
826 2011-11-02 Ian Lance Taylor <iant@google.com>
827
828 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
829 NATIVE_LINKER.
830 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
831 * options.cc (General_options::finalize): Use library search path
832 from configure script if specified. If not native and no sysroot,
833 only search TOOLLIBDIR.
834 * options.h (Search_directory::Search_directory): Change name to
835 const std::string&.
836 (General_options::add_to_library_path_with_sysroot): Change arg to
837 const std::string&.
838 * configure, Makefile.in, config.in: Rebuild.
839
840 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
841
842 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
843 we are working around the ARM1176 Erratum.
844 * options.h (General_options::fix_arm1176): Add option.
845 * testsuite/Makefile.am: Add testcases, and keep current ones
846 working.
847 * testsuite/Makefile.in: Regenerate.
848 * testsuite/arm_fix_1176.s: New file.
849 * testsuite/arm_fix_1176.sh: Likewise.
850
851 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
852
853 * arm.cc (Target_arm::Target_arm): Remove initialisation of
854 may_use_blx_.
855 (Target_arm::may_use_blx): Remove method.
856 (Target_arm::set_may_use_blx): Likewise.
857 (Target_arm::may_use_v4t_interworking): New method.
858 (Target_arm::may_use_v5t_interworking): Likewise.
859 (Target_arm::may_use_blx_): Remove member variable.
860 (Arm_relocate_functions::arm_branch_common): Check for v5T
861 interworking.
862 (Arm_relocate_functions::thumb_branch_common): Likewise.
863 (Reloc_stub::stub_type_for_reloc): Likewise.
864 (Target_arm::do_finalize_sections): Correct interworking checks.
865 * testsuite/Makefile.am: Add new tests.
866 * testsuite/Makefile.in: Regenerate.
867 * testsuite/arm_farcall_arm_arm.s: New test.
868 * testsuite/arm_farcall_arm_arm.sh: Likewise.
869 * testsuite/arm_farcall_arm_thumb.s: Likewise.
870 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
871 * testsuite/arm_farcall_thumb_arm.s: Likewise.
872 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
873 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
874 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
875
876 2011-10-31 Cary Coutant <ccoutant@google.com>
877
878 PR gold/13023
879 * expression.cc (Expression::eval_with_dot): Add
880 is_section_dot_assignment parameter.
881 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
882 absolute and assigning to dot within a section.
883 * script-sections.cc
884 (Output_section_element_assignment::set_section_addresses): Pass
885 dot_section to set_if_absolute.
886 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
887 as is_section_dot_assignment flag to eval_with_dot.
888 (Output_section_element_dot_assignment::set_section_addresses):
889 Likewise.
890 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
891 parameter. Also set value if relative to dot_section; set the
892 symbol's output_section.
893 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
894 parameter. Adjust all callers.
895 (Expression::eval_maybe_dot): Likewise.
896 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
897 Adjust all callers.
898 * testsuite/script_test_2.t: Test assignment of an absolute value
899 to dot within an output section element.
900
901 2011-10-31 Cary Coutant <ccoutant@google.com>
902
903 * options.h (class General_options): Add --[no-]gnu-unique options.
904 * symtab.cc (Symbol_table::sized_write_globals): Convert
905 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
906
907 2011-10-31 Cary Coutant <ccoutant@google.com>
908
909 PR gold/13359
910 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
911 unnecessary assertion.
912 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
913
914 2011-10-31 Sriraman Tallam <tmsriram@google.com>
915
916 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
917 gc_mark_symbol.
918 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
919 gc_mark_symbol.
920 Change to just keep the section associated with symbol.
921 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
922 they are externally visible and --export-dynamic is turned on.
923 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
924
925 2011-10-19 Ian Lance Taylor <iant@google.com>
926
927 PR gold/13163
928 * script-sections.cc
929 (Output_section_element_dot_assignment::needs_output_section): New
930 function.
931
932 2011-10-19 Ian Lance Taylor <iant@google.com>
933
934 PR gold/13204
935 * layout.cc (Layout::segment_precedes): Don't assert failure if a
936 --section-start option was seen.
937 * options.h (General_options::any_section_start): New function.
938
939 2011-10-18 David S. Miller <davem@davemloft.net>
940
941 PR binutils/13301
942 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
943 member to track relocation locations that have moved during TLS
944 reloc optimizations.
945 (Target_sparc::Relocate::Relocate): Initialize to NULL.
946 (Target_sparc::Relocate::relocate): Adjust view down by 4
947 bytes if it matches reloc_adjust_addr_.
948 (Target_sparc::Relocate::relocate_tls): Always move the
949 __tls_get_addr call delay slot instruction forward 4 bytes when
950 performing relaxation.
951
952 2011-10-18 Cary Coutant <ccoutant@google.com>
953
954 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
955 (Output_file::map_no_anonymous): Check for non-zero
956 return code from posix_fallocate.
957
958 2011-10-17 Cary Coutant <ccoutant@google.com>
959
960 PR gold/13245
961 * plugin.cc (is_visible_from_outside): Check for symbols
962 referenced from dynamic objects.
963 * resolve.cc (Symbol_table::resolve): Don't count references
964 from dynamic objects as references from real ELF files.
965 * testsuite/plugin_test_2.sh: Adjust expected result.
966
967 2011-10-17 Cary Coutant <ccoutant@google.com>
968
969 * gold.cc: Include timer.h.
970 (queue_middle_tasks): Stamp time.
971 (queue_final_tasks): Likewise.
972 * main.cc (main): Store timer in parameters. Print timers
973 for each pass.
974 * parameters.cc (Parameters::Parameters): Initialize timer_.
975 (Parameters::set_timer): New function.
976 (set_parameters_timer): New function.
977 * parameters.h (Parameters::set_timer): New function.
978 (Parameters::timer): New function.
979 (Parameters::timer_): New data member.
980 (set_parameters_timer): New function.
981 * timer.cc (Timer::stamp): New function.
982 (Timer::get_pass_time): New function.
983 * timer.h (Timer::stamp): New function.
984 (Timer::get_pass_time): New function.
985 (Timer::pass_times_): New data member.
986
987 2011-10-17 Cary Coutant <ccoutant@google.com>
988
989 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
990 task for members of lib groups.
991
992 2011-10-17 Cary Coutant <ccoutant@google.com>
993
994 PR gold/13288
995 * fileread.cc (File_read::find_view): Add assert.
996 (File_read::make_view): Move bounds check (replace with assert)...
997 (File_read::find_or_make_view): ... to here.
998
999 2011-10-12 Cary Coutant <ccoutant@google.com>
1000
1001 * output.cc (Output_file::open_base_file): Handle case where
1002 ::read returns less than requested size.
1003
1004 2011-10-10 Cary Coutant <ccoutant@google.com>
1005
1006 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1007 Initialize defined_count_.
1008 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1009 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1010 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1011 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1012 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1013 * incremental.h (Sized_relobj_incr::defined_count_): New data
1014 member.
1015 (Sized_incr_dynobj::defined_count_): New data member.
1016 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1017 Return zeroes instead of internal error.
1018
1019 2011-10-10 Cary Coutant <ccoutant@google.com>
1020
1021 PR gold/13249
1022 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1023 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1024 * output.h (class Output_reloc): Add use_plt_offset flag.
1025 (Output_reloc::type_): Adjust size of bit field.
1026 (Output_reloc::use_plt_offset_): New bit field.
1027 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1028 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1029 flag. Adjust all callers.
1030 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1031 creating RELATIVE relocations.
1032
1033 2011-10-10 Nick Clifton <nickc@redhat.com>
1034
1035 * po/es.po: Updated Spanish translation.
1036 * po/fi.po: Updated Finnish translation.
1037
1038 2011-10-03 Diego Novillo <dnovillo@google.com>
1039
1040 * options.cc (parse_uint): Fix dereference of RETVAL.
1041
1042 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1043
1044 * layout.h (section_order_map_): New member.
1045 (get_section_order_map): New member function.
1046 * output.cc (Output_section::add_input_section): Check for patterns
1047 only when --section-ordering-file is specified.
1048 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1049 output_sections have been formed.
1050 * layout.cc (Layout_Layout): Initialize section_order_map_.
1051 * plugin.cc (update_section_order): Store order in order_map. Do not
1052 update the order.
1053 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1054 * testsuite/Makefile.in: Regenerate.
1055 * testsuite/plugin_section_order.c: New file.
1056 * testsuite/plugin_final_layout.cc: New file.
1057 * testsuite/plugin_final_layout.sh: New file.
1058
1059 2011-09-29 Cary Coutant <ccoutant@google.com>
1060
1061 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1062 Check for NULL.
1063 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1064 symbols during incremental update.
1065 (Symbol_table::add_from_dynobj): Likewise.
1066
1067 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1068 Ian Lance Taylor <iant@google.com>
1069
1070 * symtab.cc (Symbol_table::define_special_symbol): Always
1071 canonicalize version string.
1072
1073 2011-09-26 Cary Coutant <ccoutant@google.com>
1074
1075 * gold.cc (queue_initial_tasks): Move option checks ...
1076 * options.cc (General_options::finalize): ... to here. Disable
1077 some options; make others fatal.
1078
1079 2011-09-26 Cary Coutant <ccoutant@google.com>
1080
1081 gcc PR lto/47247
1082 * plugin.cc (get_symbols_v2): New function.
1083 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1084 (is_referenced_from_outside): New function.
1085 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1086 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1087 (get_symbols): Pass version parameter.
1088 (get_symbols_v2): New function.
1089 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1090 parameter.
1091 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1092 (onload): Add LDPT_GET_SYMBOLS_V2.
1093 (all_symbols_read_hook): Use get_symbols_v2; check for
1094 LDPR_PREVAILING_DEF_IRONLY_EXP.
1095 * testsuite/plugin_test_3.sh: Update expected results.
1096
1097 2011-09-23 Simon Baldwin <simonb@google.com>
1098
1099 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1100 configuration options.
1101 * configure: Regenerate.
1102 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1103 * Makefile.in: Regenerate.
1104 * testsuite/Makefile.in: Regenerate.
1105
1106 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1107
1108 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1109
1110 2011-09-19 Cary Coutant <ccoutant@google.com>
1111
1112 * incremental.cc (can_incremental_update): Fix typo in comment.
1113 * incremental.h (can_incremental_update): Likewise.
1114
1115 2011-09-18 Cary Coutant <ccoutant@google.com>
1116
1117 * incremental.cc (can_incremental_update): New function.
1118 * incremental.h (can_incremental_update): New function.
1119 * layout.cc (Layout::init_fixed_output_section): Call it.
1120 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1121 * object.cc (Sized_relobj_file::do_layout): Call
1122 can_incremental_update.
1123
1124 2011-09-13 Cary Coutant <ccoutant@google.com>
1125
1126 * configure.ac: Check for glibc support for gnu_indirect_function
1127 support with static linking, setting automake conditional
1128 IFUNC_STATIC.
1129 * Makefile.in: Regenerate.
1130 * configure: Regenerate.
1131
1132 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1133 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1134 for IFUNC_STATIC.
1135 * testsuite/Makefile.in: Regenerate.
1136
1137 2011-09-13 Cary Coutant <ccoutant@google.com>
1138
1139 * incremental.cc (Sized_relobj_incr::do_layout): Call
1140 report_comdat_group for kept comdat sections.
1141 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1142 * testsuite/Makefile.in: Regenerate.
1143 * testsuite/incr_comdat_test_1.cc: New source file.
1144 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1145 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1146 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1147
1148 2011-09-13 Ian Lance Taylor <iant@google.com>
1149
1150 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1151 variable external_symbols_offset.
1152
1153 2011-09-12 Ian Lance Taylor <iant@google.com>
1154
1155 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1156 triggered if object has no symbols.
1157
1158 2011-09-09 David S. Miller <davem@davemloft.net>
1159
1160 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1161 (Output_fill_debug_line::do_write): Likewise.
1162
1163 2011-08-29 Cary Coutant <ccoutant@google.com>
1164
1165 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1166 casts to match formatting specs.
1167 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1168
1169 2011-08-26 Cary Coutant <ccoutant@google.com>
1170
1171 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1172 remaining hole size when allocating.
1173 (Layout::make_output_section): Set fill methods for debug sections.
1174 * layout.h (Free_list::Free_list_node): Move from private to
1175 public.
1176 (Free_list::set_min_hole_size): New function.
1177 (Free_list::begin, Free_list::end): New functions.
1178 (Free_list::min_hole_): New data member.
1179 * output.cc: Include dwarf.h.
1180 (Output_fill_debug_info::do_minimum_hole_size): New function.
1181 (Output_fill_debug_info::do_write): New function.
1182 (Output_fill_debug_line::do_minimum_hole_size): New function.
1183 (Output_fill_debug_line::do_write): New function.
1184 (Output_section::Output_section): Initialize new data member.
1185 (Output_section::set_final_data_size): Ensure patch space is larger
1186 than minimum hole size.
1187 (Output_section::do_write): Fill holes in debug sections.
1188 * output.h (Output_fill): New class.
1189 (Output_fill_debug_info): New class.
1190 (Output_fill_debug_line): New class.
1191 (Output_section::set_free_space_fill): New function.
1192 (Output_section::free_space_fill_): New data member.
1193 * testsuite/Makefile.am (incremental_test_3): Add
1194 --incremental-patch option.
1195 (incremental_test_4): Likewise.
1196 (incremental_test_5): Likewise.
1197 (incremental_test_6): Likewise.
1198 (incremental_copy_test): Likewise.
1199 (incremental_common_test_1): Likewise.
1200 * testsuite/Makefile.in: Regenerate.
1201
1202 2011-08-26 Nick Clifton <nickc@redhat.com>
1203
1204 * po/es.po: Updated Spanish translation.
1205
1206 2011-08-01 Cary Coutant <ccoutant@google.com>
1207
1208 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1209 * gold/testsuite/Makefile.in: Regenerate.
1210 * gold/testsuite/justsyms_exec.c: New source file.
1211 * gold/testsuite/justsyms_lib.c: New source file.
1212
1213 2011-08-01 Cary Coutant <ccoutant@google.com>
1214
1215 * layout.cc (Layout::set_segment_offsets): Don't realign text
1216 segment if -Ttext was specified.
1217 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1218 file type.
1219 * object.h (Sized_relobj_file::e_type): New function.
1220 (Sized_relobj_file::e_type_): New data member.
1221 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1222 base address for ET_EXEC files.
1223 * target.cc (Target::do_make_elf_object_implementation): Allow
1224 ET_EXEC files with --just-symbols option.
1225
1226 2011-07-28 Cary Coutant <ccoutant@google.com>
1227
1228 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1229 Add thread_number parameter.
1230 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1231 * workqueue-threads.cc
1232 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1233 current thread if its thread number is greater than desired thread
1234 count.
1235 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1236 Add thread_number parameter.
1237 (Workqueue::should_cancel_thread): Likewise.
1238 (Workqueue::find_runnable_or_wait): Pass thread_number to
1239 should_cancel_thread.
1240 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1241 parameter.
1242
1243 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1244
1245 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1246 only after checking if it cannot be forced local.
1247 * symtab.h (is_externally_visible): Check if the symbol is not forced
1248 local.
1249
1250 2011-07-15 Ian Lance Taylor <iant@google.com>
1251
1252 * options.h (class General_options): Add --print-output-format.
1253 Move -EL next to -EB, for better --help output.
1254 * target-select.cc: Include <cstdio>, "options.h", and
1255 "parameters.h".
1256 (Target_selector::do_target_bfd_name): New function.
1257 (print_output_format): New function.
1258 * target-select.h (class Target_selector): Update declarations.
1259 (Target_selector::target_bfd_name): New function.
1260 (print_output_format): Declare.
1261 * main.cc: Include "target-select.h".
1262 (main): Handle --print-output-format.
1263 * gold.cc: Include "target-select.h".
1264 (queue_initial_tasks): Handle --print-output-format when there are
1265 no input files.
1266 * parameters.cc (parameters_force_valid_target): Give a better
1267 error message if -EB/-EL does not match target.
1268 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1269 function.
1270
1271 2011-07-15 Ian Lance Taylor <iant@google.com>
1272
1273 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1274 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1275 (Output_data_plt_i386::do_write): Write address of .dynamic
1276 section to first entry in .got.plt section.
1277 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1278 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1279 Initialize layout_.
1280 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1281 section to first entry in .got.plt section.
1282 * layout.h (Layout::dynamic_section): New function.
1283
1284 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1285
1286 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1287 to claim_file call.
1288 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1289 input_section_position_, and input_section_glob_.
1290 (read_layout_from_file): Call function section_ordering_specified.
1291 * layout.h (is_section_ordering_specified): New function.
1292 (section_ordering_specified): New function.
1293 (section_ordering_specified_): New boolean member.
1294 * main.cc(main): Call load_plugins after layout object is defined.
1295 * output.cc (Output_section::add_input_section): Use
1296 function section_ordering_specified to check if section ordering is
1297 needed.
1298 * output.cc (Output_section::add_relaxed_input_section): Use
1299 function section_ordering_specified to check if section ordering is
1300 needed.
1301 (Output_section::update_section_layout): New function.
1302 (Output_section::sort_attached_input_sections): Check if input section
1303 must be reordered.
1304 * output.h (Output_section::update_section_layout): New function.
1305 * plugin.cc (get_section_count): New function.
1306 (get_section_type): New function.
1307 (get_section_name): New function.
1308 (get_section_contents): New function.
1309 (update_section_order): New function.
1310 (allow_section_ordering): New function.
1311 (Plugin::load): Add the new interfaces to the transfer vector.
1312 (Plugin_manager::load_plugins): New parameter.
1313 (Plugin_manager::all_symbols_read): New parameter.
1314 (Plugin_manager::claim_file): New parameter. Save the elf object for
1315 unclaimed objects.
1316 (Plugin_manager::get_elf_object): New function.
1317 (Plugin_manager::get_view): Change to directly use the bool to check
1318 if get_view is called from claim_file_hook.
1319 * plugin.h (input_objects): New function
1320 (Plugin__manager::load_plugins): New parameter.
1321 (Plugin_manager::claim_file): New parameter.
1322 (Plugin_manager::get_elf_object): New function.
1323 (Plugin_manager::in_claim_file_handler): New function.
1324 (Plugin_manager::in_claim_file_handler_): New member.
1325 (layout): New function.
1326 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1327 handler with an extra parameter. Make the elf object before calling
1328 claim_file handler.
1329 * testsuite/plugin_test.c (get_section_count): New function pointer.
1330 (get_section_type): New function pointer.
1331 (get_section_name): New function pointer.
1332 (get_section_contents): New function pointer.
1333 (update_section_order): New function pointer.
1334 (allow_section_ordering): New function pointer.
1335 (onload): Check if the new interfaces exist.
1336
1337 2011-07-13 Ian Lance Taylor <iant@google.com>
1338
1339 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1340 relro section.
1341 * x86_64.cc (Target_x86_64::got_section): Likewise.
1342 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1343 (relro_now_test_SOURCES): New variable.
1344 (relro_now_test_DEPENDENCIES): New variable.
1345 (relro_now_test_LDFLAGS): New variable.
1346 (relro_now_test_LDADD): New variable.
1347 (relro_now_test.so): New target.
1348 * testsuite/Makefile.in: Rebuild.
1349
1350 2011-07-12 Ian Lance Taylor <iant@google.com>
1351
1352 PR gold/12980
1353 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1354 GLOB_DAT relocation rather than a RELATIVE relocation for a
1355 protected symbol when creating a shared library.
1356 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1357 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1358 * testsuite/protected_main_1.cc (main): Test that protected
1359 function has same address.
1360
1361 2011-07-11 Ian Lance Taylor <iant@google.com>
1362
1363 PR gold/12979
1364 * options.h (class General_options): Add -Bgroup.
1365 * options.cc (General_options::finalize): If -Bgroup is set,
1366 default to --unresolved-symbols=report-all.
1367 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1368 * target-reloc.h (issue_undefined_symbol_error): Handle
1369 --unresolved-symbols=report-all.
1370
1371 2011-07-08 Ian Lance Taylor <iant@google.com>
1372
1373 PR gold/11985
1374 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1375 if linker script discards key sections.
1376 (Layout::create_dynamic_symtab): Likewise.
1377 (Layout::assign_local_dynsym_offsets): Likewise.
1378 (Layout::sized_create_version_sections): Likewise.
1379 (Layout::create_interp): Likewise.
1380 (Layout::finish_dynamic_section): Likewise.
1381 (Layout::set_dynamic_symbol_size): Likewise.
1382
1383 2011-07-08 Ian Lance Taylor <iant@google.com>
1384
1385 PR gold/12386
1386 * options.h (class General_options): Add --unresolved-symbols.
1387 * target-reloc.h (issue_undefined_symbol_error): Check
1388 --unresolved-symbols. Add comments.
1389
1390 2011-07-08 Ian Lance Taylor <iant@google.com>
1391
1392 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1393 expression more complex.
1394
1395 2011-07-08 Ian Lance Taylor <iant@google.com>
1396
1397 PR gold/11317
1398 * target-reloc.h (issue_undefined_symbol_error): New inline
1399 function, broken out of relocate_section.
1400 (relocate_section): Call issue_undefined_symbol_error.
1401 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1402 there is no TLS segment if we are about to issue an undefined
1403 symbol error.
1404 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1405
1406 2011-07-08 Ian Lance Taylor <iant@google.com>
1407
1408 PR gold/12279
1409 * resolve.cc (Symbol_table::should_override): Add fromtype
1410 parameter. Change all callers. Give error when linking together
1411 TLS and non-TLS symbol.
1412 (Symbol_table::should_override_with_special): Add fromtype
1413 parameter. Change all callers.
1414 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1415 there is no TLS segment if we have reported some errors.
1416 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1417
1418 2011-07-08 Ian Lance Taylor <iant@google.com>
1419
1420 PR gold/12372
1421 * target.h (Target::plt_address_for_global): New function.
1422 (Target::plt_address_for_local): New function.
1423 (Target::plt_section_for_global): Remove.
1424 (Target::plt_section_for_local): Remove.
1425 (Target::do_plt_address_for_global): New virtual function.
1426 (Target::do_plt_address_for_local): New virtual function.
1427 (Target::do_plt_section_for_global): Remove.
1428 (Target::do_plt_section_for_local): Remove.
1429 (Target::register_global_plt_entry): Add Symbol_table and Layout
1430 parameters.
1431 * output.cc (Output_data_got::Got_entry::write): Use
1432 plt_address_for_global and plt_address_for_local.
1433 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1434 address of output section.
1435 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1436 got_irelative_, and irelative_count_ fields. Update
1437 declarations.
1438 (Output_data_plt_i386::has_irelative_section): New function.
1439 (Output_data_plt_i386::entry_count): Add irelative_count_.
1440 (Output_data_plt_i386::set_final_data_size): Likewise.
1441 (class Target_i386): Add got_irelative_ and rel_irelative_
1442 fields. Update declarations.
1443 (Target_i386::Target_i386): Initialize new fields.
1444 (Target_i386::do_plt_address_for_global): New function replacing
1445 do_plt_section_for_global.
1446 (Target_i386::do_plt_address_for_local): New function replacing
1447 do_plt_section_for_local.
1448 (Target_i386::got_section): Create got_irelative_.
1449 (Target_i386::rel_irelative_section): New function.
1450 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1451 fields. Don't define __rel_iplt_{start,end}.
1452 (Output_data_plt_i386::add_entry): Add symtab and layout
1453 parameters. Change all callers. Use different PLT and GOT for
1454 IFUNC symbols.
1455 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1456 layout parameters. Change all callers. Use different PLT and
1457 GOT.
1458 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1459 (Output_data_plt_i386::rel_irelative): New function.
1460 (Output_data_plt_i386::address_for_global): New function.
1461 (Output_data_plt_i386::address_for_local): New function.
1462 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1463 IRELATIVE GOT when changing IFUNC GOT entries.
1464 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1465 reloc.
1466 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1467 if we didn't create an IRELATIVE GOT.
1468 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1469 plt_address_for_local.
1470 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1471 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1472 got_irelative_, and irelative_count_ fields. Update
1473 declarations.
1474 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1475 Initialize new fields. Remove symtab parameter. Change all
1476 callers.
1477 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1478 irelative_count_.
1479 (Output_data_plt_x86_64::has_irelative_section): New function.
1480 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1481 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1482 fields. Update declarations.
1483 (Target_x86_64::Target_x86_64): Initialize new fields.
1484 (Target_x86_64::do_plt_address_for_global): New function replacing
1485 do_plt_section_for_global.
1486 (Target_x86_64::do_plt_address_for_local): New function replacing
1487 do_plt_section_for_local.
1488 (Target_x86_64::got_section): Create got_irelative_.
1489 (Target_x86_64::rela_irelative_section): New function.
1490 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1491 all callers. Don't create __rel_iplt_{start,end}.
1492 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1493 parameters. Change all callers. Use different PLT and GOT for
1494 IFUNC symbols.
1495 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1496 layout parameters. Change all callers. Use different PLT and
1497 GOT.
1498 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1499 parameters. Change all callers. Use different PLT and GOT for
1500 IFUNC symbols.
1501 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1502 (Output_data_plt_x86_64::rela_irelative): New function.
1503 (Output_data_plt_x86_64::address_for_global): New function.
1504 (Output_data_plt_x86_64::address_for_local): New function.
1505 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1506 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1507 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1508 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1509 parameters.
1510 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1511 reloc.
1512 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1513 symbols if we didn't create an IRELATIVE GOT.
1514 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1515 plt_address_for_local.
1516 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1517 * testsuite/ifuncvar1.c: New test file.
1518 * testsuite/ifuncvar2.c: New test file.
1519 * testsuite/ifuncvar3.c: New test file.
1520 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1521 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1522 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1523 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1524 * testsuite/Makefile.in: Rebuild.
1525
1526 2011-07-07 Cary Coutant <ccoutant@google.com>
1527
1528 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1529 (two_file_test_1_ndebug.o): Likewise.
1530 (two_file_test_1b_ndebug.o): Likewise.
1531 (two_file_test_2_ndebug.o): Likewise.
1532 (two_file_test_main_ndebug.o): Likewise.
1533 (incremental_test_2): Link with no-debug versions.
1534
1535 2011-07-06 Cary Coutant <ccoutant@google.com>
1536
1537 * gold/incremental.cc
1538 (Output_section_incremental_inputs::write_info_blocks): Check for
1539 hidden and internal symbols.
1540
1541 2011-07-06 Cary Coutant <ccoutant@google.com>
1542
1543 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1544 Check disposition for startup file.
1545 (Incremental_inputs::report_command_line): Ignore
1546 --incremental-startup-unchanged option.
1547 * options.cc (General_options::parse_incremental_startup_unchanged):
1548 New function.
1549 (General_options::General_options): Initialize new data member.
1550 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1551 (General_options): Add --incremental-startup-unchanged option.
1552 (General_options::incremental_startup_disposition): New function.
1553 (General_options::incremental_startup_disposition_): New data member.
1554
1555 2011-07-06 Cary Coutant <ccoutant@google.com>
1556
1557 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1558 input file index to Script_info ctor.
1559 (Sized_incremental_binary::do_file_has_changed): Find the
1560 command-line argument for files named in scripts.
1561 * incremental.h (Script_info::Script_info): New ctor
1562 with input file index.
1563 (Script_info::input_file_index): New function.
1564 (Script_info::input_file_index_): New data member.
1565 (Incremental_binary::get_library): Add const.
1566 (Incremental_binary::get_script_info): Add const.
1567 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1568 * testsuite/Makefile.am (incremental_test_5): New test case.
1569 (incremental_test_6): New test case.
1570 * testsuite/Makefile.in: Regenerate.
1571
1572 2011-07-06 Cary Coutant <ccoutant@google.com>
1573
1574 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1575 debug output when command lines differ.
1576
1577 2011-07-06 Cary Coutant <ccoutant@google.com>
1578
1579 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1580 --incremental-patch option.
1581 * layout.cc (Free_list::allocate): Extend allocation beyond original
1582 end if enabled.
1583 (Layout::make_output_section): Mark sections that should get
1584 patch space.
1585 * options.cc (parse_percent): New function.
1586 * options.h (parse_percent): New function.
1587 (DEFINE_percent): New macro.
1588 (General_options): Add --incremental-patch option.
1589 * output.cc (Output_section::Output_section): Initialize new data
1590 members.
1591 (Output_section::add_input_section): Print section name when out
1592 of patch space.
1593 (Output_section::add_output_section_data): Likewise.
1594 (Output_section::set_final_data_size): Add patch space when
1595 doing --incremental-full.
1596 (Output_section::do_reset_address_and_file_offset): Remove patch
1597 space.
1598 (Output_segment::set_section_list_addresses): Print debug output
1599 only if --incremental-update.
1600 * output.h (Output_section::set_is_patch_space_allowed): New function.
1601 (Output_section::is_patch_space_allowed_): New data member.
1602 (Output_section::patch_space_): New data member.
1603 * parameters.cc (Parameters::incremental_full): New function.
1604 * parameters.h (Parameters::incremental_full): New function
1605 * testsuite/Makefile.am (incremental_test_2): Add test for
1606 --incremental-patch option.
1607 * testsuite/Makefile.in: Regenerate.
1608 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1609 (t18): Remove function body.
1610
1611 2011-07-05 Doug Kwan <dougkwan@google.com>
1612
1613 PR gold/12771
1614 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1615 Arm_Address type for relocation result.
1616 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1617 overflow check.
1618 (Arm_relocate_functions::abs32): Use unaligned access.
1619 (Arm_relocate_functions::rel32): Ditto.
1620 (Arm_relocate_functions::prel31): Ditto.
1621 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1622 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1623 static data relocations.
1624 * testsuite/Makefile.in: Regnerate.
1625 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1626
1627 2011-07-05 Ian Lance Taylor <iant@google.com>
1628
1629 PR gold/12392
1630 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1631 symbols if necessary.
1632 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1633
1634 2011-07-05 Ian Lance Taylor <iant@google.com>
1635
1636 PR gold/12952
1637 * resolve.cc (Symbol::override_base_with_special): Simply override
1638 version with special symbol version, ignoring previous version.
1639
1640 2011-07-05 Ian Lance Taylor <iant@google.com>
1641
1642 * object.cc (Sized_relobj_file::include_section_group): Add
1643 information to comment about signature location.
1644
1645 2011-07-02 Ian Lance Taylor <iant@google.com>
1646
1647 PR gold/12957
1648 * options.h (class General_options): Add -f and -F.
1649 * options.cc (General_options::finalize): Fatal error if -f/-F
1650 are used without -shared.
1651 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1652
1653 2011-07-02 Ian Lance Taylor <iant@google.com>
1654
1655 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1656
1657 2011-07-01 Ian Lance Taylor <iant@google.com>
1658
1659 PR gold/12525
1660 PR gold/12952
1661 * resolve.cc (Symbol::override_base_with_special): Don't override
1662 the version if the overriding symbol has a different name.
1663 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1664 all callers. If we give an error about an undefined version,
1665 define the base version if necessary.
1666 * dynobj.h (class Versions): Update declaration.
1667 * testsuite/weak_alias_test_5.cc: New file.
1668 * testsuite/weak_alias_test.script: New file.
1669 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1670 and versioned_alias have the right value, and call t2.
1671 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1672 weak_alias_test_5.so.
1673 (weak_alias_test_LDADD): Likewise.
1674 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1675 * testsuite/Makefile.in: Rebuild.
1676
1677 2011-07-01 Ian Lance Taylor <iant@google.com>
1678
1679 PR gold/12525
1680 * options.h (class General_options): Support -z notext.
1681 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1682 -Wl,-z,notext.
1683 (two_file_shared_nonpic.so): Likewise.
1684 (two_file_shared_mixed.so): Likewise.
1685 (two_file_shared_mixed_1.so): Likewise.
1686 (weak_undef_lib_nonpic.so): Likewise.
1687 (alt/weak_undef_lib_nonpic.so): Likewise.
1688 (tls_test_shared_nonpic.so): Likewise.
1689 * testsuite/Makefile.in: Rebuild.
1690
1691 2011-07-01 Ian Lance Taylor <iant@google.com>
1692
1693 PR gold/12525
1694 * configure.ac: Test whether static linking works, setting
1695 the automake conditional HAVE_STATIC.
1696 * testsuite/Makefile.am: Disable tests using -static if
1697 HAVE_STATIC is not true.
1698 * configure, testsuite/Makefile.in: Rebuild.
1699
1700 2011-07-01 Ian Lance Taylor <iant@google.com>
1701
1702 PR gold/12525
1703 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1704 Assert if we see DW_EH_PE_indirect.
1705 * target.h (Target::ehframe_datarel_base): New function.
1706 (Target::do_ehframe_datarel_base): New target function.
1707 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1708 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1709 function.
1710
1711 2011-07-01 Ian Lance Taylor <iant@google.com>
1712
1713 PR gold/12571
1714 * options.h (class General_options): Add
1715 --ld-generated-unwind-info.
1716 * ehframe.cc (Fde::write): Add address parameter. Change all
1717 callers. If associated with PLT, fill in address and size.
1718 (Cie::set_output_offset): Only add merge mapping if there is an
1719 object.
1720 (Cie::write): Add address parameter. Change all callers.
1721 (Eh_frame::add_ehframe_for_plt): New function.
1722 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1723 input_offset_ fields into union u_, with new plt field.
1724 (Fde::Fde): Adjust for new union field.
1725 (Fde::Fde) [Output_data version]: New constructor.
1726 (Fde::add_mapping): Only add merge mapping if there is an object.
1727 (class Cie): Update declarations.
1728 (class Eh_frame): Declare add_ehframe_for_plt.
1729 * layout.cc (Layout::layout_eh_frame): Break out code into
1730 make_eh_frame_section, and call it.
1731 (Layout::make_eh_frame_section): New function.
1732 (Layout::add_eh_frame_for_plt): New function.
1733 * layout.h (class Layout): Update declarations.
1734 * merge.cc (Merge_map::add_mapping): Add assertion.
1735 * i386.cc: Include "dwarf.h".
1736 (class Output_data_plt_i386): Make first_plt_entry,
1737 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1738 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1739 and plt_eh_frame_fde.
1740 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1741 boundary. Call add_eh_frame_for_plt if appropriate.
1742 * x86_64.cc: Include "dwarf.h".
1743 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1744 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1745 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1746 and plt_eh_frame_fde.
1747 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1748 appropriate.
1749
1750 2011-06-29 Ian Lance Taylor <iant@google.com>
1751
1752 PR gold/12629
1753 * object.cc (Sized_relobj_file::layout_section): Change shdr
1754 parameter to be const.
1755 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1756 out of do_layout.
1757 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1758 appropriate. Call layout_eh_frame_section.
1759 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1760 sections.
1761 * object.h (class Sized_relobj_file): Update declarations.
1762
1763 2011-06-29 Ian Lance Taylor <iant@google.com>
1764
1765 PR gold/12652
1766 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1767 modifier.
1768 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1769
1770 2011-06-29 Ian Lance Taylor <iant@google.com>
1771
1772 PR gold/12675
1773 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1774 SHT_X86_64_UNWIND.
1775 * layout.cc (Layout::layout_eh_frame): Likewise.
1776
1777 2011-06-29 Ian Lance Taylor <iant@google.com>
1778
1779 PR gold/12695
1780 * layout.cc (Layout::symtab_section_shndx): New function.
1781 * layout.h (class Layout): Declare symtab_section_shndx.
1782 * output.cc (Output_section::write_header): Call it.
1783
1784 2011-06-29 Ian Lance Taylor <iant@google.com>
1785
1786 PR gold/12818
1787 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1788 symbols which are not used in a relocation.
1789
1790 2011-06-28 Ian Lance Taylor <iant@google.com>
1791
1792 PR gold/12898
1793 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1794 script create indistinguishable segments.
1795 (Layout::set_segment_offsets): Use stable_sort when sorting
1796 segments. Pass this to Compare_segments constructor.
1797 * layout.h (class Layout): Make segment_precedes non-static.
1798 (class Compare_segments): Change from struct to class. Add
1799 layout_ field. Add constructor.
1800 * script-sections.cc
1801 (Script_sections::attach_sections_using_phdrs_clause): Rename
1802 local orphan to is_orphan. Don't report failure to put empty
1803 section in segment. On attachment failure, report name of
1804 section, and attach to first PT_LOAD segment.
1805
1806 2011-06-28 Ian Lance Taylor <iant@google.com>
1807
1808 PR gold/12934
1809 * target-select.cc (Target_selector::Target_selector): Add
1810 emulation parameter. Change all callers.
1811 (select_target_by_bfd_name): Rename from select_target_by_name.
1812 Change all callers.
1813 (select_target_by_emulation): New function.
1814 (supported_emulation_names): New function.
1815 * target-select.h (class Target_selector): Add emulation_ field.
1816 Update declarations.
1817 (Target_selector::recognize_by_bfd_name): Rename from
1818 recognize_by_name. Change all callers.
1819 (Target_selector::supported_bfd_names): Rename from
1820 supported_names. Change all callers.
1821 (Target_selector::recognize_by_emulation): New function.
1822 (Target_selector::supported_emulations): New function.
1823 (Target_selector::emulation): New function.
1824 (Target_selector::do_recognize_by_bfd_name): Rename from
1825 do_recognize_by_name. Change all callers.
1826 (Target_selector::do_supported_bfd_names): Rename from
1827 do_supported_names. Change all callers.
1828 (Target_selector::do_recognize_by_emulation): New function.
1829 (Target_selector::do_supported_emulations): New function.
1830 (select_target_by_bfd_name): Change name in declaration.
1831 (select_target_by_emulation): Declare.
1832 (supported_emulation_names): Declare.
1833 * parameters.cc (parameters_force_valid_target): Try to find
1834 target based on emulation from -m option.
1835 * options.h (class General_options): Change doc string for -m.
1836 * options.cc (help): Print emulations.
1837 (General_options::parse_V): Likewise.
1838 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1839 Add emulation parameter. Change all callers.
1840
1841 2011-06-28 Ian Lance Taylor <iant@google.com>
1842
1843 * target.h (class Target): Add osabi_ field.
1844 (Target::osabi): New function.
1845 (Target::set_osabi): New function.
1846 (Target::Target): Initialize osabi_.
1847 (Target::do_adjust_elf_header): Make pure virtual.
1848 (Sized_target::do_adjust_elf_header): Declare.
1849 * target.cc (Sized_target::do_adjust_elf_header): New function.
1850 (class Sized_target): Instantiate all versions.
1851 * freebsd.h (class Target_freebsd): Remove.
1852 (Target_selector_freebsd::do_recognize): Call set_osabi on
1853 Target.
1854 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1855 (Target_selector_freebsd::set_osabi): Remove.
1856 * i386.cc (class Target_i386): Inherit from Sized_target rather
1857 than Target_freebsd.
1858 * x86_64.cc (class Target_x86_64): Likewise.
1859
1860 2011-06-28 Ian Lance Taylor <iant@google.com>
1861
1862 * target.h (Target::can_check_for_function_pointers): Rewrite.
1863 Make non-virtual.
1864 (Target::can_icf_inline_merge_sections): Likewise.
1865 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1866 (Target::Target_info): Add can_icf_inline_merge_sections field.
1867 (Target::do_can_check_for_function_pointers): New virtual
1868 function.
1869 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1870 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1871 from can_check_for_function_pointers, move in file.
1872 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1873 section_may_have_icf_unsafe_poineters, move in file.
1874 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1875 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1876 Rename from can_check_for_function_pointers, move in file.
1877 (Target_i386::can_icf_inline_merge_sections): Remove.
1878 (Target_i386::i386_info): Initialize
1879 can_icf_inline_merge_sections.
1880 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1881 Initialize can_icf_inline_merge_sections.
1882 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1883 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1884 Rename from can_check_for_function_pointers, move in file.
1885 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1886 (Target_x86_64::x86_64_info): Initialize
1887 can_icf_inline_merge_sections.
1888 * testsuite/testfile.cc (Target_test::test_target_info):
1889 Likewise.
1890 * icf.cc (get_section_contents): Correct formatting.
1891
1892 2011-06-27 Ian Lance Taylor <iant@google.com>
1893
1894 * symtab.cc (Symbol::versioned_name): New function.
1895 (Symbol_table::add_to_final_symtab): Use versioned_name when
1896 appropriate.
1897 (Symbol_table::sized_write_symbol): Likewise.
1898 * symtab.h (class Symbol): Declare versioned_name.
1899 * stringpool.h (class Stringpool_template): Add variant of add
1900 which takes a std::basic_string.
1901 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1902 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1903 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1904 (ver_test_12.o): New target.
1905 * testsuite/Makefile.in: Rebuild.
1906
1907 2011-06-27 Doug Kwan <dougkwan@google.com>
1908
1909 * arm.cc (Arm_relocate_functions::thm_jump8,
1910 Arm_relocate_functions::thm_jump11): Use a wider signed
1911 type to compute offset.
1912 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1913 arm_thm_jump8.
1914 * testsuite/Makefile.in: Regenerate.
1915 * testsuite/arm_branch_in_range.sh: Check test results of
1916 arm_thm_jump11 and arm_thm_jump8.
1917 * testsuite/arm_thm_jump11.s: New test source file.
1918 * testsuite/arm_thm_jump11.t: New linker script.
1919 * testsuite/arm_thm_jump8.s: New test source file.
1920 * testsuite/arm_thm_jump8.t: New linker script.
1921
1922 2011-06-24 Ian Lance Taylor <iant@google.com>
1923
1924 * layout.cc: Include "object.h".
1925 (ctors_sections_in_init_array): New static variable.
1926 (Layout::is_ctors_in_init_array): New function.
1927 (Layout::layout): Add entry to ctors_sections_in_init_array if
1928 appropriate.
1929 * layout.h (class Layout): Declare is_ctors_in_init_array.
1930 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1931 is_ctors_reverse_view is set.
1932 (Sized_relobj_file::write_sections): Add layout parameter. Change
1933 all callers. Set is_ctors_reverse_view field of View_size.
1934 (Sized_relobj_file::reverse_words): New function.
1935 * object.h (Sized_relobj_file::View_size): Add
1936 is_ctors_reverse_view field.
1937 (class Sized_relobj_file): Update declarations.
1938 * testsuite/initpri3.c: New test.
1939 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1940 initpri3b.
1941 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1942 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1943 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1944 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1945 * testsuite/Makefile.in: Rebuild.
1946
1947 2011-06-24 Cary Coutant <ccoutant@google.com>
1948
1949 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1950 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1951 (debug_msg_cdebug.err): New targets.
1952 * testsuite/Makefile.in: Regenerate.
1953 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1954 Fix checks for link with shared library.
1955
1956 2011-06-24 Doug Kwan <dougkwan@google.com>
1957
1958 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1959 skip empty text sections.
1960 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1961
1962 2011-06-22 Ian Lance Taylor <iant@google.com>
1963
1964 PR gold/12910
1965 * options.h (class General_options): Add --ctors-in-init-array.
1966 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1967 friends as SHT_PROGBITS for merging sections.
1968 (Layout::layout): Remove special handling of .init_array and
1969 friends. Don't sort if doing relocatable link. Sort for .ctors
1970 and .dtors if ctors_in_init_array.
1971 (Layout::make_output_section): Force correct section types for
1972 .init_array and friends. Don't sort if doing relocatable link,
1973 Don't sort .ctors and .dtors if ctors_in_init_array.
1974 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1975 (Layout::output_section_name): Add relobj parameter. Change all
1976 callers. Handle .ctors. and .dtors. in code rather than table.
1977 Handle .ctors and .dtors if ctors_in_init_array.
1978 (Layout::match_file_name): New function, moved from output.cc.
1979 * layout.h (class Layout): Update declarations.
1980 * output.cc: Include "layout.h".
1981 (Input_section_sort_entry::get_priority): New function.
1982 (Input_section_sort_entry::match_file_name): Just call
1983 Layout::match_file_name.
1984 (Output_section::Input_section_sort_init_fini_compare::operator()):
1985 Handle .ctors and .dtors. Sort by explicit priority rather than
1986 by name.
1987 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1988 * testsuite/initpri2.c: New test.
1989 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1990 (check_PROGRAMS): Add initpri2.
1991 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1992 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1993 * configure, testsuite/Makefile.in: Rebuild.
1994
1995 2011-06-19 Ian Lance Taylor <iant@google.com>
1996
1997 PR gold/12880
1998 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1999 .interp section to a PT_INTERP segment even if we have seen a
2000 --dynamic-linker option. Don't do it if we have seen a PHDRS
2001 clause in a linker script.
2002 (Layout::finalize): Don't create a .interp section if we've
2003 already create a PT_INTERP segment.
2004 (Layout::create_interp): Always call choose_output_section (revert
2005 patch of 2011-06-17). Don't create PT_INTERP segment.
2006 * script-sections.cc
2007 (Script_sections::create_note_and_tls_segments): Add a .interp
2008 section to a PT_INTERP segment even if we have seen a
2009 --dynamic-linker option.
2010
2011 2011-06-18 Ian Lance Taylor <iant@google.com>
2012
2013 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2014 merely because a non-PT_LOAD segment has a dynamic reloc.
2015
2016 2011-06-18 Ian Lance Taylor <iant@google.com>
2017
2018 * layout.cc (Layout::finish_dynamic_section): Don't create
2019 DT_FLAGS entry if not needed.
2020
2021 2011-06-18 Ian Lance Taylor <iant@google.com>
2022
2023 PR gold/12745
2024 * layout.cc (Layout::layout_eh_frame): Correct handling of
2025 writable .eh_frame section.
2026
2027 2011-06-17 Ian Lance Taylor <iant@google.com>
2028
2029 PR gold/12893
2030 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2031 symbol is redefined with the exact same object and value.
2032
2033 2011-06-17 Ian Lance Taylor <iant@google.com>
2034
2035 PR gold/12880
2036 * layout.h (class Layout): Add interp_segment_ field.
2037 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2038 (Layout::attach_allocated_section_to_segment): If making shared
2039 library, put .interp section in PT_INTERP segment.
2040 (Layout::finalize): Also call create_interp if -dynamic-linker
2041 option was used.
2042 (Layout::create_interp): Assert that there is no PT_INTERP
2043 segment. If not using a SECTIONS clause, use make_output_section.
2044 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2045 * script-sections.cc
2046 (Script_sections::create_note_and_tls_segments): If making shared
2047 library, put .interp section in PT_INTERP segment.
2048
2049 2011-06-17 Ian Lance Taylor <iant@google.com>
2050
2051 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2052 when making a shared library.
2053
2054 2011-06-17 Ian Lance Taylor <iant@google.com>
2055
2056 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2057 parameter. Change all callers. Don't issue warning about PC32
2058 against locally defined symbol.
2059
2060 2011-06-16 Ian Lance Taylor <iant@google.com>
2061
2062 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2063 occurs in same object.
2064
2065 2011-06-14 Alan Modra <amodra@gmail.com>
2066
2067 * po/POTFILES.in: Regenerate.
2068
2069 2011-06-09 Ian Lance Taylor <iant@google.com>
2070
2071 * script-sections.cc
2072 (Orphan_output_section::set_section_addresses): For a relocatable
2073 link set address to 0.
2074
2075 2011-06-09 Cary Coutant <ccoutant@google.com>
2076
2077 PR gold/12804
2078 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2079 used with --compress-debug-sections.
2080 * gold/object.cc (Sized_relobj_file::do_layout): Report
2081 uncompressed size of compressed input sections.
2082
2083 2011-06-08 Cary Coutant <ccoutant@google.com>
2084
2085 PR gold/12804
2086 * testsuite/two_file_test_2_v1.cc: Change initialization of
2087 v2 to keep it in .data.
2088
2089 2011-06-07 Cary Coutant <ccoutant@google.com>
2090
2091 * common.cc (Symbol_table::do_allocate_commons_list): Call
2092 gold_fallback.
2093 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2094 (Errors::fallback): New function.
2095 (gold_fallback): New function.
2096 * errors.h (Errors::fallback): New function.
2097 * gold.cc (gold_exit): Change status parameter to enum; adjust
2098 all callers.
2099 (queue_initial_tasks): Call gold_fallback.
2100 * gold.h: Include cstdlib.
2101 (Exit_status): New enum type.
2102 (gold_exit): Change status parameter to enum.
2103 (gold_fallback): New function.
2104 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2105 (Layout::create_symtab_sections): Likewise.
2106 (Layout::create_shdrs): Likewise.
2107 * main.cc (main): Adjust call to gold_exit.
2108 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2109 (Output_data_got::add_got_entry_pair): Likewise.
2110 (Output_section::add_input_section): Likewise.
2111 (Output_section::add_output_section_data): Likewise.
2112 (Output_segment::set_section_list_addresses): Likewise.
2113 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2114
2115 2011-06-07 Cary Coutant <ccoutant@google.com>
2116
2117 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2118 for incremental links.
2119 * output.cc (Output_segment::set_section_list_addresses): Remove
2120 FIXME and test for TLS or BSS.
2121
2122 2011-06-07 Cary Coutant <ccoutant@google.com>
2123
2124 * testsuite/Makefile.am: Add incremental_copy_test,
2125 incremental_common_test_1.
2126 * testsuite/Makefile.in: Regenerate.
2127 * testsuite/common_test_1_v1.c: New source file.
2128 * testsuite/common_test_1_v2.c: New source file.
2129 * testsuite/copy_test_v1.cc: New source file.
2130
2131 2011-06-07 Cary Coutant <ccoutant@google.com>
2132
2133 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2134 update, allocate common from bss section's free list.
2135 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2136 linker-defined symbols.
2137 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2138 Skip GOT and PLT entries that are no longer referenced.
2139 (Output_section_incremental_inputs::write_info_blocks): Mark
2140 linker-defined symbols.
2141 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2142 * output.cc (Output_section::allocate): New function.
2143 * output.h (Output_section::allocate): New function.
2144 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2145 linker-defined symbols.
2146 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2147 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2148 (Symbol::init_base_output_data): Likewise.
2149 (Symbol::init_base_output_segment): Likewise.
2150 (Symbol::init_base_constant): Likewise.
2151 (Sized_symbol::init_output_data): Likewise.
2152 (Sized_symbol::init_output_segment): Likewise.
2153 (Sized_symbol::init_constant): Likewise.
2154 (Symbol_table::do_define_in_output_data): Likewise.
2155 (Symbol_table::do_define_in_output_segment): Likewise.
2156 (Symbol_table::do_define_as_constant): Likewise.
2157 * symtab.h (Symbol::is_predefined): New function.
2158 (Symbol::init_base_output_data): Add is_predefined parameter.
2159 (Symbol::init_base_output_segment): Likewise.
2160 (Symbol::init_base_constant): Likewise.
2161 (Symbol::is_predefined_): New data member.
2162 (Sized_symbol::init_output_data): Add is_predefined parameter.
2163 (Sized_symbol::init_output_segment): Likewise.
2164 (Sized_symbol::init_constant): Likewise.
2165 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2166
2167 2011-06-07 Cary Coutant <ccoutant@google.com>
2168
2169 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2170 instead of emit_copy_reloc.
2171 (Copy_relocs::emit_copy_reloc): Refactor.
2172 (Copy_relocs::make_copy_reloc): New function.
2173 (Copy_relocs::add_copy_reloc): Remove.
2174 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2175 section.
2176 (Copy_relocs::make_copy_reloc): New function.
2177 (Copy_relocs::add_copy_reloc): Remove.
2178 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2179 unchanged input files.
2180 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2181 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2182 Reserve BSS space for COPY relocations.
2183 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2184 (Output_section_incremental_inputs::write_info_blocks): Record
2185 whether a symbol is copied from a shared object.
2186 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2187 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2188 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2189 (Incremental_input_entry_reader::get_output_symbol_index): Add
2190 is_copy parameter.
2191 (Incremental_binary::emit_copy_relocs): New function.
2192 (Incremental_binary::do_emit_copy_relocs): New function.
2193 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2194 new data member.
2195 (Sized_incremental_binary::add_copy_reloc): New function.
2196 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2197 (Sized_incremental_binary::Copy_reloc): New struct.
2198 (Sized_incremental_binary::Copy_relocs): New typedef.
2199 (Sized_incremental_binary::copy_relocs_): New data member.
2200 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2201 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2202 * target.h (Sized_target::emit_copy_reloc): New function.
2203 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2204
2205 2011-06-02 Cary Coutant <ccoutant@google.com>
2206
2207 PR gold/12163
2208 * gold/archive.cc (Archive::Archive): Initialize new data member.
2209 (Archive::include_all_members): Return if archive has already been
2210 included.
2211 * gold/archive.h (Archive::include_all_members_): New data member.
2212
2213 2011-06-02 Nick Clifton <nickc@redhat.com>
2214
2215 * dynobj.h: Fix spelling mistake in comment.
2216 * output.cc: Likewise.
2217
2218 2011-05-31 Doug Kwan <dougkwan@google.com>
2219 Asier Llano
2220
2221 PR gold/12826
2222 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2223 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2224 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2225 redundant arm_exidx_test.so.
2226 * testsuite/Makefile.in: Regenerate.
2227 (check_SCRIPTS): Add pr12826.sh
2228 (check_DATA): Add pr12826.stdout
2229 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2230 * testsuite/pr12826.sh: New file.
2231 * testsuite/pr12826_1.s: Ditto.
2232 * testsuite/pr12826_1.s: Ditto.
2233
2234 2011-05-30 Ian Lance Taylor <iant@google.com>
2235
2236 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2237 sections.
2238
2239 2011-05-29 Ian Lance Taylor <iant@google.com>
2240
2241 PR gold/12804
2242 * testsuite/Makefile.am: Use different file name for two_file_test
2243 temporary file for each incremental test.
2244 * testsuite/Makefile.in: Rebuild.
2245
2246 2011-05-29 Ian Lance Taylor <iant@google.com>
2247
2248 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2249 binary input file is empty.
2250
2251 2011-05-27 Ian Lance Taylor <iant@google.com>
2252
2253 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2254 (ver_test_9.so): Likewise.
2255 * testsuite/Makefile.in: Rebuild.
2256
2257 2011-05-26 Cary Coutant <ccoutant@google.com>
2258
2259 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2260 * incremental.cc (Incremental_inputs::report_input_section): Fix
2261 comment, indentation.
2262 (Incremental_inputs::report_comdat_group): New function.
2263 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2264 of data for incremental input file entry.
2265 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2266 group count, COMDAT group signatures.
2267 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2268 an unchanged input file.
2269 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2270 Initialize new data member.
2271 (Incremental_object_entry::add_comdat_group): New function.
2272 (Incremental_object_entry::get_comdat_group_count): New function.
2273 (Incremental_object_entry::get_comdat_signature_key): New function.
2274 (Incremental_object_entry::groups_): New data member.
2275 (Incremental_inputs::report_comdat_group): New function.
2276 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2277 data for incremental input file entry.
2278 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2279 (Incremental_input_entry_reader::get_input_section): Adjust size of
2280 data for incremental input file entry.
2281 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2282 (Incremental_input_entry_reader::get_comdat_group_signature): New
2283 function.
2284 * object.cc (Sized_relobj::include_section_group): Report kept
2285 COMDAT groups for incremental links.
2286
2287 2011-05-24 David Meyer <pdox@google.com>
2288
2289 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2290 with name parameter. Add found_name parameter.
2291 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2292 * dirsearch.h (class Dirsearch): Update declaration.
2293
2294 2011-05-24 Ian Lance Taylor <iant@google.com>
2295
2296 * archive.cc (Library_base::should_include_member): Pull in object
2297 from archive if it defines the entry symbol.
2298 * parameters.cc (Parameters::entry): New function.
2299 * parameters.h (class Parameters): Declare entry.
2300 * output.h (class Output_file_header): Remove entry_ field.
2301 * output.cc (Output_file_header::Output_file_header): Remove entry
2302 parameter. Change all callers.
2303 (Output_file_header::entry): Use parameters->entry.
2304 * gold.cc (queue_middle_tasks): Likewise.
2305 * plugin.cc (Plugin_hook::run): Likewise.
2306
2307 2011-05-24 Cary Coutant <ccoutant@google.com>
2308
2309 * gold.cc (queue_initial_tasks): Pass incremental base filename
2310 to Output_file::open_base_file; don't print error message.
2311 * incremental-dump.cc (main): Adjust call to
2312 Output_file::open_for_modification.
2313 * incremental-dump.cc (main): Likewise.
2314 * incremental.cc (Incremental_inputs::report_command_line):
2315 Ignore --incremental-base option when comparing command lines.
2316 Ignore parameter when given as separate argument.
2317 * options.h (class General_options): Add --incremental-base.
2318 * output.cc (Output_file::Output_file):
2319 (Output_file::open_base_file): Add base_name and writable parameters;
2320 read base file into new file; print error message here.
2321 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2322 callers.
2323 * output.h (Output_file::open_for_modification): Rename to...
2324 (Output_file::open_base_file): ...this; add base_name and
2325 writable parameters; adjust all callers.
2326 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2327 callers.
2328 * testsuite/Makefile.am (incremental_test_4): Test
2329 --incremental-base.
2330 * testsuite/Makefile.in: Regenerate.
2331
2332 2011-05-24 Cary Coutant <ccoutant@google.com>
2333
2334 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2335 incremental_test_4.
2336 * testsuite/Makefile.in: Regenerate.
2337 * testsuite/two_file_test_1_v1.cc: New test source file.
2338 * testsuite/two_file_test_1b_v1.cc: New test source file.
2339 * testsuite/two_file_test_2_v1.cc: New test source file.
2340
2341 2011-05-24 Cary Coutant <ccoutant@google.com>
2342
2343 * dynobj.h (Dynobj::do_dynobj): New function.
2344 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2345 flag and soname for shared objects.
2346 * incremental.cc (Incremental_inputs::report_object): Make
2347 either Incremental_object_entry or Incremental_dynobj_entry; add
2348 soname to string table.
2349 (Incremental_inputs::report_input_section): Add assertion.
2350 (Output_section_incremental_inputs::set_final_data_size): Adjust
2351 type of input file entry for shared libraries; adjust size of
2352 shared library info entry.
2353 (Output_section_incremental_inputs::write_input_files): Write
2354 as_needed flag for shared libraries.
2355 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2356 of input file entry for shared libraries; write soname.
2357 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2358 soname from incremental info.
2359 * incremental.h (enum Incremental_input_flags): Add
2360 INCREMENTAL_INPUT_AS_NEEDED.
2361 (Incremental_input_entry::Incremental_input_entry): Initialize new
2362 data member.
2363 (Incremental_input_entry::set_as_needed): New function.
2364 (Incremental_input_entry::as_needed): New function.
2365 (Incremental_input_entry::do_dynobj_entry): New function.
2366 (Incremental_input_entry::as_needed_): New data member.
2367 (Incremental_object_entry::Incremental_object_entry): Don't check
2368 for shared library.
2369 (Incremental_object_entry::do_type): Likewise.
2370 (class Incremental_dynobj_entry): New class.
2371 (Incremental_input_entry_reader::as_needed): New function.
2372 (Incremental_input_entry_reader::get_soname): New function.
2373 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2374 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2375 size of shared library info entry.
2376 * layout.cc (Layout::finish_dynamic_section): Don't test for
2377 incremental link when adding DT_NEEDED entries.
2378 * object.h (Object::Object): Initialize new data member.
2379 (Object::dynobj): New function.
2380 (Object::set_as_needed): New function.
2381 (Object::as_needed): New function.
2382 (Object::do_dynobj): New function.
2383 (Object::as_needed_): New data member.
2384
2385 2011-05-24 Cary Coutant <ccoutant@google.com>
2386
2387 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2388 info; adjust display of GOT entries.
2389 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2390 vector of input objects; remove file_status_.
2391 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2392 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2393 got_plt reader; call target hooks to reserve GOT entries.
2394 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2395 of input file info header and GOT info entry.
2396 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2397 relocation info.
2398 (Got_plt_view_info::got_descriptor): Remove.
2399 (Got_plt_view_info::sym_index): New data member.
2400 (Got_plt_view_info::input_index): New data member.
2401 (Local_got_offset_visitor::visit): Write input file index.
2402 (Global_got_offset_visitor::visit): Write 0 for input file index.
2403 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2404 with sym_index and input_index.
2405 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2406 incremental info GOT entry; replace got_descriptor with input_index.
2407 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2408 map from input file index to object.
2409 (Sized_relobj_incr::do_layout): Replace direct data member reference
2410 with accessor function.
2411 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2412 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2413 Adjust size of input file info header.
2414 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2415 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2416 (Incremental_input_entry_reader::get_input_section): Adjust size of
2417 input file info header.
2418 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2419 of incremental info GOT entry.
2420 (Incremental_got_plt_reader::get_got_desc): Remove.
2421 (Incremental_got_plt_reader::get_got_symndx): New function.
2422 (Incremental_got_plt_reader::get_got_input_index): New function.
2423 (Sized_incremental_binary::Sized_incremental_binary): Remove
2424 file_status_; add input_objects_.
2425 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2426 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2427 (Sized_incremental_binary::file_is_unchanged): Remove.
2428 (Sized_incremental_binary::set_input_object): New function.
2429 (Sized_incremental_binary::input_object): New function.
2430 (Sized_incremental_binary::file_status_): Remove.
2431 (Sized_incremental_binary::input_objects_): New data member.
2432 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2433 references.
2434 (Sized_relobj_incr::invalid_address): Move to base class.
2435 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2436 class.
2437 (Sized_relobj_incr::do_output_section_offset): Likewise.
2438 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2439 (Sized_relobj_incr::section_offsets_): Likewise.
2440 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2441 function.
2442 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2443 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2444 with accessor function.
2445 (Sized_relobj_file::do_layout): Likewise.
2446 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2447 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2448 (Sized_relobj_file::compute_final_local_value): Replace refs to
2449 section_offsets_ with accessor function.
2450 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2451 * object.h (Relobj::Relobj): Initialize new data members.
2452 (Relobj::add_dyn_reloc): New function.
2453 (Relobj::first_dyn_reloc): New function.
2454 (Relobj::dyn_reloc_count): New function.
2455 (Relobj::first_dyn_reloc_): New data member.
2456 (Relobj::dyn_reloc_count_): New data member.
2457 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2458 references.
2459 (Sized_relobj::Address): New typedef.
2460 (Sized_relobj::invalid_address): Move here from child class.
2461 (Sized_relobj::Sized_relobj): Initialize new data members.
2462 (Sized_relobj::sized_relobj): New function.
2463 (Sized_relobj::is_output_section_offset_invalid): Move here from
2464 child class.
2465 (Sized_relobj::get_output_section_offset): Likewise.
2466 (Sized_relobj::local_has_got_offset): Likewise.
2467 (Sized_relobj::local_got_offset): Likewise.
2468 (Sized_relobj::set_local_got_offset): Likewise.
2469 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2470 (Sized_relobj::clear_got_offsets): New function.
2471 (Sized_relobj::section_offsets): Move here from child class.
2472 (Sized_relobj::do_output_section_offset): Likewise.
2473 (Sized_relobj::do_set_section_offset): Likewise.
2474 (Sized_relobj::Local_got_offsets): Likewise.
2475 (Sized_relobj::local_got_offsets_): Likewise.
2476 (Sized_relobj::section_offsets_): Likewise.
2477 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2478 references.
2479 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2480 class.
2481 (Sized_relobj_file::sized_relobj): New function
2482 (Sized_relobj_file::local_has_got_offset): Move to base class.
2483 (Sized_relobj_file::local_got_offset): Likewise.
2484 (Sized_relobj_file::set_local_got_offset): Likewise.
2485 (Sized_relobj_file::get_output_section_offset): Likewise.
2486 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2487 (Sized_relobj_file::do_output_section_offset): Likewise.
2488 (Sized_relobj_file::do_set_section_offset): Likewise.
2489 (Sized_relobj_file::Local_got_offsets): Likewise.
2490 (Sized_relobj_file::local_got_offsets_): Likewise.
2491 (Sized_relobj_file::section_offsets_): Likewise.
2492 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2493 (all constructors).
2494 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2495 (Output_reloc::get_symbol_index): Likewise.
2496 (Output_reloc::local_section_offset): Likewise.
2497 (Output_reloc::get_address): Likewise.
2498 (Output_reloc::symbol_value): Likewise.
2499 (Output_data_got::reserve_slot): Move to class definition.
2500 (Output_data_got::reserve_local): New function.
2501 (Output_data_got::reserve_slot_for_global): Remove.
2502 (Output_data_got::reserve_global): New function.
2503 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2504 (all constructors, two instantiations).
2505 (Output_reloc::get_relobj): New function (two instantiations).
2506 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2507 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2508 (Output_data_reloc::add_global): Adjust type of relobj.
2509 (Output_data_reloc::add_global_relative): Likewise.
2510 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2511 (Output_data_reloc::add_local): Likewise.
2512 (Output_data_reloc::add_local_relative): Likewise.
2513 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2514 (Output_data_reloc::add_local_section): Likewise.
2515 (Output_data_reloc::add_output_section): Likewise.
2516 (Output_data_reloc::add_absolute): Likewise.
2517 (Output_data_reloc::add_target_specific): Likewise.
2518 (Output_data_got::reserve_slot): Move definition here.
2519 (Output_data_got::reserve_local): New function.
2520 (Output_data_got::reserve_global): New function.
2521 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2522 section_offsets_ with accessor function.
2523 (Sized_relobj_file::write_sections): Likewise.
2524 (Sized_relobj_file::do_relocate_sections): Likewise.
2525 * target.h (Sized_target::reserve_local_got_entry): New function.
2526 (Sized_target::reserve_global_got_entry): New function.
2527 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2528 (Target_x86_64::reserve_global_got_entry): New function.
2529 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2530
2531 2011-05-23 Cary Coutant <ccoutant@google.com>
2532
2533 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2534 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2535 bit when checking got_type.
2536 * incremental.cc (Sized_incremental_binary::setup_readers):
2537 Store symbol table and string table locations; initialize bit vector
2538 of file status flags.
2539 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2540 unchanged files.
2541 (Sized_incremental_binary::do_process_got_plt): New function.
2542 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2543 (Output_section_incremental_inputs::set_final_data_size): Record
2544 file index for each input file.
2545 (Output_section_incremental_inputs::write_got_plt): Store file index
2546 instead of input entry offset for each GOT entry.
2547 * incremental.h
2548 (Incremental_input_entry::Incremental_input_entry): Initialize new
2549 data member.
2550 (Incremental_input_entry::set_offset): Store file index.
2551 (Incremental_input_entry::get_file_index): New function.
2552 (Incremental_input_entry::file_index_): New data member.
2553 (Incremental_binary::process_got_plt): New function.
2554 (Incremental_binary::do_process_got_plt): New function.
2555 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2556 data members.
2557 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2558 (Sized_incremental_binary::set_file_is_unchanged): New function.
2559 (Sized_incremental_binary::file_is_unchanged): New function.
2560 (Sized_incremental_binary::do_process_got_plt): New function.
2561 (Sized_incremental_binary::file_status_): New data member.
2562 (Sized_incremental_binary::main_symtab_loc_): New data member.
2563 (Sized_incremental_binary::main_strtab_loc_): New data member.
2564 * output.cc (Output_data_got::Got_entry::write): Add case
2565 RESERVED_CODE.
2566 (Output_data_got::add_global): Call add_got_entry.
2567 (Output_data_got::add_global_plt): Likewise.
2568 (Output_data_got::add_global_with_rel): Likewise.
2569 (Output_data_got::add_global_with_rela): Likewise.
2570 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2571 (Output_data_got::add_global_pair_with_rela): Likewise.
2572 (Output_data_got::add_local): Call add_got_entry.
2573 (Output_data_got::add_local_plt): Likewise.
2574 (Output_data_got::add_local_with_rel): Likewise.
2575 (Output_data_got::add_local_with_rela): Likewise.
2576 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2577 (Output_data_got::add_local_pair_with_rela): Likewise.
2578 (Output_data_got::reserve_slot): New function.
2579 (Output_data_got::reserve_slot_for_global): New function.
2580 (Output_data_got::add_got_entry): New function.
2581 (Output_data_got::add_got_entry_pair): New function.
2582 (Output_section::add_output_section_data): Edit FIXME.
2583 * output.h
2584 (Output_section_data_build::Output_section_data_build): New
2585 constructor with size parameter.
2586 (Output_data_space::Output_data_space): Likewise.
2587 (Output_data_got::Output_data_got): Initialize new data member; new
2588 constructor with size parameter.
2589 (Output_data_got::add_constant): Call add_got_entry.
2590 (Output_data_got::reserve_slot): New function.
2591 (Output_data_got::reserve_slot_for_global): New function.
2592 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2593 (Output_data_got::add_got_entry): New function.
2594 (Output_data_got::add_got_entry_pair): New function.
2595 (Output_data_got::free_list_): New data member.
2596 * target.h (Sized_target::init_got_plt_for_update): New function.
2597 (Sized_target::register_global_plt_entry): New function.
2598 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2599 Initialize new data member; call init; add constructor with PLT count.
2600 (Output_data_plt_x86_64::init): New function.
2601 (Output_data_plt_x86_64::add_relocation): New function.
2602 (Output_data_plt_x86_64::reserve_slot): New function.
2603 (Output_data_plt_x86_64::free_list_): New data member.
2604 (Target_x86_64::init_got_plt_for_update): New function.
2605 (Target_x86_64::register_global_plt_entry): New function.
2606 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2607 incremental updates.
2608 (Output_data_plt_x86_64::add_relocation): New function.
2609 * testsuite/object_unittest.cc (Object_test): Set default options.
2610
2611 2011-05-16 Ian Lance Taylor <iant@google.com>
2612
2613 * options.h (class General_options): Make -i a synonym for -r.
2614
2615 2011-05-16 Ian Lance Taylor <iant@google.com>
2616
2617 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2618
2619 2011-05-10 Cary Coutant <ccoutant@google.com>
2620
2621 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2622 strip_all (-s).
2623
2624 2011-05-06 Ian Lance Taylor <iant@google.com>
2625
2626 * layout.cc (Layout::layout): If the output section flags change,
2627 update the ordering.
2628
2629 2011-04-25 Cary Coutant <ccoutant@google.com>
2630
2631 * incremental-dump.cc (dump_incremental_inputs): Print local
2632 symbol info for each input file.
2633 * incremental.cc
2634 (Output_section_incremental_inputs::set_final_data_size): Add local
2635 symbol info to input file entries in incremental info.
2636 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2637 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2638 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2639 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2640 implementation.
2641 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2642 (Sized_incr_relobj::do_relocate): Write the local symbols.
2643 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2644 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2645 Adjust size of input file header.
2646 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2647 (Incremental_inputs_reader::get_local_symbol_count): New function.
2648 (Incremental_inputs_reader::get_input_section): Adjust size of input
2649 file header.
2650 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2651 (Sized_incr_relobj::This): New typedef.
2652 (Sized_incr_relobj::sym_size): New const data member.
2653 (Sized_incr_relobj::Local_symbol): New struct.
2654 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2655 (Sized_incr_relobj::do_local_symbol_offset): New function.
2656 (Sized_incr_relobj::local_symbol_count_): New data member.
2657 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2658 (Sized_incr_relobj::local_symbol_index_): New data member.
2659 (Sized_incr_relobj::local_symbol_offset_): New data member.
2660 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2661 (Sized_incr_relobj::local_symbols_): New data member.
2662 * object.h (Relobj::output_local_symbol_count): New function.
2663 (Relobj::local_symbol_offset): New function.
2664 (Relobj::do_output_local_symbol_count): New function.
2665 (Relobj::do_local_symbol_offset): New function.
2666 (Sized_relobj::do_output_local_symbol_count): New function.
2667 (Sized_relobj::do_local_symbol_offset): New function.
2668
2669 2011-04-22 Vladimir Simonov <sv@sw.ru>
2670
2671 * descriptors.cc (set_close_on_exec): New function.
2672 (Descriptors::open): Use set_close_on_exec.
2673 * output.cc (S_ISLNK): Define if not defined.
2674
2675 2011-04-22 Cary Coutant <ccoutant@google.com>
2676
2677 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2678 global symbol map.
2679 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2680 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2681 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2682 relocations.
2683 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2684 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2685 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2686 * incremental.h
2687 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2688 function.
2689 (Incremental_binary::apply_incremental_relocs): New function.
2690 (Incremental_binary::do_apply_incremental_relocs): New function.
2691 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2692 data member.
2693 (Sized_incremental_binary::add_global_symbol): New function.
2694 (Sized_incremental_binary::global_symbol): New function.
2695 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2696 (Sized_incremental_binary::symbol_map_): New data member.
2697 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2698 * target.h (Sized_target::apply_relocation): New function.
2699 * target-reloc.h (apply_relocation): New function.
2700 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2701
2702 2011-04-22 Doug Kwan <dougkwan@google.com>
2703
2704 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2705 flag of a SHT_ARM_EXIDX section.
2706 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2707 * testsuite/Makefile.in: Regenerate.
2708 * testsuite/arm_exidx_test.s: New file.
2709 * testsuite/arm_exidx_test.sh: Same.
2710
2711 2011-04-20 Cary Coutant <ccoutant@google.com>
2712
2713 PR gold/12689
2714 * archive.h (Incremental_archive_entry::Archive_member):
2715 Initialize arg_serial_ (second constructor).
2716
2717 2011-04-17 Ian Lance Taylor <iant@google.com>
2718
2719 * object.cc (Relocate_info::location): Simplify location string.
2720 * errors.cc (Errors::error_at_location): Don't print program
2721 name.
2722 (Errors::warning_at_location): Likewise.
2723 (Errors::undefined_symbol): Likewise.
2724 * testsuite/debug_msg.sh: Update accordingly.
2725
2726 2011-04-14 Cary Coutant <ccoutant@google.com>
2727
2728 * gold/layout.cc (Layout::symtab_section_offset): New function.
2729 * gold/layout.h (Layout::symtab_section_offset): New function.
2730 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2731
2732 2011-04-12 Ian Lance Taylor <iant@google.com>
2733
2734 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2735 with MREMAP_MAYMOVE.
2736 * output.h (class Output_file): Add map_is_allocated_ field.
2737 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2738 not available, provide stubs. If mremap is not available, #define
2739 it to gold_mremap.
2740 (MREMAP_MAYMOVE): Define if not defined.
2741 (Output_file::Output_file): Initialize map_is_allocated_.
2742 (Output_file::resize): Check map_is_allocated_.
2743 (Output_file::map_anonymous): If mmap fails, use malloc.
2744 (Output_file::unmap): Don't do anything for an anonymous map.
2745 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2746 is not available, provide stubs.
2747 (File_read::View::~View): Use free rather than delete[].
2748 (File_read::make_view): Use malloc rather than new[]. If mmap
2749 fails, use malloc.
2750 (File_read::find_or_make_view): Use malloc rather than new[].
2751 * gold.h: Remove HAVE_REMAP code.
2752 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2753 exists. Rename mremap to gold_mremap. If mmap is not available
2754 don't do anything.
2755 * configure, config.in: Rebuild.
2756
2757 2011-04-11 Ian Lance Taylor <iant@google.com>
2758
2759 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2760 initialize local variable v.
2761
2762 2011-04-11 Cary Coutant <ccoutant@google.com>
2763
2764 * archive.cc (Archive::include_member): Adjust call to
2765 report_object.
2766 (Add_archive_symbols::run): Track argument serial numbers.
2767 (Lib_group::include_member): Likewise.
2768 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2769 * archive.h (Incremental_archive_entry::Archive_member):
2770 Initialize arg_serial_.
2771 (Archive_member::arg_serial_): New data member.
2772 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2773 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2774 incremental link.
2775 (Sized_dynobj::do_for_all_local_got_entries): New function.
2776 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2777 function.
2778 * fileread.cc (get_mtime): New function.
2779 * fileread.h (get_mtime): New function.
2780 * gold.cc (queue_initial_tasks): Check for incremental update.
2781 (process_incremental_input): New function.
2782 (queue_middle_tasks): Don't force valid target for incremental
2783 update.
2784 * incremental-dump.cc (find_input_containing_global): Adjust
2785 size of symbol info entry.
2786 (dump_incremental_inputs): Dump argument serial number and
2787 in_system_directory flag; bias shndx by 1; print symbol names
2788 when dumping per-file symbol lists; use new symbol info readers.
2789 * incremental.cc
2790 (Output_section_incremental_inputs:update_data_size): New function.
2791 (Sized_incremental_binary::setup_readers): Setup input readers
2792 for each input file; build maps for files added from libraries
2793 and scripts.
2794 (Sized_incremental_binary::check_input_args): New function.
2795 (Sized_incremental_binary::do_check_inputs): Build map of argument
2796 serial numbers to input arguments.
2797 (Sized_incremental_binary::do_file_has_changed): Rename
2798 do_file_is_unchanged to this; compare file modification times.
2799 (Sized_incremental_binary::do_init_layout): New function.
2800 (Sized_incremental_binary::do_reserve_layout): New function.
2801 (Sized_incremental_binary::do_get_input_reader): Remove.
2802 (Sized_incremental_binary::get_symtab_view): New function.
2803 (Incremental_checker::can_incrementally_link_output_file): Remove.
2804 (Incremental_inputs::report_command_line): Exclude --debug options.
2805 (Incremental_inputs::report_archive_begin): Add parameter; track
2806 argument serial numbers; don't put input file entry for archive
2807 before archive members.
2808 (Incremental_inputs::report_archive_end): Put input file entry
2809 for archive after archive members.
2810 (Incremental_inputs::report_object): Add parameter; track argument
2811 serial numbers and in_system_directory flag.
2812 (Incremental_inputs::report_script): Add parameter; track argument
2813 serial numbers.
2814 (Output_section_incremental_inputs::set_final_data_size): Adjust
2815 size of symbol info entry; check for forwarding symbols.
2816 (Output_section_incremental_inputs::write_input_files): Write
2817 in_system_directory flag and argument serial number.
2818 (Output_section_incremental_inputs::write_info_blocks): Map section
2819 indices between incremental info and original input file; store
2820 input section index for each symbol.
2821 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2822 change operator() to visit().
2823 (class Global_got_offset_visitor): Likewise.
2824 (class Global_symbol_visitor_got_plt):
2825 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2826 classes.
2827 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2828 (Sized_incr_relobj::do_read_symbols): New function.
2829 (Sized_incr_relobj::do_layout): New function.
2830 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2831 (Sized_incr_relobj::do_add_symbols): New function.
2832 (Sized_incr_relobj::do_should_include_member): New function.
2833 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2834 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2835 (Sized_incr_relobj::do_section_size): New function.
2836 (Sized_incr_relobj::do_section_name): New function.
2837 (Sized_incr_relobj::do_section_contents): New function.
2838 (Sized_incr_relobj::do_section_flags): New function.
2839 (Sized_incr_relobj::do_section_entsize): New function.
2840 (Sized_incr_relobj::do_section_address): New function.
2841 (Sized_incr_relobj::do_section_type): New function.
2842 (Sized_incr_relobj::do_section_link): New function.
2843 (Sized_incr_relobj::do_section_info): New function.
2844 (Sized_incr_relobj::do_section_addralign): New function.
2845 (Sized_incr_relobj::do_initialize_xindex): New function.
2846 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2847 (Sized_incr_relobj::do_read_relocs): New function.
2848 (Sized_incr_relobj::do_gc_process_relocs): New function.
2849 (Sized_incr_relobj::do_scan_relocs): New function.
2850 (Sized_incr_relobj::do_count_local_symbols): New function.
2851 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2852 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2853 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2854 (Sized_incr_relobj::do_relocate): New function.
2855 (Sized_incr_relobj::do_set_section_offset): New function.
2856 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2857 (Sized_incr_dynobj::do_read_symbols): New function.
2858 (Sized_incr_dynobj::do_layout): New function.
2859 (Sized_incr_dynobj::do_add_symbols): New function.
2860 (Sized_incr_dynobj::do_should_include_member): New function.
2861 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2862 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2863 (Sized_incr_dynobj::do_section_size): New function.
2864 (Sized_incr_dynobj::do_section_name): New function.
2865 (Sized_incr_dynobj::do_section_contents): New function.
2866 (Sized_incr_dynobj::do_section_flags): New function.
2867 (Sized_incr_dynobj::do_section_entsize): New function.
2868 (Sized_incr_dynobj::do_section_address): New function.
2869 (Sized_incr_dynobj::do_section_type): New function.
2870 (Sized_incr_dynobj::do_section_link): New function.
2871 (Sized_incr_dynobj::do_section_info): New function.
2872 (Sized_incr_dynobj::do_section_addralign): New function.
2873 (Sized_incr_dynobj::do_initialize_xindex): New function.
2874 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2875 (make_sized_incremental_object): New function.
2876 (Incremental_library::copy_unused_symbols): New function.
2877 (Incremental_library::do_for_all_unused_symbols): New function.
2878 * incremental.h (enum Incremental_input_flags): New type.
2879 (class Incremental_checker): Remove.
2880 (Incremental_input_entry::Incremental_input_entry): Add argument
2881 serial number.
2882 (Incremental_input_entry::arg_serial): New function.
2883 (Incremental_input_entry::set_is_in_system_directory): New function.
2884 (Incremental_input_entry::is_in_system_directory): New function.
2885 (Incremental_input_entry::arg_serial_): New data member.
2886 (Incremental_input_entry::is_in_system_directory_): New data member.
2887 (class Script_info): Move here from script.h.
2888 (Script_info::Script_info): Add filename parameter.
2889 (Script_info::filename): New function.
2890 (Script_info::filename_): New data member.
2891 (Incremental_script_entry::Incremental_script_entry): Add argument
2892 serial number.
2893 (Incremental_object_entry::Incremental_object_entry): Likewise.
2894 (Incremental_object_entry::add_input_section): Build list of input
2895 sections with map to original shndx.
2896 (Incremental_object_entry::get_input_section_index): New function.
2897 (Incremental_object_entry::shndx_): New data member.
2898 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2899 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2900 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2901 serial number.
2902 (Incremental_inputs::report_archive_begin): Likewise.
2903 (Incremental_inputs::report_object): Likewise.
2904 (Incremental_inputs::report_script): Likewise.
2905 (class Incremental_global_symbol_reader): New class.
2906 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2907 and store flags and input file type.
2908 (Incremental_input_entry_reader::arg_serial): New function.
2909 (Incremental_input_entry_reader::type): Extract type from flags.
2910 (Incremental_input_entry_reader::is_in_system_directory): New function.
2911 (Incremental_input_entry_reader::get_input_section_count): Call
2912 accessor function for type.
2913 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2914 function for type; adjust size of global symbol entry.
2915 (Incremental_input_entry_reader::get_global_symbol_count): Call
2916 accessor function for type.
2917 (Incremental_input_entry_reader::get_object_count): Likewise.
2918 (Incremental_input_entry_reader::get_object_offset): Likewise.
2919 (Incremental_input_entry_reader::get_member_count): Likewise.
2920 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2921 (Incremental_input_entry_reader::get_member_offset): Likewise.
2922 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2923 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2924 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2925 (Incremental_input_entry_reader::get_global_symbol_reader): New
2926 function.
2927 (Incremental_input_entry_reader::get_output_symbol_index): New
2928 function.
2929 (Incremental_input_entry_reader::type_): Remove.
2930 (Incremental_input_entry_reader::flags_): New data member.
2931 (Incremental_inputs_reader::input_file_offset): New function.
2932 (Incremental_inputs_reader::input_file_index): New function.
2933 (Incremental_inputs_reader::input_file): Call input_file_offset.
2934 (Incremental_inputs_reader::input_file_at_offset): New function.
2935 (Incremental_relocs_reader::get_r_type): Reformat.
2936 (Incremental_relocs_reader::get_r_shndx): Reformat.
2937 (Incremental_relocs_reader::get_r_offset): Reformat.
2938 (Incremental_relocs_reader::data): New function.
2939 (Incremental_binary::Incremental_binary): Initialize new data members.
2940 (Incremental_binary::check_inputs): Add cmdline parameter.
2941 (Incremental_binary::file_is_unchanged): Remove.
2942 (Input_reader::arg_serial): New function.
2943 (Input_reader::get_unused_symbol_count): New function.
2944 (Input_reader::get_unused_symbol): New function.
2945 (Input_reader::do_arg_serial): New function.
2946 (Input_reader::do_get_unused_symbol_count): New function.
2947 (Input_reader::do_get_unused_symbol): New function.
2948 (Incremental_binary::input_file_count): New function.
2949 (Incremental_binary::get_input_reader): Change signature to use
2950 index instead of filename.
2951 (Incremental_binary::file_has_changed): New function.
2952 (Incremental_binary::get_input_argument): New function.
2953 (Incremental_binary::get_library): New function.
2954 (Incremental_binary::get_script_info): New function.
2955 (Incremental_binary::init_layout): New function.
2956 (Incremental_binary::reserve_layout): New function.
2957 (Incremental_binary::output_file): New function.
2958 (Incremental_binary::do_check_inputs): New function.
2959 (Incremental_binary::do_file_is_unchanged): Remove.
2960 (Incremental_binary::do_file_has_changed): New function.
2961 (Incremental_binary::do_init_layout): New function.
2962 (Incremental_binary::do_reserve_layout): New function.
2963 (Incremental_binary::do_input_file_count): New function.
2964 (Incremental_binary::do_get_input_reader): Change signature.
2965 (Incremental_binary::input_args_map_): New data member.
2966 (Incremental_binary::library_map_): New data member.
2967 (Incremental_binary::script_map_): New data member.
2968 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2969 new data members.
2970 (Sized_incremental_binary::output_section): New function.
2971 (Sized_incremental_binary::inputs_reader): Add const.
2972 (Sized_incremental_binary::symtab_reader): Add const.
2973 (Sized_incremental_binary::relocs_reader): Add const.
2974 (Sized_incremental_binary::got_plt_reader): Add const.
2975 (Sized_incremental_binary::get_symtab_view): New function.
2976 (Sized_incremental_binary::Inputs_reader): New typedef.
2977 (Sized_incremental_binary::Input_entry_reader): New typedef.
2978 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2979 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2980 (Sized_incremental_binary::do_file_has_changed): New function.
2981 (Sized_incremental_binary::do_init_layout): New function.
2982 (Sized_incremental_binary::do_reserve_layout): New function.
2983 (Sized_input_reader::Inputs_reader): Remove.
2984 (Sized_input_reader::Input_entry_reader): Remove.
2985 (Sized_input_reader::do_arg_serial): New function.
2986 (Sized_input_reader::do_get_unused_symbol_count): New function.
2987 (Sized_input_reader::do_get_unused_symbol): New function.
2988 (Sized_incremental_binary::do_input_file_count): New function.
2989 (Sized_incremental_binary::do_get_input_reader): Change signature;
2990 use index instead of filename.
2991 (Sized_incremental_binary::section_map_): New data member.
2992 (Sized_incremental_binary::input_entry_readers_): New data member.
2993 (class Sized_incr_relobj): New class.
2994 (class Sized_incr_dynobj): New class.
2995 (make_sized_incremental_object): New function.
2996 (class Incremental_library): New class.
2997 * layout.cc (Free_list::num_lists): New static data member.
2998 (Free_list::num_nodes): New static data member.
2999 (Free_list::num_removes): New static data member.
3000 (Free_list::num_remove_visits): New static data member.
3001 (Free_list::num_allocates): New static data member.
3002 (Free_list::num_allocate_visits): New static data member.
3003 (Free_list::init): New function.
3004 (Free_list::remove): New function.
3005 (Free_list::allocate): New function.
3006 (Free_list::dump): New function.
3007 (Free_list::print_stats): New function.
3008 (Layout_task_runner::run): Resize output file for incremental updates.
3009 (Layout::Layout): Initialize new data members.
3010 (Layout::set_incremental_base): New function.
3011 (Layout::init_fixed_output_section): New function.
3012 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3013 incremental updates.
3014 (Layout::create_gold_note): Do not create gold note section for
3015 incremental updates.
3016 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3017 for incremental updates.
3018 (Layout::set_section_offsets): For incremental updates, allocate space
3019 from free list.
3020 (Layout::create_symtab_sections): Layout with offsets relative to
3021 start of section; for incremental updates, allocate space from free
3022 list.
3023 (Layout::create_shdrs): For incremental updates, allocate space from
3024 free list.
3025 (Layout::finish_dynamic_section): For incremental updates, do not
3026 check --as-needed (fixed in subsequent patch).
3027 * layout.h (class Free_list): New class.
3028 (Layout::set_incremental_base): New function.
3029 (Layout::incremental_base): New function.
3030 (Layout::init_fixed_output_section): New function.
3031 (Layout::allocate): New function.
3032 (Layout::incremental_base_): New data member.
3033 (Layout::free_list_): New data member.
3034 * main.cc (main): Print Free_list statistics.
3035 * object.cc (Relobj::finalize_incremental_relocs): Add
3036 clear_counts parameter; clear counts only when clear_counts is set.
3037 (Sized_relobj::Sized_relobj): Initialize new base class.
3038 (Sized_relobj::do_layout): Don't report special sections.
3039 (Sized_relobj::do_for_all_local_got_entries): New function.
3040 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3041 symtab_off to all symbol table offsets.
3042 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3043 * object.h (class Got_offset_list): Move to top of file.
3044 (Object::Object): Allow case where input_file == NULL.
3045 (Object::~Object): Likewise.
3046 (Object::input_file): Assert that input_file != NULL.
3047 (Object::lock): Allow case where input_file == NULL.
3048 (Object::unlock): Likewise.
3049 (Object::is_locked): Likewise.
3050 (Object::token): Likewise.
3051 (Object::release): Likewise.
3052 (Object::is_incremental): New function.
3053 (Object::get_mtime): New function.
3054 (Object::for_all_local_got_entries): New function.
3055 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3056 (Object::set_is_in_system_directory): New function.
3057 (Object::is_in_system_directory): New function.
3058 (Object::do_is_incremental): New function.
3059 (Object::do_get_mtime): New function.
3060 (Object::do_for_all_local_got_entries): New function.
3061 (Object::is_in_system_directory_): New data member.
3062 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3063 (class Sized_relobj_base): New class.
3064 (class Sized_relobj): Derive from Sized_relobj_base.
3065 (class Sized_relobj::Symbols): Redeclare from base class.
3066 (class Sized_relobj::local_got_offset_list): Remove.
3067 (class Sized_relobj::Output_sections): Redeclare from base class.
3068 (class Sized_relobj::do_for_all_local_got_entries): New function.
3069 (class Sized_relobj::write_local_symbols): Add offset parameter.
3070 (class Sized_relobj::local_symbol_offset_): Update comment.
3071 (class Sized_relobj::local_dynsym_offset_): Update comment.
3072 * options.cc (Input_arguments::add_file): Remove const.
3073 * options.h (Input_file_argument::Input_file_argument):
3074 Initialize arg_serial_ (all constructors).
3075 (Input_file_argument::set_arg_serial): New function.
3076 (Input_file_argument::arg_serial): New function.
3077 (Input_file_argument::arg_serial_): New data member.
3078 (Input_arguments::Input_arguments): Initialize file_count_.
3079 (Input_arguments::add_file): Remove const.
3080 (Input_arguments::number_of_input_files): New function.
3081 (Input_arguments::file_count_): New data member.
3082 (Command_line::number_of_input_files): Call
3083 Input_arguments::number_of_input_files.
3084 * output.cc (Output_segment_headers::Output_segment_headers):
3085 Set current size.
3086 (Output_section::Input_section::current_data_size): New function.
3087 (Output_section::Output_section): Initialize new data members.
3088 (Output_section::add_input_section): Don't do merge sections for
3089 an incremental link; allocate space from free list for an
3090 incremental update.
3091 (Output_section::add_output_section_data): Allocate space from
3092 free list for an incremental update.
3093 (Output_section::update_data_size): New function.
3094 (Output_section::set_fixed_layout): New function.
3095 (Output_section::reserve): New function.
3096 (Output_segment::set_section_addresses): Remove const.
3097 (Output_segment::set_section_list_addresses): Remove const; allocate
3098 space from free list for an incremental update.
3099 (Output_segment::set_offset): Adjust size of RELRO segment for an
3100 incremental update.
3101 * output.h (Output_data::current_data_size): Move here from
3102 child classes.
3103 (Output_data::pre_finalize_data_size): New function.
3104 (Output_data::update_data_size): New function.
3105 (Output_section_headers::update_data_size): new function.
3106 (Output_section_data_build::current_data_size): Move to Output_data.
3107 (Output_data_strtab::update_data_size): New function.
3108 (Output_section::current_data_size): Move to Output_data.
3109 (Output_section::set_fixed_layout): New function.
3110 (Output_section::has_fixed_layout): New function.
3111 (Output_section::reserve): New function.
3112 (Output_section::update_data_size): New function.
3113 (Output_section::has_fixed_layout_): New data member.
3114 (Output_section::free_list_): New data member.
3115 (Output_segment::set_section_addresses): Remove const.
3116 (Output_segment::set_section_list_addresses): Remove const.
3117 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3118 New function.
3119 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3120 New function.
3121 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3122 parameter when calling Add_symbols constructor; store argument
3123 serial number for members of a lib group.
3124 (Add_symbols::locks): Allow case where token == NULL.
3125 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3126 (Read_member::~Read_member): New function.
3127 (Read_member::is_runnable): New function.
3128 (Read_member::locks): New function.
3129 (Read_member::run): New function.
3130 (Check_script::~Check_script): New function.
3131 (Check_script::is_runnable): New function.
3132 (Check_script::locks): New function.
3133 (Check_script::run): New function.
3134 (Check_library::~Check_library): New function.
3135 (Check_library::is_runnable): New function.
3136 (Check_library::locks): New function.
3137 (Check_library::run): New function.
3138 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3139 (Add_symbols::library_): New data member.
3140 (class Read_member): New class.
3141 (class Check_script): New class.
3142 (class Check_library): New class.
3143 * reloc.cc (Read_relocs::is_runnable): Allow case where
3144 token == NULL.
3145 (Read_relocs::locks): Likewise.
3146 (Scan_relocs::locks): Likewise.
3147 (Relocate_task::locks): Likewise.
3148 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3149 to clear counters.
3150 (Sized_relobj::incremental_relocs_scan): Fix comment.
3151 (Sized_relobj::do_relocate): Pass output file offset to
3152 write_local_symbols.
3153 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3154 from class declaration.
3155 * script.cc (read_input_script): Allocate Script_info; pass
3156 argument serial number to report_script.
3157 * script.h (class Script_info): Move to incremental.h.
3158 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3159 * symtab.h (Symbol_table::add_from_incrobj): New function.
3160 (Symbol_table::set_file_offset): New function.
3161
3162 2011-04-05 Cary Coutant <ccoutant@google.com>
3163
3164 * incremental-dump.cc (dump_incremental_inputs): Change signature
3165 to take a Sized_incremental_binary; change caller. Use readers
3166 in Sized_incremental_binary.
3167 * incremental.cc
3168 (Sized_incremental_binary::find_incremental_inputs_sections):
3169 Rename do_find_incremental_inputs_sections to this.
3170 (Sized_incremental_binary::setup_readers): New function.
3171 (Sized_incremental_binary::do_check_inputs): Check
3172 has_incremental_info_ flag; move setup code to setup_readers;
3173 use input readers.
3174 (Sized_incremental_binary::do_file_is_unchanged): New function.
3175 (Sized_incremental_binary::do_get_input_reader): New function.
3176 * incremental.h (class Incremental_binary): Move to end of file.
3177 (Incremental_binary::file_is_unchanged): New function.
3178 (Incremental_binary::do_file_is_unchanged): New function.
3179 (Incremental_binary::Input_reader): New class.
3180 (Incremental_binary::get_input_reader): New function.
3181 (class Sized_incremental_binary): Move to end of file.
3182 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3183 input section reader classes.
3184 (Sized_incremental_binary::has_incremental_info): New function.
3185 (Sized_incremental_binary::inputs_reader): New function.
3186 (Sized_incremental_binary::symtab_reader): New function.
3187 (Sized_incremental_binary::relocs_reader): New function.
3188 (Sized_incremental_binary::got_plt_reader): New function.
3189 (Sized_incremental_binary::do_file_is_unchanged): New function.
3190 (Sized_incremental_binary::Sized_input_reader): New class.
3191 (Sized_incremental_binary::get_input_reader): New function.
3192 (Sized_incremental_binary::find_incremental_inputs_sections):
3193 Rename do_find_incremental_inputs_sections to this.
3194 (Sized_incremental_binary::setup_readers): New function.
3195 (Sized_incremental_binary::has_incremental_info_): New data member.
3196 (Sized_incremental_binary::inputs_reader_): New data member.
3197 (Sized_incremental_binary::symtab_reader_): New data member.
3198 (Sized_incremental_binary::relocs_reader_): New data member.
3199 (Sized_incremental_binary::got_plt_reader_): New data member.
3200 (Sized_incremental_binary::current_input_file_): New data member.
3201
3202 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3203
3204 PR gold/12640
3205 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3206 violation.
3207
3208 2011-03-30 Cary Coutant <ccoutant@google.com>
3209
3210 * archive.cc (Archive::include_member): Adjust call to report_object.
3211 (Add_archive_symbols::run): Add script_info to call to
3212 report_archive_begin.
3213 (Lib_group::include_member): Adjust call to report_object.
3214 (Add_lib_group_symbols::run): Adjust call to report_object.
3215 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3216 blocks. Add object count for script input files.
3217 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3218 script_info parameter; change all callers.
3219 (Incremental_inputs::report_object): Add script_info parameter;
3220 change all callers.
3221 (Incremental_inputs::report_script): Store backpointer to
3222 incremental info entry.
3223 (Output_section_incremental_inputs::set_final_data_size): Record
3224 additional information for scripts.
3225 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3226 * incremental.h (Incremental_script_entry::add_object): New function.
3227 (Incremental_script_entry::get_object_count): New function.
3228 (Incremental_script_entry::get_object): New function.
3229 (Incremental_script_entry::objects_): New data member; adjust
3230 constructor.
3231 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3232 (Incremental_inputs::report_object): Add script_info parameter.
3233 (Incremental_inputs_reader::get_object_count): New function.
3234 (Incremental_inputs_reader::get_object_offset): New function.
3235 * options.cc (Input_arguments::add_file): Return reference to
3236 new input argument.
3237 * options.h (Input_argument::set_script_info): New function.
3238 (Input_argument::script_info): New function.
3239 (Input_argument::script_info_): New data member; adjust all
3240 constructors.
3241 (Input_file_group::add_file): Return reference to new input argument.
3242 (Input_file_lib::add_file): Likewise.
3243 (Input_arguments::add_file): Likewise.
3244 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3245 * script.cc (Parser_closure::Parser_closure): Add script_info
3246 parameter; adjust all callers.
3247 (Parser_closure::script_info): New function.
3248 (Parser_closure::script_info_): New data member.
3249 (read_input_script): Report scripts earlier to incremental info.
3250 (script_add_file): Set script_info in Input_argument.
3251 (script_add_library): Likewise.
3252 * script.h (Script_options::Script_info): Rewrite class.
3253
3254 2011-03-29 Cary Coutant <ccoutant@google.com>
3255
3256 * archive.cc (Library_base::should_include_member): Move
3257 method here from class Archive.
3258 (Archive::Archive): Initialize base class.
3259 (Archive::should_include_member): Move to base class.
3260 (Archive::do_for_all_unused_symbols): New function.
3261 (Add_archive_symbols::run): Remove redundant access to
3262 incremental_inputs.
3263 (Lib_group::Lib_group): Initialize base class.
3264 (Lib_group::do_filename): New function.
3265 (Lib_group::include_member): Pass pointer to Lib_group to
3266 report_object.
3267 (Lib_group::do_for_all_unused_symbols): New function.
3268 (Add_lib_group_symbols::run): Report archive information for
3269 incremental links.
3270 * archive.h (class Library_base): New base class.
3271 (class Archive): Derive from Library_base.
3272 (Archive::filename): Move to base class.
3273 (Archive::set_incremental_info): Likewise.
3274 (Archive::incremental_info): Likewise.
3275 (Archive::Should_include): Likewise.
3276 (Archive::should_include_member): Likewise.
3277 (Archive::Armap_entry): Remove.
3278 (Archive::Unused_symbol_iterator): Remove.
3279 (Archive::unused_symbols_begin): Remove.
3280 (Archive::unused_symbols_end): Remove.
3281 (Archive::do_filename): New function.
3282 (Archive::do_get_mtime): New function.
3283 (Archive::do_for_all_unused_symbols): New function.
3284 (Archive::task_): Move to base class.
3285 (Archive::incremental_info_): Likewise.
3286 (class Lib_group): Derive from Library_base.
3287 (Lib_group::do_filename): New function.
3288 (Lib_group::do_get_mtime): New function.
3289 (Lib_group::do_for_all_unused_symbols): New function.
3290 (Lib_group::task_): Move to base class.
3291 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3292 function.
3293 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3294 function.
3295 * incremental.cc (Incremental_inputs::report_archive_begin):
3296 Use Library_base; call library's get_mtime; add incremental inputs
3297 entry before members.
3298 (class Unused_symbol_visitor): New class.
3299 (Incremental_inputs::report_archive_end): Use Library_base; use
3300 visitor class to record unused symbols; don't add incremental inputs
3301 entry after members.
3302 (Incremental_inputs::report_object): Use Library_base.
3303 * incremental.h
3304 (Incremental_archive_entry::Incremental_archive_entry): Remove
3305 unused Archive parameter.
3306 (Incremental_inputs::report_archive_begin): Use Library_base.
3307 (Incremental_inputs::report_archive_end): Likewise.
3308 (Incremental_inputs::report_object): Likewise.
3309 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3310 function.
3311 * object.h (Object::for_all_global_symbols): New function.
3312 (Object::do_for_all_global_symbols): New function.
3313 (Sized_relobj::do_for_all_global_symbols): New function.
3314 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3315 function.
3316 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3317 function.
3318
3319 2011-03-27 Ian Lance Taylor <iant@google.com>
3320
3321 * archive.cc (Archive::interpret_header): Return -1 if something
3322 goes wrong. Change callers accordingly.
3323
3324 2011-03-25 Cary Coutant <ccoutant@google.com>
3325
3326 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3327 * testsuite/Makefile.in: Regenerate.
3328
3329 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3330
3331 * plugin.cc (get_view): New.
3332 (Plugin::load): Pass get_view to the plugin.
3333 (Plugin_manager::get_view): New.
3334
3335 2011-03-21 Ian Lance Taylor <iant@google.com>
3336
3337 * testsuite/final_layout.sh: Rewrite to not use dc.
3338 * testsuite/relro_test.sh: Fail if dc is not present.
3339
3340 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3341
3342 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3343 Change == to -eq.
3344 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3345 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3346 Change == to -eq.
3347 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3348 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3349
3350 2011-03-14 Ian Lance Taylor <iant@google.com>
3351
3352 * script-sections.cc (Sort_output_sections::script_compare):
3353 Rename from is_before, change return type.
3354 (Sort_output_sections::operator()): Adjust accordingly.
3355
3356 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3357
3358 PR gold/12572
3359 * testsuite/odr_violation2.cc: Add comment to make all error line
3360 numbers double digits.
3361 * testsuite/debug_msg.sh: Adjust expected errors.
3362
3363 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3364
3365 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3366 but mark earlier ones as non-canonical
3367 (offset_to_iterator): Update search target and example
3368 (do_addr2line): Return extra lines in a vector*
3369 (format_file_lineno): Extract from do_addr2line
3370 (one_addr2line): Add vector* out-param
3371 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3372 when a lineno entry appeared last for its instruction
3373 (Dwarf_line_info): Add vector* out-param
3374 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3375 * symtab.cc (Odr_violation_compare): Include the lineno in the
3376 comparison again.
3377 (linenos_from_loc): New. Combine the canonical line for an
3378 address with its other lines.
3379 (True_if_intersect): New. Helper functor to make
3380 std::set_intersection a query.
3381 (detect_odr_violations): Compare sets of lines instead of just
3382 one line for each function. This became less deterministic, but
3383 has fewer false positives.
3384 * symtab.h: Declarations.
3385 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3386 mix an optimized and non-optimized object in the same binary
3387 (odr_violation2.so): Same.
3388 * testsuite/Makefile.in: Regenerate from Makefile.am.
3389 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3390 * testsuite/debug_msg.sh: Update line numbers and add
3391 assertions.
3392 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3393 non-optimized context.
3394 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3395 isn't inlined, and use OdrDerived in an optimized context.
3396 * testsuite/odr_header1.h: Defines OdrDerived, where
3397 optimization will change the
3398 first-instruction-in-the-destructor's file and line number.
3399 * testsuite/odr_header2.h: Defines OdrBase.
3400
3401 2011-03-09 Ian Lance Taylor <iant@google.com>
3402
3403 * fileread.cc (File_read::clear_views): Don't delete the whole
3404 file view.
3405
3406 2011-03-08 Ian Lance Taylor <iant@google.com>
3407
3408 PR gold/12525
3409 * fileread.cc: #include <climits>.
3410 (GOLD_IOV_MAX): Define.
3411 (File_read::read_multiple): Limit number of entries by iov_max.
3412 * fileread.h (class File_read): Always set max_readv_entries to
3413 128.
3414
3415 2011-03-07 Ian Lance Taylor <iant@google.com>
3416
3417 PR gold/12525
3418 * options.h (class General_options): Add -dy and -dn.
3419
3420 2011-03-02 Cary Coutant <ccoutant@google.com>
3421
3422 * testsuite/script_test_9.t: Add TLS segment.
3423
3424 2011-03-02 Simon Baldwin <simonb@google.com>
3425
3426 * configure.ac: Add check for gnu_indirect_function support in
3427 the toolchain building binutils.
3428 * configure: Rebuild.
3429
3430 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3431
3432 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3433 plugin only symbols.
3434 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3435 in plugin files as not needed in the symbol table.
3436
3437 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3438
3439 * output.cc (Output_section::add_input_section): Delay fill
3440 generation for section ordering.
3441
3442 2011-02-09 Ian Lance Taylor <iant@google.com>
3443
3444 PR gold/12316
3445 * object.h (class Sized_relobj): Remove clear_local_symbols.
3446 * reloc.cc (Sized_relobj::do_relocate): Don't call
3447 clear_local_symbols.
3448
3449 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3450
3451 * plugin.cc (is_visible_from_outside): Return true for symbols
3452 in the -u option.
3453
3454 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3455
3456 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3457 filename.
3458
3459 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3460
3461 * icf.h (is_section_foldable_candidate): Change type of parameter
3462 to std::string.
3463 * icf.cc (Icf::find_identical_sections): Change type of local variable
3464 section_name to be std::string.
3465 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3466
3467 2011-01-25 Ian Lance Taylor <iant@google.com>
3468
3469 * script.cc (script_add_extern): Rewrite to use
3470 add_symbol_reference.
3471
3472 2011-01-25 Doug Kwan <dougkwan@google.com>
3473
3474 * icf.cc (get_section_contents): Always lock section's object.
3475
3476 2011-01-24 Ian Lance Taylor <iant@google.com>
3477
3478 * options.h (class General_options): Accept
3479 --no-detect-odr-violations.
3480
3481 2011-01-24 Ian Lance Taylor <iant@google.com>
3482
3483 * version.cc (version_string): Bump to 1.11.
3484
3485 2011-01-24 Ian Lance Taylor <iant@google.com>
3486
3487 * plugin.cc (class Plugin_rescan): Define new class.
3488 (Plugin_manager::claim_file): Set any_claimed_.
3489 (Plugin_manager::save_archive): New function.
3490 (Plugin_manager::save_input_group): New function.
3491 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3492 necessary.
3493 (Plugin_manager::new_undefined_symbol): New function.
3494 (Plugin_manager::rescan): New function.
3495 (Plugin_manager::rescannable_defines): New function.
3496 (Plugin_manager::add_input_file): Set any_added_.
3497 * plugin.h (class Plugin_manager): define new fields rescannable_,
3498 undefined_symbols_, any_claimed_, and any_added_. Declare
3499 Plugin_rescan as friend. Declare new functions.
3500 (Plugin_manager::Rescannable): Define type.
3501 (Plugin_manager::Rescannable_list): Define type.
3502 (Plugin_manager::Undefined_symbol_list): Define type.
3503 (Plugin_manager::Plugin_manager): Initialize new fields.
3504 * archive.cc (Archive::defines_symbol): New function.
3505 (Add_archive_symbols::run): Pass archive to plugins if any.
3506 * archive.h (class Archive): Declare defines_symbol.
3507 * readsyms.cc (Input_group::~Input_group): New function.
3508 (Finish_group::run): Pass input_group to plugins if any.
3509 * readsyms.h (class Input_group): Declare destructor.
3510 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3511 any.
3512
3513 2011-01-10 Ian Lance Taylor <iant@google.com>
3514
3515 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3516 section as relro.
3517 (Layout::set_segment_offsets): Reset increase_relro before calling
3518 set_section_addresses a second time.
3519
3520 2011-01-04 Cary Coutant <ccoutant@google.com>
3521
3522 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3523 sections before NOBITS sections.
3524
3525 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3526
3527 * version.cc (print_version): Update copyright to 2011.
3528
3529 2010-12-23 Cary Coutant <ccoutant@google.com>
3530
3531 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3532 of OS to this->add. Add OD parameter to second form of the function.
3533
3534 2010-12-20 Ian Lance Taylor <iant@google.com>
3535
3536 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3537 second of two consecutive entries with same offset.
3538
3539 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3540
3541 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3542 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3543 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3544 to avoid unneeded links against $(LDADD).
3545 * testsuite/Makefile.in: Regenerate.
3546
3547 2010-12-15 Ian Lance Taylor <iant@google.com>
3548
3549 PR gold/12324
3550 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3551 for R_X86_64_32 and R_X86_64_PC32.
3552 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3553 ver_matching_def_pic.o.
3554 (ver_matching_def_pic.o): New target.
3555
3556 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3557
3558 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3559 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3560 Move definition before File_read::View member definitions.
3561 (File_read::View::~View): Initialize and hold lock before
3562 updating current_mapped_bytes.
3563
3564 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3565
3566 * dwarf_reader.cc: Remove outdated comment.
3567 * gold-threads.cc: Fix typo in error message.
3568 * archive.cc: Fix typos in comments.
3569 * archive.h: Likewise.
3570 * arm-reloc-property.cc: Likewise.
3571 * arm-reloc-property.h: Likewise.
3572 * arm-reloc.def: Likewise.
3573 * arm.cc: Likewise.
3574 * attributes.h: Likewise.
3575 * cref.cc: Likewise.
3576 * ehframe.cc: Likewise.
3577 * fileread.h: Likewise.
3578 * gold.h: Likewise.
3579 * i386.cc: Likewise.
3580 * icf.cc: Likewise.
3581 * incremental.h: Likewise.
3582 * int_encoding.cc: Likewise.
3583 * layout.h: Likewise.
3584 * main.cc: Likewise.
3585 * merge.h: Likewise.
3586 * object.cc: Likewise.
3587 * object.h: Likewise.
3588 * options.cc: Likewise.
3589 * readsyms.cc: Likewise.
3590 * reduced_debug_output.cc: Likewise.
3591 * reloc.cc: Likewise.
3592 * script-sections.cc: Likewise.
3593 * sparc.cc: Likewise.
3594 * symtab.h: Likewise.
3595 * target-reloc.h: Likewise.
3596 * target.cc: Likewise.
3597 * target.h: Likewise.
3598 * timer.cc: Likewise.
3599 * timer.h: Likewise.
3600 * x86_64.cc: Likewise.
3601
3602 2010-12-09 Cary Coutant <ccoutant@google.com>
3603
3604 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3605 stack.
3606 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3607 parameter; change all callers.
3608 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3609 * options.h (warn_execstack): New option.
3610
3611 2010-12-07 Doug Kwan <dougkwan@google.com>
3612
3613 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3614 like function call relocations.
3615
3616 2010-12-07 Ian Lance Taylor <iant@google.com>
3617
3618 * archive.cc (Archive::get_elf_object_for_member): Permit
3619 punconfigured to be NULL.
3620 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3621 (Archive::include_member): Pass NULL to get_elf_object_for_member
3622 if we searched for the archive and this is the first included
3623 object.
3624
3625 2010-12-01 Ian Lance Taylor <iant@google.com>
3626
3627 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3628 track_relocs_type_ field.
3629 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3630 Set track_relocs_type_.
3631 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3632 contents when using RELA relocs.
3633 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3634 reloc_map_.
3635 * reloc.cc (Track_relocs::next_addend): New function.
3636 * reloc.h (class Track_relocs): Declare next_addend.
3637
3638 2010-12-01 Ian Lance Taylor <iant@google.com>
3639
3640 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3641 virtual destructor.
3642
3643 2010-12-01 Ian Lance Taylor <iant@google.com>
3644
3645 * README: Update compilers known to work and fail.
3646
3647 2010-11-23 Matthias Klose <doko@ubuntu.com>
3648
3649 * configure.in: For --enable-gold, handle value `default' instead of
3650 `both*'. Always install ld as ld.bfd, install as ld if gold is
3651 not the default.
3652 * configure: Regenerate.
3653
3654 2010-11-18 Doug Kwan <dougkwan@google.com>
3655
3656 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3657 and right_alignment to be zero. Store result alignment only if it is
3658 greater than existing alignment.
3659
3660 2010-11-16 Cary Coutant <ccoutant@google.com>
3661
3662 PR gold/12220
3663 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3664 Check for ".zdebug_line".
3665
3666 2010-11-16 Doug Kwan <dougkwan@google.com>
3667 Cary Coutant <ccoutant@google.com>
3668
3669 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3670 by reference; adjust all callers.
3671 * output.cc (Output_segment::set_section_addresses): Adjust references
3672 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3673 list is empty.
3674 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3675 end at page boundary.
3676
3677 2010-11-16 Cary Coutant <ccoutant@google.com>
3678
3679 PR gold/12220
3680 * layout.cc (Layout::choose_output_section): Transform names of
3681 compressed sections even when using a script with a SECTIONS clause.
3682 (Layout::output_section_name): Remove code to transform
3683 compressed debug section names.
3684 * output.cc (Output_section::add_input_section): Use uncompressed
3685 section size when tracking input sections.
3686
3687 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3688
3689 * symtab.h (Symbol::NON_PIC_REF): Remove.
3690 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3691 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3692 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3693 (Symbol::use_plt_offset): Take a flags argument and pass it
3694 directly to needs_dynamic_reloc. Restrict check for undefined
3695 weak symbols to function calls.
3696 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3697 (Target_arm::Scan::global): Use it.
3698 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3699 (Target_arm::Relocate::relocate): Likewise.
3700 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3701 parameter with an r_type parameter. Use get_reference_flags
3702 to get the flags.
3703 (Target_arm::Relocate::relocate): Update accordingly.
3704 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3705 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3706 (Target_i386::Scan::global): Likewise.
3707 (Target_i386::Relocate::relocate): Likewise.
3708 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3709 parameter with an r_type parameter. Use get_reference_flags
3710 to get the flags.
3711 (Target_i386::Relocate::relocate): Update accordingly.
3712 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3713 (Target_powerpc::Scan::global): Use it.
3714 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3715 (Target_powerpc::Relocate::relocate): Likewise.
3716 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3717 (Target_sparc::Scan::global): Use it.
3718 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3719 (Target_sparc::Relocate::relocate): Likewise.
3720 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3721 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3722 (Target_x86_64::Scan::global): Likewise.
3723 (Target_x86_64::Relocate::relocate): Likewise.
3724
3725 2010-11-08 Doug Kwan <dougkwan@google.com>
3726 Cary Coutant <ccoutant@google.com>
3727
3728 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3729 (Arm_exidx_merge_section::section_contents_): New data member.
3730 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3731 (Arm_input_section::~Arm_input_section): De-allocate memory.
3732 (Arm_input_section::original_contents_): New data member.
3733 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3734 in parameters instead of calling Object::section_contents without
3735 locking.
3736 (Arm_output_section::group_section): New parameter TASK. Pass it
3737 to callees that need locking objects.
3738 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3739 to lock EXIDX input sections. Fix a formatting issue. Call
3740 Arm_exidx_merged_section::build_contents to create merged section
3741 contents.
3742 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3743 to lock object of stub table owner.
3744 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3745 TEXT_SIZE to initialize data member TEXT_SIZE_.
3746 (Arm_exidx_input_section::addralign): Fix typo in comment.
3747 (Arm_exidx_input_section::text_size): New method.
3748 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3749 that require locking objects. Lock objects before scanning for stubs
3750 and updating local symbols.
3751 (Arm_input_section<big_endian>::init): Copy contents of original
3752 input section.
3753 (Arm_input_section<big_endian>::do_write): Use saved contents of
3754 original input section instead of calling Object::section_contents
3755 without locking.
3756 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3757 size without calling Object::section_size().
3758 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3759 for size. Allocate a buffer for merged EXIDX entries.
3760 (Arm_exidx_merged_section::build_contents): New method.
3761 (Arm_exidx_merged_section::do_write): Move merge section contents
3762 building code to Arm_exidx_merged_section::build_contetns. Write
3763 out contetns in buffer instead of building it on the fly.
3764 (Arm_relobj::make_exidx_input_section): Also pass text section size
3765 to Arm_exidx_input_section constructor.
3766 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3767 (Arm_dynobj::do_read_symbols): Fix memory leak.
3768 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3769 * target.h: (class Task): Add forward declaration.
3770 (Target::relax): Add new parameter TASK and pass it to
3771 Target::do_relax().
3772 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3773
3774 2010-11-05 Cary Coutant <ccoutant@google.com>
3775
3776 PR gold/10708
3777 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3778 object when reading from the file.
3779 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3780 second layout pass.
3781 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3782 when reading section contents.
3783 (get_section_contents): Likewise.
3784 (icf::find_identical_sections): Likewise.
3785 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3786 object when reading from the file.
3787 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3788 the object when doing deferred section layout.
3789
3790 2010-11-03 Nick Clifton <nickc@redhat.com>
3791
3792 PR gold/12001
3793 * script.h (class Symbol_assignment: name): New member. Returns
3794 the name of the symbol.
3795 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3796 Returns true if the given symbol name is on the list of
3797 assignments wating to be processed.
3798 * archive.cc (should_incldue_member): If the symbol is undefined,
3799 check to see if it is on the list of symbols pending assignment.
3800
3801 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3802
3803 * script-sections.cc (Script_sections::find_memory_region): Check
3804 for a NULL output section pointer.
3805
3806 2010-10-29 Doug Kwan <dougkwan@google.com>
3807
3808 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3809 Output_section::add_relaxed_input_section.
3810 * output.cc (Output_section::add_relaxed_input_section): Add new
3811 arguments LAYOUT and NAME. Set section order index.
3812 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3813 Copy section order index.
3814 * output.h (Output_section::add_relaxed_input_section): Add new
3815 arguments LAYOUT and NAME.
3816
3817 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3818
3819 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3820 NATIVE_OR_CROSS_LINKER.
3821 * testsuite/Makefile.in: Regenerate.
3822
3823 2010-10-20 Doug Kwan <dougkwan@google.com>
3824
3825 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3826 without SHF_LINK_ORDER flags.
3827 * layout.cc (Layout::choose_output_section): Do not filter
3828 SHF_LINK_ORDER flag in a relocatable link.
3829
3830 2010-10-17 Cary Coutant <ccoutant@google.com>
3831
3832 * output.h (Output_segment::set_section_addresses): Change function
3833 signature. Update all callers.
3834 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3835 sections.
3836 (Output_segment::set_section_addresses): Align after last TLS
3837 section. Add padding before last relro section instead of after.
3838
3839 2010-10-17 Doug Kwan <dougkwan@google.com>
3840
3841 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3842 GOT output section to be writable.
3843
3844 2010-10-14 Cary Coutant <ccoutant@google.com>
3845
3846 * debug.h (DEBUG_INCREMENTAL): New flag.
3847 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3848 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3849 mode.
3850 * incremental.cc (report_command_line): Ignore all forms of
3851 --incremental.
3852 * layout.cc (Layout::Layout): Check parameters for incremental link
3853 mode.
3854 * options.cc (General_options::parse_incremental): New function.
3855 (General_options::parse_no_incremental): New function.
3856 (General_options::parse_incremental_full): New function.
3857 (General_options::parse_incremental_update): New function.
3858 (General_options::incremental_mode_): New data member.
3859 (General_options::finalize): Check incremental_mode_.
3860 * options.h (General_options): Update help text for --incremental.
3861 Add --no-incremental, --incremental-full, --incremental-update.
3862 (General_options::Incremental_mode): New enum type.
3863 (General_options::incremental_mode): New function.
3864 (General_options::incremental_mode_): New data member.
3865 * parameters.cc (Parameters::incremental_mode_): New data member.
3866 (Parameters::set_options): Set incremental_mode_.
3867 (Parameters::set_incremental_full): New function.
3868 (Parameters::incremental): New function.
3869 (Parameters::incremental_update): New function.
3870 (set_parameters_incremental_full): New function.
3871 * parameters.h (Parameters::set_incremental_full): New function.
3872 (Parameters::incremental): New function.
3873 (Parameters::incremental_update): New function.
3874 (Parameters::incremental_mode_): New data member.
3875 (set_parameters_incremental_full): New function.
3876 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3877 incremental link mode.
3878 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3879 (Sized_relobj::do_relocate_sections): Likewise.
3880 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3881 option.
3882 * testsuite/Makefile.in: Regenerate.
3883 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3884
3885 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3886
3887 * script-sections.h (class Script_sections): Make
3888 Sections_elements typedef public.
3889 * script-sections.cc (class Sort_output_sections): Add elements_
3890 field. Add constructor which sets it; change all callers.
3891 (Sort_output_sections::is_before): New function.
3892 (Sort_output_sections::operator()): Call is_before.
3893 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3894 conditional.
3895 * testsuite/script_test_10.sh: New test. Test script section
3896 order.
3897 * testsuite/script_test_10.t: Likewise.
3898 * testsuite/script_test_10.s: Likewise.
3899 * testsuite/Makefile.am: Wrap the cross linker tests and the
3900 common tests into NATIVE_OR_CROSS_LINKER.
3901 (check_SCRIPTS): Add script_test_10.sh.
3902 (check_DATA): Add script_test_10.stdout.
3903 (script_test_10.o, script_test_10): New targets.
3904 (script_test_10.stdout): New target.
3905 * configure, testsuite/Makefile.in: Regenerate.
3906
3907 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3908
3909 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3910 error for the deprecated relocations.
3911 (Target_arm::Scan::global): Likewise.
3912 (Target_arm::Relocate::relocate): Likewise.
3913
3914 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3915
3916 * fileread.cc (Input_file::find_file): Initialize *found_name
3917 and *namep when using the fallback search for case 4.
3918
3919 2010-10-11 Cary Coutant <ccoutant@google.com>
3920
3921 * options.h (class General_options): Redefine -z lazy as an alias for
3922 the negation of -z now.
3923
3924 2010-10-11 Ian Lance Taylor <iant@google.com>
3925
3926 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3927 binding.
3928
3929 2010-10-06 Nick Clifton <nickc@redhat.com>
3930
3931 * script-sections.cc(class Memory_region): Remove
3932 current_lma_offset_ field. Rename current_vma_offset_ to
3933 current_offset_. Add last_section_ field.
3934 (Memory_region::get_current_vma_address): Rename to
3935 get_current_address.
3936 (Memory_region::get_current_lma_address): Delete.
3937 (Memory_region::increment_vma_offset): Rename to
3938 increment_offset.
3939 (Memory_region::increment_lma_offset): Delete.
3940 (Memory_region::attributes_compatible): New method. Returns
3941 true if the provided section is compatible with the region.
3942 (Memory_region::get_last_section): New method. Returns the last
3943 section to use the region.
3944 (Memory_region::set_last_section): New method. Stores the last
3945 section to use the region.
3946 (Script_sections::block_in_region): New method. Returns true if
3947 a block of memory is contained within a region.
3948 (Script_sections::find_memory_region): New method. Locates a
3949 memory region to be used to set a VMA or LMA address.
3950 (Output_section_definition::set_section_addresses): Add code to
3951 check for addresses set by memory regions.
3952 (Output_segment::set_section_addresses): Remove memory region
3953 walking code.
3954 (Script_sections::create_segment): Add a warning if a header
3955 segment is created outside of any region.
3956 * script-sections.h (class Script_sections): Add prototypes for
3957 find_memory_region and block_in_region methods.
3958 * testsuite/memory_test.s: Use .long instead of .word.
3959 * testsuite/memory_test.t: Add some more output sections.
3960 * testsuite/memory_test.sh: Update expected output.
3961
3962 2010-10-02 Doug Kwan <dougkwan@google.com>
3963
3964 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3965 defintion to symtab.h
3966 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3967 declaration to defintion.
3968
3969 2010-10-01 Nick Clifton <nickc@redhat.com>
3970
3971 * expression.cc (eval): Replace dummy argument with NULL.
3972 (eval_maybe_dot): Check for a NULL result section pointer.
3973 (Symbol_expression::value): Likewise.
3974 (Dot_expression::value): Likewise.
3975 (BINARY_EXPRESSION): Likewise.
3976 (Max_expression::value): Likewise.
3977 (Min_expression::value): Likewise.
3978 (Absolute_expression::value): Likewise.
3979 (Addr_expression::value_from_output_section): Likewise.
3980 (Loaddddr_expression::value_from_output_section): Likewise.
3981 (Segment_start_expression::value): Likewise.
3982 * script-sections.cc
3983 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3984 argument with NULL.
3985 (Sections_elememt_dot_assignment::set_section_addresses):
3986 Likewise.
3987 (Output_data_expression::do_write_to_buffer): Likewise.
3988 (Output_section_definition::finalize_symbols): Likewise.
3989 (Output_section_definition::set_section_addresses): Likewise.
3990
3991 2010-09-30 Doug Kwan <dougkwan@google.com>
3992
3993 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3994
3995 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3996
3997 * target.h (Target::can_icf_inline_merge_sections): New virtual
3998 function.
3999 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4000 virtual function.
4001 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4002 virtual function.
4003 * icf.cc (get_section_contents): Inline merge sections only when
4004 target allows it.
4005
4006 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4007
4008 * configure: Regenerate.
4009
4010 2010-09-17 Ian Lance Taylor <iant@google.com>
4011
4012 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4013 * testsuite/Makefile.am (memory_test.o): New target.
4014 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4015 memory_test.t.
4016 * testsuite/Makefile.in: Rebuild.
4017
4018 2010-09-17 Doug Kwan <dougkwan@google.com>
4019
4020 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4021 defintion if relocation uses GOT entries of the symbol.
4022 * testsuite/icf_safe_test.sh: Fix test.
4023 * testsuite/icf_safe_so_test.sh: Fix test.
4024
4025 2010-09-16 Cary Coutant <ccoutant@google.com>
4026
4027 * script_sections.cc (class Memory_region): Remove "NULL" from
4028 vector initializations.
4029
4030 2010-09-15 Cary Coutant <ccoutant@google.com>
4031
4032 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4033 Resolve forwarding symbols.
4034
4035 2010-09-15 Doug Kwan <dougkwan@google.com>
4036
4037 * gold/testsuite/script_test_3.t: Add ARM special sections.
4038 * gold/testsuite/script_test_4.t: Same.
4039 * gold/testsuite/script_test_5.t: Same.
4040 * gold/testsuite/script_test_6.t: Same.
4041 * gold/testsuite/script_test_7.t: Same.
4042 * gold/testsuite/script_test_7.t: Same.
4043 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4044
4045 2010-09-14 Cary Coutant <ccoutant@google.com>
4046
4047 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4048 (Target_x86_64::Relocate::relocate_tls): Replace check for
4049 saw_tls_block_reloc_ with test for executable section.
4050
4051 2010-09-12 Cary Coutant <ccoutant@google.com>
4052
4053 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4054 position-independent executables to shared libraries need dynamic
4055 relocations.
4056 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4057 position-independent executables.
4058 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4059 * testsuite/Makefile.in: Regenerate.
4060
4061 2010-09-10 Nick Clifton <nickc@redhat.com>
4062
4063 PR gold/11997
4064 * testsuite/memory_test.t: Discard any sections that are not
4065 needed.
4066
4067 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4068
4069 PR gold/11996
4070 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4071 "This::" to work around a bug in gcc 4.2.
4072
4073 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4074
4075 2010-09-09 Rafael Espindola <espindola@google.com>
4076
4077 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4078 sections with different PF_X flags in the same segment.
4079 (Layout::find_first_load_seg): Search all segments to find the first
4080 one.
4081 * options.h (rosegment): New.
4082
4083 2010-09-08 Rafael Espindola <espindola@google.com>
4084
4085 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4086
4087 2010-09-08 Doug Kwan <dougkwan@google.com>
4088
4089 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4090 (Arm_relobj::do_relocate_sections): Add new parameter for output
4091 file to match the parent.
4092 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4093 of local symbols instead of input values. Update code to track
4094 changes in gold::relocate_section.
4095 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4096 (Sized_relobj::compute_final_local_value_internal): New methods.
4097 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4098 body into private version of Sized_relobj::compute_final_local_value.
4099 Call the inline method.
4100 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4101 merged symbol value if there is one.
4102 (Symbol_value::has_output_value): New method defintiion.
4103 (Sized_relobj::Compute_final_local_value_status): New enum type.
4104 (Sized_relobj::compute_final_local_value): New methods.
4105 (Sized_relobj::compute_final_local_value_internal): New methods.
4106 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4107 and arm_cortex_a8.sh.
4108 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4109 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4110 New tests.
4111 * Makefile.in: Regenerate.
4112 * testsuite/arm_bl_out_of_range.s: Update test.
4113 * testsuite/thumb_bl_out_of_range.s: Ditto.
4114 * testsuite/thumb_blx_out_of_range.s: Ditto.
4115 * testsuite/arm_branch_out_of_range.sh: New file.
4116 * testsuite/arm_cortex_a8.sh: Ditto.
4117 * testsuite/arm_cortex_a8_b.s: Ditto.
4118 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4119 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4120 * testsuite/arm_cortex_a8_bl.s: Ditto.
4121 * testsuite/arm_cortex_a8_blx.s: Ditto.
4122 * testsuite/arm_cortex_a8_local.s: Ditto.
4123 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4124 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4125
4126 2010-09-08 Rafael Espindola <espindola@google.com>
4127
4128 * Makefile.am (memory_test.stdout): Run readelf with -W.
4129 * Makefile.in: Regenerate.
4130 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4131 64 bit output.
4132
4133 2010-09-08 Rafael Espindola <espindola@google.com>
4134
4135 * script-sections.cc (Script_sections::add_memory_region): Convert
4136 field precision to int.
4137 * script.cc (script_set_section_region, script_set_section_region):
4138 Convert field precision to int.
4139
4140 2010-09-08 Rafael Espindola <espindola@google.com>
4141
4142 * arm.cc (do_finalize_sections): Create the __exidx_start and
4143 __exdix_end symbols even when the section is missing.
4144
4145 2010-09-08 Nick Clifton <nickc@redhat.com>
4146
4147 * README: Remove claim that MEMORY is not supported.
4148 * expression.cc (script_exp_function_origin)
4149 (script_exp_function_length): Move from here to ...
4150 * script.cc: ... here.
4151 (script_set_section_region, script_add_memory)
4152 (script_parse_memory_attr, script_include_directive): New
4153 functions.
4154 * script-sections.cc
4155 (class Memory_region): New class.
4156 (class Output_section_definition): Add set_memory_region,
4157 set_section_vma, set_section_lma and get_section_name methods.
4158 (class Script_Sections): Add add_memory_region,
4159 find_memory_region, find_memory_region_origin,
4160 find_memory_region_length and set_memory_region methods.
4161 Have set_section_addresses method walk the list of set memory
4162 regions.
4163 Extend the print methos to display memory regions.
4164 * script-sections.h: Add prototypes for new methods.
4165 Add enum for MEMORY region attributes.
4166 * yyscript.y: Add support for parsing MEMORY regions.
4167 * script-c.h: Add prototypes for new functions.
4168 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4169 * testsuite/Makefile.in: Regenerate.
4170 * testsuite/memory_test.sh: New script.
4171 * testsuite/memory_test.s: New assembler source file.
4172 * testsuite/memory_test.t: New linker script.
4173
4174 2010-08-27 Doug Kwan <dougkwan@google.com>
4175
4176 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4177 reference override an existing dynamic weak reference.
4178 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4179 * testsuite/Makefile.in: Regenerate.
4180 * testsuite/dyn_weak_ref.sh: New file.
4181 * testsuite/dyn_weak_ref_1.c: Ditto.
4182 * testsuite/dyn_weak_ref_2.c: Ditto.
4183
4184 2010-08-27 Ian Lance Taylor <iant@google.com>
4185
4186 * incremental.h (class Incremental_input_entry): Add virtual
4187 destructor.
4188
4189 2010-08-27 Ian Lance Taylor <iant@google.com>
4190
4191 * testsuite/start_lib_test_3.c: Mark t3 as used.
4192
4193 2010-08-27 Nick Clifton <nickc@redhat.com>
4194
4195 * options.cc (version_script): Fix small typo in previous
4196 whitespace tidyup.
4197
4198 2010-08-25 Nick Clifton <nickc@redhat.com>
4199
4200 * archive.cc: Formatting fixes: Remove whitespace between
4201 typename and following asterisk. Remove whitespace between
4202 function name and opening parenthesis.
4203 * archive.h: Likewise.
4204 * arm.cc: Likewise.
4205 * attributes.cc: Likewise.
4206 * attributes.h: Likewise.
4207 * common.cc: Likewise.
4208 * copy-relocs.cc: Likewise.
4209 * dirsearch.h: Likewise.
4210 * dynobj.cc: Likewise.
4211 * ehframe.cc: Likewise.
4212 * ehframe.h: Likewise.
4213 * expression.cc: Likewise.
4214 * fileread.cc: Likewise.
4215 * fileread.h: Likewise.
4216 * gc.h: Likewise.
4217 * gold-threads.cc: Likewise.
4218 * gold.cc: Likewise.
4219 * i386.cc: Likewise.
4220 * icf.h: Likewise.
4221 * incremental-dump.cc: Likewise.
4222 * incremental.cc: Likewise.
4223 * layout.cc: Likewise.
4224 * layout.h: Likewise.
4225 * main.cc: Likewise.
4226 * merge.cc: Likewise.
4227 * merge.h: Likewise.
4228 * object.cc: Likewise.
4229 * object.h: Likewise.
4230 * options.cc: Likewise.
4231 * options.h: Likewise.
4232 * output.cc: Likewise.
4233 * output.h: Likewise.
4234 * plugin.cc: Likewise.
4235 * plugin.h: Likewise.
4236 * powerpc.cc: Likewise.
4237 * reloc.cc: Likewise.
4238 * script-c.h: Likewise.
4239 * script-sections.cc: Likewise.
4240 * script.cc: Likewise.
4241 * stringpool.cc: Likewise.
4242 * symtab.cc: Likewise.
4243 * symtab.h: Likewise.
4244 * target.cc: Likewise.
4245 * timer.cc: Likewise.
4246 * timer.h: Likewise.
4247 * version.cc: Likewise.
4248 * x86_64.cc: Likewise.
4249
4250 2010-08-24 Nick Clifton <nickc@redhat.com>
4251
4252 PR 11899
4253 * layout.cc (segment_precedes): Sort segments by their physical
4254 addresses, if they have been set.
4255
4256 2010-08-23 Cary Coutant <ccoutant@google.com>
4257
4258 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4259 symbols data.
4260 (Lib_group::include_member): Unlock object after deleting its
4261 symbols data.
4262 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4263 the bug fixed here.
4264
4265 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4266 Cary Coutant <ccoutant@google.com>
4267
4268 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4269 constructor, and set_blocker.
4270 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4271 readsyms_blocker_.
4272 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4273 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4274 * testsuite/Makefile.am (start_lib_test): New test case.
4275 * testsuite/Makefile.in: Regenerate.
4276 * testsuite/start_lib_test_main.c: New file.
4277 * testsuite/start_lib_test_1.c: New file.
4278 * testsuite/start_lib_test_2.c: New file.
4279 * testsuite/start_lib_test_3.c: New file.
4280
4281 2010-08-19 Ian Lance Taylor <iant@google.com>
4282
4283 * Makefile.in: Rebuild with automake 1.11.1.
4284 * aclocal.m4: Likewise.
4285 * testsuite/Makefile.in: Likewise.
4286
4287 2010-08-19 Ian Lance Taylor <iant@google.com>
4288
4289 PR 10893
4290 * i386.cc (class Output_data_plt_i386): Update declarations.
4291 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4292 local_ifuncs_ fields.
4293 (Target_i386::do_plt_section_for_global): New function.
4294 (Target_i386::do_plt_section_for_local): New function.
4295 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4296 parameter; change all callers. Initialize global_ifuncs_ and
4297 local_ifuncs_. If doing a static link define __rel_iplt_start and
4298 __rel_iplt_end.
4299 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4300 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4301 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4302 symbols.
4303 (Target_i386::make_plt_section): New function, broken out of
4304 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4305 (Target_i386::make_plt_entry): Call make_plt_section.
4306 (Target_i386::make_local_ifunc_plt_entry): New function.
4307 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4308 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4309 R_386_IRELATIVE to switch.
4310 (Target_i386::Scan::global): Likewise.
4311 (Target_i386::Relocate::relocate): Likewise.
4312 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4313 switch.
4314 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4315 (Target_x86_64::do_plt_section_for_global): New function.
4316 (Target_x86_64::do_plt_section_for_local): New function.
4317 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4318 parameter; change all callers. If doing a static link define
4319 __rela_iplt_start and __rela_iplt_end.
4320 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4321 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4322 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4323 to point to .plt.
4324 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4325 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4326 switch.
4327 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4328 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4329 R_X86_64_IRELATIVE to switch.
4330 (Target_x86_64::Scan::global): Likewise.
4331 (Target_x86_64::Relocate::relocate): Likewise.
4332 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4333 switch.
4334 * target.h (class Target): Add plt_section_for_global and
4335 plt_section_for_local functions. Add do_plt_section_for_global
4336 and do_plt_section_for_local virtual functions.
4337 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4338 clarifying comments.
4339 (Symbol::use_plt_offset): Handle IFUNC symbol.
4340 * object.cc (Sized_relobj::Sized_relobj): Initialize
4341 local_plt_offsets_.
4342 (Sized_relobj::local_has_plt_offset): New function.
4343 (Sized_relobj::local_plt_offset): New function.
4344 (Sized_relobj::set_local_plt_offset): New function.
4345 (Sized_relobj::do_count): Handle IFUNC symbol.
4346 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4347 a bit away from input_shndx_ field. Add set_is_func_symbol and
4348 is_ifunc_symbol functions.
4349 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4350 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4351 local_plt_offsets_ field.
4352 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4353 * output.h (class Output_section_data): Add non-const
4354 output_section function.
4355 (class Output_data_got): Update declarations.
4356 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4357 Add use_plt_offset parameter to global and local constructors.
4358 Change all callers. Change local_sym_index_ field to 31 bits.
4359 Change GSYM_CODE and CONSTANT_CODE accordingly.
4360 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4361 doing a static link don't set sh_link field.
4362 (Output_data_got::Got_entry::write): Use PLT offset if
4363 appropriate.
4364 (Output_data_got::add_global_plt): New function.
4365 (Output_data_got::add_local_plt): New function.
4366 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4367 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4368 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4369 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4370 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4371 IFUNC conditional.
4372 * testsuite/ifunc-sel.h: New file.
4373 * testsuite/ifuncmain1.c: New file.
4374 * testsuite/ifuncmain1vis.c: New file.
4375 * testsuite/ifuncmod1.c: New file.
4376 * testsuite/ifuncdep2.c: New file.
4377 * testsuite/ifuncmain2.c: New file.
4378 * testsuite/ifuncmain3.c: New file.
4379 * testsuite/ifuncmod3.c: New file.
4380 * testsuite/ifuncmain4.c: New file.
4381 * testsuite/ifuncmain5.c: New file.
4382 * testsuite/ifuncmod5.c: New file.
4383 * testsuite/ifuncmain6pie.c: New file.
4384 * testsuite/ifuncmod6.c: New file.
4385 * testsuite/ifuncmain7.c: New file.
4386 * configure, testsuite/Makefile.in: Rebuild.
4387
4388 2010-08-18 Ian Lance Taylor <iant@google.com>
4389
4390 * incremental.cc
4391 (Output_section_incremental_inputs::write_input_files): Add cast
4392 to avoid signed/unsigned comparison warning.
4393 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4394
4395 2010-08-12 Cary Coutant <ccoutant@google.com>
4396
4397 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4398
4399 2010-08-13 Ian Lance Taylor <iant@google.com>
4400
4401 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4402
4403 2010-08-12 Cary Coutant <ccoutant@google.com>
4404 Doug Kwan <dougkwan@google.com>
4405
4406 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4407 defintion overrides non-weak undef, remember that the original undef
4408 is not weak.
4409 * symtab.cc (Symbol_table::sized_write_global): For undef without
4410 an original weak binding, set binding to global in output.
4411 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4412 * testsuite/Makefile.in: Regenerate.
4413 * testsuite/strong_ref_weak_def.sh: New file.
4414 * testsuite/strong_ref_weak_def_1.c: Ditto.
4415 * testsuite/strong_ref_weak_def_2.c: Ditto.
4416
4417 2010-08-12 Cary Coutant <ccoutant@google.com>
4418
4419 * testsuite/incremental_test.sh: Rewrite.
4420 * testsuite/incremental_test_1.c: Rewrite.
4421 * testsuite/incremental_test_2.c: Rewrite.
4422
4423 2010-08-12 Cary Coutant <ccoutant@google.com>
4424
4425 * arm.cc (Target_arm::got_size): Add const.
4426 (Target_arm::got_entry_count): New function.
4427 (Target_arm::plt_entry_count): New function.
4428 (Target_arm::first_plt_entry_offset): New function.
4429 (Target_arm::plt_entry_size): New function.
4430 (Output_data_plt_arm::entry_count): New function.
4431 (Output_data_plt_arm::first_plt_entry_offset): New function.
4432 (Output_data_plt_arm::get_plt_entry_size): New function.
4433 * i386.cc (Target_i386::got_size): Add const.
4434 (Target_i386::got_entry_count): New function.
4435 (Target_i386::plt_entry_count): New function.
4436 (Target_i386::first_plt_entry_offset): New function.
4437 (Target_i386::plt_entry_size): New function.
4438 (Output_data_plt_i386::entry_count): New function.
4439 (Output_data_plt_i386::first_plt_entry_offset): New function.
4440 (Output_data_plt_i386::get_plt_entry_size): New function.
4441 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4442 find_incremental_inputs_sections. Dump incremental_got_plt section.
4443 * incremental.cc: Include target.h.
4444 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4445 parameter. Adjust all callers. Find incremental_got_plt section.
4446 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4447 section.
4448 (Output_section_incremental_inputs::set_final_data_size): Calculate
4449 size of incremental_got_plt section.
4450 (Output_section_incremental_inputs::do_write): Write the
4451 incremental_got_plt section.
4452 (Got_plt_view_info): New struct.
4453 (Local_got_offset_visitor): New class.
4454 (Global_got_offset_visitor): New class.
4455 (Global_symbol_visitor_got_plt): New class.
4456 (Output_section_incremental_inputs::write_got_plt): New function.
4457 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4458 Add parameter. Adjust all callers.
4459 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4460 (Incremental_inputs::got_plt_section): New function.
4461 (Incremental_inputs::got_plt_section_): New data member.
4462 (Incremental_got_plt_reader): New class.
4463 * layout.cc (Layout::create_incremental_info_sections): Add the
4464 incremental_got_plt section.
4465 * object.h (Got_offset_list::get_list): New function.
4466 (Got offset_list::for_all_got_offsets): New function.
4467 (Sized_relobj::local_got_offset_list): New function.
4468 * powerpc.cc (Target_powerpc::got_size): Add const.
4469 (Target_powerpc::got_entry_count): New function.
4470 (Target_powerpc::plt_entry_count): New function.
4471 (Target_powerpc::first_plt_entry_offset): New function.
4472 (Target_powerpc::plt_entry_size): New function.
4473 (Output_data_plt_powerpc::entry_count): New function.
4474 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4475 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4476 * sparc.cc (Target_sparc::got_size): Add const.
4477 (Target_sparc::got_entry_count): New function.
4478 (Target_sparc::plt_entry_count): New function.
4479 (Target_sparc::first_plt_entry_offset): New function.
4480 (Target_sparc::plt_entry_size): New function.
4481 (Output_data_plt_sparc::entry_count): New function.
4482 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4483 (Output_data_plt_sparc::get_plt_entry_size): New function.
4484 * symtab.h (Symbol::got_offset_list): New function.
4485 (Symbol_table::for_all_symbols): New function.
4486 * target.h (Sized_target::got_entry_count): New function.
4487 (Sized_target::plt_entry_count): New function.
4488 (Sized_target::plt_entry_size): New function.
4489 * x86_64.cc (Target_x86_64::got_size): Add const.
4490 (Target_x86_64::got_entry_count): New function.
4491 (Target_x86_64::plt_entry_count): New function.
4492 (Target_x86_64::first_plt_entry_offset): New function.
4493 (Target_x86_64::plt_entry_size): New function.
4494 (Output_data_plt_x86_64::entry_count): New function.
4495 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4496 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4497
4498 2010-08-12 Cary Coutant <ccoutant@google.com>
4499
4500 * archive.cc: Include incremental.h.
4501 (Archive::Archive): Initialize incremental_info_.
4502 (Archive::include_member): Record archive members in incremental info.
4503 (Add_archive_symbols::run): Record begin and end of an archive in
4504 incremental info.
4505 (Lib_group::include_member): Record objects in incremental info.
4506 * archive.h (Incremental_archive_entry): Forward declaration.
4507 (Archive::set_incremental_info): New member function.
4508 (Archive::incremental_info): New member function.
4509 (Archive::Unused_symbol_iterator): New class.
4510 (Archive::unused_symbols_begin): New member function.
4511 (Archive::unused_symbols_end): New member function.
4512 (Archive::incremental_info_): New data member.
4513 * incremental-dump.cc (find_input_containing_global): New function.
4514 (dump_incremental_inputs): Dump new incremental info sections.
4515 * incremental.cc: Include symtab.h.
4516 (Output_section_incremental_inputs): New class.
4517 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4518 new incremental info sections.
4519 (Sized_incremental_binary::do_check_inputs): Likewise.
4520 (Incremental_inputs::report_archive): Remove.
4521 (Incremental_inputs::report_archive_begin): New function.
4522 (Incremental_inputs::report_archive_end): New function.
4523 (Incremental_inputs::report_object): New function.
4524 (Incremental_inputs::finalize_inputs): Remove.
4525 (Incremental_inputs::report_input_section): New function.
4526 (Incremental_inputs::report_script): Rewrite.
4527 (Incremental_inputs::finalize): Do nothing but finalize string table.
4528 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4529 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4530 (Incremental_inputs::create_data_sections): New function.
4531 (Incremental_inputs::relocs_entsize): New function.
4532 (Output_section_incremental_inputs::set_final_data_size): New function.
4533 (Output_section_incremental_inputs::do_write): New function.
4534 (Output_section_incremental_inputs::write_header): New function.
4535 (Output_section_incremental_inputs::write_input_files): New function.
4536 (Output_section_incremental_inputs::write_info_blocks): New function.
4537 (Output_section_incremental_inputs::write_symtab): New function.
4538 * incremental.h (Incremental_script_entry): Forward declaration.
4539 (Incremental_object_entry): Forward declaration.
4540 (Incremental_archive_entry): Forward declaration.
4541 (Incremental_inputs): Forward declaration.
4542 (Incremental_inputs_header_data): Remove.
4543 (Incremental_inputs_header): Remove.
4544 (Incremental_inputs_header_write): Remove.
4545 (Incremental_inputs_entry_data): Remove.
4546 (Incremental_inputs_entry): Remove.
4547 (Incremental_inputs_entry_write): Remove.
4548 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4549 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4550 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4551 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4552 Likewise.
4553 (Incremental_input_entry): New class.
4554 (Incremental_script_entry): New class.
4555 (Incremental_object_entry): New class.
4556 (Incremental_archive_entry): New class.
4557 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4558 (Incremental_inputs::report_inputs): Remove.
4559 (Incremental_inputs::report_archive): Remove.
4560 (Incremental_inputs::report_archive_begin): New function.
4561 (Incremental_inputs::report_archive_end): New function.
4562 (Incremental_inputs::report_object): Change prototype.
4563 (Incremental_inputs::report_input_section): New function.
4564 (Incremental_inputs::report_script): Change prototype.
4565 (Incremental_inputs::get_reloc_count): New function.
4566 (Incremental_inputs::set_reloc_count): New function.
4567 (Incremental_inputs::create_data_sections): New function.
4568 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4569 (Incremental_inputs::inputs_section): New function.
4570 (Incremental_inputs::symtab_section): New function.
4571 (Incremental_inputs::relocs_section): New function.
4572 (Incremental_inputs::get_stringpool): Add const.
4573 (Incremental_inputs::command_line): Add const.
4574 (Incremental_inputs::inputs): Remove.
4575 (Incremental_inputs::command_line_key): New function.
4576 (Incremental_inputs::input_file_count): New function.
4577 (Incremental_inputs::input_files): New function.
4578 (Incremental_inputs::relocs_entsize): New function.
4579 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4580 (Incremental_inputs::finalize_inputs): Remove.
4581 (Incremental_inputs::Input_info): Remove.
4582 (Incremental_inputs::lock_): Remove.
4583 (Incremental_inputs::inputs_): Change type.
4584 (Incremental_inputs::inputs_map_): Remove.
4585 (Incremental_inputs::current_object_entry_): New data member.
4586 (Incremental_inputs::inputs_section_): New data member.
4587 (Incremental_inputs::symtab_section_): New data member.
4588 (Incremental_inputs::relocs_section_): New data member.
4589 (Incremental_inputs::reloc_count_): New data member.
4590 (Incremental_inputs_reader): New class.
4591 (Incremental_symtab_reader): New class.
4592 (Incremental_relocs_reader): New class.
4593 * layout.cc (Layout::finalize): Move finalization of incremental info
4594 and creation of incremental info sections to follow finalization of
4595 symbol table. Set offsets for postprocessing sections.
4596 (Layout::create_incremental_info_sections): Call
4597 Incremental_inputs::create_data_sections. Add incremental symtab
4598 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4599 sections to layout after input sections.
4600 * layout.h (struct Timespec): Forward declaration.
4601 (Layout::incremental_inputs): Add const.
4602 (Layout::create_incremental_info_sections): Add parameter.
4603 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4604 * object.cc: Include incremental.h.
4605 (Relobj::finalize_incremental_relocs): New function.
4606 (Sized_relobj::do_layout): Record input sections in incremental info.
4607 * object.h (Object::output_section): New function.
4608 (Object::output_section_offset): Moved from Relobj.
4609 (Object::get_incremental_reloc_base): New function.
4610 (Object::get_incremental_reloc_count): New function.
4611 (Object::do_output_section): New function.
4612 (Object::do_output_section_offset): Moved from Relobj.
4613 (Object::do_get_incremental_reloc_base): New function.
4614 (Object::do_get_incremental_reloc_count): New function.
4615 (Object::Object): Initialize new data members.
4616 (Relobj::output_section): Renamed do_output_section and moved to
4617 protected.
4618 (Relobj::output_section_offset): Moved to Object.
4619 (Relobj::do_get_incremental_reloc_base): New function.
4620 (Relobj::do_get_incremental_reloc_count): New function.
4621 (Relobj::allocate_incremental_reloc_counts): New function.
4622 (Relobj::count_incremental_reloc): New function.
4623 (Relobj::finalize_incremental_relocs): New function.
4624 (Relobj::next_incremental_reloc_index): New function.
4625 (Relobj::reloc_counts_): New data member.
4626 (Relobj::reloc_bases_): New data member.
4627 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4628 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4629 (Sized_relobj::incremental_relocs_scan): New function.
4630 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4631 (Sized_relobj::incremental_relocs_write): New function.
4632 (Sized_relobj::incremental_relocs_write_reltype): New function.
4633 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4634 incremental link.
4635 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4636 archives and object files elsewhere.
4637 (Add_symbols::run): Report object files here.
4638 (Finish_group::run): Report end of archive at end of group.
4639 * reloc.cc: Include layout.h, incremental.h.
4640 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4641 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4642 (Sized_relobj::incremental_relocs_scan): New function.
4643 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4644 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4645 (Sized_relobj::incremental_relocs_write): New function.
4646 (Sized_relobj::incremental_relocs_write_reltype): New function.
4647 * script.cc (read_input_script): Rewrite test for incremental link.
4648 Change call to Incremental_inputs::report_script.
4649 * symtab.h (Symbol_table::first_global_index): New function.
4650 (Symbol_table::output_count): New function.
4651
4652 2010-08-12 Doug Kwan <dougkwan@google.com>
4653
4654 * arm.cc (Target_arm::merge_object_attributes): Check command line
4655 options --no-wchar-size-warning and --no-enum-size-warning.
4656 * options.h (General_options): Add ld-compatible options
4657 --no-enum-size-warning and --no-wchar-size-warning.
4658
4659 2010-08-04 Ian Lance Taylor <iant@google.com>
4660
4661 * x86_64.cc (Target_x86_64::Scan::local): Use
4662 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4663 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4664 (Target_x86_64::Scan::global): Likewise.
4665 (Target_x86_64::Relocate::relocate): Likewise.
4666 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4667 Likewise.
4668
4669 2010-08-03 Cary Coutant <ccoutant@google.com>
4670
4671 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4672 to reserve space in merged_strings vector. Keep total input size
4673 for stats.
4674 (Output_merge_string::do_print_merge_stats): Print total input size.
4675 * merge.h (Output_merge_string): Add input_size_ field.
4676 * stringpool.cc (Stringpool_template::string_length): Move
4677 implementations out of Stringpool_template class and place in
4678 stringpool.h.
4679 * stringpool.h (string_length): Move out of Stringpool_template.
4680
4681 2010-08-03 Ian Lance Taylor <iant@google.com>
4682
4683 PR 11712
4684 * layout.cc (relaxation_loop_body): If address of load segment is
4685 set, adjust address to include headers if possible.
4686
4687 2010-08-03 Ian Lance Taylor <iant@google.com>
4688
4689 * version.cc (version_string): Bump to 1.10.
4690
4691 2010-08-03 Ian Lance Taylor <iant@google.com>
4692
4693 PR 11805
4694 * layout.h (enum Output_section_order): Define.
4695 (class Layout): Update declarations.
4696 * layout.cc (Layout::get_output_section): Add order parameter.
4697 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4698 is_first_non_relro parameters. Change all callers.
4699 (Layout::choose_output_section): Likewise.
4700 (Layout::add_output_section_data): Likewise.
4701 (Layout::make_output_section): Likewise. Set order.
4702 (Layout::default_section_order): New function.
4703 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4704 * output.cc (Output_section::Output_section): Initialize order_.
4705 Don't initialize deleted fields.
4706 (Output_segment::Output_segment): Don't initialize deleted
4707 fields.
4708 (Output_segment::add_output_section_to_load): New function
4709 replacing add_output_section. Change all callers to call this or
4710 add_output_section_to_nonload.
4711 (Output_segment::add_output_section_to_nonload): New function.
4712 (Output_segment::remove_output_section): Rewrite.
4713 (Output_segment::add_initial_output_data): Likewise.
4714 (Output_segment::has_any_data_sections): Likewise.
4715 (Output_segment::is_first_section_relro): Likewise.
4716 (Output_segment::maximum_alignment): Likewise.
4717 (Output_segment::has_dynamic_reloc): New function replacing
4718 dynamic_reloc_count. Change all callers.
4719 (Output_segment::has_dynamic_reloc_list): New function replacing
4720 dynamic_reloc_count_list. Change all callers.
4721 (Output_segment::set_section_addresses): Rewrite.
4722 (Output_segment::set_offset): Rewrite.
4723 (Output_segment::find_first_and_last_list): Remove.
4724 (Output_segment::set_tls_offsets): Rewrite.
4725 (Output_segment::first_section_load_address): Likewise.
4726 (Output_segment::output_section_count): Likewise.
4727 (Output_segment::section_with_lowest_load_address): Likewise.
4728 (Output_segment::write_section_headers): Likewise.
4729 (Output_segment::print_sections_to_map): Likewise.
4730 * output.h (class Output_data): Remove dynamic_reloc_count_
4731 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4732 (Output_data::add_dynamic_reloc): Rewrite.
4733 (Output_data::has_dynamic_reloc): New function.
4734 (Output_data::dynamic_reloc_count): Remove.
4735 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4736 is_last_relro_, is_first_non_relro_, is_interp_,
4737 is_dynamic_linker_section_ fields. Add order and set_order
4738 functions. Remove is_relro_local, set_is_relro_local,
4739 is_last_relro, set_is_last_relro, is_first_non_relro,
4740 set_is_first_non_relro functions, is_interp, set_is_interp,
4741 is_dynamic_linker_section, and set_is_dynamic_linker_section
4742 functions.
4743 (class Output_segment): Change Output_data_list from std::list to
4744 std:;vector. Add output_lists_ field. Remove output_data_ and
4745 output_bss_ fields. Update declarations.
4746
4747 2010-08-02 Ian Lance Taylor <iant@google.com>
4748
4749 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4750 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4751 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4752
4753 2010-08-02 Ian Lance Taylor <iant@google.com>
4754
4755 PR 11855
4756 * script.cc (Script_options::Script_options): Initialize
4757 symbol_definitions_ and symbol_references_.
4758 (Script_options::add_symbol_assignment): Update
4759 symbol_definitions_ and symbol_references_.
4760 (Script_options::add_symbol_reference): New function.
4761 (script_symbol): New function.
4762 * script.h (class Script_options): Add symbol_definitions_ and
4763 symbol_references_ fields.
4764 (Script_options::referenced_const_iterator): New type.
4765 (Script_options::referenced_begin): New function.
4766 (Script_options::referenced_end): New function.
4767 (Script_options::is_referenced): New function.
4768 (Script_options::any_unreferenced): New function.
4769 * script-c.h (script_symbol): Declare.
4770 * yyscript.y (exp): Call script_symbol.
4771 * symtab.cc: Include "script.h".
4772 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4773 Change all callers. Check symbols referenced by scripts.
4774 (Symbol_table::add_undefined_symbols_from_command_line): Add
4775 layout parameter. Change all callers.
4776 (Symbol_table::do_add_undefined_symbols_from_command_line):
4777 Likewise. Break out loop body. Check symbols referenced by
4778 scripts.
4779 (Symbol_table::add_undefined_symbol_from_command_line): New
4780 function broken out of
4781 do_add_undefined_symbols_from_command_line.
4782 * symtab.h (class Symbol_table): Update declarations.
4783 * archive.cc: Include "layout.h".
4784 (Archive::should_include_member): Add layout parameter. Change
4785 all callers. Check for symbol mentioned in expression.
4786 * archive.h (class Archive): Update declaration.
4787 * object.cc (Sized_relobj::do_should_include_member): Add layout
4788 parameter.
4789 * object.h (Object::should_include_member): Add layout parameter.
4790 Change all callers.
4791 (Object::do_should_include_member): Add layout parameter.
4792 (class Sized_relobj): Update declaration.
4793 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4794 parameter.
4795 * dynobj.h (class Sized_dynobj): Update declaration.
4796 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4797 layout parameter.
4798 * plugin.h (class Sized_pluginobj): Update declaration.
4799
4800 2010-08-02 Ian Lance Taylor <iant@google.com>
4801
4802 PR 11866
4803 * output.cc (Output_segment::set_offset): Search for the first and
4804 last sections rather than assuming that the list is in order.
4805 (Output_segment::find_first_and_last_list): New function.
4806 * output.h (class Output_segment): Update declarations.
4807 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4808 (relro_strip_test_SOURCES): New variable.
4809 (relro_strip_test_DEPENDENCIES): New variable.
4810 (relro_strip_test_LDFLAGS): New variable.
4811 (relro_strip_test_LDADD): New variable.
4812 (relro_strip_test.so): New target.
4813
4814 2010-08-02 Ian Lance Taylor <iant@google.com>
4815
4816 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4817 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4818 (Target_i386::got_tlsdesc_section): New function.
4819 (Target_i386::got_section): Create space for GOT entries for
4820 TLSDESC relocations.
4821 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4822 R_386_TLS_GOTDESC.
4823 (Target_i386::Scan::global): Likewise.
4824 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4825 using TLSDESC GOT.
4826 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4827 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4828 (Target_x86_64::got_tlsdesc_section): New function.
4829 (Target_x86_64::got_section): Create space for GOT entries for
4830 TLSDESC relocations.
4831 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4832 R_386_TLS_GOTDESC.
4833 (Target_x86_64::Scan::global): Likewise.
4834 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4835 using TLSDESC GOT.
4836
4837 2010-08-02 Ian Lance Taylor <iant@google.com>
4838
4839 * testsuite/final_layout.sh: Use dc to convert from hex to
4840 decimal.
4841
4842 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4843
4844 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4845 paramter to the call to gold::gc_process_relocs.
4846 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4847 paramter to the call to gold::gc_process_relocs.
4848 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4849 parameter to the call to gold::gc_process_relocs.
4850 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4851 template parameter to the call to gold::gc_process_relocs.
4852 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4853 paramter to the call to gold::gc_process_relocs.
4854 * gc.h (get_embedded_addend_size): New function.
4855 (gc_process_relocs): Save the size of the reloc for use by ICF.
4856 * icf.cc (get_section_contents): Get the addend from the text section
4857 for SHT_REL relocation sections.
4858 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4859 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4860 * int_encoding.h (read_from_pointer): New overloaded function.
4861 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4862 * testsuite/icf_sht_rel_addend_test.sh: New file.
4863 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4864 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4865
4866 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4867
4868 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4869 * Makefile.in: Regenerate.
4870 * testsuite/Makefile.in: Regenerate.
4871
4872 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4873
4874 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4875 * gold/testsuite/debug_msg.cc: Likewise.
4876 * gold/testsuite/odr_violation1.cc
4877 * gold/testsuite/odr_violation2.cc
4878
4879 2010-07-21 Cary Coutant <ccoutant@google.com>
4880
4881 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4882 string, and length fields.
4883 (Output_merge_string::Merged_strings_list): New type.
4884 (Output_merge_string::Merged_strings_lists): New typedef.
4885 (Output_merge_string): Replace merged_strings_ with
4886 merged_strings_lists_.
4887 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4888 Merged_strings_list per input object and section. Don't store pointer
4889 to the string. Don't store length with each merged string entry.
4890 (Output_merge_string::finalize_merged_data): Loop over list of merged
4891 strings lists. Recompute length of each merged string.
4892
4893 2010-07-15 Cary Coutant <ccoutant@google.com>
4894
4895 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4896 here.
4897
4898 2010-07-14 Ian Lance Taylor <iant@google.com>
4899
4900 * descriptors.cc (Descriptors::open): Report correct name in error
4901 message.
4902
4903 2010-07-13 Doug Kwan <dougkwan@google.com>
4904
4905 * arm.cc (Arm_input_section::Arm_input_section): For a
4906 SHT_ARM_EXIDX section, always keeps the input sections.
4907 (Arm_input_section::set_exidx_section_link): New method.
4908 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4909 has_errors_ to false.
4910 (Arm_exidx_input_section::has_errors,
4911 Arm_exidx_input_section::set_has_errors): New methods.
4912 (Arm_exidx_input_section::has_errors_): New data member.
4913 (Arm_relobj::get_exidx_shndx_list): New method.
4914 (Arm_output_section::append_text_sections_to_list): Do not skip
4915 section without SHF_EXECINSTR.
4916 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4917 errors.
4918 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4919 section header. Make error messages more verbose. Check for
4920 a non-executable section linked to an EXIDX section.
4921 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4922 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4923 check that there is no deferred EXIDX section if we exit early.
4924 Instead of not making an EXIDX section in case of an error, make one
4925 and set the has_errors flag of it.
4926 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4927 in a relocatable link.
4928 (Target_arm::do_relax): Look for the EXIDX output section instead of
4929 assuming that it is called .ARM.exidx.
4930 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4931 section list. Do not check for SHF_EXECINSTR section flags but
4932 skip any input section with errors.
4933 * output.cc (Output_section::Output_section): Initialize
4934 always_keeps_input_sections_ to false.
4935 (Output_section::add_input_section): Check for
4936 always_keeps_input_sections_.
4937 * output.h (Output_section::always_keeps_input_sections,
4938 Output_section::set_always_keeps_input_sections): New methods.
4939 (Output_section::always_keeps_input_sections): New data member.
4940
4941 2010-07-13 Rafael Espindola <espindola@google.com>
4942
4943 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4944 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4945
4946 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4947 Ian Lance Taylor <iant@google.com>
4948
4949 * output.h (Output_section_lookup_maps::add_merge_section):
4950 Correct check of whether value was inserted.
4951 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4952 (Output_section_lookup_maps::add_relaxed_input_section):
4953 Likewise.
4954 * arm.cc (Target_arm::got_section): Remove used local os.
4955 * i386.cc (Target_i386::got_section): Likewise.
4956 * x86_64.cc (Target_x86_64::got_section): Likewise.
4957 * sparc.cc (Target_sparc::got_section): Likewise.
4958 (Target_sparc::relocate): Remove unused local have_got_offset.
4959 * powerpc.cc (Target_powerpc::relocate): Likewise.
4960
4961 2010-07-13 Ian Lance Taylor <iant@google.com>
4962
4963 * compressed_output.cc (zlib_decompress): Fix signature in
4964 !HAVE_ZLIB_H case.
4965
4966 * archive.cc (Archive::include_member): Unlock an external member
4967 of a thin archive. Don't bother to delete an object we know is
4968 NULL.
4969
4970 2010-07-12 Cary Coutant <ccoutant@google.com>
4971
4972 * compressed_output.cc (zlib_decompress): New function.
4973 (get_uncompressed_size): New function.
4974 (decompress_input_section): New function.
4975 * compressed_output.h (get_uncompressed_size): New function.
4976 (decompress_input_section): New function.
4977 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4978 Handle compressed debug sections.
4979 * layout.cc (is_compressed_debug_section): New function.
4980 (Layout::output_section_name): Map compressed section names to
4981 canonical names.
4982 * layout.h (is_compressed_debug_section): New function.
4983 (is_debug_info_section): Recognize compressed debug sections.
4984 * merge.cc: Include compressed_output.h.
4985 (Output_merge_data::do_add_input_section): Handle compressed
4986 debug sections.
4987 (Output_merge_string::do_add_input_section): Handle compressed
4988 debug sections.
4989 * object.cc: Include compressed_output.h.
4990 (Sized_relobj::Sized_relobj): Initialize new data members.
4991 (build_compressed_section_map): New function.
4992 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4993 * object.h (Object::section_is_compressed): New method.
4994 (Object::do_section_is_compressed): New method.
4995 (Sized_relobj::Compressed_section_map): New type.
4996 (Sized_relobj::do_section_is_compressed): New method.
4997 (Sized_relobj::compressed_sections_): New data member.
4998 * output.cc (Output_section::add_input_section): Handle compressed
4999 debug sections.
5000 * reloc.cc: Include compressed_output.h.
5001 (Sized_relobj::write_sections): Handle compressed debug sections.
5002
5003 2010-07-08 Cary Coutant <ccoutant@google.com>
5004
5005 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5006 weak when resolving to a dynamic def.
5007 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5008 for weak undef/dynamic def cases. Adjust callers.
5009 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5010 undef_binding_weak_.
5011 (Symbol_table::sized_write_globals): Adjust symbol binding.
5012 (Symbol_table::sized_write_symbol): Add binding parameter.
5013 * symtab.h (Symbol::set_undef_binding): New method.
5014 (Symbol::is_undef_binding_weak): New method.
5015 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5016 (Symbol_table::should_override): Add new parameter.
5017 (Symbol_table::sized_write_symbol): Add new parameter.
5018
5019 * testsuite/weak_undef_file1.cc: Add new test case.
5020 * testsuite/weak_undef_file2.cc: Fix header comment.
5021 * testsuite/weak_undef_test.cc: Add new test case.
5022
5023 2010-06-29 Doug Kwan <dougkwan@google.com>
5024
5025 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5026 Initialize USE_SYMBOL_.
5027 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5028 definition.
5029 (Arm_reloc_property::uses_symbol_): New data member declaration.
5030 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5031 uses symbol value and symbol is undefined but not weakly undefined.
5032
5033 2010-06-28 Rafael Espindola <espindola@google.com>
5034
5035 * plugin.cc (Plugin::load): Use dlerror.
5036
5037 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5038
5039 * symtab.cc (detect_odr_violations): When reporting an ODR
5040 violation, report an object where the symbol is defined.
5041
5042 2010-06-25 Doug Kwan <dougkwan@google.com>
5043
5044 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5045 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5046 definition.
5047 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5048 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5049 target hook to detect function points.
5050 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5051 * icf.h (Icf::check_section_for_function_pointers): Change type of
5052 parameter SECTION_NAME to const reference to std::string. Use
5053 target hook to determine if section may have unsafe pointers.
5054 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5055 method definition.
5056
5057 2010-06-21 Rafael Espindola <espindola@google.com>
5058
5059 * fileread.cc (Input_file::find_fie): New
5060 (Input_file::open): Use Input_file::find_fie.
5061 * fileread.h (Input_file::find_fie): New
5062 * plugin.cc (set_extra_library_path): New.
5063 (Plugin::load): Add set_extra_library_path to the transfer vector.
5064 (Plugin_manager::set_extra_library_path): New.
5065 (Plugin_manager::add_input_file): Use the extra search path if set.
5066 (set_extra_library_path(): New.
5067 * plugin.h (Plugin_manager): Add set_extra_library_path and
5068 extra_search_path_.
5069
5070 2010-06-19 Cary Coutant <ccoutant@google.com>
5071
5072 * layout.cc (gdb_sections): Add .debug_types.
5073 (lines_only_debug_sections): Likewise.
5074
5075 2010-06-18 Rafael Espindola <espindola@google.com>
5076
5077 * plugin.cc (add_input_file,add_input_library)
5078 (Plugin_manager::add_input_file): Make filename arguments const.
5079 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5080 const.
5081
5082 2010-06-16 Doug Kwan <dougkwan@google.com>
5083
5084 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5085 .ARM.attributes section if we have not merged any input
5086 attributes sections.
5087
5088 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5089
5090 * arm.cc: Allow combining objects with no EABI version
5091 information.
5092
5093 2010-06-15 Rafael Espindola <espindola@google.com>
5094
5095 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5096
5097 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5098
5099 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5100 (struct iovec): Correct !HAVE_READV definition.
5101
5102 2010-06-10 Cary Coutant <ccoutant@google.com>
5103
5104 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5105 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5106 reloc sections.
5107 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5108
5109 PR 11683
5110 * symtab.h (Symbol::is_placeholder): New member function.
5111 * target-reloc.h (relocate_section): Check for placeholder symbols.
5112
5113 * testsuite/Makefile.am (plugin_test_8): New test.
5114 (plugin_test_9): New test.
5115 * testsuite/Makefile.in: Regenerate.
5116
5117 2010-06-09 Nick Clifton <nickc@redhat.com>
5118
5119 * yyscript.y (input_list_element): Allow strings prefixed with
5120 the '-' character. Treat these as libraries.
5121 * script.cc (script_add_library): New function. Adds a library
5122 specified by "-l<name>" found in an input script.
5123 * script-c.h: Add prototype for script_add_library.
5124
5125 2010-06-07 Doug Kwan <dougkwan@google.com>
5126
5127 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5128 Restrict stub-group size to be within long conditional branch
5129 range when working around cortex-A8 erratum.
5130
5131 2010-06-07 Damien Diederen <dd@crosstwine.com>
5132
5133 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5134 #ifdef typo.
5135
5136 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5137
5138 PR gold/11658
5139 * output.cc
5140 (Output_section::Input_section_sort_entry::compare_section_ordering):
5141 Change to return non-zero correctly.
5142 (Output_section::Input_section_sort_section_order_index_compare
5143 ::operator()): Change to fix ambiguity in comparisons.
5144
5145 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5146
5147 * gold.h (is_wildcard_string): New function.
5148 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5149 (Layout::layout_eh_frame): Ditto.
5150 (Layout::find_section_order_index): New method.
5151 (Layout::read_layout_from_file): New method.
5152 * layout.h (Layout::find_section_order_index): New method.
5153 (Layout::read_layout_from_file): New method.
5154 (Layout::input_section_position_): New private member.
5155 (Layout::input_section_glob_): New private member.
5156 * main.cc (main): Call read_layout_from_file here.
5157 * options.h (--section-ordering-file): New option.
5158 * output.cc (Output_section::input_section_order_specified_): New
5159 member.
5160 (Output_section::Output_section): Initialize new member.
5161 (Output_section::add_input_section): Add new parameter.
5162 Keep input sections when --section-ordering-file is used.
5163 (Output_section::set_final_data_size): Sort input sections when
5164 section ordering file is specified.
5165 (Output_section::Input_section_sort_entry): Add new parameter.
5166 Check sorting type.
5167 (Output_section::Input_section_sort_entry::compare_section_ordering):
5168 New method.
5169 (Output_section::Input_section_sort_compare::operator()): Change to
5170 consider section_order_index.
5171 (Output_section::Input_section_sort_init_fini_compare::operator()):
5172 Change to consider section_order_index.
5173 (Output_section::Input_section_sort_section_order_index_compare
5174 ::operator()): New method.
5175 (Output_section::sort_attached_input_sections): Change to sort
5176 according to section order when specified.
5177 (Output_section::add_input_section<32, true>): Add new parameter.
5178 (Output_section::add_input_section<64, true>): Add new parameter.
5179 (Output_section::add_input_section<32, false>): Add new parameter.
5180 (Output_section::add_input_section<64, false>): Add new parameter.
5181 * output.h (Output_section::add_input_section): Add new parameter.
5182 (Output_section::input_section_order_specified): New
5183 method.
5184 (Output_section::set_input_section_order_specified): New method.
5185 (Input_section::Input_section): Initialize section_order_index_.
5186 (Input_section::section_order_index): New method.
5187 (Input_section::set_section_order_index): New method.
5188 (Input_section::section_order_index_): New member.
5189 (Input_section::Input_section_sort_section_order_index_compare): New
5190 struct.
5191 (Output_section::input_section_order_specified_): New member.
5192 * script-sections.cc (is_wildcard_string): Delete and move modified
5193 method to gold.h.
5194 (Output_section_element_input::Output_section_element_input): Modify
5195 call to is_wildcard_string.
5196 (Output_section_element_input::Input_section_pattern
5197 ::Input_section_pattern): Ditto.
5198 (Output_section_element_input::Output_section_element_input): Ditto.
5199 * testsuite/Makefile.am (final_layout): New test case.
5200 * testsuite/Makefile.in: Regenerate.
5201 * testsuite/final_layout.cc: New file.
5202 * testsuite/final_layout.sh: New file.
5203
5204 2010-06-01 Rafael Espindola <espindola@google.com>
5205
5206 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5207
5208 2010-06-01 Rafael Espindola <espindola@google.com>
5209
5210 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5211 visibility of symbols.
5212
5213 2010-05-27 Doug Kwan <dougkwan@google.com>
5214
5215 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5216 from start of output section instead of address for a local symbol
5217 in a merged or relaxed section when doing a relocatable link.
5218
5219 2010-05-26 Rafael Espindola <espindola@google.com>
5220
5221 PR 11604
5222 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5223 adding sections the garbage collector removed.
5224 * gold/testsuite/Makefile.am: Add test.
5225 * gold/testsuite/Makefile.in: Regenerate.
5226 * gold/testsuite/plugin_test_7.sh: New.
5227 * gold/testsuite/plugin_test_7_1.c: New.
5228 * gold/testsuite/plugin_test_7_2.c: New.
5229
5230 2010-05-26 Rafael Espindola <espindola@google.com>
5231
5232 * script-sections.cc (Output_section_definition::set_section_addresses):
5233 Check for --section-start.
5234
5235 2010-05-26 Doug Kwan <dougkwan@google.com>
5236
5237 * arm.cc (Arm_scan_relocatable_relocs): New class.
5238 (Target_arm::relocate_special_relocatable): New method.
5239 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5240 (Arm_relocate_functions::thumb_branch_common): Same.
5241 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5242 instead of Default_scan_relocatable_relocs.
5243 * target-reloc.h (relocate_for_relocatable): Let target handle
5244 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5245 * target.h (Sized_target::relocate_special_relocatable): New method.
5246
5247 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5248
5249 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5250
5251 2010-05-23 Doug Kwan <dougkwan@google.com>
5252
5253 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5254 instead of a cast.
5255 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5256 with a direct branch, not a conditional branch, to a stub.
5257 * merge.cc (Output_merge_base::record_input_section): New method
5258 defintion.
5259 (Output_merge_data::do_add_input_section): Record input section if
5260 keeps-input-sections flag is set.
5261 (Output_merge_string::do_add_input_section): Ditto.
5262 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5263 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5264 INPUT_SECTIONS_.
5265 (Output_merge_base::keeps_input_sections,
5266 Output_merge_base::set_keeps_input_sections,
5267 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5268 method definitions.
5269 (Output_merge_base::Input_sections): New type declaration.
5270 (Output_merge_base::input_sections_begin,
5271 Output_merge_base::input_sections_end,
5272 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5273 (Output_merge_base::bool keeps_input_sections_,
5274 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5275 Output_merge_base::input_sections_): New data members.
5276 (Output_merge_data::do_set_keeps_input_sections): New method
5277 defintion.
5278 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5279 * output.cc (Output_section::Input_section::relobj): Move method
5280 defintion from class declaration to here and handle merge sections.
5281 (Output_section::Input_section::shndx): Ditto.
5282 (Output_section::Output_section): Remove initializations of removed
5283 data members and initialize new data member LOOKUP_MAPS_.
5284 (Output_section::add_input_section): Set keeps-input-sections flag
5285 for a newly created merge output section as appropriate. Adjust code
5286 to use Output_section_lookup_maps class.
5287 (Output_section::add_relaxed_input_section): Adjst code for lookup
5288 maps code refactoring.
5289 (Output_section::add_merge_input_section): Add a new parameter
5290 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5291 class. If adding input section to a newly created merge output
5292 section fails, remove the new merge section.
5293 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5294 Adjust code for use of the Output_section_lookup_maps class.
5295 (Output_section::find_merge_section): Ditto.
5296 (Output_section::build_lookup_maps): New method defintion.
5297 (Output_section::find_relaxed_input_section): Adjust code to use
5298 Output_section_lookup_maps class.
5299 (Output_section::get_input_sections): Export merge sections. Adjust
5300 code to use Output_section_lookup_maps class.
5301 (Output_section:::add_script_input_section): Adjust code to use
5302 Output_section_lookup_maps class. Update lookup maps for merge
5303 sections also.
5304 (Output_section::discard_states): Use Output_section_lookup_maps.
5305 (Output_section::restore_states): Same.
5306 * output.h (Merge_section_properties): Move class defintion out of
5307 Output_section.
5308 (Output_section_lookup_maps): New class.
5309 (Output_section::Input_section::is_merge_section): New method
5310 defintion.
5311 (Output_section::Input_section::relobj): Move defintion out of class
5312 defintion. Declare method only.
5313 (Output_section::Input_section::shndx): Ditto.
5314 (Output_section::Input_section::output_merge_base): New method defintion.
5315 (Output_section::Input_section::u2_.pomb): New union field.
5316 (Output_section::Merge_section_by_properties_map,
5317 Output_section::Output_section_data_by_input_section_map,
5318 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5319 Remove types.
5320 (Output_section::add_merge_input_section): Add new parameter
5321 KEEPS_INPUT_SECTIONS.
5322 (Output_section::build_lookup_maps): New method declaration.
5323 (Output_section::merge_section_map_,
5324 Output_section::merge_section_by_properties_map_,
5325 Output_section::relaxed_input_section_map_,
5326 Output_section::is_relaxed_input_section_map_valid_): Remove data
5327 members.
5328 (Output_section::lookup_maps_): New data member.
5329
5330 2010-05-21 Doug Kwan <dougkwan@google.com>
5331
5332 PR gold/11619
5333 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5334 avoid a compilation error.
5335
5336 2010-05-19 Rafael Espindola <espindola@google.com>
5337
5338 * script-sections.cc (Output_section_definition::allocate_to_segment):
5339 Update the phdrs_list even when the output section is NULL.
5340 * testsuite/Makefile.am: Add test.
5341 * testsuite/Makefile.in: Regenerate.
5342 * testsuite/script_test_9.cc: New.
5343 * testsuite/script_test_9.sh: New.
5344 * testsuite/script_test_9.t: New.
5345
5346 2010-05-19 Doug Kwan <dougkwan@google.com>
5347
5348 * arm.cc (Arm_input_section::original_size): New method.
5349 (Arm_input_section::do_addralign): Add a cast.
5350 (Arm_input_section::do_output_offset): Remove static cast.
5351 (Arm_input_section::original_addralign,
5352 Arm_input_section::original_size_): Change type to uint32_t.
5353 (Arm_input_section::init): Add safe casts for section alignment
5354 and size.
5355 (Arm_input_section::set_final_data_size): Do not set address and
5356 offset of stub table.
5357 (Arm_output_section::fix_exidx_coverage): Change use of of
5358 Output_section::Simple_input_section to that of
5359 Output_section::Input_section.
5360 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5361 except for the first pass.
5362 * output.cc (Output_section::get_input_sections): Change type of
5363 input_sections to std::list<Input_section>.
5364 (Output_section::add_script_input_section): Rename from
5365 Output_section::add_simple_input_section. Change type of SIS
5366 parameter from Simple_input_section to Input_section.
5367 * output.h (Output_section::Simple_input_section): Remove class.
5368 (Output_section::Input_section): Change class visibility to public.
5369 (Output_section::Input_section::addralign): Use stored alignments
5370 for special input sections if set.
5371 (Output_section::Input_section::set_addralign): New method.
5372 (Output_section::get_input_sections): Change parameter type from
5373 list of Simple_input_section to list of Input_section.
5374 (Output_section::add_script_input_section): Rename from
5375 Output_section::add_simple_input_section. Change first parameter's
5376 type from Simple_input_section to Input_section and remove the
5377 second and third parameters.
5378 * script-sections.cc (Input_section::Input_section_list): Change
5379 type to list of Output_section::Input_section/
5380 (Input_section_info::Input_section_info): Change parameter type of
5381 INPUT_SECTION to Output_section::Input_section.
5382 (Input_section_info::input_section): Change return type.
5383 (Input_section_info::input_section_): Change type to
5384 Output_section::Input_section.
5385 (Output_section_element_input::set_section_addresses): Adjust code
5386 to use Output_section::Input_section instead of
5387 Output_section::Simple_input_section. Adjust code for renaming
5388 of Output_section::add_simple_input_section.
5389 (Orphan_output_section::set_section_addresses): Ditto.
5390
5391 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5392
5393 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5394 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5395
5396 2010-05-18 Rafael Espindola <espindola@google.com>
5397
5398 * options.cc (General_options::finalize): Handle -nostdlib.
5399 * options.h (nostdlib): New option.
5400 * script.cc (script_add_search_dir): Handle -nostdlib.
5401
5402 2010-05-12 Doug Kwan <dougkwan@google.com>
5403
5404 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5405 attributes section only if there no attributes section after merging.
5406 (Target_arm::merge_object_attributes): Move value of
5407 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5408 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5409 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5410 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5411 and arm_attr_merge_7.stdout.
5412 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5413 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5414 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5415 arm_attr_merge_7b.o): New rules.
5416 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5417 arm_attr_merge_7
5418 * testsuite/Makefile.in: Regenerate.
5419 * testsuite/arm_attr_merge.sh: New file.
5420 * testsuite/arm_attr_merge_[67][ab].s: Same.
5421
5422 2010-05-05 Nick Clifton <nickc@redhat.com>
5423
5424 * po/es.po: Updated Spanish translation.
5425
5426 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5427
5428 * Makefile.am (install-exec-local): Properly install gold as
5429 default cross linker.
5430 * Makefile.in: Regenerated.
5431
5432 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5433 Nick Clifton <nickc@redhat.com>
5434
5435 * configure.ac (install_as_default): Define and set to false
5436 unless --enable-gold or --enable-gold=both/gold has been
5437 specified.
5438 * configure: Regenerate.
5439
5440 * Makefile.am (install-exec-local): Install the executable as
5441 'ld.gold'. If install_as_default is true then also install it as
5442 'ld'.
5443 * Makefile.in: Regenerated.
5444
5445 2010-04-24 Ian Lance Taylor <iant@google.com>
5446
5447 * layout.cc (Layout::layout_reloc): In relocatable link don't
5448 combine reloc sections for grouped sections.
5449
5450 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5451
5452 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5453 sections that are not ordinary to icf.
5454 * icf.cc (get_section_contents): Handle relocation pointing to section
5455 with no object or shndx information.
5456 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5457 * testsuite/Makefile.in: Regenerate.
5458 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5459 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5460
5461 2010-04-22 Ian Lance Taylor <iant@google.com>
5462
5463 * expression.cc (Expression::Expression_eval_info): Add
5464 result_alignment_pointer field.
5465 (Expression::eval_with_dot): Add result_alignment_pointer
5466 parameter. Change all callers.
5467 (Expression::eval_maybe_dot): Likewise.
5468 (class Binary_expression): Add alignment_pointer parameter to
5469 left_value and right_value. Change all callers.
5470 (BINARY_EXPRESSION): Set result alignment.
5471 (class Trinary_expression): Add alignment_pointer parameter to
5472 arg2_value and arg3_value. Change all callers.
5473 (Trinary_cond::value): Set result alignment.
5474 (Max_expression::value, Min_expression::value): Likewise.
5475 (Align_expression::value): Likewise.
5476 * script-sections.cc (class Sections_element): Add dot_alignment
5477 parameter to set_section_addresses virtual function. Update
5478 instantiations.
5479 (class Output_section_element): Likewise.
5480 (Script_sections::create_segments): Add dot_alignment parameter.
5481 Change all callers.
5482 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5483 (Script_sections::set_phdrs_clause_addresses): Likewise.
5484 * script-sections.h: Update declarations.
5485 * script.h: Update declarations.
5486 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5487 min_p_align.
5488 * testsuite/script_test_3.t: Set large alignment.
5489 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5490 segment has expected alignment.
5491
5492 2010-04-22 Nick Clifton <nickc@redhat.com>
5493
5494 * po/gold.pot: Updated by the Translation project.
5495 * po/vi.po: Updated Vietnamese translation.
5496
5497 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5498
5499 * testsuite/Makefile.am (check_PROGRAMS): Add
5500 icf_virtual_function_folding_test.
5501 * testsuite/Makefile.in: Regenerated.
5502
5503 2010-04-15 Andrew Haley <aph@redhat.com>
5504
5505 * options.h (merge_exidx_entries): New option.
5506 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5507 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5508 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5509 (Target_arm::merge_exidx_entries): New function.
5510 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5511 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5512 to Arm_exidx_fixup constructor.
5513 Add new arg, merge_exidx_entries.
5514 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5515 Arm_output_section::fix_exidx_coverage.
5516
5517 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5518
5519 * icf.cc (get_section_contents): Check for preemptible functions.
5520 Ignore addend when appropriate.
5521 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5522 section folded.
5523 (add_from_relobj): Check for section folded.
5524 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5525 * symtab.h (should_add_dynsym_entry): Add new parameter.
5526 * target-reloc.h (scan_relocs): Check for section folded.
5527 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5528 Check reloc types for function pointers in shared objects.
5529 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5530 case.
5531 (icf_preemptible_functions_test): New test case.
5532 (icf_string_merge_test): New test case.
5533 * testsuite.Makefile.in: Regenerate.
5534 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5535 bar_glob. Refactor code.
5536 * testsuite/icf_preemptible_functions_test.cc: New file.
5537 * testsuite/icf_preemptible_functions_test.sh: New file.
5538 * testsuite/icf_string_merge_test.cc: New file.
5539 * testsuite/icf_string_merge_test.sh: New file.
5540 * testsuite/icf_virtual_function_folding_test.cc: New file.
5541 * testsuite/icf_virtual_function_folding_test.sh: New file.
5542
5543 2010-04-14 Doug Kwan <dougkwan@google.com>
5544
5545 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5546 for local symbol recounting if we remove a section due to ICF.
5547 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5548 there are no regular objects in input.
5549
5550 2010-04-13 Doug Kwan <dougkwan@google.com>
5551
5552 * arm.cc (Arm_input_section::set_final_data_size): Compute
5553 accurate final data size instead of using current data size.
5554
5555 2010-04-09 Doug Kwan <dougkwan@google.com>
5556
5557 * layout.cc (Layout::choose_output_section): Handle script section
5558 types.
5559 (Layout::make_output_section_for_script): Add section type parameter.
5560 Handle script section types.
5561 * layout.h (Layout::make_output_section_for_script): Add section
5562 type parameter.
5563 * output.cc (Output_section::Output_section): Initialize data member
5564 is_noload_.
5565 (Output_section::do_reset_address_and_file_offset): Do not set address
5566 to 0 if section is a NOLOAD section.
5567 * output.h (Output_section::is_noload): New method.
5568 (Output_section::set_is_noload): Ditto.
5569 (Output_section::is_noload_): New data member.
5570 * script-c.h (Script_section_type): New enum type.
5571 (struct Parser_output_section_header): Add new file section_type.
5572 * script-sections.cc (Sections_element::output_section_name): Add
5573 parameter for returning script section type.
5574 (Output_section_definition::output_section_name): Ditto.
5575 (Output_section_definition::section_type)P; New method.
5576 (Output_section_definiton::script_section_type_name): Ditto.
5577 (Output_section_definition::script_section_type_): New data member.
5578 (Output_section_definition::Output_section_definition): Initialize
5579 data member Output_section_definition::script_section_type_.
5580 (Output_section_definition::create_sections): Pass script section type
5581 to Layout::make_output_section_for_script.
5582 (Output_section_definition::output_section_name): Return script
5583 section type to caller.
5584 (Output_section_definition::set_section_address): Do not advance
5585 dot value and load address if section type is NOLOAD. Set address
5586 of NOLOAD sections regardless of section flags.
5587 (Output_section_definition::print): Print section type if it is
5588 not SCRIPT_SECTION_TYPE_NONE.
5589 (Output_section_definition::section_type): New method.
5590 (Output_section_definition::script_section_type_name): Ditto.
5591 (Script_sections::output_section_name): Add new parameter
5592 PSECTION_TYPE for returning script section type. Pass it to
5593 section elements. Handle discard sections.
5594 (Sort_output_sections::operator()): Handle NOLOAD sections.
5595 * script-sections.h (Script_sections::Section_type): New enum type.
5596 (Script_sections::output_section_name): Add a new parameter for
5597 returning script section type.
5598 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5599 INFO and NOLOAD.
5600 * yyscript.y (union): Add new field SECTION_TYPE.
5601 (COPY, DSECT, INFO, NOLOAD): New tokens.
5602 (opt_address_and_section_type): Change type to output_section_header.
5603 (section_type): New non-terminal
5604 (section_header): Handle section type.
5605 (opt_address_and_section_type): Return section type value.
5606
5607 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5608
5609 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5610 * testsuite/plugin_common_test_2.c (foo): Likewise.
5611
5612 2010-04-08 Doug Kwan <dougkwan@google.com>
5613
5614 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5615 Output_merge_data.
5616 * output.cc (Output_section::add_merge_input_section): Simplify
5617 code and return status of Output_merge_base::add_input_section.
5618 Update merge section map only if Output_merge_base::add_input_section
5619 returns true.
5620
5621 2010-04-07 Doug Kwan <dougkwan@google.com>
5622
5623 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5624 if section is marked as containing instructions but has no mapping
5625 symbols.
5626 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5627 correct section index.
5628 (Arm_relobj::find_linked_text_section): Ditto.
5629
5630 2010-04-07 Cary Coutant <ccoutant@google.com>
5631
5632 * archive.cc (include_member): Destroy Read_symbols_data object before
5633 releasing file.
5634 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5635 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5636 (Read_symbols_data::~Read_symbols_data) New destructor.
5637 (Section_relocs::Section_relocs) New constructor.
5638 (Section_relocs::~Section_relocs) New destructor.
5639 (Read_relocs_data::Read_relocs_data) New constructor.
5640 (Read_relocs_data::~Read_relocs_data) New destructor.
5641 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5642 pointers to NULL after deleting.
5643
5644 2010-04-07 Doug Kwan <dougkwan@google.com>
5645
5646 * arm.cc: Replace "endianity" with "endianness" in comments.
5647 (Arm_exidx_cantunwind): Ditto.
5648 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5649 (Arm_relobj::merge_flags_and_attributes): New method.
5650 (Arm_relobj::merge_flags_and_attributes_): New data member.
5651 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5652 (Arm_relobj::scan_sections_for_stubs): Ditto.
5653 (Arm_relobj::do_read_symbols): Check to see if we really want to
5654 merge processor-specific flags and attributes. Exit early if
5655 an object is empty except for section names and the undefined symbol.
5656 (Target_arm::do_finalize_sections): Move check for ELF format to
5657 Arm_relobj::do_read_symbols. Merge processor specific flags and
5658 attributes from a regular object only when we have determined that
5659 it is aapropriate. Do not create an .ARM.attributes section in
5660 output if there is no regular input object.
5661 (Target_arm::merge_processor_specific_flags): Check
5662 --warn-mismatch before printing any error.
5663 (Target_arm::merge_object_attributes): Ditto.
5664 * gold.cc (queue_middle_tasks): Handle the case in which there is
5665 no regular object in input.
5666 * options.cc (General_options::parse_EB): New method.
5667 (General_options::parse_EL): Same.
5668 (General_options::General_options): Initialize endianness_.
5669 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5670 New options.
5671 (General_options::Endianness): New enum.
5672 (General_options::endianness): New method.
5673 (General_options::endianness_): New data member.
5674 * parameters.cc (Parameters::set_options): Check target endianness.
5675 (Parameters::set_target_once): Ditto.
5676 (Parameters::check_target_endianness): New method.
5677 (parameters_force_valid_target): If either -EL or -EB is specified,
5678 use it to define endianness of default target.
5679 * parameters.h (Parameters::check_target_endianness): New method
5680 declaration.
5681 * target.h (class Target): Change "endianity" to "endianness"
5682 in comments.
5683
5684 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5685
5686 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5687 * configure: Regenerate.
5688 * Makefile.in: Regenerate.
5689 * testsuite/Makefile.in: Regenerate.
5690
5691 2010-04-06 Cary Coutant <ccoutant@google.com>
5692
5693 gcc PR lto/42757
5694 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5695 prevailing definitions of common symbols.
5696 * testsuite/plugin_test_6.sh: New test case.
5697 * testsuite/plugin_common_test_1.c: New test case.
5698 * testsuite/plugin_common_test_2.c: New test case.
5699 * testsuite/Makefile.am (plugin_test_6): New test case.
5700 * testsuite/Makefile.in: Regenerate.
5701
5702 2010-04-06 Nick Clifton <nickc@redhat.com>
5703
5704 * po/vi.po: New Vietnamese translation.
5705
5706 2010-03-30 Doug Kwan <dougkwan@google.com>
5707
5708 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5709
5710 2010-03-25 Doug Kwan <dougkwan@google.com>
5711
5712 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5713 to avoid a conversion warning on a 32-bit host.
5714
5715 2010-03-24 Ian Lance Taylor <iant@google.com>
5716
5717 * testsuite/script_test_3.t: Add a TLS segment.
5718 * testsuite/Makefile.am (check_PROGRAMS): Add
5719 tls_phdrs_script_test.
5720 (tls_phdrs_script_test_SOURCES): Define.
5721 (tls_phdrs_script_test_DEPENDENCIES): Define.
5722 (tls_phdrs_script_test_LDFLAGS): Define.
5723 (tls_phdrs_script_test_LDADD): Define.
5724 * testsuite/Makefile.in: Rebuild.
5725
5726 2010-03-23 Cary Coutant <ccoutant@google.com>
5727
5728 * fileread.cc (find_or_make_view): Fix comment.
5729
5730 2010-03-23 Ian Lance Taylor <iant@google.com>
5731
5732 * script-sections.cc (class Orphan_section_placement): Define
5733 PLACE_TLS and PLACE_TLS_BSS.
5734 (Orphan_section_placement::Orphan_section_placement): Initialize
5735 new places.
5736 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5737 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5738 (tls_script_test_SOURCES): Define.
5739 (tls_script_test_DEPENDENCIES): Define.
5740 (tls_script_test_LDFLAGS): Define.
5741 (tls_script_test_LDADD): Define.
5742 * testsuite/Makefile.in: Rebuild.
5743
5744 2010-03-22 Doug Kwan <dougkwan@google.com>
5745
5746 * arm.cc (Arm_relocate_functions::abs8,
5747 Arm_relocate_functions::abs16): Use correct check for overflow
5748 specified in the ARM ELF specs.
5749 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5750 target of a BLX instruction specially.
5751 (Reloc_stub::stub_type_for_reloc): Ditto.
5752 (Relocate::relocate): Use symbolic names instead of numeric relocation
5753 codes to report error.
5754 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5755 workaround.
5756 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5757 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5758 thumb2_blx_out_of_range.stdout
5759 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5760 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5761 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5762 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5763 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5764 thumb2_blx_in_range, thumb2_blx_in_range.o,
5765 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5766 thumb2_blx_out_of_range.o): New rules.
5767 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5768 thumb2_blx_in_range and thumb2_blx_out_of_range.
5769 * testsuite/Makefile.in: Regenerate.
5770 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5771 * testsuite/thumb_blx_in_range.s: New file.
5772 * testsuite/thumb_blx_out_of_range.s: New file.
5773
5774 2010-03-22 Rafael Espindola <espindola@google.com>
5775
5776 * archive.cc (Should_include): Move to archive.h.
5777 (should_include_member): Make it a member of Archive.
5778 (Lib_group): New.
5779 (Add_lib_group_symbols): New.
5780 * archive.h: Include options.h.
5781 (Archive_member): Moved from Archive.
5782 (Should_include): Moved from archive.cc.
5783 (Lib_group): New.
5784 (Add_lib_group_symbols): New.
5785 * dynobj.cc (do_should_include_member): New.
5786 * dynobj.h (do_should_include_member): New.
5787 * gold.cc (queue_initial_tasks): Update call to queue.
5788 * main.cc (main): Print lib group stats.
5789 * object.cc (do_should_include_member): New.
5790 * object.h: Include archive.h.
5791 (Object::should_include_member): New.
5792 (Object::do_should_include_member): New.
5793 (Sized_relobj::do_should_include_member): New.
5794 * options.cc (General_options::parse_start_lib): New.
5795 (General_options::parse_end_lib): New.
5796 (Input_arguments::add_file): Handle lib groups.
5797 (Input_arguments::start_group): Check we are not in a lib.
5798 (Input_arguments::start_lib): New.
5799 (Input_arguments::end_lib): New.
5800 * options.h (General_options): Add start_lib and end_lib.
5801 (Input_argument::lib_): New.
5802 (Input_argument::lib): New.
5803 (Input_argument::is_lib): New.
5804 (Input_file_lib): New.
5805 (Input_arguments::in_lib_): New.
5806 (Input_arguments::in_lib): New.
5807 (Input_arguments::start_lib): New.
5808 (Input_arguments::end_lib_): New.
5809 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5810 in unused members as preempted.
5811 (Sized_pluginobj::do_should_include_member): New.
5812 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5813 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5814 return the blocker.
5815 (Read_symbols::do_whole_lib_group): New.
5816 (Read_symbols::do_lib_group): New.
5817 (Read_symbols::do_read_symbols): Handle lib groups.
5818 (Read_symbols::get_name): Handle lib groups.
5819 * readsyms.h (Read_symbols): Add an archive member pointer.
5820 (Read_symbols::do_whole_lib_group): New.
5821 (Read_symbols::do_lib_group): New.
5822 (Read_symbols::member_): New.
5823 * script.cc (read_input_script): Update call to queue_soon.
5824
5825 2010-03-19 Doug Kwan <dougkwan@google.com>
5826
5827 * arm.cc (Stub_table::Stub_table): Initialize new data members
5828 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5829 (Stub_table::add_reloc_stub): Assign stub offset and update
5830 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5831 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5832 New data members.
5833 (Stub_table::update_data_size_and_addralign): Use
5834 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5835 instead of going over all reloc stubs.
5836 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5837 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5838 Stringpool_template::offset_ to size of Stringpool_char.
5839 (Stringpool_template::new_key_offset): Remove code to initialize
5840 Stringpool_template::offset_.
5841 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5842 Stringpool_template::offset_ to zero.
5843
5844 2010-03-15 Doug Kwan <dougkwan@google.com>
5845
5846 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5847 offset_.
5848 (Stringpool_template::new_key_offset): New method.
5849 (Stringpool_template::add_string): Assign offsets when adding new
5850 strings.
5851 (Stringpool_template::set_string_offsets): Do not set string offsets
5852 when not optimizing.
5853 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5854 member size_.
5855 (Chunked_vector::clear): Clear size_.
5856 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5857 (Chunked_vector::size): Return size_.
5858 (Chunked_vector::push_back): Use size_ to find insert position.
5859 (Chunked_vector::size_): New data member.
5860 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5861 (Stringpool_template::new_key_offset): New method declaration.
5862 (Stringpool_template::offset_): New data member.
5863
5864 2010-03-15 Rafael Espindola <espindola@google.com>
5865
5866 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5867 Add_symbols' constructor.
5868 * readsyms.h (Add_symbols): Remove the input_group member.
5869
5870 2010-03-10 Ian Lance Taylor <iant@google.com>
5871
5872 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5873 target to ask whether a reference to a symbol requires a stack
5874 split.
5875 * target.h (Target::is_call_to_non_split): New function.
5876 (Target::do_is_call_to_non_split): Declare virtual function.
5877 * target.cc: Include "symtab.h".
5878 (Target::do_is_call_to_non_split): New function.
5879 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5880
5881 2010-03-10 Cary Coutant <ccoutant@google.com>
5882
5883 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5884 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5885 (File_read::open[2]): Add whole_file_view_ to list of views.
5886 (File_read::make_view): Remove test of whole_file_view_.
5887 (File_read::find_or_make_view): Create whole_file_view_ if
5888 necessary.
5889 (File_read::clear_views): Replace bool parameter with enum;
5890 adjust all callers. Don't delete views with permanent data;
5891 do delete cached views and views from archives if
5892 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5893 if clearing the corresponding view.
5894 * fileread.h (File_read::Clear_views_mode): New enum.
5895 (File_read::View::is_permanent_view): New method.
5896 (File_read::clear_views): Replace bool parameter
5897 with enum; adjust all callers.
5898 * options.h (General_options): Change keep_files_mapped option;
5899 add map_whole_files.
5900 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5901 releasing the file.
5902 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5903 the file.
5904
5905 2010-03-10 David S. Miller <davem@davemloft.net>
5906
5907 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5908
5909 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5910
5911 * icf.cc (get_section_contents): Add '@' marker after processing the
5912 merge reloc.
5913
5914 2010-03-08 Doug Kwan <dougkwan@google.com>
5915
5916 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5917 due to a conversion warning.
5918 (Arm_relobj::update_output_local_symbol_count): Check for local
5919 symbol with unset output index.
5920
5921 2010-03-05 Ian Lance Taylor <iant@google.com>
5922
5923 * options.h (class General_options): Add --spare-dynamic-tags.
5924 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5925 --spare-dynamic-tags.
5926
5927 2010-03-05 Ian Lance Taylor <iant@google.com>
5928
5929 * incremental.cc: Include "libiberty.h".
5930
5931 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5932
5933 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5934 function, is_info_ member.
5935 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5936 (Versions::Versions): Update caller.
5937 (Versions::define_base_version): Likewise.
5938 (Versions::add_def): Likewise.
5939
5940 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5941
5942 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5943 (Scan::possible_function_pointer_reloc): New function.
5944 (Scan::local_reloc_may_be_function_pointer): Change to call
5945 possible_function_pointer_reloc.
5946 (Scan::global_reloc_may_be_function_pointer): Ditto.
5947 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5948 relocations in ".data.rel.ro._ZTV" section.
5949 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5950 * testsuite/icf_safe_so_test.cc: Ditto.
5951 * testsuite/icf_safe_test.cc: Ditto.
5952 * testsuite/icf_safe_test.sh: Ditto.
5953
5954 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5955 Ian Lance Taylor <iant@google.com>
5956
5957 * target-reloc.h (relocate_section): Check the symbol table index
5958 for -1U before setting the local symbol index.
5959 (scan_relocatable_relocs): If copying the relocation, record that
5960 the local symbol is required.
5961 * object.h (Symbol_value::is_output_symtab_index_set): New
5962 function.
5963 (Symbol_value::may_be_discarded_from_output_symtab): New
5964 function.
5965 (Symbol_value::has_output_symtab_entry): New function.
5966 (Symbol_value::needs_output_symtab_entry): Remove.
5967 (Symbol_value::output_symtab_index): Make sure the symbol index is
5968 set.
5969 (Symbol_value::set_output_symtab_index): Make sure the symbol
5970 index is not set. Make sure the new index is valid.
5971 (Symbol_value::set_must_have_output_symtab_entry): New function.
5972 (Symbol_value::has_output_dynsym_entry): New function.
5973 (Symbol_value::set_output_dynsym_index): Make sure the new index
5974 is valid.
5975 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5976 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5977 local symbol if permitted.
5978 (Sized_relobj::do_finalize_local_symbols): Call
5979 is_output_symtab_index_set rather than needs_output_symtab_entry.
5980 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5981 rather than needs_output_symtab_entry. Call
5982 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5983 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5984 is_output_symtab_index_set rather than needs_output_symtab_entry.
5985 * testsuite/discard_locals_relocatable_test.c: New file.
5986 * testsuite/discard_locals_test.sh: Test -r.
5987 * testsuite/Makefile.am (check_DATA): Add
5988 discard_locals_relocatable_test1.syms,
5989 discard_local_relocatable_test2.syms.
5990 (MOSTLYCLEANFILES): Likewise. Also add
5991 discard_locals_relocatable_test1.lout and
5992 discard_locals_relocatable_test2.out.
5993 (discard_locals_relocatable_test1.syms): New target.
5994 (discard_locals_relocatable_test.o): New target.
5995 (discard_locals_relocatable_test1.out): New target.
5996 (discard_locals_relocatable_test2.syms): New target.
5997 (discard_locals_relocatable_test2.out): New target.
5998 (various): Add missing ../ld-new dependencies.
5999 * testsuite/Makefile.in: Rebuild.
6000
6001 2010-03-03 Nick Clifton <nickc@redhat.com>
6002
6003 * po/fi.po: New Finnish translation.
6004
6005 2010-03-01 Doug Kwan <dougkwan@google.com>
6006
6007 * layout.cc (Layout::Layout): Force section types of .init_array*,
6008 .preinit_array* and .fini_array* sections.
6009 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6010 Fix check of return value of std::string::find.().
6011 (Output_section::Input_section_sort_compare::operator()): Remove
6012 comment about .init_array.
6013 (Output_section::Input_section_sort_init_fini_compare::operator()):
6014 New method.
6015 (Output_section::sort_attached_input_sections): Handle .init_array
6016 and .fini_array specially.
6017 * output.h (Output_section::Inut_section_sort_compare): Update
6018 comment.
6019 (Output_section::Input_section_sort_init_fini_compare): New struct.
6020
6021 2010-02-26 Doug Kwan <dougkwan@google.com>
6022
6023 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6024 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6025 * testsuite/debug_msg.sh: Avoid matching source line number for
6026 use of global variable undef_int.
6027
6028 2010-02-26 Doug Kwan <dougkwan@google.com>
6029
6030 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6031 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6032 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6033 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6034 * options.cc (General_options::General_options): Initialize member
6035 fix_v4bx_.
6036 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6037 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6038 and rm_no_fix_v4bx.stdout
6039 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6040 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6041 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6042 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6043 and arm_no_fix_v4bx.
6044 * Makefile.in: Regenerate.
6045 * testsuite/arm_fix_v4bx.s: New file.
6046 * testsuite/arm_fix_v4bx.sh: Ditto.
6047
6048 2010-02-24 Doug Kwan <dougkwan@google.com>
6049
6050 * arm.cc (Target_arm::got_section): Make the .got section the first
6051 non RELRO section in the data segment.
6052 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6053 suffixes of section names.
6054
6055 2010-02-24 Doug Kwan <dougkwan@google.com>
6056
6057 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6058 flags and attributes merging if an input file is a binary file.
6059 * fileread.cc (Input_file::open): Record format of original file.
6060 * fileread.h (Input_file::Format): New enum type.
6061 (Input_file::Input_file): Initialize data member format_.
6062 (Input_file::format): New method definition.
6063 (Input_file::format_):: New data member.
6064
6065 2010-02-24 Doug Kwan <dougkwan@google.com>
6066
6067 * arm.cc (Arm_output_data_got): New class.
6068 (ARM_TCB_SIZE): New constant
6069 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6070 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6071 If user uses a script with a SECTIONS clause, issue only a warning
6072 for a misplaced EXIDX input section. Otherwise, issue an error.
6073 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6074 garbage collection.
6075 (Target_arm::got_mode_index_entry): Handle static linking.
6076 (Target_arm::Scan::local): Ditto.
6077 (Target_arm::Scan::global): Ditto.
6078 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6079 all incorrectly implemented relocations.
6080 (Target_arm::fix_exidx_coverage): Pass layout to
6081 Arm_output_section::fix_exidx_coverage.
6082 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6083 from ".ARM.exidx." and ".ARM.extab.".
6084
6085 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6086
6087 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6088 section if it does not already exist.
6089 * attributes.cc (Attributes_section_data::Attributes_section_data):
6090 Don't crash if size is zero.
6091
6092 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6093 Ian Lance Taylor <iant@google.com>
6094
6095 * gold.cc (queue_middle_tasks): If no input files were opened,
6096 exit.
6097 * workqueue.h (Task_function::Task_function): Assert that there is
6098 a blocker.
6099
6100 2010-02-22 Doug Kwan <dougkwan@google.com>
6101
6102 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6103 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6104 types to avoid warnings due to different uint64_t implementations
6105 on different hosts.
6106
6107 2010-02-21 Doug Kwan <dougkwan@google.com>
6108
6109 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6110 handling of the maximum backward branch offset.
6111 (Arm_relocate_functions::thumb_branch_common): Ditto.
6112 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6113 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6114 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6115 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6116 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6117 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6118 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6119 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6120 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6121 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6122 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6123 thumb2_bl_out_of_range.o): New rules.
6124 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6125 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6126 thumb2_bl_out_of_range
6127 * testsuite/Makefile.in: Regenerate.
6128 * testsuite/arm_bl_in_range.s: New file.
6129 * testsuite/arm_bl_out_of_range.s: Ditto.
6130 * testsuite/arm_branch_in_range.sh: Ditto.
6131 * testsuite/arm_branch_range.t: Ditto.
6132 * testsuite/thumb2_branch_range.t: Ditto.
6133 * testsuite/thumb_bl_in_range.s: Ditto.
6134 * testsuite/thumb_bl_out_of_range.s: Ditto.
6135 * testsuite/thumb_branch_range.t: Ditto.
6136
6137 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6138
6139 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6140 Add reloc offset information.
6141 * icf.cc (get_section_contents): Change iterators to point to the new
6142 vectors. Add reloc offset information to the contents.
6143 * icf.h (Icf::Sections_reachable_info): New typedef.
6144 (Icf::Sections_reachable_list): New typedef.
6145 (Icf::Offset_info): New typedef.
6146 (Icf::Reloc_info): New struct typedef.
6147 (Icf::Reloc_info_list): New typedef.
6148 (Icf::symbol_reloc_list): Delete method.
6149 (Icf::addend_reloc_list): Delete method.
6150 (Icf::section_reloc_list): Delete method.
6151 (Icf::reloc_info_list): New method.
6152 (Icf::reloc_info_list_): New member.
6153
6154 2010-02-19 Doug Kwan <dougkwan@google.com>
6155
6156 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6157 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6158 * arm.cc (Arm_relocation_functions): New forward declaration.
6159 (Target_arm::Target_arm): Initialize new data members
6160 got_mod_index_offset_ and tls_base_symbol_defined_.
6161 (Target_arm::Relocate::relocate_tls): New method.
6162 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6163 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6164 New methods.
6165 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6166 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6167 (Target_arm::got_mod_index_offset_,
6168 Target_arm::tls_base_symbol_defined_): New data members.
6169 (Target_arm::Scan::local, Target::Scan::global,
6170 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6171 relocations.
6172
6173 2010-02-18 Doug Kwan <dougkwan@google.com>
6174
6175 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6176 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6177 text section as a parameter becuase some broken tools may not set
6178 the link in section header.
6179 (Target_arm::has_got_section): New method.
6180 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6181 without any mapping symbol as data only. Remove warning.
6182 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6183 link in its section header, try to discover the link by inspecting the
6184 REL31 relocation at the beginning of the section.
6185 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6186 in error message.
6187 (Target_arm::Scan::global): Treat any reference to the symbol
6188 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6189
6190 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6191
6192 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6193 (Scan::global_reloc_may_be_function_pointer): New function.
6194 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6195 (Scan::global_reloc_may_be_function_pointer): New function.
6196 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6197 (Scan::global_reloc_may_be_function_pointer): New function.
6198 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6199 (Scan::global_reloc_may_be_function_pointer): New function.
6200 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6201 (Scan::global_reloc_may_be_function_pointer): New function.
6202 (Scan::possible_function_pointer_reloc): New function.
6203 (Target_x86_64::can_check_for_function_pointers): New function.
6204 * gc.h (gc_process_relocs): Scan relocation types to determine if
6205 function pointers were taken for targets that support it.
6206 * icf.cc (Icf::find_identical_sections): Include functions for
6207 folding in safe ICF whose pointer is not taken.
6208 * icf.h (Secn_fptr_taken_set): New typedef.
6209 (fptr_section_id_): New member.
6210 (section_has_function_pointers): New function.
6211 (set_section_has_function_pointers): New function.
6212 (check_section_for_function_pointers): New function.
6213 * options.h: Fix comment for safe ICF option.
6214 * target.h (can_check_for_function_pointers): New function.
6215 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6216 Modify icf_safe_test for X86-64.
6217 * testsuite/Makefile.in: Regenerate.
6218 * testsuite/icf_safe_so_test.cc: New file.
6219 * testsuite/icf_safe_so_test.sh: New file.
6220 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6221 (main): Change to take pointer to function kept_func_3.
6222 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6223 folding is done correctly for X86-64.
6224
6225 2010-02-12 David S. Miller <davem@davemloft.net>
6226
6227 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6228 is_symbolless parameter.
6229 (Output_reloc<SHT_REL>::is_symbolless): New.
6230 (Output_reloc<SHT_REL>::is_symbolless_): New.
6231 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6232 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6233 (Output_reloc<SHT_RELA>::is_symbolless): New.
6234 (Output_data_reloc::add_global): Handle is_symbolless.
6235 (Output_data_reloc::add_global_relative): Likewise.
6236 (Output_data_reloc::add_local): Likewise.
6237 (Output_data_reloc::add_local_relative): Likewise.
6238 (Output_data_reloc::add_symbolless_global_addend): New.
6239 (Output_data_reloc::add_symbolless_local_addend): New.
6240 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6241 is_symbolless.
6242 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6243 instead of ->is_relative_
6244 (Output_reloc::write): Likewise.
6245 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6246 (Output_reloc::write_rel): Simplify.
6247
6248 * sparc.cc (Target_sparc::Scan::local): Use
6249 ->add_symbolless_local_addend as needed.
6250 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6251 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6252 based upon relocation offset.
6253
6254 2010-02-11 Doug Kwan <dougkwan@google.com>
6255
6256 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6257 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6258 beginning of function.
6259 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6260 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6261 parameter is_32bit in calls to should_apply_static_reloc.
6262 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6263 (check_DATA): Add arm_abs_global.stdout.
6264 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6265 arm_abs_global.stdout): New rules.
6266 (MOSTLLYCLEANFILES): Add arm_abs_global
6267 * Makefile.in: Regenerate.
6268 * testsuite/arm_abs_global.s: New file.
6269 * testsuite/arm_abs_global.sh: Ditto.
6270 * testsuite/arm_abs_lib.s: Ditto.
6271
6272 2010-02-11 Ian Lance Taylor <iant@google.com>
6273
6274 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6275 Read_relocs task.
6276 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6277 Allocate_commons_task first.
6278 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6279 task, rather than symtab_lock_.
6280 (Gc_process_relocs::~Gc_process_relocs): New function.
6281 (Gc_process_relocs::is_runnable): Check this_blocker_.
6282 (Gc_process_relocs::locks): Use next_blocker_ rather than
6283 blocker_.
6284 (Scan_relocs::~Scan_relocs): New function.
6285 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6286 symtab_lock_.
6287 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6288 next_blocker_.
6289 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6290 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6291 constructor accordingly.
6292 (class Gc_process_relocs): Likewise.
6293 (class Scan_relocs): Likewise.
6294 * common.h (class Allocate_commons_task): Remove symtab_lock_
6295 field, and corresponding constructor parameter.
6296 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6297 symtab_lock_.
6298 (Allocate_commons_task::locks): Likewise.
6299
6300 2010-02-11 Ian Lance Taylor <iant@google.com>
6301
6302 * gold-threads.h (class Once): Define.
6303 (class Initialize_lock): Rewrite as child of Once.
6304 * gold-threads.cc (class Once_initialize): Define.
6305 (once_pointer_control): New static variable.
6306 (once_pointer, once_arg): New static variables.
6307 (c_run_once): New static function.
6308 (Once::Once, Once::run_once, Once::internal_run): New functions.
6309 (class Initialize_lock_once): Remove.
6310 (initialize_lock_control): Remove.
6311 (initialize_lock_pointer): Remove.
6312 (initialize_lock_once): Remove.
6313 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6314 (Initialize_lock::initialize): Rewrite.
6315 (Initialize_lock::do_run_once): New function.
6316 * archive.cc (Archive::interpret_header): Only clear name if it is
6317 not already empty.
6318 * fileread.cc: Include "gold-threads.h"
6319 (file_counts_lock): New static variable.
6320 (file_counts_initialize_lock): Likewise.
6321 (File_read::release): Only increment counts when using --stats.
6322 Use a lock around the increment.
6323 * parameters.cc (class Set_parameters_target_once): Define.
6324 (set_parameters_target_once): New static variable.
6325 (Parameters::Parameters): Move here from parameters.h.
6326 (Parameters::set_target): Rewrite.
6327 (Parameters::set_target_once): New function.
6328 (Parameters::clear_target): Move here and rewrite.
6329 * parameters.h (class Parameters): Update declarations. Add
6330 set_parameters_target_once_ field.
6331 (Parameters::Parameters): Move to parameters.cc.
6332 (Parameters::clear_target): Likewise.
6333 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6334 task.
6335 (Start_group::~Start_group): New function.
6336 (Start_group::is_runnable): New function.
6337 (Start_group::locks, Start_group::run): New functions.
6338 (Finish_group::run): Change saw_undefined to size_t.
6339 * readsyms.h (class Start_group): Define.
6340 (class Finish_group): Change saw_undefined_ field to size_t.
6341 (Finish_group::Finish_group): Remove saw_undefined and
6342 this_blocker parameters. Change all callers.
6343 (Finish_group::set_saw_undefined): New function.
6344 (Finish_group::set_blocker): New function.
6345 * symtab.h (class Symbol_table): Change saw_undefined to return
6346 size_t. Change saw_undefined_ field to size_t.
6347 * target-select.cc (Set_target_once::do_run_once): New function.
6348 (Target_selector::Target_selector): Initialize set_target_once_
6349 field. Don't initialize lock_ and initialize_lock_ fields.
6350 (Target_selector::instantiate_target): Rewrite.
6351 (Target_selector::set_target): New function.
6352 * target-select.h (class Set_target_once): Define.
6353 (class Target_selector): Update declarations. Make
6354 Set_target_once a friend. Remove lock_ and initialize_lock_
6355 fields. Add set_target_once_ field.
6356
6357 2010-02-10 Ian Lance Taylor <iant@google.com>
6358
6359 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6360 queueing any tasks.
6361 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6362 (queue_middle_tasks): Add all blockers before queueing any tasks.
6363 (queue_final_tasks): Likewise.
6364 * token.h (Task_token::add_blockers): New function.
6365 * object.h (Input_objects::number_of_relobjs): New function.
6366
6367 2010-02-10 Ian Lance Taylor <iant@google.com>
6368
6369 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6370 shared, not if not position independent.
6371 * x86_64.cc (Relocate::relocate_tls): Likewise.
6372 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6373 (tls_pie_pic_test): New target.
6374 * testsuite/Makefile.in: Rebuild.
6375
6376 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6377 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6378 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6379 * testsuite/Makefile.in: Rebuild.
6380
6381 2010-02-09 David S. Miller <davem@davemloft.net>
6382
6383 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6384 R_SPARC_RELATIVE using ->add_local_relative().
6385 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6386
6387 * output.h (Output_data_dynamic::add_section_size): New method
6388 that takes two Output_data objects.
6389 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6390 entry param. Handle it in initializers.
6391 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6392 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6393 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6394 arg.
6395 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6396 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6397 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6398 for dynrel_includes_plt.
6399 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6400 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6401 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6402 before .rela.plt
6403 (Target_sparc::do_finalize_sections): Update to pass true for
6404 dynrel_includes_plt.
6405 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6406 output before .rela.plt
6407 (Target_powerpc::do_finalize_sections): Update to pass true for
6408 dynrel_includes_plt when 32-bit.
6409
6410 2010-02-08 Doug Kwan <dougkwan@google.com>
6411
6412 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6413 method.
6414 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6415 Arm_relobj::scan_section_for_cortex_a8_stubs,
6416 Arm_relobj::do_relocation_section): Instead of calling
6417 Output_section::output_address, use faster
6418 Arm_relobj::simple_input_section_output_address.
6419
6420 2010-02-08 David S. Miller <davem@davemloft.net>
6421
6422 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6423 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6424 relocation helper function.
6425
6426 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6427 just like R_SPARC_GOT{10,13,22}.
6428 (Target_sparc::Scan::local): Likewise.
6429 (Target_sparc::Relocate:relocate): Likewise.
6430
6431 2010-02-06 Ian Lance Taylor <iant@google.com>
6432
6433 * configure.ac: Rewrite targetobjs duplicate removal code to use
6434 only shell constructs.
6435 * configure: Rebuild.
6436
6437 2010-02-05 Doug Kwan <dougkwan@google.com>
6438
6439 PR 11247
6440 * arm.cc (Arm_relobj::section_is_scannable): New method.
6441 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6442 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6443
6444 2010-02-04 Doug Kwan <dougkwan@google.com>
6445
6446 PR 11247
6447 * arm-reloc-property.cc (cstdio): Include.
6448 * configure.ac (targetobjs): Remove duplicates.
6449 * configure: Regenerate.
6450 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6451 big and little endian version for a given address size.
6452
6453 2010-02-03 Doug Kwan <dougkwan@google.com>
6454
6455 * arm-reloc-property.cc
6456 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6457 definition.
6458 * arm-reloc-property.h
6459 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6460 New method definition.
6461 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6462 declaration.
6463 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6464 overflow to N.
6465 (GOT_PREL): Change implemented to Y.
6466 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6467 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6468 (Arm_relocate_functions::movw_abs_nc): Remove method.
6469 (Arm_relocate_functions::movt_abs): Ditto.
6470 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6471 (Arm_relocate_functions::thm_movt_abs): Ditto.
6472 (Arm_relocate_functions::movw_rel_nc): Ditto.
6473 (Arm_relocate_functions::movw_rel): Ditto.
6474 (Arm_relocate_functions::movt_rel): Ditto.
6475 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6476 (Arm_relocate_functions:thm_movw_rel): Ditto.
6477 (Arm_relocate_functions:thm_movt_rel): Ditto.
6478 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6479 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6480 New method definitions.
6481 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6482 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6483 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6484 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6485 (Target_arm::Relocate::relocate): Check for non-static or
6486 unimplemented relocation code and exit early. Change calls to
6487 Target_arm::reloc_uses_thumb_bit and
6488 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6489 instead. Refactor code to handle similar relocations to increase
6490 code sharing. Remove check for unsupported relocation code in switch
6491 statement.
6492 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6493 relocation property table to find out size. Change error message to
6494 print out the name of a relocation code instead of the numeric value.
6495 (Target_arm::scan_reloc_for_stub): Use relocation property table
6496 instead of calling Target_arm::reloc_uses_thumb_bit().
6497
6498 2010-02-02 Doug Kwan <dougkwan@google.com>
6499
6500 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6501 types of relaxed input section.
6502
6503 2010-02-02 Doug Kwan <dougkwan@google.com>
6504
6505 * Makefile.am (HFILES): Add arm-reloc-property.h.
6506 (DEFFILES): New.
6507 (TARGETSOURCES): Add arm-reloc-property.cc
6508 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6509 (libgold_a_SOURCES): $(DEFFILES)
6510 * Makefile.in: Regenerate.
6511 * arm-reloc-property.cc: New file.
6512 * arm-reloc-property.h: New file.
6513 * arm-reloc.def: New file.
6514 * arm.cc: Update comments.
6515 (arm-reloc-property.h): New included header.
6516 (arm_reloc_property_table): New global variable.
6517 (Target_arm::do_select_as_default_target): New method definition.
6518 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6519 arm-reloc-property to targ_extra_obj.
6520 * parameters.cc (set_parameters_target): Call
6521 Target::select_as_default_target().
6522 * target.h (Target::select_as_default_target): New method definition.
6523 (Target::do_select_as_default_target): Same.
6524
6525 2010-02-01 Doug Kwan <dougkwan@google.com>
6526
6527 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6528 first_output_text_section_.
6529 (Arm_exidx_fixup::first_output_text_section): New method definition.
6530 (Arm_exidx_fixup::first_output_text_section_): New data member.
6531 (Arm_exidx_fixup::process_exidx_section): Record the first text
6532 output section seen.
6533 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6534 and entsize in output section header.
6535
6536 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6537
6538 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6539 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6540 (Arm_relocate_functions::thm_alu11): New Method.
6541 (Arm_relocate_functions::thm_pc8): New Method.
6542 (Arm_relocate_functions::thm_pc12): New Method.
6543 (Target_arm::Scan::local): Handle the relocations.
6544 (Target_arm::Scan::global): Likewise.
6545 (Target_arm::Relocate::relocate): Likewise.
6546 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6547
6548 2010-01-29 Doug Kwan <dougkwan@google.com>
6549
6550 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6551 of relocation types as ld.
6552
6553 2010-01-29 Doug Kwan <dougkwan@google.com>
6554
6555 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6556 to public.
6557 (Arm_relocate_functions::thumb_branch_common): Ditto.
6558 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6559 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6560 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6561 Arm_relocate_functions::jump24): Remove.
6562 (Target_arm::Relocate::relocate): Adjust code to call
6563 Arm_relocation_functions::arm_branch_common and
6564 Arm_relocation_functions::thumb_branch_common instead of their removed
6565 wrappers. Merge switch-cases together to reduce source code size.
6566
6567 2010-01-29 Doug Kwan <dougkwan@google.com>
6568
6569 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6570 output_local_symbol_count_needs_update_.
6571 (Arm_relobj::output_local_symbol_count_needs_update,
6572 Arm_relobj::set_output_local_symbol_count_needs_update,
6573 Arm_relobj::update_output_local_symbol_count): New methods.
6574 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6575 member.
6576 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6577 of pointed function as in a R_ARM_PREL31 relocation.
6578 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6579 for output local symbol count updating.
6580 (Target_arm::do_relax): Update output local symbol counts in objects
6581 if necessary.
6582 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6583
6584 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6585
6586 * arm.cc: Added support for the ARM relocations:
6587 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6588 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6589 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6590 movw_prel_nc).
6591 (Arm_relocate_functions::movw_rel): New method.
6592 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6593 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6594 thm_movw_prel_nc).
6595 (Arm_relocate_functions::thm_movw_rel): New method.
6596 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6597 thm_movt_prel).
6598 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6599 relocations.
6600 (Target_arm::Scan::global): Likewise.
6601 (Target_arm::Relocate::relocate): Likewise.
6602 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6603 Likewise.
6604
6605 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6606
6607 * arm.cc: Added support for ARM group relocations.
6608 (Target_arm::reloc_needs_sym_origin): New method.
6609 (Arm_relocate_functions::calc_grp_kn): New method.
6610 (Arm_relocate_functions::calc_grp_residual): New method.
6611 (Arm_relocate_functions::calc_grp_gn): New method.
6612 (Arm_relocate_functions::arm_grp_alu): New Method.
6613 (Arm_relocate_functions::arm_grp_ldr): New Method.
6614 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6615 (Arm_relocate_functions::arm_grp_ldc): New Method.
6616 (Target_arm::Scan::local): Handle the ARM group relocations.
6617 (Target_arm::Scan::global): Likewise.
6618 (Target_arm::Relocate::relocate): Likewise.
6619 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6620 Likewise.
6621
6622 2010-01-26 Doug Kwan <dougkwan@google.com>
6623
6624 * arm.cc (set): Include.
6625 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6626 pointer type.
6627 (Arm_output_section::Text_section_list): New type.
6628 (Arm_output_section::append_text_sections_to_list): New method.
6629 (Arm_output_section::fix_exidx_coverage): Ditto.
6630 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6631 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6632 Relobj::set_section_offset() instead of
6633 Sized_relobj::invalidate_section_offset().
6634 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6635 parameter for section headers. Ignore relocation sections for
6636 unallocated sections and EXIDX sections.
6637 (Target_arm::fix_exidx_coverage): New method.
6638 (Target_arm::output_section_address_less_than): New type.
6639 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6640 linked text section instead of the EXIDX section.
6641 (Arm_output_section::create_stub_group): Add an assertion to check
6642 that this is not an EXIDX output section.
6643 (Arm_output_section::append_text_sections_to_list): New method.
6644 (Arm_output_section::fix_exidx_coverage): Ditto.
6645 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6646 Arm_relobj::section_needs_reloc_stub_scanning.
6647 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6648 first pass.
6649 (Target_arm::fix_exidx_coverage): New method.
6650 * object.h (Relobj::set_output_section): New method.
6651 (Sized_relobj::invalidate_section_offset): Remove method.
6652 (Sized_relobj::do_invalidate_section_offset): Remove method.
6653 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6654
6655 2010-01-25 Doug Kwan <dougkwan@google.com>
6656
6657 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6658 Fix warning due to signed and unsigned comparison on a 32-bit host.
6659
6660 2010-01-22 Doug Kwan <dougkwan@google.com>
6661
6662 * arm.cc (Target_arm::do_relax): Record an output section for section
6663 offset adjustment it contains any stub table that has changed.
6664 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6665 offsets in an output section if necessary.
6666 * output.cc (Output_section::Output_section): Initialize
6667 section_offsets_need_adjustments_.
6668 (Output_section::add_input_section_for_script): Renamed to
6669 Output_section::add_simple_input_section.
6670 (Output_section::save_states): Add a comment.
6671 (Output_section::discard_states): New method defintion.
6672 (Output_section::adjust_section_offsets): Same.
6673 * output.h (Output_section::add_input_section_for_script): Renamed to
6674 Output_section::add_simple_input_section.
6675 (Output_section::discard_states): New method declaration.
6676 (Output_section::adjust_section_offsets): Same.
6677 (Output_section::section_offsets_need_adjustment,
6678 Output_section::set_section_offsets_need_adjustment): New method
6679 definitions.
6680 (Output_section::section_offsets_need_adjustment_): New data member.
6681 * script-sections.cc
6682 (Output_section_element_input::set_section_address): Adjust code for
6683 renaming of Output_section::add_input_section_for_script.
6684 (Orphan_output_section::set_section_address): Same.
6685
6686 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6687
6688 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6689 Fix_v4bx enum values .
6690 * gold/options.h (General_options): New option definitions.
6691 (General_options::fix_v4bx): New method.
6692 (General_options::Fix_v4bx): New enum.
6693 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6694 (General_options::parse_fix_v4bx_interworking): New method.
6695
6696 2010-01-22 Doug Kwan <dougkwan@google.com>
6697
6698 * arm.cc (Arm_exidx_fixup): New class.
6699
6700 2010-01-21 Doug Kwan <dougkwan@google.com>
6701
6702 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6703 classes.
6704 (Arm_exidx_section_offset_map): New type.
6705
6706 2010-01-21 Doug Kwan <dougkwan@google.com>
6707
6708 * arm.cc (Arm_exidx_input_section): New class.
6709 (Arm_relobj::exidx_input_section_by_link,
6710 Arm_relobj::exidx_input_section_by_shndx,
6711 Arm_relobj::make_exidx_input_section): New methods.
6712 (read_arm_attributes_section): Remove.
6713 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6714 information about them.
6715 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6716 to here.
6717
6718 2010-01-20 Doug Kwan <dougkwan@google.com>
6719
6720 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6721 Input_section_specifier to Section_id.
6722 (Target_arm::new_arm_input_section: Adjust code for change of key
6723 type.
6724 (Target_arm::find_arm_input_section): Ditto.
6725 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6726 (Section_id): Remove.
6727 (Garbage_collection::Section_id_hash): Remove.
6728 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6729 (Section_id): Remove.
6730 (Icf::Section_id_hash): Remove.
6731 * object.h (Section_id, Const_section_id, Section_id_hash,
6732 Const_section_id_hash): New type definitions.
6733 * output.cc (Output_section::add_relaxed_input_section): Change to
6734 use Const_section_id instead of Input_section_specifier as key type.
6735 (Output_section::add_merge_input_section): Ditto.
6736 (Output_section::build_relaxation_map): Change to use Section_id
6737 instead of Input_section_specifier as key type.
6738 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6739 Ditto.
6740 (Output_section::convert_input_sections_to_relaxed_sections): Change
6741 to use Const_section_id instead of Input_section_specifier as key type.
6742 (Output_section::find_merge_section): Ditto.
6743 (Output_section::find_relaxed_input_section): Ditto.
6744 * output.h (Input_section_specifier): Remove class.
6745 (Output_section::Output_section_data_by_input_section_map): Change
6746 key type to Const_section_id.
6747 (Output_section::Output_relaxed_input_section_by_input_section_map):
6748 Ditto.
6749 (Output_section::Relaxation_map): Change key type to Section_id.
6750
6751 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6752
6753 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6754 (class Arm_v4bx_stub): New class.
6755 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6756 (Stub_factory::make_arm_v4bx_stub): New method.
6757 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6758 (Stub_table::empty): Handle v4bx stubs.
6759 (Stub_table::add_arm_v4bx_stub): New method.
6760 (Stub_table::find_arm_v4bx_stub): New method.
6761 (Arm_relocate_functions::v4bx): New method.
6762 (Target_arm::fix_v4bx): New method.
6763 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6764 (Stub_table::relocate_stubs): Likewise.
6765 (Stub_table::do_write): Likewise.
6766 (Stub_table::update_data_size_and_addralign): Likewise.
6767 (Stub_table::finalize_stubs): Likewise.
6768 (Target_arm::Scan::local): Likewise.
6769 (Target_arm::Scan::global): Likewise.
6770 (Target_arm::do_finalize_sections): Likewise.
6771 (Target_arm::Relocate::relocate): Likewise.
6772 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6773 Likewise.
6774 (Target_arm::scan_reloc_for_stub): Likewise.
6775 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6776
6777 2010-01-19 Ian Lance Taylor <iant@google.com>
6778
6779 * output.cc (Output_section_headers::do_sized_write): Write large
6780 segment count to sh_info field.
6781 (Output_file_header::do_sized_write): For large segment count,
6782 write PN_XNUM to e_phnum field.
6783
6784 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6785
6786 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6787 (Arm_relocate_functions::thm_jump8): New function.
6788 (Arm_relocate_functions::thm_jump11): New function.
6789 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6790 R_ARM_THM_JUMP11.
6791 (Target_arm::Scan::global): Likewise.
6792 (Target_arm::Relocate::relocate): Likewise.
6793 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6794 Likewise.
6795
6796 2010-01-14 Doug Kwan <dougkwan@google.com>
6797
6798 * arm.cc (map, utility): Include headers.
6799 (Target_arm::apply_cortex_a8_workaround): New method.
6800 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6801 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6802 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6803 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6804 the --[no-]fix-cortex-a8 command line options.
6805 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6806 (Target_arm::relocate_stub): Use addend in instruction template.
6807 * options.h (DEFINE_bool): Set the user-set flag.
6808 (General_options): Add --[no-]-fix-cortex options.
6809 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6810 : Update fast look-up map after conversion.
6811
6812 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6813
6814 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6815 in the first pass of do_layout.
6816
6817 2010-01-13 Doug Kwan <dougkwan@google.com>
6818
6819 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6820 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6821 apparent compiler problem of not folding static constant integral
6822 data members of elfcpp::Elf_sizes<32>.
6823
6824 2010-01-13 Doug Kwan <dougkwan@google.com>
6825
6826 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6827 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6828 Arm_relobj::scan_section_for_cortex_a8_erratum,
6829 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6830 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6831 sections to scan for relocation stubs into a new method
6832 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6833 relocation and Cortex-A8 stub scanning.
6834 (Target_arm::do_relax): Force stubs to be after stubbed sections
6835 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6836 the beginning of a new relaxation pass. Update a comment.
6837 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6838
6839 2010-01-12 Ian Lance Taylor <iant@google.com>
6840
6841 * target-reloc.h (visibility_error): New inline function.
6842 (relocate_section): Call visibility_error.
6843 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6844 (MOSTLYCLEANFILES): Likewise.
6845 (protected_4_pic.o, protected_3.err): New targets.
6846 * testsuite/protected_4.cc: New file.
6847
6848 2010-01-12 Doug Kwan <dougkwan@google.com>
6849
6850 * arm.cc (Cortex_a8_reloc): New class.
6851 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6852 and cortex_a8_relocs_info_.
6853 (Target_arm::fix_cortex_a8): New method definition.
6854 (Target_arm::Cortex_a8_relocs_info): New type.
6855 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6856 New data member declarations.
6857 (Target_arm::scan_reloc_for_stub): Record information about
6858 relocations for THUMB branches that might be exempted from the
6859 Cortex-A8 workaround.
6860 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6861 at the beginning of a relaxation pass.
6862
6863 2010-01-12 Doug Kwan <dougkwan@google.com>
6864
6865 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6866 (Arm_relobj::Mapping_symbol_position,
6867 Arm_reloj::Mapping_symbol_position_less,
6868 Arm_relobj::Mapping_symbols_info): New types.
6869 (Target_arm::is_mapping_symbol_name): New method definition.
6870 (Arm_relobj::do_count_local_symbols): Save information about mapping
6871 symbols.
6872
6873 2010-01-11 Doug Kwan <dougkwan@google.com>
6874
6875 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6876 Arm_relocate_functions::thumb32_branch_upper,
6877 Arm_relocate_functions::thumb32_branch_lower,
6878 Arm_relocate_functions::thumb32_cond_branch_offset,
6879 Arm_relocate_functions::thumb32_cond_branch_upper,
6880 Arm_relocate_functions::thumb32_cond_branch_lower,
6881 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6882 branch offset encoding.
6883 (Arm_relocate_functions::thumb_branch_common): Use new branch
6884 offset encoding methods to avoid code duplication.
6885 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6886 (Stub_addend_reader::operator()): Use new branch encoding method
6887 to avoid code duplication.
6888
6889 2010-01-11 Doug Kwan <dougkwan@google.com>
6890
6891 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6892 (Target_arm::do_finalize_sections): Define special EXIDX section
6893 symbols only if referenced.
6894 * gc.h (Garbage_collection::add_reference): New method.
6895 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6896 code duplication.
6897
6898 2010-01-11 Ian Lance Taylor <iant@google.com>
6899
6900 * script.cc (Version_script_info::build_expression_list_lookup):
6901 Change complaing about duplicate wildcard match from error to
6902 warning.
6903
6904 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6905 of 2009-12-30.
6906 (Version_script_info::Version_script_info): Initialize globs_,
6907 default_version_, default_is_global_, and exact_. Don't
6908 initialize globals_ or locals_.
6909 (Version_script_info::build_lookup_tables): Build local symbols
6910 first.
6911 (Version_script_info::unquote): New function.
6912 (Version_script_info::add_exact_match): New function.
6913 (Version_script_info::build_expression_list_lookup): Remove lookup
6914 parameter. Add is_global parameter. Change all callers. Handle
6915 wildcard pattern specially. Unquote pattern. Call
6916 add_exact_match.
6917 (Version_script_info::get_name_to_match): New function.
6918 (Version_script_info::get_symbol_version): New function.
6919 (Version_script_info::get_symbol_version_helper): Remove.
6920 (Version_script_info::check_unmatched_names): Call unquote.
6921 * script.h (class Version_script_info): Change get_symbol_version
6922 to be non-inline and add is_global parameter; change all callers.
6923 Rewrite symbol_is_local. Update declarations. Define struct
6924 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6925 Remove globals_ and locals_ members. Add exact_, globs_,
6926 default_version_, is_global_.
6927 (Version_script_info::Glob): Remove pattern, add expression and
6928 is_global. Update constructor. Change all callers.
6929 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6930 default version.
6931 (Versions::symbol_section_contents): If a symbol is undefined, or
6932 defined in a dynamic object, set the version index to
6933 VER_NDX_LOCAL.
6934 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6935 symbol_is_local.
6936 (Symbol_table::add_from_pluginobj): Likewise.
6937 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6938
6939 2010-01-11 Doug Kwan <dougkwan@google.com>
6940
6941 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6942 (incremental_dump_LDADD): Add linking option for libintl.
6943 * Makefile.in: Regenerate.
6944
6945 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6946
6947 PR gold/11144
6948 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6949 instead of -Ds.
6950 * testsuite/Makefile.in: Regenerated.
6951
6952 2010-01-10 Doug Kwan <dougkwan@google.com>
6953
6954 * options.h (DEFINE_var): Use parentheses around argument varname__
6955 in macro body to avoid any unintended subsequent substitutions.
6956
6957 2010-01-10 Ian Lance Taylor <iant@google.com>
6958
6959 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6960 candidates before doing symbol resolution.
6961
6962 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6963 ODR candidates if only one is weak.
6964
6965 2010-01-08 Ian Lance Taylor <iant@google.com>
6966
6967 * script.cc (Version_script_info::build_expression_list_lookup):
6968 Don't warn about ambiguous version, just record the ambiguity.
6969 (Version_script_info::get_symbol_version_helper): Give error if
6970 version is ambiguous.
6971
6972 2010-01-08 Doug Kwan <dougkwan@google.com>
6973
6974 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6975 prev_data_size_ and prev_addralign_. Remove initializer for
6976 deleted data member has_been_changed_.
6977 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6978 to determine if the table is empty.
6979 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6980 Remove.
6981 (Stub_table::add_reloc_stub): Define method in class definition
6982 instead of just declaring it there.
6983 (Stub_table::add_cortex_a8_stub): New method definition.
6984 (Stub_table::update_data_size_and_addralign): Ditto.
6985 (Stub_table::finalize_stubs): Ditto.
6986 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6987 (Stub_table::do_addralign_): Return address alignment in the
6988 (Stub_table::do_reset_address_and_file_offset): Define method in
6989 class definition instead of declaring it there. Set current data
6990 size to be the data size of the previous pass.
6991 (Stub_table::set_final_data_size): Use current data size as the
6992 final data size.
6993 (Stub_table::relocate_stub): Change parameter type of stub from
6994 Reloc_stub pointer to Stub pointer.
6995 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6996 (Stub_table::Cortex_a8_stub_list): New typedef.
6997 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6998 Stub_table::prev_addralign_): New data member.
6999 (Arm_relobj::Arm_relobj): Initialize data member
7000 section_has_cortex_a8_workaround_.
7001 (Arm_relobj::section_has_cortex_a8_workaround,
7002 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7003 definitions.
7004 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7005 declarations.
7006 (Target_arm::relocate_stub): Change parameter type of stub from
7007 Reloc_stub pointer to Stub pointer.
7008 (Insn_template::size, Insn_template::alignment): Handle
7009 THUMB16_SPECIAL_TYPE.
7010 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7011 Stub_table::update_data_size_and_addralign,
7012 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7013 definitions.
7014 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7015 (Stub_table::do_write): Ditto.
7016 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7017
7018 2010-01-08 Ian Lance Taylor <iant@google.com>
7019
7020 PR 11108
7021 * symtab.h (class Symbol): Remove fields is_target_special_ and
7022 has_plt_offset_. Add field is_defined_in_discarded_section_.
7023 (Symbol::is_defined_in_discarded_section): New function.
7024 (Symbol::set_is_defined_in_discarded_section): New function.
7025 (Symbol::has_plt_offset): Rewrite.
7026 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7027 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7028 Don't initialize is_target_special_ or has_plt_offset_.
7029 Initialize is_defined_in_discarded_section_.
7030 (Symbol_table::add_from_relobj): If appropriate, set
7031 is_defined_in_discarded_section.
7032 * resolve.cc (Symbol::override_base_with_special): Don't test
7033 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7034 * target-reloc.h (relocate_section): Do special handling for
7035 symbols defined in discarded sections for global symbols as well
7036 as local symbols.
7037
7038 2010-01-08 Ian Lance Taylor <iant@google.com>
7039
7040 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7041 the SHT_SYMTAB case.
7042
7043 2010-01-08 Ian Lance Taylor <iant@google.com>
7044
7045 * object.cc (Sized_relobj::do_layout): Don't get confused if
7046 layout_eh_frame returns NULL.
7047
7048 2010-01-08 Ian Lance Taylor <iant@google.com>
7049
7050 PR 11084
7051 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7052 dynamic symbol table, use the normal symbol table.
7053 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7054 symbol table.
7055
7056 2010-01-08 Ian Lance Taylor <iant@google.com>
7057
7058 PR 11072
7059 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7060 sections.
7061
7062 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7063
7064 * version.cc (print_version): Change to "Copyright 2010".
7065
7066 2010-01-08 Ian Lance Taylor <iant@google.com>
7067
7068 PR 10287
7069 PR 11063
7070 * i386.cc (class Target_i386): Change return type of plt_section
7071 to be non-const.
7072 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7073 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7074 tls_desc_rel_ field.
7075 (Output_data_plt_i386::rel_tls_desc): New function.
7076 (Target_i386::rel_tls_desc_section): New function.
7077 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7078 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7079 R_386_TLS_DESC reloc in rel_tls_desc_section.
7080 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7081 Define struct Tlsdesc_info.
7082 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7083 (Target_x86_64::do_reloc_symbol_index): New function.
7084 (Target_x86_64::add_tlsdesc_info): New function.
7085 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7086 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7087 tlsdesc_rel_ field.
7088 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7089 all callers.
7090 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7091 (Target_x86_64::rela_tlsdesc_section): New function.
7092 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7093 handling.
7094 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7095 (Target_x86_64::do_reloc_addend): New function.
7096 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7097 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7098 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7099 (Output_reloc::type): New function.
7100 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7101 (Output_reloc::is_target_specific): New function.
7102 (Output_reloc::target_arg): New function.
7103 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7104 absolute relocs and target specific relocs.
7105 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7106 add_target_specific.
7107 (class Output_data_reloc) [SHT_RELA]: Likewise.
7108 * output.cc (Output_reloc::Output_reloc): Add four new versions
7109 for absolute relocs and target specific relocs.
7110 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7111 (Output_reloc::get_symbol_index): Likewise.
7112 (Output_reloc::local_section_offset): Check that local_sym_index_
7113 is not TARGET_CODE or 0.
7114 (Output_reloc::symbol_value): Likewise.
7115 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7116 reloc.
7117 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7118 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7119 functions.
7120 * layout.cc (add_target_dynamic_tags): Use output section for
7121 DT_PLTRELSZ and DT_JMPREL.
7122
7123 2010-01-07 Ian Lance Taylor <iant@google.com>
7124
7125 PR 11061
7126 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7127 function.
7128 (class Output_data_reloc_generic): Define.
7129 (class Output_data_reloc_base): Change base class to
7130 Output_data_reloc_generic. Change add() method to call
7131 bump_relative_reloc_count for a relative reloc. Remove
7132 sort_relocs_ field.
7133 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7134 to sort_relocs().
7135 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7136 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7137 appropriate.
7138 * layout.h (class Layout): Update declaration.
7139
7140 2010-01-07 Ian Lance Taylor <iant@google.com>
7141
7142 * output.h (class Output_data): Add const version of
7143 output_section and do_output_section.
7144 (class Output_section_data): Add const version of
7145 do_output_section.
7146 (class Output_section): Likewise.
7147 * layout.cc (Layout::add_target_dynamic_tags): New function.
7148 * layout.h (class Layout): Update declarations.
7149 * arm.cc (Target_arm::do_finalize_sections): Use
7150 add_target_dynamic_tags.
7151 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7152 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7153 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7154 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7155
7156 2010-01-07 Ian Lance Taylor <iant@google.com>
7157
7158 PR 11042
7159 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7160 object as needed.
7161
7162 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7163 Ian Lance Taylor <iant@google.com>
7164
7165 PR 11019
7166 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7167 Xindex::read_symtab_xindex.
7168
7169 2010-01-07 Doug Kwan <dougkwan@google.com>
7170
7171 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7172 (Insn_template::thumb16_bcond_insn): New method declaration.
7173 (Insn_template): Fix spelling.
7174 (Stub::thumb16_special): New method declaration.
7175 (Stub::do_write): Define virtual method which was previously pure
7176 virtual.
7177 (Stub::do_thumb16_special): New method declaration.
7178 (Stub::do_fixed_endian_write): New template member.
7179 (Reloc_stub::do_write): Remove.
7180 (Reloc_stub::do_fixed_endian_write): Remove.
7181 (Cortex_a8_stub): New class definition.
7182 (Stub_factory::make_cortex_a8_stub): New method definition.
7183 (Stub_factory::Stub_factory): Add missing static storage class
7184 qualifier for elf32_arm_stub_a8_veneer_blx.
7185
7186 2010-01-07 Ian Lance Taylor <iant@google.com>
7187
7188 PR 10980
7189 * options.h (class General_options): Add --warn-unresolved-symbols
7190 and --error-unresolved-symbols.
7191 * errors.cc (Errors::undefined_symbol): Implement
7192 --warn-unresolved-symbols.
7193
7194 * options.h (class General_options): Add -z text and -z textoff.
7195 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7196
7197 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7198
7199 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7200 (Garbage_collection::cident_sections): New function.
7201 (Garbage_collection::add_cident_section): New function.
7202 (Garbage_collection::cident_sections_): New member.
7203 (gc_process_relocs): Add references to sections whose names are C
7204 identifiers.
7205 * gold.h (cident_section_start_prefix): New constant.
7206 (cident_section_stop_prefix): New constant.
7207 (is_cident): New function.
7208 * layout.cc (Layout::define_section_symbols): Replace string constants
7209 with the newly defined constants.
7210 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7211 C identifiers.
7212 * testsuite/Makefile.am: Add gc_orphan_section_test.
7213 * testsuite/Makefile.in: Regenerate.
7214 * testsuite/gc_orphan_section_test.cc: New file.
7215 * testsuite/gc_orphan_section_test.sh: New file.
7216
7217 2010-01-06 Ian Lance Taylor <iant@google.com>
7218
7219 PR 10980
7220 * options.h (class General_options): Add --warn-shared-textrel.
7221 * layout.cc (Layout::finish_dynamic_section): Implement
7222 --warn-shared-textrel.
7223
7224 PR 10980
7225 * options.h (class General_options): Add --warn-multiple-gp.
7226
7227 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7228
7229 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7230 $(THREADSLIB) and $(LIBDL).
7231 * Makefile.in: Rebuild.
7232
7233 2010-01-06 Ian Lance Taylor <iant@google.com>
7234
7235 PR 10980
7236 * options.cc (General_options::parse_section_start): New function.
7237 (General_options::section_start): New function.
7238 (General_options::General_options): Initialize all members.
7239 * options.h: Include <map>
7240 (class General_options): Add --section-start. Add section_starts_
7241 member.
7242 * layout.cc (Layout::attach_allocated_section_to_segment): If
7243 --section-start was used, set the address of the segment. Remove
7244 local sort_sections.
7245 (Layout::relaxation_loop_body): If the address of the load segment
7246 has been set by --section-start, don't use it.
7247 * output.h (Output_segment::update_flags_for_output_section): New
7248 function.
7249 * output.cc (Output_segment::add_output_section): Call
7250 update_flags_for_output_section.
7251
7252 2010-01-05 Ian Lance Taylor <iant@google.com>
7253
7254 PR 10980
7255 * options.h (class General_options): Add --undefined-version.
7256 * script.cc (struct Version_expression): Add was_matched_by_symbol
7257 field.
7258 (Version_script_info::matched_symbol): New function.
7259 (Version_script_info::get_symbol_version_helper): Call
7260 matched_symbol.
7261 (Version_script_info::check_unmatched_names): New function.
7262 * script.h (class Version_script_info): Update declarations.
7263 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7264
7265 * options.h (class General_options): Use DEFINE_bool_alias for
7266 allow_multiple_definition.
7267 * resolve.cc (Symbol_table::should_override): Don't test
7268 allow_multiple_definition.
7269
7270 PR 10980
7271 * options.h (class General_options): Add --cref.
7272 * main.cc (main): Print cref table if --cref. Don't close mapfile
7273 until after printing cref table.
7274 * cref.cc: Include "symtab.h".
7275 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7276 (Cref_table_compare::operator()): New function.
7277 (Cref_inputs::gather_cref): New function.
7278 (filecol): New static const.
7279 (Cref_inputs::print_cref): New function.
7280 (Cref::print_cref): New function.
7281 * cref.h: Include <cstdio>.
7282 (class Cref): Update declarations.
7283 * mapfile.h (Mapfile::file): New function.
7284 * object.h (class Object): Define Symbols. Declare virtual
7285 do_get_global_symbols.
7286 (Object::get_global_symbols): New function.
7287 * object.cc (Input_objects::add_object): Pass object to cref_ if
7288 --cref.
7289 (Input_objects::archive_start): Likewise.
7290 (Input_objects::archive_stop): Likewise.
7291 (Input_objects::print_cref): New function.
7292 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7293 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7294 --cref.
7295 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7296 function.
7297 * plugin.h (class Sized_pluginobj): Update declarations.
7298
7299 2010-01-05 Ian Lance Taylor <iant@google.com>
7300
7301 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7302 to is_default_version. Rename insdef to insdefault.
7303 (Symbol_table::add_from_relobj): Rename def to is_default_version
7304 and local to is_forced_local.
7305 (Symbol_table::add_from_pluginobj): Likewise.
7306 (Symbol_table::add_from_dynobj): Likewise.
7307 (Symbol_table::define_special_symbol): Rename insdef to
7308 insdefault.
7309
7310 2010-01-04 Ian Lance Taylor <iant@google.com>
7311
7312 PR 10980
7313 * options.h (class General_options): Add
7314 --allow-multiple-definition and -z muldefs.
7315 * resolve.cc (Symbol_table::should_override): Don't warn about a
7316 multiple symbol definition if --allow-multiple-definition or -z
7317 muldefs.
7318
7319 PR 10980
7320 * options.h (class General_options): Add --add-needed and
7321 --copy-dt-needed-entries. Tweak --as-needed help entry.
7322 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7323 error if --copy-dt-needed-entries aka --add-needed is used and
7324 would cause a change in behaviour.
7325
7326 PR 10980
7327 * options.h (class General_options): Add -G as a short version of
7328 --shared. Add no-op options -assert, -g, and -i.
7329
7330 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7331
7332 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7333 check for .text or .gnu.linkonce.t sections.
7334 * icf.cc (Icf::find_identical_sections): Ditto.
7335 Change the detection for mangled function name within the section
7336 name.
7337 * icf.h (is_section_foldable_candidate): New function.
7338
7339 2009-12-30 Ian Lance Taylor <iant@google.com>
7340
7341 PR 10980
7342 * options.h (class General_options): Permit two dashes with
7343 --retain-symbols-file.
7344
7345 2009-12-30 Ian Lance Taylor <iant@google.com>
7346
7347 PR 10979
7348 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7349 don't put the file header and segment headers in the text
7350 segment.
7351
7352 PR 10979
7353 * common.cc (Sort_commons::operator()): Stabilize sort when both
7354 entries are NULL.
7355 (Symbol_table::do_allocate_commons_list): When allocating common
7356 symbols, skip a symbol which is no longer common.
7357 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7358 an object before checking its type.
7359 * testsuite/common_test_2.c: New file.
7360 * testsuite/common_test_3.c: New file.
7361 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7362 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7363 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7364 (common_test_2_pic.o, common_test_2.so): New targets.
7365 (common_test_3_pic.o, common_test_3.so): New targets.
7366 * testsuite/Makefile.in: Rebuild.
7367
7368 PR 10979
7369 * script.cc (read_input_script): If we see a new SECTIONS clause,
7370 and we have added an input section, give an error.
7371 * layout.h (class Layout): Add have_added_input_section function.
7372 Add have_added_input_section_ field.
7373 * layout.cc (Layout::Layout): Initialize
7374 have_added_input_section_.
7375 (Layout::layout): Set have_added_input_section_.
7376 (Layout::layout_eh_frame): Likewise.
7377
7378 2009-12-30 Ian Lance Taylor <iant@google.com>
7379
7380 PR 10931
7381 * options.h (class General_options): Add --sort-common option.
7382 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7383 * common.cc (Sort_common): Add sort_order parameter to
7384 constructor. Add sort_order_ field.
7385 (Sort_commons::operator): Check sort_order_.
7386 (Symbol_table::allocate_commons): Determine the sort order.
7387 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7388 Change all callers.
7389 (Symbol_table::do_allocate_commons_list): Likewise.
7390
7391 2009-12-30 Ian Lance Taylor <iant@google.com>
7392
7393 PR 10916
7394 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7395 symbols from this object, don't change the visibility of an
7396 undefined symbol.
7397 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7398
7399 2009-12-30 Ian Lance Taylor <iant@google.com>
7400
7401 PR 10861
7402 * script.h (class Version_script_info): Define Language enum.
7403 Update declarations. Define Glob, Exact, and Lookup types. Add
7404 new fields globals_, locals_, and is_finalized_.
7405 * script.cc: Various formatting fixes.
7406 (class Parser_closure): Change language_stack_ from a vector of
7407 std::string to one of Version_script_info::Language. Adjust all
7408 uses accordingly.
7409 (class Lazy_demangler): Remove.
7410 (struct Version_expression): Change language from std::string to
7411 Version_script_info::Language.
7412 (Version_script_info::Version_script_info): New function.
7413 (Version_script_info::~Version_script_info): Don't call clear.
7414 (Version_script_info::finalize): New function.
7415 (Version_script_info::build_lookup_tables): New function.
7416 (Version_script_info::build_expression_list_lookup): New
7417 function.
7418 (Version_script_info::get_symbol_version_helper): Rewrite to use
7419 lookup tables.
7420 (Version_script_info::print_expression_list): Adjust to use
7421 Version_script_info::Language.
7422 (script_push_lex_into_version_mode): Check that the version script
7423 has not been finalized.
7424 (version_script_push_lang): Change language string to
7425 Version_script_info::Language.
7426 * options.cc (Command_line::version_script): New function.
7427 * options.h (class General_options): Add finalize_dynamic_list
7428 function. Change version_script from declaration to definition.
7429 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7430 * testsuite/version_script.map: Remove duplicate def of foo.
7431 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7432 version_script.map.
7433 * testsuite/Makefile.in: Rebuild.
7434
7435 2009-12-30 Ian Lance Taylor <iant@google.com>
7436
7437 PR 10843
7438 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7439 if the input symbol index is 0, make the output symbol index 0.
7440
7441 2009-12-30 Ian Lance Taylor <iant@google.com>
7442
7443 PR 10670
7444 * options.h (class General_options): Add -x/--discard-all.
7445 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7446 --discard-all. If the local symbol needs a dynamic entry, check
7447 that before handling --discard-locals.
7448
7449 2009-12-30 Ian Lance Taylor <iant@google.com>
7450
7451 PR 10450
7452 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7453 flags to PF_R.
7454 (Output_segment::add_output_section): Don't change the flags if
7455 the type is PT_TLS.
7456
7457 PR 10450
7458 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7459 GNU hash table if they need a dynamic value. Otherwise, don't add
7460 them if they are defined in a dynamic object or are forced local.
7461
7462 2009-12-29 Ian Lance Taylor <iant@google.com>
7463
7464 PR 10450
7465 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7466 .gnu.hash table for a 32-bit target.
7467
7468 PR 10450
7469 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7470 regular and a dynamic object only needs a dynamic symbol table
7471 entry if it is externally visible.
7472
7473 PR 10450
7474 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7475 constructor. Add global_offset_table_ field.
7476 (Target_i386::got_section): Set global_offset_table_.
7477 (Target_i386::do_finalize_sections): Set global_offset_table_
7478 size.
7479 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7480 in constructor. Add global_offset_table_ field.
7481 (Target_x86_64::got_section): Set global_offset_table_.
7482 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7483 size.
7484
7485 * layout.cc (Layout::Layout): Initialize increase_relro_.
7486 (Layout::get_output_section): Add is_relro, is_last_relro, and
7487 is_first_non_relro parameters. Change all callers.
7488 (Layout::choose_output_section): Likewise.
7489 (Layout::add_output_section_data): Likewise.
7490 (Layout::make_output_section): Likewise.
7491 (Layout::set_segment_offsets): Clear increase_relro when using a
7492 linker script.
7493 * layout.h (class Layout): Add increase_relro method. Add
7494 increase_relro_ field. Update declarations.
7495 * output.cc (Output_section::Output_section): Initialize
7496 is_last_relro_ and is_first_non_relro_.
7497 (Output_segment::add_output_section): Group relro sections is
7498 do_sort is true. Handle is_last_relro and is_first_non_relro.
7499 (Output_segment::maximum_alignment): Remove relro handling.
7500 (Output_segment::set_section_addresses): Add increase_relro
7501 parameter. Change all callers. Add initial alignment to align
7502 relro sections on separate page. Remove old relro handling.
7503 (Output_segment::set_section_list_addresses): Remove in_relro
7504 parameter. Change all callers.
7505 (Output_segment::set_offset): Add increase parameter. Change all
7506 callers. Remove old relro handling.
7507 * output.h (class Output_section): Add new methods: is_last_relro,
7508 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7509 Add is_last_relro_ and is_first_non_relro_ fields.
7510 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7511 Create separate .got.plt section. Call increase_relro.
7512 * x86_64.cc (Target_x86_64::got_section): Likewise.
7513 * testsuite/relro_script_test.t: Add .got.plt.
7514
7515 PR 10450
7516 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7517 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7518 (Layout::finalize): Call set_dynamic_symbol_size.
7519 (Layout::set_dynamic_symbol_size): New function.
7520 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7521 set_dynamic_symbol_size.
7522
7523 PR 10450
7524 * output.h (class Output_section): Add is_entsize_zero_ field.
7525 * output.cc (Output_section::Output_section): Initialize
7526 is_entsize_zero_.
7527 (Output_section::set_entsize): If two different entsizes are
7528 requested, force it to zero.
7529 (Output_section::add_input_section): Set flags for .debug_str
7530 before updating section flags. Set entsize.
7531 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7532 and SHF_STRING if all input sections have those flags.
7533
7534 2009-12-29 Rafael Espindola <espindola@google.com>
7535
7536 * main.cc (main): Fix the sys time reporting.
7537 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7538 reporting.
7539
7540 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7541
7542 * options.cc (General_options::parse_version): Allow -v to exit
7543 without an error if there is nothing to link.
7544
7545 2009-12-29 Ian Lance Taylor <iant@google.com>
7546
7547 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7548 using a version of gcc before 4.1.
7549 * configure: Rebuild.
7550
7551 2009-12-28 Chris Demetriou <cgd@google.com>
7552
7553 * attributes.cc (Output_attributes_section_data::do_write): Use
7554 std::vector::front rather than std::vector::data.
7555
7556 2009-12-28 Ian Lance Taylor <iant@google.com>
7557
7558 * symtab.h (class Symbol_table): Add enum Defined.
7559 * resolve.cc (Symbol_table::should_override): Add defined
7560 parameter. Change all callers. Test whether object is NULL
7561 before calling a method on it.
7562 (Symbol_table::report_resolve_problem): Add defined parameter.
7563 Change all callers.
7564 (Symbol_table::should_override_with_special): Likewise.
7565 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7566 parameter. Change all callers.
7567 (Symbol_table::do_define_in_output_data): Likewise.
7568 (Symbol_table::define_in_output_segment): Likewise.
7569 (Symbol_table::do_define_in_output_segment): Likewise.
7570 (Symbol_table::define_as_constant): Likewise.
7571 (Symbol_table::do_define_as_constant): Likewise.
7572 * script.h (class Symbol_assignment): Add is_defsym parameter to
7573 constructor; change all callers.
7574 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7575 parameter. Change all callers. Add is_defsym_ field.
7576 (class Parser_closure): Add parsing_defsym parameter to
7577 constructor; change all callers. Add parsing_defsym accessor
7578 function. Add parsing_defsym_ field.
7579
7580 2009-12-28 Ian Lance Taylor <iant@google.com>
7581
7582 * gold.cc (queue_middle_tasks): Fix formatting.
7583 * object.cc (Relobj::is_section_name_included): Likewise.
7584
7585 2009-12-23 Ian Lance Taylor <iant@google.com>
7586
7587 * i386.cc (Target_i386::do_calls_non_split): Recognize
7588 -fsplit-stack prologue for a function with a static chain.
7589 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7590 -fsplit-stack prologue when using %r11.
7591
7592 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7593
7594 * options.cc (General_options::parse_version): Make -v continue and do
7595 the link like GNU ld does.
7596
7597 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7598
7599 * Makefile.am (CCFILES): Add timer.cc.
7600 (HFILES): Add timer.h.
7601 * configure.ac: Check for sysconf and times.
7602 * main.cc: include timer.h.
7603 (main): Use Timer instead of get_run_time.
7604 * timer.cc: New.
7605 * timer.h: New.
7606 * workqueue.cc: include timer.h.
7607 (Workqueue::find_and_run_task):
7608 Report user, sys and wall time.
7609 * Makefile.in: Regenerate.
7610 * config.in: Regenerate.
7611 * configure: Regenerate.
7612
7613 2009-12-16 Doug Kwan <dougkwan@google.com>
7614
7615 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7616 sections.
7617 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7618 relaxed input sections.
7619 * output.cc (Output_section::find_relaxed_input_section): Change
7620 return type to Output_relaxed_input_section pointer. Adjust code
7621 for new type of relaxed_input_section_map_.
7622 * output.h (Output_section::find_relaxed_input_section): Change
7623 return type to Output_relaxed_input_section pointer.
7624 (Output_section::Output_relaxed_input_section_by_input_section_map):
7625 New type.
7626 (Output_section::relaxed_input_section_map_): Change type to
7627 Output_section::Output_relaxed_input_section_by_input_section_map.
7628 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7629 input section.
7630
7631 2009-12-15 Ian Lance Taylor <iant@google.com>
7632
7633 * layout.cc (Layout::create_shstrtab): Only write out after input
7634 sections if we are compressing debug sections.
7635
7636 2009-12-15 Ian Lance Taylor <iant@google.com>
7637
7638 * archive.cc (Archive::add_symbols): Only look up a symbol without
7639 a version if there is, in fact, a version.
7640
7641 2009-12-14 Ian Lance Taylor <iant@google.com>
7642
7643 Revert -Wshadow changes, all changes from:
7644 2009-12-11 Doug Kwan <dougkwan@google.com>
7645 2009-12-11 Nick Clifton <nickc@redhat.com>
7646 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7647
7648 2009-12-11 Doug Kwan <dougkwan@google.com>
7649
7650 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7651 due to -Wshadow.
7652 * attributes.cc (Object_attribute::size): Ditto.
7653 (Attributes_section_data::size): Ditto.
7654 (Attributes_section_data::Attributes_section_data): Ditto.
7655 (Output_attributes_section_data::do_write): Ditto.
7656 * attributes.h (Object_attribute::set_type): Ditto.
7657 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7658
7659 2009-12-11 Nick Clifton <nickc@redhat.com>
7660
7661 * archive.cc: Fix shadowed variable warnings.
7662 * arm.cc: Likewise.
7663 * compressed_output.cc: Likewise.
7664 * compressed_output.h: Likewise.
7665 * configure: Likewise.
7666 * dwarf_reader.cc: Likewise.
7667 * dynobj.cc: Likewise.
7668 * dynobj.h: Likewise.
7669 * ehframe.cc: Likewise.
7670 * ehframe.h: Likewise.
7671 * errors.cc: Likewise.
7672 * expression.cc: Likewise.
7673 * fileread.cc: Likewise.
7674 * fileread.h: Likewise.
7675 * freebsd.h: Likewise.
7676 * i386.cc: Likewise.
7677 * icf.cc: Likewise.
7678 * incremental.h: Likewise.
7679 * layout.cc: Likewise.
7680 * layout.h: Likewise.
7681 * mapfile.cc: Likewise.
7682 * merge.cc: Likewise.
7683 * merge.h: Likewise.
7684 * object.cc: Likewise.
7685 * object.h: Likewise.
7686 * options.h: Likewise.
7687 * output.cc: Likewise.
7688 * output.h: Likewise.
7689 * parameters.cc: Likewise.
7690 * plugin.cc: Likewise.
7691 * powerpc.cc: Likewise.
7692 * reduced_debug_output.cc: Likewise.
7693 * reduced_debug_output.h: Likewise.
7694 * reloc.cc: Likewise.
7695 * reloc.h: Likewise.
7696 * resolve.cc: Likewise.
7697 * script-sections.cc: Likewise.
7698 * script.cc: Likewise.
7699 * script.h: Likewise.
7700 * sparc.cc: Likewise.
7701 * symtab.cc: Likewise.
7702 * symtab.h: Likewise.
7703 * target-select.cc: Likewise.
7704 * target-select.h: Likewise.
7705 * token.h: Likewise.
7706 * workqueue.cc: Likewise.
7707 * workqueue.h: Likewise.
7708 * x86_64.cc: Likewise.
7709
7710 2009-12-10 Doug Kwan <dougkwan@google.com>
7711
7712 * arm.cc (attributes.h): New include.
7713 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7714 (Arm_relobj::~Arm_relobj): Delete object pointed by
7715 attributes_section_data_.
7716 (Arm_relobj::attributes_section_data): New method definition.
7717 (Arm_relobj::attributes_section_data_): New data member declaration.
7718 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7719 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7720 attributes_section_data_.
7721 (Arm_dynobj::attributes_section_data): New method definition.
7722 (Arm_dynobj::attributes_section_data_): New data member declaration.
7723 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7724 initialization value of may_use_blx_ to false.
7725 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7726 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7727 object attributes to compute results instead of hard-coding.
7728 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7729 Target_arm::get_secondary_compatible_arch,
7730 Target_arm::set_secondary_compatible_arch
7731 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7732 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7733 New method declarations.
7734 (Target_arm::get_aeabi_object_attribute): New method definition.
7735 (Target_arm::attributes_section_data_): New data member declaration.
7736 (read_arm_attributes_section): New template definition.
7737 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7738 (Arm_dynobj::do_read_symbols): Ditto.
7739 (Target_arm::do_finalize_sections): Merge attributes sections from
7740 input. Check for BLX use after attributes section merging.
7741 Fix __exidx_start and __exidx_end visibility. Create an
7742 .ARM.attributes section if necessary.
7743 (Target_arm::get_secondary_compatible_arch,
7744 Target_arm::set_secondary_compatible_arch,
7745 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7746 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7747 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7748 New method definitions.
7749
7750 2009-12-09 Ian Lance Taylor <iant@google.com>
7751
7752 * plugin.cc (Plugin::load): Don't cast from void* to a function
7753 pointer.
7754
7755 2009-12-09 Ian Lance Taylor <iant@google.com>
7756
7757 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7758 information fields.
7759
7760 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7761
7762 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7763 Replace two_file_shared_1.so with two_file_shared_2.so.
7764 * testsuite/Makefile.in: Regenerated.
7765
7766 2009-12-08 Doug Kwan <dougkwan@google.com>
7767
7768 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7769 (HFILES): Add attributes.h and int_encoding.h.
7770 * Makefile.in: Regenerate.
7771 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7772 function definitions to int_encoding.cc
7773 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7774 prototypes to int_encoding.h
7775 * reduced_debug_output.cc (int_encoding.h): New include.
7776 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7777 function definitions to int_encoding.cc
7778 (insert_into_vector, read_from_pointer): Move template definitions to
7779 int_encoding.h
7780 * attributes.cc: New file.
7781 * attributes.h: New file.
7782 * int_encoding.cc: New file.
7783 * int_encoding.h: New file.
7784
7785 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7786
7787 PR gold/11055
7788 * incremental-dump.cc (dump_incremental_inputs): New.
7789 (main): Use dump_incremental_inputs.
7790
7791 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7792
7793 PR gold/10893
7794 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7795 checking elfcpp::STT_FUNC.
7796 (Target_i386::Relocate::relocate): Likewise.
7797 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7798
7799 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7800 symbols from shared libraries into normal FUNC symbols.
7801
7802 * symtab.h (Symbol): Add is_func and use it.
7803
7804 2009-12-05 Doug Kwan <dougkwan@google.com>
7805
7806 * arm.cc (Target_arm::arm_info): Initialize new fields
7807 attributes_section and attributes_vendor.
7808 * i386.cc (Target_i386::i386_info): Same.
7809 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7810 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7811 fields attributes_section and attributes_vendor.
7812 * sparc.cc (Target_sparc::sparc_info): Same.
7813 * target.h (Target::attributes_section, Target::attributes_vendor,
7814 Target::is_attributes_section, Target::attribute_arg_type,
7815 Target::attributes_order): New method definitions.
7816 (Target::Target_info::attributes_section,
7817 Target::Target_info::attributes_vendor): New fields.
7818 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7819 virtual method definitions.
7820 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7821 attributes_section and attributes_vendor.
7822 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7823
7824 2009-12-05 Doug Kwan <dougkwan@google.com>
7825
7826 * arm.cc: Update comments about interworking and stub generation.
7827 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7828 considered as non-PIC.
7829 (Arm_relocate_functions::base_abs): Fix formatting.
7830 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7831 of function to use GOT entry address instead of offset.
7832 (Target_arm::Scan::global): Issue an error if a symbol would need a
7833 PLT does not get one because it is untyped. Remove code to create
7834 dynamic symbols for relative branches.
7835 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7836 takes unsigned integer instead of boolean.
7837
7838 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7839
7840 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7841 (two_file_test_LDADD): Likewise.
7842 (common_test_1_LDADD): Likewise.
7843 (exception_test_LDADD) Likewise.
7844 (weak_test_LDADD): Likewise.
7845 (many_sections_test_LDADD): Likewise.
7846 (initpri1_LDADD): Likewise.
7847 (script_test_1_LDADD): Likewise.
7848 (script_test_2_LDADD): Likewise.
7849 (justsyms_LDADD): Likewise.
7850 (binary_test_LDADD): Likewise.
7851 (large_LDADD): Likewise.
7852 * testsuite/Makefile.in: Regenerated.
7853
7854 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7855
7856 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7857 (Symbol_table::override_with_special): Likewise.
7858 (Symbol_table::add_from_object): Likewise.
7859
7860 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7861
7862 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7863 Don't set the data_offset twice.
7864
7865 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7866
7867 * testsuite/Makefile.in: Regenerate.
7868
7869 2009-12-03 Doug Kwan <dougkwan@google.com>
7870
7871 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7872 (Target_arm::do_finalize_sections): Add parameter for symbol table
7873 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7874 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7875 parameter for symbol table pointer.
7876 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7877 an additional parameter for a pointer to symbol table.
7878 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7879 parameter for a symbol table pointer.
7880 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7881 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7882 Ditto.
7883 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7884 parameter for a symbol table pointer.
7885
7886 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7887
7888 * incremental.cc (Incremental_inputs_header)
7889 (Incremental_inputs_header_write, Incremental_inputs_entry)
7890 (Incremental_inputs_entry_write): Move ...
7891 * incremental.h (Incremental_inputs_header)
7892 (Incremental_inputs_header_write, Incremental_inputs_entry)
7893 (Incremental_inputs_entry_write): here.
7894
7895 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7896
7897 * incremental.cc (make_sized_incremental_binary): Set the target.
7898 Error if it is incompatible.
7899 * output.h (Output_file): Add filename method.
7900
7901 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7902
7903 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7904 from the get_* methods.
7905
7906 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7907
7908 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7909 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7910 Write 0 for the data_offset of scripts.
7911
7912 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7913
7914 * testsuite/Makefile.am: Add the incremental_test.sh test.
7915 * testsuite/incremental_test.sh: New.
7916 * testsuite/incremental_test_1.c: New.
7917 * testsuite/incremental_test_2.c: New.
7918
7919 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7920
7921 * incremental-dump.cc (main): Fix typos.
7922
7923 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7924
7925 PR gold/11025
7926 * incremental-dump.cc (main): Use llu to print 64 bit values.
7927
7928 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7929 H.J. Lu <hongjiu.lu@intel.com>
7930
7931 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7932 $(LIBDL).
7933 (incremental_dump_LDADD): Likewise.
7934 * Makefile.in: Regenerated.
7935
7936 2009-11-25 Doug Kwan <dougkwan@google.com>
7937
7938 Revert:
7939
7940 2009-11-25 Doug Kwan <dougkwan@google.com>
7941
7942 * arm.cc (Target_arm::Target_arm): Move method definition
7943 outside of class definition. Add code to handle
7944 --target1-rel, --target1-abs and --target2= options.
7945 (Target_arm::get_reloc_reloc_type): Change method to be
7946 non-static and const.
7947 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7948 New data member declaration.
7949 (Target_arm::Scan::local, Target_arm::Scan::global,
7950 Target_arm::Relocate::relocate,
7951 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7952 Adjust call to Target_arm::get_real_reloc_type.
7953 (Target_arm::get_real_reloc_type): Use command line options
7954 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7955 * options.h (--target1-rel, --target1-abs, --target2): New
7956 ARM-only options.
7957
7958 2009-11-25 Doug Kwan <dougkwan@google.com>
7959
7960 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7961 class definition. Add code to handle --target1-rel, --target1-abs
7962 and --target2= options.
7963 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7964 and const.
7965 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7966 member declaration.
7967 (Target_arm::Scan::local, Target_arm::Scan::global,
7968 Target_arm::Relocate::relocate,
7969 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7970 call to Target_arm::get_real_reloc_type.
7971 (Target_arm::get_real_reloc_type): Use command line options to
7972 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7973 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7974 options.
7975
7976 2009-11-25 Doug Kwan <dougkwan@google.com>
7977
7978 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7979 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7980 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7981 formatting.
7982 (Arm_relocate_functions::thm_call): Replace body with a call to
7983 Arm_relocate_functions::thumb_branch_common.
7984 (Arm_relocate_functions::thm_jump24,
7985 Arm_relocate_functions::thm_xpc22): New method definitions.
7986 (Arm_relocate_functions::thumb_branch_common): New method definition.
7987 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7988 operator.
7989 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7990 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7991
7992 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7993
7994 * Makefile.am: Build incremental-dump
7995 * Makefile.in: Regenerate.
7996 * incremental-dump.cc: New.
7997 * incremental.cc (Incremental_inputs_header_data,
7998 Incremental_inputs_entry_data): Move to incremental.h
7999 * incremental.h: (Incremental_inputs_header_data,
8000 Incremental_inputs_entry_data): Move from incremental.cc
8001
8002 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8003
8004 * incremental.cc (Incremental_inputs_header,
8005 Incremental_inputs_header_write, Incremental_inputs_entry,
8006 Incremental_inputs_entry_write): Add a typedef with the data type.
8007
8008 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8009
8010 * incremental.cc (Incremental_inputs_header,
8011 Incremental_inputs_header_write, Incremental_inputs_entry,
8012 Incremental_inputs_entry_write): Update comment about which
8013 type has the filed descriptions.
8014
8015 2009-11-15 Doug Kwan <dougkwan@google.com>
8016
8017 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8018 (Arm_relocate_functions::arm_branch_common): Change method defintion
8019 in class definition to a method declaration and update list of formal
8020 parameters.
8021 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8022 Arm_relocation_functions::jump24): Adjust call to
8023 Arm_relocate_functions::arm_branch_common. Update list of formal
8024 parameters.
8025 (Arm_relocate_functions::xpc25): New method definition.
8026 (Arm_relocate_functions::arm_branch_common): Move method defintion
8027 out from class definition. Use stubs for mode-switching and extending
8028 branch ranges.
8029 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8030 specially. Change code to enable use of stubs in ARM branches.
8031
8032 2009-11-10 Doug Kwan <dougkwan@google.com>
8033
8034 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8035 in method declaration.
8036 (Target_arm::relocate_stub): New method declaration.
8037 (Target_arm::default_target): Change to return a pointer instead of
8038 a const reference.
8039 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8040 Target_arm::default_target.
8041 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8042 method definition.
8043 (Target_arm::relocate_section): Adjust view.
8044 (Target_arm::relocate_stub): New method definition.
8045
8046 2009-11-10 Doug Kwan <dougkwan@google.com>
8047
8048 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8049 a format warning.
8050 * incremental.cc (open_incremental_binary): Initialized local
8051 variables to avoid warnings.
8052 * object.cc (make_elf_object): Ditto.
8053 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8054 a format warning.
8055
8056 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8057
8058 PR gold/10930
8059 * testsuite/plugin_test.c: Include "config.h".
8060
8061 2009-11-09 Doug Kwan <dougkwan@google.com>
8062
8063 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8064 (arm_symbol_value): Remove.
8065 (Arm_relocate_functions::arm_branch_common,
8066 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8067 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8068 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8069 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8070 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8071 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8072 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8073 Arm_relocate_functions::thm_mobw_abs_nc,
8074 Arm_relocate_functions::thm_mov_abs,
8075 Arm_relocate_functions::movw_prel_nc,
8076 Arm_relocate_functions::thm_movt_abs,
8077 Arm_relocate_functions::movt_prel,
8078 Arm_relocate_functions::thm_movw_prel_nc,
8079 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8080 (Target_arm::Relocate::relocate): Only decompose address into two
8081 parts if relocation type uses the thumb-bit and pass the actual
8082 bit instead of a flag indicating that the thumb-bit is used. Adjust
8083 calls to methods in Arm_relocate_functions for this change.
8084
8085 2009-11-08 Ian Lance Taylor <iant@google.com>
8086
8087 PR 10925
8088 * reloc.cc: Instantiate
8089 Sized_relobj::initialize_input_to_output_maps and
8090 Sized_relobj:free_input_to_output_maps.
8091
8092 2009-11-06 Ian Lance Taylor <iant@google.com>
8093
8094 PR 10876
8095 * defstd.cc (in_segment): Set only_if_ref true for "end".
8096
8097 2009-11-06 Doug Kwan <dougkwan@google.com>
8098
8099 * arm.cc (class Reloc_stub): Correct a comment.
8100 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8101 (Target_arm::scan_section_for_stubs): New method declaration.
8102 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8103 Change methods from private to protected.
8104 (Target_arm::do_may_relax): New method definition.
8105 (Target_arm::do_relax, Target_arm::group_sections,
8106 Target_arm::scan_reloc_for_stub,
8107 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8108 (Target_arm::arm_input_section_map_): New data member declaration.
8109 (Target_arm::scan_reloc_for_stub,
8110 Target_arm::scan_reloc_section_for_stubs,
8111 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8112 Target_arm::do_relax): New method definitions.
8113
8114 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8115
8116 * configure.ac: Check for (struct stat)::st_mtim
8117 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8118 * config.in: Regenerate.
8119 * configure: Regenerate.
8120
8121 2009-11-05 Ian Lance Taylor <iant@google.com>
8122
8123 PR 10910
8124 * output.cc (Output_segment::add_output_section): Add missing
8125 return statement.
8126
8127 2009-11-04 Ian Lance Taylor <iant@google.com>
8128
8129 PR 10880
8130 * object.h (class Object): Add is_needed and set_is_needed
8131 methods. Add is_needed_ field. Make bool fields into bitfields.
8132 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8133 defined in a dynamic object and referenced by a regular object,
8134 set is_needed for the dynamic object.
8135 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8136 if the file is marked with as_needed and it is not needed.
8137
8138 2009-11-04 Ian Lance Taylor <iant@google.com>
8139
8140 PR 10887
8141 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8142 tags if data is discarded by linker script.
8143 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8144 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8145 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8146 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8147
8148 2009-11-04 Ian Lance Taylor <iant@google.com>
8149
8150 * layout.cc (Layout::get_output_section): Add is_interp and
8151 is_dynamic_linker_section parameters. Change all callers.
8152 (Layout::choose_output_section): Likewise.
8153 (Layout::make_output_section): Likewise.
8154 (Layout::add_output_section_data): Add is_dynamic_linker_section
8155 parameter. Change all callers.
8156 * layout.h (class Layout): Update declarations.
8157 * output.h (class Output_section): Add is_interp, set_is_interp,
8158 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8159 Add is_interp_, is_dynamic_linker_section_ fields. Change
8160 generate_code_fills_at_write_ to a bitfield.
8161 * output.cc (Output_section::Output_sections): Initialize new
8162 fields.
8163 (Output_segment::add_output_section): Add do_sort parameter.
8164 Change all callers.
8165
8166 2009-11-03 Ian Lance Taylor <iant@google.com>
8167
8168 PR 10860
8169 * options.h (class General_options): Add --warn-common.
8170 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8171 merging two common symbols.
8172 (Symbol_table::should_override): Handle --warn-common when merging
8173 a common symbol with a defined symbol. Use report_resolve_problem
8174 for multiple definitions.
8175 (Symbol_table::report_resolve_problem): New function.
8176 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8177
8178 2009-11-03 Doug Kwan <dougkwan@google.com>
8179
8180 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8181 stub_factory_.
8182 (Target_arm::stub_factory): New method definition.
8183 (Target_arm::new_arm_input_section,
8184 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8185 Target_arm::reloc_uses_thumb_bit): New method declarations.
8186 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8187 New type definitions.
8188 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8189 member declarations.
8190 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8191 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8192 New method definitions.
8193
8194 2009-11-03 Ian Lance Taylor <iant@google.com>
8195
8196 * options.h (class General_options): Add --warn_constructors.
8197
8198 2009-11-03 Ian Lance Taylor <iant@google.com>
8199
8200 PR 10893
8201 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8202 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8203
8204 2009-11-03 Ian Lance Taylor <iant@google.com>
8205
8206 PR 10895
8207 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8208 --msgid-bugs-address.
8209 (install-pdf): New target.
8210 (install-data_yes): Look up one directory to find mkinstalldirs.
8211
8212 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8213
8214 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8215 tree.
8216
8217 2009-10-30 Doug Kwan <dougkwan@google.com>
8218
8219 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8220
8221 2009-10-30 Doug Kwan <dougkwan@google.com>
8222
8223 * arm.cc (Stub_addend_reader): New struct template definition
8224 and partial specializations.
8225 (Stub_addend_reader::operator()): New method definition for a
8226 partially specialized template.
8227
8228 2009-10-30 Doug Kwan <dougkwan@google.com>
8229
8230 * arm.cc (Arm_relobj::processor_specific_flags): New method
8231 definition.
8232 (Arm_relobj::do_read_symbols): New method declaration.
8233 (Arm_relobj::processor_specific_flags_): New data member declaration.
8234 (Arm_dynobj): New class definition.
8235 (Target_arm::do_finalize_sections): Add input_objects parameter.
8236 (Target_arm::do_adjust_elf_header): New method declaration.
8237 (Target_arm::are_eabi_versions_compatible,
8238 (Target_arm::merge_processor_specific_flags): New method declaration.
8239 (Target_arm::do_make_elf_object): New overloaded method definitions
8240 and declaration.
8241 (Arm_relobj::do_read_symbols): New method definition.
8242 (Arm_dynobj::do_read_symbols): Ditto.
8243 (Target_arm::do_finalize_sections): Add input_objects parameters.
8244 Merge processor-specific flags from all input objects.
8245 (Target_arm::are_eabi_versions_compatible,
8246 Target_arm::merge_processor_specific_flags,
8247 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8248 New method definitions.
8249 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8250 Input_objects pointer type parameter.
8251 * layout.cc (Layout::finalize): Pass input objects to target's.
8252 finalize_sections function.
8253 * output.cc (Output_file_header::do_sized_write): Set ELF file
8254 header's processor-specific flags.
8255 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8256 Input_objects pointer type parameter.
8257 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8258 * target.h (Input_objects): New forward class declaration.
8259 (Target::processor_specific_flags,
8260 Target::are_processor_specific_flags_sect): New method definitions.
8261 (Target::finalize_sections): Add input_objects parameter.
8262 (Target::Target): Initialize processor_specific_flags_ and
8263 are_processor_specific_flags_set_.
8264 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8265 parameter.
8266 (Target::set_processor_specific_flags): New method definition.
8267 (Target::processor_specific_flags_,
8268 Target::are_processor_specific_flags_set_): New data member
8269 declarations.
8270 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8271 Input_objects pointer type parameter.
8272
8273 2009-10-30 Doug Kwan <dougkwan@google.com>
8274
8275 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8276
8277 2009-10-28 Ian Lance Taylor <iant@google.com>
8278
8279 * object.h (class Relobj): Drop options parameter from
8280 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8281 do_scan_relocs, do_relocate. Change all callers.
8282 (class Sized_relobj): Drop options parameters from
8283 do_gc_process_relocs, do_scan_relocs, do_relocate,
8284 do_relocate_sections, relocate_sections, emit_relocs_scan,
8285 emit_relocs_scan_reltype. Change all callers.
8286 (struct Relocate_info): Remove options field and all references to
8287 it.
8288 * reloc.h (class Read_relocs): Remove options constructor
8289 parameter and options_ field. Change all callers.
8290 (class Gc_process_relocs, class Scan_relocs): Likewise.
8291 (class Relocate_task): Likewise.
8292 * target-reloc.h (scan_relocs): Remove options parameter. Change
8293 all callers.
8294 (scan_relocatable_relocs): Likewise.
8295 * target.h (class Sized_target): Remove options parameter from
8296 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8297 all callers.
8298 * gc.h (gc_process_relocs): Remove options parameter. Change all
8299 callers.
8300 * arm.cc: Update functions to remove options parameters.
8301 * i386.cc: Likewise.
8302 * powerpc.cc: Likewise.
8303 * sparc.cc: Likewise.
8304 * x86_64.cc: Likewise.
8305 * testsuite/testfile.cc: Likewise.
8306
8307 2009-10-28 Doug Kwan <dougkwan@google.com>
8308
8309 * arm.cc (Arm_relobj): New class definition.
8310 (Arm_relobj::scan_sections_for_stubs,
8311 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8312 New method definitions.
8313
8314 2009-10-28 Cary Coutant <ccoutant@google.com>
8315
8316 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8317 (Plugin::cleanup_done_): New member.
8318 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8319 (Plugin_manager::cleanup_done_): Remove.
8320 (Plugin_manager::add_input_file): Edit error message.
8321 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8322 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8323
8324 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8325
8326 * fileread.cc: (File_read::View::~View): Use the new
8327 data_ownership_ filed.
8328 (File_read::~File_read): Dispose the new whole_file_view_.
8329 (File_read::open): Mmap the whole file if needed.
8330 (File_read::open): Use whole_file_view_ instead of contents_.
8331 (File_read::find_view): Use whole_file_view_ if applicable.
8332 (File_read::do_read): Use whole_file_view_ instead of contents_.
8333 (File_read::make_view): Use whole_file_view_ instead of contents_,
8334 update File_read::View::View call.
8335 (File_read::find_or_make_view): Update File_read::View::View
8336 call.
8337 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8338 remove contents_
8339 (File_read::View::Data_ownership): New enum.
8340 (File_read::View::View): Replace bool mapped_ with Data_ownership
8341 argument.
8342 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8343 (File_read::View::data_ownership_): New field.
8344 (File_read::contents_): Remove (replaced by whole_file_view_).
8345 (File_read::whole_file_view_): New field.
8346 * options.h (class General_options): Add --keep-files-mapped.
8347
8348 2009-10-27 Cary Coutant <ccoutant@google.com>
8349
8350 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8351 * testsuite/Makefile.am (plugin_test_5): New test case.
8352 * testsuite/Makefile.in: Regenerate.
8353
8354 2009-10-25 Doug Kwan <dougkwan@google.com>
8355
8356 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8357 from private to protected to allow access by child class.
8358 (Sized_relobj::do_relocate_sections): New method declaration.
8359 (Sized_relobj::relocate_sections): Virtualize.
8360 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8361 Sized_relobj::relocate_sections. Instantiate template explicitly
8362 for different target sizes and endianity.
8363
8364 2009-10-24 Doug Kwan <dougkwan@google.com>
8365
8366 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8367 (Arm_input_section::as_arm_input_section): New method.
8368 (Arm_output_section): New class definition.
8369 (Arm_output_section::create_stub_group,
8370 Arm_output_section::group_sections): New method definitions.
8371
8372 2009-10-22 Doug Kwan <dougkwan@google.com>
8373
8374 * arm.cc (Arm_input_section): New class definition.
8375 (Arm_input_section::init, Arm_input_section:do_write,
8376 Arm_input_section::set_final_data_size,
8377 Arm_input_section::do_reset_address_and_file_offset): New method
8378 definitions.
8379
8380 2009-10-21 Doug Kwan <dougkwan@google.com>
8381
8382 * arm.cc (Stub_table, Arm_input_section): New forward class
8383 declarations.
8384 (Stub_table): New class defintion.
8385 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8386 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8387 New method definition.
8388
8389 2009-10-21 Doug Kwan <dougkwan@google.com>
8390
8391 * arm.cc: Update copyright comments.
8392 (Target_arm): New forward class template declaration.
8393 (Arm_address): New type.
8394 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8395 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8396 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8397 constants.
8398 (Insn_template): Same.
8399 (DEF_STUBS): New macro.
8400 (Stub_type): New enum type.
8401 (Stub_template): New class definition.
8402 (Stub): Same.
8403 (Reloc_stub): Same.
8404 (Stub_factory): Same.
8405 (Target_arm::Target_arm): Initialize may_use_blx_ and
8406 should_force_pic_veneer_.
8407 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8408 Target_arm::should_force_pic_veneer,
8409 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8410 Target_arm::using_thumb_only, Target_arm:;default_target): New
8411 method defintions.
8412 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8413 New data member declarations.
8414 (Insn_template::size, Insn_template::alignment): New method defintions.
8415 (Stub_template::Stub_template): New method definition.
8416 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8417 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8418 (Stub_factory::Stub_factory): New method definition.
8419 * gold.h (string_hash): New template.
8420 * output.h (Input_section_specifier::hash_value): Use
8421 gold::string_hash.
8422 (Input_section_specifier::string_hash): Remove.
8423 * stringpool.cc (Stringpool_template::string_hash): Use
8424 gold::string_hash.
8425
8426 2009-10-20 Doug Kwan <dougkwan@google.com>
8427
8428 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8429 symbols of relaxed input sections.
8430 * output.h (Output_section::find_relaxed_input_section): Make
8431 method public.
8432
8433 2009-10-16 Doug Kwan <dougkwan@google.com>
8434
8435 * dynobj.cc (Versions::Versions): Initialize version_script_.
8436 Only insert base version symbol definition for a shared object
8437 if version script defines any version versions.
8438 (Versions::define_base_version): New method definition.
8439 (Versions::add_def): Check that base version is not needed.
8440 (Versions::add_need): Define base version lazily.
8441 * dynobj.h (Versions::define_base_version): New method declaration.
8442 (Versions::needs_base_version_): New data member declaration.
8443 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8444 (check_DATA): Add no_version_test.stdout.
8445 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8446 New make rules.
8447 * testsuite/Makefile.in: Regenerate.
8448 * testsuite/no_version_test.c: New file.
8449 * testsuite/no_version_test.sh: Ditto.
8450
8451 2009-10-16 Doug Kwan <dougkwan@google.com>
8452
8453 * expression.cc (class Segment_start_expression): New class definition.
8454 (Segment_start_expression::value): New method definition.
8455 (script_exp_function_segment_start): Return a new
8456 Segment_start_expression.
8457 * gold/script-c.h (script_saw_segment_start_expression): New function
8458 prototype.
8459 * script-sections.cc (Script_sections::Script_sections): Initialize
8460 SAW_SEGMENT_START_EXPRESSION_ to false.
8461 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8462 and -Tbbs options to specify section addresses if given in
8463 command line and no SEGMENT_START expression is seen in a script.
8464 * script-sections.h (Script_sections::saw_segment_start_expression,
8465 Script_sections::set_saw_segment_start_expression): New method
8466 definition.
8467 (Script_sections::saw_segment_start_expression_): New data member
8468 declaration.
8469 * script.cc (script_saw_segment_start_expression): New function.
8470 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8471 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8472 script_test_7.sh and script_test_8.sh.
8473 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8474 script_test_8.stdout.
8475 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8476 (script_test_6, script_test_6.stdout, script_test_7,
8477 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8478 * Makefile.in: Regenerate.
8479 * testsuite/script_test_6.sh: New file.
8480 * testsuite/script_test_6.t: Same.
8481 * testsuite/script_test_7.sh: Same.
8482 * testsuite/script_test_7.t: Same.
8483 * testsuite/script_test_8.sh: Same.
8484
8485 2009-10-16 Doug Kwan <dougkwan@google.com>
8486
8487 * output.cc (Output_segment::set_section_list_address): Cast
8488 expressions to unsigned long long type to avoid format warnings.
8489
8490 2009-10-15 Ian Lance Taylor <iant@google.com>
8491
8492 * script.cc (Script_options::add_symbol_assignment): Always add a
8493 dot assignment to script_sections_.
8494 * script-sections.cc (Script_sections::add_dot_assignment):
8495 Initialize if necessary.
8496
8497 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8498 program headers with no load segment if there is a linker script.
8499
8500 * layout.cc (Layout::set_segment_offsets): Align the file offset
8501 to the segment aligment for -N or -n with no load segment.
8502 * output.cc (Output_segment::add_output_section): Don't crash if
8503 the first section is a TLS section.
8504 (Output_segment::set_section_list_addresses): Print an error
8505 message if the address moves backward in a linker script.
8506 * script-sections.cc
8507 (Output_section_element_input::set_section_addresses): Don't
8508 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8509 (Orphan_output_section::set_section_addresses): Likewise.
8510
8511 2009-10-15 Doug Kwan <dougkwan@google.com>
8512
8513 * layout.cc (Layout::finish_dynamic_section): Generate tags
8514 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8515 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8516 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8517
8518 2009-10-14 Ian Lance Taylor <iant@google.com>
8519
8520 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8521 fields.
8522 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8523 data_shdr fields of relinfo.
8524 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8525 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8526 R_386_TLS_LDO_32, adjust based on section flags.
8527 (Target_i386::Relocate::fix_up_ldo): Remove.
8528
8529 2009-10-13 Ian Lance Taylor <iant@google.com>
8530
8531 Add support for -pie.
8532 * options.h (class General_options): Add -pie and
8533 --pic-executable.
8534 (General_options::output_is_position_independent): Test -pie.
8535 (General_options::output_is_executable): Return true if not shared
8536 and not relocatable.
8537 (General_options::output_is_pie): Remove.
8538 * options.cc (General_options::finalize): Reject incompatible uses
8539 of -pie.
8540 * gold.cc (queue_middle_tasks): A -pie link is not static.
8541 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8542 * symtab.cc (Symbol::final_value_is_known): Return false if
8543 output_is_position_independent.
8544 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8545 output_is_position_independent.
8546 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8547 output_is_position_independent.
8548 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8549 output_is_position_independent.
8550 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8551 two_file_pie_test.
8552 (basic_pie_test.o, basic_pie_test): New targets.
8553 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8554 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8555 (two_file_pie_test): New target.
8556 * testsuite/Makefile.in: Rebuild.
8557 * README: Remove note saying that -pie is not supported.
8558
8559 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8560
8561 * options.h (class General_options): Add -init and -fini.
8562 * layout.cc (Layout::finish_dynamic_section): Emit
8563 given init and fini functions.
8564
8565 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8566
8567 * gc.h (gc_process_relocs): Check if icf is enabled using new
8568 function.
8569 * gold.cc (queue_initial_tasks): Likewise.
8570 (queue_middle_tasks): Likewise.
8571 * object.cc (do_layout): Likewise.
8572 * symtab.cc (is_section_folded): Likewise.
8573 * main.cc (main): Likewise.
8574 * reloc.cc (Read_relocs::run): Likewise.
8575 (Sized_relobj::do_scan_relocs): Likewise.
8576 * icf.cc (is_function_ctor_or_dtor): New function.
8577 (Icf::find_identical_sections): Check if function is ctor or dtor when
8578 safe icf is chosen.
8579 * options.h (General_options::icf): Change option to be an enum.
8580 (Icf_status): New enum.
8581 (icf_enabled): New method.
8582 (icf_safe_folding): New method.
8583 (set_icf_status): New method.
8584 (icf_status_): New variable.
8585 * (options.cc) (General_options::finalize): Set icf_status_.
8586 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8587 icf_test and icf_keep_unique_test to use the --icf enum flag.
8588 * testsuite/icf_safe_test.sh: New file.
8589 * testsuite/icf_safe_test.cc: New file.
8590
8591 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8592
8593 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8594 includes to gc.h and icf.h.
8595 * arm.cc: Include gc.h.
8596 * gold.cc: Likewise.
8597 * i386.cc: Likewise.
8598 * powerpc.cc: Likewise.
8599 * sparc.cc: Likewise.
8600 * x86_64.cc: Likewise.
8601 * gc.h: Include icf.h.
8602
8603 2009-10-11 Ian Lance Taylor <iant@google.com>
8604
8605 * plugin.cc: Include "gold.h" before other header files.
8606
8607 2009-10-10 Chris Demetriou <cgd@google.com>
8608
8609 * options.h (Input_file_argument::Input_file_type): New enum.
8610 (Input_file_argument::is_lib_): Replace with...
8611 (Input_file_argument::type_): New member.
8612 (Input_file_argument::Input_file_argument): Take Input_file_type
8613 'type' rather than boolean 'is_lib' as second argument.
8614 (Input_file_argument::is_lib): Use type_.
8615 (Input_file_argument::is_searched_file): New function.
8616 (Input_file_argument::may_need_search): Handle is_searched_file.
8617 * options.cc (General_options::parse_library): Support -l:filename.
8618 (General_options::parse_just_symbols): Update for Input_file_argument
8619 changes.
8620 (Command_line::process): Likewise.
8621 * archive.cc (Archive::get_file_and_offset): Likewise.
8622 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8623 * script.cc (read_script_file, script_add_file): Likewise.
8624 * fileread.cc (Input_file::Input_file): Likewise.
8625 (Input_file::will_search_for): Handle is_searched_file.
8626 (Input_file::open): Likewise.
8627 * readsyms.cc (Read_symbols::get_name): Likewise.
8628 * testsuite/Makefile.am (searched_file_test): New test.
8629 * testsuite/Makefile.in: Regenerate.
8630 * testsuite/searched_file_test.cc: New file.
8631 * testsuite/searched_file_test_lib.cc: New file.
8632
8633 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8634 Ian Lance Taylor <iant@google.com>
8635
8636 * descriptor.cc: Include <cstdio> and "binary-io.h".
8637 (Descriptors::open): Open the files in binary mode always.
8638 * script.cc (Lex::get_token): Treat \r as whitespace.
8639
8640 2009-10-09 Ian Lance Taylor <iant@google.com>
8641
8642 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8643
8644 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8645 Ian Lance Taylor <iant@google.com>
8646
8647 * configure.ac: Check for readv function also.
8648 * fileread.cc (readv): Define if not HAVE_READV.
8649 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8650 does not exist.
8651 * config.in: Regenerate.
8652 * configure: Regenerate.
8653
8654 2009-10-09 Doug Kwan <dougkwan@google.com>
8655
8656 * layout.cc (Layout::make_output_section): Call target hook to make
8657 ordinary output section.
8658 (Layout::finalize): Adjust parameter list of call the
8659 Target::may_relax().
8660 * layout.h (class Layout::section_list): New method.
8661 * merge.h (Output_merge_base::entsize): Change visibility to public.
8662 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8663 New methods.
8664 (Output_merge_string::do_is_string): New method.
8665 * object.cc (Sized_relobj::do_setup): renamed from
8666 Sized_relobj::set_up.
8667 * object.h (Sized_relobj::adjust_shndx,
8668 Sized_relobj::initializ_input_to_output_maps,
8669 Sized_relobj::free_input_to_output_maps): Change visibilities to
8670 protected.
8671 (Sized_relobj::setup): Virtualize.
8672 (Sized_relobj::do_setup): New method declaration.
8673 (Sized_relobj::invalidate_section_offset,
8674 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8675 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8676 * options.cc (parse_int): New function.
8677 * options.h (parse_int): New declaration.
8678 (DEFINE_int): New macro.
8679 (stub_group_size): New option.
8680 * output.cc (Output_section::Output_section): Initialize memebers
8681 merge_section_map_, merge_section_by_properties_map_,
8682 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8683 (Output_section::add_input_section): Handled deferred code-fill
8684 generation and remove an old comment.
8685 (Output_section::add_relaxed_input_section): New method definition.
8686 (Output_section::add_merge_input_section): Use merge section by
8687 properties map to speed to search. Update merge section maps
8688 as appropriate.
8689 (Output_section::build_relaxation_map): New method definition.
8690 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8691 Same.
8692 (Output_section::relax_input_section): Renamed to
8693 Output_section::convert_input_sections_to_relaxed_sections and change
8694 interface to take a vector of pointers to relaxed sections.
8695 (Output_section::find_merge_section,
8696 Output_section::find_relaxed_input_section): New method definitions.
8697 (Output_section::is_input_address_mapped,
8698 Output_section::output_offset, Output_section::output_address):
8699 Use output section data maps to speed up searching.
8700 (Output_section::find_starting_output_address): Add comments.
8701 (Output_section::do_write,
8702 Output_section::write_to_postprocessing_buffer): Do code-fill
8703 generation as appropriate.
8704 (Output_section::get_input_sections): Invalidate relaxed input section
8705 map.
8706 (Output_section::restore_states): Adjust type of checkpoint .
8707 Invalidate relaxed input section map.
8708 * output.h (Output_merge_base): New class declaration.
8709 (Input_section_specifier): New class defintion.
8710 (class Output_relaxed_input_section) Change base class to
8711 Output_section_data_build.
8712 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8713 base class initializer.
8714 (Output_section::add_relaxed_input_section): New method declaration.
8715 (Output_section::Input_section): Change visibility to protected.
8716 (Output_section::Input_section::relobj,
8717 Output_section::Input_section::shndx): Handle relaxed input sections.
8718 Output_section::input_sections) Change visibility to protected. Also
8719 define overload to return a non-const pointer.
8720 (Output_section::Merge_section_properties): New class defintion.
8721 (Output_section::Merge_section_by_properties_map,
8722 Output_section::Output_section_data_by_input_section_map,
8723 Output_section::Relaxation_map): New types.
8724 (Output_section::relax_input_section): Rename method to
8725 Output_section::convert_input_sections_to_relaxed_sections and change
8726 interface to take a vector of relaxed section pointers.
8727 (Output_section::find_merge_section,
8728 Output_section::find_relaxed_input_section,
8729 Output_section::build_relaxation_map,
8730 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8731 New method declarations.
8732 (Output_section::merge_section_map_
8733 Output_section::merge_section_by_properties_map_,
8734 Output_section::relaxed_input_section_map_,
8735 Output_section::is_relaxed_input_section_map_valid_,
8736 Output_section::generate_code_fills_at_write_): New data members.
8737 * script-sections.cc
8738 (Output_section_element_input::set_section_addresses): Call
8739 current_data_size and addralign methods of relaxed input sections.
8740 (Orphan_output_section::set_section_addresses): Call current_data_size
8741 and addralign methods of relaxed input sections.
8742 * symtab.cc (Symbol_table::compute_final_value): Extract template
8743 from the body of Symbol_table::sized_finalize_symbol.
8744 (Symbol_table::sized_finalized_symbol): Call
8745 Symbol_table::compute_final_value.
8746 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8747 (Symbol_table::compute_final_value): New templated method declaration.
8748 * target.cc (Target::do_make_output_section): New method defintion.
8749 * target.h (Target::make_output_section): New method declaration.
8750 (Target::relax): Add more parameters for input objects, symbol table
8751 and layout. Adjust call to do_relax.
8752 (Target::do_make_output_section): New method declaration.
8753 (Target::do_relax): Add parameters for input objects, symbol table
8754 and layout.
8755
8756 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8757
8758 * pread.c: Include stdio.h.
8759
8760 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8761
8762 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8763 defined.
8764
8765 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8766
8767 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8768 Change read_shndx type to unsigned int.
8769 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8770 int.
8771 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8772 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8773 Change read_shndx type to unsigned int.
8774 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8775 int.
8776 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8777 * layout.cc (Layout::create_symtab_sections): Cast the result of
8778 local_symcount * symsize to off_t in the gold_assert.
8779
8780 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8781
8782 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8783 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8784 R_ARM_BASE_ABS.
8785 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8786 (Arm_relocate_functions::thm_abs5): New function.
8787 (Arm_relocate_functions::abs12): New function.
8788 (Arm_relocate_functions::abs16): New function.
8789 (Arm_relocate_functions::base_abs): New function.
8790 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8791 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8792 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8793 R_ARM_BASE_ABS.
8794 (Scan::global): Likewise.
8795 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8796 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8797 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8798 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8799 R_ARM_BASE_ABS.
8800
8801 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8802
8803 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8804 (Arm_relocate_functions::movt_prel): New function.
8805 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8806 (Arm_relocate_functions::thm_movt_prel): New function.
8807 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8808 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8809 (Scan::global, Relocate::relocate): Likewise.
8810 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8811
8812 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8813
8814 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8815 Incremental_checker.
8816 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8817 unsigned int.
8818 (class Incremental_inputs_header): New class.
8819 (Incremental_inputs_header_writer): Edit comment.
8820 (Incremental_inputs_entry): New class.
8821 (Incremental_inputs_entry_writer): Edit comment.
8822 (Sized_incremental_binary::do_find_incremental_inputs_section):
8823 Add *strtab_shndx parameter, fill it.
8824 (Sized_incremental_binary::do_check_inputs): New method.
8825 (Incremental_checker::can_incrementally_link_output_file): Use
8826 Sized_incremental_binary::check_inputs.
8827 (Incremental_inputs::report_command_line): Save command line in
8828 command_line_.
8829 * incremental.h:
8830 (Incremental_binary::find_incremental_inputs_section): New
8831 method.
8832 (Incremental_binary::do_find_incremental_inputs_section): Add
8833 strtab_shndx parameter.
8834 (Incremental_binary::do_check_inputs): New pure virtual method.
8835 (Sized_incremental_binary::do_check_inputs): Declare.
8836 (Incremental_checker::Incremental_checker): Add incremental_inputs
8837 parameter, use it to initialize incremental_inputs_.
8838 (Incremental_checker::incremental_inputs_): New field.
8839 (Incremental_checker::command_line): New method.
8840 (Incremental_checker::inputs): New method.
8841 (Incremental_checker::command_line_): New field.
8842
8843 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8844
8845 * incremental.cc: Include <cstdarg> and "target-select.h".
8846 (vexplain_no_incremental): New function.
8847 (explain_no_incremental): New function.
8848 (Incremental_binary::error): New method.
8849 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8850 method.
8851 (make_sized_incremental_binary): New function.
8852 (open_incremental_binary): New function.
8853 (can_incrementally_link_file): Add checks if output is ELF and has
8854 inputs section.
8855 * incremental.h: Include "elfcpp_file.h" and "output.h".
8856 (Incremental_binary): New class.
8857 (Sized_incremental_binary): New class.
8858 (open_incremental_binary): Declare.
8859 * object.cc (is_elf_object): Use
8860 elfcpp::Elf_recognizer::is_elf_file.
8861 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8862 * output.h (Output_file::filesize): New method.
8863
8864 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8865
8866 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8867 New function.
8868 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8869 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8870 function.
8871 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8872 function.
8873 (Arm_relocate_functions::movw_abs_nc): New function.
8874 (Arm_relocate_functions::movt_abs): New function.
8875 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8876 (Arm_relocate_functions::thm_movt_abs): New function.
8877 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8878 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8879 (Scan::global): Likewise.
8880 (Relocate::relocate): Likewise.
8881 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8882
8883 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8884
8885 * arm.cc (Arm_relocate_functions::got_prel) New function.
8886 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8887 (Relocate::relocate): Likewise.
8888 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8889
8890 2009-10-06 Ian Lance Taylor <iant@google.com>
8891
8892 * options.h (class General_options): Define
8893 split_stack_adjust_size parameter.
8894 * object.h (class Object): Add uses_split_stack_ and
8895 has_no_split_stack_ fields. Add uses_split_stack and
8896 has_no_split_stack accessor functions. Declare
8897 handle_split_stack_section.
8898 (class Reloc_symbol_changes): Define.
8899 (class Sized_relobj): Define Function_offsets. Declare
8900 split_stack_adjust, split_stack_adjust_reltype, and
8901 find_functions.
8902 * object.cc (Object::handle_split_stack_section): New function.
8903 (Sized_relobj::do_layout): Call handle_split_stack_section.
8904 * dynobj.cc (Sized_dynobj::do_layout): Call
8905 handle_split_stack_section.
8906 * reloc.cc (Sized_relobj::relocate_sections): Call
8907 split_stack_adjust for executable sections in split_stack
8908 objects. Pass reloc_map to relocate_section.
8909 (Sized_relobj::split_stack_adjust): New function.
8910 (Sized_relobj::split_stack_adjust_reltype): New function.
8911 (Sized_relobj::find_functions): New function.
8912 * target-reloc.h: Include "object.h".
8913 (relocate_section): Add reloc_symbol_changes parameter. Change
8914 all callers.
8915 * target.h (class Target): Add calls_non_split method. Declare
8916 do_calls_non_split virtual method. Declare match_view and
8917 set_view_to_nop.
8918 * target.cc: Include "elfcpp.h".
8919 (Target::do_calls_non_split): New function.
8920 (Target::match_view): New function.
8921 (Target::set_view_to_nop): New function.
8922 * gold.cc (queue_middle_tasks): Give an error if mixing
8923 split-stack and non-split-stack objects with -r.
8924 * i386.cc (Target_i386::relocate_section): Add
8925 reloc_symbol_changes parameter.
8926 (Target_i386::do_calls_non_split): New function.
8927 * x86_64.cc (Target_x86_64::relocate_section): Add
8928 reloc_symbol_changes parameter.
8929 (Target_x86_64::do_calls_non_split): New function.
8930 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8931 parameter.
8932 * powerpc.cc (Target_powerpc::relocate_section): Add
8933 reloc_symbol_changes parameter.
8934 * sparc.cc (Target_sparc::relocate_section): Add
8935 reloc_symbol_changes parameter.
8936 * configure.ac: Call AM_CONDITIONAL for the default target.
8937 * configure: Rebuild.
8938 * testsuite/Makefile.am (TEST_AS): New variable.
8939 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8940 (check_DATA): Add split_i386 and split_x86_64 files.
8941 (SPLIT_DEFSYMS): Define.
8942 (split_i386_[1234n].o): New targets.
8943 (split_i386_[124]): New targets.
8944 (split_i386_[1234r].stdout): New targets.
8945 (split_x86_64_[1234n].o): New targets.
8946 (split_x86_64_[124]): New targets.
8947 (split_x86_64_[1234r].stdout): New targets.
8948 (MOSTLYCLEANFILES): Add new executables.
8949 * testsuite/split_i386.sh: New file.
8950 * testsuite/split_x86_64.sh: New file.
8951 * testsuite/split_i386_1.s: New file.
8952 * testsuite/split_i386_2.s: New file.
8953 * testsuite/split_i386_3.s: New file.
8954 * testsuite/split_i386_4.s: New file.
8955 * testsuite/split_i386_n.s: New file.
8956 * testsuite/split_x86_64_1.s: New file.
8957 * testsuite/split_x86_64_2.s: New file.
8958 * testsuite/split_x86_64_3.s: New file.
8959 * testsuite/split_x86_64_4.s: New file.
8960 * testsuite/split_x86_64_n.s: New file.
8961 * testsuite/testfile.cc (Target_test): Update relocation_section
8962 function.
8963 * testsuite/Makefile.in: Rebuild.
8964
8965 2009-10-06 Ian Lance Taylor <iant@google.com>
8966
8967 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8968 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8969 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8970 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8971 the address on ldo_addrs_.
8972 (Target_i386::Relocate::fix_up_ldo): New function.
8973
8974 2009-10-06 Rafael Espindola <espindola@google.com>
8975
8976 * plugin.cc (add_input_library): New.
8977 (Plugin::load): Add add_input_library to tv.
8978 (Plugin_manager::add_input_file): Add the is_lib argument.
8979 (add_input_file): Update call to Plugin_manager::add_input_file.
8980 (add_input_library): New.
8981 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8982
8983 2009-09-30 Doug Kwan <dougkwan@google.com>
8984
8985 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8986 symbol and call Symbol::may_need_copy_reloc to determine if
8987 a copy reloc is needed.
8988 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8989 nocopyreloc is given in command line.
8990 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8991 given in command line.
8992 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8993 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8994 of the removed Target_i386::may_need_copy_reloc.
8995 * options.h (copyreloc): New option with default value false.
8996 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8997 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8998 instead of the removed Target_powerpc::may_need_copy_reloc.
8999 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9000 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9001 instead of the removed Target_sparc::may_need_copy_reloc.
9002 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9003 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9004 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9005 instead of the removed Target_x86_64::may_need_copy_reloc.
9006
9007 2009-09-30 Ian Lance Taylor <iant@google.com>
9008
9009 * object.h (class Object): Remove target_ field, and target,
9010 sized_target, and set_target methods.
9011 (Object::sized_target): Remove.
9012 (class Sized_relobj): Update declarations. Remove sized_target.
9013 * object.cc (Sized_relobj::setup): Remove target parameter.
9014 Change all callers.
9015 (Input_objects::add_object): Don't do anything with the target.
9016 (make_elf_sized_object): Add punconfigured parameter. Change all
9017 callers. Set or test parameter target.
9018 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9019 Change all callers.
9020 * parameters.cc (Parameters::set_target): Change parameter type to
9021 be non-const.
9022 (Parameters::default_target): Remove.
9023 (set_parameters_target): Change parameter type to be non-const.
9024 (parameters_force_valid_target): New function.
9025 (parameters_clear_target): New function.
9026 * parameters.h (class Parameters): Update declarations. Remove
9027 default_target method. Add sized_target and clear_target
9028 methods. Change target_ to be non-const.
9029 (set_parameters_target): Update declaration.
9030 (parameters_force_valid_target): Declare.
9031 (parameters_clear_target): Declare.
9032 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9033 as NULL if we aren't searching.
9034 (Add_symbols::run): Don't check for compatible target.
9035 * fileread.cc (Input_file::open_binary): Call
9036 parameters_force_valid_target.
9037 * gold.cc (queue_middle_tasks): Likewise.
9038 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9039 set_target on object.
9040 * dynobj.h (class Sized_dynobj): Update declarations.
9041 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9042 make_elf_object returns NULL.
9043 (Archive::include_member): Don't check whether object target is
9044 compatible.
9045 * output.cc (Output_section::add_input_section): Get target from
9046 parameters.
9047 (Output_section::relax_input_section): Likewise.
9048 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9049 parameters.
9050 (Sized_relobj::do_scan_relocs): Likewise.
9051 (Sized_relobj::relocate_sections): Likewise.
9052 * resolve.cc (Symbol_table::resolve): Likewise.
9053 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9054 parameter. Change all callers.
9055 (Symbol_table::add_from_object): Get target from parameters.
9056 (Symbol_table::add_from_relobj): Don't check object target.
9057 (Symbol_table::add_from_dynobj): Likewise.
9058 (Symbol_table::define_special_symbol): Get target from
9059 parameters.
9060 * symtab.h (class Symbol_table): Update declaration.
9061 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9062 parameter. Change all callers. Clear parameter target.
9063 (Binary_test): Test target here.
9064 * testsuite/object_unittest.cc (gold_testsuite): Remove
9065 target_test_pointer parameter. Change all callers.
9066 (Object_test): Test target here.
9067
9068 2009-09-26 Ian Lance Taylor <iant@google.com>
9069
9070 * testsuite/initpri1.c: Don't try to use constructor priorities if
9071 compiling with gcc before 4.3.
9072
9073 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9074
9075 * testsuite/retain_symbols_file_test.sh (check_present): Change
9076 output file name to retain_symbols_file_test.stdout.
9077 (check_absent): Likewise.
9078
9079 2009-09-18 Craig Silverstein <csilvers@google.com>
9080
9081 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9082 * options.cc: Include <cerrno> and <fstream>.
9083 (General_options::finalize): Parse -retain-symbols-file tag.
9084 * options.h: New flag.
9085 (General_options): New method should_retain_symbol, new
9086 variable symbols_to_retain.
9087 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9088 should_retain_symbol map.
9089 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9090 * testsuite/Makefile.in: Regenerate.
9091 * testsuite/retain_symbols_file_test.sh: New file.
9092
9093 2009-09-18 Nick Clifton <nickc@redhat.com>
9094
9095 * po/es.po: Updated Spanish translation.
9096
9097 2009-09-17 Doug Kwan <dougkwan@google.com>
9098
9099 * debug.h (DEBUG_RELAXATION): New constant.
9100 (DEBUG_ALL): Add DEBUG_RELAXATION.
9101 (debug_string_to_enum): Add relaxation debug option.
9102 * layout.cc
9103 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9104 Layout::Relaxation_debug_check::read_sections,
9105 Layout::Relaxation_debug_check::read_sections): New method definitions.
9106 (Layout::Layout): Initialize data members
9107 record_output_section_data_from_scrips_,
9108 script_output_section_data_list_ and relaxation_debug_check_.
9109 (Layout::save_segments, Layout::restore_segments,
9110 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9111 Layout::relaxation_loop_body): New method definitions.
9112 (Layout::finalize): Support relaxation. Move section layout code to
9113 Layout::relaxation_loop_body.
9114 (Layout::set_asection_address_from_script): Move code for orphan
9115 section placement out.
9116 (Layout::place_orphan_sections_in_script): New method definition.
9117 * layout.h (Output_segment_headers, Output_file_header):
9118 New forward class declarations.
9119 (Layout::~Layout): Define.
9120 (Layout::new_output_section_data_from_script): New method definition.
9121 (Layout::place_orphan_sections_in_script): New method declaration.
9122 (Layout::Segment_states): New type declaration.
9123 (Layout::save_segments, Layout::restore_segments,
9124 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9125 Layout::relaxation_loop_body): New method declarations.
9126 (Layout::Output_section_data_list): New type declaration.
9127 (Layout::Relaxation_debug_check): New class definition.
9128 (Layout::record_output_section_data_from_script_,
9129 Layout::script_output_section_data_list_, Layout::segment_states_,
9130 Layout::relaxation_debug_check_): New data members.
9131 * output.cc: (Output_section_headers::do_size): New method definition.
9132 (Output_section_headers::Output_section_headers): Move size
9133 computation to Output_section_headers::do_size.
9134 (Output_segment_headers::do_size): New method definition.
9135 (Output_file_header::Output_file_header): Move size computation to
9136 Output_file_header::do_size and call it.
9137 (Output_file_header::do_size): New method definition.
9138 (Output_data_group::Output_data_group): Adjust call to
9139 Output_section_data.
9140 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9141 (Output_symtab_xindex::do_write): Add array bound check.
9142 (Output_section::Input_section::print_to_mapfile): Handle
9143 RELAXED_INPUT_SECTION_CODE.
9144 (Output_section::Output_section): Initialize data member checkpoint_.
9145 (Output_section::~Output_section): Delete checkpoint object pointed
9146 by checkpoint_.
9147 (Output_section::add_input_section): Always add an Input_section if
9148 relaxing.
9149 (Output_section::add_merge_input_section): Add assert.
9150 (Output_section::relax_input_section): New method definition.
9151 (Output_section::set_final_data_size): Set load address to zero for
9152 an unallocated section.
9153 (Output_section::do_address_and_file_offset_have_reset_values):
9154 New method definition.
9155 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9156 Handle relaxed input section.
9157 (Output_section::sort_attached_input_sections): Checkpoint input
9158 section list lazily.
9159 (Output_section::get_input_sections): Change type of input_sections to
9160 list of Simple_input_section pointers. Checkpoint input section list
9161 lazily. Also handle relaxed input sections.
9162 (Output_section::add_input_section_for_script): Take a reference to
9163 a Simple_input_section object instead of Relobj pointer and section
9164 index as parameter. Handle relaxed input sections.
9165 (Output_section::save_states, Output_section::restore_states): New
9166 method definitions.
9167 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9168 (Output_data::is_data_size_fixed): New method definition.
9169 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9170 if it is fixed.
9171 (Output_data::address_and_file_offset_have_reset_values): New method
9172 definition.
9173 (Output_data::do_address_and_file_offset_have_reset_values): New method
9174 definition.
9175 (Output_data::set_data_size): Check that data size is not fixed.
9176 (Output_data::fix_data_size): New method definition.
9177 (Output_data::is_data_size_fixed_): New data member.
9178 (Output_section_headers::set_final_data_size): New method definition.
9179 (Output_section_headers::do_size): New method declaration.
9180 (Output_segment_headers::set_final_data_size): New method definition.
9181 (Output_segment_headers::do_size): New method declaration.
9182 (Output_file_header::set_final_data_size)::New method definition.
9183 (Output_file_header::do_size)::New method declaration.
9184 (Output_section_data::Output_section_data): Add new parameter
9185 is_data_size_fixed and use it to fix data size.
9186 (Output_data_const::Output_data_const): Adjust call to base class
9187 constructor and fix data size.
9188 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9189 base class constructor and fix data size.
9190 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9191 base class constructor and fix data size.
9192 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9193 class constructor and fix data size.
9194 (Output_data_group::set_final_data_size): New method definition.
9195 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9196 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9197 class constructor and fix data size.
9198 (Output_relaxed_input_section): New class definition.
9199 (Output_section::Simple_input_section): New class definition.
9200 (Output_section::get_input_sections): Adjust parameter list.
9201 (Output_section::add_input_section_for_script): Same.
9202 (Output_section::save_states, Output_section::restore_states,
9203 Output_section::do_address_and_file_offset_have_reset_values,
9204 (Output_section::Input_section::Input_section): Handle
9205 RELAXED_INPUT_SECTION_CODE. Add new overload for
9206 Output_relaxed_input_section.
9207 (Output_section::Input_section::is_input_section,
9208 Output_section::Input_section::set_output_section): Handle relaxed
9209 input section.
9210 (Output_section::Input_section::is_relaxed_input_section,
9211 Output_section::Input_section::output_section_data,
9212 Output_section::Input_section::relaxed_input_section): New method
9213 definitions.
9214 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9215 value.
9216 (Output_section::Input_section::u1_): Update comments.
9217 (Output_section::Input_section::u2_): Add new union member poris.
9218 (Output_section::Checkpoint_output_section): New classs definition.
9219 (Output_section::relax_input_section): New method declaration.
9220 (Output_section::checkpoint_): New data member.
9221 (Output_segment): Update comments.
9222 (Output_segment::Output_segment): Un-privatize copy constructor.
9223 (Output_segment::operator=): Un-privatize.
9224 * script-sections.cc (Output_section_element::Input_section_list):
9225 Change element type to Output_section::Simple_input_section.
9226 (Output_section_element_dot_assignment::set_section_addresses):
9227 Register output section data for relaxation clean up.
9228 (Output_data_exression::Output_data_expression): Adjust call to base
9229 constructor to fix data size.
9230 (Output_section_element_data::set_section_addresses): Register
9231 Output_data_expression object for relaxation clean up.
9232 (struct Input_section_info): Replace Relobj pointer and section index
9233 pair with Output_section::Simple_input_section and Convert struct to a
9234 class.
9235 (Input_section_sorter::operator()): Adjust access to
9236 Input_section_info data member to use accessors.
9237 (Output_section_element_input::set_section_addresses): Use layout
9238 parameter. Adjust code to use Output_section::Simple_input_section
9239 and Input_secction_info classes. Register filler for relaxation
9240 clean up.
9241 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9242 and section index pair with Output_section::Simple_input_section
9243 class. Adjust code accordingly.
9244 (Phdrs_element::release_segment): New method definition.
9245 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9246 segment list.
9247 (Script_sections::release_segments): New method definition.
9248 * gold/script-sections.h (Script_sections::release_segments): New
9249 method declaration.
9250 * gold/target.h (Target::may_relax, Target::relax,
9251 Target::do_may_relax, Target::do_relax): New method definitions.
9252
9253 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9254
9255 * arm.cc (has_signed_unsigned_overflow): New function.
9256 (Arm_relocate_functions::abs8): New function.
9257 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9258 (Target_arm::Scan::global): Likewise.
9259 (Target_arm::relocate::relocate): Likewise.
9260 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9261 Likewise.
9262
9263 2009-09-16 Cary Coutant <ccoutant@google.com>
9264
9265 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9266 * testsuite/Makefile.in: Regenerate.
9267
9268 2009-09-11 Nick Clifton <nickc@redhat.com>
9269
9270 * po/gold.pot: Updated by the Translation project.
9271
9272 2009-09-08 Cary Coutant <ccoutant@google.com>
9273
9274 * output.cc (Output_file::open): Add execute permission to empty file.
9275 * testsuite/Makefile.am (permission_test): New test.
9276 * testsuite/Makefile.in: Regenerate.
9277
9278 2009-09-02 Ian Lance Taylor <iant@google.com>
9279
9280 * output.cc (Output_file::resize): Call map_no_anonymous rather
9281 than map.
9282
9283 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9284
9285 * gold.cc: Include "incremental.h".
9286 (queue_initial_tasks): Call Incremental_checker methods.
9287 * incremental.cc: Include "output.h".
9288 (Incremental_checker::can_incrementally_link_output_file): New
9289 method.
9290 * incremental.h (Incremental_checker): New class.
9291
9292 * output.cc (Output_file::open_for_modification): New method.
9293 (Output_file::map_anonymous): Changed return type to bool. Record
9294 map in base_ field.
9295 (Output_file::map_no_anonymous): New method, broken out of map.
9296 (Output_file::map): Use map_no_anonymous and map_anonymous.
9297 * output.h (class Output_file): Update declarations.
9298
9299 2009-08-24 Cary Coutant <ccoutant@google.com>
9300
9301 * options.h (Command_line::Pre_options): New class.
9302 (Command_line::pre_options): New member.
9303 * options.cc (gold::options::ready_to_register): New variable.
9304 (One_option::register_option): Do nothing if not registering options.
9305 Assert if same short option registered twice.
9306 (General_options::General_options): Turn off option registration when
9307 done constructing.
9308 (Command_line::Pre_options::Pre_options): New constructor.
9309
9310 2009-08-24 Cary Coutant <ccoutant@google.com>
9311
9312 * options.h (General_options::no_keep_memory): Remove incorrect
9313 short option.
9314
9315 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9316
9317 * Makefile.am (am__skiplex, am__skipyacc): New.
9318 * Makefile.in: Regenerate.
9319
9320 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9321
9322 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9323 (INCLUDES): ... this.
9324 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9325 (AM_CPPFLAGS): Renamed from ...
9326 (INCLUDE): ... this.
9327 * Makefile.in, testsuite/Makefile.in: Regenerate.
9328
9329 * Makefile.in: Regenerate.
9330 * aclocal.m4: Likewise.
9331 * config.in: Likewise.
9332 * configure: Likewise.
9333 * testsuite/Makefile.in: Likewise.
9334
9335 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9336 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9337 * Makefile.in: Regenerate.
9338 * testsuite/Makefile.in: Regenerate.
9339
9340 2009-08-19 Cary Coutant <ccoutant@google.com>
9341
9342 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9343 symbols in shared libraries overridden by hidden or internal symbols
9344 in the main program.
9345
9346 2009-08-19 Chris Demetriou <cgd@google.com>
9347
9348 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9349 checking source file names in error messages.
9350
9351 2009-08-18 Doug Kwan <dougkwan@google.com>
9352
9353 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9354 an elcpp::Ehdr as parameter. Adjust call to set_target.
9355 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9356 an elfcpp::Ehdr as parameter.
9357 * object.cc (Object::set_target): Remove the version that looks up
9358 a target and sets it.
9359 (Sized_relobj::setup): Take a Target object instead of
9360 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9361 (make_elf_sized_object): Find target and ask target to
9362 make an ELF object.
9363 * object.h: (Object::set_target): Remove the version that looks up
9364 a target and sets it.
9365 (Sized_relobj::setup): Take a Target object instead of
9366 an elfcpp:Ehdr as parameter.
9367 * target.cc: Include dynobj.h.
9368 (Target::do_make_elf_object_implementation): New.
9369 (Target::do_make_elf_object): New.
9370 * target.h (Target::make_elf_object): New template declaration.
9371 (Target::do_make_elf_object): New method declarations.
9372 (Target::do_make_elf_object_implementation): New template declaration.
9373
9374 2009-08-14 Ian Lance Taylor <iant@google.com>
9375
9376 * gold.h (FUNCTION_NAME): Define.
9377 (gold_unreachable): Use FUNCTION_NAME.
9378
9379 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9380
9381 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9382 symbol in the --keep-unique list is not found.
9383
9384 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9385
9386 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9387 been maked as --keep-unique.
9388 (Icf::unfold_section): New function.
9389 * icf.h (Icf::unfold_section): New function.
9390 * options.h (General_options::keep_unique): New option.
9391 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9392 * testsuite/Makefile.in: Regenerate.
9393 * testsuite/icf_keep_unique_test.sh: New file.
9394 * testsuite/icf_keep_unique_test.cc: New file.
9395
9396 2009-08-12 Cary Coutant <ccoutant@google.com>
9397
9398 PR 10471
9399 * resolve.cc (Symbol_table::resolve): Check for references from
9400 dynamic objects to hidden and internal symbols.
9401 * testsuite/Makefile.am (hidden_test.sh): New test.
9402 * testsuite/Makefile.in: Regenerate.
9403 * testsuite/hidden_test.sh: New script.
9404 * testsuite/hidden_test_1.c: New test source.
9405 * testsuite/hidden_test_main.c: New test source.
9406
9407 2009-08-11 Doug Kwan <dougkwan@google.com>
9408
9409 * arm.cc: Update comments.
9410 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9411 segment to locate the .ARM.exidx section if present.
9412
9413 2009-08-09 Doug Kwan <dougkwan@google.com>
9414
9415 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9416 patch.
9417
9418 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9419 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9420 compiler warnings.
9421
9422 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9423
9424 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9425 valid tls_segment only for non-debug-section relocations.
9426 * testsuite/Makefile.am: Add gc_tls_test.
9427 * testsuite/Makefile.in: Regenerate.
9428 * testsuite/gc_tls_test.cc: New file.
9429 * testsuite/gc_tls_test.sh: New file.
9430
9431 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9432
9433 * icf.cc: New file.
9434 * icf.h: New file.
9435 * Makefile.am (CCFILES): Add icf.cc.
9436 (HFILES): Add icf.h
9437 * Makefile.in: Regenerate.
9438 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9439 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9440 section, symbol and addend information for the relocs.
9441 * gold.cc (queue_middle_tasks): Call identical code folding.
9442 * gold.h: Add defines for multimap.
9443 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9444 to the call of finalize_local_symbols.
9445 * main.cc (main): Create object of class Icf.
9446 * object.cc (Sized_relobj::do_layout): Allow this function to be
9447 called twice during icf.
9448 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9449 to sections marked as identical by icf.
9450 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9451 when available.
9452 (Sized_relobj::do_section_entsize): New function.
9453 * object.h (Object::section_entsize): New function.
9454 (Object::do_section_entsize): New pure virtual function.
9455 (Relobj::finalize_local_symbols): Add new parameter.
9456 (Relobj::do_section_entsize): New function.
9457 * options.h (General_options::icf): New option.
9458 (General_options::icf_iterations): New option.
9459 (General_options::print_icf_sections): New option.
9460 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9461 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9462 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9463 icf.
9464 * symtab.cc (Symbol_table::is_section_folded): New function.
9465 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9466 to sections marked as identical by icf.
9467 * symtab.h (Symbol_table::set_icf): New function.
9468 (Symbol_table::icf): New function.
9469 (Symbol_table::is_section_folded): New function.
9470 (Symbol_table::icf_): New data member.
9471 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9472 * testsuite/Makefile.am: Add commands to build icf_test.
9473 * testsuite/Makefile.in: Regenerate.
9474 * testsuite/icf_test.sh: New file.
9475 * testsuite/icf_test.cc: New file.
9476
9477 2009-07-24 Chris Demetriou <cgd@google.com>
9478
9479 * layout.cc (is_compressible_debug_section): Fix incorrect
9480 comment about compressed section names.
9481
9482 2009-07-20 Ian Lance Taylor <ian@airs.com>
9483
9484 PR 10419
9485 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9486
9487 2009-07-16 Ian Lance Taylor <iant@google.com>
9488
9489 PR 10400
9490 * layout.h: #include <map>.
9491 (class Kept_section): Change from struct to class. Add accessors
9492 and setters. Add section size to Comdat_group mapping. Change
9493 Comdat_group to std::map. Add is_comdat_ field. Add
9494 linkonce_size field in union.
9495 (class Layout): Update declaration of find_or_add_kept_section.
9496 Don't declare find_kept_object.
9497 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9498 parameter. Add object, shndx, is_comdat, and is_group_name
9499 parameters. Change all callers. Adjust for new Kept_section.
9500 (Layout::find_kept_object): Remove.
9501 * object.cc (Sized_relobj::include_section_group): Update use of
9502 Kept_section. Rename secnum to shndx. Only record
9503 Kept_comdat_section if sections are the same size.
9504 (Sized_relobj::include_linkonce_section): Update use of
9505 Kept_section. Only record Kept_comdat_section if sections are the
9506 same size. Set size of linkonce section.
9507 (Sized_relobj::map_to_kept_section): Update call to
9508 get_kept_comdat_section.
9509 * object.h (class Sized_relobj): Rename fields in
9510 Kept_comdat_section to drop trailing underscores; change object
9511 field to Relobj*. Change Kept_comdat_section_table to store
9512 struct rather than pointer.
9513 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9514 Add kept_object and kept_shndx parameters. Change all callers.
9515 (Sized_relobj::get_kept_comdat_section): Change return type to
9516 bool. Add kept_object and kept_shndx parameters. Change all
9517 callers.
9518 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9519 Layout::find_or_add_kept_section.
9520
9521 2009-07-09 Ian Lance Taylor <iant@google.com>
9522
9523 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9524 Reserve space in the hash table.
9525
9526 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9527
9528 * fileread.cc (File_read::get_mtime): New method.
9529 * fileread.h (Timespec): New structure.
9530 (File_read::get_mtime): New method.
9531 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9532 Renamed from timestamp_nsec.
9533 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9534 Elf_Xword.
9535 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9536 timestamp_nsec.
9537 (Incremental_inputs::report_archive): Save mtime; style fix.
9538 (Incremental_inputs::report_obejct): Save mtime; style fix.
9539 (Incremental_inputs::report_script): Save mtime; style fix.
9540 (Incremental_inputs::finalize_inputs): Style fix.
9541 (Incremental_inputs::finalize): Style fix.
9542 (Incremental_inputs::create_input_section_data): Store inputs
9543 mtime.
9544 * incremental.h (Incremental_inputs::report_script): Add mtime
9545 argument.
9546 (Incremental_inputs::Input_info::Input_info): Intialize only one
9547 union member.
9548 (Incremental_inputs::Input_info::archive): Move to nameless
9549 union.
9550 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9551 (Incremental_inputs::Input_info::script): Move to nameless union.
9552 (Incremental_inputs::mtime): New field.
9553 * script.cc (read_input_script): Pass file mtime to
9554 Incremental_input.
9555 * script.h (Script_info::inputs): Style fix.
9556
9557 2009-07-01 Ian Lance Taylor <ian@airs.com>
9558
9559 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9560 instead of 32.
9561
9562 2009-06-24 Ian Lance Taylor <iant@google.com>
9563
9564 PR 10156
9565 * layout.cc (Layout::choose_output_section): If we find an
9566 existing section, update the flags.
9567 (Layout::create_notes): New function, broken out of
9568 Layout::finalize.
9569 (Layout::finalize): Don't create note sections.
9570 (Layout::create_note): Don't crash if linker script discards
9571 section.
9572 (Layout::create_gold_note): Likewise.
9573 (Layout::create_build_id): Likewise. Don't set
9574 after_input_sections on the section.
9575 (Layout::create_executable_stack_info): Remove target parameter.
9576 Change caller.
9577 * layout.h (class Layout): Declare create_notes. Update
9578 declaration of create_executable_stack_info.
9579 * gold.cc (queue_middle_tasks): Call create_notes.
9580 * output.cc (Output_section::update_flags_for_input_section): Move
9581 here from output.h. If SHF_ALLOC flag is newly set, mark address
9582 invalid.
9583 * output.h (Output_data::mark_address_invalid): New function.
9584 (class Output_section): Only declare, not define,
9585 update_flags_for_input_section. Remove set_flags.
9586
9587 2009-06-24 Ian Lance Taylor <iant@google.com>
9588
9589 * script-sections.cc (Output_section_definition::
9590 set_section_addresses): Rename shadowing local load_address to
9591 laddr.
9592
9593 2009-06-24 Ian Lance Taylor <iant@google.com>
9594
9595 PR 10244
9596 * reloc.cc (relocate_sections): Skip empty relocation sections.
9597
9598 2009-06-23 Ian Lance Taylor <iant@google.com>
9599
9600 PR 10156
9601 * layout.cc (Layout::create_note): Use choose_output_section
9602 rather than make_output_section.
9603
9604 2009-06-23 Ian Lance Taylor <iant@google.com>
9605
9606 PR 10237
9607 * options.cc (General_options::parse_V): Set printed_version_.
9608 (General_options::General_options): Initialize printed_version_.
9609 * options.h (class General_options): Add printed_version_ field.
9610 * gold.cc (queue_initial_tasks): If there are no input files,
9611 don't give a fatal error if we printed the version information.
9612 (queue_middle_tasks): If using -r with a shared object, give a
9613 fatal error rather than an ordinary error.
9614
9615 2009-06-23 Ian Lance Taylor <iant@google.com>
9616
9617 PR 10219
9618 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9619 (Layout::make_output_section): Set have_stabstr_section_ if we see
9620 a .stab*str section.
9621 (Layout::finalize): Call link_stabs_sections.
9622 (Layout::link_stabs_sections): New file.
9623 * layout.h (class Layout): Add have_stabstr_section_ field.
9624 Declare link_stabs_sections.
9625
9626 2009-06-23 Doug Kwan <dougkwan@google.com>
9627
9628 * Makefile.am (libgold_a_LIBADD): New.
9629 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9630 * Makefile.in: Regenerate.
9631 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9632 * configure: Regenerate.
9633 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9634 * fileread.cc: Include sys/state.h
9635 * gold.h: Declare memmem and strndup if found missing.
9636 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9637
9638 2009-06-23 Ian Lance Taylor <iant@google.com>
9639
9640 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9641 * configure: Rebuild.
9642
9643 2009-06-23 Ian Lance Taylor <iant@google.com>
9644
9645 PR 10147
9646 * object.cc (Object::section_contents): Don't try to get a view if
9647 the section has length zero.
9648 (Object::handle_gnu_warning_section): If the section is empty, use
9649 the name of the section as the warning.
9650
9651 2009-06-23 Ian Lance Taylor <iant@google.com>
9652
9653 PR 10133
9654 * stringpool.h (class Stringpool_template): Add optimize_ field.
9655 (Stringpool_template::set_optimize): New function.
9656 * stringpool.cc (Stringpool_template::Stringpool_template):
9657 Initialize optimize_ field.
9658 (Stringpool_template::set_string_offsets): Test local optimize
9659 fild rather than parameter.
9660 * layout.cc (Layout::Layout): Call set_optimize on the section
9661 name stringpool.
9662
9663 2009-06-22 Ian Lance Taylor <iant@google.com>
9664
9665 PR 10030
9666 * yyscript.y: Parse TARGET.
9667 * script.cc (script_set_target): New function.
9668 * script-c.h (script_set_target): Declare.
9669 * options.cc (General_options::string_to_object_format): Rename
9670 from string_to_object_format in anonymous namespace. Change
9671 callers.
9672 * options.h (class General_options): Declare
9673 string_to_object_format.
9674
9675 2009-06-22 Ian Lance Taylor <iant@google.com>
9676
9677 * script-sections.cc (Script_sections::create_segments): Don't put
9678 program headers in a PT_LOAD segment if -n or -N.
9679
9680 2009-06-22 Ian Lance Taylor <iant@google.com>
9681
9682 PR 10141
9683 * options.h (class General_options): Add -z lazy and -z now. Sort
9684 -z options into alphabetical order.
9685 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9686
9687 2009-06-21 Ian Lance Taylor <iant@google.com>
9688
9689 * layout.cc (Layout::make_output_section): Call
9690 Target::new_output_section.
9691 (Layout::attach_allocated_section_to_segment): Put large section
9692 sections in a separate load segment with the large segment flag
9693 set.
9694 (Layout::segment_precedes): Sort large data segments after other
9695 load segments.
9696 (align_file_offset): New static function.
9697 (Layout::set_segment_offsets): Use align_file_offset.
9698 * output.h (class Output_section): Add is_small_section_ and
9699 is_large_section_ fields.
9700 (Output_section::is_small_section): New function.
9701 (Output_section::set_is_small_section): New function.
9702 (Output_section::is_large_section): New function.
9703 (Output_section::set_is_large_section): New function.
9704 (Output_section::is_large_data_section): New function.
9705 (class Output_segment): Add is_large_data_segment_ field.
9706 (Output_segment::is_large_data_segment): New function.
9707 (Output_segment::set_is_large_data_segment): New function.
9708 * output.cc (Output_section::Output_section): Initialize new
9709 fields.
9710 (Output_segment::Output_segment): Likewise.
9711 (Output_segment::add_output_section): Add assertion that large
9712 data sections always go in large data segments. Force small data
9713 sections to the end of the list of data sections. Force small BSS
9714 sections to the start of the list of BSS sections. For large BSS
9715 sections to the end of the list of BSS sections.
9716 * symtab.h (class Symbol): Declare is_common_shndx.
9717 (Symbol::is_defined): Check Symbol::is_common_shndx.
9718 (Symbol::is_common): Likewise.
9719 (class Symbol_table): Define enum Commons_section_type. Update
9720 declarations. Add small_commons_ and large_commons_ fields.
9721 * symtab.cc (Symbol::is_common_shndx): New function.
9722 (Symbol_table::Symbol_table): Initialize new fields.
9723 (Symbol_table::add_from_object): Put small and large common
9724 symbols in the right list.
9725 (Symbol_table::sized_finalized_symbol): Check
9726 Symbol::is_common_shndx.
9727 (Symbol_table::sized_write_globals): Likewise.
9728 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9729 common symbol lists. Don't call do_allocate_commons_list if the
9730 list is empty.
9731 (Symbol_table::do_allocate_commons_list): Remove is_tls
9732 parameter. Add comons_section_type parameter. Change all
9733 callers. Handle small and large common symbols.
9734 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9735 Symbol::is_common_shndx.
9736 * resolve.cc (symbol_to_bits): Likewise.
9737 * target.h (Target::small_common_shndx): New function.
9738 (Target::small_common_section_flags): New function.
9739 (Target::large_common_shndx): New function.
9740 (Target::large_common_section_flags): New function.
9741 (Target::new_output_section): New function.
9742 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9743 small_common_section_flags, and large_common_section_flags
9744 fields.
9745 (Target::do_new_output_section): New virtual function.
9746 * arm.cc (Target_arm::arm_info): Initialize new fields.
9747 * i386.cc (Target_i386::i386_info): Likewise.
9748 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9749 Likewise.
9750 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9751 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9752 (Target_x86_64::do_new_output_section): New function.
9753 * configure.ac: Define conditional MCMODEL_MEDIUM.
9754 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9755 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9756 (large_LDFLAGS): Define.
9757 * testsuite/large.c: New file.
9758 * testsuite/testfile.cc (Target_test::test_target_info):
9759 Initialize new fields.
9760 * configure, testsuite/Makefile.in: Rebuild.
9761
9762 2009-06-05 Doug Kwan <dougkwan@google.com>
9763
9764 * Makefile.am (CCFILES): Add target.cc.
9765 * Makefile.in: Regenerate.
9766 * i386.cc (class Target_i386): Define new virtual method to
9767 override do_is_local_label_name in parent.
9768 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9769 local symbols if --discard-locals or -X is given.
9770 * options.h (class General_options): Declare new options
9771 '--discard-locals' and '-X' for discarding locals.
9772 * target.h (class Target): Define new methods is_local_label_name.
9773 Declare new virtual method do_is_local_label_name.
9774 * target.cc: New file.
9775 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9776 (check_SCRIPTS): Add discard_locals_test.sh.
9777 (check_DATA): Add discard_local_tests.syms.
9778 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9779 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9780 * testsuite/Makefile.in: Regenerate.
9781 * testsuite/discard_locals_test.c: New file.
9782 * testsuite/discard_locals_test.sh: Same.
9783
9784 2009-06-05 Doug Kwan <dougkwan@google.com>
9785
9786 * object.cc (Sized_relobj::Sized_relobj): Initialize
9787 discarded_eh_frame_shndx_ to -1U.
9788 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9789 section.
9790 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9791 a discarded .eh_frame section.
9792 (Sized_relobj::do_finalize_local_symbols): Ditto.
9793 * object.h (class Sized_relobj): Declare new member
9794 discarded_eh_frame_shndx_.
9795 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9796 (local_labels_test.o, local_labels_test): New rules.
9797 * testsuite/Makefile.in: Regenerate.
9798
9799 2009-06-04 Doug Kwan <dougkwan@google.com>
9800
9801 * layout.cc (Layout::section_name_mapping): Add mapping for
9802 special ARM sections.
9803
9804 2009-06-03 Doug Kwan <dougkwan@google.com>
9805
9806 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9807 (utils::has_overflow): Same.
9808
9809 2009-06-03 Ian Lance Taylor <iant@google.com>
9810
9811 * layout.cc (Layout::section_name_mapping): New array, replacing
9812 Layout::linkonce_mapping.
9813 (Layout::section_name_mapping_count): New variable, replacing
9814 Layout::linkonce_mapping_count.
9815 (Layout::linkonce_output_name): Remove.
9816 (Layout::output_section_name): Rewrite.
9817 * layout.h (class Layout): Rename Linkonce_mapping to
9818 Section_name_mapping, linkonce_mapping to section_name_mapping,
9819 linkonce_mapping_count to section_name_mapping_count. Don't
9820 declare linkonce_output_name.
9821
9822 2009-06-03 Doug Kwan <dougkwan@google.com>
9823
9824 * gold/arm.cc (namespace utils): New.
9825 (Target_arm::reloc_is_non_pic): Define new method.
9826 (class Arm_relocate_functions): New.
9827 (Target_arm::Relocate::relocate): Handle relocation types used by
9828 Android.
9829
9830 2009-06-03 Ian Lance Taylor <iant@google.com>
9831
9832 * arm.cc (Target_arm::scan::global): Use || instead of |.
9833
9834 2009-06-02 Doug Kwan <dougkwan@google.com>
9835
9836 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9837 issued_non_pic_error_.
9838 (class Target_arm::Scan): Declare new method check_non_pic.
9839 Define new method symbol_needs_plt_entry.
9840 Declare new data member issued_non_pic_error_.
9841 (class Target_arm::Relocate): Declare new method
9842 should_apply_static_reloc.
9843 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9844 (Target_arm::Scan::check_non_pic): Define new method.
9845 (Target_arm::Scan::local): Handle a small subset of reloc types used
9846 by Android.
9847 (Target_arm::Scan::local): Same.
9848 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9849
9850 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9851
9852 * incremental.cc (Incremental_inputs::report_command_line): Filter
9853 out --incremental-* options.
9854
9855 2009-05-29 Doug Kwan <dougkwan@google.com>
9856
9857 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9858 template class.
9859 (class Target_arm): Update comment.
9860 (Target_arm::Target_arm): Initialize new data members GOT_,
9861 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9862 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9863 and Target_arm::rel_dyn_section.
9864 Declare new_enum Target_arm::Got_type.
9865 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9866 and DYNBSS_.
9867 Update commments for member do_dynsym_value.
9868 (Target_arm::got_size, Target_arm::plt_section,
9869 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9870 new methods inside class defintion.
9871 (Target_arm::got_section): Define new method.
9872 (Target_arm::rel_dyn_section): Same.
9873 (Output_data_plt_arm): New template class.
9874 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9875 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9876 (Output_data_plt_arm::add_entry): Same.
9877 (Output_data_plt_arm::first_plt_entry): Define new
9878 static data member for PLT instruction template.
9879 (Output_data_plt_arm::plt_entry): Same.
9880 (Output_data_plt_arm::do_write): Define new method.
9881 (Target_arm::make_plt_entry): Same.
9882 (Target_arm::do_finalize_sections): Same.
9883 (Target_arm::do_dynsym_value): Same.
9884
9885 2009-05-28 Doug Kwan <dougkwan@google.com>
9886
9887 * Makefile.am (TARGETSOURCES): Add arm.cc.
9888 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9889 * Makefile.in: Regenerate.
9890 * arm.cc: New file.
9891 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9892
9893 2009-05-26 Doug Kwan <dougkwan@google.com>
9894
9895 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9896 (General_options::check_excluded_libs): Strip off directories in
9897 archive name before matching like GNU ld does.
9898 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9899 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9900 (exclude_libs_test_LDFLAGS): Add linker option
9901 -Wl,--exclude-libs,libexclude_libs_test_3
9902 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9903 an explicit archive without using -l.
9904 (alt/libexclude_libs_test_3.a): New make rule.
9905 * testsuite/Makefile.in: Regenerate.
9906 * testsuite/exclude_libs_test.c : Declare lib3_default().
9907 (main): Call it.
9908 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9909 * exclude_libs_test_3.c: New file.
9910
9911 2009-05-26 Nick Clifton <nickc@redhat.com>
9912
9913 * po/id.po: New Indonesian translation.
9914 * po/gold.pot: Updated template file.
9915
9916 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9917
9918 * testsuite/Makefile.am: Add -ffunction-sections to compile
9919 gc_comdat_test files. Add -Wl,--gc-sections to build
9920 gc_comdat_test.
9921 * testsuite/Makefile.in: Regenerate.
9922 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9923
9924 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9925
9926 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9927 kept comdat section was garbage collected.
9928 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9929 * testsuite/Makefile.in: Regenerate.
9930 * testsuite/gc_comdat_test.sh: New file.
9931 * testsuite/gc_comdat_test_1.cc: New file.
9932 * testsuite/gc_comdat_test_2.cc: New file.
9933
9934 2009-05-19 Doug Kwan <dougkwan@google.com>
9935
9936 * archive.cc (Archive::Archive): Move constructor from archive.h
9937 to here. Initialize no_export_.
9938 (Archive::get_elf_object_for_member): Set no_export flag of object.
9939 * archive.h (Archive::Archive): Move constructor body to
9940 archive.cc.
9941 (Archive::no_export): New method.
9942 (Archive::no_export_): New field.
9943 * object.h (Object::Object): Initialize no_export_ to false.
9944 (Object::no_export, Object::set_no_export): New methods.
9945 (Object::no_export_): New field.
9946 * options.cc (General_options::parse_exclude_libs): New method.
9947 (General_options::check_excluded_libs) Same.
9948 * options.h (exclude_libs): New option.
9949 (General_options::check_excluded_libs): New method declaration.
9950 (General_options::excluded_libs_): New field.
9951 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9952 default or protected visibility if an object has no-export flag set.
9953 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9954 (check_SCRIPTS): Add exclude_libs_test.sh.
9955 (check_DATA): Add exclude_libs_test.syms.
9956 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9957 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9958 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9959 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9960 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9961 libexclude_libs_test_2.a): New rules.
9962 * testsuite/Makefile.in: Regenerate.
9963 * testsuite/exclude_libs_test.c: New file.
9964 * testsuite/exclude_libs_test.sh: Ditto.
9965 * testsuite/exclude_libs_test_1.c: Ditto.
9966 * testsuite/exclude_libs_test_2.c: Ditto.
9967
9968 2009-05-15 Ian Lance Taylor <iant@google.com>
9969
9970 * configure.ac: Check for declarations for cases where libiberty.h
9971 checks HAVE_DECL_xxx.
9972 * configure, config.in: Rebuild.
9973
9974 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9975
9976 * gold.h (Incremental_argument_list): Remove (invalid) forward
9977 declaration.
9978 * incremental.cc (Incremental_inputs::report_achive): New method.
9979 (Incremental_inputs::report_object): New method.
9980 (Incremental_inputs::report_script): New method.
9981 (Incremental_inputs::finalize_inputs): New method.
9982 (Incremental_inputs::finalize): Call finalize_inputs().
9983 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9984 Create inputs entries.
9985 * incremental.h (Incremental_input_type): New enum.
9986 (Incremental_inputs::Incremental_input): Initialize new fields.
9987 (Incremental_inputs::report_inputs): New method.
9988 (Incremental_inputs::report_achive): New method.
9989 (Incremental_inputs::report_object): New method.
9990 (Incremental_inputs::report_script): New method.
9991 (Incremental_inputs::finalize_inputs): New method.
9992 (Incremental_inputs::Input_info): New struct.
9993 (Incremental_inputs::Input_info_map): New typedef.
9994 (Incremental_inputs::lock_): New field.
9995 (Incremental_inputs::Inputs_): New field.
9996 (Incremental_inputs::Inputs_map): New field.
9997 * main.cc (main): Call Incremental_input::report_inputs.
9998 * options.h (Input_argument_list): Typedef moved from
9999 Input_arguments.
10000 (Input_file_group::Files): Remove, use ::Input_argument_list.
10001 (Input_file_group::Input_argument_list): Remove, use
10002 ::Input_argument_list.
10003 * plugin.cc (Plugin_manager::add_input_file): Add error in
10004 incremental build.
10005 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10006 functions.
10007 * script.cc (read_input_script): Call
10008 Incremental_input::report_script.
10009 * script.h (Script_info): New class.
10010
10011 2009-04-27 Ian Lance Taylor <iant@google.com>
10012
10013 * x86_64.cc (do_adjust_output_section): Set entsize to
10014 plt_entry_size.
10015
10016 2009-04-23 Elliott Hughes <enh@google.com>
10017
10018 * output.cc (Output_file::close): After short writes, continue
10019 writing from the correct offset in the buffer being written.
10020
10021 2009-04-23 Chris Demetriou <cgd@google.com>
10022
10023 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10024 * configure: Regenerate.
10025 * config.in: Regenerate.
10026 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10027 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10028
10029 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10030
10031 * incremental.cc (Incremental_inputs_header_data): Renamed from
10032 Incremental_input_header_data.
10033 (Incremental_inputs_header_data::data_size): New field.
10034 (Incremental_inputs_header_data::put_input_file_count): Renamed
10035 from input_file_count.
10036 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10037 from command_line_offset.
10038 (Incremental_inputs_header_data::put_reserved): Renamed from
10039 put_reserved.
10040 (Incremental_inputs_entry_data): Renamed from
10041 Incremental_input_entry_data.
10042 (Incremental_inputs_entry_data::data_size): New field.
10043 (Incremental_inputs::report_command_line): New method.
10044 (Incremental_inputs::finalize): New method.
10045 (Incremental_inputs::create_incremental_inputs_data): New method.
10046 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10047 * incremental.h: New file.
10048 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10049 (Layout::finalize): Create incremental inputs section in
10050 incremental builds.
10051 (Layout::create_incremental_info_sections): New method.
10052 * layout.h (Layout::incremental_inputs): New method.
10053 (Layout::create_incremental_info_sections): New method.
10054 (Layout::incremental_inputs_): New field.
10055 * main.cc (main): Notify Incremental_input of the command line.
10056
10057 2009-04-01 Ian Lance Taylor <iant@google.com>
10058 Mikolaj Zalewski <mikolajz@google.com>
10059
10060 * gold.h (reserve_unordered_map): Define, three versions, one for
10061 each version of Unordered_map.
10062 * layout.cc (Layout::Layout): Remove options parameter. Add
10063 number_of_input_files parameter. Don't initialize options_.
10064 Initialize number_of_input_files_ and resized_signatures_. Move
10065 sections_are_attached_.
10066 (Layout::layout_group): Reserve space for group_signatures_.
10067 (Layout::find_or_add_kept_section): Change name parameter to be a
10068 reference. Resize signatures_ map when it gets large enough.
10069 (Layout::layout_eh_frame): Use parameters->options() instead of
10070 this->options_.
10071 (Layout::make_output_section): Likewise.
10072 (Layout::attach_allocated_section_to_segment): Likewise.
10073 (Layout::finalize, Layout::create_executable_stack): Likewise.
10074 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10075 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10076 * layout.h (class Layout): Update declarations. Remove options_
10077 field. Add number_of_input_files_ and resized_signatures_
10078 fields. Move sections_are_attached_ field.
10079 * main.cc (main): Pass number of input files to Layout
10080 constructor. Don't pass options.
10081
10082 2009-03-30 Ian Lance Taylor <iant@google.com>
10083
10084 * ffsll.c (ffsll): Correct implementation.
10085
10086 2009-03-27 Ian Lance Taylor <iant@google.com>
10087
10088 * ffsll.c: New file.
10089 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10090 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10091 * ftruncate.c (ftruncate): Declare before definition.
10092 * mremap.c (mremap): Likewise.
10093 * pread.c (pread): Likewise.
10094 * configure, Makefile.in, config.in: Rebuild.
10095
10096 * mremap.c: New file.
10097 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10098 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10099 (mremap): Declare if HAVE_MREMAP is not defined.
10100 * configure, Makefile.in, config.in: Rebuild.
10101
10102 2009-03-27 Cary Coutant <ccoutant@google.com>
10103
10104 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10105 position independent.
10106 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10107 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10108
10109 2009-03-24 Cary Coutant <ccoutant@google.com>
10110
10111 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10112 an executable.
10113 (needs_dynamic_reloc): Likewise.
10114
10115 2009-03-24 Ian Lance Taylor <iant@google.com>
10116
10117 * yyscript.y (file_cmd): Recognize EXTERN.
10118 (extern_name_list, extern_name_list_body): New nonterminals.
10119 * script.cc (script_add_extern): Define.
10120 * script-c.h (script_add_extern): Declare.
10121
10122 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10123
10124 * object.cc (is_elf_object): Define.
10125 * object.h (is_elf_object): Declare.
10126 * archive.cc (Archive::get_elf_object_for_member): Call
10127 is_elf_object.
10128 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10129
10130 2009-03-24 Elliott Hughes <enh@google.com>
10131
10132 * output.cc (Output_file::map_anonymous): Define.
10133 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10134 try an anonymous one. Report the size if the mmap fails.
10135 * output.h (class Output_file): Declare map_anonymous.
10136
10137 2009-03-24 Ian Lance Taylor <iant@google.com>
10138
10139 * target-select.cc (instantiate_target): Don't acquire the lock if
10140 the instantiated_target_ field has already been set.
10141
10142 2009-03-23 Ian Lance Taylor <iant@google.com>
10143
10144 * gold-threads.h (class Initialize_lock): Define.
10145 * gold-threads.cc (class Initialize_lock_once): Define.
10146 (initialize_lock_control): New static variable.
10147 (initialize_lock_pointer): New static variable.
10148 (initialize_lock_once): New static function.
10149 (Initialize_lock::Initialize_lock): Define.
10150 (Initialize_lock::initialize): Define.
10151 * target-select.h: Include "gold-threads.h".
10152 (class Target_selector): Add lock_ and initialize_lock_ fields.
10153 Don't define instantiate_target, just declare it.
10154 * target-select.cc (Target_selector::Target_selector): Initialize
10155 new fields.
10156 (Target_selector::instantiate_target): Define.
10157 * descriptors.h: Include "gold-threads.h".
10158 (class Descriptors): Add initialize_lock_ field.
10159 * descriptors.cc (Descriptors::Descriptors): Initialize new
10160 field.
10161 (Descriptors::open): Use initialize_lock_ field
10162 * errors.h (class Errors): Add initialize_lock_ field.
10163 * errors.cc (Errors::Errors): Initialize new field.
10164 (Errors::initialize_lock): Use initialize_lock_ field.
10165 * powerpc.cc (class Target_selector_powerpc): Remove
10166 instantiated_target_ field. In do_recognize call
10167 instantiate_target rather than do_instantiate_target. In
10168 do_instantiate_target just allocate a new target.
10169 * sparc.cc (class Target_selector_sparc): Likewise.
10170
10171 * freebsd.h: New file.
10172 * i386.cc: Include "freebsd.h".
10173 (Target_i386): Derive from Target_freebsd rather than
10174 Sized_target.
10175 (Target_selector_i386): Derive from Target_selector_freebsd rather
10176 than Target_selector.
10177 * x86_64.cc: Include "freebsd.h".
10178 (Target_x86_64): Derive from Target_freebsd rather than
10179 Sized_target.
10180 (Target_selector_x86_64): Derive from Target_selector_freebsd
10181 rather than Target_selector.
10182 * target.h (class Target): Add adjust_elf_header and
10183 do_adjust_elf_header.
10184 * output.cc (Output_file_header:: do_sized_write): Call target
10185 adjust_elf_header routine.
10186 * configure.tgt: Set targ_osabi.
10187 * configure.ac: Define GOLD_DEFAULT_OSABI.
10188 * parameters.cc (Parameters::default_target): Pass
10189 GOLD_DEFAULT_OSABI to select_target.
10190 * target-select.h (class Target_selector): Make instantiate_target
10191 protected rather than private.
10192 * Makefile.am (HFILES): Add freebsd.h.
10193 * configure, Makefile.in, config.in: Rebuild.
10194
10195 * merge.cc (do_add_input_section): Correct pend value. Change
10196 message about last entry not being null terminated from error to
10197 warning.
10198
10199 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10200
10201 * incremental.cc: New file.
10202 * Makefile.am (CCFILES): Add incremental.cc.
10203 * Makefile.in: Rebuild.
10204
10205 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10206
10207 * layout.cc (Layout::output_section_name): Preserve names
10208 of '.note.' sections.
10209
10210 2009-03-19 Ian Lance Taylor <iant@google.com>
10211
10212 * descriptors.cc (Descriptors::open): Check that the options are
10213 valid before using them.
10214
10215 2009-03-18 Ian Lance Taylor <iant@google.com>
10216
10217 * script-sections.h: Include <list>.
10218 (class Script_sections): Change Sections_elements from std::vector
10219 to std::list. Typedef public Elements_iterator. Add
10220 orphan_section_placement_, data_segment_align_start_, and
10221 saw_data_segment_align_ fields. Remove data_segment_align_index_
10222 field.
10223 * script-sections.cc (class Orphan_section_placement): New class.
10224 (class Sections_element): Add virtual functions is_relro and
10225 orphan_section_init. Remove virtual function place_orphan_here.
10226 (class Output_section_definition): Add is_relro and
10227 orphan_section_init. Remove place_orphan_here.
10228 (class Orphan_output_section): Likewise.
10229 (Script_sections::Script_sections): Update for field changes.
10230 (Script_sections::data_segment_align): Set saw_data_segment_align_
10231 and data_segment_align_start_, not data_segment_align_index.
10232 (Script_sections::data_segment_relro_end): Check
10233 saw_data_segment_align_. Use data_segment_align_start_ rather
10234 than data_segment_align_index_.
10235 (Script_sections::place_orphan): Rewrite to use
10236 Orphan_section_placement.
10237
10238 2009-03-17 Ian Lance Taylor <iant@google.com>
10239
10240 * archive.cc (Archive::add_symbols): Check for a version attached
10241 to the symbol name in the archive map.
10242 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10243 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10244 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10245 (ver_test_11.a): New target.
10246 * testsuite/Makefile.in: Rebuild.
10247
10248 * configure.ac: Check for chsize and posix_fallocate. Replace
10249 ftruncate.
10250 * ftruncate.c: New file, from gnulib.
10251 * output.cc (posix_fallocate): Define dummy version if not
10252 HAVE_POSIX_FALLOCATE.
10253 (Output_file::map): Call posix_fallocate rather than lseek and
10254 write.
10255 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10256 * configure, Makefile.in, config.in: Rebuild.
10257
10258 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10259
10260 * layout.h (Layout::create_note): Add section_name parameter.
10261 * layout.cc (Layout::create_note): Likewise.
10262 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10263
10264 2009-03-17 Ian Lance Taylor <iant@google.com>
10265
10266 * descriptors.cc: Include "options.h".
10267 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10268 (Descriptors::open): Always use O_CLOEXEC when opening a new
10269 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10270 then set FD_CLOEXEC.
10271
10272 * sparc.cc (class Target_sparc): Add has_got_section.
10273 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10274 make sure we have a GOT section.
10275
10276 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10277 (Target_sparc::Scan::local): Likewise.
10278 (Target_sparc::Scan::global): Likewise.
10279 (Target_sparc::Relocate::relocate): Likewise.
10280 (Target_sparc::Relocate::relocate_tls): Likewise.
10281
10282 * symtab.cc (Symbol_table::define_default_version): New function,
10283 broken out of add_from_object.
10284 (Symbol_table::add_from_object): Call define_default_version.
10285 (Symbol_table::define_special_symbol): Add resolve_oldsym
10286 parameter. Change all callers. If the version for a symbol comes
10287 from a version script, resolve it with the symbol with the same
10288 name with no version. Also add the symbol without a version if
10289 appropriate.
10290 (do_define_in_output_data): If resolving with oldsym, don't delete
10291 sym.
10292 (do_define_in_output_segment): Likewise.
10293 (do_define_as_constant): Likewise.
10294 * symtab.h (class Symbol_table): Update declarations.
10295
10296 2009-03-13 Ian Lance Taylor <iant@google.com>
10297
10298 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10299 (Read_symbols::requeue): New function.
10300 (Read_symbols::do_read_symbols): If make_elf_object fails because
10301 the target type is not configured, and the file was searched for,
10302 issue a warning and retry with the next directory.
10303 (Add_symbols::run): If the file has an incompatible format, and
10304 it was searched for, requeue the Read_symbols task. On error,
10305 release the object.
10306 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10307 dirindex parameter to constructor. Change all callers. Declare
10308 incompatible_warning and requeue.
10309 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10310 input_argument_ and input_group_ fields. Add them to
10311 constructor. Change all callers.
10312 (class Read_script): Add dirindex_ field. Add it to constructor.
10313 Change all callers.
10314 * archive.cc (Archive::setup): Remove input_objects parameter.
10315 Change all callers.
10316 (Archive::get_file_and_offset): Likewise.
10317 (Archive::read_all_symbols): Likewise.
10318 (Archive::read_symbols): Likewise.
10319 (Archive::get_elf_object_for_member): Remove input_objects
10320 parameter. Add punconfigured parameter. Change all callers.
10321 (Archive::add_symbols): Change return type to bool. Check return
10322 value of include_member.
10323 (Archive::include_all_members): Likewise.
10324 (Archive::include_member): Change return type to bool. Return
10325 false if first included object has incompatible target. Set
10326 included_member_ field.
10327 (Add_archive_symbols::run): If add_symbols returns false, requeue
10328 Read_symbols task.
10329 * archive.h (class Archive): Add included_member_ field.
10330 Initialize it in constructor. Add input_file and searched_for
10331 methods. Update declarations.
10332 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10333 input_argument_ fields. Add them to constructor. Change all
10334 callers.
10335 * script.cc: Include "target-select.h".
10336 (class Parser_closure): Add skip_on_incompatible_target_ and
10337 found_incompatible_target_ fields. Add
10338 skip_on_incompatible_target parameter to constructor. Change all
10339 callers. Add methods skip_on_incompatible_target,
10340 clear_skip_on_incompatible_target, found_incompatible_target, and
10341 set_found_incompatible_target.
10342 (read_input_script): Add dirindex parameter. Change all callers.
10343 If parser finds an incompatible target, requeue Read_symbols
10344 task.
10345 (script_set_symbol): Clear skip_on_incompatible_target in
10346 closure.
10347 (script_add_assertion, script_parse_option): Likewise.
10348 (script_start_sections, script_add_phdr): Likewise.
10349 (script_check_output_format): New function.
10350 * script.h (read_input_script): Update declaration.
10351 * script-c.h (script_check_output_format): Declare.
10352 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10353 (ignore_cmd): Remove OUTPUT_FORMAT.
10354 * fileread.cc (Input_file::Input_file): Add explicit this.
10355 (Input_file::will_search_for): New function.
10356 (Input_file::open): Add pindex parameter. Change all callers.
10357 * fileread.h (class Input_file): Add input_file_argument method.
10358 Declare will_search_for. Update declarations.
10359 * object.cc (make_elf_object): Add punconfigured parameter.
10360 Change all callers.
10361 * object.h (class Object): Make input_file public. Add
10362 searched_for method.
10363 (make_elf_object): Update declaration.
10364 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10365 restart search.
10366 * dirsearch.h (class Dirsearch): Update declaration.
10367 * options.h (class General_options): Add --warn-search-mismatch.
10368 * parameters.cc (Parameters::is_compatible_target): New function.
10369 * parameters.h (class Parameters): Declare is_compatible_target.
10370 * workqueue.cc (Workqueue::add_blocker): New function.
10371 * workqueue.h (class Workqueue): Declare add_blocker.
10372
10373 * fileread.cc (Input_file::open): Remove options parameter.
10374 Change all callers.
10375 (Input_file::open_binary): Likewise.
10376 * script.cc (read_input_script): Likewise.
10377 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10378 options parameter from constructor. Change all callers.
10379 (class Read_script): Likewise.
10380 * fileread.h (class Input_file): Update declarations.
10381 * script.h (read_input_script): Update declaration.
10382
10383 2009-03-10 Nick Clifton <nickc@redhat.com>
10384
10385 * po/es.po: New Spanish translation.
10386
10387 2009-03-06 Cary Coutant <ccoutant@google.com>
10388
10389 * options.cc (parse_short_option): Keep dash_z from registering itself.
10390
10391 2009-03-03 Ian Lance Taylor <iant@google.com>
10392
10393 PR 9918
10394 * target-reloc.h (relocate_section): Pass output_section to
10395 relocate.
10396 * i386.cc (Target_i386::should_apply_static_reloc): Add
10397 output_section parameter. Change all callers.
10398 (Target_i386::Relocate::relocate): Add output_section parameter.
10399 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10400 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10401 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10402 * testsuite/two_file_shared.sh: New script.
10403 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10404 (check_DATA): Add two_file_shared.dbg.
10405 (two_file_shared.dbg): New target.
10406 * testsuite/Makefile.in: Rebuild.
10407
10408 2009-03-01 Ian Lance Taylor <iant@google.com>
10409
10410 * configure.ac: Check for byteswap.h.
10411 * configure: Rebuild.
10412 * config.in: Rebuild.
10413
10414 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10415
10416 * layout.cc (Layout::find_or_add_kept_section): New function.
10417 (Layout::add_comdat): Removed.
10418 * layout.h (struct Kept_section): Move out of class Layout.
10419 Remove trailing underscores from field names. Add group_sections
10420 field. Rename group_ field to is_group. Change all uses.
10421 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10422 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10423 comdat_groups_ field.
10424 (Sized_relobj::include_section_group): Use
10425 find_or_add_kept_section and Kept_section::group_sections.
10426 (Sized_relobj::include_linkonce_section): Likewise.
10427 * object.cc (class Sized_relobj): Don't define Comdat_group or
10428 Comdat_group_table. Remove find_comdat_group and
10429 add_comdat_group. Remove comdat_groups_ field.
10430 * plugin.cc (include_comdat_group): Use
10431 Layout::find_or_add_kept_section.
10432
10433 2009-02-28 Ian Lance Taylor <iant@google.com>
10434
10435 * README: --gc-sections and map files are now supported. Document
10436 some build requirements.
10437
10438 PR 6992
10439 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10440 relocatable link set the value of the section symbol to zero.
10441 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10442 relocatable link don't include the section address in the local
10443 symbol value.
10444
10445 2009-02-27 Ian Lance Taylor <iant@google.com>
10446
10447 PR 6811
10448 * options.h (class Search_directory): Add is_system_directory.
10449 (class General_options): Declare is_in_system_directory.
10450 * options.cc (get_relative_sysroot): Make static.
10451 (get_default_sysroot): Make static.
10452 (General_optoins::is_in_system_directory): New function.
10453 * fileread.cc (Input_file::is_in_system_directory): New function.
10454 * fileread.h (class Input_file): Declare is_in_system_directory.
10455 * object.h (class Object): Add is_in_system_directory.
10456 (class Input_objects): Remove system_library_directory_ field.
10457 * object.cc (Input_objects::add_object): Don't set
10458 system_library_directory_.
10459 (input_objects::found_in_system_library_directory): Remove.
10460 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10461 parameter. Change all callers.
10462 (Symbol_table::sized_write_globals): Likewise.
10463 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10464 Call Object::is_in_system_directory.
10465 * symtab.h (class Symbol_table): Update declarations.
10466
10467 PR 5990
10468 * descriptors.h (Open_descriptor): Add is_on_stack field.
10469 * descriptors.cc (Descriptors::open): If the descriptor is on the
10470 top of the stack, remove it. Initialize is_on_stack field.
10471 (Descriptors::release): Only add pod to stack if it is not on the
10472 stack already.
10473 (Descriptors::close_some_descriptor): Clear stack_next and
10474 is_on_stack fields.
10475
10476 PR 7091
10477 * output.cc (Output_section::find_starting_output_address): Rename
10478 from starting_output_address; add PADDR parameter; change return
10479 type.
10480 * output.h (class Output_section): Declare
10481 find_starting_output_address instead of starting_output_address.
10482 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10483 section symbol for which we can't find a merge section.
10484
10485 PR 9836
10486 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10487 hidden or internal, force the symbol to be local.
10488 * resolve.cc (Symbol::override_visibility): Define.
10489 (Symbol::override_base): Use override_visibility.
10490 (Symbol_table::resolve): Likewise.
10491 (Symbol::override_base_with_special): Likewise.
10492 (Symbol_table::override_with_special): If the visibility is hidden
10493 or internal, force the symbol to be local.
10494 * symtab.h (class Symbol): Add set_visibility and
10495 override_visibility.
10496 * testsuite/ver_test_1.sh: New file.
10497 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10498 (check_DATA): Add ver_test_1.syms.
10499 (ver_test_1.syms): New target.
10500 * testsuite/Makefile.in: Rebuild.
10501
10502 2009-02-25 Cary Coutant <ccoutant@google.com>
10503
10504 * layout.cc (Layout::choose_output_section): Don't rename sections
10505 when using a linker script that has a SECTIONS clause.
10506 * Makefile.in: Regenerate.
10507
10508 * testsuite/Makefile.am (script_test_5.sh): New test case.
10509 * testsuite/Makefile.in: Regenerate.
10510 * testsuite/script_test_5.cc: New file.
10511 * testsuite/script_test_5.sh: New file.
10512 * testsuite/script_test_5.t: New file.
10513
10514 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10515
10516 * archive.cc (Archive::include_member): Update calls to add_symbols.
10517 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10518 the Layout argument.
10519 * dynobj.h (do_add_symbols): Add the Layout argument.
10520 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10521 Layout argument.
10522 * object.h (Object::add_symbols): Add the Layout argument.
10523 (Object::do_add_symbols): Add the Layout argument.
10524 (Sized_relobj::do_add_symbols): Add the Layout argument.
10525 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10526 Unify the two versions.
10527 (Add_plugin_symbols): Remove.
10528 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10529 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10530 (Add_plugin_symbols): Remove.
10531 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10532 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10533 (Add_symbols::run): Make it work with Pulginobj.
10534
10535 2009-02-06 Ian Lance Taylor <iant@google.com>
10536
10537 * object.cc (Sized_relobj::do_layout): Make info message start
10538 with lower case letter.
10539
10540 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10541
10542 * binary.cc: Fix file comment.
10543
10544 * options.h (enum Incremental_disposition): Define.
10545 (class General_options): Add new options: --incremental,
10546 --incremental_changed, --incremental_unchanged,
10547 --incremental_unknown. Add incremental_disposition_ and
10548 implicit_incremental_ fields.
10549 (General_options::incremental_disposition): New function.
10550 (class Position_dependent_options): Add incremental_disposition
10551 option.
10552 (Position_dependent_options::copy_from_options): Set incremental
10553 dispositions.
10554 * options.cc (General_options::parse_incremental_changed): New
10555 function.
10556 (General_options::parse_incremental_unchanged): New function.
10557 (General_options::parse_incremental_unknown): New function.
10558 (General_options::General_options): Initialize new fields
10559 incremental_disposition_ and implicit_incremental_.
10560 (General_options::finalize): Check for uasge of --incremental-*
10561 without --incremental.
10562
10563 2009-02-06 Chris Demetriou <cgd@google.com>
10564
10565 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10566 pointer and to report location as the file name associated with
10567 the symbol.
10568 (gold_undefined_symbol_at_location): New function to replace the
10569 old gold_undefined_symbol functionality.
10570 * target-reloc.h (relocate_section): Update to use
10571 gold_undefined_symbol_at_location.
10572 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10573 Call gold_undefined_symbol function rather than gold_error.
10574 * errors.h (Errors::undefined_symbol): Take location as a
10575 string, rather than calculating it from a relocation.
10576 * errors.cc (Errors::fatal): Print "fatal error:" before the
10577 formatted message.
10578 (Errors::error, Errors::error_at_location): Print "error: "
10579 before the formatted message.
10580 (Errors::undefined_symbol): Take location as a string, rather
10581 than calculating it from a relocation.
10582 (gold_undefined_symbol_at_location): New function akin to
10583 old gold_undefined_symbol, calculates location from relocation.
10584 (gold_undefined_symbol): Change to take only a Symbol pointer
10585 and to report location as the file name associated with the symbol.
10586 * testsuite/debug_msg.sh: Update for changed error messages.
10587 * testsuite/undef_symbol.sh: Likewise.
10588
10589 2009-02-04 Duncan Sands <baldrick@free.fr>
10590
10591 PR 9812
10592 * reduced_debug_output.h
10593 (Output_reduced_debug_abbrev_section::failed): Use format for
10594 gold_warning.
10595 (Output_reduced_debug_info_section::faild): Likewise.
10596
10597 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10598
10599 * script.cc (Lazy_demangler): New class.
10600 (Version_script_info::get_symbol_version_helper): Demangle a
10601 symbol only once.
10602
10603 2009-01-29 Cary Coutant <ccoutant@google.com>
10604
10605 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10606 to __tls_get_addr.
10607 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10608
10609 2009-01-28 Ian Lance Taylor <iant@google.com>
10610
10611 * version.cc (version_string): Bump to 1.9.
10612
10613 * gold.h: Include <cstring> and <stdint.h>.
10614 * version.cc: Include <cstdio>.
10615 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10616 warning.
10617 * reduced_debug_output.cc (insert_into_vector): Rename from
10618 Insert_into_vector; change all callers. Use Swap_unaligned to
10619 avoid aliasing issue; remove union since it is unnecessary.
10620
10621 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10622
10623 * Makefile.am (CCFILES): Add gc.cc.
10624 (HFILES): Add gc.h.
10625 * Makefile.in: Regenerate.
10626 * gold.cc (Gc_runner): New class.
10627 (queue_initial_tasks): Call garbage collection related tasks
10628 when corresponding options are invoked.
10629 (queue_middle_gc_tasks): New function.
10630 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10631 processed early before laying out sections during garbage collection.
10632 * gold.h (queue_middle_gc_tasks): New function.
10633 (is_prefix_of): Move from "layout.cc".
10634 * i386.cc (Target_i386::gc_process_relocs): New function.
10635 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10636 * main.cc (main): Create object of class "Garbage_collection".
10637 * object.cc (Relobj::copy_symbols_data): New function.
10638 (Relobj::is_section_name_included): New function.
10639 (Sized_relobj::do_layout): Allow this function to be called twice
10640 during garbage collection and defer layout of section during the
10641 first call.
10642 * object.h (Relobj::get_symbols_data): New function.
10643 (Relobj::is_section_name_included): New function.
10644 (Relobj::copy_symbols_data): New function.
10645 (Relobj::set_symbols_data): New function.
10646 (Relobj::get_relocs_data): New function.
10647 (Relobj::set_relocs_data): New function.
10648 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10649 (Relobj::gc_process_relocs): New function.
10650 (Relobj::do_gc_process_relocs): New pure virtual function.
10651 (Relobj::sd_): New data member.
10652 (Sized_relobj::is_output_section_offset_invalid): New function.
10653 (Sized_relobj::do_gc_process_relocs): New function.
10654 * options.h (General_options::gc_sections): Modify to not be a no-op.
10655 (General_options::print_gc_sections): New option.
10656 * plugin.cc (Plugin_finish::run): Remove function call to
10657 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10658 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10659 * reloc.cc (Read_relocs::run): Add task to process relocs and
10660 determine unreferenced sections when doing garbage collection.
10661 (Gc_process_relocs): New class.
10662 (Sized_relobj::do_gc_process_relocs): New function.
10663 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10664 sections that are garbage collected.
10665 * reloc.h (Gc_process_relocs): New class.
10666 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10667 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10668 symbols whose corresponding sections are garbage collected.
10669 (Symbol_table::Symbol_table): Add new parameter for the garbage
10670 collection object.
10671 (Symbol_table::gc_mark_undef_symbols): New function.
10672 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10673 (Symbol_table::gc_mark_dyn_syms): New function.
10674 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10675 as garbage.
10676 (Symbol_table::add_from_object): Likewise.
10677 (Symbol_table::add_from_relobj): When building shared objects, do not
10678 treat externally visible symbols as garbage.
10679 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10680 table information for static and relocatable links.
10681 * symtab.h (Symbol_table::set_gc): New function.
10682 (Symbol_table::gc): New function.
10683 (Symbol_table::gc_mark_undef_symbols): New function.
10684 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10685 (Symbol_table::gc_mark_dyn_syms): New function.
10686 (Symbol_table::gc_): New data member.
10687 * target.h (Sized_target::gc_process_relocs): New pure virtual
10688 function.
10689 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10690 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10691
10692 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10693
10694 * options.h (General_options::gc_sections): Define as a no-op for now.
10695 (General_options::no_keep_memory): Ditto.
10696 (General_options::Bshareable): Define.
10697 * options.cc (General_options::finalize): Honor -Bshareable.
10698
10699 2009-01-20 Andreas Schwab <schwab@suse.de>
10700
10701 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10702 read the value in the contents, since we don't use it. Use the
10703 template endianness when writing.
10704 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10705
10706 2009-01-19 Andreas Schwab <schwab@suse.de>
10707
10708 * configure.tgt (powerpc64-*): Fix targ_obj.
10709
10710 2009-01-15 Ian Lance Taylor <iant@google.com>
10711
10712 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10713 local symbols when stripping all symbols.
10714
10715 2009-01-14 Cary Coutant <ccoutant@google.com>
10716
10717 * output.cc (Output_reloc): Add explicit instantiations.
10718
10719 2009-01-14 Cary Coutant <ccoutant@google.com>
10720
10721 * archive.cc (Archive::get_elf_object_for_member): Remove call
10722 to File_read::claim_for_plugin.
10723 * descriptors.cc (Descriptors::open): Remove reference to
10724 is_claimed.
10725 (Descriptors::claim_for_plugin): Remove.
10726 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10727 (Descriptors::is_claimed): Remove.
10728 (claim_descriptor_for_plugin): Remove.
10729 * fileread.cc (File_read::claim_for_plugin): Remove.
10730 * fileread.h (File_read::claim_for_plugin): Remove.
10731 (File_read::descriptor): Reopen descriptor if necessary.
10732 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10733 (Plugin_manager::all_symbols_read): Add task parameter. Change
10734 all callers.
10735 (Plugin_manager::get_input_file): New function.
10736 (Plugin_manager::release_input_file): New function.
10737 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10738 corresponding data member.
10739 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10740 and pass to base constructor. Change all callers.
10741 (get_input_file, release_input_file): New functions.
10742 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10743 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10744 (Plugin_manager::all_symbols_read): Add task parameter.
10745 (Plugin_manager::get_input_file): New function.
10746 (Plugin_manager::release_input_file): New function.
10747 (Plugin_manager::task_): New data member.
10748 (Pluginobj::Pluginobj): Add filesize parameter.
10749 (Pluginobj::filename): New function.
10750 (Pluginobj::descriptor): New function.
10751 (Pluginobj::filesize): New function.
10752 (Pluginobj::filesize_): New data member.
10753 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10754 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10755 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10756
10757 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10758 with archive libraries.
10759 * testsuite/Makefile.in: Regenerate.
10760 * testsuite/plugin_test.c (struct sym_info): New type.
10761 (get_input_file, release_input_file): New static variables.
10762 (onload): Capture new transfer vector entries.
10763 (claim_file_hook): Stop reading at end of file according to filesize.
10764 Factor out parsing of readelf output into separate function.
10765 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10766 APIs and get the source file name from the symbol table. Convert
10767 source file name to corresponding object file name. Print info
10768 message when adding new input files.
10769 (parse_readelf_line): New function.
10770 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10771 * testsuite/plugin_test_2.sh: Likewise.
10772 * testsuite/plugin_test_3.sh: Likewise.
10773 * testsuite/plugin_test_4.sh: New test case.
10774
10775 2009-01-07 Ian Lance Taylor <iant@google.com>
10776
10777 * version.cc (version_string): Bump to 1.8.
10778
10779 2008-12-23 Cary Coutant <ccoutant@google.com>
10780
10781 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10782 * plugin.cc (Plugin_manager::finish): Rename as
10783 layout_deferred_objects. Move cleanup to separate function.
10784 (Plugin_manager::cleanup): New function.
10785 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10786 separately.
10787 * plugin.h (Plugin_manager::finish): Rename as
10788 layout_deferred_objects.
10789 (Plugin_manager::cleanup): New function.
10790 (Plugin_manager::cleanup_done): New field.
10791
10792 2008-12-23 Cary Coutant <ccoutant@google.com>
10793
10794 * plugin.cc (is_visible_from_outside): New function.
10795 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10796 so we don't return "IR only" status for exported symbols or -r links.
10797
10798 * testsuite/Makefile.am (plugin_test_3): New test case.
10799 * testsuite/Makefile.in: Regenerate.
10800 * testsuite/plugin_test_3.sh: New file.
10801
10802 2008-12-22 Cary Coutant <ccoutant@google.com>
10803
10804 * object.cc (Sized_relobj::layout_section): New function.
10805 (Sized_relobj::do_layout): Defer layout of input sections until after
10806 plugin has provided replacement files.
10807 (Sized_relobj::do_layout_deferred_sections): New function.
10808 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10809 (Relobj::layout_deferred_sections): New function.
10810 (Relobj::do_layout_deferred_sections): New function.
10811 (Sized_relobj::do_layout_deferred_sections): New function.
10812 (Sized_relobj::layout_section): New function.
10813 (Sized_relobj::Deferred_layout): New structure.
10814 (Sized_relobj::deferred_layout_): New field.
10815 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10816 Change all callers. Layout deferred sections.
10817 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10818 references.
10819 (Plugin_hook::run): Move code from do_plugin_hook inline.
10820 (Plugin_hook::do_plugin_hook): Remove.
10821 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10822 (Plugin_manager::finish): Renamed, was cleanup.
10823 (Plugin_manager::should_defer_layout): New function.
10824 (Plugin_manager::add_deferred_layout_object): New function.
10825 (Plugin_manager::Deferred_layout_list): New type.
10826 (Plugin_manager::deferred_layout_objects_): New field.
10827 (Plugin_hook::do_plugin_hook): Remove.
10828
10829 2008-12-17 Ian Lance Taylor <iant@google.com>
10830
10831 * options.h (class General_options): Add --no case for
10832 --export-dynamic.
10833
10834 2008-12-16 Cary Coutant <ccoutant@google.com>
10835
10836 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10837 vector.
10838 (Plugin_manager::claim_file): Create plugin object even if
10839 plugin did not call the add_symbols callback.
10840 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10841 asking for more symbols than were added.
10842 * testsuite/Makefile.am (plugin_test_1): Add test case with
10843 no global symbols.
10844 (empty.syms): New target.
10845 * testsuite/Makefile.in: Regenerate.
10846 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10847 message. Don't call add_symbols if no globals.
10848 (all_symbols_read_hook): Don't provide replacement for empty
10849 claimed file.
10850
10851 2008-12-12 Ian Lance Taylor <iant@google.com>
10852
10853 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10854 r_type == 0 for a local symbol with r_sym == 0.
10855 (scan_relocatable_relocs): Pass r_sym to
10856 local_non_section_strategy.
10857 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10858 r_sym parameter.
10859
10860 * configure.ac: Update test for TLS descriptors: they are
10861 supported as of glibc 2.9.
10862 * configure: Rebuild.
10863
10864 2008-12-11 Ian Lance Taylor <iant@google.com>
10865
10866 PR 7091
10867 * target-reloc.h (Default_scan_relocatable_relocs): For each
10868 function, map r_type == 0 to RELOC_DISCARD.
10869
10870 2008-12-10 Cary Coutant <ccoutant@google.com>
10871
10872 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10873 object to override a kept COMDAT group from a plugin object.
10874
10875 2008-12-09 Ian Lance Taylor <iant@google.com>
10876
10877 PR 7088
10878 * yyscript.y (file_cmd): Handle INPUT.
10879
10880 * testsuite/initpri1.c: Change all declarations to be full
10881 prototypes by adding void, to avoid compiler warnings.
10882
10883 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10884
10885 * options.cc (General_options::parse_plugin_opt): New.
10886 (General_options::add_plugin): The argument now is just the filename.
10887 (General_options::add_plugin_option): New.
10888 * options.h (plugin_opt): New.
10889 (add_plugin): Change argument name.
10890 (add_plugin_option): New.
10891 * plugin.cc (Plugin::load): Don't parse the plugin option.
10892 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10893 (Plugin::add_option): New.
10894 (Plugin::args_): Change type.
10895 (Plugin::filename_): New.
10896 (Plugin_manager::add_plugin_option): New.
10897 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10898 * testsuite/Makefile.in: Regenerate.
10899
10900 2008-12-05 Cary Coutant <ccoutant@google.com>
10901
10902 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10903 Handle --strip-lto-sections option.
10904 * options.h (strip_lto_sections): New option.
10905
10906 2008-12-01 Cary Coutant <ccoutant@google.com>
10907
10908 * plugin.cc (ld_plugin_message): Change format parameter to const.
10909 Fix mismatch between new[] and delete.
10910
10911 2008-11-14 Cary Coutant <ccoutant@google.com>
10912
10913 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10914 instead of -1U.
10915
10916 2008-11-05 Craig Silverstein <csilvers@google.com>
10917
10918 * options.cc (General_options::parse_dynamic_list): New function.
10919 * options.h (General_options): New flags dynamic_list,
10920 dynamic_list_data, dynamic_list_cpp_new, and
10921 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10922 (General_options::in_dynamic_list): New function.
10923 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10924 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10925 (Lex::can_continue_name): Likewise.
10926 (yylex): Likewise.
10927 (read_script_file): New parameter script_options.
10928 (read_dynamic_list): New function.
10929 (Script_options::define_dynamic_list): New function.
10930 (dynamic_list_keyword_parsecodes): New variable.
10931 (dynamic_list_keywords): New variable.
10932 * script.h (Script_options::define_dynamic_list): New function
10933 prototype.
10934 (read_dynamic_list): New function prototype.
10935 * symtab.cc (strprefix): New macro.
10936 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10937 dynamic_list_data, dynamic_list_cpp_new, and
10938 dynamic_list_cpp_typeinfo.
10939 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10940 (dynamic_list_expr): New rule.
10941 (dynamic_list_nodes): Likewise.
10942 (dynamic_list_node): Likewise.
10943 * testsuite/Makefile.am (dynamic_list): New test.
10944 * testsuite/Makefile.in: Regenerated.
10945 * testsuite/dynamic_list.t: New file.
10946 * testsuite/dynamic_list.sh: New file.
10947
10948 2008-11-05 Craig Silverstein <csilvers@google.com>
10949
10950 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10951 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10952 (t11_last): Likewise.
10953 * testsuite/ver_test_6.c (main): Likewise.
10954
10955 2008-10-07 Cary Coutant <ccoutant@google.com>
10956
10957 * options.c (General_options::finalize): Add check for -static and
10958 -shared.
10959 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10960 is not empty.
10961
10962 2008-10-02 Cary Coutant <ccoutant@google.com>
10963
10964 * plugin.cc (make_sized_plugin_object): Fix conditional
10965 compilation to work when not all targets are enabled.
10966
10967 2008-09-29 Cary Coutant <ccoutant@google.com>
10968
10969 * archive.cc (Archive::get_file_and_offset): Use filename instead
10970 of name to get library path.
10971 (Archive::include_member): Unlock external member of a thin archive.
10972
10973 * testsuite/Makefile.am (TEST_AR): New variable.
10974 (thin_archive_test_1): New test.
10975 (thin_archive_test_2): New test.
10976 * testsuite/Makefile.in: Regenerate.
10977 * testsuite/thin_archive_main.cc: New file.
10978 * testsuite/thin_archive_test_1.cc: New file.
10979 * testsuite/thin_archive_test_2.cc: New file.
10980 * testsuite/thin_archive_test_3.cc: New file.
10981 * testsuite/thin_archive_test_4.cc: New file.
10982
10983 2008-09-29 Cary Coutant <ccoutant@google.com>
10984
10985 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10986 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10987 instead of -1U.
10988 (Sized_relobj::do_finalize_local_symbols): Likewise.
10989 (Sized_relobj::map_to_kept_section): Likewise.
10990 * object.h (Sized_relobj::invalid_address): New constant.
10991 (Sized_relobj::do_output_section_offset): Check for invalid_address
10992 and return -1ULL.
10993 * output.cc (Output_reloc::local_section_offset): Use constant
10994 invalid_address instead of -1U.
10995 (Output_reloc::get_address): Likewise.
10996 (Output_section::output_address): Change -1U to -1ULL.
10997 * output.h (Output_reloc::invalid_address): New constant.
10998 * reloc.cc (Sized_relobj::write_sections): Use constant
10999 invalid_address instead of -1U.
11000 (Sized_relobj::relocate_sections): Likewise.
11001 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11002 values for merge sections.
11003 * target-reloc.h (relocate_for_relocatable): Use constant
11004 invalid_address instead of -1U.
11005
11006 2008-09-19 Cary Coutant <ccoutant@google.com>
11007
11008 Add plugin functionality for link-time optimization (LTO).
11009 * configure.ac (plugins): Add --enable-plugins option.
11010 * configure: Regenerate.
11011 * config.in: Regenerate.
11012 * Makefile.am (LIBDL): New variable.
11013 (CCFILES): Add plugin.cc.
11014 (HFILES): Add plugin.h.
11015 (ldadd_var): Add LIBDL.
11016 * Makefile.in: Regenerate.
11017
11018 * archive.cc: Include "plugin.h".
11019 (Archive::setup): Don't preread archive symbols when using a plugin.
11020 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11021 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11022 files.
11023 (Archive::include_member): Add symbols from plugin objects.
11024 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11025 * descriptors.cc (Descriptors::open): Check for file descriptors
11026 abandoned by plugins.
11027 (Descriptors::claim_for_plugin): New function.
11028 * descriptors.h (Descriptors::claim_for_plugin): New function.
11029 (Open_descriptor::is_claimed): New field.
11030 (claim_descriptor_for_plugin): New function.
11031 * fileread.cc (File_read::claim_for_plugin): New function.
11032 * fileread.h (File_read::claim_for_plugin): New function.
11033 (File_read::descriptor): New function.
11034 * gold.cc: Include "plugin.h".
11035 (queue_initial_tasks): Add task to call plugin hooks for generating
11036 new object files.
11037 * main.cc: Include "plugin.h".
11038 (main): Load plugin libraries.
11039 * object.h (Pluginobj): Declare.
11040 (Object::pluginobj): New function.
11041 (Object::do_pluginobj): New function.
11042 (Object::set_target): New function.
11043 * options.cc: Include "plugin.h".
11044 (General_options::parse_plugin): New function.
11045 (General_options::General_options): Initialize plugins_ field.
11046 (General_options::add_plugin): New function.
11047 * options.h (Plugin_manager): Declare.
11048 (General_options): Add --plugin option.
11049 (General_options::has_plugins): New function.
11050 (General_options::plugins): New function.
11051 (General_options::add_plugin): New function.
11052 (General_options::plugins_): New field.
11053 * plugin.cc: New file.
11054 * plugin.h: New file.
11055 * readsyms.cc: Include "plugin.h".
11056 (Read_symbols::do_read_symbols): Check for archive before checking
11057 for ELF file. Call plugin hooks to claim files.
11058 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11059 from a real object file; force override when processing replacement
11060 files.
11061 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11062 (Symbol::init_base_object): Likewise.
11063 (Symbol::init_base_output_data): Likewise.
11064 (Symbol::init_base_output_segment): Likewise.
11065 (Symbol::init_base_constant): Likewise.
11066 (Symbol::init_base_undefined): Likewise.
11067 (Symbol::output_section): Assert that object is not a plugin.
11068 (Symbol_table::add_from_pluginobj): New function.
11069 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11070 undefined.
11071 (Symbol_table::sized_write_globals): Likewise.
11072 (Symbol_table::add_from_pluginobj): Instantiate template.
11073 * symtab.h (Sized_pluginobj): Declare.
11074 (Symbol::in_real_elf): New function.
11075 (Symbol::set_in_real_elf): New function.
11076 (Symbol::in_real_elf_): New field.
11077 (Symbol_table::add_from_pluginobj): New function.
11078
11079 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11080 (LIBDL): New variable.
11081 (LDADD): Add LIBDL.
11082 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11083 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11084 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11085 (MOSTLYCLEANFILES): Likewise.
11086 * testsuite/Makefile.in: Regenerate.
11087 * testsuite/plugin_test.c: New file.
11088 * testsuite/plugin_test_1.sh: New file.
11089 * testsuite/plugin_test_2.sh: New file.
11090
11091 2008-09-16 Ian Lance Taylor <iant@google.com>
11092
11093 * target-reloc.h (relocate_section): Check whether a symbol is
11094 defined by the ABI before reporting an undefined symbol error.
11095 * target.h (Target::is_defined_by_abi): Make parameter const.
11096 (Target::do_is_defined_by_abi): Likewise.
11097 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11098 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11099 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11100 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11101 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11102 * testsuite/Makefile.in: Rebuild.
11103
11104 * fileread.cc (make_view): Add casts to avoid warning.
11105
11106 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11107
11108 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11109 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11110
11111 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11112
11113 * options.h (General_options::output_is_executable): New.
11114 (General_options::output_is_pie): New.
11115 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11116 for shared libraries.
11117 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11118
11119 2008-09-11 Chris Demetriou <cgd@google.com>
11120
11121 * options.h (origin): New -z option.
11122 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11123 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11124 in DT_FLAGS_1.
11125
11126 2008-09-05 Cary Coutant <ccoutant@google.com>
11127
11128 * fileread.cc (File_read::make_view): Add check for attempt to map
11129 beyond end of file.
11130
11131 2008-09-05 Cary Coutant <ccoutant@google.com>
11132
11133 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11134 explicit instantiations.
11135
11136 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11137
11138 PR gold/6858
11139 * options.cc (General_options::finalize): Allow undefined symbols
11140 in shlibs if linking -shared.
11141
11142 PR gold/6859
11143 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11144 symbols as not needing a dynsym entry.
11145
11146 2008-08-20 Craig Silverstein <csilvers@google.com>
11147
11148 * fileread.cc (File_read::open): Do not lock the file unless it
11149 was successfully opened.
11150
11151 2008-08-14 Cary Coutant <ccoutant@google.com>
11152
11153 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11154 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11155 * testsuite/tls_test.cc (struct int128): 128-bit struct
11156 for testing TLS relocs with non-zero addend.
11157 (v12): New TLS variable.
11158 (t12): New test.
11159 (t_last): Add check for v12.
11160 * testsuite/tls_test.h (t12): New function.
11161 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11162
11163 2008-08-13 Ian Lance Taylor <iant@google.com>
11164
11165 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11166 set tls_segment_ or relro_segment_.
11167 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11168 when appropriate.
11169 * output.h (Output_section::clear_is_relro): New function.
11170 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11171 sections specially even when output_data_ is empty.
11172 (Output_segment::maximum_alignment): When first section is relro,
11173 only force alignment for PT_LOAD segments.
11174 * script.cc (script_data_segment_align): New function.
11175 (script_data_segment_relro_end): New function.
11176 * script-c.h (script_data_segment_align): Declare.
11177 (script_data_segment_relro_end): Declare.
11178 * script-sections.h (class Script_sections): Declare
11179 data_segment_align and data_segment_relro_end. Add fields
11180 segment_align_index_ and saw_relro_end_.
11181 * script-sections.cc (class Sections_element): Add set_is_relro
11182 virtual function. Add new bool* parameter to place_orphan_here.
11183 Add get_output_section virtual function.
11184 (class Output_section_definition): Add set_is_relro. Add new
11185 bool* parameter to place_orphan_here. Add get_output_section.
11186 Add is_relro_ field.
11187 (Output_section_definition::Output_section_definition): Initialize
11188 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11189 and is_relro_ fields.
11190 (Output_section_definition::place_orphan_here): Add is_relro
11191 parameter.
11192 (Output_section_definition::set_section_addresses): Set relro for
11193 output section.
11194 (Output_section_definition::alternate_constraint): Likewise.
11195 (class Orphan_output_section): Add new bool* parameter to
11196 place_orphan_here. Add get_output_section.
11197 (Orphan_output_section::place_orphan_here): Add is_relro
11198 parameter.
11199 (Script_sections::Script_sections): Initialize
11200 data_segment_align_index_ and saw_relro_end_.
11201 (Script_sections::data_segment_align): New function.
11202 (Script_sections::data_segment_relro_end): New function.
11203 (Script_sections::place_orphan): Set or clear is_relro.
11204 (Script_sections::set_section_addresses): Force alignment of first
11205 TLS section.
11206 * yyscript.y (exp): Call script_data_segment_align and
11207 script_data_segment_relro_end.
11208 * testsuite/relro_script_test.t: New file.
11209 * testsuite/relro_test.cc (using_script): Declare.
11210 (t1, t2): Test using_script.
11211 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11212 (relro_script_test_SOURCES): Define.
11213 (relro_script_test_DEPENDENCIES): Define.
11214 (relro_script_test_LDFLAGS): Define.
11215 (relro_script_test_LDADD): Define.
11216 (relro_script_test.so): New target.
11217 * testsuite/Makefile.in: Rebuild.
11218
11219 2008-08-06 Cary Coutant <ccoutant@google.com>
11220
11221 * archive.cc (Archive::total_archives, Archive::total_members)
11222 (Archive::total_members_loaded): New variables.
11223 (Archive::setup): Add parameter. Add option to preread
11224 archive symbols.
11225 (Archive::read_armap): Add counter.
11226 (Archive::get_file_and_offset): New function.
11227 (Archive::get_elf_object_for_member): New function.
11228 (Archive::read_all_symbols): New function.
11229 (Archive::read_symbols): New function.
11230 (Archive::add_symbols): Add counters.
11231 (Archive::include_all_members): Use armap to find members if it's
11232 already built.
11233 (Archive::include_member): Skip reading symbols if already read.
11234 Factored code into Archive::get_file_and_offset and
11235 Archive::get_elf_object_for_member. Changed call to
11236 Mapfile::report_include_archive_member.
11237 (Archive::print_stats): New function.
11238 * archive.h: Declare Object and Read_symbols_data classes.
11239 (Archive::Archive): Add initializers for new members.
11240 (Archive::setup): Add parameter.
11241 (Archive::print_stats): New function.
11242 (Archive::total_archives, Archive::total_members)
11243 (Archive::total_members_loaded): New variables.
11244 (Archive::get_file_and_offset): New function.
11245 (Archive::get_elf_object_for_member): New function.
11246 (Archive::read_all_symbols): New function.
11247 (Archive::read_symbols): New function.
11248 (Archive::Archive_member): New class.
11249 (Archive::members_): New member.
11250 (Archive::num_members_): New member.
11251 * main.cc: Include archive.h.
11252 (main): Call Archive::print_stats.
11253 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11254 archive parameter; member_name is now the fully-decorated name.
11255 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11256 * options.h: (General_options): Add --preread-archive-symbols option.
11257 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11258 Archive::setup.
11259
11260 2008-08-04 Ian Lance Taylor <iant@google.com>
11261
11262 * symtab.h (Symbol::use_plt_offset): New function.
11263 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11264 * powerpc.cc (Relocate::relocate): Likewise.
11265 * sparc.cc (Relocate::relocate): Likewise.
11266 * x86_64.cc (Relocate::relocate): Likewise.
11267 * testsuite/weak_plt.sh: New test.
11268 * testsuite/weak_plt_main.cc: New test.
11269 * testsuite/weak_plt_shared.cc: New test.
11270 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11271 (check_PROGRAMS): Add weak_plt.
11272 (check_DATA): Add weak_plt_shared.so.
11273 (weak_plt_main_pic.o, weak_plt): New targets.
11274 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11275 * testsuite/Makefile.in: Rebuild.
11276
11277 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11278 gcctestdir/ld.
11279 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11280 * testsuite/Makefile.in: Rebuild.
11281
11282 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11283
11284 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11285 * Makefile.in: Regenerate.
11286 * po/POTFILES.in: Regenerate.
11287
11288 2008-07-29 Ian Lance Taylor <iant@google.com>
11289
11290 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11291 symbols before other symbols.
11292 * testsuite/script_test_2.cc (test_addr): Declare.
11293 (test_addr_alias): Declare.
11294 (main): Check that test_addr and test_addr_alias have the right
11295 values.
11296 * testsuite/script_test_2.t: Define test_addr_alias and
11297 test_addr.
11298
11299 2008-07-24 Ian Lance Taylor <iant@google.com>
11300
11301 PR 5990
11302 * descriptors.cc: New file.
11303 * descriptors.h: New file.
11304 * gold-threads.h (class Hold_optional_lock): New class.
11305 * fileread.cc: Include "descriptors.h".
11306 (File_read::~File_read): Release descriptor rather than closing
11307 it.
11308 (File_read::open) [file]: Call open_descriptor rather than open.
11309 Set is_descriptor_opened_.
11310 (File_read::open) [memory]: Assert that descriptor is not open.
11311 (File_read::reopen_descriptor): New function.
11312 (File_read::release): Release descriptor.
11313 (File_read::do_read): Make non-const. Reopen descriptor.
11314 (File_read::read): Make non-const.
11315 (File_read::make_view): Reopen descriptor.
11316 (File_read::do_readv): Likewise.
11317 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11318 Update declarations.
11319 * layout.cc: Include "descriptors.h".
11320 (Layout::create_build_id): Use open_descriptor rather than open.
11321 * output.cc: Include "descriptors.h".
11322 (Output_file::open): Use open_descriptor rather than open.
11323 * archive.cc (Archive::const_iterator): Change Archive to be
11324 non-const.
11325 (Archive::begin, Archive::end): Make non-const.
11326 (Archive::count_members): Likewise.
11327 * archive.h (class Archive): Update declarations.
11328 * object.h (Object::read): Make non-const.
11329 * Makefile.am (CCFILES): Add descriptors.cc.
11330 (HFILES): Add descriptors.h.
11331 * Makefile.in: Rebuild.
11332
11333 PR 6716
11334 * gold.h: Always include <clocale>. Add Solaris workarounds
11335 following code in binutils/sysdep.h.
11336
11337 PR 6048
11338 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11339 this->eh_frame_hdr_ is NULL before using it.
11340
11341 * dynobj.cc (Versions::Versions): Update comment.
11342
11343 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11344 the base version name.
11345
11346 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11347 array size plus one.
11348 (Stringpool_template::set_string_offsets): Subtract one from key
11349 before using it as an array index.
11350 (Stringpool_template::get_offset_with_length): Likewise.
11351 (Stringpool_template::write_to_buffer): Likewise.
11352 * stringpool.h (Stringpool_template::get_offset_from_key):
11353 Likewise.
11354
11355 2008-07-23 Ian Lance Taylor <iant@google.com>
11356
11357 PR 6658
11358 * object.h (Merged_symbol_value::value): Do our best to handle a
11359 negative addend.
11360
11361 PR 6647
11362 * script.cc (Version_script_info::get_versions): Don't add empty
11363 version tag to return value.
11364 (Version_script_info::get_symbol_version_helper): Change return
11365 type to bool. Add pversion parameter. Change all callers.
11366 (script_register_vers_node): Don't require a non-NULL tag.
11367 * script.h (class Version_script_info): Update declarations.
11368 (Version_script_info::get_symbol_version): Change return type to
11369 bool. Add version parameter. Change all callers.
11370 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11371 handling. Handle an empty version from a version script.
11372 (Symbol_table::define_special_symbol): Likewise.
11373 * testsuite/ver_test_10.script: New file.
11374 * testsuite/ver_test_10.sh: New file.
11375 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11376 (check_DATA): Add ver_test_10.syms.
11377 (ver_test_10.syms, ver_test_10.so): New target.
11378 * testsuite/Makefile.in: Rebuild.
11379
11380 2008-07-23 Simon Baldwin <simonb@google.com>
11381
11382 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11383 to zero for undefined symbols from dynamic libraries.
11384
11385 2008-07-23 Ian Lance Taylor <iant@google.com>
11386
11387 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11388 Change all callers.
11389 * symtab.h (class Symbol_table): Update declaration.
11390 * testsuite/ver_test_9.cc: New file.
11391 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11392 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11393 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11394 (ver_test_9.so, ver_test_9.o): New targets.
11395 * testsuite/Makefile.in: Rebuild.
11396
11397 2008-07-22 Ian Lance Taylor <iant@google.com>
11398
11399 * options.h (class General_options): Define --check-sections.
11400 * layout.cc (Layout::set_segment_offsets): Handle
11401 --check-sections.
11402
11403 * options.h (class General_options): Define -n/--nmagic and
11404 -N/--omagic.
11405 * options.cc (General_options::finalize): For -n/--nmagic or
11406 -N/--omagic, set -static.
11407 * layout.cc (Layout::attach_allocated_section_to_segment): If
11408 -N/--omagic, don't put read-only and read-write sections in
11409 different segments.
11410 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11411 finding a read-only segment.
11412 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11413 don't set the minimum segment alignment to the common page size,
11414 and don't set the file offset to the address modulo the page size.
11415 * script-sections.cc (Script_sections::create_segments): If
11416 -n/--omagic, don't put read-only and read-write sections in
11417 different segments.
11418
11419 * cref.cc: New file.
11420 * cref.h: New file.
11421 * options.h (class General_options): Add --print-symbol-counts.
11422 * main.cc (main): Issue defined symbol report if requested.
11423 * archive.cc (Archive::interpret_header): Make into a const member
11424 function.
11425 (Archive::add_symbols): Call Input_objects::archive_start and
11426 archive_stop.
11427 (Archive::const_iterator): Define new class.
11428 (Archive::begin, Archive::end): New functions.
11429 (Archive::include_all_members): Rewrite to use iterator.
11430 (Archive::count_members): New function.
11431 * archive.h (class Archive): Update declarations.
11432 (Archive::filename): New function.
11433 * object.cc: Include "cref.h".
11434 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11435 (Sized_relobj::do_get_global_symbol_counts): New function.
11436 (Input_objects::add_object): Add object to cross-referencer.
11437 (Input_objects::archive_start): New function.
11438 (Input_objects::archive_stop): New function.
11439 (Input_objects::print_symbol_counts): New function.
11440 * object.h: Declare Cref and Archive.
11441 (Object::get_global_symbol_counts): New function.
11442 (Object::do_get_global_symbol_counts): New pure virtual function.
11443 (class Sized_relobj): Add defined_count_ field. Update
11444 declarations.
11445 (class Input_objects): Add cref_ field. Update constructor.
11446 Update declarations.
11447 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11448 defined_count_.
11449 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11450 symbol counts.
11451 (Sized_dynobj::do_get_global_symbol_counts): New function.
11452 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11453 defined_count_. Update declarations. Define Symbols typedef.
11454 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11455 parameter. Change all callers.
11456 (Symbol_table::add_from_dynobj): Add sympointers and defined
11457 parameters. Change all callers.
11458 * symtab.h (class Symbol_table): Update declarations.
11459 * Makefile.am (CCFILES): Add cref.cc.
11460 (HFILES): Add cref.h.
11461 * Makefile.in: Rebuild.
11462
11463 2008-07-22 Simon Baldwin <simonb@google.com>
11464
11465 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11466 to zero when writing undefined symbols.
11467
11468 2008-07-22 Ian Lance Taylor <iant@google.com>
11469
11470 * output.cc (Output_section::add_input_section): Don't try to
11471 merge empty merge sections.
11472
11473 2008-07-21 Craig Silverstein <csilvers@google.com>
11474
11475 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11476 Include symbol version in error message.
11477
11478 2008-07-20 Chris Demetriou <cgd@google.com>
11479
11480 * configure.ac (gold_cv_c_random_seed): New configured variable.
11481 (RANDOM_SEED_CFLAGS): New substituted variable.
11482 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11483 * configure: Rebuild.
11484 * Makefile.in: Likewise.
11485 * testsuite/Makefile.in: Likewise.
11486
11487 2008-07-18 Ian Lance Taylor <iant@google.com>
11488
11489 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11490 where we see NAME/NULL and NAME/VERSION as separate symbols.
11491 * testsuite/ver_test_main.cc (main): Call t4.
11492 (t4, t4_2a): Define.
11493 * testsuite/ver_test_2.cc (t4_2): Define.
11494 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11495 * testsuite/ver_test_4.cc (t4_2a): Define.
11496 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11497 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11498
11499 2008-07-17 Ian Lance Taylor <iant@google.com>
11500
11501 * dynobj.cc (Versions::add_def): If we give an error about a
11502 missing version, go ahead and create the version anyhow.
11503
11504 2008-07-10 Ian Lance Taylor <iant@google.com>
11505
11506 Handle output sections with more than 0x7fffffff bytes.
11507 * object.h (class Relobj): Change map_to_output_ to
11508 output_sections_, and just keep a section pointer. Change all
11509 uses. Move comdat group support to Sized_relobj.
11510 (Relobj::is_section_specially_mapped): Remove.
11511 (Relobj::output_section): Remove poff parameter. Change all
11512 callers.
11513 (Relobj::output_section_offset): New function.
11514 (Relobj::set_section_offset): Rewrite.
11515 (Relobj::map_to_output): Remove.
11516 (Relobj::output_sections): New function.
11517 (Relobj::do_output_section_offset): New pure virtual function.
11518 (Relobj::do_set_section_offset): Likewise.
11519 (class Sized_relobj): Add section_offsets_ field. Add comdat
11520 group support from Relobj. Update declarations.
11521 (Sized_relobj::get_output_section_offset): New function.
11522 (Sized_relobj::do_output_section_offset): New function.
11523 (Sized_relobj::do_set_section_offset): New function.
11524 * object.cc (Relobj::output_section_address): Remove.
11525 (Sized_relobj::Sized_relobj): Initialize new fields.
11526 (Sized_relobj::include_section_group): Cast find_kept_object to
11527 Sized_relobj.
11528 (Sized_relobj::include_linkonce_section): Likewise.
11529 (Sized_relobj::do_layout): Use separate arrays for output section
11530 and output offset.
11531 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11532 output_sections.
11533 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11534 output_sections and section_offsets.
11535 (Sized_relobj::write_local_symbols): Likewise.
11536 (map_to_kept_section): Compute output address directly.
11537 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11538 output_sections and section_offsets.
11539 (Sized_relobj::write_sections): Likewise.
11540 (Sized_relobj::relocate_sections): Likewise.
11541 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11542 * output.h (class Output_reloc): Update declarations. Change
11543 u2_.relobj to Sized_relobj*.
11544 (class Output_data_reloc): Change add functions to use
11545 Sized_relobj*.
11546 * output.cc (Output_reloc::Output_reloc): Change relobj to
11547 Sized_relobj*.
11548 (Output_reloc::local_section_offset): Change return type to
11549 Elf_Addr. Use get_output_section_offset.
11550 (Output_reloc::get_address): Likewise.
11551 (Output_section::is_input_address_mapped): Don't call
11552 is_section_specially_mapped.
11553 (Output_section::output_offset): Likewise.
11554 (Output_section::output_address): Likewise.
11555 (Output_section::starting_output_address): Likewise.
11556 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11557 parameter to Sized_relobj*.
11558 (Copy_relocs::need_copy_reloc): Likewise.
11559 (Copy_relocs::save): Likewise.
11560 * copy-relocs.h (class Copy_relocs): Update declarations.
11561 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11562 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11563 * target-reloc.h (relocate_for_relocatable): Change
11564 offset_in_output_section type to Elf_Addr. Change code that uses
11565 it as well.
11566 * layout.cc (Layout::layout): Always set *off.
11567 * mapfile.cc (Mapfile::print_input_section): Use
11568 output_section_offset.
11569 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11570 Sized_relobj*.
11571 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11572 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11573 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11574
11575 2008-07-03 Ian Lance Taylor <iant@google.com>
11576
11577 * layout.cc (Layout::include_section): Do not discard unrecognized
11578 SHT_STRTAB sections.
11579
11580 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11581
11582 * script.cc (Lex::can_continue_name): Make '?' allowable in
11583 version-script names.
11584 * testsuite/version_script.map: Change glob pattern to use '?'
11585
11586 2008-06-30 Manish Singh <yosh@gimp.org>
11587
11588 PR 6585
11589 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11590 Correct typo.
11591
11592 2008-06-30 Ian Lance Taylor <iant@google.com>
11593
11594 PR 6660
11595 PR 6682
11596 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11597 versions]: Don't try to read the value in the contents, since we
11598 don't use it. Use the template endianness when writing.
11599
11600 2008-06-25 Cary Coutant <ccoutant@google.com>
11601
11602 * fileread.cc (File_read::make_view): Assert on zero-length view.
11603 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11604 symbol table when there are no symbols to read.
11605
11606 2008-06-23 Craig Silverstein <csilvers@google.com>
11607
11608 * version.cc (version_string): Bump to 1.7
11609
11610 2008-06-18 Craig Silverstein <csilvers@google.com>
11611
11612 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11613 constant 0xFFFF to type Valtype.
11614 (Powerpc_relocate_functions::rel16_ha): Likewise.
11615
11616 2008-06-17 Ian Lance Taylor <iant@google.com>
11617
11618 * output.h (Output_section::Input_section): Initialize p2align_ to
11619 zero for Output_section_data constructors.
11620 (Output_section::Input_section::addralign): If not an input
11621 section, return the alignment of the Output_section_data.
11622 * testsuite/copy_test.cc: New file.
11623 * testsuite/copy_test_1.cc: New file.
11624 * testsuite/copy_test_2.cc: New file.
11625 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11626 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11627 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11628 (copy_test_1_pic.o, copy_test_1.so): New targets.
11629 (copy_test_2_pic.o, copy_test_2.so): New targets.
11630 * testsuite/Makefile.in: Rebuild.
11631
11632 * script-sections.cc (Script_sections::place_orphan): Initialize
11633 local variable exact.
11634
11635 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11636
11637 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11638
11639 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11640 David S. Miller <davem@davemloft.net>
11641
11642 * powerpc.cc: New file.
11643 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11644 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11645 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11646 * Makefile.in: Rebuild.
11647
11648 2008-06-09 Ian Lance Taylor <iant@google.com>
11649
11650 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11651 <exception>.
11652 (throwing, orig_terminate): New static variables.
11653 (terminate_handler): New static function.
11654 (t2): Set terminate handler.
11655
11656 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11657
11658 PR 6584
11659 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11660 alignment.
11661
11662 2008-05-30 Cary Coutant <ccoutant@google.com>
11663
11664 * archive.cc (Archive::include_all_members) Correct to step
11665 over symbol table and extended name table in thin archives.
11666
11667 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11668
11669 PR 6407
11670 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11671 calculation.
11672
11673 2008-05-28 Caleb Howe <cshowe@google.com>
11674
11675 * reduced_debug_output.cc: New file.
11676 * reduced_debug_output.h: New file.
11677 * options.h (class General_options): Add --strip-debug-non-line.
11678 * options.cc (General_options::finalize): Add strip_debug_non_line
11679 to the strip heirarchy.
11680 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11681 fields.
11682 * layout.cc: Include "reduced_debug_output.h".
11683 (Layout::Layout): Initialize new fields.
11684 (line_only_debug_sections): New static array.
11685 (is_lines_only_debug_sections): New static inline function.
11686 (Layout::include_section): Handle --strip-debug-non-line.
11687 (Layout::make_output_section): If --strip-debug-non-line, build
11688 new output sections for .debug_abbrev and .debug_info.
11689 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11690 gold. Warn about possible overflow.
11691 (read_signed_LEB_128): Likewise.
11692 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11693 (read_signed_LEB_128): Declare.
11694 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11695 (HFILES): Add reduced_debug_output.h.
11696 * Makefile.in: Rebuild.
11697
11698 2008-05-21 Ian Lance Taylor <iant@google.com>
11699
11700 * mapfile.cc: New file.
11701 * mapfile.h: New file.
11702 * options.h (class General_options): Add -M/--print-map and -Map.
11703 * options.cc (General_options::finalize): Make -M equivalent to
11704 -Map -.
11705 * main.cc: Include <cstdio> and "mapfile.h".
11706 (main): Open mapfile if requested.
11707 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11708 constructor. Change caller.
11709 (queue_initial_tasks): Add mapfile parameter. Change caller.
11710 (queue_middle_tasks): Likewise.
11711 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11712 declarations.
11713 * archive.cc: Include "mapfile.h".
11714 (Archive::add_symbols): Add mapfile parameter. Change all
11715 callers. Pass mapfile, symbol, and reason to include_member.
11716 (Archive::include_all_members): Add mapfile parameter. Change all
11717 callers.
11718 (Archive::include_member): Add mapfile, sym, and why parameters.
11719 Change all callers. Report inclusion to map file.
11720 * archive.h: Include "fileread.h".
11721 (class Archive): Update declarations.
11722 (Archive::file): New const method.
11723 (class Add_archive_symbols): Add mapfile_ field. Update
11724 constructor. Change all callers.
11725 * readsyms.h (class Read_symbols): Likewise.
11726 (class Finish_group): Likewise.
11727 (class Read_script): Likewise.
11728 * common.cc: Include "mapfile.h".
11729 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11730 all callers.
11731 (Symbol_table::do_allocate_commons): Likewise.
11732 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11733 symbol allocation to mapfile.
11734 * common.h (class Allocate_commons_task): Add mapfile_ field.
11735 Update constructor. Change all callers.
11736 * symtab.h (class Symbol_table): Update declarations.
11737 * layout.cc: Include "mapfile.h".
11738 (Layout_task_runner::run): Print information to mapfile.
11739 (Layout::create_gold_note): Change Output_data_fixed_space to
11740 Output_data_zero_fill.
11741 (Layout::create_build_id): Likewise.
11742 (Layout::print_to_mapfile): New function.
11743 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11744 constructor. Change caller.
11745 (class Layout): Declare print_to_mapfile.
11746 * output.cc (Output_section::Input_section::print_to_mapfile): New
11747 function.
11748 (Output_section::add_input_section): If producing a map, always
11749 add to input_sections_ list.
11750 (Output_section::do_print_to_mapfile): New function.
11751 (Output_segment::print_sections_to_mapfile): New function.
11752 (Output_segment::print_section_list_to_mapfile): New function.
11753 * output.h: Include "mapfile.h".
11754 (Output_data::print_to_mapfile): New function.
11755 (Output_data::do_print_to_mapfile): New virtual function.
11756 (Output_segment_headers::do_print_to_mapfile): New function.
11757 (Output_file_header::do_print_to_mapfile): New function.
11758 (Output_data_const::do_print_to_mapfile): New function.
11759 (class Output_data_const_buffer): Add map_name_ field. Update
11760 constructor. Change all callers. Add do_print_to_mapfile
11761 function.
11762 (class Output_data_fixed_space): Likewise.
11763 (class Output_data_space): Likewise.
11764 (class Output_data_zero_fill): New class.
11765 (Output_data_strtab::do_print_to_mapfile): New function.
11766 (Output_data_reloc_base::do_print_to_mapfile): New function.
11767 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11768 (Output_data_group::do_print_to_mapfile): New function.
11769 (Output_data_got::do_print_to_mapfile): New function.
11770 (Output_data_dynamic::do_print_to_mapfile): New function.
11771 (Output_symtab_xindex::do_print_to_mapfile): New function.
11772 (class Output_section): Declare do_print_to_mapflie. Declare
11773 print_to_mapfile in Input_section.
11774 (class Output_segment): Declare new functions.
11775 * object.h (Sized_relobj::symbol_count): New function.
11776 * script-sections.cc
11777 (Output_section_element_dot_assignment::set_section_addresses):
11778 Change Output_data_fixed_space to Output_data_zero_fill.
11779 (Output_data_expression::do_print_to_mapfile): New function.
11780 * script.cc (read_input_script): Add mapfile parameter. Change
11781 all callers.
11782 * script.h (read_input_script): Update declaration.
11783 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11784 (Eh_frame::do_print_to_mapfile): New function.
11785 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11786 (Output_merge_string::do_print_to_mapfile): New function.
11787 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11788 function.
11789 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11790 function.
11791 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11792 function.
11793 * Makefile.am (CCFILES): Add mapfile.cc.
11794 (HFILES): Add mapfile.h.
11795 * Makefile.in: Rebuild.
11796
11797 2008-05-19 Ian Lance Taylor <iant@google.com>
11798
11799 * options.h (class General_options): Add -z relro.
11800 * layout.cc (Layout::Layout): Initialize relro_segment_.
11801 (Layout::add_output_section_data): Return the output section.
11802 (Layout::make_output_section): Rcognize relro sections and mark
11803 them appropriately.
11804 (Layout::attach_allocated_section_to_segment): Put relro sections
11805 in a PT_GNU_RELRO segment.
11806 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11807 section as relro.
11808 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11809 PT_TLS segments.
11810 (Layout::linkonce_mapping): Map d.rel.ro.local to
11811 .data.rel.ro.local.
11812 (Layout::output_section_name): Us .data.rel.ro.local for any
11813 section which begins with that.
11814 * layout.h (class Layout): Update add_output_section_data
11815 declaration. Add relro_segment_ field.
11816 * output.cc (Output_section::Output_section): Initialize is_relro_
11817 and is_relro_local_ fields.
11818 (Output_segment::add_output_section): Group relro sections.
11819 (Output_segment::is_first_section_relro): New function.
11820 (Output_segment::maximum_alignment): If there is a relro section,
11821 align the segment to the common page size.
11822 (Output_segment::set_section_addresses): Track whether we are
11823 looking at relro sections. If the last section is a relro
11824 section, align to the common page size.
11825 (Output_segment::set_section_list_addresses): Add in_relro
11826 parameter. Change all callers. Align to the page size when
11827 moving from relro to non-relro section.
11828 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11829 segment.
11830 * output.h (class Output_section): Add is_relro_ and
11831 is_relro_local_ fields.
11832 (Output_section::is_relro): New function.
11833 (Output_section::set_is_relro): New function.
11834 (Output_section::is_relro_local): New function.
11835 (Output_section::set_is_relro_local): New function.
11836 (class Output_segment): Update declarations.
11837 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11838 * sparc.cc (Target_sparc::got_section): Likewise.
11839 * x86_64.cc (Target_x86_64::got_section): Likewise.
11840 * testsuite/relro_test_main.cc: New file.
11841 * testsuite/relro_test.cc: New file.
11842 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11843 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11844 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11845 (relro_test.so, relro_test_pic.o): New targets.
11846 * testsuite/Makefile.in: Rebuild.
11847
11848 2008-05-16 Ian Lance Taylor <iant@google.com>
11849
11850 * output.cc (Output_segment::add_output_section): Remove front
11851 parameter.
11852 * output.h (class Output_segment): Remove
11853 add_initial_output_section and overloaded add_output_section.
11854 Update declaration of remaining add_output_section.
11855 * layout.cc (Layout::create_interp): Call add_output_section
11856 rather than add_initial_output_section.
11857 (Layout::finish_dynamic_section): Likewise.
11858
11859 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11860 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11861 know the dynamic type.
11862 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11863 field. Initialize it in constructor.
11864 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11865 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11866 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11867 reloc.
11868
11869 * output.cc (Output_reloc::get_address): Change return type to
11870 Elf_Addr.
11871 * output.h (class Output_reloc): Update get_address declaration.
11872 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11873 for section addresses.
11874
11875 2008-05-09 Ian Lance Taylor <iant@google.com>
11876
11877 PR 6493
11878 * gold.cc (gold_nomem): Use return value of write.
11879
11880 2008-05-08 Ian Lance Taylor <iant@google.com>
11881
11882 * symtab.c (Symbol::init_base_output_data): Add version
11883 parameter. Change all callers.
11884 (Symbol::init_base_output_segment): Likewise.
11885 (Symbol::init_base_constant): Likewise.
11886 (Symbol::init_base_undefined): Likewise.
11887 (Sized_symbol::init_output_data): Likewise.
11888 (Sized_symbol::init_output_segment): Likewise.
11889 (Sized_symbol::init_constant): Likewise.
11890 (Sized_symbol::init_undefined): Likewise.
11891 (Symbol_table::do_define_in_output_data): If the new symbol has a
11892 version, mark it as the default.
11893 (Symbol_table::do_define_in_output_segment): Likewise.
11894 (Symbol_table::do_define_as_constant): Likewise.
11895 * symtab.h (class Symbol): Update declarations.
11896 (class Sized_symbol): Likewise.
11897 * resolve.cc (Symbol::override_version): New function.
11898 (Symbol::override_base): Call override_version.
11899 (Symbol::override_base_with_special): Likewise.
11900 * testsuite/ver_script_8.script: New file.
11901 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11902 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11903 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11904 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11905
11906 2008-05-06 Ian Lance Taylor <iant@google.com>
11907
11908 PR 6049
11909 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11910 functions.
11911 (class General_options): Remove existing --undefined, and add
11912 --no-undefined instead. Add new --undefined as synonym for -u.
11913 * archive.cc (Archive::add_symbols): Check whether symbol was
11914 named with -u.
11915 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11916 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11917 all uses. Add IS_UNDEFINED. Update declarations to split
11918 different versions of init_base. Declare init_base_undefined.
11919 (Symbol::is_defined): Handle IS_UNDEFINED.
11920 (Symbol::is_undefined): Likewise.
11921 (Symbol::is_weak_undefined): Call is_undefined.
11922 (Symbol::is_absolute): Handle IS_CONSTANT.
11923 (class Sized_symbol): Update declarations to split different
11924 versions of init. Declare init_undefined.
11925 (class Symbol_table): Declare new functions.
11926 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11927 Change all callers.
11928 (Symbol::init_base_output_data): Likewise.
11929 (Symbol::init_base_output_segment): Likewise.
11930 (Symbol::init_base_constant): Likewise.
11931 (Symbol::init_base_undefined): New function.
11932 (Sized_symbol::init_object): Rename from init. Change all
11933 callers.
11934 (Sized_symbol::init_output_data): Likewise.
11935 (Sized_symbol::init_output_segment): Likewise.
11936 (Sized_symbol::init_constant): Likewise.
11937 (Sized_symbol::init_undefined): New function.
11938 (Symbol_table::add_undefined_symbols_from_command_line): New
11939 function.
11940 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11941 function.
11942 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11943 (Symbol::output_section): Likewise.
11944 (Symbol::set_output_section): Likewise.
11945 (Symbol_table::sized_finalize_symbol): Likewise.
11946 (Symbol_table::sized_write_globals): Likewise.
11947 * resolve.cc (Symbol_table::should_override): Likewise.
11948 (Symbol::override_base_with_special): Likewise.
11949
11950 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11951 symbol, change it to have default visibility.
11952 * testsuite/protected_1.cc: New file.
11953 * testsuite/protected_2.cc: New file.
11954 * testsuite/protected_3.cc: New file.
11955 * testsuite/protected_main_1.cc: New file.
11956 * testsuite/protected_main_2.cc: New file.
11957 * testsuite/protected_main_3.cc: New file.
11958 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11959 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11960 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11961 (protected_1.so): New target.
11962 (protected_1_pic.o, protected_2_pic.o): New targets.
11963 (protected_3_pic.o): New target.
11964 (check_PROGRAMS): Add protected_2.
11965 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11966 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11967 * testsuite/Makefile.in: Rebuild.
11968
11969 * options.h (DEFINE_var): Add set_user_set_##varname__.
11970 (DEFINE_bool_alias): New macro.
11971 (class General_options): Define -Bstatic using DEFINE_bool_alias
11972 rather than DEFINE_special. Add --undefined as an alias for -z
11973 defs.
11974 * options.cc (General_options::parse_Bstatic): Remove.
11975
11976 * options.h (class General_options): Add --fatal-warnings.
11977 * main.cc (main): Implement --fatal-warnings.
11978 * errors.h (Errors::warning_count): New function.
11979
11980 * options.h (class General_options): Add -Bsymbolic-functions.
11981 * symtab.h (Symbol::is_preemptible): Check for
11982 -Bsymbolic-functions.
11983
11984 2008-05-05 Ian Lance Taylor <iant@google.com>
11985
11986 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11987 as noVARNAME rather than no-VARNAME.
11988 (class General_options): Add option -z combreloc.
11989 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11990 get_address.
11991 (Output_reloc::sort_before) [SHT_REL]: New function.
11992 (Output_reloc::sort_before) [SHT_RELA]: New function.
11993 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11994 Sort_relocs_comparison.
11995 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11996 parameter. Change all callers.
11997 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11998 sort_relocs parameter. Change all callers.
11999 * output.cc (Output_reloc::get_address): New function, broken out
12000 of write_rel.
12001 (Output_reloc::write_rel): Call it.
12002 (Output_reloc::compare): New function.
12003 (Output_data_reloc_base::do_write): Optionally sort relocs.
12004
12005 * configure.ac: If targ_extra_obj is set, link it in.
12006 * configure.tgt: Initialize all variables.
12007 (x86_64*): Set targ_extra_obj and targ_extra_size.
12008 * configure: Rebuild.
12009
12010 * object.cc (Sized_relobj::include_section_group): Adjust section
12011 indexes read from group data. Build vector to pass to
12012 layout_group.
12013 * layout.cc (Layout::layout_group): Add flags and shndxes
12014 parameters. Remove contents parameter. Change caller. Update
12015 explicit instantiations.
12016 * layout.h (class Layout): Update layout_group declaration.
12017 * output.cc (Output_data_group::Output_data_group): Add flags and
12018 input_shndxes parameters. Remove contents parameter. Change
12019 caller.
12020 (Output_data_group::do_write): Change input_sections_ to
12021 input_shndxes_.
12022 * output.h (class Output_data_group): Update constructor
12023 declaration. Rename input_sections_ to input_shndxes_.
12024 * testsuite/many_sections_test.cc: Add template.
12025
12026 2008-04-30 Cary Coutant <ccoutant@google.com>
12027
12028 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12029
12030 * layout.cc (Layout::include_section): Refactored check for debug
12031 info section.
12032 (Layout::add_comdat): Add new parameters. Change type
12033 of signature parameter. Add object and shndx to signatures table.
12034 (Layout::find_kept_object): New function.
12035 * layout.h: Include <cstring>.
12036 (Layout::is_debug_info_section): New function.
12037 (Layout::add_comdat): Add new parameters.
12038 (Layout::find_kept_object): New function.
12039 (Layout::Kept_section): New struct.
12040 (Layout::Signatures): Change type of map range.
12041 * object.cc (Relobj::output_section_address): New function.
12042 (Sized_relobj::include_section_group): Add new parameters. Change
12043 calls to Layout::add_comdat. Change to build table of kept comdat
12044 groups and table mapping discarded sections to kept sections.
12045 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12046 (Sized_relobj::do_layout): Change calls to include_section_group and
12047 include_linkonce_section.
12048 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12049 value to zero when section is discarded.
12050 (Sized_relobj::map_to_kept_section): New function.
12051 * object.h (Relobj::output_section_address): New function.
12052 (Relobj::Comdat_group): New type.
12053 (Relobj::find_comdat_group): New function.
12054 (Relobj::Comdat_group_table): New type.
12055 (Relobj::Kept_comdat_section): New type.
12056 (Relobj::Kept_comdat_section_table): New type.
12057 (Relobj::add_comdat_group): New function.
12058 (Relobj::set_kept_comdat_section): New function.
12059 (Relobj::get_kept_comdat_section): New function.
12060 (Relobj::comdat_groups_): New field.
12061 (Relobj::kept_comdat_sections_): New field.
12062 (Symbol_value::input_value): Update comment.
12063 (Sized_relobj::map_to_kept_section) New function.
12064 (Sized_relobj::include_linkonce_section): Add new parameter.
12065 * target-reloc.h (Comdat_behavior): New type.
12066 (get_comdat_behavior): New function.
12067 (relocate_section): Add code to map a discarded section to the
12068 corresponding kept section when applying a relocation.
12069
12070 2008-04-30 Craig Silverstein <csilvers@google.com>
12071
12072 * dwarf_reader.cc (next_generation_count): New static var.
12073 (Addr2line_cache_entry): New struct.
12074 (addr2line_cache): New static var.
12075 (Dwarf_line_info::one_addr2line): Added caching.
12076 (Dwarf_line_info::clear_addr2line_cache): New function.
12077 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12078 cache-size parameter.
12079 (Dwarf_line_info::one_addr2line_cache): New function.
12080 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12081 new cache-size argument to one_addr2line(), and clear cache.
12082
12083 2008-04-28 Cary Coutant <ccoutant@google.com>
12084
12085 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12086 R_386_PC8 relocations.
12087
12088 2008-04-23 Ian Lance Taylor <iant@google.com>
12089
12090 * object.cc (Sized_relobj::include_section_group): Check for
12091 invalid section group.
12092
12093 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12094 header size.
12095
12096 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12097 than read for file header.
12098 * archive.cc (Archive::include_member): Likewise.
12099
12100 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12101
12102 * aclocal.m4: Regenerate.
12103 * configure: Regenerate.
12104
12105 2008-04-19 Ian Lance Taylor <iant@google.com>
12106
12107 * version.cc (version_string): Bump to 1.6.
12108
12109 * testsuite/Makefile.am (many_sections_r_test): New target.
12110 (many_sections_r_test_SOURCES): Remove.
12111 (many_sections_r_test_DEPENDENCIES): Remove.
12112 (many_sections_r_test_LDFLAGS): Remove.
12113 (many_sections_r_test_LDADD): Remove.
12114
12115 * object.cc (Sized_relobj::do_add_symbols): Always pass
12116 local_symbol_count_ to add_from_relobj.
12117
12118 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12119 every thousand variables.
12120 * testsuite/Makefile.in: Rebuild.
12121
12122 * object.cc (Xindex::initialize_symtab_xindex): New function.
12123 (Xindex::read_symtab_xindex): New function.
12124 (Xindex::sym_xindex_to_shndx): New function.
12125 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12126 available.
12127 (Sized_relobj::do_initialize_xindex): New function.
12128 (Sized_relobj::do_read_symbols): Adjust section links.
12129 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12130 parameter. Change all callers.
12131 (Sized_relobj::include_section_group): Adjust section links and
12132 symbol section indexes.
12133 (Sized_relobj::do_layout): Adjust section links.
12134 (Sized_relobj::do_count_local_symbols): Adjust section links and
12135 symbol section indexes.
12136 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12137 ordinary and special symbols.
12138 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12139 dynsym_xindex parameters. Change all callers. Adjust section
12140 links. Use SHN_XINDEX when needed.
12141 (Sized_relobj::get_symbol_location_info): Adjust section links.
12142 Don't get fooled by special symbols.
12143 * object.h (class Xindex): Define.
12144 (class Object): Add xindex_ parameter. Declare virtual functoin
12145 do_initialize_xindex.
12146 (Object::adjust_sym_shndx): New function.
12147 (Object::set_xindex): New protected function.
12148 (class Symbol_value): Add is_ordinary_shndx_ field.
12149 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12150 (Symbol_value::value): Assert ordinary section.
12151 (Symbol_value::initialize_input_to_output_map): Likewise.
12152 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12153 Change all callers.
12154 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12155 all callers.
12156 (class Sized_relobj): Update declarations.
12157 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12158 parameter. Change all callers.
12159 (Sized_relobj::adjust_shndx): New function.
12160 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12161 field.
12162 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12163 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12164 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12165 (Sized_dynobj::read_dynsym_section): Adjust section links.
12166 (Sized_dynobj::read_dynamic): Likewise.
12167 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12168 section links.
12169 (Sized_dynobj::do_initialize_xindex): New function.
12170 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12171 do_initialize_xindex.
12172 (Sized_dynobj::adjust_shndx): New function.
12173 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12174 dynsym_xindex_ fields.
12175 (Layout::finalize): Add a call to set_section_indexes before
12176 creating the symtab sections.
12177 (Layout::set_section_indexes): Don't do anything if the section
12178 already has a section index.
12179 (Layout::create_symtab_sections): Add shnum parameter. Change
12180 caller. Create .symtab_shndx section if needed.
12181 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12182 caller.
12183 (Layout::allocated_output_section_count): New function.
12184 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12185 needed.
12186 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12187 fields. Update declarations.
12188 (Layout::symtab_xindex): New function.
12189 (Layout::dynsym_xindex): New function.
12190 (class Write_symbols_task): Add layout_ field.
12191 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12192 Change caller.
12193 * output.cc (Output_section_headers::Output_section_headers): Add
12194 shstrtab_section parameter. Change all callers.
12195 (Output_section_headers::do_sized_write): Store overflow values
12196 for section count and section string table section index in
12197 section header zero.
12198 (Output_file_header::do_sized_write): Check for overflow of
12199 section count and section string table section index.
12200 (Output_symtab_xindex::do_write): New function.
12201 (Output_symtab_xindex::endian_do_write): New function.
12202 * output.h (class Output_section_headers): Add shstrtab_section_.
12203 Update declarations.
12204 (class Output_symtab_xindex): Define.
12205 (Output_section::has_out_shndx): New function.
12206 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12207 field.
12208 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12209 Change all callers.
12210 (Sized_symbol::init): Likewise.
12211 (Symbol::output_section): Check for ordinary symbol.
12212 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12213 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12214 callers.
12215 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12216 Change all callers. Simplify handling of symbols from sections
12217 not included in the link.
12218 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12219 distinction.
12220 (Weak_alias_sorter::operator()): Assert that symbols are
12221 ordinary.
12222 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12223 distinction.
12224 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12225 parameters. Change all callers.
12226 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12227 symbol distinction. Use SHN_XINDEX when needed.
12228 (Symbol_table::write_section_symbol): Add symtab_xindex
12229 parameter. Change all callers.
12230 (Symbol_table::sized_write_section_symbol): Likewise. Use
12231 SHN_XINDEX when needed.
12232 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12233 declarations.
12234 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12235 (Symbol::is_defined): Check is_ordinary.
12236 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12237 (Symbol::is_absolute, Symbol::is_common): Likewise.
12238 (class Sized_symbol): Update declarations.
12239 (class Symbol_table): Update declarations.
12240 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12241 parameters. Change all callers.
12242 (Sized_symbol::override): Likewise.
12243 (Symbol_table::override): Likewise.
12244 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12245 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12246 is_ordinary, and orig_st_shndx parameters. Change all callers.
12247 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12248 to be in an ordinary section.
12249 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12250 object and is_ordinary parameters. Change all callers.
12251 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12252 Change all callers. Don't add undefined or non-ordinary symbols
12253 to reloc_map_.
12254 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12255 Change all callers.
12256 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12257 declarations.
12258 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12259 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12260 (Sized_relobj::relocate_sections): Likewise.
12261 * target-reloc.h (scan_relocs): Adjust section symbol index.
12262 (scan_relocatable_relocs): Likewise.
12263 * i386.cc (Scan::local): Check for ordinary symbols.
12264 * sparc.cc (Scan::local): Likewise.
12265 * x86_64.cc (Scan::local): Likewise.
12266 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12267 to symbol_section_and_value.
12268 * testsuite/many_sections_test.cc: New file.
12269 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12270 (check_PROGRAMS): Add many_sections_test.
12271 (many_sections_test_SOURCES): Define.
12272 (many_sections_test_DEPENDENCIES): Define.
12273 (many_sections_test_LDFLAGS): Define.
12274 (BUILT_SOURCES): Add many_sections_define.h.
12275 (many_sections_define.h): New target.
12276 (BUILT_SOURCES): Add many_sections_check.h.
12277 (many_sections_check.h): New target.
12278 (check_PROGRAMS): Add many_sections_r_test.
12279 (many_sections_r_test_SOURCES): Define.
12280 (many_sections_r_test_DEPENDENCIES): Define.
12281 (many_sections_r_test_LDFLAGS): Define.
12282 (many_sections_r_test_LDADD): Define.
12283 (many_sections_r_test.o): New target.
12284 * testsuite/Makefile.in: Rebuild.
12285
12286 2008-04-17 Cary Coutant <ccoutant@google.com>
12287
12288 * errors.cc (Errors::info): New function.
12289 (gold_info): New function.
12290 * errors.h (Errors::info): New function.
12291 * gold.h (gold_info): New function.
12292 * object.cc (Input_objects::add_object): Print trace output.
12293 * options.cc (options::parse_set): New function.
12294 (General_options::parse_wrap): Deleted.
12295 (General_options::General_options): Deleted initializer.
12296 * options.h (options::String_set): New typedef.
12297 (options::parse_set): New function.
12298 (DEFINE_set): New macro.
12299 (General_options::wrap): Changed to use DEFINE_set. Changed
12300 callers of any_wrap_symbols and is_wrap_symbol.
12301 (General_options::trace, General_options::trace_symbol):
12302 New options.
12303 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12304 (General_options::wrap_symbols_): Deleted.
12305 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12306
12307 2008-04-17 David S. Miller <davem@davemloft.net>
12308
12309 * options.cc (General_options::parse_V): New function.
12310 * options.h: Add entries for -V and -Qy.
12311
12312 2008-04-17 Ian Lance Taylor <iant@google.com>
12313
12314 * common.cc (Symbol_table::allocate_commons): Remove options
12315 parameter. Change caller.
12316 (Symbol_table::do_allocate_commons): Remove options parameter.
12317 Change caller. Just call do_allocate_commons_list twice.
12318 (Symbol_table::do_allocate_commons_list): New function, broken out
12319 of do_allocate_commons.
12320 * common.h (class Allocate_commons_task): Remove options_ field.
12321 Update constructor.
12322 * symtab.cc (Symbol_table::Symbol_table): Initialize
12323 tls_commons_.
12324 (Symbol_table::add_from_object): Put TLS common symbols on
12325 tls_commons_ list.
12326 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12327 which are IN_OUTPUT_DATA.
12328 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12329 allocate_commons and do_allocate_commons declarations. Declare
12330 do_allocate_commons_list.
12331 * gold.cc (queue_middle_tasks): Update creation of
12332 Allocate_commons_task to not pass options.
12333 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12334 (TLS_TEST_C_FLAGS): New variable.
12335 (tls_test_c_pic.o): New target.
12336 (tls_test_shared.so): Link in tls_test_c_pic.o.
12337 (tls_test_c_pic_ie.o): New target.
12338 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12339 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12340 (tls_test_c.o): New target.
12341 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12342 (tls_pic_test_LDADD): Likewise.
12343 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12344 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12345 (tls_test_c_gnu2.o): New target.
12346 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12347 tls_test_c_gnu2.o.
12348 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12349 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12350 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12351 * testsuite/tls_test.cc: Include "config.h".
12352 (t_last): Call t11_last.
12353 * testsuite/tls_test.h (t11, t11_last): Declare.
12354 * testsuite/tls_test_c.c: New file.
12355 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12356 * configure.ac: Check for OpenMP support.
12357 * configure, config.in, Makefile.in: Rebuild.
12358 * testsuite/Makefile.in: Rebuild.
12359
12360 2008-04-16 Cary Coutant <ccoutant@google.com>
12361
12362 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12363 (Target_i386::tls_base_symbol_defined_): New field.
12364 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12365 (Target_i386::Scan::global): Likewise.
12366 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12367 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12368 (Target_x86_64::tls_base_symbol_defined_): New field.
12369 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12370 (Target_x86_64::Scan::global): Likewise.
12371
12372 2008-04-16 Cary Coutant <ccoutant@google.com>
12373
12374 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12375 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12376 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12377 building shared libraries.
12378 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12379 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12380 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12381 * testsuite/Makefile.in: Rebuild.
12382 * testsuite/weak_undef.h: New file.
12383 * testsuite/weak_undef_file1.cc: Add extra test cases.
12384 * testsuite/weak_undef_file2.cc: Likewise.
12385 * testsuite/weak_undef_test.cc: Likewise.
12386
12387 2008-04-16 David S. Miller <davem@davemloft.net>
12388
12389 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12390 Add issued_non_pic_error_ field. Declare check_non_pic.
12391 (Target_sparc::Scan::check_non_pic): New function.
12392 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12393 (Target_sparc::Scan::global): Likewise.
12394
12395 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12396 * configure: Rebuild.
12397
12398 * options.h (DEFINE_enable): New macro.
12399 (new_dtags): New enable option.
12400 (initfirst, interpose, loadfltr, nodefaultlib,
12401 nodelete, nodlopen, nodump): New -z options.
12402 * layout.cc (Layout:finish_dynamic_section): If new
12403 dtags enabled, emit DT_RUNPATH. Also, emit a
12404 DT_FLAGS_1 containing any specified -z flags.
12405
12406 2008-04-16 Ian Lance Taylor <iant@google.com>
12407
12408 * copy-relocs.cc: New file.
12409 * copy-relocs.h: New file.
12410 * reloc.cc: Remove Copy_relocs code.
12411 * reloc.h: Likewise.
12412 * reloc-types.h (struct Reloc_types) [both versions]: Add
12413 get_reloc_addend_noerror.
12414 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12415 variants of add_global which take an addend which must be zero.
12416 * i386.cc: Include "copy-relocs.h".
12417 (class Target_i386): Change type of copy_relocs_ to variable,
12418 update initializer.
12419 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12420 Change all callers.
12421 (Target_i386::do_finalize_sections): Change handling of
12422 copy_relocs_.
12423 * sparc.cc: Include "copy-relocs.h".
12424 (class Target_sparc): Change type of copy_relocs_ to variable,
12425 update initializer.
12426 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12427 Change all callers.
12428 (Target_sparc::do_finalize_sections): Change handling of
12429 copy_relocs_.
12430 * x86_64.cc: Include "copy-relocs.h".
12431 (class Target_x86_64): Change type of copy_relocs_ to variable,
12432 update initializer.
12433 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12434 class. Change all callers.
12435 (Target_x86_64::do_finalize_sections): Change handling of
12436 copy_relocs_.
12437 * Makefile.am (CCFILES): Add copy-relocs.cc.
12438 (HFILES): Add copy-relocs.h.
12439
12440 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12441
12442 * testsuite/script_test_4.sh: Permit leading zeroes.
12443
12444 2008-04-15 Ian Lance Taylor <iant@google.com>
12445
12446 * script-sections.cc (Script_sections::create_segments): Use
12447 header_size_adjustment even when there is enough room for the
12448 headers.
12449 * testsuite/script_test_4.sh: New file.
12450 * testsuite/script_test_4.t: New file.
12451 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12452 (check_DATA): Add script_test_4.stdout.
12453 (MOSTLYCLEANFILES): Likewise.
12454 (script_test_4): New target.
12455 (script_test_4.stdout): New target.
12456 * testsuite/Makefile.in: Rebuild.
12457
12458 * sparc.cc: Add definitions for Output_data_plt_sparc class
12459 constants.
12460
12461 2008-04-14 David S. Miller <davem@davemloft.net>
12462
12463 * sparc.cc: New file.
12464 * Makefile.am (TARGETSOURCES): Add sparc.cc
12465 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12466 * configure.tgt: Document targ_extra_size and
12467 targ_extra_big_endian. Add entries for sparc-* and
12468 sparc64-*.
12469 * configure.ac: Handle targ_extra_size and
12470 targ_extra_big_endian.
12471 * Makefile.in: Rebuild.
12472 * configure: Likewise.
12473 * po/POTFILES.in: Likewise.
12474 * po/gold.pot: Likewise.
12475
12476 2008-04-14 Ian Lance Taylor <iant@google.com>
12477
12478 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12479 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12480 in the name/type/flags to section mapping. Don't call
12481 allocate_output_section.
12482 (Layout::choose_output_section): Change parameter from adjust_name
12483 to is_input_section. Don't permit input sections after sections
12484 are attached to segments. Don't call allocate_output_section.
12485 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12486 not write_enable_output_section.
12487 (Layout::make_output_section): Don't push to
12488 unattached_section_list_ nor call attach_to_segment. Call
12489 attach_section_to_segment if sections are attached.
12490 (Layout::attach_sections_to_segments): New function.
12491 (Layout::attach_section_to_segment): New function.
12492 (Layout::attach_allocated_section_to_segment): Rename from
12493 attach_to_segment. Remove flags parameter.
12494 (Layout::allocate_output_section): Remove function.
12495 (Layout::write_enable_output_section): Remove function.
12496 * layout.h (class Layout): Update for above changes. Add new
12497 field sections_are_attached_.
12498 * output.h (Output_section::update_flags_for_input_section): New
12499 function.
12500 * output.cc (Output_section::add_input_section): Call
12501 update_flags_for_input_section.
12502 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12503
12504 2008-04-11 Cary Coutant <ccoutant@google.com>
12505
12506 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12507 thought unnecessary.
12508 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12509
12510 2008-04-11 Ian Lance Taylor <iant@google.com>
12511
12512 * output.h (class Output_section_data): Remove inline definition
12513 of set_addralign.
12514 * output.cc (Output_section_data::set_addralign): New function.
12515
12516 2008-04-11 Cary Coutant <ccoutant@google.com>
12517
12518 Add support for TLS descriptors for i386 and x86_64.
12519 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12520 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12521 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12522 GOT_TYPE_TLS_DESC.
12523 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12524 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12525 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12526 relocations.
12527 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12528 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12529 Fix problem with initial-exec relocations.
12530 (Target_i386::Relocate::relocate_tls): Likewise.
12531 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12532 relaxation.
12533 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12534 support for section-plus-offset dynamic table entries.
12535 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12536 (Output_data_dynamic::Dynamic_entry): Add support for
12537 section-plus-offset dynamic table entries.
12538 (Output_data_dynamic::Classification): Likewise.
12539 (Output_data_dynamic::classification_): Renamed offset_.
12540 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12541 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12542 (Target_x86_64::make_plt_section): New function.
12543 (Target_x86_64::reserve_tlsdesc_entries): New function.
12544 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12545 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12546 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12547 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12548 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12549 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12550 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12551 add extra PLT entry for TLS descriptors.
12552 (Output_data_plt_x86_64::got_): New field.
12553 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12554 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12555 fields.
12556 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12557 descriptors.
12558 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12559 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12560 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12561 R_386_TLS_DESC_CALL relocations.
12562 (Target_x86_64::Scan::global): Likewise.
12563 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12564 for TLS descriptors.
12565 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12566 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12567 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12568 GD-to-IE relaxation.
12569 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12570 and TLS_DESCRIPTORS.
12571 * Makefile.in: Rebuild.
12572 * configure: Rebuild.
12573 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12574 (tls_test_shared2.so): New target.
12575 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12576 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12577 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12578 (tls_shared_gd_to_ie_test_LDADD): New variable.
12579 (tls_shared_gnu2_gd_to_ie_test): New target.
12580 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12581 New targets.
12582 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12583 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12584 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12585 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12586 (tls_shared_gnu2_test): New target.
12587 (tls_test_gnu2_shared.so): New target.
12588 (tls_shared_gnu2_test_SOURCES): New variable.
12589 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12590 (tls_shared_gnu2_test_LDFLAGS): New variable.
12591 (tls_shared_gnu2_test_LDADD): New variable.
12592 * testsuite/Makefile.in: Rebuild.
12593 * testsuite/Makefile.
12594
12595 2008-04-11 Ian Lance Taylor <iant@google.com>
12596
12597 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12598 justsyms.t.
12599 * testsuite/Makefile.in: Rebuild.
12600
12601 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12602 long.
12603 * testsuite/script_test_2.cc (main): Adjust test.
12604
12605 2008-04-11 David S. Miller <davem@davemloft.net>
12606 Ian Lance Taylor <iant@google.com>
12607
12608 * options.h (General_options): Add entries for '-Y' and
12609 '-relax'.
12610 * options.cc (General_options:finalize): If -Y was used, add those
12611 entries to the library path instead of the default "/lib" and
12612 "/usr/lib".
12613
12614 2008-04-11 David S. Miller <davem@davemloft.net>
12615
12616 * testsuite/justsyms.t: Start at 0x100.
12617 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12618 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12619 long.
12620 * testsuite/script_test_2.cc: Adjust string and section length
12621 checks.
12622
12623 2008-04-09 Ian Lance Taylor <iant@google.com>
12624
12625 PR gold/5996
12626 * script-sections.cc (Sections_element::allocate_to_segment): Add
12627 orphan parameter.
12628 (Output_section_definition::allocate_to_segment): Likewise.
12629 (Orphan_output_section::allocate_to_segment): Likewise.
12630 (Script_sections::attach_sections_using_phdrs_clause): Don't
12631 propagate non-PT_LOAD segments to orphan sections.
12632 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12633 readelf rather than objdump.
12634 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12635 .interp section and PT_INTERP segment are the same size.
12636 * testsuite/Makefile.in: Rebuild.
12637
12638 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12639 aliases for symbols defined in the same object.
12640 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12641 (weak_alias_test_SOURCES): New variable.
12642 (weak_alias_test_DEPENDENCIES): New variable.
12643 (weak_alias_test_LDFLAGS): New variable.
12644 (weak_alias_test_LDADD): New variable.
12645 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12646 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12647 (weak_alias_test_3.o): New target.
12648 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12649 * testsuite/weak_alias_test_main.cc: New file.
12650 * testsuite/weak_alias_test_1.cc: New file.
12651 * testsuite/weak_alias_test_2.cc: New file.
12652 * testsuite/weak_alias_test_3.cc: New file.
12653
12654 2008-04-08 Ian Lance Taylor <iant@google.com>
12655
12656 * options.h (class General_options): Add --noinhibit-exec option.
12657 * main.cc (main): Check --noinhibit-exec.
12658
12659 * options.h (class General_options): Define --wrap as a special
12660 option. Add wrap_symbols_ field.
12661 (General_options::any_wrap_symbols): New function.
12662 (General_options::is_wrap_symbol): New function.
12663 * options.cc (General_options::parse_wrap): New function.
12664 (General_options::General_options): Initialize wrap_symbols_.
12665 * symtab.cc (Symbol_table::wrap_symbol): New function.
12666 (Symbol_table::add_from_object): Handle --wrap.
12667 * symtab.h (class Symbol_table): Declare wrap_symbol.
12668 * target.h (Target::wrap_char): New function.
12669 (Target::Target_info): Add wrap_char field.
12670 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12671 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12672 * testsuite/testfile.cc (Target_test::test_target_info):
12673 Likewise.
12674
12675 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12676 there is one.
12677
12678 * layout.h (class Layout): Add added_eh_frame_data_ field.
12679 * layout.cc (Layout::Layout): Initialize new field.
12680 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12681 output section until we find a section we merged successfully.
12682 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12683 that the size be non-zero.
12684
12685 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12686 qualifier.
12687
12688 2008-04-08 Craig Silverstein <csilvers@google.com>
12689
12690 * configure.ac: Export new conditional variable HAVE_ZLIB.
12691 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12692 on HAVE_ZLIB.
12693 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12694 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12695
12696 2008-04-07 Ian Lance Taylor <iant@google.com>
12697
12698 * version.cc (version_string): Set to "1.5".
12699
12700 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12701 Add issued_non_pic_error_ field. Declare check_non_pic.
12702 (Target_x86_64::Scan::check_non_pic): New function.
12703 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12704 (Target_x86_64::Scan::global): Likewise.
12705
12706 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12707 addend parameter. Change caller. Handle merge sections.
12708 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12709 Address to Addend. Don't add in the result of
12710 local_section_offset, pass down the addend and use the returned
12711 value.
12712 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12713 Update declarations of local_section_offset and symbol_value.
12714 * testsuite/two_file_test_1.cc (t18): New function.
12715 * testsuite/two_file_test_2.cc (f18): New function.
12716 * testsuite/two_file_test_main.cc (main): Call t18.
12717 * testsuite/two_file_test.h (t18, f18): Declare.
12718
12719 * configure.ac: Don't test for objdump, c++filt, or readelf.
12720 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12721 conditionals.
12722 (TEST_READELF): New variable.
12723 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12724 (check_PROGRAMS): Add two_file_strip_test.
12725 (two_file_strip_test): New target.
12726 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12727 (two_file_same_shared_strip_test_SOURCES): New variable.
12728 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12729 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12730 (two_file_same_shared_strip_test_LDADD): New variable.
12731 (two_file_shared_strip.so): New target.
12732 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12733 (ver_test_5.syms, ver_test_7.syms): Likewise.
12734 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12735 (strip_test_3.stdout): Use TEST_OBJDUMP.
12736 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12737
12738 2008-04-04 Cary Coutant <ccoutant@google.com>
12739
12740 * symtab.h (Symbol::is_weak_undefined): New function.
12741 (Symbol::is_strong_undefined): New function.
12742 (Symbol::is_absolute): New function.
12743 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12744 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12745 absolute symbols.
12746 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12747 (weak_undef_test): New target.
12748 * testsuite/Makefile.in: Rebuild.
12749 * testsuite/weak_undef_file1.cc: New file.
12750 * testsuite/weak_undef_file2.cc: New file.
12751 * testsuite/weak_undef_test.cc: New file.
12752
12753 2008-04-03 Craig Silverstein <csilvers@google.com>
12754
12755 * compressed_output.h (class Output_compressed_section): Use
12756 unsigned buffer.
12757 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12758 add zlib header.
12759 (zlib_compressed_suffix): Removed.
12760 (Output_compressed_section::set_final_data_size): Use unsigned
12761 buffers.
12762 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12763 Fix linker invocation.
12764 (flagstest_o_specialfile_and_compress_debug_sections):
12765 Likewise.
12766 * testsuite/Makefile.in: Regenerated.
12767
12768 2008-04-02 David S. Miller <davem@davemloft.net>
12769
12770 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12771 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12772
12773 2008-04-02 Craig Silverstein <csilvers@google.com>
12774
12775 * TODO: New file.
12776
12777 2008-04-02 Ian Lance Taylor <iant@google.com>
12778
12779 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12780 parameters. Update for new key type to views_. Change all
12781 callers.
12782 (File_read::read): Adjust for byteshift in returned view.
12783 (File_read::add_view): New function, broken out of
12784 find_and_make_view.
12785 (File_read::make_view): New function, broken out of
12786 find_and_make_view.
12787 (File_read::find_or_make_view): Add offset and aligned
12788 parameters. Rewrite accordingly. Change all callers.
12789 (File_read::get_view): Add offset and aligned parameters. Adjust
12790 for byteshift in return value.
12791 (File_read::get_lasting_view): Likewise.
12792 * fileread.h (class File_read): Update declarations.
12793 (class File_read::View): Add byteshift_ field. Add byteshift to
12794 constructor. Add byteshift method.
12795 * archive.h (Archive::clear_uncached_views): New function.
12796 (Archive::get_view): Add aligned parameter. Change all callers.
12797 * object.h (Object::get_view): Add aligned parameter. Change all
12798 callers.
12799 (Object::get_lasting_view): Likewise.
12800
12801 * fileread.cc (File_read::release): Don't call clear_views if
12802 there are multiple objects.
12803 * fileread.h (File_read::clear_uncached_views): New function.
12804 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12805 on the archive.
12806
12807 2008-03-31 Cary Coutant <ccoutant@google.com>
12808
12809 Add thin archive support.
12810 * archive.cc (Archive::armagt): New const.
12811 (Archive::setup): Remove task parameter and calls to unlock.
12812 (Archive::unlock_nested_archives): New function.
12813 (Archive::read_header): Add nested_off parameter. Change
12814 all callers.
12815 (Archive::interpret_header): Likewise.
12816 (Archive::include_all_members): Change to handle thin
12817 archives.
12818 (Archive::include_member): Likewise.
12819 * archive.h (Archive::Archive): Add new parameters and
12820 initializers.
12821 (Archive::armagt): New const.
12822 (Archive::setup): Remove task parameter.
12823 (Archive::unlock_nested_archives): New function.
12824 (Archive::read_header): Add nested_off parameter.
12825 (Archive::interpret_header): Likewise.
12826 (Archive::Nested_archive_table): New typedef.
12827 (Archive::is_thin_archive_): New field.
12828 (Archive::nested_archives_): New field.
12829 (Archive::options_): New field.
12830 (Archive::dirpath_): New field.
12831 (Archive::task_): New field.
12832 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12833 for thin archives. Pass additional parameters to
12834 Archive::Archive. Unlock the archive file after calling
12835 Archive::setup.
12836
12837 2008-03-29 Ian Lance Taylor <iant@google.com>
12838
12839 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12840 version symbol to be local.
12841 * testsuite/ver_test_4.sh: New file.
12842 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12843 (check_DATA): Add ver_test_4.syms.
12844 (ver_test_4.syms): New target.
12845 * testsuite/Makefile.in: Rebuild.
12846
12847 * output.cc
12848 (Output_section::Input_section_sort_entry::has_priority): New
12849 function.
12850 (Output_section::Input_section_sort_entry::match_file_name): New
12851 function.
12852 (Output_section::Input_section_sort_entry::match_section_name):
12853 Remove.
12854 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12855 Remove.
12856 (Output_section::Input_section_sort_entry::match_section_file):
12857 Remove.
12858 (Output_section::Input_section_sort_compare::operator()): Rewrite
12859 using new Input_section_sort_entry functions. Sort crtbegin and
12860 crtend first. Sort sections with no priority before sections with
12861 a priority.
12862 * testsuite/initpri1.c (d3): Check j != 4.
12863 (cd5): New constructor/destructor function.
12864 (main): Check j != 2.
12865
12866 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12867 new symbol when resolving, don't call set_is_default.
12868 * testsuite/ver_test_7.cc: New file.
12869 * testsuite/ver_test_7.sh: New file.
12870 * testsuite/Makefile.am (ver_test_7.so): New target.
12871 (ver_test_7.o): New target.
12872 (check_SCRIPTS): Add ver_test_7.sh.
12873 (check_DATA): Add ver_test_7.syms.
12874 (ver_test_7.syms): New target.
12875
12876 2008-03-28 Ian Lance Taylor <iant@google.com>
12877
12878 * layout.cc (Layout::layout): If we see an input section with a
12879 name that needs sorting, set the must_sort flag for the output
12880 section.
12881 (Layout::make_output_section): If the name of the output section
12882 indicates that it might require sorting, set the may_sort flag.
12883 * output.h (Output_section::may_sort_attached_input_sections): New
12884 function.
12885 (Output_section::set_may_sort_attached_input_sections): New
12886 function.
12887 (Output_section::must_sort_attached_input_sections): New
12888 function.
12889 (Output_section::set_must_sort_attached_input_sections): New
12890 function.
12891 (class Output_section): Declare Input_section_sort_entry. Define
12892 Input_section_sort_compare. Declare
12893 sort_attached_input_sections. Add new fields:
12894 may_sort_attached_input_sections_,
12895 must_sort_attached_input_sections_,
12896 attached_input_sections_are_sorted_.
12897 * output.cc (Output_section::Output_section): Initialize new
12898 fields.
12899 (Output_section::add_input_section): Add an entry to
12900 input_sections_ if may_sort or must_sort are true.
12901 (Output_section::set_final_data_size): Call
12902 sort_attached_input_sections if necessary.
12903 (Output_section::Input_section_sort_entry): Define new class.
12904 (Output_section::Input_section_sort_compare::operator()): New
12905 function.
12906 (Output_section::sort_attached_input_sections): New function.
12907 * configure.ac: Check whether the compiler supports constructor
12908 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12909 * testsuite/initpri1.c: New file.
12910 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12911 CONSTRUCTOR_PRIORITY.
12912 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12913 (initpri1_LDFLAGS): New variable.
12914 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12915
12916 2008-03-27 Ian Lance Taylor <iant@google.com>
12917
12918 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12919 * testsuite/common_test_1.c: New file.
12920 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12921 (common_test_1_SOURCES): New variable.
12922 (common_test_1_DEPENDENCIES): New variable.
12923 (common_test_1_LDFLAGS): New variable.
12924
12925 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12926 and commons_ correctly when NAME/VERSION does not override
12927 NAME/NULL.
12928 * testsuite/ver_test_6.c: New file.
12929 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12930 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12931 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12932
12933 2008-03-26 Ian Lance Taylor <iant@google.com>
12934
12935 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12936 of an undefined symbol from a version script.
12937 * testsuite/Makefile.am (ver_test_5.so): New target.
12938 (ver_test_5.o): New target.
12939 (check_SCRIPTS): Add ver_test_5.sh.
12940 (check_DATA): Add ver_test_5.syms.
12941 (ver_test_5.syms): New target.
12942 * testsuite/ver_test_5.cc: New file.
12943 * testsuite/ver_test_5.script: New file.
12944 * testsuite/ver_test_5.sh: New file.
12945 * Makefile.in, testsuite/Makefile.in: Rebuild.
12946
12947 PR gold/5986
12948 Fix problems building gold with gcc 4.3.0.
12949 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12950 (gold_error_at_location, gold_warning_at_location): Use it.
12951 * configure.ac: Check whether we can compile and use a template
12952 function with a printf attribute.
12953 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12954 when jumping over bytes.
12955 * object.cc: Instantiate Object::read_section_data.
12956 * debug.h: Include <cstring>
12957 * dwarf_reader.cc: Include <algorithm>
12958 * main.cc: Include <cstring>.
12959 * options.cc: Include <cstring>.
12960 * output.cc: Include <cstring>.
12961 * script.cc: Include <cstring>.
12962 * script.h: Include <string>.
12963 * symtab.cc: Include <cstring> and <algorithm>.
12964 * target-select.cc: Include <cstring>.
12965 * version.cc: Include <string>.
12966 * testsuite/testmain.cc: Include <cstdlib>.
12967 * configure, config.in: Rebuild.
12968
12969 2008-03-25 Ian Lance Taylor <iant@google.com>
12970
12971 * options.cc: Include "../bfd/bfdver.h".
12972 (options::help): Print bug reporting address.
12973
12974 * version.cc (print_version): Adjust output for current value of
12975 BFD_VERSION_STRING.
12976
12977 * NEWS: New file.
12978
12979 * options.cc (options::help): Print list of supported targets.
12980 * target-select.h: Include <vector>.
12981 (class Target_selector): Make machine_, size_, and is_big_endian_
12982 fields const. Add bfd_name_ and instantiated_target_ fields.
12983 (Target_selector::Target_selector): Add bfd_name parameter.
12984 (Target_selector::recognize): Make non-virtual, call
12985 do_recognize.
12986 (Target_selector::recognize_by_name): Make non-virtual, call
12987 do_recognize_by_name.
12988 (Target_selector::supported_names): New function.
12989 (Target_selector::bfd_name): New function.
12990 (Target_selector::do_instantiate_target): New pure virtual
12991 function.
12992 (Target_selector::do_recognize): New virtual function.
12993 (Target_selector::do_recognize_by_name): New virtual function.
12994 (Target_selector::instantiate_target): New private function.
12995 (supported_target_names): Declare.
12996 * target-select.cc (Target_selector::Target_selector): Update for
12997 new parameter and fields.
12998 (select_target_by_name): Check that the name matches before
12999 calling recognize_by_name.
13000 (supported_target_names): New function.
13001 * i386.cc (class Target_selector_i386): Update Target_selector
13002 constructor call. Remove recognize and recognize_by_name. Add
13003 do_instantiate_target.
13004 * x86_64.cc (class Target_selector_x86_64): Likewise.
13005 * testsuite/testfile.cc (class Target_selector_test): Update for
13006 changes to Target_selector.
13007
13008 * README: Rewrite, with some notes on unsupported features.
13009
13010 2008-03-24 Cary Coutant <ccoutant@google.com>
13011
13012 * i386.cc (Target_i386::Got_type): New enum declaration.
13013 (Target_i386::Scan::local): Updated callers of Output_data_got
13014 member functions.
13015 (Target_i386::Scan::global): Likewise.
13016 (Target_i386::Relocate::relocate): Likewise.
13017 (Target_i386::Relocate::relocate_tls): Likewise.
13018 * object.h (Got_offset_list): New class.
13019 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13020 (Sized_relobj::local_got_offset): Likewise.
13021 (Sized_relobj::set_local_got_offset): Likewise.
13022 (Sized_relobj::local_has_tls_got_offset): Removed.
13023 (Sized_relobj::local_tls_got_offset): Removed.
13024 (Sized_relobj::set_local_tls_got_offset): Removed.
13025 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13026 * output.cc (Output_data_got::add_global): Added got_type parameter.
13027 (Output_data_got::add_global_with_rel): Likewise.
13028 (Output_data_got::add_global_with_rela): Likewise.
13029 (Output_data_got::add_global_pair_with_rel): New function.
13030 (Output_data_got::add_global_pair_with_rela): New function.
13031 (Output_data_got::add_local): Added got_type parameter.
13032 (Output_data_got::add_local_with_rel): Likewise.
13033 (Output_data_got::add_local_with_rela): Likewise.
13034 (Output_data_got::add_local_pair_with_rel): New function.
13035 (Output_data_got::add_local_pair_with_rela): New function.
13036 (Output_data_got::add_global_tls): Removed.
13037 (Output_data_got::add_global_tls_with_rel): Removed.
13038 (Output_data_got::add_global_tls_with_rela): Removed.
13039 (Output_data_got::add_local_tls): Removed.
13040 (Output_data_got::add_local_tls_with_rel): Removed.
13041 (Output_data_got::add_local_tls_with_rela): Removed.
13042 * output.h (Output_data_got::add_global): Added got_type parameter.
13043 (Output_data_got::add_global_with_rel): Likewise.
13044 (Output_data_got::add_global_with_rela): Likewise.
13045 (Output_data_got::add_global_pair_with_rel): New function.
13046 (Output_data_got::add_global_pair_with_rela): New function.
13047 (Output_data_got::add_local): Added got_type parameter.
13048 (Output_data_got::add_local_with_rel): Likewise.
13049 (Output_data_got::add_local_with_rela): Likewise.
13050 (Output_data_got::add_local_pair_with_rel): New function.
13051 (Output_data_got::add_local_pair_with_rela): New function.
13052 (Output_data_got::add_global_tls): Removed.
13053 (Output_data_got::add_global_tls_with_rel): Removed.
13054 (Output_data_got::add_global_tls_with_rela): Removed.
13055 (Output_data_got::add_local_tls): Removed.
13056 (Output_data_got::add_local_tls_with_rel): Removed.
13057 (Output_data_got::add_local_tls_with_rela): Removed.
13058 * resolve.cc (Symbol::override_base_with_special): Removed
13059 reference to has_got_offset_ field.
13060 * symtab.cc (Symbol::init_fields): Replaced initialization
13061 of got_offset_ with got_offsets_. Removed initialization
13062 of has_got_offset_
13063 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13064 (Symbol::got_offset): Likewise.
13065 (Symbol::set_got_offset): Likewise.
13066 (Symbol::has_tls_got_offset): Removed.
13067 (Symbol::tls_got_offset): Removed.
13068 (Symbol::set_tls_got_offset): Removed.
13069 (Symbol::got_offset_): Removed.
13070 (Symbol::tls_mod_got_offset_): Removed.
13071 (Symbol::tls_pair_got_offset_): Removed.
13072 (Symbol::got_offsets_): New field.
13073 (Symbol::has_got_offset): Removed.
13074 (Symbol::has_tls_mod_got_offset): Removed.
13075 (Symbol::has_tls_pair_got_offset): Removed.
13076 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13077 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13078 member functions.
13079 (Target_x86_64::Scan::global): Likewise.
13080 (Target_x86_64::Relocate::relocate): Likewise.
13081 (Target_x86_64::Relocate::relocate_tls): Likewise.
13082
13083 2008-03-25 Ben Elliston <bje@au.ibm.com>
13084
13085 * yyscript.y: Fix spelling error in comment.
13086
13087 2008-03-24 Ian Lance Taylor <iant@google.com>
13088
13089 * options.h (class General_options): Define build_id option.
13090 * layout.h (class Layout): Declare write_build_id, create_note,
13091 create_build_id. Add build_id_note_ member.
13092 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13093 "libiberty.h", "md5.h", "sha1.h".
13094 (Layout::Layout): Initialize eh_frame_data_,
13095 eh_frame_hdr_section_, and build_id_note_.
13096 (Layout::finalize): Call create_build_id.
13097 (Layout::create_note): New function, broken out of
13098 Layout::create_gold_note.
13099 (Layout::create_gold_note): Call create_note.
13100 (Layout::create_build_id): New function.
13101 (Layout::write_build_id): New function.
13102 (Close_task_runner::run): Call write_build_id.
13103
13104 * x86_64.cc: Correct license to GPLv3.
13105
13106 2008-03-23 Ian Lance Taylor <iant@google.com>
13107
13108 * options.cc: Include "demangle.h".
13109 (parse_optional_string): New function.
13110 (parse_long_option): Handle takes_optional_argument.
13111 (parse_short_option): Update dash_z initializer. Handle
13112 takes_optional_argument.
13113 (General_options::General_options): Initialize do_demangle_.
13114 (General_options::finalize): Set do_demangle_. Handle demangling
13115 style.
13116 * options.h (parse_optional_string): Declare.
13117 (struct One_option): Add optional_arg field. Update constructor.
13118 Update call constructor calls. Add takes_optional_argument
13119 function.
13120 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13121 (DEFINE_optional_string): Define.
13122 (General_options::demangle): Change from DEFINE_bool to
13123 DEFINE_optional_string.
13124 (General_options::no_demangle): New function.
13125 (General_options::do_demangle): New function.
13126 (General_options::set_do_demangle): New function.
13127 (General_options::execstack_status_): Move definition to end of
13128 class definition.
13129 (General_options::static_): Likewise.
13130 (General_options::do_demangle_): New field.
13131 * object.cc (big_endian>::get_symbol_location_info): Call
13132 Options::do_demangle, not Options::demangle.
13133 * symtab.cc (demangle): Likewise.
13134
13135 2008-03-22 Ian Lance Taylor <iant@google.com>
13136
13137 * gold.h: Include <cstddef> and <sys/types.h>
13138 * options.h: Include <cstring>.
13139
13140 2008-03-21 Ian Lance Taylor <iant@google.com>
13141
13142 * Added source code to GNU binutils.
This page took 0.318154 seconds and 4 git commands to generate.