Handle ARM-specific --target1-abs, --target1-rel and --target2 options
[binutils-gdb.git] / gold / ChangeLog
1 2016-09-02 Doug Kwan <dougkwan@google.com>
2
3 * arm.cc (Target_arm::Target_arm): Move method definition outside of
4 class definition. Add code to handle --target1-rel, --target1-abs
5 and --target2= options.
6 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7 and const.
8 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9 member declaration.
10 (Target_arm::Scan::local, Target_arm::Scan::global,
11 Target_arm::Relocate::relocate,
12 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
13 call to Target_arm::get_real_reloc_type.
14 (Target_arm::get_real_reloc_type): Use command line options to
15 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
16 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
17 options.
18
19 2016-08-31 Alan Modra <amodra@gmail.com>
20
21 * powerpc.cc (class Stub_control): Delete stub14_group_size_
22 and has14_. Add group_size_.
23 (Stub_control::can_add_to_stub_group): Adjust to suit. Print
24 debug info when switching to adding sections before stubs.
25
26 2016-08-31 Alan Modra <amodra@gmail.com>
27
28 * debug.h (DEBUG_TARGET): New.
29 (DEBUG_ALL): Add DEBUG_TARGET.
30 (gold_debug): Delete FORMAT param.
31 * powerpc.cc (Stub_control::can_add_to_stub_group): Print debug ourput.
32
33 2016-08-30 Alan Modra <amodra@gmail.com>
34
35 PR 20523
36 * powerpc.cc (class Stub_control): Add has14_. Comment owner_.
37 (Stub_control::can_add_to_stub_group): Correct grouping of
38 sections containing 14-bit external branches. When returning
39 false, set state_ to reflect the fact that we have one section
40 for the next group. Rewrite most of function for clarity.
41 Add and expand comments.
42 (Target_powerpc::do_relax): Print stub group size retry in hex.
43
44 2016-08-26 Han Shen <shenhan@google.com>
45
46 PR gold/20529 - relaxing loop never ends.
47
48 * powerpc.cc (Stub_table::min_size_threshold_): New member to
49 limit size.
50 (Stub_table::set_min_size_threshold): New member function.
51 (Stub_table::set_address_and_size): Add code to only allow size
52 increase.
53 (Target_powerpc::do_relax): Add code to record last size.
54
55 2016-08-23 Roland McGrath <roland@hack.frob.com>
56
57 * options.h (General_options): Grok -z stack-size.
58 * output.h (Output_segment::set_size): New method.
59 * layout.cc (Layout::create_executable_stack_info): Renamed to ...
60 (Layout::create_stack_segment): ... this. Always create the
61 segment if -z stack-size was used.
62 (Layout::set_segment_offsets): Don't call ->set_offset on the
63 PT_GNU_STACK segment.
64
65 2016-08-15 Bharathi Seshadri <bseshadr@cisco.com>
66
67 * options.h (General_options): Add --be8 option.
68 * arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
69 (Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
70 (Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
71 (Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
72 (Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
73
74 2016-08-17 Cary Coutant <ccoutant@gmail.com>
75
76 * i386.cc (Target_i386): Reset skip_call_tls_get_addr_ after printing
77 error message.
78 * testsuite/Makefile.am (pr20216a): Add missing dependencies.
79 (pr20308a): Add -Bgcctestdir/ to compile rules.
80 * testsuite/Makefile.in: Regenerate.
81
82 2016-08-12 Roland McGrath <roland@hack.frob.com>
83
84 PR gold/20462
85 * script-sections.cc (Script_sections::release_segments):
86 Reset this->segments_created_.
87
88 2016-08-12 Roland McGrath <roland@hack.frob.com>
89
90 * yyscript.y (HIDDEN): New %token.
91 (assignment): Handle HIDDEN(string = expr) syntax.
92 * script.cc (script_keyword_parsecodes): Add HIDDEN.
93
94 2016-08-10 Cary Coutant <ccoutant@gmail.com>
95
96 PR gold/20216
97 * x86_64.cc (Target_x86_64::Relocate::relocate): Add check for
98 R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing
99 error message.
100 * testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/.
101 (pr20216_ld.o): Likewise.
102 * testsuite/Makefile.in: Regenerate.
103
104 2016-08-10 James Clarke <jrtc27@jrtc27.com>
105
106 PR gold/20443
107 * symtab.cc (Symbol_table::add_from_relobj): Handle NULL symbols,
108 which will be present for STT_SPARC_REGISTER.
109 (Symbol_table::add_from_pluginobj): Likewise.
110 (Symbol_table::add_from_dynobj): Likewise.
111 (Symbol_table::add_from_incrobj): Removed dead code.
112
113 2016-08-10 James Clarke <jrtc27@jrtc27.com>
114
115 PR gold/20442
116 * sparc.cc (Target_sparc::Relocate::relocate): R_SPARC_GOTDATA_OP_LOX10
117 should fall back on R_SPARC_GOT10, not R_SPARC_GOT13.
118
119 2016-08-10 James Clarke <jrtc27@jrtc27.com>
120
121 PR gold/20441
122 * sparc.cc (Target_sparc::Scan::check_non_pic): Allow R_SPARC_32 on
123 sparc64.
124
125 2016-06-29 Cary Coutant <ccoutant@gmail.com>
126
127 PR gold/20310
128 * testsuite/dynamic_list.sh: Remove check for _ZdlPv.
129
130 2016-06-29 Cary Coutant <ccoutant@gmail.com>
131
132 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add eh_test_2.
133 * testsuite/Makefile.in: Regenerate.
134
135 2016-06-30 Alan Modra <amodra@gmail.com>
136
137 * testsuite/Makefile.am (memory_test, memory_test_2): Pass
138 -Wl,-z to gcc, not plain -z.
139 * testsuite/Makefile.in: Regenerate.
140
141 2016-06-29 H.J. Lu <hongjiu.lu@intel.com>
142
143 PR gold/20308
144 * i386.cc (Target_i386::Relocate::relocate): Allow
145 R_386_GOT32X relocation against ___tls_get_addr.
146 (Target_i386::Relocate::tls_gd_to_ie): Support indirect
147 call to __tls_get_addr.
148 (Target_i386::Relocate::tls_gd_to_le): Likewise.
149 (Target_i386::Relocate::tls_ld_to_le): Likewise.
150 * testsuite/Makefile.am (check_PROGRAMS): Add pr20308a_test,
151 pr20308b_test, pr20308c_test, pr20308d_test, pr20308e_test.
152 (pr20308a_test_SOURCES): New.
153 (pr20308a_test_DEPENDENCIES): Likewise.
154 (pr20308a_test_CFLAGS): Likewise.
155 (pr20308a_test_LDFLAGS): Likewise.
156 (pr20308a_test_LDADD): Likewise.
157 (pr20308b_test_SOURCES): Likewise.
158 (pr20308b_test_DEPENDENCIES): Likewise.
159 (pr20308b_test_CFLAGS): Likewise.
160 (pr20308b_test_LDFLAGS): Likewise.
161 (pr20308b_test_LDADD): Likewise.
162 (pr20308c_test_SOURCES): Likewise.
163 (pr20308c_test_DEPENDENCIES): Likewise.
164 (pr20308c_test_CFLAGS): Likewise.
165 (pr20308c_test_LDFLAGS): Likewise.
166 (pr20308c_test_LDADD): Likewise.
167 (pr20308d_test_SOURCES): Likewise.
168 (pr20308d_test_DEPENDENCIES): Likewise.
169 (pr20308d_test_CFLAGS): Likewise.
170 (pr20308d_test_LDFLAGS): Likewise.
171 (pr20308d_test_LDADD): Likewise.
172 (pr20308e_test_SOURCES): Likewise.
173 (pr20308e_test_DEPENDENCIES): Likewise.
174 (pr20308e_test_CFLAGS): Likewise.
175 (pr20308e_test_LDFLAGS): Likewise.
176 (pr20308e_test_LDADD): Likewise.
177 (pr20308a.so): Likewise.
178 (pr20308b.so): Likewise.
179 (pr20308_gd.o): Likewise.
180 (pr20308_ld.o): Likewise.
181 (MOSTLYCLEANFILES): Add pr20308a.so pr20308b.so.
182 * testsuite/Makefile.in: Regenerated.
183 * testsuite/pr20308_def.c: New file.
184 * testsuite/pr20308_gd.S: Likewise.
185 * testsuite/pr20308_ld.S: Likewise.
186 * testsuite/pr20308_main.c: Likewise.
187
188 2016-06-29 H.J. Lu <hongjiu.lu@intel.com>
189
190 PR gold/20216
191 * configure.ac (DEFAULT_TARGET_X86_64_OR_X32): New
192 AM_CONDITIONAL.
193 * configure: Regenerated.
194 * x86_64.cc (Target_x86_64<size>::Relocate::relocate): Allow
195 R_X86_64_GOTPCRELX relocation against __tls_get_addr.
196 (Target_x86_64<size>::Relocate::tls_gd_to_ie): Support indirect
197 call to __tls_get_addr.
198 (Target_x86_64<size>::Relocate::tls_gd_to_le): Likewise.
199 (Target_x86_64<size>::Relocate::tls_ld_to_le): Likewise.
200 * testsuite/Makefile.am (check_PROGRAMS): Add pr20216a_test,
201 pr20216b_test, pr20216c_test, pr20216d_test, pr20216e_test.
202 (pr20216a_test_SOURCES): New.
203 (pr20216a_test_DEPENDENCIES): Likewise.
204 (pr20216a_test_CFLAGS): Likewise.
205 (pr20216a_test_LDFLAGS): Likewise.
206 (pr20216a_test_LDADD): Likewise.
207 (pr20216b_test_SOURCES): Likewise.
208 (pr20216b_test_DEPENDENCIES): Likewise.
209 (pr20216b_test_CFLAGS): Likewise.
210 (pr20216b_test_LDFLAGS): Likewise.
211 (pr20216b_test_LDADD): Likewise.
212 (pr20216c_test_SOURCES): Likewise.
213 (pr20216c_test_DEPENDENCIES): Likewise.
214 (pr20216c_test_CFLAGS): Likewise.
215 (pr20216c_test_LDFLAGS): Likewise.
216 (pr20216c_test_LDADD): Likewise.
217 (pr20216d_test_SOURCES): Likewise.
218 (pr20216d_test_DEPENDENCIES): Likewise.
219 (pr20216d_test_CFLAGS): Likewise.
220 (pr20216d_test_LDFLAGS): Likewise.
221 (pr20216d_test_LDADD): Likewise.
222 (pr20216e_test_SOURCES): Likewise.
223 (pr20216e_test_DEPENDENCIES): Likewise.
224 (pr20216e_test_CFLAGS): Likewise.
225 (pr20216e_test_LDFLAGS): Likewise.
226 (pr20216e_test_LDADD): Likewise.
227 (pr20216a.so): Likewise.
228 (pr20216b.so): Likewise.
229 (pr20216_gd.o): Likewise.
230 (pr20216_ld.o): Likewise.
231 (MOSTLYCLEANFILES): Add pr20216a.so pr20216b.so.
232 * testsuite/Makefile.in: Regenerated.
233 * testsuite/pr20216_def.c: New file.
234 * testsuite/pr20216_gd.S: Likewise.
235 * testsuite/pr20216_ld.S: Likewise.
236 * testsuite/pr20216_main.c: Likewise.
237
238 2016-06-29 Alan Modra <amodra@gmail.com>
239
240 * script_test_12.t: Delete .plt, specify 64k page size.
241 * script_test_12i.t: Likewise.
242
243 2016-06-29 Alan Modra <amodra@gmail.com>
244
245 * testsuite/plugin_layout_with_alignment.c: Explicitly align all
246 variables.
247
248 2016-06-29 Alan Modra <amodra@gmail.com>
249
250 * testsuite/Makefile.am (copy_test_protected): Disable for powerpc.
251 * testsuite/Makefile.in: Regenerate.
252
253 2016-06-28 Igor Kudrin <ikudrin@accesssoftek.com>
254
255 * aarch64-reloc.def (NONE): New relocation.
256 * aarch64.cc (Target_aarch64::Scan::local): Handle R_AARCH64_NONE.
257 (Target_aarch64::Scan::global): Likewise.
258 * testsuite/Makefile.am (aarch64_reloc_none): New test.
259 * testsuite/Makefile.in: Regenerate.
260 * testsuite/aarch64_reloc_none.s: New test source file.
261 * testsuite/aarch64_reloc_none.sh: New test script.
262
263 2016-06-28 Sriraman Tallam <tmsriram@google.com>
264
265 * x86_64.cc (Lazy_view): New class.
266 (can_convert_mov_to_lea): Templatize function. Make the function
267 check for appropriate relocation types and use the view parameter
268 to get section contents.
269 (can_convert_callq_to_direct): New function.
270 (Target_x86_64<size>::Scan::global): Refactor.
271 (Target_x86_64<size>::Relocate::relocate): Refactor. Change any indirect
272 call via GOT that can be converted.
273 * testsuite/Makefile.am (x86_64_indirect_call_to_direct.sh): New test.
274 * testsuite/Makefile.in: Regenerate.
275 * testsuite/x86_64_indirect_call_to_direct1.s: New file.
276 * testsuite/x86_64_indirect_jump_to_direct1.s: New file.
277
278 2016-06-28 Igor Kudrin <ikudrin@accesssoftek.com>
279
280 * aarch64.cc (Target_aarch64::Scan::local): Move the call to got_section
281 from the top level to the places of its use.
282
283 2016-06-28 Igor Kudrin <ikudrin@accesssoftek.com>
284
285 PR gold/18098
286 * script-c.h (Sort_wildcard): Add SORT_WILDCARD_BY_INIT_PRIORITY.
287 * script-sections.cc (Input_section_sorter::get_init_priority): New method.
288 (Input_section_sorter::operator()): Handle SORT_WILDCARD_BY_INIT_PRIORITY.
289 (Output_section_element_input::print): Likewise.
290 * script.cc (script_keyword_parsecodes): Add entry SORT_BY_INIT_PRIORITY.
291 * yyscript.y (SORT_BY_INIT_PRIORITY): New token.
292 (wildcard_section): Handle SORT_BY_INIT_PRIORITY.
293
294 * testsuite/Makefile.am (script_test_14): New test.
295 * testsuite/Makefile.in: Regenerate.
296 * testsuite/script_test_14.s: New test source file.
297 * testsuite/script_test_14.sh: New test script.
298 * testsuite/script_test_14.t: New test linker script.
299
300 2016-06-28 James Clarke <jrtc27@jrtc27.com>
301
302 * sparc.cc (Target_sparc::Scan::local): Don't convert R_SPARC_32
303 to R_SPARC_RELATIVE if class is ELFCLASS64.
304 (Target_sparc::Scan::global): Likewise.
305
306 2016-06-23 Cary Coutant <ccoutant@gmail.com>
307 Igor Kudrin <ikudrin@accesssoftek.com>
308
309 PR gold/15370
310 * script-sections.cc
311 (Output_section_element_input::set_section_addresses): Keep bin_count
312 separate from input_pattern_count.
313 * testsuite/script_test_12.t: Add another section .x4.
314 * testsuite/script_test_12i.t: Likewise.
315 * testsuite/script_test_12a.c: Likewise.
316 * testsuite/script_test_12b.c: Likewise.
317
318 2016-06-23 Igor Kudrin <ikudrin@accesssoftek.com>
319
320 * gold-threads.cc (impl_threads::Lock_impl_threads): Fix typos.
321
322 2016-06-22 H.J. Lu <hongjiu.lu@intel.com>
323
324 PR ld/20283
325 * NEWS: Mention --enable-relro.
326 * configure.ac: Add --enable-relro.
327 (DEFAULT_LD_Z_RELRO): New. Set by --enable-relro and default
328 to 1.
329 * config.in: Regenerated.
330 * configure: Likewise.
331 * options.h (General_options::relro): Default to
332 DEFAULT_LD_Z_RELRO.
333
334 2016-06-20 Cary Coutant <ccoutant@gmail.com>
335
336 * NEWS: Add new features in 1.12.
337 * version.cc (version_string): Bump to 1.12.
338
339 2016-06-20 H.J. Lu <hongjiu.lu@intel.com>
340
341 PR gold/20245
342 * i386.cc (Target_i386::first_plt_entry_offset): Return 0 if
343 plt_ is NULL.
344 (Target_i386::plt_entry_size): Likewise.
345 (Target_x86_64<size>::first_plt_entry_offset): Likewise.
346 (Target_x86_64<size>::plt_entry_size): Likewise.
347
348 2016-06-20 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
349
350 * mips.cc (Target_mips::Target_mips): Initialize rld_map_.
351 (Target_mips::rld_map_): New data member.
352 (Target_mips::do_finalize_sections): Add support for
353 DT_MIPS_RLD_MAP and DT_MIPS_RLD_MAP_REL dynamic tags,
354 .rld_map section, and __RLD_MAP symbol.
355 (Target_mips::do_dynamic_tag_custom_value): Add support for
356 DT_MIPS_RLD_MAP_REL dynamic tag.
357 * output.cc (Output_data_dynamic::get_entry_offset): New method
358 definition.
359 * output.h (Output_data_dynamic::get_entry_offset): New method
360 declaration.
361
362 2016-06-20 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
363
364 * mips.cc (Mips_relocate_functions::relpc16): Add unaligned check.
365
366 2016-06-20 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
367
368 * mips.cc (relocation_needs_la25_stub): Add support for relocs:
369 R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
370 (hi16_reloc): Add support for R_MIPS_PCHI16 relocation.
371 (is_matching_lo16_reloc): Likewise.
372 (lo16_reloc): Add support for R_MIPS_PCLO16 relocation.
373 (Mips_output_data_plt::plt_entry_r6): New static data member for
374 R6 PLT entry.
375 (Target_mips::is_output_r6): New method.
376 (Target_mips::Mips_mach): Add new enum constants.
377 (Mips_relocate_functions::Status): Likewise.
378 (Mips_relocate_functions::pchi16_relocs): New static data member.
379 (Mips_relocate_functions::relpc21): New method.
380 (Mips_relocate_functions::relpc26): Likewise.
381 (Mips_relocate_functions::relpc18): Likewise.
382 (Mips_relocate_functions::relpc19): Likewise.
383 (Mips_relocate_functions::relpchi16): Likewise.
384 (Mips_relocate_functions::do_relpchi16): Likewise.
385 (Mips_relocate_functions::relpclo16): Likewise.
386 (Mips_output_data_plt::do_write): Add support for Mips r6 plt
387 entry.
388 (Target_mips::mips_32bit_flags): Add E_MIPS_ARCH_32R6 support.
389 (Target_mips::elf_mips_mach): Add E_MIPS_ARCH_32R6 and
390 E_MIPS_ARCH_64R6 support.
391 (Target_mips::update_abiflags_isa): Likewise.
392 (mips_get_size_for_reloc): Add support for relocs: R_MIPS_PCHI16,
393 R_MIPS_PCLO16, R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3 and
394 R_MIPS_PC19_S2.
395 (Target_mips::Scan::local): Add support for relocs: R_MIPS_PCHI16
396 and R_MIPS_PCLO16.
397 (Target_mips::Scan::global): Add support for relocs:
398 R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
399 (Target_mips::Relocate::relocate): Call functions for resolving
400 Mips32r6 and Mips64r6 relocations, and print error message for
401 STATUS_PCREL_UNALIGNED.
402 (Target_mips::Scan::get_reference_flags): Add support for relocs:
403 R_MIPS_PCHI16, R_MIPS_PCLO16, R_MIPS_PC21_S2, R_MIPS_PC26_S2,
404 R_MIPS_PC18_S3 and R_MIPS_PC19_S2.
405 (Target_mips::elf_mips_mach_name): Add E_MIPS_ARCH_32R6 and
406 E_MIPS_ARCH_64R6 support.
407
408 2016-06-13 H.J. Lu <hongjiu.lu@intel.com>
409
410 PR gold/20246
411 * testsuite/script_test_2.t: Add .got.plt after .got.
412
413 2016-06-10 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
414
415 * mips.cc (struct Mips_abiflags): New struct.
416 (Mips_relobj::Mips_relobj): Initialize attributes_section_data_
417 and abiflags_.
418 (Mips_relobj::~Mips_relobj): Delete object pointed by
419 attributes_section_data_.
420 (Mips_relobj::abiflags): New method.
421 (Mips_relobj::attributes_section_data): Likewise.
422 (Mips_relobj::attributes_section_data_): New data member.
423 (Mips_relobj::abiflags_): Likewise.
424 (class Mips_output_section_abiflags): New class.
425 (Target_mips::Target_mips): Initialize attributes_section_data_,
426 abiflags_ and has_abiflags_section_.
427 (Target_mips::do_should_include_section): Don't emit input
428 .MIPS.abiflags sections to output .MIPS.abiflags.
429 (Target_mips::Mips_mach): Add new enum constants.
430 (Target_mips::mips_isa_ext_mach): New method.
431 (Target_mips::mips_isa_ext): Likewise.
432 (Target_mips::update_abiflags_isa): Likewise.
433 (Target_mips::infer_abiflags): Likewise.
434 (Target_mips::create_abiflags): Likewise.
435 (Target_mips::fp_abi_string): Likewise.
436 (Target_mips::select_fp_abi): Likewise.
437 (Target_mips::merge_obj_attributes): Likewise.
438 (Target_mips::merge_obj_abiflags): Likewise.
439 (Target_mips::level_rev): Likewise.
440 (Target_mips::merge_obj_e_flags): Rename from
441 merge_processor_specific_flags. Remove dyn_obj argument,
442 call update_abiflags_isa when needed, compare NaN encodings and
443 compare FP64 state.
444 (Target_mips::add_machine_extensions): Add two machine extensions
445 and fix one.
446 (Target_mips::attributes_section_data_): New data member.
447 (Target_mips::abiflags_): Likewise.
448 (Target_mips::has_abiflags_section_): Likewise.
449 (Mips_relobj::do_read_symbols): Read .gnu.attributes and
450 .MIPS.abiflags sections if they exists.
451 (Target_mips::elf_mips_mach): Add E_MIPS_MACH_5900 and
452 E_MIPS_MACH_OCTEON3 support.
453 (Target_mips::do_adjust_elf_header): Setup EI_ABIVERSION flag.
454 (Target_mips::do_finalize_sections): Merge .gnu.attributes and
455 .MIPS.abiflags sections from input. Create these sections if
456 needed.
457 (Target_mips::elf_mips_mach_name): Add E_MIPS_MACH_5900 and
458 E_MIPS_MACH_OCTEON3 support, and change strings for
459 E_MIPS_MACH_LS2E, E_MIPS_MACH_LS2F and E_MIPS_MACH_LS3A just
460 to match bfd.
461
462 2016-06-10 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
463
464 * mips.cc (Mips_relobj::Mips_relobj): Initialize
465 has_reginfo_section_.
466 (Mips_relobj::has_reginfo_section_): New data member.
467 (Mips_relobj::has_reginfo_section): New method.
468 (class Mips_output_section_reginfo): Change base class to
469 Output_section_data, and set masks of the output .reginfo section
470 in constructor.
471 (Mips_output_section_reginfo::as_mips_output_section_reginfo):
472 Remove.
473 (Mips_output_section_reginfo::set_masks): Likewise.
474 (Mips_output_section_reginfo::set_final_data_size): Likewise.
475 (Mips_output_section_reginfo::do_print_to_mapfile): New method.
476 (Target_mips::do_make_output_section): Remove.
477 (Mips_relobj::do_read_symbols): Set has_reginfo_section_ to true
478 if the object contains a .reginfo section.
479 (Target_mips::do_finalize_sections): Create a .reginfo output
480 section if needed.
481
482 2016-06-09 Artemiy Volkov <artemiyv@acm.org>
483
484 * mips.cc (Mips_output_data_got::do_write): Add missing template
485 args via typedef.
486
487 2016-05-30 Marcin Kościelnicki <koriakin@0x04.net>
488
489 PR/19960
490 * s390.cc (Target_s390::ss_code_st_r14): Removed.
491 (Target_s390::ss_code_l_r14): Removed.
492 (Target_s390::ss_code_ear): Removed.
493 (Target_s390::ss_code_c): Removed.
494 (Target_s390::ss_match_st_r14): New function.
495 (Target_s390::ss_match_l_r14): New function.
496 (Target_s390::ss_match_mcount): Call ss_match_{l,st}_r14 instead
497 of matching code directly.
498 (Target_s390::ss_match_ear): New function.
499 (Target_s390::ss_match_c): New function.
500 (Target_s390::do_calls_non_split): Call ss_match_{ear,c} instead
501 of matching code directly.
502
503 2016-05-19 Cary Coutant <ccoutant@gmail.com>
504
505 PR gold/19823
506 * copy-relocs.cc (Copy_relocs::make_copy_reloc): Add object
507 parameter; check for protected symbol.
508 * copy-relocs.h (Copy_relocs::make_copy_reloc): Add object parameter.
509 * mips.cc (Mips_copy_relocs): Adjust call to make_copy_reloc.
510 * symtab.cc (Symbol::init_fields): Initialize is_protected_.
511 (Symbol_table::add_from_dynobj): Mark protected symbols.
512 * symtab.h (Symbol::is_protected): New method.
513 (Symbol::set_is_protected): New method.
514 (Symbol::is_protected_): New data member.
515
516 * testsuite/Makefile.am (copy_test_protected): New test.
517 * testsuite/Makefile.in: Regenerate.
518 * testsuite/copy_test.cc (main): Add legal reference to protected
519 symbol.
520 * testsuite/copy_test_v1.cc (main): Likewise.
521 * testsuite/copy_test_2.cc (ip): Add protected symbol.
522 * testsuite/copy_test_protected.cc: New test source file.
523 * testsuite/copy_test_protected.sh: New test script.
524
525 2016-05-19 Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com>
526
527 * mips.cc (Mips_got_entry::Mips_got_entry): Remove object argument
528 for global got symbols, and set addend to 0.
529 (Mips_got_entry::hash): Change hash algorithm.
530 (Mips_got_entry::equals): Refactor.
531 (Mips_got_entry::object): Return input object for local got symbols
532 from union d.
533 (Mips_got_entry::addend): Change return of the relocation addend.
534 (Mips_got_entry::addend_): Move from union d.
535 (Mips_got_entry::object_): Move into union d.
536 (class Mips_symbol_hash): New class.
537 (Mips_got_info::Global_got_entry_set): New type.
538 (Mips_got_info::global_got_symbols): Change return type to
539 Global_got_entry_set.
540 (Mips_got_info::global_got_symbols_): Change type to
541 Global_got_entry_set.
542 (Mips_symbol::hash): New method.
543 (Mips_output_data_la25_stub::symbols_): Change type to std::vector.
544 (Mips_output_data_mips_stubs::Mips_stubs_entry_set): New type.
545 (Mips_output_data_mips_stubs::symbols_): Change type to
546 Mips_stubs_entry_set.
547 (Mips_got_info::record_global_got_symbol): Don't pass object
548 argument when creating global got symbol.
549 (Mips_got_info::record_got_entry): Remove find before inserting
550 got entries.
551 (Mips_got_info::add_reloc_only_entries): Change type of iterator
552 to Global_got_entry_set.
553 (Mips_got_info::count_got_symbols): Likewise.
554 (Mips_output_data_la25_stub::create_la25_stub): Use push_back
555 for adding entries to symbols_.
556 (Mips_output_data_la25_stub::do_write): Change type of iterator
557 to std::vector.
558 (Mips_output_data_mips_stubs::set_lazy_stub_offsets): Change type
559 of iterator to Mips_stubs_entry_set.
560 (Mips_output_data_mips_stubs::set_needs_dynsym_value): Likewise.
561 (Mips_output_data_mips_stubs::do_write): Likewise.
562
563 2016-05-06 Han Shen <shenhan@google.com>
564
565 PR gold/19987.
566
567 * aarch64-reloc.def: New relocation type.
568 * aarch64.cc (AArch64_relocate_functions::Page): Changed to public.
569 (Target_aarch64::Scan::local): Add R_AARCH64_LD64_GOTPAGE_LO15.
570 (Target_aarch64::Scan::global): Add R_AARCH64_LD64_GOTPAGE_LO15.
571 (Target_aarch64::Relocate::relocate): Implement R_AARCH64_LD64_GOTPAGE_LO15.
572
573 2016-04-28 Nick Clifton <nickc@redhat.com>
574
575 * po/zh_CN.po: Updated Chinese (simplified) translation.
576
577 2016-04-15 H.J. Lu <hongjiu.lu@intel.com>
578
579 * Makefile.in: Regenerated with automake 1.11.6.
580 * aclocal.m4: Likewise.
581 * testsuite/Makefile.in: Likewise.
582
583 2016-03-30 Cary Coutant <ccoutant@gmail.com>
584
585 PR gold/16979
586 * symtab.cc (Symbol_table::define_default_version): Check for case
587 where symbols are both in different shared objects.
588
589 2016-03-27 Cary Coutant <ccoutant@gmail.com>
590
591 PR gold/16111
592 * i386.cc (Target_i386): Add check for fully-resolved symbol for
593 R_386_GOTOFF.
594
595 2016-03-22 Nick Clifton <nickc@redhat.com>
596
597 * configure: Regenerate.
598
599 2016-03-21 Cary Coutant <ccoutant@gmail.com>
600
601 PR gold/19842
602 * errors.cc (Errors::undefined_symbol): Add info message when
603 symbol should have been provided by a plugin.
604 * target-reloc.h (issue_undefined_symbol_error): Check for
605 placeholder symbols defined in discarded sections.
606 * testsuite/Makefile.am (plugin_test_9b): New test case.
607 * testsuite/Makefile.in: Regenerate.
608 * testsuite/plugin_test_9b_elf.cc: New test source file.
609 * testsuite/plugin_test_9b_ir.cc: New test source file.
610
611 2016-03-20 Cary Coutant <ccoutant@gmail.com>
612
613 PR gold/19002
614 * ehframe.cc (Eh_frame::read_fde): Check for dropped functions.
615 * testsuite/Makefile.am (eh_test_2): New test.
616 * testsuite/Makefile.in: Regenerate.
617 * testsuite/eh_test_2.sh: New test script.
618 * testsuite/eh_test_a.cc (bar): Make it comdat.
619 * testsuite/eh_test_b.cc (bar): Add a duplicate copy.
620
621 2016-03-18 Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com>
622
623 * mips.cc (Mips_relobj::is_n64_): Remove.
624 (Target_mips::ei_class_): Likewise.
625 (Mips_relobj::is_newabi): Call methods.
626 (Mips_relobj::is_n64): Change checking for N64 ABI.
627 (Target_mips::is_output_n64): Likewise.
628 (Target_mips::merge_processor_specific_flags): Remove ei_class
629 argument, and remove comparing ei_class.
630 (Target_mips::do_adjust_elf_header): Remove setting EI_CLASS field
631 of the ELF header.
632 (Target_mips::do_finalize_sections): Don't pass ei_class argument
633 to merge_processor_specific_flags.
634 (Target_mips::elf_mips_abi_name): Remove ei_class argument, and
635 change checking for N64 ABI.
636
637 2016-03-17 Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com>
638
639 * mips.cc (enum Special_relocation_symbol): New enum type.
640 (is_readonly_section): New function.
641 (eh_reloc): Likewise.
642 (Mips_got_entry::is_section_symbol_): New member.
643 (Mips_got_entry::is_section_symbol): New method.
644 (Mips_got_info::record_local_got_symbol): Add is_section_symbol
645 argument.
646 (Mips_relobj::mips_elf_options_section_name): New method.
647 (Mips_output_data_got::record_local_got_symbol): Add
648 is_section_symbol argument, and pass it to
649 Mips_got_info::record_local_got_symbol.
650 (Mips_output_data_got::got_offset): Add addend argument, and pass
651 it to Relobj::local_got_offset.
652 (struct Mips_output_reloc_writer): New type.
653 (class Mips_output_data_reloc): New class.
654 (Mips_output_data_plt::Reloc_section): Change type to
655 Mips_output_data_reloc.
656 (Target_mips::Reloc_section): Likewise.
657 (Mips_reloc_types::get_r_addend): Remove unsigned from return type.
658 (Mips_classify_reloc::get_r_type2): New method.
659 (Mips_classify_reloc::get_r_type3): Likewise.
660 (Mips_classify_reloc::get_r_ssym): Likewise.
661 (Target_mips::Reloca_section): Remove.
662 (Relocate::should_apply_static_reloc): Rename from
663 should_apply_r_mips_32_reloc.
664 (Target_mips::copy_reloc): Replace Reltype parameter with r_type
665 and r_offset.
666 (Mips_relocate_functions::Valtype): New type.
667 (Mips_relocate_functions::Valtype64): New type.
668 (Mips_relocate_functions::check_overflow): New method.
669 (Mips_relocate_functions::mips_reloc_unshuffle): Move to public
670 interface.
671 (Mips_relocate_functions::mips_reloc_shuffle): Likewise.
672 (Mips_relocate_functions::rel16): Add support for resolving
673 relocations for Mips64.
674 (Mips_relocate_functions::rel32): Likewise.
675 (Mips_relocate_functions::reljalr): Likewise.
676 (Mips_relocate_functions::relpc32): Likewise.
677 (Mips_relocate_functions::rel26): Likewise.
678 (Mips_relocate_functions::relpc16): Likewise.
679 (Mips_relocate_functions::relmicromips_pc7_s1): Likewise.
680 (Mips_relocate_functions::relmicromips_pc10_s1): Likewise.
681 (Mips_relocate_functions::relmicromips_pc16_s1): Likewise.
682 (Mips_relocate_functions::do_relhi16): Likewise.
683 (Mips_relocate_functions::do_relgot16_local): Likewise.
684 (Mips_relocate_functions::rello16): Likewise.
685 (Mips_relocate_functions::relgot): Likewise.
686 (Mips_relocate_functions::relgotpage): Likewise.
687 (Mips_relocate_functions::relgotofst): Likewise.
688 (Mips_relocate_functions::relgot_hi16): Likewise.
689 (Mips_relocate_functions::relgot_lo16): Likewise.
690 (Mips_relocate_functions::relgprel): Likewise.
691 (Mips_relocate_functions::relgprel32): Likewise.
692 (Mips_relocate_functions::tlsrelhi16): Likewise.
693 (Mips_relocate_functions::tlsrello16): Likewise.
694 (Mips_relocate_functions::tlsrel32): Likewise.
695 (Mips_relocate_functions::relsub): Likewise.
696 (Mips_relocate_functions::releh): New method.
697 (Mips_relocate_functions::rel64): Likewise.
698 (Mips_got_info::record_local_got_symbol): Add is_section_symbol and
699 pass it to Mips_got_entry.
700 (Mips_got_info::add_local_entries): Pass addend argument
701 to code functions, and for STT_SECTION symbols call
702 add_symbolless_local_addend.
703 (Mips_got_info::add_tls_entries): Pass addend argument to code
704 functions.
705 (Mips_relobj::do_read_symbols): Read gp value that was used to
706 create object.
707 (Mips_output_data_plt::plt_entry): Remove opcode from l[wd]
708 instruction. Opcode for instruction will be selected later.
709 (Target_mips::gc_process_relocs): Add case for SHT_RELA.
710 (Target_mips::scan_relocatable_relocs): Likewise.
711 (Target_mips::emit_relocs_scan): Likewise.
712 (Target_mips::relocate_relocs): Likewise.
713 (Target_mips::do_finalize_sections): Skip objects for merging
714 processor specific flags in which all input sections will be
715 discarded.
716 (mips_get_size_for_reloc): Add case for R_MIPS_EH.
717 (Target_mips::Scan::get_reference_flags): Likewise.
718 (Target_mips::relocate_special_relocatable): Call rel26 method with
719 calculate_only and calculated_value arguments.
720 (Target_mips::Scan::local): Add case for R_MIPS_EH. Don't create a
721 dynamic relocation against a readonly sections, and pass
722 is_section_symbol to Mips_got_info::record_local_got_symbol.
723 (Target_mips::Scan::global): Add case for R_MIPS_EH. Don't create a
724 dynamic relocation against a readonly sections, and pass r_type
725 and r_offset to Target_mips::copy_reloc.
726 (Target_mips::Relocate::relocate): Add support for resolving
727 relocations for Mips64.
728 (Target_mips::mips_info): Add case for Mips64 default dynamic
729 linker name.
730 (Target_selector_mips): Correct emulation names.
731
732 2016-03-17 Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com>
733
734 * mips.cc (class Mips_output_data_la25_stub): Add
735 do_print_to_mapfile function.
736
737 2016-03-17 Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com>
738
739 * mips.cc (Mips_classify_reloc::put_r_info): Call 32bit version of
740 elf_r_info.
741
742 2016-03-09 H.J. Lu <hongjiu.lu@intel.com>
743
744 * testsuite/plugin_layout_with_alignment.cc: Renamed to ..
745 * testsuite/plugin_layout_with_alignment.c: This.
746 * testsuite/Makefile.am (plugin_layout_with_alignment.o): Updated.
747 (plugin_layout_with_alignment): Likewise.
748 * testsuite/Makefile.in: Regenerated.
749
750 2016-03-08 Cary Coutant <ccoutant@gmail.com>
751
752 PR 19751
753 * testsuite/Makefile.am (retain_symbols_file_test): Remove check
754 for constructor.
755 * testsuite/Makefile.in: Regenerate.
756 * testsuite/dynamic_list.sh: Likewise.
757 * testsuite/retain_symbols_file_test.sh: Likewise.
758
759 2016-03-08 Cary Coutant <ccoutant@gmail.com>
760
761 PR 19751
762 * arm.cc (Reloc_stub::Key::name): Add unused attribute.
763 * dirsearch.cc (Dir_caches::~Dir_caches): Likewise.
764
765 2016-03-08 Cary Coutant <ccoutant@gmail.com>
766 Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com>
767
768 * output.cc (Output_reloc_writer): New type.
769 (Output_data_reloc_base::do_write): Move implementation to template
770 in output.h and replace with invocation of template.
771 * output.h (Output_file): Move to top of file.
772 (Output_reloc::get_symbol_index): Move to public interface.
773 (Output_reloc::get_address): Likewise.
774 (Output_data_reloc_base::do_write_generic): New function template.
775
776 2016-03-04 Cary Coutant <ccoutant@gmail.com>
777
778 PR gold/19019
779 PR gold/19763
780 * symtab.cc: Instantiate Sized_symbol::init_constant and
781 Sized_symbol::init_undefined.
782
783 2016-03-03 Cary Coutant <ccoutant@gmail.com>
784
785 PR gold/19019
786 * layout.h (Layout::add_target_specific_dynamic_tag): New function.
787 * layout.cc (Layout::add_target_specific_dynamic_tag): New function.
788 * mips.cc (Target_mips::make_symbol): Adjust function signature.
789 * sparc.cc (Target_sparc::Target_sparc): Initialize register_syms_.
790 (Target_sparc::do_is_defined_by_abi): Remove test for
791 STT_SPARC_REGISTER.
792 (Target_sparc::Register_symbol): New struct type.
793 (Target_sparc::register_syms_): New data member.
794 (Target_sparc<64, true>::sparc_info): Set has_make_symbol to true.
795 (Target_sparc::make_symbol): New function.
796 (Target_sparc::do_finalize_sections): Add register symbols and new
797 dynamic table entries.
798 * symtab.h (Sized_symbol::init_undefined): Add value parameter.
799 (Symbol_table::add_target_global_symbol): New function.
800 (Symbol_table::target_symbols_): New data member.
801 * symtab.cc (Sized_symbol::init_undefined): Add value parameter.
802 (Symbol_table::Symbol_table): Initialize target_symbols_.
803 (Symbol_table::add_from_object): Pass additional parameters to
804 Target::make_symbol.
805 (Symbol_table::define_special_symbol): Likewise.
806 (Symbol_table::add_undefined_symbol_from_command_line): Pass 0 for
807 undefined symbol value.
808 (Symbol_table::set_dynsym_indexes): Process target-specific symbols.
809 (Symbol_table::sized_finalize): Likewise.
810 (Symbol_table::sized_write_globals): Likewise.
811 * target.h (Sized_target::make_symbol): Add name, st_type, object,
812 st_shndx, and value parameters.
813
814 2016-03-03 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
815
816 * plugin.cc (do_should_include_member): Ignore LDPK_UNDEF and
817 LDPK_WEAKUNDEF symbols.
818
819 2016-03-03 Than McIntosh <thanm@google.com>
820
821 * plugin.cc (Plugin::load): Include hooks for get_input_section_size
822 and get_input_section_alignment in transfer vector.
823 (get_input_section_alignment): New function.
824 (get_input_section_size): New function.
825 * testsuite/Makefile.am: Add plugin_layout_with_alignment.sh test.
826 * testsuite/Makefile.in: [Regenerate.]
827 * testsuite/plugin_section_alignment.cc: New test file.
828 * testsuite/plugin_layout_with_alignment.cc: New test file.
829 * testsuite/plugin_layout_with_alignment.sh: New test file.
830
831 2016-03-03 Evgenii Stepanov <eugenis@google.com>
832
833 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
834 parameter.
835 * plugin.cc (get_symbols_v3): New function.
836 (Plugin::load): Add LDPT_GET_SYMBOLS_V3.
837 (Pluginobj::get_symbol_resolution_info): Return LDPS_NO_SYMS when using
838 new version.
839
840 2016-02-26 Egor Kochetov <egor.kochetov@intel.com>
841 Cary Coutant <ccoutant@gmail.com>
842
843 PR gold/19735
844 * ehframe.h (Cie::fde_encoding): New method.
845 * ehframe.cc (Eh_frame::read_fde): Discard FDEs for zero-length
846 address ranges.
847
848 2016-02-15 H.J. Lu <hongjiu.lu@intel.com>
849
850 * testsuite/Makefile.am (x86_64_mov_to_lea5.o): Pass
851 -mrelax-relocations=yes to $(TEST_AS).
852 (x86_64_mov_to_lea6.o): Likewise.
853 (x86_64_overflow_pc32.o): Remove duplicated target.
854 * testsuite/Makefile.in: Regenerated.
855
856 2016-02-15 Marcin Kościelnicki <koriakin@0x04.net>
857
858 * s390.cc (Target_s390::match_view_u): New helper method.
859 (Target_s390::do_is_call_to_non_split): New method.
860 (Target_s390::ss_code_st_r14): New const.
861 (Target_s390::ss_code_l_r14): New const.
862 (Target_s390::ss_code_bras_8): New const.
863 (Target_s390::ss_code_l_basr): New const.
864 (Target_s390::ss_code_a_basr): New const.
865 (Target_s390::ss_code_ear): New const.
866 (Target_s390::ss_code_c): New const.
867 (Target_s390::ss_code_larl): New const.
868 (Target_s390::ss_code_brasl): New const.
869 (Target_s390::ss_code_jg): New const.
870 (Target_s390::ss_code_jgl): New const.
871 (Target_s390::ss_match_mcount): New helper method.
872 (Target_s390::ss_match_l): New helper method.
873 (Target_s390::ss_match_ahi): New helper method.
874 (Target_s390::ss_match_alfi): New helper method.
875 (Target_s390::ss_match_cr): New helper method.
876 (Target_s390::do_calls_non_split): New method.
877 * testsuite/Makefile.am: Added new tests.
878 * testsuite/Makefile.in: Regenerate.
879 * testsuite/split_s390.sh: New test.
880 * testsuite/split_s390_1_a1.s: New test.
881 * testsuite/split_s390_1_a2.s: New test.
882 * testsuite/split_s390_1_n1.s: New test.
883 * testsuite/split_s390_1_n2.s: New test.
884 * testsuite/split_s390_1_z1.s: New test.
885 * testsuite/split_s390_1_z2.s: New test.
886 * testsuite/split_s390_1_z3.s: New test.
887 * testsuite/split_s390_1_z4.s: New test.
888 * testsuite/split_s390_2_ns.s: New test.
889 * testsuite/split_s390_2_s.s: New test.
890 * testsuite/split_s390x_1_a1.s: New test.
891 * testsuite/split_s390x_1_a2.s: New test.
892 * testsuite/split_s390x_1_n1.s: New test.
893 * testsuite/split_s390x_1_n2.s: New test.
894 * testsuite/split_s390x_1_z1.s: New test.
895 * testsuite/split_s390x_1_z2.s: New test.
896 * testsuite/split_s390x_1_z3.s: New test.
897 * testsuite/split_s390x_1_z4.s: New test.
898 * testsuite/split_s390x_2_ns.s: New test.
899 * testsuite/split_s390x_2_s.s: New test.
900
901 2016-02-11 Rahul Chaudhry <rahulchaudhry@google.com>
902
903 * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Remove
904 info message for every erratum 843419 found and fixed.
905
906 2016-02-07 Cary Coutant <ccoutant@gmail.com>
907
908 PR gold/18695
909 * x86_64.cc (Target_x86_64::Relocate::relocate): Add additional
910 information to relocation overflow errors.
911
912 2016-02-06 Cary Coutant <ccoutant@gmail.com>
913
914 PR gold/18695
915 * x86_64.cc (X86_64_relocate_functions::pcrela32_check): Fix x32
916 overflow checking when symbol value + addend < 0.
917
918 2016-02-06 Cary Coutant <ccoutant@gmail.com>
919
920 PR gold/19577
921 * reloc.h (Limits): New class.
922 (Bits::has_overflow32): Use min/max values from Limits.
923 (Bits::has_unsigned_overflow32): Likewise.
924 (Bits::has_signed_unsigned_overflow32): Likewise.
925 (Bits::has_overflow): Likewise.
926 (Bits::has_unsigned_overflow): Likewise.
927 (Bits::has_signed_unsigned_overflow64): Likewise.
928
929 2016-02-06 Cary Coutant <ccoutant@gmail.com>
930
931 PR gold/19567
932 * reloc.h (Relocate_functions::Overflow_check): Add comments.
933 * x86_64.cc (X86_64_relocate_functions): New class.
934 (Target_x86_64::Relocate::relocate): Use the new class.
935 * testsuite/Makefile.am (x86_64_overflow_pc32): Add -Tdata option.
936 (x32_overflow_pc32): New test case.
937 * testsuite/Makefile.in: Regenerate.
938 * testsuite/x32_overflow_pc32.sh: New script.
939 * testsuite/x86_64_overflow_pc32.s: Remove .space directive.
940
941 2016-02-06 Cary Coutant <ccoutant@gmail.com>
942
943 PR gold/19577
944 * reloc.h (Bits::has_unsigned_overflow32): Fix static_cast.
945 (Bits::has_unsigned_overflow): Remove unnecessary static_cast.
946
947 2016-02-06 Cary Coutant <ccoutant@gmail.com>
948
949 PR gold/19577
950 * reloc.h (Bits::has_unsigned_overflow32): Fix unsigned/signed
951 comparison.
952 (Bits::has_unsigned_overflow): Likewise.
953
954 2016-02-06 Marcin Kościelnicki <koriakin@0x04.net>
955
956 * i386.cc (Target_i386::is_call_to_non_split): Add view and view_size
957 parameters.
958 * reloc.cc (Sized_relobj_file::split_stack_adjust_reltype): Pass view
959 and view_size to is_call_to_non_split.
960 * target.cc (Target::is_call_to_non_split): Add view and view_size
961 parameters.
962 * target.h (class Target): Likewise.
963
964 2016-02-05 Sriraman Tallam <tmsriram@google.com>
965
966 * icf.cc (get_rel_addend): New function.
967 (get_section_contents): Move merge section addend computation to a
968 new function. Ignore negative values for SHT_REL and SHT_RELA addends.
969 Fix bug to not read past the length of the section.
970
971 2016-02-05 Cary Coutant <ccoutant@gmail.com>
972 Andrew Senkevich <andrew.senkevich@intel.com>
973
974 PR gold/18695
975 * x86_64.cc (Target_x86_64::Relocate::relocate): Add overflow
976 checking for R_X86_64_32, R_X86_64_32S, R_X86_64_PC32, and
977 R_X86_64_PLT32.
978 * testsuite/Makefile.am (x86_64_overflow_pc32): New test.
979 * testsuite/x86_64_overflow_pc32.sh: New test script.
980 * testsuite/x86_64_overflow_pc32.s: New source file.
981
982 2016-02-05 Cary Coutant <ccoutant@gmail.com>
983
984 PR gold/18695
985 * reloc.h (Relocate_functions::Address): New typedef.
986 (Relocate_functions::Addendtype): New typedef.
987 (Relocate_functions::Overflow_check): New enum type.
988 (Relocate_functions::Reloc_status): New enum type.
989 (Relocate_functions::check_overflow): New function template.
990 (Relocate_functions::rel): Add check parameter; check for overflow.
991 (Relocate_functions::rel_unaligned): Likewise.
992 (Relocate_functions::rela): Likewise.
993 (Relocate_functions::pcrel): Likewise.
994 (Relocate_functions::pcrel_unaligned): Likewise.
995 (Relocate_functions::pcrela): Likewise.
996 (Relocate_functions::rel8): Adjust parameter types.
997 (Relocate_functions::rela8): Likewise.
998 (Relocate_functions::pcrel8): Likewise.
999 (Relocate_functions::pcrela8): Likewise.
1000 (Relocate_functions::rel16): Likewise.
1001 (Relocate_functions::rela168): Likewise.
1002 (Relocate_functions::pcrel16): Likewise.
1003 (Relocate_functions::pcrela16): Likewise.
1004 (Relocate_functions::rel32): Likewise.
1005 (Relocate_functions::rel32_unaligned): Likewise.
1006 (Relocate_functions::rela32): Likewise.
1007 (Relocate_functions::pcrel32): Likewise.
1008 (Relocate_functions::pcrel32_unaligned): Likewise.
1009 (Relocate_functions::pcrela32): Likewise.
1010 (Relocate_functions::rel8_check): New function.
1011 (Relocate_functions::rela8_check): New function.
1012 (Relocate_functions::pcrel8_check): New function.
1013 (Relocate_functions::pcrela8_check): New function.
1014 (Relocate_functions::rel16_check): New function.
1015 (Relocate_functions::rela168_check): New function.
1016 (Relocate_functions::pcrel16_check): New function.
1017 (Relocate_functions::pcrela16_check): New function.
1018 (Relocate_functions::rel32_check): New function.
1019 (Relocate_functions::rel32_unaligned_check): New function.
1020 (Relocate_functions::rela32_check): New function.
1021 (Relocate_functions::pcrel32_check): New function.
1022 (Relocate_functions::pcrel32_unaligned_check): New function.
1023 (Relocate_functions::pcrela32_check): New function.
1024 (Bits::has_unsigned_overflow32): New function.
1025 (Bits::has_unsigned_overflow): New function.
1026 * testsuite/Makefile.am (overflow_unittest): New test.
1027 * testsuite/Makefile.in: Regenerate.
1028 * testsuite/overflow_unittest.cc: New source file.
1029
1030 2016-02-04 Alan Modra <amodra@gmail.com>
1031
1032 * powerpc.cc (relocate): Adjust last patch for big-endian.
1033
1034 2016-02-02 Alan Modra <amodra@gmail.com>
1035
1036 * powerpc.cc (relocate): Further restrict ELFv2 entry optimization.
1037
1038 2016-01-15 Han Shen <shenhan@google.com>
1039
1040 PR gold/19472 - need pc-relative stubs.
1041
1042 * aarch64.cc (Reloc_stub::stub_type_for_reloc): Return PC-relative
1043 stub type for DSOs and pie executables.
1044
1045 2016-01-12 H.J. Lu <hongjiu.lu@intel.com>
1046
1047 * i386.cc (Target_i386::Classify_reloc::get_r_addend): Remove
1048 'typename'.
1049
1050 2016-01-12 Cary Coutant <ccoutant@gmail.com>
1051
1052 * arm.cc (Target_arm::Classify_reloc::get_r_addend): New method.
1053 * i386.cc (Target_i386::Classify_reloc::get_r_addend): New method.
1054 * mips.cc (Target_arm::Mips_classify_reloc::get_r_addend): (Both
1055 specializations) New method.
1056
1057 2016-01-11 Cary Coutant <ccoutant@gmail.com>
1058
1059 PR gold/19353
1060 * aarch64.cc (Target_aarch64::relocate_tls): Don't insist that
1061 we have a TLS segment for GD-to-IE optimization.
1062 * i386.cc (Target_i386::tls_gd_to_ie): Remove tls_segment parameter.
1063 Adjust all calls.
1064 (Target_i386::tls_desc_gd_to_ie): Likewise.
1065 (Target_i386::relocate_tls): Don't insist that we have a TLS segment
1066 for TLSDESC GD-to-IE optimizations.
1067 * x86_64.cc (Target_x86_64::tls_gd_to_ie): Remove tls_segment parameter.
1068 Adjust all calls.
1069 (Target_x86_64::tls_desc_gd_to_ie): Likewise.
1070 (Target_x86_64::relocate_tls): Don't insist that we have a TLS segment
1071 for TLSDESC GD-to-IE optimizations.
1072
1073 2016-01-11 Cary Coutant <ccoutant@gmail.com>
1074
1075 Refactor gold to enable support for MIPS-64 relocation format.
1076
1077 * gc.h (get_embedded_addend_size): Remove sh_type parameter.
1078 (gc_process_relocs): Remove sh_type template parameter.
1079 Use Classify_reloc to access r_sym, r_type, and r_addend fields.
1080 * object.h (Sized_relobj_file::split_stack_adjust): Add target
1081 parameter.
1082 (Sized_relobj_file::split_stack_adjust_reltype): Likewise.
1083 * reloc-types.h (Reloc_types::copy_reloc_addend): (SHT_REL and SHT_RELA
1084 specializations) Remove.
1085 * reloc.cc (Emit_relocs_strategy): Rename and move to target-reloc.h.
1086 (Sized_relobj_file::emit_relocs_scan): Call Target::emit_relocs_scan().
1087 (Sized_relobj_file::emit_relocs_scan_reltype): Remove.
1088 (Sized_relobj_file::split_stack_adjust): Add target parameter.
1089 Adjust all callers.
1090 (Sized_relobj_file::split_stack_adjust_reltype): Likewise. Call
1091 Target::get_r_sym() to get r_sym field from relocations.
1092 (Track_relocs::next_symndx): Call Target::get_r_sym().
1093 * target-reloc.h (scan_relocs): Remove sh_type template parameter;
1094 add Classify_reloc template parameter. Use for accessing r_sym and
1095 r_type.
1096 (relocate_section): Likewise.
1097 (Default_classify_reloc): New class (renamed and moved from reloc.cc).
1098 (Default_scan_relocatable_relocs): Remove sh_type template parameter.
1099 (Default_scan_relocatable_relocs::Reltype): New typedef.
1100 (Default_scan_relocatable_relocs::reloc_size): New const.
1101 (Default_scan_relocatable_relocs::sh_type): New const.
1102 (Default_scan_relocatable_relocs::get_r_sym): New method.
1103 (Default_scan_relocatable_relocs::get_r_type): New method.
1104 (Default_emit_relocs_strategy): New class.
1105 (scan_relocatable_relocs): Replace sh_type template parameter with
1106 Scan_relocatable_relocs class. Use it to access r_sym and r_type
1107 fields.
1108 (relocate_relocs): Replace sh_type template parameter with
1109 Classify_reloc class. Use it to access r_sym and r_type fields.
1110 * target.h (Target::is_call_to_non_split): Replace r_type parameter
1111 with pointer to relocation. Adjust all callers.
1112 (Target::do_is_call_to_non_split): Likewise.
1113 (Target::emit_relocs_scan): New virtual method.
1114 (Sized_target::get_r_sym): New virtual method.
1115 * target.cc (Target::do_is_call_to_non_split): Replace r_type parameter
1116 with pointer to relocation.
1117
1118 * aarch64.cc (Target_aarch64::emit_relocs_scan): New method.
1119 (Target_aarch64::Relocatable_size_for_reloc): Remove.
1120 (Target_aarch64::gc_process_relocs): Use Default_classify_reloc.
1121 (Target_aarch64::scan_relocs): Likewise.
1122 (Target_aarch64::relocate_section): Likewise.
1123 (Target_aarch64::Relocatable_size_for_reloc::get_size_for_reloc):
1124 Remove.
1125 (Target_aarch64::scan_relocatable_relocs): Use Default_classify_reloc.
1126 (Target_aarch64::relocate_relocs): Use Default_classify_reloc.
1127 * arm.cc (Target_arm::Arm_scan_relocatable_relocs): Remove sh_type
1128 template parameter.
1129 (Target_arm::emit_relocs_scan): New method.
1130 (Target_arm::Relocatable_size_for_reloc): Replace with...
1131 (Target_arm::Classify_reloc): ...this.
1132 (Target_arm::gc_process_relocs): Use Classify_reloc.
1133 (Target_arm::scan_relocs): Likewise.
1134 (Target_arm::relocate_section): Likewise.
1135 (Target_arm::scan_relocatable_relocs): Likewise.
1136 (Target_arm::relocate_relocs): Likewise.
1137 * i386.cc (Target_i386::emit_relocs_scan): New method.
1138 (Target_i386::Relocatable_size_for_reloc): Replace with...
1139 (Target_i386::Classify_reloc): ...this.
1140 (Target_i386::gc_process_relocs): Use Classify_reloc.
1141 (Target_i386::scan_relocs): Likewise.
1142 (Target_i386::relocate_section): Likewise.
1143 (Target_i386::scan_relocatable_relocs): Likewise.
1144 (Target_i386::relocate_relocs): Likewise.
1145 * mips.cc (Mips_scan_relocatable_relocs): Remove sh_type template
1146 parameter.
1147 (Mips_reloc_types): New class template.
1148 (Mips_classify_reloc): New class template.
1149 (Target_mips::Reltype): New typedef.
1150 (Target_mips::Relatype): New typedef.
1151 (Target_mips::emit_relocs_scan): New method.
1152 (Target_mips::get_r_sym): New method.
1153 (Target_mips::Relocatable_size_for_reloc): Replace with
1154 Mips_classify_reloc.
1155 (Target_mips::copy_reloc): Use Mips_classify_reloc.
1156 (Target_mips::gc_process_relocs): Likewise.
1157 (Target_mips::scan_relocs): Likewise.
1158 (Target_mips::relocate_section): Likewise.
1159 (Target_mips::scan_relocatable_relocs): Likewise.
1160 (Target_mips::relocate_relocs): Likewise.
1161 (mips_get_size_for_reloc): New function, factored out from
1162 Relocatable_size_for_reloc::get_size_for_reloc.
1163 (Target_mips::Scan::local): Use Mips_classify_reloc.
1164 (Target_mips::Scan::global): Likewise.
1165 (Target_mips::Relocate::relocate): Likewise.
1166 * powerpc.cc (Target_powerpc::emit_relocs_scan): New method.
1167 (Target_powerpc::Relocatable_size_for_reloc): Remove.
1168 (Target_powerpc::gc_process_relocs): Use Default_classify_reloc.
1169 (Target_powerpc::scan_relocs): Likewise.
1170 (Target_powerpc::relocate_section): Likewise.
1171 (Powerpc_scan_relocatable_reloc): Convert to class template.
1172 (Powerpc_scan_relocatable_reloc::Reltype): New typedef.
1173 (Powerpc_scan_relocatable_reloc::reloc_size): New const.
1174 (Powerpc_scan_relocatable_reloc::sh_type): New const.
1175 (Powerpc_scan_relocatable_reloc::get_r_sym): New method.
1176 (Powerpc_scan_relocatable_reloc::get_r_type): New method.
1177 (Target_powerpc::scan_relocatable_relocs): Use
1178 Powerpc_scan_relocatable_reloc.
1179 (Target_powerpc::relocate_relocs): Use Default_classify_reloc.
1180 * s390.cc (Target_s390::emit_relocs_scan): New method.
1181 (Target_s390::Relocatable_size_for_reloc): Remove.
1182 (Target_s390::gc_process_relocs): Use Default_classify_reloc.
1183 (Target_s390::scan_relocs): Likewise.
1184 (Target_s390::relocate_section): Likewise.
1185 (Target_s390::Relocatable_size_for_reloc::get_size_for_reloc):
1186 Remove.
1187 (Target_s390::scan_relocatable_relocs): Use Default_classify_reloc.
1188 (Target_s390::relocate_relocs): Use Default_classify_reloc.
1189 * sparc.cc (Target_sparc::emit_relocs_scan): New method.
1190 (Target_sparc::Relocatable_size_for_reloc): Remove.
1191 (Target_sparc::gc_process_relocs): Use Default_classify_reloc.
1192 (Target_sparc::scan_relocs): Likewise.
1193 (Target_sparc::relocate_section): Likewise.
1194 (Target_sparc::Relocatable_size_for_reloc::get_size_for_reloc):
1195 Remove.
1196 (Target_sparc::scan_relocatable_relocs): Use Default_classify_reloc.
1197 (Target_sparc::relocate_relocs): Use Default_classify_reloc.
1198 * tilegx.cc (Target_tilegx::emit_relocs_scan): New method.
1199 (Target_tilegx::Relocatable_size_for_reloc): Remove.
1200 (Target_tilegx::gc_process_relocs): Use Default_classify_reloc.
1201 (Target_tilegx::scan_relocs): Likewise.
1202 (Target_tilegx::relocate_section): Likewise.
1203 (Target_tilegx::Relocatable_size_for_reloc::get_size_for_reloc):
1204 Remove.
1205 (Target_tilegx::scan_relocatable_relocs): Use Default_classify_reloc.
1206 (Target_tilegx::relocate_relocs): Use Default_classify_reloc.
1207 * x86_64.cc (Target_x86_64::emit_relocs_scan): New method.
1208 (Target_x86_64::Relocatable_size_for_reloc): Remove.
1209 (Target_x86_64::gc_process_relocs): Use Default_classify_reloc.
1210 (Target_x86_64::scan_relocs): Likewise.
1211 (Target_x86_64::relocate_section): Likewise.
1212 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1213 Remove.
1214 (Target_x86_64::scan_relocatable_relocs): Use Default_classify_reloc.
1215 (Target_x86_64::relocate_relocs): Use Default_classify_reloc.
1216
1217 * testsuite/testfile.cc (Target_test::emit_relocs_scan): New method.
1218
1219 2016-01-01 Alan Modra <amodra@gmail.com>
1220
1221 Update year range in copyright notice of all files.
1222
1223 For older changes see ChangeLog-0815
1224 \f
1225 Copyright (C) 2016 Free Software Foundation, Inc.
1226
1227 Copying and distribution of this file, with or without modification,
1228 are permitted in any medium without royalty provided the copyright
1229 notice and this notice are preserved.
1230
1231 Local Variables:
1232 mode: change-log
1233 left-margin: 8
1234 fill-column: 74
1235 version-control: never
1236 End: