12011-06-17 Ian Lance Taylor <iant@google.com> 2 3 * object.cc (Sized_relobj::do_layout): Keep warning sections when 4 making a shared library. 5 62011-06-09 Ian Lance Taylor <iant@google.com> 7 8 * script-sections.cc 9 (Orphan_output_section::set_section_addresses): For a relocatable 10 link set address to 0. 11 122011-05-29 Ian Lance Taylor <iant@google.com> 13 14 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the 15 binary input file is empty. 16 172011-05-06 Ian Lance Taylor <iant@google.com> 18 19 * layout.cc (Layout::layout): If the output section flags change, 20 update the ordering. 21 222011-03-14 Ian Lance Taylor <iant@google.com> 23 24 * script-sections.cc (Sort_output_sections::script_compare): 25 Rename from is_before, change return type. 26 (Sort_output_sections::operator()): Adjust accordingly. 27 282011-03-08 Ian Lance Taylor <iant@google.com> 29 30 PR gold/12525 31 * fileread.cc: #include <climits>. 32 (GOLD_IOV_MAX): Define. 33 (File_read::read_multiple): Limit number of entries by iov_max. 34 * fileread.h (class File_read): Always set max_readv_entries to 35 128. 36 372011-03-07 Ian Lance Taylor <iant@google.com> 38 39 PR gold/12525 40 * options.h (class General_options): Add -dy and -dn. 41 422011-03-02 Simon Baldwin <simonb@google.com> 43 44 * configure.ac: Add check for gnu_indirect_function support in 45 the toolchain building binutils. 46 * configure: Rebuild. 47 482011-03-01 Ian Lance Taylor <iant@google.com> 49 50 Backport from mainline: 51 2011-01-04 Cary Coutant <ccoutant@google.com> 52 * script-sections.cc (Sort_output_sections::operator()): Sort TLS 53 sections before NOBITS sections. 54 552011-02-27 Ian Lance Taylor <iant@google.com> 56 57 Backport from mainline: 58 2010-11-05 Cary Coutant <ccoutant@google.com> 59 PR gold/10708 60 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the 61 object when reading from the file. 62 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing 63 second layout pass. 64 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object 65 when reading section contents. 66 (get_section_contents): Likewise. 67 (icf::find_identical_sections): Likewise. 68 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the 69 object when reading from the file. 70 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on 71 the object when doing deferred section layout. 72 732011-02-09 Ian Lance Taylor <iant@google.com> 74 75 PR gold/12316 76 * object.h (class Sized_relobj): Remove clear_local_symbols. 77 * reloc.cc (Sized_relobj::do_relocate): Don't call 78 clear_local_symbols. 79 802011-02-04 Jeffrey Yasskin <jyasskin@google.com> 81 82 * symtab.cc (Odr_violation_compare::operator()): Sort by just the 83 filename. 84 852011-02-02 Sriraman Tallam <tmsriram@google.com> 86 87 * icf.h (is_section_foldable_candidate): Change type of parameter 88 to std::string. 89 * icf.cc (Icf::find_identical_sections): Change type of local variable 90 section_name to be std::string. 91 (is_function_ctor_or_dtor): Change type of parameter to std::string. 92 932011-02-01 Ian Lance Taylor <iant@google.com> 94 95 Backport from mainline: 96 2011-01-25 Ian Lance Taylor <iant@google.com> 97 * script.cc (script_add_extern): Rewrite to use 98 add_symbol_reference. 99 1002011-02-01 Alan Modra <amodra@gmail.com> 101 102 Backport from mainline 103 2011-01-01 H.J. Lu <hongjiu.lu@intel.com> 104 * version.cc (print_version): Update copyright to 2011. 105 1062011-01-24 Ian Lance Taylor <iant@google.com> 107 108 * version.cc (version_string): Bump to 1.11. 109 1102011-01-24 Ian Lance Taylor <iant@google.com> 111 112 * plugin.cc (class Plugin_rescan): Define new class. 113 (Plugin_manager::claim_file): Set any_claimed_. 114 (Plugin_manager::save_archive): New function. 115 (Plugin_manager::save_input_group): New function. 116 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if 117 necessary. 118 (Plugin_manager::new_undefined_symbol): New function. 119 (Plugin_manager::rescan): New function. 120 (Plugin_manager::rescannable_defines): New function. 121 (Plugin_manager::add_input_file): Set any_added_. 122 * plugin.h (class Plugin_manager): define new fields rescannable_, 123 undefined_symbols_, any_claimed_, and any_added_. Declare 124 Plugin_rescan as friend. Declare new functions. 125 (Plugin_manager::Rescannable): Define type. 126 (Plugin_manager::Rescannable_list): Define type. 127 (Plugin_manager::Undefined_symbol_list): Define type. 128 (Plugin_manager::Plugin_manager): Initialize new fields. 129 * archive.cc (Archive::defines_symbol): New function. 130 (Add_archive_symbols::run): Pass archive to plugins if any. 131 * archive.h (class Archive): Declare defines_symbol. 132 * readsyms.cc (Input_group::~Input_group): New function. 133 (Finish_group::run): Pass input_group to plugins if any. 134 * readsyms.h (class Input_group): Declare destructor. 135 * symtab.cc (add_from_object): Pass undefined symbol to plugins if 136 any. 137 1382011-01-10 Ian Lance Taylor <iant@google.com> 139 140 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame 141 section as relro. 142 (Layout::set_segment_offsets): Reset increase_relro before calling 143 set_section_addresses a second time. 144 1452010-12-23 Cary Coutant <ccoutant@google.com> 146 147 * output.h (Output_data_reloc::add_output_section): Pass OD instead 148 of OS to this->add. Add OD parameter to second form of the function. 149 1502010-12-21 Alan Modra <amodra@gmail.com> 151 152 * po/ja.po: New translation. 153 1542010-12-01 Ian Lance Taylor <iant@google.com> 155 156 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add 157 virtual destructor. 158 1592010-12-01 Ian Lance Taylor <iant@google.com> 160 161 * README: Update compilers known to work and fail. 162 1632010-11-23 Matthias Klose <doko@ubuntu.com> 164 165 * configure.in: For --enable-gold, handle value `default' instead of 166 `both*'. Always install ld as ld.bfd, install as ld if gold is 167 not the default. 168 * configure: Regenerate. 169 1702010-11-18 Doug Kwan <dougkwan@google.com> 171 172 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment 173 and right_alignment to be zero. Store result alignment only if it is 174 greater than existing alignment. 175 1762010-11-16 Doug Kwan <dougkwan@google.com> 177 Cary Coutant <ccoutant@google.com> 178 179 * output.h (Output_segment::set_section_addresses): Pass increase_relro 180 by reference; adjust all callers. 181 * output.cc (Output_segment::set_section_addresses): Adjust references 182 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST 183 list is empty. 184 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not 185 end at page boundary. 186 1872010-11-03 Nick Clifton <nickc@redhat.com> 188 189 PR gold/12001 190 * script.h (class Symbol_assignment: name): New member. Returns 191 the name of the symbol. 192 * scrfipt.cc (Script_options::is_pending_assignment): New member. 193 Returns true if the given symbol name is on the list of 194 assignments wating to be processed. 195 * archive.cc (should_incldue_member): If the symbol is undefined, 196 check to see if it is on the list of symbols pending assignment. 197 1982010-11-03 Ryan Mansfield <rmansfield@qnx.com> 199 200 * script-sections.cc (Script_sections::find_memory_region): Check 201 for a NULL output section pointer. 202 2032010-10-29 Doug Kwan <dougkwan@google.com> 204 205 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to 206 Output_section::add_relaxed_input_section. 207 * output.cc (Output_section::add_relaxed_input_section): Add new 208 arguments LAYOUT and NAME. Set section order index. 209 (Output_section::convert_input_sections_in_list_to_relaxed_sections): 210 Copy section order index. 211 * output.h (Output_section::add_relaxed_input_section): Add new 212 arguments LAYOUT and NAME. 213 2142010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com> 215 216 * testsuite/Makefile.am: Move gcctestdir/ld rule to 217 NATIVE_OR_CROSS_LINKER. 218 * testsuite/Makefile.in: Regenerate. 219 2202010-10-20 Doug Kwan <dougkwan@google.com> 221 222 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections 223 without SHF_LINK_ORDER flags. 224 * layout.cc (Layout::choose_output_section): Do not filter 225 SHF_LINK_ORDER flag in a relocatable link. 226 2272010-10-17 Cary Coutant <ccoutant@google.com> 228 229 * output.h (Output_segment::set_section_addresses): Change function 230 signature. Update all callers. 231 * output.cc (Output_segment::is_first_section_relro): Ignore TLS 232 sections. 233 (Output_segment::set_section_addresses): Align after last TLS 234 section. Add padding before last relro section instead of after. 235 2362010-10-17 Doug Kwan <dougkwan@google.com> 237 238 * gold/arm.cc (Target_arm::got_section): Use correct order and set 239 GOT output section to be writable. 240 2412010-10-14 Cary Coutant <ccoutant@google.com> 242 243 * debug.h (DEBUG_INCREMENTAL): New flag. 244 (debug_string_to_enum): Add DEBUG_INCREMENTAL). 245 * gold.cc (queue_initial_tasks): Check parameters for incremental link 246 mode. 247 * incremental.cc (report_command_line): Ignore all forms of 248 --incremental. 249 * layout.cc (Layout::Layout): Check parameters for incremental link 250 mode. 251 * options.cc (General_options::parse_incremental): New function. 252 (General_options::parse_no_incremental): New function. 253 (General_options::parse_incremental_full): New function. 254 (General_options::parse_incremental_update): New function. 255 (General_options::incremental_mode_): New data member. 256 (General_options::finalize): Check incremental_mode_. 257 * options.h (General_options): Update help text for --incremental. 258 Add --no-incremental, --incremental-full, --incremental-update. 259 (General_options::Incremental_mode): New enum type. 260 (General_options::incremental_mode): New function. 261 (General_options::incremental_mode_): New data member. 262 * parameters.cc (Parameters::incremental_mode_): New data member. 263 (Parameters::set_options): Set incremental_mode_. 264 (Parameters::set_incremental_full): New function. 265 (Parameters::incremental): New function. 266 (Parameters::incremental_update): New function. 267 (set_parameters_incremental_full): New function. 268 * parameters.h (Parameters::set_incremental_full): New function. 269 (Parameters::incremental): New function. 270 (Parameters::incremental_update): New function. 271 (Parameters::incremental_mode_): New data member. 272 (set_parameters_incremental_full): New function. 273 * plugin.cc (Plugin_manager::add_input_file): Check parameters for 274 incremental link mode. 275 * reloc.cc (Sized_relobj::do_read_relocs): Likewise. 276 (Sized_relobj::do_relocate_sections): Likewise. 277 * testsuite/Makefile.am (incremental_test): Use --incremental-full 278 option. 279 * testsuite/Makefile.in: Regenerate. 280 * testsuite/incremental_test.sh: Filter all forms of --incremental. 281 2822010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com> 283 284 * script-sections.h (class Script_sections): Make 285 Sections_elements typedef public. 286 * script-sections.cc (class Sort_output_sections): Add elements_ 287 field. Add constructor which sets it; change all callers. 288 (Sort_output_sections::is_before): New function. 289 (Sort_output_sections::operator()): Call is_before. 290 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake 291 conditional. 292 * testsuite/script_test_10.sh: New test. Test script section 293 order. 294 * testsuite/script_test_10.t: Likewise. 295 * testsuite/script_test_10.s: Likewise. 296 * testsuite/Makefile.am: Wrap the cross linker tests and the 297 common tests into NATIVE_OR_CROSS_LINKER. 298 (check_SCRIPTS): Add script_test_10.sh. 299 (check_DATA): Add script_test_10.stdout. 300 (script_test_10.o, script_test_10): New targets. 301 (script_test_10.stdout): New target. 302 * configure, testsuite/Makefile.in: Regenerate. 303 3042010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com> 305 306 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc 307 error for the deprecated relocations. 308 (Target_arm::Scan::global): Likewise. 309 (Target_arm::Relocate::relocate): Likewise. 310 3112010-10-12 Richard Sandiford <richard.sandiford@linaro.org> 312 313 * fileread.cc (Input_file::find_file): Initialize *found_name 314 and *namep when using the fallback search for case 4. 315 3162010-10-11 Cary Coutant <ccoutant@google.com> 317 318 * options.h (class General_options): Redefine -z lazy as an alias for 319 the negation of -z now. 320 3212010-10-11 Ian Lance Taylor <iant@google.com> 322 323 * resolve.cc (symbol_to_bits): Report the value of the unsupported 324 binding. 325 3262010-10-06 Nick Clifton <nickc@redhat.com> 327 328 * script-sections.cc(class Memory_region): Remove 329 current_lma_offset_ field. Rename current_vma_offset_ to 330 current_offset_. Add last_section_ field. 331 (Memory_region::get_current_vma_address): Rename to 332 get_current_address. 333 (Memory_region::get_current_lma_address): Delete. 334 (Memory_region::increment_vma_offset): Rename to 335 increment_offset. 336 (Memory_region::increment_lma_offset): Delete. 337 (Memory_region::attributes_compatible): New method. Returns 338 true if the provided section is compatible with the region. 339 (Memory_region::get_last_section): New method. Returns the last 340 section to use the region. 341 (Memory_region::set_last_section): New method. Stores the last 342 section to use the region. 343 (Script_sections::block_in_region): New method. Returns true if 344 a block of memory is contained within a region. 345 (Script_sections::find_memory_region): New method. Locates a 346 memory region to be used to set a VMA or LMA address. 347 (Output_section_definition::set_section_addresses): Add code to 348 check for addresses set by memory regions. 349 (Output_segment::set_section_addresses): Remove memory region 350 walking code. 351 (Script_sections::create_segment): Add a warning if a header 352 segment is created outside of any region. 353 * script-sections.h (class Script_sections): Add prototypes for 354 find_memory_region and block_in_region methods. 355 * testsuite/memory_test.s: Use .long instead of .word. 356 * testsuite/memory_test.t: Add some more output sections. 357 * testsuite/memory_test.sh: Update expected output. 358 3592010-10-02 Doug Kwan <dougkwan@google.com> 360 361 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move 362 defintion to symtab.h 363 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change 364 declaration to defintion. 365 3662010-10-01 Nick Clifton <nickc@redhat.com> 367 368 * expression.cc (eval): Replace dummy argument with NULL. 369 (eval_maybe_dot): Check for a NULL result section pointer. 370 (Symbol_expression::value): Likewise. 371 (Dot_expression::value): Likewise. 372 (BINARY_EXPRESSION): Likewise. 373 (Max_expression::value): Likewise. 374 (Min_expression::value): Likewise. 375 (Absolute_expression::value): Likewise. 376 (Addr_expression::value_from_output_section): Likewise. 377 (Loaddddr_expression::value_from_output_section): Likewise. 378 (Segment_start_expression::value): Likewise. 379 * script-sections.cc 380 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy 381 argument with NULL. 382 (Sections_elememt_dot_assignment::set_section_addresses): 383 Likewise. 384 (Output_data_expression::do_write_to_buffer): Likewise. 385 (Output_section_definition::finalize_symbols): Likewise. 386 (Output_section_definition::set_section_addresses): Likewise. 387 3882010-09-30 Doug Kwan <dougkwan@google.com> 389 390 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests. 391 3922010-09-28 Sriraman Tallam <tmsriram@google.com> 393 394 * target.h (Target::can_icf_inline_merge_sections): New virtual 395 function. 396 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New 397 virtual function. 398 * i386.cc (Target_i386::can_icf_inline_merge_sections): New 399 virtual function. 400 * icf.cc (get_section_contents): Inline merge sections only when 401 target allows it. 402 4032010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 404 405 * configure: Regenerate. 406 4072010-09-17 Ian Lance Taylor <iant@google.com> 408 409 * testsuite/memory_test.sh: Adjust for change of 2010-09-10. 410 * testsuite/Makefile.am (memory_test.o): New target. 411 (memory_test): Depend on memory_test.o, gcctestdir/ld, and 412 memory_test.t. 413 * testsuite/Makefile.in: Rebuild. 414 4152010-09-17 Doug Kwan <dougkwan@google.com> 416 417 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and 418 defintion if relocation uses GOT entries of the symbol. 419 * testsuite/icf_safe_test.sh: Fix test. 420 * testsuite/icf_safe_so_test.sh: Fix test. 421 4222010-09-16 Cary Coutant <ccoutant@google.com> 423 424 * script_sections.cc (class Memory_region): Remove "NULL" from 425 vector initializations. 426 4272010-09-15 Cary Coutant <ccoutant@google.com> 428 429 * incremental.cc (Output_section_incremental_inputs::write_info_blocks): 430 Resolve forwarding symbols. 431 4322010-09-15 Doug Kwan <dougkwan@google.com> 433 434 * gold/testsuite/script_test_3.t: Add ARM special sections. 435 * gold/testsuite/script_test_4.t: Same. 436 * gold/testsuite/script_test_5.t: Same. 437 * gold/testsuite/script_test_6.t: Same. 438 * gold/testsuite/script_test_7.t: Same. 439 * gold/testsuite/script_test_7.t: Same. 440 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment. 441 4422010-09-14 Cary Coutant <ccoutant@google.com> 443 444 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member. 445 (Target_x86_64::Relocate::relocate_tls): Replace check for 446 saw_tls_block_reloc_ with test for executable section. 447 4482010-09-12 Cary Coutant <ccoutant@google.com> 449 450 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from 451 position-independent executables to shared libraries need dynamic 452 relocations. 453 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in 454 position-independent executables. 455 * testsuite/Makefile.am (two_file_mixed_pie_test): New test. 456 * testsuite/Makefile.in: Regenerate. 457 4582010-09-10 Nick Clifton <nickc@redhat.com> 459 460 PR gold/11997 461 * testsuite/memory_test.t: Discard any sections that are not 462 needed. 463 4642010-09-09 H.J. Lu <hongjiu.lu@intel.com> 465 466 PR gold/11996 467 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove 468 "This::" to work around a bug in gcc 4.2. 469 470 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)). 471 4722010-09-09 Rafael Espindola <espindola@google.com> 473 474 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put 475 sections with different PF_X flags in the same segment. 476 (Layout::find_first_load_seg): Search all segments to find the first 477 one. 478 * options.h (rosegment): New. 479 4802010-09-08 Rafael Espindola <espindola@google.com> 481 482 * layout.cc (Layout::set_segment_offsets): Always advance to a new page. 483 4842010-09-08 Doug Kwan <dougkwan@google.com> 485 486 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method. 487 (Arm_relobj::do_relocate_sections): Add new parameter for output 488 file to match the parent. 489 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values 490 of local symbols instead of input values. Update code to track 491 changes in gold::relocate_section. 492 * object.cc (Sized_relobj::compute_final_local_value): New methods. 493 (Sized_relobj::compute_final_local_value_internal): New methods. 494 (Sized_relobj::do_finalize_local_symbols): Move code from loop 495 body into private version of Sized_relobj::compute_final_local_value. 496 Call the inline method. 497 * object.h (Symbol_value::Symbol_value): Define destructor. Free 498 merged symbol value if there is one. 499 (Symbol_value::has_output_value): New method defintiion. 500 (Sized_relobj::Compute_final_local_value_status): New enum type. 501 (Sized_relobj::compute_final_local_value): New methods. 502 (Sized_relobj::compute_final_local_value_internal): New methods. 503 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh 504 and arm_cortex_a8.sh. 505 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl, 506 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc): 507 New tests. 508 * Makefile.in: Regenerate. 509 * testsuite/arm_bl_out_of_range.s: Update test. 510 * testsuite/thumb_bl_out_of_range.s: Ditto. 511 * testsuite/thumb_blx_out_of_range.s: Ditto. 512 * testsuite/arm_branch_out_of_range.sh: New file. 513 * testsuite/arm_cortex_a8.sh: Ditto. 514 * testsuite/arm_cortex_a8_b.s: Ditto. 515 * testsuite/arm_cortex_a8_b_cond.s: Ditto. 516 * testsuite/arm_cortex_a8_b_local.s: Ditto. 517 * testsuite/arm_cortex_a8_bl.s: Ditto. 518 * testsuite/arm_cortex_a8_blx.s: Ditto. 519 * testsuite/arm_cortex_a8_local.s: Ditto. 520 * testsuite/arm_cortex_a8_local_reloc.s: Ditto. 521 * testsuite/thumb_bl_out_of_range_local.s: Ditto. 522 5232010-09-08 Rafael Espindola <espindola@google.com> 524 525 * Makefile.am (memory_test.stdout): Run readelf with -W. 526 * Makefile.in: Regenerate. 527 * testsuite/memory_test.sh: Make the regexps accept both 32 and 528 64 bit output. 529 5302010-09-08 Rafael Espindola <espindola@google.com> 531 532 * script-sections.cc (Script_sections::add_memory_region): Convert 533 field precision to int. 534 * script.cc (script_set_section_region, script_set_section_region): 535 Convert field precision to int. 536 5372010-09-08 Rafael Espindola <espindola@google.com> 538 539 * arm.cc (do_finalize_sections): Create the __exidx_start and 540 __exdix_end symbols even when the section is missing. 541 5422010-09-08 Nick Clifton <nickc@redhat.com> 543 544 * README: Remove claim that MEMORY is not supported. 545 * expression.cc (script_exp_function_origin) 546 (script_exp_function_length): Move from here to ... 547 * script.cc: ... here. 548 (script_set_section_region, script_add_memory) 549 (script_parse_memory_attr, script_include_directive): New 550 functions. 551 * script-sections.cc 552 (class Memory_region): New class. 553 (class Output_section_definition): Add set_memory_region, 554 set_section_vma, set_section_lma and get_section_name methods. 555 (class Script_Sections): Add add_memory_region, 556 find_memory_region, find_memory_region_origin, 557 find_memory_region_length and set_memory_region methods. 558 Have set_section_addresses method walk the list of set memory 559 regions. 560 Extend the print methos to display memory regions. 561 * script-sections.h: Add prototypes for new methods. 562 Add enum for MEMORY region attributes. 563 * yyscript.y: Add support for parsing MEMORY regions. 564 * script-c.h: Add prototypes for new functions. 565 * testsuite/Makefile.am: Add test of MEMORY region functionality. 566 * testsuite/Makefile.in: Regenerate. 567 * testsuite/memory_test.sh: New script. 568 * testsuite/memory_test.s: New assembler source file. 569 * testsuite/memory_test.t: New linker script. 570 5712010-08-27 Doug Kwan <dougkwan@google.com> 572 573 * gold/resolve.cc (Symbol_table::should_override): Let a weak 574 reference override an existing dynamic weak reference. 575 * testsuite/Makefile.am: Add new test dyn_weak_ref. 576 * testsuite/Makefile.in: Regenerate. 577 * testsuite/dyn_weak_ref.sh: New file. 578 * testsuite/dyn_weak_ref_1.c: Ditto. 579 * testsuite/dyn_weak_ref_2.c: Ditto. 580 5812010-08-27 Ian Lance Taylor <iant@google.com> 582 583 * incremental.h (class Incremental_input_entry): Add virtual 584 destructor. 585 5862010-08-27 Ian Lance Taylor <iant@google.com> 587 588 * testsuite/start_lib_test_3.c: Mark t3 as used. 589 5902010-08-27 Nick Clifton <nickc@redhat.com> 591 592 * options.cc (version_script): Fix small typo in previous 593 whitespace tidyup. 594 5952010-08-25 Nick Clifton <nickc@redhat.com> 596 597 * archive.cc: Formatting fixes: Remove whitespace between 598 typename and following asterisk. Remove whitespace between 599 function name and opening parenthesis. 600 * archive.h: Likewise. 601 * arm.cc: Likewise. 602 * attributes.cc: Likewise. 603 * attributes.h: Likewise. 604 * common.cc: Likewise. 605 * copy-relocs.cc: Likewise. 606 * dirsearch.h: Likewise. 607 * dynobj.cc: Likewise. 608 * ehframe.cc: Likewise. 609 * ehframe.h: Likewise. 610 * expression.cc: Likewise. 611 * fileread.cc: Likewise. 612 * fileread.h: Likewise. 613 * gc.h: Likewise. 614 * gold-threads.cc: Likewise. 615 * gold.cc: Likewise. 616 * i386.cc: Likewise. 617 * icf.h: Likewise. 618 * incremental-dump.cc: Likewise. 619 * incremental.cc: Likewise. 620 * layout.cc: Likewise. 621 * layout.h: Likewise. 622 * main.cc: Likewise. 623 * merge.cc: Likewise. 624 * merge.h: Likewise. 625 * object.cc: Likewise. 626 * object.h: Likewise. 627 * options.cc: Likewise. 628 * options.h: Likewise. 629 * output.cc: Likewise. 630 * output.h: Likewise. 631 * plugin.cc: Likewise. 632 * plugin.h: Likewise. 633 * powerpc.cc: Likewise. 634 * reloc.cc: Likewise. 635 * script-c.h: Likewise. 636 * script-sections.cc: Likewise. 637 * script.cc: Likewise. 638 * stringpool.cc: Likewise. 639 * symtab.cc: Likewise. 640 * symtab.h: Likewise. 641 * target.cc: Likewise. 642 * timer.cc: Likewise. 643 * timer.h: Likewise. 644 * version.cc: Likewise. 645 * x86_64.cc: Likewise. 646 6472010-08-24 Nick Clifton <nickc@redhat.com> 648 649 PR 11899 650 * layout.cc (segment_precedes): Sort segments by their physical 651 addresses, if they have been set. 652 6532010-08-23 Cary Coutant <ccoutant@google.com> 654 655 * archive.cc (Lib_group::add_symbols): Lock object before deleting its 656 symbols data. 657 (Lib_group::include_member): Unlock object after deleting its 658 symbols data. 659 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger 660 the bug fixed here. 661 6622010-08-19 Neil Vachharajani <nvachhar@google.com> 663 Cary Coutant <ccoutant@google.com> 664 665 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust 666 constructor, and set_blocker. 667 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check 668 readsyms_blocker_. 669 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass 670 this->this_blocker_ to Add_lib_group_symbols::set_blocker. 671 * testsuite/Makefile.am (start_lib_test): New test case. 672 * testsuite/Makefile.in: Regenerate. 673 * testsuite/start_lib_test_main.c: New file. 674 * testsuite/start_lib_test_1.c: New file. 675 * testsuite/start_lib_test_2.c: New file. 676 * testsuite/start_lib_test_3.c: New file. 677 6782010-08-19 Ian Lance Taylor <iant@google.com> 679 680 * Makefile.in: Rebuild with automake 1.11.1. 681 * aclocal.m4: Likewise. 682 * testsuite/Makefile.in: Likewise. 683 6842010-08-19 Ian Lance Taylor <iant@google.com> 685 686 PR 10893 687 * i386.cc (class Output_data_plt_i386): Update declarations. 688 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and 689 local_ifuncs_ fields. 690 (Target_i386::do_plt_section_for_global): New function. 691 (Target_i386::do_plt_section_for_local): New function. 692 (Output_data_plt_i386::Output_data_plt_i386): Add symtab 693 parameter; change all callers. Initialize global_ifuncs_ and 694 local_ifuncs_. If doing a static link define __rel_iplt_start and 695 __rel_iplt_end. 696 (Output_data_plt_i386::add_entry): Handle IFUNC symbols. 697 (Output_data_plt_i386::add_local_ifunc_entry): New function. 698 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC 699 symbols. 700 (Target_i386::make_plt_section): New function, broken out of 701 make_plt_entry. Set sh_info field of .rel.plt to point to .plt. 702 (Target_i386::make_plt_entry): Call make_plt_section. 703 (Target_i386::make_local_ifunc_plt_entry): New function. 704 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function. 705 (Target_i386::Scan::local): Handle IFUNC symbols. Add 706 R_386_IRELATIVE to switch. 707 (Target_i386::Scan::global): Likewise. 708 (Target_i386::Relocate::relocate): Likewise. 709 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to 710 switch. 711 * x86_64.cc (class Output_data_plt_x86_64): Update declarations. 712 (Target_x86_64::do_plt_section_for_global): New function. 713 (Target_x86_64::do_plt_section_for_local): New function. 714 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab 715 parameter; change all callers. If doing a static link define 716 __rela_iplt_start and __rela_iplt_end. 717 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols. 718 (Output_data_plt_x86_64::add_local_ifunc_entry): New function. 719 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt 720 to point to .plt. 721 (Target_x86_64::make_local_ifunc_plt_entry): New function. 722 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to 723 switch. 724 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function. 725 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add 726 R_X86_64_IRELATIVE to switch. 727 (Target_x86_64::Scan::global): Likewise. 728 (Target_x86_64::Relocate::relocate): Likewise. 729 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to 730 switch. 731 * target.h (class Target): Add plt_section_for_global and 732 plt_section_for_local functions. Add do_plt_section_for_global 733 and do_plt_section_for_local virtual functions. 734 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add 735 clarifying comments. 736 (Symbol::use_plt_offset): Handle IFUNC symbol. 737 * object.cc (Sized_relobj::Sized_relobj): Initialize 738 local_plt_offsets_. 739 (Sized_relobj::local_has_plt_offset): New function. 740 (Sized_relobj::local_plt_offset): New function. 741 (Sized_relobj::set_local_plt_offset): New function. 742 (Sized_relobj::do_count): Handle IFUNC symbol. 743 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take 744 a bit away from input_shndx_ field. Add set_is_func_symbol and 745 is_ifunc_symbol functions. 746 (class Sized_relobj): Update declarations. Remove Tls_got_entry 747 and Local_tls_got_offsets. Define Local_plt_offsets. Add 748 local_plt_offsets_ field. 749 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_. 750 * output.h (class Output_section_data): Add non-const 751 output_section function. 752 (class Output_data_got): Update declarations. 753 (class Output_data_got::Got_entry): Add use_plt_offset_ field. 754 Add use_plt_offset parameter to global and local constructors. 755 Change all callers. Change local_sym_index_ field to 31 bits. 756 Change GSYM_CODE and CONSTANT_CODE accordingly. 757 * output.cc (Output_data_reloc_base::do_adjust_output_section): If 758 doing a static link don't set sh_link field. 759 (Output_data_got::Got_entry::write): Use PLT offset if 760 appropriate. 761 (Output_data_got::add_global_plt): New function. 762 (Output_data_got::add_local_plt): New function. 763 * target-reloc.h (relocate_section): Handle IFUNC symbol. 764 * defstd.cc (in_section): Remove entries for __rel_iplt_start, 765 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end. 766 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11. 767 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within 768 IFUNC conditional. 769 * testsuite/ifunc-sel.h: New file. 770 * testsuite/ifuncmain1.c: New file. 771 * testsuite/ifuncmain1vis.c: New file. 772 * testsuite/ifuncmod1.c: New file. 773 * testsuite/ifuncdep2.c: New file. 774 * testsuite/ifuncmain2.c: New file. 775 * testsuite/ifuncmain3.c: New file. 776 * testsuite/ifuncmod3.c: New file. 777 * testsuite/ifuncmain4.c: New file. 778 * testsuite/ifuncmain5.c: New file. 779 * testsuite/ifuncmod5.c: New file. 780 * testsuite/ifuncmain6pie.c: New file. 781 * testsuite/ifuncmod6.c: New file. 782 * testsuite/ifuncmain7.c: New file. 783 * configure, testsuite/Makefile.in: Rebuild. 784 7852010-08-18 Ian Lance Taylor <iant@google.com> 786 787 * incremental.cc 788 (Output_section_incremental_inputs::write_input_files): Add cast 789 to avoid signed/unsigned comparison warning. 790 (Output_section_incremental_inputs::write_info_blocks): Likewise. 791 7922010-08-12 Cary Coutant <ccoutant@google.com> 793 794 * common.cc (Sort_commons::operator()): Remove unnecessary code. 795 7962010-08-13 Ian Lance Taylor <iant@google.com> 797 798 * testsuite/incremental_test_1.c: Add prototype to avoid warning. 799 8002010-08-12 Cary Coutant <ccoutant@google.com> 801 Doug Kwan <dougkwan@google.com> 802 803 * resolve.cc (Symbol_table::should_override): When a weak dynamic 804 defintion overrides non-weak undef, remember that the original undef 805 is not weak. 806 * symtab.cc (Symbol_table::sized_write_global): For undef without 807 an original weak binding, set binding to global in output. 808 * testsuite/Makefile.am: Add new test strong_ref_weak_def. 809 * testsuite/Makefile.in: Regenerate. 810 * testsuite/strong_ref_weak_def.sh: New file. 811 * testsuite/strong_ref_weak_def_1.c: Ditto. 812 * testsuite/strong_ref_weak_def_2.c: Ditto. 813 8142010-08-12 Cary Coutant <ccoutant@google.com> 815 816 * testsuite/incremental_test.sh: Rewrite. 817 * testsuite/incremental_test_1.c: Rewrite. 818 * testsuite/incremental_test_2.c: Rewrite. 819 8202010-08-12 Cary Coutant <ccoutant@google.com> 821 822 * arm.cc (Target_arm::got_size): Add const. 823 (Target_arm::got_entry_count): New function. 824 (Target_arm::plt_entry_count): New function. 825 (Target_arm::first_plt_entry_offset): New function. 826 (Target_arm::plt_entry_size): New function. 827 (Output_data_plt_arm::entry_count): New function. 828 (Output_data_plt_arm::first_plt_entry_offset): New function. 829 (Output_data_plt_arm::get_plt_entry_size): New function. 830 * i386.cc (Target_i386::got_size): Add const. 831 (Target_i386::got_entry_count): New function. 832 (Target_i386::plt_entry_count): New function. 833 (Target_i386::first_plt_entry_offset): New function. 834 (Target_i386::plt_entry_size): New function. 835 (Output_data_plt_i386::entry_count): New function. 836 (Output_data_plt_i386::first_plt_entry_offset): New function. 837 (Output_data_plt_i386::get_plt_entry_size): New function. 838 * incremental-dump.cc (dump_incremental_inputs): Adjust call to 839 find_incremental_inputs_sections. Dump incremental_got_plt section. 840 * incremental.cc: Include target.h. 841 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add 842 parameter. Adjust all callers. Find incremental_got_plt section. 843 (Incremental_inputs::create_data_sections): Create incremental_got_plt 844 section. 845 (Output_section_incremental_inputs::set_final_data_size): Calculate 846 size of incremental_got_plt section. 847 (Output_section_incremental_inputs::do_write): Write the 848 incremental_got_plt section. 849 (Got_plt_view_info): New struct. 850 (Local_got_offset_visitor): New class. 851 (Global_got_offset_visitor): New class. 852 (Global_symbol_visitor_got_plt): New class. 853 (Output_section_incremental_inputs::write_got_plt): New function. 854 * incremental.h (Incremental_binary::find_incremental_inputs_sections): 855 Add parameter. Adjust all callers. 856 (Incremental_binary::do_find_incremental_inputs_sections): Likewise. 857 (Incremental_inputs::got_plt_section): New function. 858 (Incremental_inputs::got_plt_section_): New data member. 859 (Incremental_got_plt_reader): New class. 860 * layout.cc (Layout::create_incremental_info_sections): Add the 861 incremental_got_plt section. 862 * object.h (Got_offset_list::get_list): New function. 863 (Got offset_list::for_all_got_offsets): New function. 864 (Sized_relobj::local_got_offset_list): New function. 865 * powerpc.cc (Target_powerpc::got_size): Add const. 866 (Target_powerpc::got_entry_count): New function. 867 (Target_powerpc::plt_entry_count): New function. 868 (Target_powerpc::first_plt_entry_offset): New function. 869 (Target_powerpc::plt_entry_size): New function. 870 (Output_data_plt_powerpc::entry_count): New function. 871 (Output_data_plt_powerpc::first_plt_entry_offset): New function. 872 (Output_data_plt_powerpc::get_plt_entry_size): New function. 873 * sparc.cc (Target_sparc::got_size): Add const. 874 (Target_sparc::got_entry_count): New function. 875 (Target_sparc::plt_entry_count): New function. 876 (Target_sparc::first_plt_entry_offset): New function. 877 (Target_sparc::plt_entry_size): New function. 878 (Output_data_plt_sparc::entry_count): New function. 879 (Output_data_plt_sparc::first_plt_entry_offset): New function. 880 (Output_data_plt_sparc::get_plt_entry_size): New function. 881 * symtab.h (Symbol::got_offset_list): New function. 882 (Symbol_table::for_all_symbols): New function. 883 * target.h (Sized_target::got_entry_count): New function. 884 (Sized_target::plt_entry_count): New function. 885 (Sized_target::plt_entry_size): New function. 886 * x86_64.cc (Target_x86_64::got_size): Add const. 887 (Target_x86_64::got_entry_count): New function. 888 (Target_x86_64::plt_entry_count): New function. 889 (Target_x86_64::first_plt_entry_offset): New function. 890 (Target_x86_64::plt_entry_size): New function. 891 (Output_data_plt_x86_64::entry_count): New function. 892 (Output_data_plt_x86_64::first_plt_entry_offset): New function. 893 (Output_data_plt_x86_64::get_plt_entry_size): New function. 894 8952010-08-12 Cary Coutant <ccoutant@google.com> 896 897 * archive.cc: Include incremental.h. 898 (Archive::Archive): Initialize incremental_info_. 899 (Archive::include_member): Record archive members in incremental info. 900 (Add_archive_symbols::run): Record begin and end of an archive in 901 incremental info. 902 (Lib_group::include_member): Record objects in incremental info. 903 * archive.h (Incremental_archive_entry): Forward declaration. 904 (Archive::set_incremental_info): New member function. 905 (Archive::incremental_info): New member function. 906 (Archive::Unused_symbol_iterator): New class. 907 (Archive::unused_symbols_begin): New member function. 908 (Archive::unused_symbols_end): New member function. 909 (Archive::incremental_info_): New data member. 910 * incremental-dump.cc (find_input_containing_global): New function. 911 (dump_incremental_inputs): Dump new incremental info sections. 912 * incremental.cc: Include symtab.h. 913 (Output_section_incremental_inputs): New class. 914 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support 915 new incremental info sections. 916 (Sized_incremental_binary::do_check_inputs): Likewise. 917 (Incremental_inputs::report_archive): Remove. 918 (Incremental_inputs::report_archive_begin): New function. 919 (Incremental_inputs::report_archive_end): New function. 920 (Incremental_inputs::report_object): New function. 921 (Incremental_inputs::finalize_inputs): Remove. 922 (Incremental_inputs::report_input_section): New function. 923 (Incremental_inputs::report_script): Rewrite. 924 (Incremental_inputs::finalize): Do nothing but finalize string table. 925 (Incremental_inputs::create_incremental_inputs_section_data): Remove. 926 (Incremental_inputs::sized_create_inputs_section_data): Remove. 927 (Incremental_inputs::create_data_sections): New function. 928 (Incremental_inputs::relocs_entsize): New function. 929 (Output_section_incremental_inputs::set_final_data_size): New function. 930 (Output_section_incremental_inputs::do_write): New function. 931 (Output_section_incremental_inputs::write_header): New function. 932 (Output_section_incremental_inputs::write_input_files): New function. 933 (Output_section_incremental_inputs::write_info_blocks): New function. 934 (Output_section_incremental_inputs::write_symtab): New function. 935 * incremental.h (Incremental_script_entry): Forward declaration. 936 (Incremental_object_entry): Forward declaration. 937 (Incremental_archive_entry): Forward declaration. 938 (Incremental_inputs): Forward declaration. 939 (Incremental_inputs_header_data): Remove. 940 (Incremental_inputs_header): Remove. 941 (Incremental_inputs_header_write): Remove. 942 (Incremental_inputs_entry_data): Remove. 943 (Incremental_inputs_entry): Remove. 944 (Incremental_inputs_entry_write): Remove. 945 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER. 946 (Incremental_binary::find_incremental_inputs_sections): Add parameters. 947 (Incremental_binary::do_find_incremental_inputs_sections): Likewise. 948 (Sized_ncremental_binary::do_find_incremental_inputs_sections): 949 Likewise. 950 (Incremental_input_entry): New class. 951 (Incremental_script_entry): New class. 952 (Incremental_object_entry): New class. 953 (Incremental_archive_entry): New class. 954 (Incremental_inputs::Incremental_inputs): Initialize new data members. 955 (Incremental_inputs::report_inputs): Remove. 956 (Incremental_inputs::report_archive): Remove. 957 (Incremental_inputs::report_archive_begin): New function. 958 (Incremental_inputs::report_archive_end): New function. 959 (Incremental_inputs::report_object): Change prototype. 960 (Incremental_inputs::report_input_section): New function. 961 (Incremental_inputs::report_script): Change prototype. 962 (Incremental_inputs::get_reloc_count): New function. 963 (Incremental_inputs::set_reloc_count): New function. 964 (Incremental_inputs::create_data_sections): New function. 965 (Incremental_inputs::create_incremental_inputs_section_data): Remove. 966 (Incremental_inputs::inputs_section): New function. 967 (Incremental_inputs::symtab_section): New function. 968 (Incremental_inputs::relocs_section): New function. 969 (Incremental_inputs::get_stringpool): Add const. 970 (Incremental_inputs::command_line): Add const. 971 (Incremental_inputs::inputs): Remove. 972 (Incremental_inputs::command_line_key): New function. 973 (Incremental_inputs::input_file_count): New function. 974 (Incremental_inputs::input_files): New function. 975 (Incremental_inputs::relocs_entsize): New function. 976 (Incremental_inputs::sized_create_inputs_section_data): Remove. 977 (Incremental_inputs::finalize_inputs): Remove. 978 (Incremental_inputs::Input_info): Remove. 979 (Incremental_inputs::lock_): Remove. 980 (Incremental_inputs::inputs_): Change type. 981 (Incremental_inputs::inputs_map_): Remove. 982 (Incremental_inputs::current_object_entry_): New data member. 983 (Incremental_inputs::inputs_section_): New data member. 984 (Incremental_inputs::symtab_section_): New data member. 985 (Incremental_inputs::relocs_section_): New data member. 986 (Incremental_inputs::reloc_count_): New data member. 987 (Incremental_inputs_reader): New class. 988 (Incremental_symtab_reader): New class. 989 (Incremental_relocs_reader): New class. 990 * layout.cc (Layout::finalize): Move finalization of incremental info 991 and creation of incremental info sections to follow finalization of 992 symbol table. Set offsets for postprocessing sections. 993 (Layout::create_incremental_info_sections): Call 994 Incremental_inputs::create_data_sections. Add incremental symtab 995 and relocs sections. Set sh_entsize and sh_link fields. Arrange for 996 sections to layout after input sections. 997 * layout.h (struct Timespec): Forward declaration. 998 (Layout::incremental_inputs): Add const. 999 (Layout::create_incremental_info_sections): Add parameter. 1000 * main.cc (main): Remove call to Incremental_inputs::report_inputs. 1001 * object.cc: Include incremental.h. 1002 (Relobj::finalize_incremental_relocs): New function. 1003 (Sized_relobj::do_layout): Record input sections in incremental info. 1004 * object.h (Object::output_section): New function. 1005 (Object::output_section_offset): Moved from Relobj. 1006 (Object::get_incremental_reloc_base): New function. 1007 (Object::get_incremental_reloc_count): New function. 1008 (Object::do_output_section): New function. 1009 (Object::do_output_section_offset): Moved from Relobj. 1010 (Object::do_get_incremental_reloc_base): New function. 1011 (Object::do_get_incremental_reloc_count): New function. 1012 (Object::Object): Initialize new data members. 1013 (Relobj::output_section): Renamed do_output_section and moved to 1014 protected. 1015 (Relobj::output_section_offset): Moved to Object. 1016 (Relobj::do_get_incremental_reloc_base): New function. 1017 (Relobj::do_get_incremental_reloc_count): New function. 1018 (Relobj::allocate_incremental_reloc_counts): New function. 1019 (Relobj::count_incremental_reloc): New function. 1020 (Relobj::finalize_incremental_relocs): New function. 1021 (Relobj::next_incremental_reloc_index): New function. 1022 (Relobj::reloc_counts_): New data member. 1023 (Relobj::reloc_bases_): New data member. 1024 (Sized_relobj::do_relocate_sections): Add parameter. Change caller. 1025 (Sized_relobj::relocate_sections): Add parameter. Change all callers. 1026 (Sized_relobj::incremental_relocs_scan): New function. 1027 (Sized_relobj::incremental_relocs_scan_reltype): New function. 1028 (Sized_relobj::incremental_relocs_write): New function. 1029 (Sized_relobj::incremental_relocs_write_reltype): New function. 1030 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for 1031 incremental link. 1032 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of 1033 archives and object files elsewhere. 1034 (Add_symbols::run): Report object files here. 1035 (Finish_group::run): Report end of archive at end of group. 1036 * reloc.cc: Include layout.h, incremental.h. 1037 (Sized_relobj::do_read_relocs): Need relocations for incremental link. 1038 (Sized_relobj::do_scan_relocs): Record relocations for incremental link. 1039 (Sized_relobj::incremental_relocs_scan): New function. 1040 (Sized_relobj::incremental_relocs_scan_reltype): New function. 1041 (Sized_relobj::do_relocate_sections): Write incremental relocations. 1042 (Sized_relobj::incremental_relocs_write): New function. 1043 (Sized_relobj::incremental_relocs_write_reltype): New function. 1044 * script.cc (read_input_script): Rewrite test for incremental link. 1045 Change call to Incremental_inputs::report_script. 1046 * symtab.h (Symbol_table::first_global_index): New function. 1047 (Symbol_table::output_count): New function. 1048 10492010-08-12 Doug Kwan <dougkwan@google.com> 1050 1051 * arm.cc (Target_arm::merge_object_attributes): Check command line 1052 options --no-wchar-size-warning and --no-enum-size-warning. 1053 * options.h (General_options): Add ld-compatible options 1054 --no-enum-size-warning and --no-wchar-size-warning. 1055 10562010-08-04 Ian Lance Taylor <iant@google.com> 1057 1058 * x86_64.cc (Target_x86_64::Scan::local): Use 1059 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and 1060 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY. 1061 (Target_x86_64::Scan::global): Likewise. 1062 (Target_x86_64::Relocate::relocate): Likewise. 1063 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc): 1064 Likewise. 1065 10662010-08-03 Cary Coutant <ccoutant@google.com> 1067 1068 * merge.cc (Output_merge_string::do_add_input_section): Count strings 1069 to reserve space in merged_strings vector. Keep total input size 1070 for stats. 1071 (Output_merge_string::do_print_merge_stats): Print total input size. 1072 * merge.h (Output_merge_string): Add input_size_ field. 1073 * stringpool.cc (Stringpool_template::string_length): Move 1074 implementations out of Stringpool_template class and place in 1075 stringpool.h. 1076 * stringpool.h (string_length): Move out of Stringpool_template. 1077 10782010-08-03 Ian Lance Taylor <iant@google.com> 1079 1080 PR 11712 1081 * layout.cc (relaxation_loop_body): If address of load segment is 1082 set, adjust address to include headers if possible. 1083 10842010-08-03 Ian Lance Taylor <iant@google.com> 1085 1086 * version.cc (version_string): Bump to 1.10. 1087 10882010-08-03 Ian Lance Taylor <iant@google.com> 1089 1090 PR 11805 1091 * layout.h (enum Output_section_order): Define. 1092 (class Layout): Update declarations. 1093 * layout.cc (Layout::get_output_section): Add order parameter. 1094 Remove is_interp, is_dynamic_linker_section, is_last_relro, and 1095 is_first_non_relro parameters. Change all callers. 1096 (Layout::choose_output_section): Likewise. 1097 (Layout::add_output_section_data): Likewise. 1098 (Layout::make_output_section): Likewise. Set order. 1099 (Layout::default_section_order): New function. 1100 (Layout::layout_eh_frame): Call add_output_section_to_nonload. 1101 * output.cc (Output_section::Output_section): Initialize order_. 1102 Don't initialize deleted fields. 1103 (Output_segment::Output_segment): Don't initialize deleted 1104 fields. 1105 (Output_segment::add_output_section_to_load): New function 1106 replacing add_output_section. Change all callers to call this or 1107 add_output_section_to_nonload. 1108 (Output_segment::add_output_section_to_nonload): New function. 1109 (Output_segment::remove_output_section): Rewrite. 1110 (Output_segment::add_initial_output_data): Likewise. 1111 (Output_segment::has_any_data_sections): Likewise. 1112 (Output_segment::is_first_section_relro): Likewise. 1113 (Output_segment::maximum_alignment): Likewise. 1114 (Output_segment::has_dynamic_reloc): New function replacing 1115 dynamic_reloc_count. Change all callers. 1116 (Output_segment::has_dynamic_reloc_list): New function replacing 1117 dynamic_reloc_count_list. Change all callers. 1118 (Output_segment::set_section_addresses): Rewrite. 1119 (Output_segment::set_offset): Rewrite. 1120 (Output_segment::find_first_and_last_list): Remove. 1121 (Output_segment::set_tls_offsets): Rewrite. 1122 (Output_segment::first_section_load_address): Likewise. 1123 (Output_segment::output_section_count): Likewise. 1124 (Output_segment::section_with_lowest_load_address): Likewise. 1125 (Output_segment::write_section_headers): Likewise. 1126 (Output_segment::print_sections_to_map): Likewise. 1127 * output.h (class Output_data): Remove dynamic_reloc_count_ 1128 field. Add has_dynamic_reloc_ field. Make bools into bitfields. 1129 (Output_data::add_dynamic_reloc): Rewrite. 1130 (Output_data::has_dynamic_reloc): New function. 1131 (Output_data::dynamic_reloc_count): Remove. 1132 (class Output_section): Add order_ field. Remvoe is_relro_local_, 1133 is_last_relro_, is_first_non_relro_, is_interp_, 1134 is_dynamic_linker_section_ fields. Add order and set_order 1135 functions. Remove is_relro_local, set_is_relro_local, 1136 is_last_relro, set_is_last_relro, is_first_non_relro, 1137 set_is_first_non_relro functions, is_interp, set_is_interp, 1138 is_dynamic_linker_section, and set_is_dynamic_linker_section 1139 functions. 1140 (class Output_segment): Change Output_data_list from std::list to 1141 std:;vector. Add output_lists_ field. Remove output_data_ and 1142 output_bss_ fields. Update declarations. 1143 11442010-08-02 Ian Lance Taylor <iant@google.com> 1145 1146 * arm.cc (Target_arm::gc_process_relocs): Use typename. 1147 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise. 1148 * sparc.cc (Target_sparc::gc_process_relocs): Likewise. 1149 11502010-08-02 Ian Lance Taylor <iant@google.com> 1151 1152 PR 11855 1153 * script.cc (Script_options::Script_options): Initialize 1154 symbol_definitions_ and symbol_references_. 1155 (Script_options::add_symbol_assignment): Update 1156 symbol_definitions_ and symbol_references_. 1157 (Script_options::add_symbol_reference): New function. 1158 (script_symbol): New function. 1159 * script.h (class Script_options): Add symbol_definitions_ and 1160 symbol_references_ fields. 1161 (Script_options::referenced_const_iterator): New type. 1162 (Script_options::referenced_begin): New function. 1163 (Script_options::referenced_end): New function. 1164 (Script_options::is_referenced): New function. 1165 (Script_options::any_unreferenced): New function. 1166 * script-c.h (script_symbol): Declare. 1167 * yyscript.y (exp): Call script_symbol. 1168 * symtab.cc: Include "script.h". 1169 (Symbol_table::gc_mark_undef_symbols): Add layout parameter. 1170 Change all callers. Check symbols referenced by scripts. 1171 (Symbol_table::add_undefined_symbols_from_command_line): Add 1172 layout parameter. Change all callers. 1173 (Symbol_table::do_add_undefined_symbols_from_command_line): 1174 Likewise. Break out loop body. Check symbols referenced by 1175 scripts. 1176 (Symbol_table::add_undefined_symbol_from_command_line): New 1177 function broken out of 1178 do_add_undefined_symbols_from_command_line. 1179 * symtab.h (class Symbol_table): Update declarations. 1180 * archive.cc: Include "layout.h". 1181 (Archive::should_include_member): Add layout parameter. Change 1182 all callers. Check for symbol mentioned in expression. 1183 * archive.h (class Archive): Update declaration. 1184 * object.cc (Sized_relobj::do_should_include_member): Add layout 1185 parameter. 1186 * object.h (Object::should_include_member): Add layout parameter. 1187 Change all callers. 1188 (Object::do_should_include_member): Add layout parameter. 1189 (class Sized_relobj): Update declaration. 1190 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout 1191 parameter. 1192 * dynobj.h (class Sized_dynobj): Update declaration. 1193 * plugin.cc (Sized_pluginobj::do_should_include_member): Add 1194 layout parameter. 1195 * plugin.h (class Sized_pluginobj): Update declaration. 1196 11972010-08-02 Ian Lance Taylor <iant@google.com> 1198 1199 PR 11866 1200 * output.cc (Output_segment::set_offset): Search for the first and 1201 last sections rather than assuming that the list is in order. 1202 (Output_segment::find_first_and_last_list): New function. 1203 * output.h (class Output_segment): Update declarations. 1204 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test. 1205 (relro_strip_test_SOURCES): New variable. 1206 (relro_strip_test_DEPENDENCIES): New variable. 1207 (relro_strip_test_LDFLAGS): New variable. 1208 (relro_strip_test_LDADD): New variable. 1209 (relro_strip_test.so): New target. 1210 12112010-08-02 Ian Lance Taylor <iant@google.com> 1212 1213 * i386.cc (class Target_i386): Add got_tlsdesc_ field. 1214 (Target_i386::Target_i386):: Initialize got_tlsdesc_. 1215 (Target_i386::got_tlsdesc_section): New function. 1216 (Target_i386::got_section): Create space for GOT entries for 1217 TLSDESC relocations. 1218 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized 1219 R_386_TLS_GOTDESC. 1220 (Target_i386::Scan::global): Likewise. 1221 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when 1222 using TLSDESC GOT. 1223 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field. 1224 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_. 1225 (Target_x86_64::got_tlsdesc_section): New function. 1226 (Target_x86_64::got_section): Create space for GOT entries for 1227 TLSDESC relocations. 1228 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized 1229 R_386_TLS_GOTDESC. 1230 (Target_x86_64::Scan::global): Likewise. 1231 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when 1232 using TLSDESC GOT. 1233 12342010-08-02 Ian Lance Taylor <iant@google.com> 1235 1236 * testsuite/final_layout.sh: Use dc to convert from hex to 1237 decimal. 1238 12392010-07-29 Sriraman Tallam <tmsriram@google.com> 1240 1241 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template 1242 paramter to the call to gold::gc_process_relocs. 1243 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template 1244 paramter to the call to gold::gc_process_relocs. 1245 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template 1246 parameter to the call to gold::gc_process_relocs. 1247 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add 1248 template parameter to the call to gold::gc_process_relocs. 1249 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template 1250 paramter to the call to gold::gc_process_relocs. 1251 * gc.h (get_embedded_addend_size): New function. 1252 (gc_process_relocs): Save the size of the reloc for use by ICF. 1253 * icf.cc (get_section_contents): Get the addend from the text section 1254 for SHT_REL relocation sections. 1255 * icf.h (Icf::Reloc_addend_size_info): New typedef. 1256 (Icf::Reloc_info): Add new member reloc_addend_size_info. 1257 * int_encoding.h (read_from_pointer): New overloaded function. 1258 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test. 1259 * testsuite/icf_sht_rel_addend_test.sh: New file. 1260 * testsuite/icf_sht_rel_addend_test_1.cc: New file. 1261 * testsuite/icf_sht_rel_addend_test_2.cc: New file. 1262 12632010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 1264 1265 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option. 1266 * Makefile.in: Regenerate. 1267 * testsuite/Makefile.in: Regenerate. 1268 12692010-07-27 Jeffrey Yasskin <jyasskin@google.com> 1270 1271 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior. 1272 * gold/testsuite/debug_msg.cc: Likewise. 1273 * gold/testsuite/odr_violation1.cc 1274 * gold/testsuite/odr_violation2.cc 1275 12762010-07-21 Cary Coutant <ccoutant@google.com> 1277 1278 * merge.h (Output_merge_string::Merged_string): Remove object, shndx, 1279 string, and length fields. 1280 (Output_merge_string::Merged_strings_list): New type. 1281 (Output_merge_string::Merged_strings_lists): New typedef. 1282 (Output_merge_string): Replace merged_strings_ with 1283 merged_strings_lists_. 1284 * merge.cc (Output_merge_string::do_add_input_section): Allocate new 1285 Merged_strings_list per input object and section. Don't store pointer 1286 to the string. Don't store length with each merged string entry. 1287 (Output_merge_string::finalize_merged_data): Loop over list of merged 1288 strings lists. Recompute length of each merged string. 1289 12902010-07-15 Cary Coutant <ccoutant@google.com> 1291 1292 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from 1293 here. 1294 12952010-07-14 Ian Lance Taylor <iant@google.com> 1296 1297 * descriptors.cc (Descriptors::open): Report correct name in error 1298 message. 1299 13002010-07-13 Doug Kwan <dougkwan@google.com> 1301 1302 * arm.cc (Arm_input_section::Arm_input_section): For a 1303 SHT_ARM_EXIDX section, always keeps the input sections. 1304 (Arm_input_section::set_exidx_section_link): New method. 1305 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize 1306 has_errors_ to false. 1307 (Arm_exidx_input_section::has_errors, 1308 Arm_exidx_input_section::set_has_errors): New methods. 1309 (Arm_exidx_input_section::has_errors_): New data member. 1310 (Arm_relobj::get_exidx_shndx_list): New method. 1311 (Arm_output_section::append_text_sections_to_list): Do not skip 1312 section without SHF_EXECINSTR. 1313 (Arm_output_section::fix_exidx_coverage): Skip input sections with 1314 errors. 1315 (Arm_relobj::make_exidx_input_section): Add new parameter for text 1316 section header. Make error messages more verbose. Check for 1317 a non-executable section linked to an EXIDX section. 1318 (Arm_relobj::do_read_symbols): Remove error checking, which has been 1319 moved to Arm_relobj::make_exidx_input_section. Add an assertion to 1320 check that there is no deferred EXIDX section if we exit early. 1321 Instead of not making an EXIDX section in case of an error, make one 1322 and set the has_errors flag of it. 1323 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections 1324 in a relocatable link. 1325 (Target_arm::do_relax): Look for the EXIDX output section instead of 1326 assuming that it is called .ARM.exidx. 1327 (Target_arm::fix_exidx_coverage): Add a new parameter for input 1328 section list. Do not check for SHF_EXECINSTR section flags but 1329 skip any input section with errors. 1330 * output.cc (Output_section::Output_section): Initialize 1331 always_keeps_input_sections_ to false. 1332 (Output_section::add_input_section): Check for 1333 always_keeps_input_sections_. 1334 * output.h (Output_section::always_keeps_input_sections, 1335 Output_section::set_always_keeps_input_sections): New methods. 1336 (Output_section::always_keeps_input_sections): New data member. 1337 13382010-07-13 Rafael Espindola <espindola@google.com> 1339 1340 * fileread.cc (try_extra_search_path, find_file): Move to Input_file. 1341 * fileread.h (Input_file): Add try_extra_search_path and find_file. 1342 13432010-07-13 Philip Herron <herron.philip@googlemail.com> 1344 Ian Lance Taylor <iant@google.com> 1345 1346 * output.h (Output_section_lookup_maps::add_merge_section): 1347 Correct check of whether value was inserted. 1348 (Output_section_lookup_maps::add_merge_input_section): Likewise. 1349 (Output_section_lookup_maps::add_relaxed_input_section): 1350 Likewise. 1351 * arm.cc (Target_arm::got_section): Remove used local os. 1352 * i386.cc (Target_i386::got_section): Likewise. 1353 * x86_64.cc (Target_x86_64::got_section): Likewise. 1354 * sparc.cc (Target_sparc::got_section): Likewise. 1355 (Target_sparc::relocate): Remove unused local have_got_offset. 1356 * powerpc.cc (Target_powerpc::relocate): Likewise. 1357 13582010-07-13 Ian Lance Taylor <iant@google.com> 1359 1360 * compressed_output.cc (zlib_decompress): Fix signature in 1361 !HAVE_ZLIB_H case. 1362 1363 * archive.cc (Archive::include_member): Unlock an external member 1364 of a thin archive. Don't bother to delete an object we know is 1365 NULL. 1366 13672010-07-12 Cary Coutant <ccoutant@google.com> 1368 1369 * compressed_output.cc (zlib_decompress): New function. 1370 (get_uncompressed_size): New function. 1371 (decompress_input_section): New function. 1372 * compressed_output.h (get_uncompressed_size): New function. 1373 (decompress_input_section): New function. 1374 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info) 1375 Handle compressed debug sections. 1376 * layout.cc (is_compressed_debug_section): New function. 1377 (Layout::output_section_name): Map compressed section names to 1378 canonical names. 1379 * layout.h (is_compressed_debug_section): New function. 1380 (is_debug_info_section): Recognize compressed debug sections. 1381 * merge.cc: Include compressed_output.h. 1382 (Output_merge_data::do_add_input_section): Handle compressed 1383 debug sections. 1384 (Output_merge_string::do_add_input_section): Handle compressed 1385 debug sections. 1386 * object.cc: Include compressed_output.h. 1387 (Sized_relobj::Sized_relobj): Initialize new data members. 1388 (build_compressed_section_map): New function. 1389 (Sized_relobj::do_read_symbols): Handle compressed debug sections. 1390 * object.h (Object::section_is_compressed): New method. 1391 (Object::do_section_is_compressed): New method. 1392 (Sized_relobj::Compressed_section_map): New type. 1393 (Sized_relobj::do_section_is_compressed): New method. 1394 (Sized_relobj::compressed_sections_): New data member. 1395 * output.cc (Output_section::add_input_section): Handle compressed 1396 debug sections. 1397 * reloc.cc: Include compressed_output.h. 1398 (Sized_relobj::write_sections): Handle compressed debug sections. 1399 14002010-07-08 Cary Coutant <ccoutant@google.com> 1401 1402 * resolve.cc (Symbol_table::resolve): Remember whether undef was 1403 weak when resolving to a dynamic def. 1404 (Symbol_table::should_override): Add adjust_dyndef flag; set it 1405 for weak undef/dynamic def cases. Adjust callers. 1406 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and 1407 undef_binding_weak_. 1408 (Symbol_table::sized_write_globals): Adjust symbol binding. 1409 (Symbol_table::sized_write_symbol): Add binding parameter. 1410 * symtab.h (Symbol::set_undef_binding): New method. 1411 (Symbol::is_undef_binding_weak): New method. 1412 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members. 1413 (Symbol_table::should_override): Add new parameter. 1414 (Symbol_table::sized_write_symbol): Add new parameter. 1415 1416 * testsuite/weak_undef_file1.cc: Add new test case. 1417 * testsuite/weak_undef_file2.cc: Fix header comment. 1418 * testsuite/weak_undef_test.cc: Add new test case. 1419 14202010-06-29 Doug Kwan <dougkwan@google.com> 1421 1422 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property): 1423 Initialize USE_SYMBOL_. 1424 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method 1425 definition. 1426 (Arm_reloc_property::uses_symbol_): New data member declaration. 1427 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation 1428 uses symbol value and symbol is undefined but not weakly undefined. 1429 14302010-06-28 Rafael Espindola <espindola@google.com> 1431 1432 * plugin.cc (Plugin::load): Use dlerror. 1433 14342010-06-26 Jeffrey Yaskin <jyasskin@google.com> 1435 1436 * symtab.cc (detect_odr_violations): When reporting an ODR 1437 violation, report an object where the symbol is defined. 1438 14392010-06-25 Doug Kwan <dougkwan@google.com> 1440 1441 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true. 1442 (Target_arm::section_may_have_icf_unsafe_pointers): New method 1443 definition. 1444 (Target_arm::Scan::local_reloc_may_be_function_pointer, 1445 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement 1446 target hook to detect function points. 1447 (Target_arm::Scan::possible_function_pointer_reloc): New method. 1448 * icf.h (Icf::check_section_for_function_pointers): Change type of 1449 parameter SECTION_NAME to const reference to std::string. Use 1450 target hook to determine if section may have unsafe pointers. 1451 * target.h (Target::section_may_have_icf_unsafe_pointers): New 1452 method definition. 1453 14542010-06-21 Rafael Espindola <espindola@google.com> 1455 1456 * fileread.cc (Input_file::find_fie): New 1457 (Input_file::open): Use Input_file::find_fie. 1458 * fileread.h (Input_file::find_fie): New 1459 * plugin.cc (set_extra_library_path): New. 1460 (Plugin::load): Add set_extra_library_path to the transfer vector. 1461 (Plugin_manager::set_extra_library_path): New. 1462 (Plugin_manager::add_input_file): Use the extra search path if set. 1463 (set_extra_library_path(): New. 1464 * plugin.h (Plugin_manager): Add set_extra_library_path and 1465 extra_search_path_. 1466 14672010-06-19 Cary Coutant <ccoutant@google.com> 1468 1469 * layout.cc (gdb_sections): Add .debug_types. 1470 (lines_only_debug_sections): Likewise. 1471 14722010-06-18 Rafael Espindola <espindola@google.com> 1473 1474 * plugin.cc (add_input_file,add_input_library) 1475 (Plugin_manager::add_input_file): Make filename arguments const. 1476 * plugin.h (Plugin_manager::add_input_file): Make filename arguments 1477 const. 1478 14792010-06-16 Doug Kwan <dougkwan@google.com> 1480 1481 * arm.cc (Target_arm::do_finalize_sections): Do not emit an 1482 .ARM.attributes section if we have not merged any input 1483 attributes sections. 1484 14852010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com> 1486 1487 * arm.cc: Allow combining objects with no EABI version 1488 information. 1489 14902010-06-15 Rafael Espindola <espindola@google.com> 1491 1492 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol. 1493 14942010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com> 1495 1496 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV. 1497 (struct iovec): Correct !HAVE_READV definition. 1498 14992010-06-10 Cary Coutant <ccoutant@google.com> 1500 1501 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections. 1502 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred 1503 reloc sections. 1504 * object.h (Sized_relobj::deferred_layout_relocs_): New data member. 1505 1506 PR 11683 1507 * symtab.h (Symbol::is_placeholder): New member function. 1508 * target-reloc.h (relocate_section): Check for placeholder symbols. 1509 1510 * testsuite/Makefile.am (plugin_test_8): New test. 1511 (plugin_test_9): New test. 1512 * testsuite/Makefile.in: Regenerate. 1513 15142010-06-09 Nick Clifton <nickc@redhat.com> 1515 1516 * yyscript.y (input_list_element): Allow strings prefixed with 1517 the '-' character. Treat these as libraries. 1518 * script.cc (script_add_library): New function. Adds a library 1519 specified by "-l<name>" found in an input script. 1520 * script-c.h: Add prototype for script_add_library. 1521 15222010-06-07 Doug Kwan <dougkwan@google.com> 1523 1524 * arm.cc (Target_arm::do_relax): Reserve more space for stubs. 1525 Restrict stub-group size to be within long conditional branch 1526 range when working around cortex-A8 erratum. 1527 15282010-06-07 Damien Diederen <dd@crosstwine.com> 1529 1530 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct 1531 #ifdef typo. 1532 15332010-06-03 Sriraman Tallam <tmsriram@google.com> 1534 1535 PR gold/11658 1536 * output.cc 1537 (Output_section::Input_section_sort_entry::compare_section_ordering): 1538 Change to return non-zero correctly. 1539 (Output_section::Input_section_sort_section_order_index_compare 1540 ::operator()): Change to fix ambiguity in comparisons. 1541 15422010-06-01 Sriraman Tallam <tmsriram@google.com> 1543 1544 * gold.h (is_wildcard_string): New function. 1545 * layout.cc (Layout::layout): Pass this pointer to add_input_section. 1546 (Layout::layout_eh_frame): Ditto. 1547 (Layout::find_section_order_index): New method. 1548 (Layout::read_layout_from_file): New method. 1549 * layout.h (Layout::find_section_order_index): New method. 1550 (Layout::read_layout_from_file): New method. 1551 (Layout::input_section_position_): New private member. 1552 (Layout::input_section_glob_): New private member. 1553 * main.cc (main): Call read_layout_from_file here. 1554 * options.h (--section-ordering-file): New option. 1555 * output.cc (Output_section::input_section_order_specified_): New 1556 member. 1557 (Output_section::Output_section): Initialize new member. 1558 (Output_section::add_input_section): Add new parameter. 1559 Keep input sections when --section-ordering-file is used. 1560 (Output_section::set_final_data_size): Sort input sections when 1561 section ordering file is specified. 1562 (Output_section::Input_section_sort_entry): Add new parameter. 1563 Check sorting type. 1564 (Output_section::Input_section_sort_entry::compare_section_ordering): 1565 New method. 1566 (Output_section::Input_section_sort_compare::operator()): Change to 1567 consider section_order_index. 1568 (Output_section::Input_section_sort_init_fini_compare::operator()): 1569 Change to consider section_order_index. 1570 (Output_section::Input_section_sort_section_order_index_compare 1571 ::operator()): New method. 1572 (Output_section::sort_attached_input_sections): Change to sort 1573 according to section order when specified. 1574 (Output_section::add_input_section<32, true>): Add new parameter. 1575 (Output_section::add_input_section<64, true>): Add new parameter. 1576 (Output_section::add_input_section<32, false>): Add new parameter. 1577 (Output_section::add_input_section<64, false>): Add new parameter. 1578 * output.h (Output_section::add_input_section): Add new parameter. 1579 (Output_section::input_section_order_specified): New 1580 method. 1581 (Output_section::set_input_section_order_specified): New method. 1582 (Input_section::Input_section): Initialize section_order_index_. 1583 (Input_section::section_order_index): New method. 1584 (Input_section::set_section_order_index): New method. 1585 (Input_section::section_order_index_): New member. 1586 (Input_section::Input_section_sort_section_order_index_compare): New 1587 struct. 1588 (Output_section::input_section_order_specified_): New member. 1589 * script-sections.cc (is_wildcard_string): Delete and move modified 1590 method to gold.h. 1591 (Output_section_element_input::Output_section_element_input): Modify 1592 call to is_wildcard_string. 1593 (Output_section_element_input::Input_section_pattern 1594 ::Input_section_pattern): Ditto. 1595 (Output_section_element_input::Output_section_element_input): Ditto. 1596 * testsuite/Makefile.am (final_layout): New test case. 1597 * testsuite/Makefile.in: Regenerate. 1598 * testsuite/final_layout.cc: New file. 1599 * testsuite/final_layout.sh: New file. 1600 16012010-06-01 Rafael Espindola <espindola@google.com> 1602 1603 * plugin.cc (Plugin::load): Pass the output name to the plugin. 1604 16052010-06-01 Rafael Espindola <espindola@google.com> 1606 1607 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the 1608 visibility of symbols. 1609 16102010-05-27 Doug Kwan <dougkwan@google.com> 1611 1612 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset 1613 from start of output section instead of address for a local symbol 1614 in a merged or relaxed section when doing a relocatable link. 1615 16162010-05-26 Rafael Espindola <espindola@google.com> 1617 1618 PR 11604 1619 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid 1620 adding sections the garbage collector removed. 1621 * gold/testsuite/Makefile.am: Add test. 1622 * gold/testsuite/Makefile.in: Regenerate. 1623 * gold/testsuite/plugin_test_7.sh: New. 1624 * gold/testsuite/plugin_test_7_1.c: New. 1625 * gold/testsuite/plugin_test_7_2.c: New. 1626 16272010-05-26 Rafael Espindola <espindola@google.com> 1628 1629 * script-sections.cc (Output_section_definition::set_section_addresses): 1630 Check for --section-start. 1631 16322010-05-26 Doug Kwan <dougkwan@google.com> 1633 1634 * arm.cc (Arm_scan_relocatable_relocs): New class. 1635 (Target_arm::relocate_special_relocatable): New method. 1636 (Arm_relocate_functions::arm_branch_common): Handle relocatable link. 1637 (Arm_relocate_functions::thumb_branch_common): Same. 1638 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs 1639 instead of Default_scan_relocatable_relocs. 1640 * target-reloc.h (relocate_for_relocatable): Let target handle 1641 relocation strategy Relocatable_relocs::RELOC_SPECIAL. 1642 * target.h (Sized_target::relocate_special_relocatable): New method. 1643 16442010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com> 1645 1646 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined. 1647 16482010-05-23 Doug Kwan <dougkwan@google.com> 1649 1650 * arm.cc (Arm_input_section::do_output_offset): Use convert_types 1651 instead of a cast. 1652 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch 1653 with a direct branch, not a conditional branch, to a stub. 1654 * merge.cc (Output_merge_base::record_input_section): New method 1655 defintion. 1656 (Output_merge_data::do_add_input_section): Record input section if 1657 keeps-input-sections flag is set. 1658 (Output_merge_string::do_add_input_section): Ditto. 1659 * merge.h (Output_merge_base::Output_merge_base): Initialize new data 1660 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and 1661 INPUT_SECTIONS_. 1662 (Output_merge_base::keeps_input_sections, 1663 Output_merge_base::set_keeps_input_sections, 1664 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New 1665 method definitions. 1666 (Output_merge_base::Input_sections): New type declaration. 1667 (Output_merge_base::input_sections_begin, 1668 Output_merge_base::input_sections_end, 1669 Output_merge_base::do_set_keeps_input_sections): New method definitions. 1670 (Output_merge_base::bool keeps_input_sections_, 1671 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_, 1672 Output_merge_base::input_sections_): New data members. 1673 (Output_merge_data::do_set_keeps_input_sections): New method 1674 defintion. 1675 (Output_merge_string::do_set_keeps_input_sections): Ditto. 1676 * output.cc (Output_section::Input_section::relobj): Move method 1677 defintion from class declaration to here and handle merge sections. 1678 (Output_section::Input_section::shndx): Ditto. 1679 (Output_section::Output_section): Remove initializations of removed 1680 data members and initialize new data member LOOKUP_MAPS_. 1681 (Output_section::add_input_section): Set keeps-input-sections flag 1682 for a newly created merge output section as appropriate. Adjust code 1683 to use Output_section_lookup_maps class. 1684 (Output_section::add_relaxed_input_section): Adjst code for lookup 1685 maps code refactoring. 1686 (Output_section::add_merge_input_section): Add a new parameter 1687 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps 1688 class. If adding input section to a newly created merge output 1689 section fails, remove the new merge section. 1690 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections): 1691 Adjust code for use of the Output_section_lookup_maps class. 1692 (Output_section::find_merge_section): Ditto. 1693 (Output_section::build_lookup_maps): New method defintion. 1694 (Output_section::find_relaxed_input_section): Adjust code to use 1695 Output_section_lookup_maps class. 1696 (Output_section::get_input_sections): Export merge sections. Adjust 1697 code to use Output_section_lookup_maps class. 1698 (Output_section:::add_script_input_section): Adjust code to use 1699 Output_section_lookup_maps class. Update lookup maps for merge 1700 sections also. 1701 (Output_section::discard_states): Use Output_section_lookup_maps. 1702 (Output_section::restore_states): Same. 1703 * output.h (Merge_section_properties): Move class defintion out of 1704 Output_section. 1705 (Output_section_lookup_maps): New class. 1706 (Output_section::Input_section::is_merge_section): New method 1707 defintion. 1708 (Output_section::Input_section::relobj): Move defintion out of class 1709 defintion. Declare method only. 1710 (Output_section::Input_section::shndx): Ditto. 1711 (Output_section::Input_section::output_merge_base): New method defintion. 1712 (Output_section::Input_section::u2_.pomb): New union field. 1713 (Output_section::Merge_section_by_properties_map, 1714 Output_section::Output_section_data_by_input_section_map, 1715 Output_section::Ouptut_relaxed_input_section_by_input_section_map): 1716 Remove types. 1717 (Output_section::add_merge_input_section): Add new parameter 1718 KEEPS_INPUT_SECTIONS. 1719 (Output_section::build_lookup_maps): New method declaration. 1720 (Output_section::merge_section_map_, 1721 Output_section::merge_section_by_properties_map_, 1722 Output_section::relaxed_input_section_map_, 1723 Output_section::is_relaxed_input_section_map_valid_): Remove data 1724 members. 1725 (Output_section::lookup_maps_): New data member. 1726 17272010-05-21 Doug Kwan <dougkwan@google.com> 1728 1729 PR gold/11619 1730 * arm.cc (Arm_input_section::do_output_offset): Add a cast to 1731 avoid a compilation error. 1732 17332010-05-19 Rafael Espindola <espindola@google.com> 1734 1735 * script-sections.cc (Output_section_definition::allocate_to_segment): 1736 Update the phdrs_list even when the output section is NULL. 1737 * testsuite/Makefile.am: Add test. 1738 * testsuite/Makefile.in: Regenerate. 1739 * testsuite/script_test_9.cc: New. 1740 * testsuite/script_test_9.sh: New. 1741 * testsuite/script_test_9.t: New. 1742 17432010-05-19 Doug Kwan <dougkwan@google.com> 1744 1745 * arm.cc (Arm_input_section::original_size): New method. 1746 (Arm_input_section::do_addralign): Add a cast. 1747 (Arm_input_section::do_output_offset): Remove static cast. 1748 (Arm_input_section::original_addralign, 1749 Arm_input_section::original_size_): Change type to uint32_t. 1750 (Arm_input_section::init): Add safe casts for section alignment 1751 and size. 1752 (Arm_input_section::set_final_data_size): Do not set address and 1753 offset of stub table. 1754 (Arm_output_section::fix_exidx_coverage): Change use of of 1755 Output_section::Simple_input_section to that of 1756 Output_section::Input_section. 1757 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables 1758 except for the first pass. 1759 * output.cc (Output_section::get_input_sections): Change type of 1760 input_sections to std::list<Input_section>. 1761 (Output_section::add_script_input_section): Rename from 1762 Output_section::add_simple_input_section. Change type of SIS 1763 parameter from Simple_input_section to Input_section. 1764 * output.h (Output_section::Simple_input_section): Remove class. 1765 (Output_section::Input_section): Change class visibility to public. 1766 (Output_section::Input_section::addralign): Use stored alignments 1767 for special input sections if set. 1768 (Output_section::Input_section::set_addralign): New method. 1769 (Output_section::get_input_sections): Change parameter type from 1770 list of Simple_input_section to list of Input_section. 1771 (Output_section::add_script_input_section): Rename from 1772 Output_section::add_simple_input_section. Change first parameter's 1773 type from Simple_input_section to Input_section and remove the 1774 second and third parameters. 1775 * script-sections.cc (Input_section::Input_section_list): Change 1776 type to list of Output_section::Input_section/ 1777 (Input_section_info::Input_section_info): Change parameter type of 1778 INPUT_SECTION to Output_section::Input_section. 1779 (Input_section_info::input_section): Change return type. 1780 (Input_section_info::input_section_): Change type to 1781 Output_section::Input_section. 1782 (Output_section_element_input::set_section_addresses): Adjust code 1783 to use Output_section::Input_section instead of 1784 Output_section::Simple_input_section. Adjust code for renaming 1785 of Output_section::add_simple_input_section. 1786 (Orphan_output_section::set_section_addresses): Ditto. 1787 17882010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 1789 1790 * gold.h (Unordered_multimap, Unordered_map): Fix defines for 1791 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set. 1792 17932010-05-18 Rafael Espindola <espindola@google.com> 1794 1795 * options.cc (General_options::finalize): Handle -nostdlib. 1796 * options.h (nostdlib): New option. 1797 * script.cc (script_add_search_dir): Handle -nostdlib. 1798 17992010-05-12 Doug Kwan <dougkwan@google.com> 1800 1801 * arm.cc (Target_arm::do_finalize_sections): Create an empty 1802 attributes section only if there no attributes section after merging. 1803 (Target_arm::merge_object_attributes): Move value of 1804 Tag_MPextension_use_legacy to that of Tag_MPextension_use. 1805 Handle Tag_DIV_use and Tag_MPextension_use_legacy. 1806 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh 1807 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout 1808 and arm_attr_merge_7.stdout. 1809 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o 1810 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r, 1811 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o, 1812 arm_attr_merge_7b.o): New rules. 1813 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and 1814 arm_attr_merge_7 1815 * testsuite/Makefile.in: Regenerate. 1816 * testsuite/arm_attr_merge.sh: New file. 1817 * testsuite/arm_attr_merge_[67][ab].s: Same. 1818 18192010-05-05 Nick Clifton <nickc@redhat.com> 1820 1821 * po/es.po: Updated Spanish translation. 1822 18232010-04-27 H.J. Lu <hongjiu.lu@intel.com> 1824 1825 * Makefile.am (install-exec-local): Properly install gold as 1826 default cross linker. 1827 * Makefile.in: Regenerated. 1828 18292010-04-27 H.J. Lu <hongjiu.lu@intel.com> 1830 Nick Clifton <nickc@redhat.com> 1831 1832 * configure.ac (install_as_default): Define and set to false 1833 unless --enable-gold or --enable-gold=both/gold has been 1834 specified. 1835 * configure: Regenerate. 1836 1837 * Makefile.am (install-exec-local): Install the executable as 1838 'ld.gold'. If install_as_default is true then also install it as 1839 'ld'. 1840 * Makefile.in: Regenerated. 1841 18422010-04-24 Ian Lance Taylor <iant@google.com> 1843 1844 * layout.cc (Layout::layout_reloc): In relocatable link don't 1845 combine reloc sections for grouped sections. 1846 18472010-04-23 Sriraman Tallam <tmsriram@google.com> 1848 1849 * gc.h (gc_process_relocs): Pass information on relocs pointing to 1850 sections that are not ordinary to icf. 1851 * icf.cc (get_section_contents): Handle relocation pointing to section 1852 with no object or shndx information. 1853 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh 1854 * testsuite/Makefile.in: Regenerate. 1855 * testsuite/icf_virtual_function_folding_test.cc: Remove printf. 1856 * testsuite/icf_virtual_function_folding_test.sh: Delete file. 1857 18582010-04-22 Ian Lance Taylor <iant@google.com> 1859 1860 * expression.cc (Expression::Expression_eval_info): Add 1861 result_alignment_pointer field. 1862 (Expression::eval_with_dot): Add result_alignment_pointer 1863 parameter. Change all callers. 1864 (Expression::eval_maybe_dot): Likewise. 1865 (class Binary_expression): Add alignment_pointer parameter to 1866 left_value and right_value. Change all callers. 1867 (BINARY_EXPRESSION): Set result alignment. 1868 (class Trinary_expression): Add alignment_pointer parameter to 1869 arg2_value and arg3_value. Change all callers. 1870 (Trinary_cond::value): Set result alignment. 1871 (Max_expression::value, Min_expression::value): Likewise. 1872 (Align_expression::value): Likewise. 1873 * script-sections.cc (class Sections_element): Add dot_alignment 1874 parameter to set_section_addresses virtual function. Update 1875 instantiations. 1876 (class Output_section_element): Likewise. 1877 (Script_sections::create_segments): Add dot_alignment parameter. 1878 Change all callers. 1879 (Script_sections::create_segments_from_phdrs_clause): Likewise. 1880 (Script_sections::set_phdrs_clause_addresses): Likewise. 1881 * script-sections.h: Update declarations. 1882 * script.h: Update declarations. 1883 * output.h (Output_segment::set_minimum_p_align): Don't decrease 1884 min_p_align. 1885 * testsuite/script_test_3.t: Set large alignment. 1886 * testsuite/script_test_3.sh: Make sure that at least one LOAD 1887 segment has expected alignment. 1888 18892010-04-22 Nick Clifton <nickc@redhat.com> 1890 1891 * po/gold.pot: Updated by the Translation project. 1892 * po/vi.po: Updated Vietnamese translation. 1893 18942010-04-22 H.J. Lu <hongjiu.lu@intel.com> 1895 1896 * testsuite/Makefile.am (check_PROGRAMS): Add 1897 icf_virtual_function_folding_test. 1898 * testsuite/Makefile.in: Regenerated. 1899 19002010-04-15 Andrew Haley <aph@redhat.com> 1901 1902 * options.h (merge_exidx_entries): New option. 1903 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries. 1904 (class Arm_exidx_fixup::merge_exidx_entries_): New member. 1905 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries. 1906 (Target_arm::merge_exidx_entries): New function. 1907 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false. 1908 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries 1909 to Arm_exidx_fixup constructor. 1910 Add new arg, merge_exidx_entries. 1911 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to 1912 Arm_output_section::fix_exidx_coverage. 1913 19142010-04-18 Sriraman Tallam <tmsriram@google.com> 1915 1916 * icf.cc (get_section_contents): Check for preemptible functions. 1917 Ignore addend when appropriate. 1918 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for 1919 section folded. 1920 (add_from_relobj): Check for section folded. 1921 (set_dynsym_indexes): Fix call to should_add_dynsym_entry. 1922 * symtab.h (should_add_dynsym_entry): Add new parameter. 1923 * target-reloc.h (scan_relocs): Check for section folded. 1924 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc): 1925 Check reloc types for function pointers in shared objects. 1926 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test 1927 case. 1928 (icf_preemptible_functions_test): New test case. 1929 (icf_string_merge_test): New test case. 1930 * testsuite.Makefile.in: Regenerate. 1931 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and 1932 bar_glob. Refactor code. 1933 * testsuite/icf_preemptible_functions_test.cc: New file. 1934 * testsuite/icf_preemptible_functions_test.sh: New file. 1935 * testsuite/icf_string_merge_test.cc: New file. 1936 * testsuite/icf_string_merge_test.sh: New file. 1937 * testsuite/icf_virtual_function_folding_test.cc: New file. 1938 * testsuite/icf_virtual_function_folding_test.sh: New file. 1939 19402010-04-14 Doug Kwan <dougkwan@google.com> 1941 1942 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object 1943 for local symbol recounting if we remove a section due to ICF. 1944 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if 1945 there are no regular objects in input. 1946 19472010-04-13 Doug Kwan <dougkwan@google.com> 1948 1949 * arm.cc (Arm_input_section::set_final_data_size): Compute 1950 accurate final data size instead of using current data size. 1951 19522010-04-09 Doug Kwan <dougkwan@google.com> 1953 1954 * layout.cc (Layout::choose_output_section): Handle script section 1955 types. 1956 (Layout::make_output_section_for_script): Add section type parameter. 1957 Handle script section types. 1958 * layout.h (Layout::make_output_section_for_script): Add section 1959 type parameter. 1960 * output.cc (Output_section::Output_section): Initialize data member 1961 is_noload_. 1962 (Output_section::do_reset_address_and_file_offset): Do not set address 1963 to 0 if section is a NOLOAD section. 1964 * output.h (Output_section::is_noload): New method. 1965 (Output_section::set_is_noload): Ditto. 1966 (Output_section::is_noload_): New data member. 1967 * script-c.h (Script_section_type): New enum type. 1968 (struct Parser_output_section_header): Add new file section_type. 1969 * script-sections.cc (Sections_element::output_section_name): Add 1970 parameter for returning script section type. 1971 (Output_section_definition::output_section_name): Ditto. 1972 (Output_section_definition::section_type)P; New method. 1973 (Output_section_definiton::script_section_type_name): Ditto. 1974 (Output_section_definition::script_section_type_): New data member. 1975 (Output_section_definition::Output_section_definition): Initialize 1976 data member Output_section_definition::script_section_type_. 1977 (Output_section_definition::create_sections): Pass script section type 1978 to Layout::make_output_section_for_script. 1979 (Output_section_definition::output_section_name): Return script 1980 section type to caller. 1981 (Output_section_definition::set_section_address): Do not advance 1982 dot value and load address if section type is NOLOAD. Set address 1983 of NOLOAD sections regardless of section flags. 1984 (Output_section_definition::print): Print section type if it is 1985 not SCRIPT_SECTION_TYPE_NONE. 1986 (Output_section_definition::section_type): New method. 1987 (Output_section_definition::script_section_type_name): Ditto. 1988 (Script_sections::output_section_name): Add new parameter 1989 PSECTION_TYPE for returning script section type. Pass it to 1990 section elements. Handle discard sections. 1991 (Sort_output_sections::operator()): Handle NOLOAD sections. 1992 * script-sections.h (Script_sections::Section_type): New enum type. 1993 (Script_sections::output_section_name): Add a new parameter for 1994 returning script section type. 1995 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT, 1996 INFO and NOLOAD. 1997 * yyscript.y (union): Add new field SECTION_TYPE. 1998 (COPY, DSECT, INFO, NOLOAD): New tokens. 1999 (opt_address_and_section_type): Change type to output_section_header. 2000 (section_type): New non-terminal 2001 (section_header): Handle section type. 2002 (opt_address_and_section_type): Return section type value. 2003 20042010-04-09 H.J. Lu <hongjiu.lu@intel.com> 2005 2006 * testsuite/plugin_common_test_1.c (foo): Add prototype. 2007 * testsuite/plugin_common_test_2.c (foo): Likewise. 2008 20092010-04-08 Doug Kwan <dougkwan@google.com> 2010 2011 * merge.cc (Output_merge_data::set_final_data_size): Handle empty 2012 Output_merge_data. 2013 * output.cc (Output_section::add_merge_input_section): Simplify 2014 code and return status of Output_merge_base::add_input_section. 2015 Update merge section map only if Output_merge_base::add_input_section 2016 returns true. 2017 20182010-04-07 Doug Kwan <dougkwan@google.com> 2019 2020 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn 2021 if section is marked as containing instructions but has no mapping 2022 symbols. 2023 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get 2024 correct section index. 2025 (Arm_relobj::find_linked_text_section): Ditto. 2026 20272010-04-07 Cary Coutant <ccoutant@google.com> 2028 2029 * archive.cc (include_member): Destroy Read_symbols_data object before 2030 releasing file. 2031 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor. 2032 * object.h (Read_symbols_data::Read_symbols_data) New constructor. 2033 (Read_symbols_data::~Read_symbols_data) New destructor. 2034 (Section_relocs::Section_relocs) New constructor. 2035 (Section_relocs::~Section_relocs) New destructor. 2036 (Read_relocs_data::Read_relocs_data) New constructor. 2037 (Read_relocs_data::~Read_relocs_data) New destructor. 2038 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member 2039 pointers to NULL after deleting. 2040 20412010-04-07 Doug Kwan <dougkwan@google.com> 2042 2043 * arm.cc: Replace "endianity" with "endianness" in comments. 2044 (Arm_exidx_cantunwind): Ditto. 2045 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures. 2046 (Arm_relobj::merge_flags_and_attributes): New method. 2047 (Arm_relobj::merge_flags_and_attributes_): New data member. 2048 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting. 2049 (Arm_relobj::scan_sections_for_stubs): Ditto. 2050 (Arm_relobj::do_read_symbols): Check to see if we really want to 2051 merge processor-specific flags and attributes. Exit early if 2052 an object is empty except for section names and the undefined symbol. 2053 (Target_arm::do_finalize_sections): Move check for ELF format to 2054 Arm_relobj::do_read_symbols. Merge processor specific flags and 2055 attributes from a regular object only when we have determined that 2056 it is aapropriate. Do not create an .ARM.attributes section in 2057 output if there is no regular input object. 2058 (Target_arm::merge_processor_specific_flags): Check 2059 --warn-mismatch before printing any error. 2060 (Target_arm::merge_object_attributes): Ditto. 2061 * gold.cc (queue_middle_tasks): Handle the case in which there is 2062 no regular object in input. 2063 * options.cc (General_options::parse_EB): New method. 2064 (General_options::parse_EL): Same. 2065 (General_options::General_options): Initialize endianness_. 2066 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch): 2067 New options. 2068 (General_options::Endianness): New enum. 2069 (General_options::endianness): New method. 2070 (General_options::endianness_): New data member. 2071 * parameters.cc (Parameters::set_options): Check target endianness. 2072 (Parameters::set_target_once): Ditto. 2073 (Parameters::check_target_endianness): New method. 2074 (parameters_force_valid_target): If either -EL or -EB is specified, 2075 use it to define endianness of default target. 2076 * parameters.h (Parameters::check_target_endianness): New method 2077 declaration. 2078 * target.h (class Target): Change "endianity" to "endianness" 2079 in comments. 2080 20812010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 2082 2083 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist. 2084 * configure: Regenerate. 2085 * Makefile.in: Regenerate. 2086 * testsuite/Makefile.in: Regenerate. 2087 20882010-04-06 Cary Coutant <ccoutant@google.com> 2089 2090 gcc PR lto/42757 2091 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for 2092 prevailing definitions of common symbols. 2093 * testsuite/plugin_test_6.sh: New test case. 2094 * testsuite/plugin_common_test_1.c: New test case. 2095 * testsuite/plugin_common_test_2.c: New test case. 2096 * testsuite/Makefile.am (plugin_test_6): New test case. 2097 * testsuite/Makefile.in: Regenerate. 2098 20992010-04-06 Nick Clifton <nickc@redhat.com> 2100 2101 * po/vi.po: New Vietnamese translation. 2102 21032010-03-30 Doug Kwan <dougkwan@google.com> 2104 2105 * arm.cc (Target_arm::using_thumb_only): Handle v6-M 2106 21072010-03-25 Doug Kwan <dougkwan@google.com> 2108 2109 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code 2110 to avoid a conversion warning on a 32-bit host. 2111 21122010-03-24 Ian Lance Taylor <iant@google.com> 2113 2114 * testsuite/script_test_3.t: Add a TLS segment. 2115 * testsuite/Makefile.am (check_PROGRAMS): Add 2116 tls_phdrs_script_test. 2117 (tls_phdrs_script_test_SOURCES): Define. 2118 (tls_phdrs_script_test_DEPENDENCIES): Define. 2119 (tls_phdrs_script_test_LDFLAGS): Define. 2120 (tls_phdrs_script_test_LDADD): Define. 2121 * testsuite/Makefile.in: Rebuild. 2122 21232010-03-23 Cary Coutant <ccoutant@google.com> 2124 2125 * fileread.cc (find_or_make_view): Fix comment. 2126 21272010-03-23 Ian Lance Taylor <iant@google.com> 2128 2129 * script-sections.cc (class Orphan_section_placement): Define 2130 PLACE_TLS and PLACE_TLS_BSS. 2131 (Orphan_section_placement::Orphan_section_placement): Initialize 2132 new places. 2133 (Orphan_section_placement::find_place): Handle SHF_TLS sections. 2134 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test. 2135 (tls_script_test_SOURCES): Define. 2136 (tls_script_test_DEPENDENCIES): Define. 2137 (tls_script_test_LDFLAGS): Define. 2138 (tls_script_test_LDADD): Define. 2139 * testsuite/Makefile.in: Rebuild. 2140 21412010-03-22 Doug Kwan <dougkwan@google.com> 2142 2143 * arm.cc (Arm_relocate_functions::abs8, 2144 Arm_relocate_functions::abs16): Use correct check for overflow 2145 specified in the ARM ELF specs. 2146 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch 2147 target of a BLX instruction specially. 2148 (Reloc_stub::stub_type_for_reloc): Ditto. 2149 (Relocate::relocate): Use symbolic names instead of numeric relocation 2150 codes to report error. 2151 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8 2152 workaround. 2153 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout, 2154 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and 2155 thumb2_blx_out_of_range.stdout 2156 (thumb_bl_out_of_range, thumb_bl_out_of_range.o, 2157 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices. 2158 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o, 2159 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range, 2160 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout, 2161 thumb2_blx_in_range, thumb2_blx_in_range.o, 2162 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range, 2163 thumb2_blx_out_of_range.o): New rules. 2164 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range, 2165 thumb2_blx_in_range and thumb2_blx_out_of_range. 2166 * testsuite/Makefile.in: Regenerate. 2167 * arm_branch_in_range.sh: Add tests for THUMB BLX. 2168 * testsuite/thumb_blx_in_range.s: New file. 2169 * testsuite/thumb_blx_out_of_range.s: New file. 2170 21712010-03-22 Rafael Espindola <espindola@google.com> 2172 2173 * archive.cc (Should_include): Move to archive.h. 2174 (should_include_member): Make it a member of Archive. 2175 (Lib_group): New. 2176 (Add_lib_group_symbols): New. 2177 * archive.h: Include options.h. 2178 (Archive_member): Moved from Archive. 2179 (Should_include): Moved from archive.cc. 2180 (Lib_group): New. 2181 (Add_lib_group_symbols): New. 2182 * dynobj.cc (do_should_include_member): New. 2183 * dynobj.h (do_should_include_member): New. 2184 * gold.cc (queue_initial_tasks): Update call to queue. 2185 * main.cc (main): Print lib group stats. 2186 * object.cc (do_should_include_member): New. 2187 * object.h: Include archive.h. 2188 (Object::should_include_member): New. 2189 (Object::do_should_include_member): New. 2190 (Sized_relobj::do_should_include_member): New. 2191 * options.cc (General_options::parse_start_lib): New. 2192 (General_options::parse_end_lib): New. 2193 (Input_arguments::add_file): Handle lib groups. 2194 (Input_arguments::start_group): Check we are not in a lib. 2195 (Input_arguments::start_lib): New. 2196 (Input_arguments::end_lib): New. 2197 * options.h (General_options): Add start_lib and end_lib. 2198 (Input_argument::lib_): New. 2199 (Input_argument::lib): New. 2200 (Input_argument::is_lib): New. 2201 (Input_file_lib): New. 2202 (Input_arguments::in_lib_): New. 2203 (Input_arguments::in_lib): New. 2204 (Input_arguments::start_lib): New. 2205 (Input_arguments::end_lib_): New. 2206 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols 2207 in unused members as preempted. 2208 (Sized_pluginobj::do_should_include_member): New. 2209 * plugin.h (Sized_pluginobj::do_should_include_member): New. 2210 * readsyms.cc (Read_symbols::locks): If we are just reading a member, 2211 return the blocker. 2212 (Read_symbols::do_whole_lib_group): New. 2213 (Read_symbols::do_lib_group): New. 2214 (Read_symbols::do_read_symbols): Handle lib groups. 2215 (Read_symbols::get_name): Handle lib groups. 2216 * readsyms.h (Read_symbols): Add an archive member pointer. 2217 (Read_symbols::do_whole_lib_group): New. 2218 (Read_symbols::do_lib_group): New. 2219 (Read_symbols::member_): New. 2220 * script.cc (read_input_script): Update call to queue_soon. 2221 22222010-03-19 Doug Kwan <dougkwan@google.com> 2223 2224 * arm.cc (Stub_table::Stub_table): Initialize new data members 2225 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_. 2226 (Stub_table::add_reloc_stub): Assign stub offset and update 2227 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_. 2228 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_): 2229 New data members. 2230 (Stub_table::update_data_size_and_addralign): Use 2231 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_ 2232 instead of going over all reloc stubs. 2233 (Stub_table::finalize_stubs): Do not assign reloc stub offsets. 2234 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize 2235 Stringpool_template::offset_ to size of Stringpool_char. 2236 (Stringpool_template::new_key_offset): Remove code to initialize 2237 Stringpool_template::offset_. 2238 * stringpool.h (Stringpool_template::set_no_zero_null): Set 2239 Stringpool_template::offset_ to zero. 2240 22412010-03-15 Doug Kwan <dougkwan@google.com> 2242 2243 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize 2244 offset_. 2245 (Stringpool_template::new_key_offset): New method. 2246 (Stringpool_template::add_string): Assign offsets when adding new 2247 strings. 2248 (Stringpool_template::set_string_offsets): Do not set string offsets 2249 when not optimizing. 2250 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data 2251 member size_. 2252 (Chunked_vector::clear): Clear size_. 2253 (Chunked_vector::reserve): Call reserve method of all Element_vectors. 2254 (Chunked_vector::size): Return size_. 2255 (Chunked_vector::push_back): Use size_ to find insert position. 2256 (Chunked_vector::size_): New data member. 2257 (Stringpool_template::set_no_zero_null): Assert string set is empty. 2258 (Stringpool_template::new_key_offset): New method declaration. 2259 (Stringpool_template::offset_): New data member. 2260 22612010-03-15 Rafael Espindola <espindola@google.com> 2262 2263 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to 2264 Add_symbols' constructor. 2265 * readsyms.h (Add_symbols): Remove the input_group member. 2266 22672010-03-10 Ian Lance Taylor <iant@google.com> 2268 2269 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the 2270 target to ask whether a reference to a symbol requires a stack 2271 split. 2272 * target.h (Target::is_call_to_non_split): New function. 2273 (Target::do_is_call_to_non_split): Declare virtual function. 2274 * target.cc: Include "symtab.h". 2275 (Target::do_is_call_to_non_split): New function. 2276 * i386.cc (Target_i386::do_is_call_to_non_split): New function. 2277 22782010-03-10 Cary Coutant <ccoutant@google.com> 2279 2280 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_. 2281 (File_read::open[1]): Remove initial mapping of whole_file_view_. 2282 (File_read::open[2]): Add whole_file_view_ to list of views. 2283 (File_read::make_view): Remove test of whole_file_view_. 2284 (File_read::find_or_make_view): Create whole_file_view_ if 2285 necessary. 2286 (File_read::clear_views): Replace bool parameter with enum; 2287 adjust all callers. Don't delete views with permanent data; 2288 do delete cached views and views from archives if 2289 --no-keep-files-mapped is set. Set whole_file_view_ to NULL 2290 if clearing the corresponding view. 2291 * fileread.h (File_read::Clear_views_mode): New enum. 2292 (File_read::View::is_permanent_view): New method. 2293 (File_read::clear_views): Replace bool parameter 2294 with enum; adjust all callers. 2295 * options.h (General_options): Change keep_files_mapped option; 2296 add map_whole_files. 2297 * readsyms.cc (Add_symbols::run): Delete sd_ object before 2298 releasing the file. 2299 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing 2300 the file. 2301 23022010-03-10 David S. Miller <davem@davemloft.net> 2303 2304 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30. 2305 23062010-03-09 Sriraman Tallam <tmsriram@google.com> 2307 2308 * icf.cc (get_section_contents): Add '@' marker after processing the 2309 merge reloc. 2310 23112010-03-08 Doug Kwan <dougkwan@google.com> 2312 2313 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage 2314 due to a conversion warning. 2315 (Arm_relobj::update_output_local_symbol_count): Check for local 2316 symbol with unset output index. 2317 23182010-03-05 Ian Lance Taylor <iant@google.com> 2319 2320 * options.h (class General_options): Add --spare-dynamic-tags. 2321 * output.cc (Output_data_dynamic::set_final_data_size): Implement 2322 --spare-dynamic-tags. 2323 23242010-03-05 Ian Lance Taylor <iant@google.com> 2325 2326 * incremental.cc: Include "libiberty.h". 2327 23282010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2329 2330 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member 2331 function, is_info_ member. 2332 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_. 2333 (Versions::Versions): Update caller. 2334 (Versions::define_base_version): Likewise. 2335 (Versions::add_def): Likewise. 2336 23372010-03-03 Sriraman Tallam <tmsriram@google.com> 2338 2339 * i386.cc (Target_i386::can_check_for_function_pointers): New function. 2340 (Scan::possible_function_pointer_reloc): New function. 2341 (Scan::local_reloc_may_be_function_pointer): Change to call 2342 possible_function_pointer_reloc. 2343 (Scan::global_reloc_may_be_function_pointer): Ditto. 2344 * icf.h (Icf::check_section_for_function_pointers): Change to reject 2345 relocations in ".data.rel.ro._ZTV" section. 2346 * testsuite/icf_safe_so_test.sh: Change to pass i386. 2347 * testsuite/icf_safe_so_test.cc: Ditto. 2348 * testsuite/icf_safe_test.cc: Ditto. 2349 * testsuite/icf_safe_test.sh: Ditto. 2350 23512010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com> 2352 Ian Lance Taylor <iant@google.com> 2353 2354 * target-reloc.h (relocate_section): Check the symbol table index 2355 for -1U before setting the local symbol index. 2356 (scan_relocatable_relocs): If copying the relocation, record that 2357 the local symbol is required. 2358 * object.h (Symbol_value::is_output_symtab_index_set): New 2359 function. 2360 (Symbol_value::may_be_discarded_from_output_symtab): New 2361 function. 2362 (Symbol_value::has_output_symtab_entry): New function. 2363 (Symbol_value::needs_output_symtab_entry): Remove. 2364 (Symbol_value::output_symtab_index): Make sure the symbol index is 2365 set. 2366 (Symbol_value::set_output_symtab_index): Make sure the symbol 2367 index is not set. Make sure the new index is valid. 2368 (Symbol_value::set_must_have_output_symtab_entry): New function. 2369 (Symbol_value::has_output_dynsym_entry): New function. 2370 (Symbol_value::set_output_dynsym_index): Make sure the new index 2371 is valid. 2372 (Sized_relobj::set_must_have_output_symtab_entry): New function. 2373 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a 2374 local symbol if permitted. 2375 (Sized_relobj::do_finalize_local_symbols): Call 2376 is_output_symtab_index_set rather than needs_output_symtab_entry. 2377 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry 2378 rather than needs_output_symtab_entry. Call 2379 has_output_dynsym_entry rather than needs_output_dynsym_entry. 2380 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call 2381 is_output_symtab_index_set rather than needs_output_symtab_entry. 2382 * testsuite/discard_locals_relocatable_test.c: New file. 2383 * testsuite/discard_locals_test.sh: Test -r. 2384 * testsuite/Makefile.am (check_DATA): Add 2385 discard_locals_relocatable_test1.syms, 2386 discard_local_relocatable_test2.syms. 2387 (MOSTLYCLEANFILES): Likewise. Also add 2388 discard_locals_relocatable_test1.lout and 2389 discard_locals_relocatable_test2.out. 2390 (discard_locals_relocatable_test1.syms): New target. 2391 (discard_locals_relocatable_test.o): New target. 2392 (discard_locals_relocatable_test1.out): New target. 2393 (discard_locals_relocatable_test2.syms): New target. 2394 (discard_locals_relocatable_test2.out): New target. 2395 (various): Add missing ../ld-new dependencies. 2396 * testsuite/Makefile.in: Rebuild. 2397 23982010-03-03 Nick Clifton <nickc@redhat.com> 2399 2400 * po/fi.po: New Finnish translation. 2401 24022010-03-01 Doug Kwan <dougkwan@google.com> 2403 2404 * layout.cc (Layout::Layout): Force section types of .init_array*, 2405 .preinit_array* and .fini_array* sections. 2406 * output.cc (Output_section::Input_section_sort_entry::has_priority): 2407 Fix check of return value of std::string::find.(). 2408 (Output_section::Input_section_sort_compare::operator()): Remove 2409 comment about .init_array. 2410 (Output_section::Input_section_sort_init_fini_compare::operator()): 2411 New method. 2412 (Output_section::sort_attached_input_sections): Handle .init_array 2413 and .fini_array specially. 2414 * output.h (Output_section::Inut_section_sort_compare): Update 2415 comment. 2416 (Output_section::Input_section_sort_init_fini_compare): New struct. 2417 24182010-02-26 Doug Kwan <dougkwan@google.com> 2419 2420 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat 2421 R_ARM_PREL31 and R_ARM_SBREL31 as position independent. 2422 * testsuite/debug_msg.sh: Avoid matching source line number for 2423 use of global variable undef_int. 2424 24252010-02-26 Doug Kwan <dougkwan@google.com> 2426 2427 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling 2428 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs. 2429 (Target_arm::scan_reloc_section_for_stubs): Instead of calling 2430 scan_reloc_for_stub, do all processing of R_ARM_V4BX here. 2431 * options.cc (General_options::General_options): Initialize member 2432 fix_v4bx_. 2433 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh 2434 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout 2435 and rm_no_fix_v4bx.stdout 2436 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o, 2437 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking, 2438 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules. 2439 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking 2440 and arm_no_fix_v4bx. 2441 * Makefile.in: Regenerate. 2442 * testsuite/arm_fix_v4bx.s: New file. 2443 * testsuite/arm_fix_v4bx.sh: Ditto. 2444 24452010-02-24 Doug Kwan <dougkwan@google.com> 2446 2447 * arm.cc (Target_arm::got_section): Make the .got section the first 2448 non RELRO section in the data segment. 2449 * testsuite/script_test_5.sh: Fix match patterns to avoid matching 2450 suffixes of section names. 2451 24522010-02-24 Doug Kwan <dougkwan@google.com> 2453 2454 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific 2455 flags and attributes merging if an input file is a binary file. 2456 * fileread.cc (Input_file::open): Record format of original file. 2457 * fileread.h (Input_file::Format): New enum type. 2458 (Input_file::Input_file): Initialize data member format_. 2459 (Input_file::format): New method definition. 2460 (Input_file::format_):: New data member. 2461 24622010-02-24 Doug Kwan <dougkwan@google.com> 2463 2464 * arm.cc (Arm_output_data_got): New class. 2465 (ARM_TCB_SIZE): New constant 2466 (Target_arm): Use Arm_output_data_got instead of Output_data_got. 2467 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout. 2468 If user uses a script with a SECTIONS clause, issue only a warning 2469 for a misplaced EXIDX input section. Otherwise, issue an error. 2470 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing 2471 garbage collection. 2472 (Target_arm::got_mode_index_entry): Handle static linking. 2473 (Target_arm::Scan::local): Ditto. 2474 (Target_arm::Scan::global): Ditto. 2475 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix 2476 all incorrectly implemented relocations. 2477 (Target_arm::fix_exidx_coverage): Pass layout to 2478 Arm_output_section::fix_exidx_coverage. 2479 * layout.cc (Layout::section_name_mapping): Remove trailing dots 2480 from ".ARM.exidx." and ".ARM.extab.". 2481 24822010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com> 2483 2484 * arm.cc (Target_arm::do_finalize_sections): Create attribute 2485 section if it does not already exist. 2486 * attributes.cc (Attributes_section_data::Attributes_section_data): 2487 Don't crash if size is zero. 2488 24892010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com> 2490 Ian Lance Taylor <iant@google.com> 2491 2492 * gold.cc (queue_middle_tasks): If no input files were opened, 2493 exit. 2494 * workqueue.h (Task_function::Task_function): Assert that there is 2495 a blocker. 2496 24972010-02-22 Doug Kwan <dougkwan@google.com> 2498 2499 * gold-threads.h (Once::~Once): Explicitly define virtual destructor. 2500 * icf.cc (get_section_contents): Cast snprintf arguments to long long 2501 types to avoid warnings due to different uint64_t implementations 2502 on different hosts. 2503 25042010-02-21 Doug Kwan <dougkwan@google.com> 2505 2506 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in 2507 handling of the maximum backward branch offset. 2508 (Arm_relocate_functions::thumb_branch_common): Ditto. 2509 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh. 2510 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout 2511 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout, 2512 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout. 2513 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o, 2514 arm_bl_out_of_range.stdout, arm_bl_out_of_range, 2515 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range, 2516 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout, 2517 thumb_bl_out_of_range thumb_bl_out_of_range.o, 2518 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o 2519 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range, 2520 thumb2_bl_out_of_range.o): New rules. 2521 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range, 2522 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and 2523 thumb2_bl_out_of_range 2524 * testsuite/Makefile.in: Regenerate. 2525 * testsuite/arm_bl_in_range.s: New file. 2526 * testsuite/arm_bl_out_of_range.s: Ditto. 2527 * testsuite/arm_branch_in_range.sh: Ditto. 2528 * testsuite/arm_branch_range.t: Ditto. 2529 * testsuite/thumb2_branch_range.t: Ditto. 2530 * testsuite/thumb_bl_in_range.s: Ditto. 2531 * testsuite/thumb_bl_out_of_range.s: Ditto. 2532 * testsuite/thumb_branch_range.t: Ditto. 2533 25342010-02-20 Sriraman Tallam <tmsriram@google.com> 2535 2536 * gc.h (gc_process_relocs): Change vectors to point to the new list. 2537 Add reloc offset information. 2538 * icf.cc (get_section_contents): Change iterators to point to the new 2539 vectors. Add reloc offset information to the contents. 2540 * icf.h (Icf::Sections_reachable_info): New typedef. 2541 (Icf::Sections_reachable_list): New typedef. 2542 (Icf::Offset_info): New typedef. 2543 (Icf::Reloc_info): New struct typedef. 2544 (Icf::Reloc_info_list): New typedef. 2545 (Icf::symbol_reloc_list): Delete method. 2546 (Icf::addend_reloc_list): Delete method. 2547 (Icf::section_reloc_list): Delete method. 2548 (Icf::reloc_info_list): New method. 2549 (Icf::reloc_info_list_): New member. 2550 25512010-02-19 Doug Kwan <dougkwan@google.com> 2552 2553 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32, 2554 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented. 2555 * arm.cc (Arm_relocation_functions): New forward declaration. 2556 (Target_arm::Target_arm): Initialize new data members 2557 got_mod_index_offset_ and tls_base_symbol_defined_. 2558 (Target_arm::Relocate::relocate_tls): New method. 2559 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol, 2560 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section): 2561 New methods. 2562 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET, 2563 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC. 2564 (Target_arm::got_mod_index_offset_, 2565 Target_arm::tls_base_symbol_defined_): New data members. 2566 (Target_arm::Scan::local, Target::Scan::global, 2567 Target_arm::Relocate::relocate): Handle 32-bit initial TLS 2568 relocations. 2569 25702010-02-18 Doug Kwan <dougkwan@google.com> 2571 2572 * arm.cc (Arm_relobj::find_linked_text_section): New method. 2573 (Arm_relobj::make_exidx_input_section): Pass section index of linked 2574 text section as a parameter becuase some broken tools may not set 2575 the link in section header. 2576 (Target_arm::has_got_section): New method. 2577 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section 2578 without any mapping symbol as data only. Remove warning. 2579 (Arm_relobj::do_read_synbols): If an EXIDX input section has no 2580 link in its section header, try to discover the link by inspecting the 2581 REL31 relocation at the beginning of the section. 2582 (Target_arm::Scan::check_non_pic): Report name of offending relocation 2583 in error message. 2584 (Target_arm::Scan::global): Treat any reference to the symbol 2585 _GLOBAL_OFFSET_TABLE_ as a GOT access. 2586 25872010-02-12 Sriraman Tallam <tmsriram@google.com> 2588 2589 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function. 2590 (Scan::global_reloc_may_be_function_pointer): New function. 2591 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function. 2592 (Scan::global_reloc_may_be_function_pointer): New function. 2593 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function. 2594 (Scan::global_reloc_may_be_function_pointer): New function. 2595 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function. 2596 (Scan::global_reloc_may_be_function_pointer): New function. 2597 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function. 2598 (Scan::global_reloc_may_be_function_pointer): New function. 2599 (Scan::possible_function_pointer_reloc): New function. 2600 (Target_x86_64::can_check_for_function_pointers): New function. 2601 * gc.h (gc_process_relocs): Scan relocation types to determine if 2602 function pointers were taken for targets that support it. 2603 * icf.cc (Icf::find_identical_sections): Include functions for 2604 folding in safe ICF whose pointer is not taken. 2605 * icf.h (Secn_fptr_taken_set): New typedef. 2606 (fptr_section_id_): New member. 2607 (section_has_function_pointers): New function. 2608 (set_section_has_function_pointers): New function. 2609 (check_section_for_function_pointers): New function. 2610 * options.h: Fix comment for safe ICF option. 2611 * target.h (can_check_for_function_pointers): New function. 2612 * testsuite/Makefile.am: Add icf_safe_so_test test case. 2613 Modify icf_safe_test for X86-64. 2614 * testsuite/Makefile.in: Regenerate. 2615 * testsuite/icf_safe_so_test.cc: New file. 2616 * testsuite/icf_safe_so_test.sh: New file. 2617 * testsuite/icf_safe_test.cc (kept_func_3): New function. 2618 (main): Change to take pointer to function kept_func_3. 2619 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe 2620 folding is done correctly for X86-64. 2621 26222010-02-12 David S. Miller <davem@davemloft.net> 2623 2624 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add 2625 is_symbolless parameter. 2626 (Output_reloc<SHT_REL>::is_symbolless): New. 2627 (Output_reloc<SHT_REL>::is_symbolless_): New. 2628 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits. 2629 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter. 2630 (Output_reloc<SHT_RELA>::is_symbolless): New. 2631 (Output_data_reloc::add_global): Handle is_symbolless. 2632 (Output_data_reloc::add_global_relative): Likewise. 2633 (Output_data_reloc::add_local): Likewise. 2634 (Output_data_reloc::add_local_relative): Likewise. 2635 (Output_data_reloc::add_symbolless_global_addend): New. 2636 (Output_data_reloc::add_symbolless_local_addend): New. 2637 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle 2638 is_symbolless. 2639 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_ 2640 instead of ->is_relative_ 2641 (Output_reloc::write): Likewise. 2642 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_ 2643 (Output_reloc::write_rel): Simplify. 2644 2645 * sparc.cc (Target_sparc::Scan::local): Use 2646 ->add_symbolless_local_addend as needed. 2647 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as 2648 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc 2649 based upon relocation offset. 2650 26512010-02-11 Doug Kwan <dougkwan@google.com> 2652 2653 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling. 2654 (Target_arm::Scan::global): Ditto. Also remove a comment before the 2655 beginning of function. 2656 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS 2657 and MOVT_ABS relocations. Those are non issued in scanning. Fix 2658 parameter is_32bit in calls to should_apply_static_reloc. 2659 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh. 2660 (check_DATA): Add arm_abs_global.stdout. 2661 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global, 2662 arm_abs_global.stdout): New rules. 2663 (MOSTLLYCLEANFILES): Add arm_abs_global 2664 * Makefile.in: Regenerate. 2665 * testsuite/arm_abs_global.s: New file. 2666 * testsuite/arm_abs_global.sh: Ditto. 2667 * testsuite/arm_abs_lib.s: Ditto. 2668 26692010-02-11 Ian Lance Taylor <iant@google.com> 2670 2671 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each 2672 Read_relocs task. 2673 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run 2674 Allocate_commons_task first. 2675 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next 2676 task, rather than symtab_lock_. 2677 (Gc_process_relocs::~Gc_process_relocs): New function. 2678 (Gc_process_relocs::is_runnable): Check this_blocker_. 2679 (Gc_process_relocs::locks): Use next_blocker_ rather than 2680 blocker_. 2681 (Scan_relocs::~Scan_relocs): New function. 2682 (Scan_relocs::is_runnable): Check this_blocker_ rather than 2683 symtab_lock_. 2684 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add 2685 next_blocker_. 2686 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_ 2687 fields. Add this_blocker_ and next_blocker_ fields. Adjust 2688 constructor accordingly. 2689 (class Gc_process_relocs): Likewise. 2690 (class Scan_relocs): Likewise. 2691 * common.h (class Allocate_commons_task): Remove symtab_lock_ 2692 field, and corresponding constructor parameter. 2693 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of 2694 symtab_lock_. 2695 (Allocate_commons_task::locks): Likewise. 2696 26972010-02-11 Ian Lance Taylor <iant@google.com> 2698 2699 * gold-threads.h (class Once): Define. 2700 (class Initialize_lock): Rewrite as child of Once. 2701 * gold-threads.cc (class Once_initialize): Define. 2702 (once_pointer_control): New static variable. 2703 (once_pointer, once_arg): New static variables. 2704 (c_run_once): New static function. 2705 (Once::Once, Once::run_once, Once::internal_run): New functions. 2706 (class Initialize_lock_once): Remove. 2707 (initialize_lock_control): Remove. 2708 (initialize_lock_pointer): Remove. 2709 (initialize_lock_once): Remove. 2710 (Initialize_lock::Initialize_lock): Move to gold-threads.h. 2711 (Initialize_lock::initialize): Rewrite. 2712 (Initialize_lock::do_run_once): New function. 2713 * archive.cc (Archive::interpret_header): Only clear name if it is 2714 not already empty. 2715 * fileread.cc: Include "gold-threads.h" 2716 (file_counts_lock): New static variable. 2717 (file_counts_initialize_lock): Likewise. 2718 (File_read::release): Only increment counts when using --stats. 2719 Use a lock around the increment. 2720 * parameters.cc (class Set_parameters_target_once): Define. 2721 (set_parameters_target_once): New static variable. 2722 (Parameters::Parameters): Move here from parameters.h. 2723 (Parameters::set_target): Rewrite. 2724 (Parameters::set_target_once): New function. 2725 (Parameters::clear_target): Move here and rewrite. 2726 * parameters.h (class Parameters): Update declarations. Add 2727 set_parameters_target_once_ field. 2728 (Parameters::Parameters): Move to parameters.cc. 2729 (Parameters::clear_target): Likewise. 2730 * readsyms.cc (Read_symbols::do_group): Create a Start_group 2731 task. 2732 (Start_group::~Start_group): New function. 2733 (Start_group::is_runnable): New function. 2734 (Start_group::locks, Start_group::run): New functions. 2735 (Finish_group::run): Change saw_undefined to size_t. 2736 * readsyms.h (class Start_group): Define. 2737 (class Finish_group): Change saw_undefined_ field to size_t. 2738 (Finish_group::Finish_group): Remove saw_undefined and 2739 this_blocker parameters. Change all callers. 2740 (Finish_group::set_saw_undefined): New function. 2741 (Finish_group::set_blocker): New function. 2742 * symtab.h (class Symbol_table): Change saw_undefined to return 2743 size_t. Change saw_undefined_ field to size_t. 2744 * target-select.cc (Set_target_once::do_run_once): New function. 2745 (Target_selector::Target_selector): Initialize set_target_once_ 2746 field. Don't initialize lock_ and initialize_lock_ fields. 2747 (Target_selector::instantiate_target): Rewrite. 2748 (Target_selector::set_target): New function. 2749 * target-select.h (class Set_target_once): Define. 2750 (class Target_selector): Update declarations. Make 2751 Set_target_once a friend. Remove lock_ and initialize_lock_ 2752 fields. Add set_target_once_ field. 2753 27542010-02-10 Ian Lance Taylor <iant@google.com> 2755 2756 * dirsearch.cc (Dirsearch::initialize): Add all blockers before 2757 queueing any tasks. 2758 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker. 2759 (queue_middle_tasks): Add all blockers before queueing any tasks. 2760 (queue_final_tasks): Likewise. 2761 * token.h (Task_token::add_blockers): New function. 2762 * object.h (Input_objects::number_of_relobjs): New function. 2763 27642010-02-10 Ian Lance Taylor <iant@google.com> 2765 2766 * i386.cc (Relocate::relocate_tls): A local symbol is final if not 2767 shared, not if not position independent. 2768 * x86_64.cc (Relocate::relocate_tls): Likewise. 2769 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test. 2770 (tls_pie_pic_test): New target. 2771 * testsuite/Makefile.in: Rebuild. 2772 2773 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test. 2774 (tls_test_main_pie.o, tls_test_pie.o): New targets. 2775 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise. 2776 * testsuite/Makefile.in: Rebuild. 2777 27782010-02-09 David S. Miller <davem@davemloft.net> 2779 2780 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than 2781 R_SPARC_RELATIVE using ->add_local_relative(). 2782 (Target_sparc::Scan::global): Likewise for ->add_global_relative(). 2783 2784 * output.h (Output_data_dynamic::add_section_size): New method 2785 that takes two Output_data objects. 2786 (Output_data_dynamic::Dynamic_entry): Create storage for secondary 2787 entry param. Handle it in initializers. 2788 * output.cc (Output_data_dynamic::Dynamic_entry::write): For 2789 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL. 2790 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt 2791 arg. 2792 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt, 2793 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt 2794 * arm.cc (Target_arm::do_finalize_sections): Update to pass false 2795 for dynrel_includes_plt. 2796 * i386.cc (Target_i386::do_finalize_sections): Likewise. 2797 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise. 2798 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output 2799 before .rela.plt 2800 (Target_sparc::do_finalize_sections): Update to pass true for 2801 dynrel_includes_plt. 2802 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be 2803 output before .rela.plt 2804 (Target_powerpc::do_finalize_sections): Update to pass true for 2805 dynrel_includes_plt when 32-bit. 2806 28072010-02-08 Doug Kwan <dougkwan@google.com> 2808 2809 * arm.cc (Arm_relobj::simple_input_section_output_address): New 2810 method. 2811 (Arm_relobj::section_needs_cortex_a8_stub_scanning, 2812 Arm_relobj::scan_section_for_cortex_a8_stubs, 2813 Arm_relobj::do_relocation_section): Instead of calling 2814 Output_section::output_address, use faster 2815 Arm_relobj::simple_input_section_output_address. 2816 28172010-02-08 David S. Miller <davem@davemloft.net> 2818 2819 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is 2820 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned 2821 relocation helper function. 2822 2823 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP* 2824 just like R_SPARC_GOT{10,13,22}. 2825 (Target_sparc::Scan::local): Likewise. 2826 (Target_sparc::Relocate:relocate): Likewise. 2827 28282010-02-06 Ian Lance Taylor <iant@google.com> 2829 2830 * configure.ac: Rewrite targetobjs duplicate removal code to use 2831 only shell constructs. 2832 * configure: Rebuild. 2833 28342010-02-05 Doug Kwan <dougkwan@google.com> 2835 2836 PR 11247 2837 * arm.cc (Arm_relobj::section_is_scannable): New method. 2838 (Arm_relobj::section_needs_reloc_stub_scanning): Use it. 2839 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same. 2840 28412010-02-04 Doug Kwan <dougkwan@google.com> 2842 2843 PR 11247 2844 * arm-reloc-property.cc (cstdio): Include. 2845 * configure.ac (targetobjs): Remove duplicates. 2846 * configure: Regenerate. 2847 * resolve.cc (Symbol_table::resolve): Explicit instantiate both 2848 big and little endian version for a given address size. 2849 28502010-02-03 Doug Kwan <dougkwan@google.com> 2851 2852 * arm-reloc-property.cc 2853 (Arm_reloc_property_table::reloc_name_in_error_message): New method 2854 definition. 2855 * arm-reloc-property.h 2856 (Arm_reloc_property_table::get_implemented_static_reloc_property): 2857 New method definition. 2858 (Arm_reloc_property_table::reloc_name_in_error_message): New method 2859 declaration. 2860 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change 2861 overflow to N. 2862 (GOT_PREL): Change implemented to Y. 2863 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method. 2864 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method. 2865 (Arm_relocate_functions::movw_abs_nc): Remove method. 2866 (Arm_relocate_functions::movt_abs): Ditto. 2867 (Arm_relocate_functions::thm_movw_abs_nc): Ditto. 2868 (Arm_relocate_functions::thm_movt_abs): Ditto. 2869 (Arm_relocate_functions::movw_rel_nc): Ditto. 2870 (Arm_relocate_functions::movw_rel): Ditto. 2871 (Arm_relocate_functions::movt_rel): Ditto. 2872 (Arm_relocate_functions:thm_movw_rel_nc): Ditto. 2873 (Arm_relocate_functions:thm_movw_rel): Ditto. 2874 (Arm_relocate_functions:thm_movt_rel): Ditto. 2875 (Arm_relocate_functions::movw, Arm_relocate_functions::movt, 2876 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt): 2877 New method definitions. 2878 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index. 2879 (Arm_relocation_functions::arm_grp_ldr): Ditto. 2880 (Arm_relocation_functions::arm_grp_ldrs): Ditto. 2881 (Arm_relocation_functions::arm_grp_ldc): Ditto. 2882 (Target_arm::Relocate::relocate): Check for non-static or 2883 unimplemented relocation code and exit early. Change calls to 2884 Target_arm::reloc_uses_thumb_bit and 2885 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property 2886 instead. Refactor code to handle similar relocations to increase 2887 code sharing. Remove check for unsupported relocation code in switch 2888 statement. 2889 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use 2890 relocation property table to find out size. Change error message to 2891 print out the name of a relocation code instead of the numeric value. 2892 (Target_arm::scan_reloc_for_stub): Use relocation property table 2893 instead of calling Target_arm::reloc_uses_thumb_bit(). 2894 28952010-02-02 Doug Kwan <dougkwan@google.com> 2896 2897 * arm.cc (Target_arm::relocate_section): Do view adjustment for all 2898 types of relaxed input section. 2899 29002010-02-02 Doug Kwan <dougkwan@google.com> 2901 2902 * Makefile.am (HFILES): Add arm-reloc-property.h. 2903 (DEFFILES): New. 2904 (TARGETSOURCES): Add arm-reloc-property.cc 2905 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT) 2906 (libgold_a_SOURCES): $(DEFFILES) 2907 * Makefile.in: Regenerate. 2908 * arm-reloc-property.cc: New file. 2909 * arm-reloc-property.h: New file. 2910 * arm-reloc.def: New file. 2911 * arm.cc: Update comments. 2912 (arm-reloc-property.h): New included header. 2913 (arm_reloc_property_table): New global variable. 2914 (Target_arm::do_select_as_default_target): New method definition. 2915 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add 2916 arm-reloc-property to targ_extra_obj. 2917 * parameters.cc (set_parameters_target): Call 2918 Target::select_as_default_target(). 2919 * target.h (Target::select_as_default_target): New method definition. 2920 (Target::do_select_as_default_target): Same. 2921 29222010-02-01 Doug Kwan <dougkwan@google.com> 2923 2924 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize 2925 first_output_text_section_. 2926 (Arm_exidx_fixup::first_output_text_section): New method definition. 2927 (Arm_exidx_fixup::first_output_text_section_): New data member. 2928 (Arm_exidx_fixup::process_exidx_section): Record the first text 2929 output section seen. 2930 (Arm_output_section::fix_exidx_coverage): Set correct linked section 2931 and entsize in output section header. 2932 29332010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com> 2934 2935 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8, 2936 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0. 2937 (Arm_relocate_functions::thm_alu11): New Method. 2938 (Arm_relocate_functions::thm_pc8): New Method. 2939 (Arm_relocate_functions::thm_pc12): New Method. 2940 (Target_arm::Scan::local): Handle the relocations. 2941 (Target_arm::Scan::global): Likewise. 2942 (Target_arm::Relocate::relocate): Likewise. 2943 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise. 2944 29452010-01-29 Doug Kwan <dougkwan@google.com> 2946 2947 * arm.cc (Target_arm::Scan::global): General PLTs for the same set 2948 of relocation types as ld. 2949 29502010-01-29 Doug Kwan <dougkwan@google.com> 2951 2952 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility 2953 to public. 2954 (Arm_relocate_functions::thumb_branch_common): Ditto. 2955 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24, 2956 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32, 2957 Arm_relocate_functions::xpc25, Arm_relocate_functions::call, 2958 Arm_relocate_functions::jump24): Remove. 2959 (Target_arm::Relocate::relocate): Adjust code to call 2960 Arm_relocation_functions::arm_branch_common and 2961 Arm_relocation_functions::thumb_branch_common instead of their removed 2962 wrappers. Merge switch-cases together to reduce source code size. 2963 29642010-01-29 Doug Kwan <dougkwan@google.com> 2965 2966 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member 2967 output_local_symbol_count_needs_update_. 2968 (Arm_relobj::output_local_symbol_count_needs_update, 2969 Arm_relobj::set_output_local_symbol_count_needs_update, 2970 Arm_relobj::update_output_local_symbol_count): New methods. 2971 (Arm_relobj::output_local_symbol_count_needs_update_): New data 2972 member. 2973 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address 2974 of pointed function as in a R_ARM_PREL31 relocation. 2975 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects 2976 for output local symbol count updating. 2977 (Target_arm::do_relax): Update output local symbol counts in objects 2978 if necessary. 2979 * object.h (Sized_relobj::set_output_local_symbol_count): New method. 2980 29812010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com> 2982 2983 * arm.cc: Added support for the ARM relocations: 2984 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL, 2985 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL. 2986 (Arm_relocate_functions::movw_rel_nc): Renamed (was 2987 movw_prel_nc). 2988 (Arm_relocate_functions::movw_rel): New method. 2989 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel). 2990 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was 2991 thm_movw_prel_nc). 2992 (Arm_relocate_functions::thm_movw_rel): New method. 2993 (Arm_relocate_functions::thm_movt_rel): Renamed (was 2994 thm_movt_prel). 2995 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL 2996 relocations. 2997 (Target_arm::Scan::global): Likewise. 2998 (Target_arm::Relocate::relocate): Likewise. 2999 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): 3000 Likewise. 3001 30022010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com> 3003 3004 * arm.cc: Added support for ARM group relocations. 3005 (Target_arm::reloc_needs_sym_origin): New method. 3006 (Arm_relocate_functions::calc_grp_kn): New method. 3007 (Arm_relocate_functions::calc_grp_residual): New method. 3008 (Arm_relocate_functions::calc_grp_gn): New method. 3009 (Arm_relocate_functions::arm_grp_alu): New Method. 3010 (Arm_relocate_functions::arm_grp_ldr): New Method. 3011 (Arm_relocate_functions::arm_grp_ldrs): New Method. 3012 (Arm_relocate_functions::arm_grp_ldc): New Method. 3013 (Target_arm::Scan::local): Handle the ARM group relocations. 3014 (Target_arm::Scan::global): Likewise. 3015 (Target_arm::Relocate::relocate): Likewise. 3016 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): 3017 Likewise. 3018 30192010-01-26 Doug Kwan <dougkwan@google.com> 3020 3021 * arm.cc (set): Include. 3022 (class Arm_exidx_fixup): Change type of last_input_section_ to const 3023 pointer type. 3024 (Arm_output_section::Text_section_list): New type. 3025 (Arm_output_section::append_text_sections_to_list): New method. 3026 (Arm_output_section::fix_exidx_coverage): Ditto. 3027 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_. 3028 (Arm_relobj::convert_input_section_to_relaxed_section): Use 3029 Relobj::set_section_offset() instead of 3030 Sized_relobj::invalidate_section_offset(). 3031 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra 3032 parameter for section headers. Ignore relocation sections for 3033 unallocated sections and EXIDX sections. 3034 (Target_arm::fix_exidx_coverage): New method. 3035 (Target_arm::output_section_address_less_than): New type. 3036 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the 3037 linked text section instead of the EXIDX section. 3038 (Arm_output_section::create_stub_group): Add an assertion to check 3039 that this is not an EXIDX output section. 3040 (Arm_output_section::append_text_sections_to_list): New method. 3041 (Arm_output_section::fix_exidx_coverage): Ditto. 3042 (Arm_relobj::scan_sections_for_stubs): Adjust call to 3043 Arm_relobj::section_needs_reloc_stub_scanning. 3044 (Target_arm::do_relax): Fix EXIDX output section coverage in the 3045 first pass. 3046 (Target_arm::fix_exidx_coverage): New method. 3047 * object.h (Relobj::set_output_section): New method. 3048 (Sized_relobj::invalidate_section_offset): Remove method. 3049 (Sized_relobj::do_invalidate_section_offset): Remove method. 3050 (Sized_relobj::do_set_section_offset): Handle offset value -1. 3051 30522010-01-25 Doug Kwan <dougkwan@google.com> 3053 3054 * arm.cc (Arm_exidx_merged_section::do_output_offset): 3055 Fix warning due to signed and unsigned comparison on a 32-bit host. 3056 30572010-01-22 Doug Kwan <dougkwan@google.com> 3058 3059 * arm.cc (Target_arm::do_relax): Record an output section for section 3060 offset adjustment it contains any stub table that has changed. 3061 * layout.cc (Layout::clean_up_after_relaxation): Adjust section 3062 offsets in an output section if necessary. 3063 * output.cc (Output_section::Output_section): Initialize 3064 section_offsets_need_adjustments_. 3065 (Output_section::add_input_section_for_script): Renamed to 3066 Output_section::add_simple_input_section. 3067 (Output_section::save_states): Add a comment. 3068 (Output_section::discard_states): New method defintion. 3069 (Output_section::adjust_section_offsets): Same. 3070 * output.h (Output_section::add_input_section_for_script): Renamed to 3071 Output_section::add_simple_input_section. 3072 (Output_section::discard_states): New method declaration. 3073 (Output_section::adjust_section_offsets): Same. 3074 (Output_section::section_offsets_need_adjustment, 3075 Output_section::set_section_offsets_need_adjustment): New method 3076 definitions. 3077 (Output_section::section_offsets_need_adjustment_): New data member. 3078 * script-sections.cc 3079 (Output_section_element_input::set_section_address): Adjust code for 3080 renaming of Output_section::add_input_section_for_script. 3081 (Orphan_output_section::set_section_address): Same. 3082 30832010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com> 3084 3085 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of 3086 Fix_v4bx enum values . 3087 * gold/options.h (General_options): New option definitions. 3088 (General_options::fix_v4bx): New method. 3089 (General_options::Fix_v4bx): New enum. 3090 * gold/options.cc (General_options::parse_fix_v4bx): New method. 3091 (General_options::parse_fix_v4bx_interworking): New method. 3092 30932010-01-22 Doug Kwan <dougkwan@google.com> 3094 3095 * arm.cc (Arm_exidx_fixup): New class. 3096 30972010-01-21 Doug Kwan <dougkwan@google.com> 3098 3099 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New 3100 classes. 3101 (Arm_exidx_section_offset_map): New type. 3102 31032010-01-21 Doug Kwan <dougkwan@google.com> 3104 3105 * arm.cc (Arm_exidx_input_section): New class. 3106 (Arm_relobj::exidx_input_section_by_link, 3107 Arm_relobj::exidx_input_section_by_shndx, 3108 Arm_relobj::make_exidx_input_section): New methods. 3109 (read_arm_attributes_section): Remove. 3110 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record 3111 information about them. 3112 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section 3113 to here. 3114 31152010-01-20 Doug Kwan <dougkwan@google.com> 3116 3117 * arm.cc (Target_arm::Arm_input_section_map): Change key type from 3118 Input_section_specifier to Section_id. 3119 (Target_arm::new_arm_input_section: Adjust code for change of key 3120 type. 3121 (Target_arm::find_arm_input_section): Ditto. 3122 * gc.h (object.h): Include for Section_id nand Section_id_hash. 3123 (Section_id): Remove. 3124 (Garbage_collection::Section_id_hash): Remove. 3125 * icf.h (object.h): Include for Section_id nand Section_id_hash. 3126 (Section_id): Remove. 3127 (Icf::Section_id_hash): Remove. 3128 * object.h (Section_id, Const_section_id, Section_id_hash, 3129 Const_section_id_hash): New type definitions. 3130 * output.cc (Output_section::add_relaxed_input_section): Change to 3131 use Const_section_id instead of Input_section_specifier as key type. 3132 (Output_section::add_merge_input_section): Ditto. 3133 (Output_section::build_relaxation_map): Change to use Section_id 3134 instead of Input_section_specifier as key type. 3135 (Output_section::convert_input_sections_in_list_to_relaxed_sections): 3136 Ditto. 3137 (Output_section::convert_input_sections_to_relaxed_sections): Change 3138 to use Const_section_id instead of Input_section_specifier as key type. 3139 (Output_section::find_merge_section): Ditto. 3140 (Output_section::find_relaxed_input_section): Ditto. 3141 * output.h (Input_section_specifier): Remove class. 3142 (Output_section::Output_section_data_by_input_section_map): Change 3143 key type to Const_section_id. 3144 (Output_section::Output_relaxed_input_section_by_input_section_map): 3145 Ditto. 3146 (Output_section::Relaxation_map): Change key type to Section_id. 3147 31482010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com> 3149 3150 * gold/arm.cc: Added support for R_ARM_V4BX relocation 3151 (class Arm_v4bx_stub): New class. 3152 (DEF_STUBS): Updated definition to support v4_veneer_bx. 3153 (Stub_factory::make_arm_v4bx_stub): New method. 3154 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template. 3155 (Stub_table::empty): Handle v4bx stubs. 3156 (Stub_table::add_arm_v4bx_stub): New method. 3157 (Stub_table::find_arm_v4bx_stub): New method. 3158 (Arm_relocate_functions::v4bx): New method. 3159 (Target_arm::fix_v4bx): New method. 3160 (Target_arm::Target_arm): Handle R_ARM_V4BX. 3161 (Stub_table::relocate_stubs): Likewise. 3162 (Stub_table::do_write): Likewise. 3163 (Stub_table::update_data_size_and_addralign): Likewise. 3164 (Stub_table::finalize_stubs): Likewise. 3165 (Target_arm::Scan::local): Likewise. 3166 (Target_arm::Scan::global): Likewise. 3167 (Target_arm::do_finalize_sections): Likewise. 3168 (Target_arm::Relocate::relocate): Likewise. 3169 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): 3170 Likewise. 3171 (Target_arm::scan_reloc_for_stub): Likewise. 3172 (Target_arm::scan_reloc_section_for_stubs): Likewise. 3173 31742010-01-19 Ian Lance Taylor <iant@google.com> 3175 3176 * output.cc (Output_section_headers::do_sized_write): Write large 3177 segment count to sh_info field. 3178 (Output_file_header::do_sized_write): For large segment count, 3179 write PN_XNUM to e_phnum field. 3180 31812010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com> 3182 3183 * arm.cc (Arm_relocate_functions::thm_jump6): New function. 3184 (Arm_relocate_functions::thm_jump8): New function. 3185 (Arm_relocate_functions::thm_jump11): New function. 3186 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8, 3187 R_ARM_THM_JUMP11. 3188 (Target_arm::Scan::global): Likewise. 3189 (Target_arm::Relocate::relocate): Likewise. 3190 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): 3191 Likewise. 3192 31932010-01-14 Doug Kwan <dougkwan@google.com> 3194 3195 * arm.cc (map, utility): Include headers. 3196 (Target_arm::apply_cortex_a8_workaround): New method. 3197 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround. 3198 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19. 3199 (Target_arm::Scan::global): R_ARM_THM_JUMP19. 3200 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to 3201 the --[no-]fix-cortex-a8 command line options. 3202 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19. 3203 (Target_arm::relocate_stub): Use addend in instruction template. 3204 * options.h (DEFINE_bool): Set the user-set flag. 3205 (General_options): Add --[no-]-fix-cortex options. 3206 * output.cc (Output_section::convert_input_sections_to_relaxed_sections) 3207 : Update fast look-up map after conversion. 3208 32092010-01-14 Sriraman Tallam <tmsriram@google.com> 3210 3211 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack 3212 in the first pass of do_layout. 3213 32142010-01-13 Doug Kwan <dougkwan@google.com> 3215 3216 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning, 3217 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an 3218 apparent compiler problem of not folding static constant integral 3219 data members of elfcpp::Elf_sizes<32>. 3220 32212010-01-13 Doug Kwan <dougkwan@google.com> 3222 3223 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning, 3224 Arm_relobj::section_needs_cortex_a8_stub_scanning, 3225 Arm_relobj::scan_section_for_cortex_a8_erratum, 3226 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods. 3227 (Arm_relobj::scan_sections_for_stubs): Move code deciding what 3228 sections to scan for relocation stubs into a new method 3229 Arm_relobj::section_needs_reloc_stub_scanning. Handle both 3230 relocation and Cortex-A8 stub scanning. 3231 (Target_arm::do_relax): Force stubs to be after stubbed sections 3232 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at 3233 the beginning of a new relaxation pass. Update a comment. 3234 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition. 3235 32362010-01-12 Ian Lance Taylor <iant@google.com> 3237 3238 * target-reloc.h (visibility_error): New inline function. 3239 (relocate_section): Call visibility_error. 3240 * testsuite/Makefile.am (check_DATA): Add protected_3.err. 3241 (MOSTLYCLEANFILES): Likewise. 3242 (protected_4_pic.o, protected_3.err): New targets. 3243 * testsuite/protected_4.cc: New file. 3244 32452010-01-12 Doug Kwan <dougkwan@google.com> 3246 3247 * arm.cc (Cortex_a8_reloc): New class. 3248 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_ 3249 and cortex_a8_relocs_info_. 3250 (Target_arm::fix_cortex_a8): New method definition. 3251 (Target_arm::Cortex_a8_relocs_info): New type. 3252 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_): 3253 New data member declarations. 3254 (Target_arm::scan_reloc_for_stub): Record information about 3255 relocations for THUMB branches that might be exempted from the 3256 Cortex-A8 workaround. 3257 (Target_arm::do_relax): Clear all Cortex-A8 relocation information 3258 at the beginning of a relaxation pass. 3259 32602010-01-12 Doug Kwan <dougkwan@google.com> 3261 3262 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member. 3263 (Arm_relobj::Mapping_symbol_position, 3264 Arm_reloj::Mapping_symbol_position_less, 3265 Arm_relobj::Mapping_symbols_info): New types. 3266 (Target_arm::is_mapping_symbol_name): New method definition. 3267 (Arm_relobj::do_count_local_symbols): Save information about mapping 3268 symbols. 3269 32702010-01-11 Doug Kwan <dougkwan@google.com> 3271 3272 * arm.cc (Arm_relocate_functions::thumb32_branch_offset, 3273 Arm_relocate_functions::thumb32_branch_upper, 3274 Arm_relocate_functions::thumb32_branch_lower, 3275 Arm_relocate_functions::thumb32_cond_branch_offset, 3276 Arm_relocate_functions::thumb32_cond_branch_upper, 3277 Arm_relocate_functions::thumb32_cond_branch_lower, 3278 Arm_relocate_functions::thm_jump19): New methods to handle THUMB 3279 branch offset encoding. 3280 (Arm_relocate_functions::thumb_branch_common): Use new branch 3281 offset encoding methods to avoid code duplication. 3282 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE. 3283 (Stub_addend_reader::operator()): Use new branch encoding method 3284 to avoid code duplication. 3285 32862010-01-11 Doug Kwan <dougkwan@google.com> 3287 3288 * arm.cc (Arm_relobj::do_gc_process_relocs): New method. 3289 (Target_arm::do_finalize_sections): Define special EXIDX section 3290 symbols only if referenced. 3291 * gc.h (Garbage_collection::add_reference): New method. 3292 (gc_process_relocs): Use Garbage_collection::add_reference to avoid 3293 code duplication. 3294 32952010-01-11 Ian Lance Taylor <iant@google.com> 3296 3297 * script.cc (Version_script_info::build_expression_list_lookup): 3298 Change complaing about duplicate wildcard match from error to 3299 warning. 3300 3301 * script.cc (class Lazy_demangler): Recreate--revert part of patch 3302 of 2009-12-30. 3303 (Version_script_info::Version_script_info): Initialize globs_, 3304 default_version_, default_is_global_, and exact_. Don't 3305 initialize globals_ or locals_. 3306 (Version_script_info::build_lookup_tables): Build local symbols 3307 first. 3308 (Version_script_info::unquote): New function. 3309 (Version_script_info::add_exact_match): New function. 3310 (Version_script_info::build_expression_list_lookup): Remove lookup 3311 parameter. Add is_global parameter. Change all callers. Handle 3312 wildcard pattern specially. Unquote pattern. Call 3313 add_exact_match. 3314 (Version_script_info::get_name_to_match): New function. 3315 (Version_script_info::get_symbol_version): New function. 3316 (Version_script_info::get_symbol_version_helper): Remove. 3317 (Version_script_info::check_unmatched_names): Call unquote. 3318 * script.h (class Version_script_info): Change get_symbol_version 3319 to be non-inline and add is_global parameter; change all callers. 3320 Rewrite symbol_is_local. Update declarations. Define struct 3321 Version_tree_match, Exact, Globs. Don't define struct Lookup. 3322 Remove globals_ and locals_ members. Add exact_, globs_, 3323 default_version_, is_global_. 3324 (Version_script_info::Glob): Remove pattern, add expression and 3325 is_global. Update constructor. Change all callers. 3326 * dynobj.cc (Versions::finalize): Mark the version symbol as the 3327 default version. 3328 (Versions::symbol_section_contents): If a symbol is undefined, or 3329 defined in a dynamic object, set the version index to 3330 VER_NDX_LOCAL. 3331 * symtab.cc (Symbol_table::add_from_relobj): Don't call 3332 symbol_is_local. 3333 (Symbol_table::add_from_pluginobj): Likewise. 3334 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2. 3335 33362010-01-11 Doug Kwan <dougkwan@google.com> 3337 3338 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency. 3339 (incremental_dump_LDADD): Add linking option for libintl. 3340 * Makefile.in: Regenerate. 3341 33422010-01-11 H.J. Lu <hongjiu.lu@intel.com> 3343 3344 PR gold/11144 3345 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms 3346 instead of -Ds. 3347 * testsuite/Makefile.in: Regenerated. 3348 33492010-01-10 Doug Kwan <dougkwan@google.com> 3350 3351 * options.h (DEFINE_var): Use parentheses around argument varname__ 3352 in macro body to avoid any unintended subsequent substitutions. 3353 33542010-01-10 Ian Lance Taylor <iant@google.com> 3355 3356 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR 3357 candidates before doing symbol resolution. 3358 3359 * resolve.cc (Symbol_table::resolve): Add symbols to the list of 3360 ODR candidates if only one is weak. 3361 33622010-01-08 Ian Lance Taylor <iant@google.com> 3363 3364 * script.cc (Version_script_info::build_expression_list_lookup): 3365 Don't warn about ambiguous version, just record the ambiguity. 3366 (Version_script_info::get_symbol_version_helper): Give error if 3367 version is ambiguous. 3368 33692010-01-08 Doug Kwan <dougkwan@google.com> 3370 3371 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_, 3372 prev_data_size_ and prev_addralign_. Remove initializer for 3373 deleted data member has_been_changed_. 3374 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_ 3375 to determine if the table is empty. 3376 (Stub_table::has_been_changed, Stub_table_set_has_been_changed): 3377 Remove. 3378 (Stub_table::add_reloc_stub): Define method in class definition 3379 instead of just declaring it there. 3380 (Stub_table::add_cortex_a8_stub): New method definition. 3381 (Stub_table::update_data_size_and_addralign): Ditto. 3382 (Stub_table::finalize_stubs): Ditto. 3383 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto. 3384 (Stub_table::do_addralign_): Return address alignment in the 3385 (Stub_table::do_reset_address_and_file_offset): Define method in 3386 class definition instead of declaring it there. Set current data 3387 size to be the data size of the previous pass. 3388 (Stub_table::set_final_data_size): Use current data size as the 3389 final data size. 3390 (Stub_table::relocate_stub): Change parameter type of stub from 3391 Reloc_stub pointer to Stub pointer. 3392 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove. 3393 (Stub_table::Cortex_a8_stub_list): New typedef. 3394 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_, 3395 Stub_table::prev_addralign_): New data member. 3396 (Arm_relobj::Arm_relobj): Initialize data member 3397 section_has_cortex_a8_workaround_. 3398 (Arm_relobj::section_has_cortex_a8_workaround, 3399 Arm_relobj::mark_section_for_cortex_a8_workaround): New method 3400 definitions. 3401 (Arm_relobj::section_has_cortex_a8_workaround_): New data member 3402 declarations. 3403 (Target_arm::relocate_stub): Change parameter type of stub from 3404 Reloc_stub pointer to Stub pointer. 3405 (Insn_template::size, Insn_template::alignment): Handle 3406 THUMB16_SPECIAL_TYPE. 3407 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs, 3408 Stub_table::update_data_size_and_addralign, 3409 Stub_table::apply_cortex_a8_workaround_to_address_range): New method 3410 definitions. 3411 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs. 3412 (Stub_table::do_write): Ditto. 3413 (Target_arm::do_relax): Adjust code for changes in Stub_table. 3414 34152010-01-08 Ian Lance Taylor <iant@google.com> 3416 3417 PR 11108 3418 * symtab.h (class Symbol): Remove fields is_target_special_ and 3419 has_plt_offset_. Add field is_defined_in_discarded_section_. 3420 (Symbol::is_defined_in_discarded_section): New function. 3421 (Symbol::set_is_defined_in_discarded_section): New function. 3422 (Symbol::has_plt_offset): Rewrite. 3423 (Symbol::set_plt_offset): Verify that new offset is not -1U. 3424 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U. 3425 Don't initialize is_target_special_ or has_plt_offset_. 3426 Initialize is_defined_in_discarded_section_. 3427 (Symbol_table::add_from_relobj): If appropriate, set 3428 is_defined_in_discarded_section. 3429 * resolve.cc (Symbol::override_base_with_special): Don't test 3430 is_target_special_. Change has_plt_offset_ to has_plt_offset(). 3431 * target-reloc.h (relocate_section): Do special handling for 3432 symbols defined in discarded sections for global symbols as well 3433 as local symbols. 3434 34352010-01-08 Ian Lance Taylor <iant@google.com> 3436 3437 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in 3438 the SHT_SYMTAB case. 3439 34402010-01-08 Ian Lance Taylor <iant@google.com> 3441 3442 * object.cc (Sized_relobj::do_layout): Don't get confused if 3443 layout_eh_frame returns NULL. 3444 34452010-01-08 Ian Lance Taylor <iant@google.com> 3446 3447 PR 11084 3448 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no 3449 dynamic symbol table, use the normal symbol table. 3450 (Sized_dynobj::do_read_symbols): Remove assertion about type of 3451 symbol table. 3452 34532010-01-08 Ian Lance Taylor <iant@google.com> 3454 3455 PR 11072 3456 * layout.cc (Layout::include_section): Remove .gnu_debuglink 3457 sections. 3458 34592010-01-08 H.J. Lu <hongjiu.lu@intel.com> 3460 3461 * version.cc (print_version): Change to "Copyright 2010". 3462 34632010-01-08 Ian Lance Taylor <iant@google.com> 3464 3465 PR 10287 3466 PR 11063 3467 * i386.cc (class Target_i386): Change return type of plt_section 3468 to be non-const. 3469 (class Output_data_plt_i386): Add tls_desc_rel_ field. 3470 (Output_data_plt_i386::Output_data_plt_i386): Initialize 3471 tls_desc_rel_ field. 3472 (Output_data_plt_i386::rel_tls_desc): New function. 3473 (Target_i386::rel_tls_desc_section): New function. 3474 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling. 3475 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put 3476 R_386_TLS_DESC reloc in rel_tls_desc_section. 3477 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field. 3478 Define struct Tlsdesc_info. 3479 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_. 3480 (Target_x86_64::do_reloc_symbol_index): New function. 3481 (Target_x86_64::add_tlsdesc_info): New function. 3482 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field. 3483 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize 3484 tlsdesc_rel_ field. 3485 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change 3486 all callers. 3487 (Output_data_plt_x86_64::rela_tlsdesc): New function. 3488 (Target_x86_64::rela_tlsdesc_section): New function. 3489 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC 3490 handling. 3491 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put 3492 (Target_x86_64::do_reloc_addend): New function. 3493 R_X86_64_TLSDESC reloc in rela_tlsdesc_section. 3494 * output.h (class Output_reloc) [SHT_REL]: Add new constructor 3495 declarations. Define TARGET_CODE. Add arg field to u1_ union. 3496 (Output_reloc::type): New function. 3497 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE. 3498 (Output_reloc::is_target_specific): New function. 3499 (Output_reloc::target_arg): New function. 3500 (class Output_reloc) [SHT_RELA]: Add four new constructors for 3501 absolute relocs and target specific relocs. 3502 (class Output_data_reloc) [SHT_REL]: Add add_absolute and 3503 add_target_specific. 3504 (class Output_data_reloc) [SHT_RELA]: Likewise. 3505 * output.cc (Output_reloc::Output_reloc): Add four new versions 3506 for absolute relocs and target specific relocs. 3507 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case. 3508 (Output_reloc::get_symbol_index): Likewise. 3509 (Output_reloc::local_section_offset): Check that local_sym_index_ 3510 is not TARGET_CODE or 0. 3511 (Output_reloc::symbol_value): Likewise. 3512 (Output_reloc::write) [SHT_RELA]: Call target for target specific 3513 reloc. 3514 * target.h (class Target): Add reloc_symbol_index and reloc_addend 3515 functions. Add do_reloc_symbol_index and do_reloc_addend virtual 3516 functions. 3517 * layout.cc (add_target_dynamic_tags): Use output section for 3518 DT_PLTRELSZ and DT_JMPREL. 3519 35202010-01-07 Ian Lance Taylor <iant@google.com> 3521 3522 PR 11061 3523 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative 3524 function. 3525 (class Output_data_reloc_generic): Define. 3526 (class Output_data_reloc_base): Change base class to 3527 Output_data_reloc_generic. Change add() method to call 3528 bump_relative_reloc_count for a relative reloc. Remove 3529 sort_relocs_ field. 3530 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_ 3531 to sort_relocs(). 3532 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to 3533 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if 3534 appropriate. 3535 * layout.h (class Layout): Update declaration. 3536 35372010-01-07 Ian Lance Taylor <iant@google.com> 3538 3539 * output.h (class Output_data): Add const version of 3540 output_section and do_output_section. 3541 (class Output_section_data): Add const version of 3542 do_output_section. 3543 (class Output_section): Likewise. 3544 * layout.cc (Layout::add_target_dynamic_tags): New function. 3545 * layout.h (class Layout): Update declarations. 3546 * arm.cc (Target_arm::do_finalize_sections): Use 3547 add_target_dynamic_tags. 3548 * i386.cc (Target_i386::do_finalize_sections): Likewise. 3549 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise. 3550 * sparc.cc (Target_sparc::do_finalize_sections): Likewise. 3551 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise. 3552 35532010-01-07 Ian Lance Taylor <iant@google.com> 3554 3555 PR 11042 3556 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic 3557 object as needed. 3558 35592010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com> 3560 Ian Lance Taylor <iant@google.com> 3561 3562 PR 11019 3563 * object.cc: Instantiate Xindex::initialize_symtab_xindex and 3564 Xindex::read_symtab_xindex. 3565 35662010-01-07 Doug Kwan <dougkwan@google.com> 3567 3568 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE. 3569 (Insn_template::thumb16_bcond_insn): New method declaration. 3570 (Insn_template): Fix spelling. 3571 (Stub::thumb16_special): New method declaration. 3572 (Stub::do_write): Define virtual method which was previously pure 3573 virtual. 3574 (Stub::do_thumb16_special): New method declaration. 3575 (Stub::do_fixed_endian_write): New template member. 3576 (Reloc_stub::do_write): Remove. 3577 (Reloc_stub::do_fixed_endian_write): Remove. 3578 (Cortex_a8_stub): New class definition. 3579 (Stub_factory::make_cortex_a8_stub): New method definition. 3580 (Stub_factory::Stub_factory): Add missing static storage class 3581 qualifier for elf32_arm_stub_a8_veneer_blx. 3582 35832010-01-07 Ian Lance Taylor <iant@google.com> 3584 3585 PR 10980 3586 * options.h (class General_options): Add --warn-unresolved-symbols 3587 and --error-unresolved-symbols. 3588 * errors.cc (Errors::undefined_symbol): Implement 3589 --warn-unresolved-symbols. 3590 3591 * options.h (class General_options): Add -z text and -z textoff. 3592 * layout.cc (Layout::finish_dynamic_section): Implement -z text. 3593 35942010-01-06 Sriraman Tallam <tmsriram@google.com> 3595 3596 * gc.h (Garbage_collection::Cident_section_map): New typedef. 3597 (Garbage_collection::cident_sections): New function. 3598 (Garbage_collection::add_cident_section): New function. 3599 (Garbage_collection::cident_sections_): New member. 3600 (gc_process_relocs): Add references to sections whose names are C 3601 identifiers. 3602 * gold.h (cident_section_start_prefix): New constant. 3603 (cident_section_stop_prefix): New constant. 3604 (is_cident): New function. 3605 * layout.cc (Layout::define_section_symbols): Replace string constants 3606 with the newly defined constants. 3607 * object.cc (Sized_relobj::do_layout): Track sections whose names are 3608 C identifiers. 3609 * testsuite/Makefile.am: Add gc_orphan_section_test. 3610 * testsuite/Makefile.in: Regenerate. 3611 * testsuite/gc_orphan_section_test.cc: New file. 3612 * testsuite/gc_orphan_section_test.sh: New file. 3613 36142010-01-06 Ian Lance Taylor <iant@google.com> 3615 3616 PR 10980 3617 * options.h (class General_options): Add --warn-shared-textrel. 3618 * layout.cc (Layout::finish_dynamic_section): Implement 3619 --warn-shared-textrel. 3620 3621 PR 10980 3622 * options.h (class General_options): Add --warn-multiple-gp. 3623 36242010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com> 3625 3626 * Makefile.am (incremental_dump_DEPENDENCIES): Remove 3627 $(THREADSLIB) and $(LIBDL). 3628 * Makefile.in: Rebuild. 3629 36302010-01-06 Ian Lance Taylor <iant@google.com> 3631 3632 PR 10980 3633 * options.cc (General_options::parse_section_start): New function. 3634 (General_options::section_start): New function. 3635 (General_options::General_options): Initialize all members. 3636 * options.h: Include <map> 3637 (class General_options): Add --section-start. Add section_starts_ 3638 member. 3639 * layout.cc (Layout::attach_allocated_section_to_segment): If 3640 --section-start was used, set the address of the segment. Remove 3641 local sort_sections. 3642 (Layout::relaxation_loop_body): If the address of the load segment 3643 has been set by --section-start, don't use it. 3644 * output.h (Output_segment::update_flags_for_output_section): New 3645 function. 3646 * output.cc (Output_segment::add_output_section): Call 3647 update_flags_for_output_section. 3648 36492010-01-05 Ian Lance Taylor <iant@google.com> 3650 3651 PR 10980 3652 * options.h (class General_options): Add --undefined-version. 3653 * script.cc (struct Version_expression): Add was_matched_by_symbol 3654 field. 3655 (Version_script_info::matched_symbol): New function. 3656 (Version_script_info::get_symbol_version_helper): Call 3657 matched_symbol. 3658 (Version_script_info::check_unmatched_names): New function. 3659 * script.h (class Version_script_info): Update declarations. 3660 * gold.cc (queue_middle_tasks): Handle --no-undefined-version. 3661 3662 * options.h (class General_options): Use DEFINE_bool_alias for 3663 allow_multiple_definition. 3664 * resolve.cc (Symbol_table::should_override): Don't test 3665 allow_multiple_definition. 3666 3667 PR 10980 3668 * options.h (class General_options): Add --cref. 3669 * main.cc (main): Print cref table if --cref. Don't close mapfile 3670 until after printing cref table. 3671 * cref.cc: Include "symtab.h". 3672 (class Cref_inputs): Define Cref_table_compare and Cref_table. 3673 (Cref_table_compare::operator()): New function. 3674 (Cref_inputs::gather_cref): New function. 3675 (filecol): New static const. 3676 (Cref_inputs::print_cref): New function. 3677 (Cref::print_cref): New function. 3678 * cref.h: Include <cstdio>. 3679 (class Cref): Update declarations. 3680 * mapfile.h (Mapfile::file): New function. 3681 * object.h (class Object): Define Symbols. Declare virtual 3682 do_get_global_symbols. 3683 (Object::get_global_symbols): New function. 3684 * object.cc (Input_objects::add_object): Pass object to cref_ if 3685 --cref. 3686 (Input_objects::archive_start): Likewise. 3687 (Input_objects::archive_stop): Likewise. 3688 (Input_objects::print_cref): New function. 3689 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function. 3690 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if 3691 --cref. 3692 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New 3693 function. 3694 * plugin.h (class Sized_pluginobj): Update declarations. 3695 36962010-01-05 Ian Lance Taylor <iant@google.com> 3697 3698 * symtab.cc (Symbol_table::add_from_object): Rename def parameter 3699 to is_default_version. Rename insdef to insdefault. 3700 (Symbol_table::add_from_relobj): Rename def to is_default_version 3701 and local to is_forced_local. 3702 (Symbol_table::add_from_pluginobj): Likewise. 3703 (Symbol_table::add_from_dynobj): Likewise. 3704 (Symbol_table::define_special_symbol): Rename insdef to 3705 insdefault. 3706 37072010-01-04 Ian Lance Taylor <iant@google.com> 3708 3709 PR 10980 3710 * options.h (class General_options): Add 3711 --allow-multiple-definition and -z muldefs. 3712 * resolve.cc (Symbol_table::should_override): Don't warn about a 3713 multiple symbol definition if --allow-multiple-definition or -z 3714 muldefs. 3715 3716 PR 10980 3717 * options.h (class General_options): Add --add-needed and 3718 --copy-dt-needed-entries. Tweak --as-needed help entry. 3719 * object.cc (Input_objects::check_dynamic_dependencies): Give an 3720 error if --copy-dt-needed-entries aka --add-needed is used and 3721 would cause a change in behaviour. 3722 3723 PR 10980 3724 * options.h (class General_options): Add -G as a short version of 3725 --shared. Add no-op options -assert, -g, and -i. 3726 37272010-01-04 Sriraman Tallam <tmsriram@google.com> 3728 3729 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to 3730 check for .text or .gnu.linkonce.t sections. 3731 * icf.cc (Icf::find_identical_sections): Ditto. 3732 Change the detection for mangled function name within the section 3733 name. 3734 * icf.h (is_section_foldable_candidate): New function. 3735 37362009-12-30 Ian Lance Taylor <iant@google.com> 3737 3738 PR 10980 3739 * options.h (class General_options): Permit two dashes with 3740 --retain-symbols-file. 3741 37422009-12-30 Ian Lance Taylor <iant@google.com> 3743 3744 PR 10979 3745 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used, 3746 don't put the file header and segment headers in the text 3747 segment. 3748 3749 PR 10979 3750 * common.cc (Sort_commons::operator()): Stabilize sort when both 3751 entries are NULL. 3752 (Symbol_table::do_allocate_commons_list): When allocating common 3753 symbols, skip a symbol which is no longer common. 3754 * symtab.h (Symbol::is_common): Test whether the symbol comes from 3755 an object before checking its type. 3756 * testsuite/common_test_2.c: New file. 3757 * testsuite/common_test_3.c: New file. 3758 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2. 3759 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define. 3760 (common_test_2_LDFLAGS, common_test_2_LDADD): Define. 3761 (common_test_2_pic.o, common_test_2.so): New targets. 3762 (common_test_3_pic.o, common_test_3.so): New targets. 3763 * testsuite/Makefile.in: Rebuild. 3764 3765 PR 10979 3766 * script.cc (read_input_script): If we see a new SECTIONS clause, 3767 and we have added an input section, give an error. 3768 * layout.h (class Layout): Add have_added_input_section function. 3769 Add have_added_input_section_ field. 3770 * layout.cc (Layout::Layout): Initialize 3771 have_added_input_section_. 3772 (Layout::layout): Set have_added_input_section_. 3773 (Layout::layout_eh_frame): Likewise. 3774 37752009-12-30 Ian Lance Taylor <iant@google.com> 3776 3777 PR 10931 3778 * options.h (class General_options): Add --sort-common option. 3779 * symtab.h (class Symbol_table): Define Sort_commons_order enum. 3780 * common.cc (Sort_common): Add sort_order parameter to 3781 constructor. Add sort_order_ field. 3782 (Sort_commons::operator): Check sort_order_. 3783 (Symbol_table::allocate_commons): Determine the sort order. 3784 (Symbol_table::do_allocate_commons): Add sort_order parameter. 3785 Change all callers. 3786 (Symbol_table::do_allocate_commons_list): Likewise. 3787 37882009-12-30 Ian Lance Taylor <iant@google.com> 3789 3790 PR 10916 3791 * symtab.cc (Symbol_table::add_from_relobj): When not exporting 3792 symbols from this object, don't change the visibility of an 3793 undefined symbol. 3794 * testsuite/exclude_libs_test_1.c (lib1_ref): New function. 3795 37962009-12-30 Ian Lance Taylor <iant@google.com> 3797 3798 PR 10861 3799 * script.h (class Version_script_info): Define Language enum. 3800 Update declarations. Define Glob, Exact, and Lookup types. Add 3801 new fields globals_, locals_, and is_finalized_. 3802 * script.cc: Various formatting fixes. 3803 (class Parser_closure): Change language_stack_ from a vector of 3804 std::string to one of Version_script_info::Language. Adjust all 3805 uses accordingly. 3806 (class Lazy_demangler): Remove. 3807 (struct Version_expression): Change language from std::string to 3808 Version_script_info::Language. 3809 (Version_script_info::Version_script_info): New function. 3810 (Version_script_info::~Version_script_info): Don't call clear. 3811 (Version_script_info::finalize): New function. 3812 (Version_script_info::build_lookup_tables): New function. 3813 (Version_script_info::build_expression_list_lookup): New 3814 function. 3815 (Version_script_info::get_symbol_version_helper): Rewrite to use 3816 lookup tables. 3817 (Version_script_info::print_expression_list): Adjust to use 3818 Version_script_info::Language. 3819 (script_push_lex_into_version_mode): Check that the version script 3820 has not been finalized. 3821 (version_script_push_lang): Change language string to 3822 Version_script_info::Language. 3823 * options.cc (Command_line::version_script): New function. 3824 * options.h (class General_options): Add finalize_dynamic_list 3825 function. Change version_script from declaration to definition. 3826 * testsuite/ver_test_4.script: Remove duplicate def of t2_2. 3827 * testsuite/version_script.map: Remove duplicate def of foo. 3828 * testsuite/Makefile.am (ver_matching_def.so): Depend upon 3829 version_script.map. 3830 * testsuite/Makefile.in: Rebuild. 3831 38322009-12-30 Ian Lance Taylor <iant@google.com> 3833 3834 PR 10843 3835 * target-reloc.h (relocate_for_relocatable): When copying a reloc, 3836 if the input symbol index is 0, make the output symbol index 0. 3837 38382009-12-30 Ian Lance Taylor <iant@google.com> 3839 3840 PR 10670 3841 * options.h (class General_options): Add -x/--discard-all. 3842 * object.cc (Sized_relobj::do_count_local_symbols): Handle 3843 --discard-all. If the local symbol needs a dynamic entry, check 3844 that before handling --discard-locals. 3845 38462009-12-30 Ian Lance Taylor <iant@google.com> 3847 3848 PR 10450 3849 * output.cc (Output_segment::Output_segment): If PT_TLS, set the 3850 flags to PF_R. 3851 (Output_segment::add_output_section): Don't change the flags if 3852 the type is PT_TLS. 3853 3854 PR 10450 3855 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the 3856 GNU hash table if they need a dynamic value. Otherwise, don't add 3857 them if they are defined in a dynamic object or are forced local. 3858 38592009-12-29 Ian Lance Taylor <iant@google.com> 3860 3861 PR 10450 3862 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of 3863 .gnu.hash table for a 32-bit target. 3864 3865 PR 10450 3866 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a 3867 regular and a dynamic object only needs a dynamic symbol table 3868 entry if it is externally visible. 3869 3870 PR 10450 3871 * i386.cc (class Target_i386): Initialize global_offset_table_ in 3872 constructor. Add global_offset_table_ field. 3873 (Target_i386::got_section): Set global_offset_table_. 3874 (Target_i386::do_finalize_sections): Set global_offset_table_ 3875 size. 3876 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_ 3877 in constructor. Add global_offset_table_ field. 3878 (Target_x86_64::got_section): Set global_offset_table_. 3879 (Target_x86_64::do_finalize_sections): Set global_offset_table_ 3880 size. 3881 3882 * layout.cc (Layout::Layout): Initialize increase_relro_. 3883 (Layout::get_output_section): Add is_relro, is_last_relro, and 3884 is_first_non_relro parameters. Change all callers. 3885 (Layout::choose_output_section): Likewise. 3886 (Layout::add_output_section_data): Likewise. 3887 (Layout::make_output_section): Likewise. 3888 (Layout::set_segment_offsets): Clear increase_relro when using a 3889 linker script. 3890 * layout.h (class Layout): Add increase_relro method. Add 3891 increase_relro_ field. Update declarations. 3892 * output.cc (Output_section::Output_section): Initialize 3893 is_last_relro_ and is_first_non_relro_. 3894 (Output_segment::add_output_section): Group relro sections is 3895 do_sort is true. Handle is_last_relro and is_first_non_relro. 3896 (Output_segment::maximum_alignment): Remove relro handling. 3897 (Output_segment::set_section_addresses): Add increase_relro 3898 parameter. Change all callers. Add initial alignment to align 3899 relro sections on separate page. Remove old relro handling. 3900 (Output_segment::set_section_list_addresses): Remove in_relro 3901 parameter. Change all callers. 3902 (Output_segment::set_offset): Add increase parameter. Change all 3903 callers. Remove old relro handling. 3904 * output.h (class Output_section): Add new methods: is_last_relro, 3905 set_is_last_relro, is_first_non_relro, set_is_first_non_relro. 3906 Add is_last_relro_ and is_first_non_relro_ fields. 3907 * i386.cc (Target_i386::got_section): Don't call set_is_relro. 3908 Create separate .got.plt section. Call increase_relro. 3909 * x86_64.cc (Target_x86_64::got_section): Likewise. 3910 * testsuite/relro_script_test.t: Add .got.plt. 3911 3912 PR 10450 3913 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field. 3914 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_. 3915 (Layout::finalize): Call set_dynamic_symbol_size. 3916 (Layout::set_dynamic_symbol_size): New function. 3917 * layout.h (class Layout): Add dynamic_symbol_ field. Declare 3918 set_dynamic_symbol_size. 3919 3920 PR 10450 3921 * output.h (class Output_section): Add is_entsize_zero_ field. 3922 * output.cc (Output_section::Output_section): Initialize 3923 is_entsize_zero_. 3924 (Output_section::set_entsize): If two different entsizes are 3925 requested, force it to zero. 3926 (Output_section::add_input_section): Set flags for .debug_str 3927 before updating section flags. Set entsize. 3928 (Output_section::update_flags_for_input_section): Set SHF_MERGE 3929 and SHF_STRING if all input sections have those flags. 3930 39312009-12-29 Rafael Espindola <espindola@google.com> 3932 3933 * main.cc (main): Fix the sys time reporting. 3934 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time 3935 reporting. 3936 39372009-12-29 Sriraman Tallam <tmsriram@google.com> 3938 3939 * options.cc (General_options::parse_version): Allow -v to exit 3940 without an error if there is nothing to link. 3941 39422009-12-29 Ian Lance Taylor <iant@google.com> 3943 3944 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if 3945 using a version of gcc before 4.1. 3946 * configure: Rebuild. 3947 39482009-12-28 Chris Demetriou <cgd@google.com> 3949 3950 * attributes.cc (Output_attributes_section_data::do_write): Use 3951 std::vector::front rather than std::vector::data. 3952 39532009-12-28 Ian Lance Taylor <iant@google.com> 3954 3955 * symtab.h (class Symbol_table): Add enum Defined. 3956 * resolve.cc (Symbol_table::should_override): Add defined 3957 parameter. Change all callers. Test whether object is NULL 3958 before calling a method on it. 3959 (Symbol_table::report_resolve_problem): Add defined parameter. 3960 Change all callers. 3961 (Symbol_table::should_override_with_special): Likewise. 3962 * symtab.cc (Symbol_table::define_in_output_data): Add defined 3963 parameter. Change all callers. 3964 (Symbol_table::do_define_in_output_data): Likewise. 3965 (Symbol_table::define_in_output_segment): Likewise. 3966 (Symbol_table::do_define_in_output_segment): Likewise. 3967 (Symbol_table::define_as_constant): Likewise. 3968 (Symbol_table::do_define_as_constant): Likewise. 3969 * script.h (class Symbol_assignment): Add is_defsym parameter to 3970 constructor; change all callers. 3971 * script.cc (Script_options::add_symbol_assignment): Add is_defsym 3972 parameter. Change all callers. Add is_defsym_ field. 3973 (class Parser_closure): Add parsing_defsym parameter to 3974 constructor; change all callers. Add parsing_defsym accessor 3975 function. Add parsing_defsym_ field. 3976 39772009-12-28 Ian Lance Taylor <iant@google.com> 3978 3979 * gold.cc (queue_middle_tasks): Fix formatting. 3980 * object.cc (Relobj::is_section_name_included): Likewise. 3981 39822009-12-23 Ian Lance Taylor <iant@google.com> 3983 3984 * i386.cc (Target_i386::do_calls_non_split): Recognize 3985 -fsplit-stack prologue for a function with a static chain. 3986 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize 3987 -fsplit-stack prologue when using %r11. 3988 39892009-12-21 Sriraman Tallam <tmsriram@google.com> 3990 3991 * options.cc (General_options::parse_version): Make -v continue and do 3992 the link like GNU ld does. 3993 39942009-12-17 Rafael Avila de Espindola <espindola@google.com> 3995 3996 * Makefile.am (CCFILES): Add timer.cc. 3997 (HFILES): Add timer.h. 3998 * configure.ac: Check for sysconf and times. 3999 * main.cc: include timer.h. 4000 (main): Use Timer instead of get_run_time. 4001 * timer.cc: New. 4002 * timer.h: New. 4003 * workqueue.cc: include timer.h. 4004 (Workqueue::find_and_run_task): 4005 Report user, sys and wall time. 4006 * Makefile.in: Regenerate. 4007 * config.in: Regenerate. 4008 * configure: Regenerate. 4009 40102009-12-16 Doug Kwan <dougkwan@google.com> 4011 4012 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated 4013 sections. 4014 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle 4015 relaxed input sections. 4016 * output.cc (Output_section::find_relaxed_input_section): Change 4017 return type to Output_relaxed_input_section pointer. Adjust code 4018 for new type of relaxed_input_section_map_. 4019 * output.h (Output_section::find_relaxed_input_section): Change 4020 return type to Output_relaxed_input_section pointer. 4021 (Output_section::Output_relaxed_input_section_by_input_section_map): 4022 New type. 4023 (Output_section::relaxed_input_section_map_): Change type to 4024 Output_section::Output_relaxed_input_section_by_input_section_map. 4025 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed 4026 input section. 4027 40282009-12-15 Ian Lance Taylor <iant@google.com> 4029 4030 * layout.cc (Layout::create_shstrtab): Only write out after input 4031 sections if we are compressing debug sections. 4032 40332009-12-15 Ian Lance Taylor <iant@google.com> 4034 4035 * archive.cc (Archive::add_symbols): Only look up a symbol without 4036 a version if there is, in fact, a version. 4037 40382009-12-14 Ian Lance Taylor <iant@google.com> 4039 4040 Revert -Wshadow changes, all changes from: 4041 2009-12-11 Doug Kwan <dougkwan@google.com> 4042 2009-12-11 Nick Clifton <nickc@redhat.com> 4043 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS. 4044 40452009-12-11 Doug Kwan <dougkwan@google.com> 4046 4047 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage 4048 due to -Wshadow. 4049 * attributes.cc (Object_attribute::size): Ditto. 4050 (Attributes_section_data::size): Ditto. 4051 (Attributes_section_data::Attributes_section_data): Ditto. 4052 (Output_attributes_section_data::do_write): Ditto. 4053 * attributes.h (Object_attribute::set_type): Ditto. 4054 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto. 4055 40562009-12-11 Nick Clifton <nickc@redhat.com> 4057 4058 * archive.cc: Fix shadowed variable warnings. 4059 * arm.cc: Likewise. 4060 * compressed_output.cc: Likewise. 4061 * compressed_output.h: Likewise. 4062 * configure: Likewise. 4063 * dwarf_reader.cc: Likewise. 4064 * dynobj.cc: Likewise. 4065 * dynobj.h: Likewise. 4066 * ehframe.cc: Likewise. 4067 * ehframe.h: Likewise. 4068 * errors.cc: Likewise. 4069 * expression.cc: Likewise. 4070 * fileread.cc: Likewise. 4071 * fileread.h: Likewise. 4072 * freebsd.h: Likewise. 4073 * i386.cc: Likewise. 4074 * icf.cc: Likewise. 4075 * incremental.h: Likewise. 4076 * layout.cc: Likewise. 4077 * layout.h: Likewise. 4078 * mapfile.cc: Likewise. 4079 * merge.cc: Likewise. 4080 * merge.h: Likewise. 4081 * object.cc: Likewise. 4082 * object.h: Likewise. 4083 * options.h: Likewise. 4084 * output.cc: Likewise. 4085 * output.h: Likewise. 4086 * parameters.cc: Likewise. 4087 * plugin.cc: Likewise. 4088 * powerpc.cc: Likewise. 4089 * reduced_debug_output.cc: Likewise. 4090 * reduced_debug_output.h: Likewise. 4091 * reloc.cc: Likewise. 4092 * reloc.h: Likewise. 4093 * resolve.cc: Likewise. 4094 * script-sections.cc: Likewise. 4095 * script.cc: Likewise. 4096 * script.h: Likewise. 4097 * sparc.cc: Likewise. 4098 * symtab.cc: Likewise. 4099 * symtab.h: Likewise. 4100 * target-select.cc: Likewise. 4101 * target-select.h: Likewise. 4102 * token.h: Likewise. 4103 * workqueue.cc: Likewise. 4104 * workqueue.h: Likewise. 4105 * x86_64.cc: Likewise. 4106 41072009-12-10 Doug Kwan <dougkwan@google.com> 4108 4109 * arm.cc (attributes.h): New include. 4110 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_. 4111 (Arm_relobj::~Arm_relobj): Delete object pointed by 4112 attributes_section_data_. 4113 (Arm_relobj::attributes_section_data): New method definition. 4114 (Arm_relobj::attributes_section_data_): New data member declaration. 4115 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_. 4116 (Arm_dynobj::~Arm_dynobj): Delete object pointed by 4117 attributes_section_data_. 4118 (Arm_dynobj::attributes_section_data): New method definition. 4119 (Arm_dynobj::attributes_section_data_): New data member declaration. 4120 (Target_arm::Target_arm): Initialize attributes_section_data_. Change 4121 initialization value of may_use_blx_ to false. 4122 (Target_arm::using_thumb2, Target_arm::using_thumb_only, 4123 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use 4124 object attributes to compute results instead of hard-coding. 4125 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order, 4126 Target_arm::get_secondary_compatible_arch, 4127 Target_arm::set_secondary_compatible_arch 4128 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name, 4129 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes): 4130 New method declarations. 4131 (Target_arm::get_aeabi_object_attribute): New method definition. 4132 (Target_arm::attributes_section_data_): New data member declaration. 4133 (read_arm_attributes_section): New template definition. 4134 (Arm_relobj::do_read_symbols): Read attributes section if it exists. 4135 (Arm_dynobj::do_read_symbols): Ditto. 4136 (Target_arm::do_finalize_sections): Merge attributes sections from 4137 input. Check for BLX use after attributes section merging. 4138 Fix __exidx_start and __exidx_end visibility. Create an 4139 .ARM.attributes section if necessary. 4140 (Target_arm::get_secondary_compatible_arch, 4141 Target_arm::set_secondary_compatible_arch, 4142 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name, 4143 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes, 4144 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order): 4145 New method definitions. 4146 41472009-12-09 Ian Lance Taylor <iant@google.com> 4148 4149 * plugin.cc (Plugin::load): Don't cast from void* to a function 4150 pointer. 4151 41522009-12-09 Ian Lance Taylor <iant@google.com> 4153 4154 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version 4155 information fields. 4156 41572009-12-09 H.J. Lu <hongjiu.lu@intel.com> 4158 4159 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES): 4160 Replace two_file_shared_1.so with two_file_shared_2.so. 4161 * testsuite/Makefile.in: Regenerated. 4162 41632009-12-08 Doug Kwan <dougkwan@google.com> 4164 4165 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc. 4166 (HFILES): Add attributes.h and int_encoding.h. 4167 * Makefile.in: Regenerate. 4168 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move 4169 function definitions to int_encoding.cc 4170 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move 4171 prototypes to int_encoding.h 4172 * reduced_debug_output.cc (int_encoding.h): New include. 4173 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move 4174 function definitions to int_encoding.cc 4175 (insert_into_vector, read_from_pointer): Move template definitions to 4176 int_encoding.h 4177 * attributes.cc: New file. 4178 * attributes.h: New file. 4179 * int_encoding.cc: New file. 4180 * int_encoding.h: New file. 4181 41822009-12-07 Rafael Avila de Espindola <espindola@google.com> 4183 4184 PR gold/11055 4185 * incremental-dump.cc (dump_incremental_inputs): New. 4186 (main): Use dump_incremental_inputs. 4187 41882009-12-07 H.J. Lu <hongjiu.lu@intel.com> 4189 4190 PR gold/10893 4191 * i386.cc (Target_i386::Scan::globa): Use is_func instead of 4192 checking elfcpp::STT_FUNC. 4193 (Target_i386::Relocate::relocate): Likewise. 4194 * x86_64.cc (Target_x86_64::Scan::global): Likewise. 4195 4196 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC 4197 symbols from shared libraries into normal FUNC symbols. 4198 4199 * symtab.h (Symbol): Add is_func and use it. 4200 42012009-12-05 Doug Kwan <dougkwan@google.com> 4202 4203 * arm.cc (Target_arm::arm_info): Initialize new fields 4204 attributes_section and attributes_vendor. 4205 * i386.cc (Target_i386::i386_info): Same. 4206 * object.cc (Sized_relobj::do_layout): Skip attribute section. 4207 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new 4208 fields attributes_section and attributes_vendor. 4209 * sparc.cc (Target_sparc::sparc_info): Same. 4210 * target.h (Target::attributes_section, Target::attributes_vendor, 4211 Target::is_attributes_section, Target::attribute_arg_type, 4212 Target::attributes_order): New method definitions. 4213 (Target::Target_info::attributes_section, 4214 Target::Target_info::attributes_vendor): New fields. 4215 (Target::do_attribute_arg_type, Target::do_attributes_order): New 4216 virtual method definitions. 4217 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields 4218 attributes_section and attributes_vendor. 4219 * testsuite/testfile.cc (Target_test::test_target_info): Same. 4220 42212009-12-05 Doug Kwan <dougkwan@google.com> 4222 4223 * arm.cc: Update comments about interworking and stub generation. 4224 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations 4225 considered as non-PIC. 4226 (Arm_relocate_functions::base_abs): Fix formatting. 4227 (Arm_relocate_functions::got_prel): Fix comment. Change interface 4228 of function to use GOT entry address instead of offset. 4229 (Target_arm::Scan::global): Issue an error if a symbol would need a 4230 PLT does not get one because it is untyped. Remove code to create 4231 dynamic symbols for relative branches. 4232 (Target_arm::Relocate::relocate: Use 0 instead of false since function 4233 takes unsigned integer instead of boolean. 4234 42352009-12-05 H.J. Lu <hongjiu.lu@intel.com> 4236 4237 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty. 4238 (two_file_test_LDADD): Likewise. 4239 (common_test_1_LDADD): Likewise. 4240 (exception_test_LDADD) Likewise. 4241 (weak_test_LDADD): Likewise. 4242 (many_sections_test_LDADD): Likewise. 4243 (initpri1_LDADD): Likewise. 4244 (script_test_1_LDADD): Likewise. 4245 (script_test_2_LDADD): Likewise. 4246 (justsyms_LDADD): Likewise. 4247 (binary_test_LDADD): Likewise. 4248 (large_LDADD): Likewise. 4249 * testsuite/Makefile.in: Regenerated. 4250 42512009-12-04 H.J. Lu <hongjiu.lu@intel.com> 4252 4253 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL. 4254 (Symbol_table::override_with_special): Likewise. 4255 (Symbol_table::add_from_object): Likewise. 4256 42572009-12-04 Rafael Avila de Espindola <espindola@google.com> 4258 4259 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data): 4260 Don't set the data_offset twice. 4261 42622009-12-04 Rafael Avila de Espindola <espindola@google.com> 4263 4264 * testsuite/Makefile.in: Regenerate. 4265 42662009-12-03 Doug Kwan <dougkwan@google.com> 4267 4268 * arm.cc: Remove comment about missing .ARM.exidx section symbols. 4269 (Target_arm::do_finalize_sections): Add parameter for symbol table 4270 pointer. Add __exidx_start and __exidx_end symbols as appropriate. 4271 * i386.cc (Target_i386::do_finalize_sections): Add an additional 4272 parameter for symbol table pointer. 4273 * layout.cc (Layout::finalize): Call Target::finalize_sections with 4274 an additional parameter for a pointer to symbol table. 4275 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional 4276 parameter for a symbol table pointer. 4277 * sparc.cc (Target_sparc::do_finalize_sections): Ditto. 4278 * target.h (Target::finalize_sections, Target::do_finalize_sections): 4279 Ditto. 4280 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional 4281 parameter for a symbol table pointer. 4282 42832009-12-03 Rafael Avila de Espindola <espindola@google.com> 4284 4285 * incremental.cc (Incremental_inputs_header) 4286 (Incremental_inputs_header_write, Incremental_inputs_entry) 4287 (Incremental_inputs_entry_write): Move ... 4288 * incremental.h (Incremental_inputs_header) 4289 (Incremental_inputs_header_write, Incremental_inputs_entry) 4290 (Incremental_inputs_entry_write): here. 4291 42922009-12-02 Rafael Avila de Espindola <espindola@google.com> 4293 4294 * incremental.cc (make_sized_incremental_binary): Set the target. 4295 Error if it is incompatible. 4296 * output.h (Output_file): Add filename method. 4297 42982009-12-02 Rafael Avila de Espindola <espindola@google.com> 4299 4300 * incremental.cc (Incremental_inputs_entry): Remove unused argument 4301 from the get_* methods. 4302 43032009-12-02 Rafael Avila de Espindola <espindola@google.com> 4304 4305 * incremental-dump.cc (main): Check that the offeset of a script is 0. 4306 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data): 4307 Write 0 for the data_offset of scripts. 4308 43092009-12-02 Rafael Avila de Espindola <espindola@google.com> 4310 4311 * testsuite/Makefile.am: Add the incremental_test.sh test. 4312 * testsuite/incremental_test.sh: New. 4313 * testsuite/incremental_test_1.c: New. 4314 * testsuite/incremental_test_2.c: New. 4315 43162009-12-01 Rafael Avila de Espindola <espindola@google.com> 4317 4318 * incremental-dump.cc (main): Fix typos. 4319 43202009-11-27 Rafael Avila de Espindola <espindola@google.com> 4321 4322 PR gold/11025 4323 * incremental-dump.cc (main): Use llu to print 64 bit values. 4324 43252009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org> 4326 H.J. Lu <hongjiu.lu@intel.com> 4327 4328 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB) 4329 $(LIBDL). 4330 (incremental_dump_LDADD): Likewise. 4331 * Makefile.in: Regenerated. 4332 43332009-11-25 Doug Kwan <dougkwan@google.com> 4334 4335 Revert: 4336 4337 2009-11-25 Doug Kwan <dougkwan@google.com> 4338 4339 * arm.cc (Target_arm::Target_arm): Move method definition 4340 outside of class definition. Add code to handle 4341 --target1-rel, --target1-abs and --target2= options. 4342 (Target_arm::get_reloc_reloc_type): Change method to be 4343 non-static and const. 4344 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): 4345 New data member declaration. 4346 (Target_arm::Scan::local, Target_arm::Scan::global, 4347 Target_arm::Relocate::relocate, 4348 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): 4349 Adjust call to Target_arm::get_real_reloc_type. 4350 (Target_arm::get_real_reloc_type): Use command line options 4351 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2. 4352 * options.h (--target1-rel, --target1-abs, --target2): New 4353 ARM-only options. 4354 43552009-11-25 Doug Kwan <dougkwan@google.com> 4356 4357 * arm.cc (Target_arm::Target_arm): Move method definition outside of 4358 class definition. Add code to handle --target1-rel, --target1-abs 4359 and --target2= options. 4360 (Target_arm::get_reloc_reloc_type): Change method to be non-static 4361 and const. 4362 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data 4363 member declaration. 4364 (Target_arm::Scan::local, Target_arm::Scan::global, 4365 Target_arm::Relocate::relocate, 4366 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust 4367 call to Target_arm::get_real_reloc_type. 4368 (Target_arm::get_real_reloc_type): Use command line options to 4369 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2. 4370 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only 4371 options. 4372 43732009-11-25 Doug Kwan <dougkwan@google.com> 4374 4375 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition. 4376 (Arm_relocate_functions::thumb_branch_common): New metod declaration. 4377 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix 4378 formatting. 4379 (Arm_relocate_functions::thm_call): Replace body with a call to 4380 Arm_relocate_functions::thumb_branch_common. 4381 (Arm_relocate_functions::thm_jump24, 4382 Arm_relocate_functions::thm_xpc22): New method definitions. 4383 (Arm_relocate_functions::thumb_branch_common): New method definition. 4384 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or 4385 operator. 4386 (Target_arm::Relocate::relocate): Adjust call to thm_call. 4387 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24. 4388 43892009-11-24 Rafael Avila de Espindola <espindola@google.com> 4390 4391 * Makefile.am: Build incremental-dump 4392 * Makefile.in: Regenerate. 4393 * incremental-dump.cc: New. 4394 * incremental.cc (Incremental_inputs_header_data, 4395 Incremental_inputs_entry_data): Move to incremental.h 4396 * incremental.h: (Incremental_inputs_header_data, 4397 Incremental_inputs_entry_data): Move from incremental.cc 4398 43992009-11-24 Rafael Avila de Espindola <espindola@google.com> 4400 4401 * incremental.cc (Incremental_inputs_header, 4402 Incremental_inputs_header_write, Incremental_inputs_entry, 4403 Incremental_inputs_entry_write): Add a typedef with the data type. 4404 44052009-11-24 Rafael Avila de Espindola <espindola@google.com> 4406 4407 * incremental.cc (Incremental_inputs_header, 4408 Incremental_inputs_header_write, Incremental_inputs_entry, 4409 Incremental_inputs_entry_write): Update comment about which 4410 type has the filed descriptions. 4411 44122009-11-15 Doug Kwan <dougkwan@google.com> 4413 4414 * arm.cc (Target_arm::may_use_arm_nop): New method definition. 4415 (Arm_relocate_functions::arm_branch_common): Change method defintion 4416 in class definition to a method declaration and update list of formal 4417 parameters. 4418 (Arm_relocate_functions::plt32, Arm_relocate_functions::call, 4419 Arm_relocation_functions::jump24): Adjust call to 4420 Arm_relocate_functions::arm_branch_common. Update list of formal 4421 parameters. 4422 (Arm_relocate_functions::xpc25): New method definition. 4423 (Arm_relocate_functions::arm_branch_common): Move method defintion 4424 out from class definition. Use stubs for mode-switching and extending 4425 branch ranges. 4426 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols 4427 specially. Change code to enable use of stubs in ARM branches. 4428 44292009-11-10 Doug Kwan <dougkwan@google.com> 4430 4431 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter 4432 in method declaration. 4433 (Target_arm::relocate_stub): New method declaration. 4434 (Target_arm::default_target): Change to return a pointer instead of 4435 a const reference. 4436 (Reloc_stub::stub_type_for_reloc): Adjust for the change in 4437 Target_arm::default_target. 4438 (Arm_Relobj::do_relocate_sections): Remove options paramater in 4439 method definition. 4440 (Target_arm::relocate_section): Adjust view. 4441 (Target_arm::relocate_stub): New method definition. 4442 44432009-11-10 Doug Kwan <dougkwan@google.com> 4444 4445 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid 4446 a format warning. 4447 * incremental.cc (open_incremental_binary): Initialized local 4448 variables to avoid warnings. 4449 * object.cc (make_elf_object): Ditto. 4450 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid 4451 a format warning. 4452 4453009-11-09 H.J. Lu <hongjiu.lu@intel.com> 4454 4455 PR gold/10930 4456 * testsuite/plugin_test.c: Include "config.h". 4457 44582009-11-09 Doug Kwan <dougkwan@google.com> 4459 4460 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant. 4461 (arm_symbol_value): Remove. 4462 (Arm_relocate_functions::arm_branch_common, 4463 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5, 4464 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16, 4465 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32, 4466 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32, 4467 Arm_relocate_functions::call, Arm_relocate_functions::jump24, 4468 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc, 4469 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc, 4470 Arm_relocate_functions::thm_mobw_abs_nc, 4471 Arm_relocate_functions::thm_mov_abs, 4472 Arm_relocate_functions::movw_prel_nc, 4473 Arm_relocate_functions::thm_movt_abs, 4474 Arm_relocate_functions::movt_prel, 4475 Arm_relocate_functions::thm_movw_prel_nc, 4476 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above. 4477 (Target_arm::Relocate::relocate): Only decompose address into two 4478 parts if relocation type uses the thumb-bit and pass the actual 4479 bit instead of a flag indicating that the thumb-bit is used. Adjust 4480 calls to methods in Arm_relocate_functions for this change. 4481 44822009-11-08 Ian Lance Taylor <iant@google.com> 4483 4484 PR 10925 4485 * reloc.cc: Instantiate 4486 Sized_relobj::initialize_input_to_output_maps and 4487 Sized_relobj:free_input_to_output_maps. 4488 44892009-11-06 Ian Lance Taylor <iant@google.com> 4490 4491 PR 10876 4492 * defstd.cc (in_segment): Set only_if_ref true for "end". 4493 44942009-11-06 Doug Kwan <dougkwan@google.com> 4495 4496 * arm.cc (class Reloc_stub): Correct a comment. 4497 (Target_arm::Target_arm): Initialize arm_input_section_map_. 4498 (Target_arm::scan_section_for_stubs): New method declaration. 4499 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section): 4500 Change methods from private to protected. 4501 (Target_arm::do_may_relax): New method definition. 4502 (Target_arm::do_relax, Target_arm::group_sections, 4503 Target_arm::scan_reloc_for_stub, 4504 Target_arm::scan_reloc_section_for_stubs): New method declarations. 4505 (Target_arm::arm_input_section_map_): New data member declaration. 4506 (Target_arm::scan_reloc_for_stub, 4507 Target_arm::scan_reloc_section_for_stubs, 4508 Target_arm::scan_section_for_stubs, Target_arm::group_sections, 4509 Target_arm::do_relax): New method definitions. 4510 45112009-11-06 Mikolaj Zalewski <mikolaj@google.com> 4512 4513 * configure.ac: Check for (struct stat)::st_mtim 4514 * fileread.cc (File_read::get_mtime): Use st_mtim if available. 4515 * config.in: Regenerate. 4516 * configure: Regenerate. 4517 45182009-11-05 Ian Lance Taylor <iant@google.com> 4519 4520 PR 10910 4521 * output.cc (Output_segment::add_output_section): Add missing 4522 return statement. 4523 45242009-11-04 Ian Lance Taylor <iant@google.com> 4525 4526 PR 10880 4527 * object.h (class Object): Add is_needed and set_is_needed 4528 methods. Add is_needed_ field. Make bool fields into bitfields. 4529 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is 4530 defined in a dynamic object and referenced by a regular object, 4531 set is_needed for the dynamic object. 4532 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED 4533 if the file is marked with as_needed and it is not needed. 4534 45352009-11-04 Ian Lance Taylor <iant@google.com> 4536 4537 PR 10887 4538 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic 4539 tags if data is discarded by linker script. 4540 * i386.cc (Target_i386::do_finalize_sections): Likewise. 4541 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise. 4542 * sparc.cc (Target_sparc::do_finalize_sections): Likewise. 4543 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise. 4544 45452009-11-04 Ian Lance Taylor <iant@google.com> 4546 4547 * layout.cc (Layout::get_output_section): Add is_interp and 4548 is_dynamic_linker_section parameters. Change all callers. 4549 (Layout::choose_output_section): Likewise. 4550 (Layout::make_output_section): Likewise. 4551 (Layout::add_output_section_data): Add is_dynamic_linker_section 4552 parameter. Change all callers. 4553 * layout.h (class Layout): Update declarations. 4554 * output.h (class Output_section): Add is_interp, set_is_interp, 4555 is_dynamic_linker_section, set_is_dynamic_linker_section methods. 4556 Add is_interp_, is_dynamic_linker_section_ fields. Change 4557 generate_code_fills_at_write_ to a bitfield. 4558 * output.cc (Output_section::Output_sections): Initialize new 4559 fields. 4560 (Output_segment::add_output_section): Add do_sort parameter. 4561 Change all callers. 4562 45632009-11-03 Ian Lance Taylor <iant@google.com> 4564 4565 PR 10860 4566 * options.h (class General_options): Add --warn-common. 4567 * resolve.cc (Symbol_table::resolve): Handle --warn-common when 4568 merging two common symbols. 4569 (Symbol_table::should_override): Handle --warn-common when merging 4570 a common symbol with a defined symbol. Use report_resolve_problem 4571 for multiple definitions. 4572 (Symbol_table::report_resolve_problem): New function. 4573 * symtab.h (class Symbol_table): Declare report_resolve_problem. 4574 45752009-11-03 Doug Kwan <dougkwan@google.com> 4576 4577 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and 4578 stub_factory_. 4579 (Target_arm::stub_factory): New method definition. 4580 (Target_arm::new_arm_input_section, 4581 Target_arm::find_arm_input_section, Target_arm::new_stub_table, 4582 Target_arm::reloc_uses_thumb_bit): New method declarations. 4583 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map): 4584 New type definitions. 4585 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data 4586 member declarations. 4587 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section, 4588 Target_arm::find_arm_input_section, Target_arm::new_stub_table): 4589 New method definitions. 4590 45912009-11-03 Ian Lance Taylor <iant@google.com> 4592 4593 * options.h (class General_options): Add --warn_constructors. 4594 45952009-11-03 Ian Lance Taylor <iant@google.com> 4596 4597 PR 10893 4598 * defstd.cc (in_section): Add entries for __rel_iplt_start, 4599 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack. 4600 46012009-11-03 Ian Lance Taylor <iant@google.com> 4602 4603 PR 10895 4604 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and 4605 --msgid-bugs-address. 4606 (install-pdf): New target. 4607 (install-data_yes): Look up one directory to find mkinstalldirs. 4608 46092009-11-03 H.J. Lu <hongjiu.lu@intel.com> 4610 4611 * po/Make-in (.po.gmo): Don't generate .gmo files in source 4612 tree. 4613 46142009-10-30 Doug Kwan <dougkwan@google.com> 4615 4616 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in. 4617 46182009-10-30 Doug Kwan <dougkwan@google.com> 4619 4620 * arm.cc (Stub_addend_reader): New struct template definition 4621 and partial specializations. 4622 (Stub_addend_reader::operator()): New method definition for a 4623 partially specialized template. 4624 46252009-10-30 Doug Kwan <dougkwan@google.com> 4626 4627 * arm.cc (Arm_relobj::processor_specific_flags): New method 4628 definition. 4629 (Arm_relobj::do_read_symbols): New method declaration. 4630 (Arm_relobj::processor_specific_flags_): New data member declaration. 4631 (Arm_dynobj): New class definition. 4632 (Target_arm::do_finalize_sections): Add input_objects parameter. 4633 (Target_arm::do_adjust_elf_header): New method declaration. 4634 (Target_arm::are_eabi_versions_compatible, 4635 (Target_arm::merge_processor_specific_flags): New method declaration. 4636 (Target_arm::do_make_elf_object): New overloaded method definitions 4637 and declaration. 4638 (Arm_relobj::do_read_symbols): New method definition. 4639 (Arm_dynobj::do_read_symbols): Ditto. 4640 (Target_arm::do_finalize_sections): Add input_objects parameters. 4641 Merge processor-specific flags from all input objects. 4642 (Target_arm::are_eabi_versions_compatible, 4643 Target_arm::merge_processor_specific_flags, 4644 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object): 4645 New method definitions. 4646 * i386.cc (Target_i386::do_finalize_sections): Add unnamed 4647 Input_objects pointer type parameter. 4648 * layout.cc (Layout::finalize): Pass input objects to target's. 4649 finalize_sections function. 4650 * output.cc (Output_file_header::do_sized_write): Set ELF file 4651 header's processor-specific flags. 4652 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed 4653 Input_objects pointer type parameter. 4654 * sparc.cc (Target_sparc::do_finalize_sections): Same. 4655 * target.h (Input_objects): New forward class declaration. 4656 (Target::processor_specific_flags, 4657 Target::are_processor_specific_flags_sect): New method definitions. 4658 (Target::finalize_sections): Add input_objects parameter. 4659 (Target::Target): Initialize processor_specific_flags_ and 4660 are_processor_specific_flags_set_. 4661 (Target::do_finalize_sections): Add unnamed Input_objects pointer type 4662 parameter. 4663 (Target::set_processor_specific_flags): New method definition. 4664 (Target::processor_specific_flags_, 4665 Target::are_processor_specific_flags_set_): New data member 4666 declarations. 4667 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed 4668 Input_objects pointer type parameter. 4669 46702009-10-30 Doug Kwan <dougkwan@google.com> 4671 4672 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr. 4673 46742009-10-28 Ian Lance Taylor <iant@google.com> 4675 4676 * object.h (class Relobj): Drop options parameter from 4677 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs, 4678 do_scan_relocs, do_relocate. Change all callers. 4679 (class Sized_relobj): Drop options parameters from 4680 do_gc_process_relocs, do_scan_relocs, do_relocate, 4681 do_relocate_sections, relocate_sections, emit_relocs_scan, 4682 emit_relocs_scan_reltype. Change all callers. 4683 (struct Relocate_info): Remove options field and all references to 4684 it. 4685 * reloc.h (class Read_relocs): Remove options constructor 4686 parameter and options_ field. Change all callers. 4687 (class Gc_process_relocs, class Scan_relocs): Likewise. 4688 (class Relocate_task): Likewise. 4689 * target-reloc.h (scan_relocs): Remove options parameter. Change 4690 all callers. 4691 (scan_relocatable_relocs): Likewise. 4692 * target.h (class Sized_target): Remove options parameter from 4693 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change 4694 all callers. 4695 * gc.h (gc_process_relocs): Remove options parameter. Change all 4696 callers. 4697 * arm.cc: Update functions to remove options parameters. 4698 * i386.cc: Likewise. 4699 * powerpc.cc: Likewise. 4700 * sparc.cc: Likewise. 4701 * x86_64.cc: Likewise. 4702 * testsuite/testfile.cc: Likewise. 4703 47042009-10-28 Doug Kwan <dougkwan@google.com> 4705 4706 * arm.cc (Arm_relobj): New class definition. 4707 (Arm_relobj::scan_sections_for_stubs, 4708 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections): 4709 New method definitions. 4710 47112009-10-28 Cary Coutant <ccoutant@google.com> 4712 4713 * plugin.h (Plugin::Plugin): Initialize cleanup_done_. 4714 (Plugin::cleanup_done_): New member. 4715 (Plugin_manager::Plugin_manager): Remove cleanup_done_. 4716 (Plugin_manager::cleanup_done_): Remove. 4717 (Plugin_manager::add_input_file): Edit error message. 4718 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_. 4719 (Plugin_manager::cleanup): Remove use of cleanup_done_. 4720 47212009-10-27 Mikolaj Zalewski <mikolajz@google.com> 4722 4723 * fileread.cc: (File_read::View::~View): Use the new 4724 data_ownership_ filed. 4725 (File_read::~File_read): Dispose the new whole_file_view_. 4726 (File_read::open): Mmap the whole file if needed. 4727 (File_read::open): Use whole_file_view_ instead of contents_. 4728 (File_read::find_view): Use whole_file_view_ if applicable. 4729 (File_read::do_read): Use whole_file_view_ instead of contents_. 4730 (File_read::make_view): Use whole_file_view_ instead of contents_, 4731 update File_read::View::View call. 4732 (File_read::find_or_make_view): Update File_read::View::View 4733 call. 4734 * fileread.h: (File_read::File_read): Initialize whole_file_view_, 4735 remove contents_ 4736 (File_read::View::Data_ownership): New enum. 4737 (File_read::View::View): Replace bool mapped_ with Data_ownership 4738 argument. 4739 (File_read::View::mapped_): Remove (replaced by data_ownership_). 4740 (File_read::View::data_ownership_): New field. 4741 (File_read::contents_): Remove (replaced by whole_file_view_). 4742 (File_read::whole_file_view_): New field. 4743 * options.h (class General_options): Add --keep-files-mapped. 4744 47452009-10-27 Cary Coutant <ccoutant@google.com> 4746 4747 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary. 4748 * testsuite/Makefile.am (plugin_test_5): New test case. 4749 * testsuite/Makefile.in: Regenerate. 4750 47512009-10-25 Doug Kwan <dougkwan@google.com> 4752 4753 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change 4754 from private to protected to allow access by child class. 4755 (Sized_relobj::do_relocate_sections): New method declaration. 4756 (Sized_relobj::relocate_sections): Virtualize. 4757 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from 4758 Sized_relobj::relocate_sections. Instantiate template explicitly 4759 for different target sizes and endianity. 4760 47612009-10-24 Doug Kwan <dougkwan@google.com> 4762 4763 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations. 4764 (Arm_input_section::as_arm_input_section): New method. 4765 (Arm_output_section): New class definition. 4766 (Arm_output_section::create_stub_group, 4767 Arm_output_section::group_sections): New method definitions. 4768 47692009-10-22 Doug Kwan <dougkwan@google.com> 4770 4771 * arm.cc (Arm_input_section): New class definition. 4772 (Arm_input_section::init, Arm_input_section:do_write, 4773 Arm_input_section::set_final_data_size, 4774 Arm_input_section::do_reset_address_and_file_offset): New method 4775 definitions. 4776 47772009-10-21 Doug Kwan <dougkwan@google.com> 4778 4779 * arm.cc (Stub_table, Arm_input_section): New forward class 4780 declarations. 4781 (Stub_table): New class defintion. 4782 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs 4783 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write): 4784 New method definition. 4785 47862009-10-21 Doug Kwan <dougkwan@google.com> 4787 4788 * arm.cc: Update copyright comments. 4789 (Target_arm): New forward class template declaration. 4790 (Arm_address): New type. 4791 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET, 4792 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET, 4793 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New 4794 constants. 4795 (Insn_template): Same. 4796 (DEF_STUBS): New macro. 4797 (Stub_type): New enum type. 4798 (Stub_template): New class definition. 4799 (Stub): Same. 4800 (Reloc_stub): Same. 4801 (Stub_factory): Same. 4802 (Target_arm::Target_arm): Initialize may_use_blx_ and 4803 should_force_pic_veneer_. 4804 (Target_arm::may_use_blx, Target_arm::set_may_use_blx, 4805 Target_arm::should_force_pic_veneer, 4806 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2, 4807 Target_arm::using_thumb_only, Target_arm:;default_target): New 4808 method defintions. 4809 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_): 4810 New data member declarations. 4811 (Insn_template::size, Insn_template::alignment): New method defintions. 4812 (Stub_template::Stub_template): New method definition. 4813 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc, 4814 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same. 4815 (Stub_factory::Stub_factory): New method definition. 4816 * gold.h (string_hash): New template. 4817 * output.h (Input_section_specifier::hash_value): Use 4818 gold::string_hash. 4819 (Input_section_specifier::string_hash): Remove. 4820 * stringpool.cc (Stringpool_template::string_hash): Use 4821 gold::string_hash. 4822 48232009-10-20 Doug Kwan <dougkwan@google.com> 4824 4825 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section 4826 symbols of relaxed input sections. 4827 * output.h (Output_section::find_relaxed_input_section): Make 4828 method public. 4829 48302009-10-16 Doug Kwan <dougkwan@google.com> 4831 4832 * dynobj.cc (Versions::Versions): Initialize version_script_. 4833 Only insert base version symbol definition for a shared object 4834 if version script defines any version versions. 4835 (Versions::define_base_version): New method definition. 4836 (Versions::add_def): Check that base version is not needed. 4837 (Versions::add_need): Define base version lazily. 4838 * dynobj.h (Versions::define_base_version): New method declaration. 4839 (Versions::needs_base_version_): New data member declaration. 4840 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh 4841 (check_DATA): Add no_version_test.stdout. 4842 (libno_version_test.so, no_version_test.o no_version_test.stdout): 4843 New make rules. 4844 * testsuite/Makefile.in: Regenerate. 4845 * testsuite/no_version_test.c: New file. 4846 * testsuite/no_version_test.sh: Ditto. 4847 48482009-10-16 Doug Kwan <dougkwan@google.com> 4849 4850 * expression.cc (class Segment_start_expression): New class definition. 4851 (Segment_start_expression::value): New method definition. 4852 (script_exp_function_segment_start): Return a new 4853 Segment_start_expression. 4854 * gold/script-c.h (script_saw_segment_start_expression): New function 4855 prototype. 4856 * script-sections.cc (Script_sections::Script_sections): Initialize 4857 SAW_SEGMENT_START_EXPRESSION_ to false. 4858 (Script_sections::set_section_addresses): Use -Ttext, -Tdata 4859 and -Tbbs options to specify section addresses if given in 4860 command line and no SEGMENT_START expression is seen in a script. 4861 * script-sections.h (Script_sections::saw_segment_start_expression, 4862 Script_sections::set_saw_segment_start_expression): New method 4863 definition. 4864 (Script_sections::saw_segment_start_expression_): New data member 4865 declaration. 4866 * script.cc (script_saw_segment_start_expression): New function. 4867 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression. 4868 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh, 4869 script_test_7.sh and script_test_8.sh. 4870 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and 4871 script_test_8.stdout. 4872 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8. 4873 (script_test_6, script_test_6.stdout, script_test_7, 4874 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules. 4875 * Makefile.in: Regenerate. 4876 * testsuite/script_test_6.sh: New file. 4877 * testsuite/script_test_6.t: Same. 4878 * testsuite/script_test_7.sh: Same. 4879 * testsuite/script_test_7.t: Same. 4880 * testsuite/script_test_8.sh: Same. 4881 48822009-10-16 Doug Kwan <dougkwan@google.com> 4883 4884 * output.cc (Output_segment::set_section_list_address): Cast 4885 expressions to unsigned long long type to avoid format warnings. 4886 48872009-10-15 Ian Lance Taylor <iant@google.com> 4888 4889 * script.cc (Script_options::add_symbol_assignment): Always add a 4890 dot assignment to script_sections_. 4891 * script-sections.cc (Script_sections::add_dot_assignment): 4892 Initialize if necessary. 4893 4894 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see 4895 program headers with no load segment if there is a linker script. 4896 4897 * layout.cc (Layout::set_segment_offsets): Align the file offset 4898 to the segment aligment for -N or -n with no load segment. 4899 * output.cc (Output_segment::add_output_section): Don't crash if 4900 the first section is a TLS section. 4901 (Output_segment::set_section_list_addresses): Print an error 4902 message if the address moves backward in a linker script. 4903 * script-sections.cc 4904 (Output_section_element_input::set_section_addresses): Don't 4905 increase *dot_value for a SHF_TLS/SHT_NOBITS section. 4906 (Orphan_output_section::set_section_addresses): Likewise. 4907 49082009-10-15 Doug Kwan <dougkwan@google.com> 4909 4910 * layout.cc (Layout::finish_dynamic_section): Generate tags 4911 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ, 4912 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is 4913 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS. 4914 49152009-10-14 Ian Lance Taylor <iant@google.com> 4916 4917 * object.h (class Relocate_info): Add reloc_shdr and data_shdr 4918 fields. 4919 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and 4920 data_shdr fields of relinfo. 4921 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field. 4922 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For 4923 R_386_TLS_LDO_32, adjust based on section flags. 4924 (Target_i386::Relocate::fix_up_ldo): Remove. 4925 49262009-10-13 Ian Lance Taylor <iant@google.com> 4927 4928 Add support for -pie. 4929 * options.h (class General_options): Add -pie and 4930 --pic-executable. 4931 (General_options::output_is_position_independent): Test -pie. 4932 (General_options::output_is_executable): Return true if not shared 4933 and not relocatable. 4934 (General_options::output_is_pie): Remove. 4935 * options.cc (General_options::finalize): Reject incompatible uses 4936 of -pie. 4937 * gold.cc (queue_middle_tasks): A -pie link is not static. 4938 * symtab.h (Symbol::needs_plt_entry): Return false if -pie. 4939 * symtab.cc (Symbol::final_value_is_known): Return false if 4940 output_is_position_independent. 4941 * layout.cc (Layout::set_segment_offsets): Start at address 0 if 4942 output_is_position_independent. 4943 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if 4944 output_is_position_independent. 4945 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if 4946 output_is_position_independent. 4947 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and 4948 two_file_pie_test. 4949 (basic_pie_test.o, basic_pie_test): New targets. 4950 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets. 4951 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets. 4952 (two_file_pie_test): New target. 4953 * testsuite/Makefile.in: Rebuild. 4954 * README: Remove note saying that -pie is not supported. 4955 49562009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> 4957 4958 * options.h (class General_options): Add -init and -fini. 4959 * layout.cc (Layout::finish_dynamic_section): Emit 4960 given init and fini functions. 4961 49622009-10-13 Sriraman Tallam <tmsriram@google.com> 4963 4964 * gc.h (gc_process_relocs): Check if icf is enabled using new 4965 function. 4966 * gold.cc (queue_initial_tasks): Likewise. 4967 (queue_middle_tasks): Likewise. 4968 * object.cc (do_layout): Likewise. 4969 * symtab.cc (is_section_folded): Likewise. 4970 * main.cc (main): Likewise. 4971 * reloc.cc (Read_relocs::run): Likewise. 4972 (Sized_relobj::do_scan_relocs): Likewise. 4973 * icf.cc (is_function_ctor_or_dtor): New function. 4974 (Icf::find_identical_sections): Check if function is ctor or dtor when 4975 safe icf is chosen. 4976 * options.h (General_options::icf): Change option to be an enum. 4977 (Icf_status): New enum. 4978 (icf_enabled): New method. 4979 (icf_safe_folding): New method. 4980 (set_icf_status): New method. 4981 (icf_status_): New variable. 4982 * (options.cc) (General_options::finalize): Set icf_status_. 4983 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify 4984 icf_test and icf_keep_unique_test to use the --icf enum flag. 4985 * testsuite/icf_safe_test.sh: New file. 4986 * testsuite/icf_safe_test.cc: New file. 4987 49882009-10-12 Sriraman Tallam <tmsriram@google.com> 4989 4990 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove 4991 includes to gc.h and icf.h. 4992 * arm.cc: Include gc.h. 4993 * gold.cc: Likewise. 4994 * i386.cc: Likewise. 4995 * powerpc.cc: Likewise. 4996 * sparc.cc: Likewise. 4997 * x86_64.cc: Likewise. 4998 * gc.h: Include icf.h. 4999 50002009-10-11 Ian Lance Taylor <iant@google.com> 5001 5002 * plugin.cc: Include "gold.h" before other header files. 5003 50042009-10-10 Chris Demetriou <cgd@google.com> 5005 5006 * options.h (Input_file_argument::Input_file_type): New enum. 5007 (Input_file_argument::is_lib_): Replace with... 5008 (Input_file_argument::type_): New member. 5009 (Input_file_argument::Input_file_argument): Take Input_file_type 5010 'type' rather than boolean 'is_lib' as second argument. 5011 (Input_file_argument::is_lib): Use type_. 5012 (Input_file_argument::is_searched_file): New function. 5013 (Input_file_argument::may_need_search): Handle is_searched_file. 5014 * options.cc (General_options::parse_library): Support -l:filename. 5015 (General_options::parse_just_symbols): Update for Input_file_argument 5016 changes. 5017 (Command_line::process): Likewise. 5018 * archive.cc (Archive::get_file_and_offset): Likewise. 5019 * plugin.cc (Plugin_manager::release_input_file): Likewise. 5020 * script.cc (read_script_file, script_add_file): Likewise. 5021 * fileread.cc (Input_file::Input_file): Likewise. 5022 (Input_file::will_search_for): Handle is_searched_file. 5023 (Input_file::open): Likewise. 5024 * readsyms.cc (Read_symbols::get_name): Likewise. 5025 * testsuite/Makefile.am (searched_file_test): New test. 5026 * testsuite/Makefile.in: Regenerate. 5027 * testsuite/searched_file_test.cc: New file. 5028 * testsuite/searched_file_test_lib.cc: New file. 5029 50302009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com> 5031 Ian Lance Taylor <iant@google.com> 5032 5033 * descriptor.cc: Include <cstdio> and "binary-io.h". 5034 (Descriptors::open): Open the files in binary mode always. 5035 * script.cc (Lex::get_token): Treat \r as whitespace. 5036 50372009-10-09 Ian Lance Taylor <iant@google.com> 5038 5039 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0. 5040 50412009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com> 5042 Ian Lance Taylor <iant@google.com> 5043 5044 * configure.ac: Check for readv function also. 5045 * fileread.cc (readv): Define if not HAVE_READV. 5046 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv 5047 does not exist. 5048 * config.in: Regenerate. 5049 * configure: Regenerate. 5050 50512009-10-09 Doug Kwan <dougkwan@google.com> 5052 5053 * layout.cc (Layout::make_output_section): Call target hook to make 5054 ordinary output section. 5055 (Layout::finalize): Adjust parameter list of call the 5056 Target::may_relax(). 5057 * layout.h (class Layout::section_list): New method. 5058 * merge.h (Output_merge_base::entsize): Change visibility to public. 5059 (Output_merge_base::is_string, Output_merge_base::do_is_string): 5060 New methods. 5061 (Output_merge_string::do_is_string): New method. 5062 * object.cc (Sized_relobj::do_setup): renamed from 5063 Sized_relobj::set_up. 5064 * object.h (Sized_relobj::adjust_shndx, 5065 Sized_relobj::initializ_input_to_output_maps, 5066 Sized_relobj::free_input_to_output_maps): Change visibilities to 5067 protected. 5068 (Sized_relobj::setup): Virtualize. 5069 (Sized_relobj::do_setup): New method declaration. 5070 (Sized_relobj::invalidate_section_offset, 5071 Sized_relobj::do_invalidate_section_offset): New method decfinitions. 5072 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods. 5073 * options.cc (parse_int): New function. 5074 * options.h (parse_int): New declaration. 5075 (DEFINE_int): New macro. 5076 (stub_group_size): New option. 5077 * output.cc (Output_section::Output_section): Initialize memebers 5078 merge_section_map_, merge_section_by_properties_map_, 5079 relaxed_input_section_map_, is_relaxed_input_section_map_valid_. 5080 (Output_section::add_input_section): Handled deferred code-fill 5081 generation and remove an old comment. 5082 (Output_section::add_relaxed_input_section): New method definition. 5083 (Output_section::add_merge_input_section): Use merge section by 5084 properties map to speed to search. Update merge section maps 5085 as appropriate. 5086 (Output_section::build_relaxation_map): New method definition. 5087 (Output_section::convert_input_sections_in_list_to_relaxed_sections): 5088 Same. 5089 (Output_section::relax_input_section): Renamed to 5090 Output_section::convert_input_sections_to_relaxed_sections and change 5091 interface to take a vector of pointers to relaxed sections. 5092 (Output_section::find_merge_section, 5093 Output_section::find_relaxed_input_section): New method definitions. 5094 (Output_section::is_input_address_mapped, 5095 Output_section::output_offset, Output_section::output_address): 5096 Use output section data maps to speed up searching. 5097 (Output_section::find_starting_output_address): Add comments. 5098 (Output_section::do_write, 5099 Output_section::write_to_postprocessing_buffer): Do code-fill 5100 generation as appropriate. 5101 (Output_section::get_input_sections): Invalidate relaxed input section 5102 map. 5103 (Output_section::restore_states): Adjust type of checkpoint . 5104 Invalidate relaxed input section map. 5105 * output.h (Output_merge_base): New class declaration. 5106 (Input_section_specifier): New class defintion. 5107 (class Output_relaxed_input_section) Change base class to 5108 Output_section_data_build. 5109 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust 5110 base class initializer. 5111 (Output_section::add_relaxed_input_section): New method declaration. 5112 (Output_section::Input_section): Change visibility to protected. 5113 (Output_section::Input_section::relobj, 5114 Output_section::Input_section::shndx): Handle relaxed input sections. 5115 Output_section::input_sections) Change visibility to protected. Also 5116 define overload to return a non-const pointer. 5117 (Output_section::Merge_section_properties): New class defintion. 5118 (Output_section::Merge_section_by_properties_map, 5119 Output_section::Output_section_data_by_input_section_map, 5120 Output_section::Relaxation_map): New types. 5121 (Output_section::relax_input_section): Rename method to 5122 Output_section::convert_input_sections_to_relaxed_sections and change 5123 interface to take a vector of relaxed section pointers. 5124 (Output_section::find_merge_section, 5125 Output_section::find_relaxed_input_section, 5126 Output_section::build_relaxation_map, 5127 Output_section::convert_input_sections_in_list_to_relaxed_sections): 5128 New method declarations. 5129 (Output_section::merge_section_map_ 5130 Output_section::merge_section_by_properties_map_, 5131 Output_section::relaxed_input_section_map_, 5132 Output_section::is_relaxed_input_section_map_valid_, 5133 Output_section::generate_code_fills_at_write_): New data members. 5134 * script-sections.cc 5135 (Output_section_element_input::set_section_addresses): Call 5136 current_data_size and addralign methods of relaxed input sections. 5137 (Orphan_output_section::set_section_addresses): Call current_data_size 5138 and addralign methods of relaxed input sections. 5139 * symtab.cc (Symbol_table::compute_final_value): Extract template 5140 from the body of Symbol_table::sized_finalize_symbol. 5141 (Symbol_table::sized_finalized_symbol): Call 5142 Symbol_table::compute_final_value. 5143 * symtab.h (Symbol_table::Compute_final_value_status): New enum type. 5144 (Symbol_table::compute_final_value): New templated method declaration. 5145 * target.cc (Target::do_make_output_section): New method defintion. 5146 * target.h (Target::make_output_section): New method declaration. 5147 (Target::relax): Add more parameters for input objects, symbol table 5148 and layout. Adjust call to do_relax. 5149 (Target::do_make_output_section): New method declaration. 5150 (Target::do_relax): Add parameters for input objects, symbol table 5151 and layout. 5152 51532009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com> 5154 5155 * pread.c: Include stdio.h. 5156 51572009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com> 5158 5159 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not 5160 defined. 5161 51622009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com> 5163 5164 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info): 5165 Change read_shndx type to unsigned int. 5166 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned 5167 int. 5168 (Sized_dwarf_line_info::read_line_mappings): Likewise. 5169 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info): 5170 Change read_shndx type to unsigned int. 5171 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned 5172 int. 5173 (Sized_dwarf_line_info::read_line_mappings): Likewise. 5174 * layout.cc (Layout::create_symtab_sections): Cast the result of 5175 local_symcount * symsize to off_t in the gold_assert. 5176 51772009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com> 5178 5179 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for 5180 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16, 5181 R_ARM_BASE_ABS. 5182 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter. 5183 (Arm_relocate_functions::thm_abs5): New function. 5184 (Arm_relocate_functions::abs12): New function. 5185 (Arm_relocate_functions::abs16): New function. 5186 (Arm_relocate_functions::base_abs): New function. 5187 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI. 5188 (Scan::local): Remove special handling of R_ARM_ABS8. Handle 5189 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and 5190 R_ARM_BASE_ABS. 5191 (Scan::global): Likewise. 5192 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16, 5193 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS. 5194 (Relocatable_size_for_reloc::get_size_for_reloc): Handle 5195 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and 5196 R_ARM_BASE_ABS. 5197 51982009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com> 5199 5200 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function. 5201 (Arm_relocate_functions::movt_prel): New function. 5202 (Arm_relocate_functions::thm_movw_prel_nc): New function. 5203 (Arm_relocate_functions::thm_movt_prel): New function. 5204 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL, 5205 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL. 5206 (Scan::global, Relocate::relocate): Likewise. 5207 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise. 5208 52092009-10-09 Mikolaj Zalewski <mikolajz@google.com> 5210 5211 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to 5212 Incremental_checker. 5213 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to 5214 unsigned int. 5215 (class Incremental_inputs_header): New class. 5216 (Incremental_inputs_header_writer): Edit comment. 5217 (Incremental_inputs_entry): New class. 5218 (Incremental_inputs_entry_writer): Edit comment. 5219 (Sized_incremental_binary::do_find_incremental_inputs_section): 5220 Add *strtab_shndx parameter, fill it. 5221 (Sized_incremental_binary::do_check_inputs): New method. 5222 (Incremental_checker::can_incrementally_link_output_file): Use 5223 Sized_incremental_binary::check_inputs. 5224 (Incremental_inputs::report_command_line): Save command line in 5225 command_line_. 5226 * incremental.h: 5227 (Incremental_binary::find_incremental_inputs_section): New 5228 method. 5229 (Incremental_binary::do_find_incremental_inputs_section): Add 5230 strtab_shndx parameter. 5231 (Incremental_binary::do_check_inputs): New pure virtual method. 5232 (Sized_incremental_binary::do_check_inputs): Declare. 5233 (Incremental_checker::Incremental_checker): Add incremental_inputs 5234 parameter, use it to initialize incremental_inputs_. 5235 (Incremental_checker::incremental_inputs_): New field. 5236 (Incremental_checker::command_line): New method. 5237 (Incremental_checker::inputs): New method. 5238 (Incremental_checker::command_line_): New field. 5239 52402009-10-09 Mikolaj Zalewski <mikolajz@google.com> 5241 5242 * incremental.cc: Include <cstdarg> and "target-select.h". 5243 (vexplain_no_incremental): New function. 5244 (explain_no_incremental): New function. 5245 (Incremental_binary::error): New method. 5246 (Sized_incremental_binary::do_find_incremental_inputs_section): New 5247 method. 5248 (make_sized_incremental_binary): New function. 5249 (open_incremental_binary): New function. 5250 (can_incrementally_link_file): Add checks if output is ELF and has 5251 inputs section. 5252 * incremental.h: Include "elfcpp_file.h" and "output.h". 5253 (Incremental_binary): New class. 5254 (Sized_incremental_binary): New class. 5255 (open_incremental_binary): Declare. 5256 * object.cc (is_elf_object): Use 5257 elfcpp::Elf_recognizer::is_elf_file. 5258 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header. 5259 * output.h (Output_file::filesize): New method. 5260 52612009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com> 5262 5263 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend): 5264 New function. 5265 (Arm_relocate_functions::insert_val_arm_movw_movt): New function. 5266 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New 5267 function. 5268 (Arm_relocate_functions::insert_val_thumb_movw_movt): New 5269 function. 5270 (Arm_relocate_functions::movw_abs_nc): New function. 5271 (Arm_relocate_functions::movt_abs): New function. 5272 (Arm_relocate_functions::thm_movw_abs_nc): New function. 5273 (Arm_relocate_functions::thm_movt_abs): New function. 5274 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS, 5275 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS. 5276 (Scan::global): Likewise. 5277 (Relocate::relocate): Likewise. 5278 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise. 5279 52802009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com> 5281 5282 * arm.cc (Arm_relocate_functions::got_prel) New function. 5283 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL. 5284 (Relocate::relocate): Likewise. 5285 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise. 5286 52872009-10-06 Ian Lance Taylor <iant@google.com> 5288 5289 * options.h (class General_options): Define 5290 split_stack_adjust_size parameter. 5291 * object.h (class Object): Add uses_split_stack_ and 5292 has_no_split_stack_ fields. Add uses_split_stack and 5293 has_no_split_stack accessor functions. Declare 5294 handle_split_stack_section. 5295 (class Reloc_symbol_changes): Define. 5296 (class Sized_relobj): Define Function_offsets. Declare 5297 split_stack_adjust, split_stack_adjust_reltype, and 5298 find_functions. 5299 * object.cc (Object::handle_split_stack_section): New function. 5300 (Sized_relobj::do_layout): Call handle_split_stack_section. 5301 * dynobj.cc (Sized_dynobj::do_layout): Call 5302 handle_split_stack_section. 5303 * reloc.cc (Sized_relobj::relocate_sections): Call 5304 split_stack_adjust for executable sections in split_stack 5305 objects. Pass reloc_map to relocate_section. 5306 (Sized_relobj::split_stack_adjust): New function. 5307 (Sized_relobj::split_stack_adjust_reltype): New function. 5308 (Sized_relobj::find_functions): New function. 5309 * target-reloc.h: Include "object.h". 5310 (relocate_section): Add reloc_symbol_changes parameter. Change 5311 all callers. 5312 * target.h (class Target): Add calls_non_split method. Declare 5313 do_calls_non_split virtual method. Declare match_view and 5314 set_view_to_nop. 5315 * target.cc: Include "elfcpp.h". 5316 (Target::do_calls_non_split): New function. 5317 (Target::match_view): New function. 5318 (Target::set_view_to_nop): New function. 5319 * gold.cc (queue_middle_tasks): Give an error if mixing 5320 split-stack and non-split-stack objects with -r. 5321 * i386.cc (Target_i386::relocate_section): Add 5322 reloc_symbol_changes parameter. 5323 (Target_i386::do_calls_non_split): New function. 5324 * x86_64.cc (Target_x86_64::relocate_section): Add 5325 reloc_symbol_changes parameter. 5326 (Target_x86_64::do_calls_non_split): New function. 5327 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes 5328 parameter. 5329 * powerpc.cc (Target_powerpc::relocate_section): Add 5330 reloc_symbol_changes parameter. 5331 * sparc.cc (Target_sparc::relocate_section): Add 5332 reloc_symbol_changes parameter. 5333 * configure.ac: Call AM_CONDITIONAL for the default target. 5334 * configure: Rebuild. 5335 * testsuite/Makefile.am (TEST_AS): New variable. 5336 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh. 5337 (check_DATA): Add split_i386 and split_x86_64 files. 5338 (SPLIT_DEFSYMS): Define. 5339 (split_i386_[1234n].o): New targets. 5340 (split_i386_[124]): New targets. 5341 (split_i386_[1234r].stdout): New targets. 5342 (split_x86_64_[1234n].o): New targets. 5343 (split_x86_64_[124]): New targets. 5344 (split_x86_64_[1234r].stdout): New targets. 5345 (MOSTLYCLEANFILES): Add new executables. 5346 * testsuite/split_i386.sh: New file. 5347 * testsuite/split_x86_64.sh: New file. 5348 * testsuite/split_i386_1.s: New file. 5349 * testsuite/split_i386_2.s: New file. 5350 * testsuite/split_i386_3.s: New file. 5351 * testsuite/split_i386_4.s: New file. 5352 * testsuite/split_i386_n.s: New file. 5353 * testsuite/split_x86_64_1.s: New file. 5354 * testsuite/split_x86_64_2.s: New file. 5355 * testsuite/split_x86_64_3.s: New file. 5356 * testsuite/split_x86_64_4.s: New file. 5357 * testsuite/split_x86_64_n.s: New file. 5358 * testsuite/testfile.cc (Target_test): Update relocation_section 5359 function. 5360 * testsuite/Makefile.in: Rebuild. 5361 53622009-10-06 Ian Lance Taylor <iant@google.com> 5363 5364 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field. 5365 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before 5366 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When 5367 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push 5368 the address on ldo_addrs_. 5369 (Target_i386::Relocate::fix_up_ldo): New function. 5370 53712009-10-06 Rafael Espindola <espindola@google.com> 5372 5373 * plugin.cc (add_input_library): New. 5374 (Plugin::load): Add add_input_library to tv. 5375 (Plugin_manager::add_input_file): Add the is_lib argument. 5376 (add_input_file): Update call to Plugin_manager::add_input_file. 5377 (add_input_library): New. 5378 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument. 5379 53802009-09-30 Doug Kwan <dougkwan@google.com> 5381 5382 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function 5383 symbol and call Symbol::may_need_copy_reloc to determine if 5384 a copy reloc is needed. 5385 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z 5386 nocopyreloc is given in command line. 5387 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not 5388 given in command line. 5389 * i386.cc (Target_i386::may_need_copy_reloc): Remove. 5390 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead 5391 of the removed Target_i386::may_need_copy_reloc. 5392 * options.h (copyreloc): New option with default value false. 5393 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove. 5394 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc 5395 instead of the removed Target_powerpc::may_need_copy_reloc. 5396 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove. 5397 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc 5398 instead of the removed Target_sparc::may_need_copy_reloc. 5399 * symtab.h (Symbol::may_need_copy_reloc): New method definition. 5400 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove. 5401 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc 5402 instead of the removed Target_x86_64::may_need_copy_reloc. 5403 54042009-09-30 Ian Lance Taylor <iant@google.com> 5405 5406 * object.h (class Object): Remove target_ field, and target, 5407 sized_target, and set_target methods. 5408 (Object::sized_target): Remove. 5409 (class Sized_relobj): Update declarations. Remove sized_target. 5410 * object.cc (Sized_relobj::setup): Remove target parameter. 5411 Change all callers. 5412 (Input_objects::add_object): Don't do anything with the target. 5413 (make_elf_sized_object): Add punconfigured parameter. Change all 5414 callers. Set or test parameter target. 5415 * dynobj.cc (Sized_dynobj::target): Remove target parameter. 5416 Change all callers. 5417 * parameters.cc (Parameters::set_target): Change parameter type to 5418 be non-const. 5419 (Parameters::default_target): Remove. 5420 (set_parameters_target): Change parameter type to be non-const. 5421 (parameters_force_valid_target): New function. 5422 (parameters_clear_target): New function. 5423 * parameters.h (class Parameters): Update declarations. Remove 5424 default_target method. Add sized_target and clear_target 5425 methods. Change target_ to be non-const. 5426 (set_parameters_target): Update declaration. 5427 (parameters_force_valid_target): Declare. 5428 (parameters_clear_target): Declare. 5429 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured 5430 as NULL if we aren't searching. 5431 (Add_symbols::run): Don't check for compatible target. 5432 * fileread.cc (Input_file::open_binary): Call 5433 parameters_force_valid_target. 5434 * gold.cc (queue_middle_tasks): Likewise. 5435 * plugin.cc (make_sized_plugin_object): Likewise. Don't call 5436 set_target on object. 5437 * dynobj.h (class Sized_dynobj): Update declarations. 5438 * archive.cc (Archive::get_elf_object_for_member): Return NULL if 5439 make_elf_object returns NULL. 5440 (Archive::include_member): Don't check whether object target is 5441 compatible. 5442 * output.cc (Output_section::add_input_section): Get target from 5443 parameters. 5444 (Output_section::relax_input_section): Likewise. 5445 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from 5446 parameters. 5447 (Sized_relobj::do_scan_relocs): Likewise. 5448 (Sized_relobj::relocate_sections): Likewise. 5449 * resolve.cc (Symbol_table::resolve): Likewise. 5450 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object 5451 parameter. Change all callers. 5452 (Symbol_table::add_from_object): Get target from parameters. 5453 (Symbol_table::add_from_relobj): Don't check object target. 5454 (Symbol_table::add_from_dynobj): Likewise. 5455 (Symbol_table::define_special_symbol): Get target from 5456 parameters. 5457 * symtab.h (class Symbol_table): Update declaration. 5458 * testsuite/binary_unittest.cc (gold_testsuite): Remove target 5459 parameter. Change all callers. Clear parameter target. 5460 (Binary_test): Test target here. 5461 * testsuite/object_unittest.cc (gold_testsuite): Remove 5462 target_test_pointer parameter. Change all callers. 5463 (Object_test): Test target here. 5464 54652009-09-26 Ian Lance Taylor <iant@google.com> 5466 5467 * testsuite/initpri1.c: Don't try to use constructor priorities if 5468 compiling with gcc before 4.3. 5469 54702009-09-22 Mikolaj Zalewski <mikolajz@google.com> 5471 5472 * testsuite/retain_symbols_file_test.sh (check_present): Change 5473 output file name to retain_symbols_file_test.stdout. 5474 (check_absent): Likewise. 5475 54762009-09-18 Craig Silverstein <csilvers@google.com> 5477 5478 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map. 5479 * options.cc: Include <cerrno> and <fstream>. 5480 (General_options::finalize): Parse -retain-symbols-file tag. 5481 * options.h: New flag. 5482 (General_options): New method should_retain_symbol, new 5483 variable symbols_to_retain. 5484 * symtab.cc (Symbol_table::sized_finalize_symbol): Test 5485 should_retain_symbol map. 5486 * testsuite/Makefile.am (retain_symbols_file_test): New test. 5487 * testsuite/Makefile.in: Regenerate. 5488 * testsuite/retain_symbols_file_test.sh: New file. 5489 54902009-09-18 Nick Clifton <nickc@redhat.com> 5491 5492 * po/es.po: Updated Spanish translation. 5493 54942009-09-17 Doug Kwan <dougkwan@google.com> 5495 5496 * debug.h (DEBUG_RELAXATION): New constant. 5497 (DEBUG_ALL): Add DEBUG_RELAXATION. 5498 (debug_string_to_enum): Add relaxation debug option. 5499 * layout.cc 5500 (Layout::Relaxation_debug_check::check_output_data_for_reset_values, 5501 Layout::Relaxation_debug_check::read_sections, 5502 Layout::Relaxation_debug_check::read_sections): New method definitions. 5503 (Layout::Layout): Initialize data members 5504 record_output_section_data_from_scrips_, 5505 script_output_section_data_list_ and relaxation_debug_check_. 5506 (Layout::save_segments, Layout::restore_segments, 5507 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation, 5508 Layout::relaxation_loop_body): New method definitions. 5509 (Layout::finalize): Support relaxation. Move section layout code to 5510 Layout::relaxation_loop_body. 5511 (Layout::set_asection_address_from_script): Move code for orphan 5512 section placement out. 5513 (Layout::place_orphan_sections_in_script): New method definition. 5514 * layout.h (Output_segment_headers, Output_file_header): 5515 New forward class declarations. 5516 (Layout::~Layout): Define. 5517 (Layout::new_output_section_data_from_script): New method definition. 5518 (Layout::place_orphan_sections_in_script): New method declaration. 5519 (Layout::Segment_states): New type declaration. 5520 (Layout::save_segments, Layout::restore_segments, 5521 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation, 5522 Layout::relaxation_loop_body): New method declarations. 5523 (Layout::Output_section_data_list): New type declaration. 5524 (Layout::Relaxation_debug_check): New class definition. 5525 (Layout::record_output_section_data_from_script_, 5526 Layout::script_output_section_data_list_, Layout::segment_states_, 5527 Layout::relaxation_debug_check_): New data members. 5528 * output.cc: (Output_section_headers::do_size): New method definition. 5529 (Output_section_headers::Output_section_headers): Move size 5530 computation to Output_section_headers::do_size. 5531 (Output_segment_headers::do_size): New method definition. 5532 (Output_file_header::Output_file_header): Move size computation to 5533 Output_file_header::do_size and call it. 5534 (Output_file_header::do_size): New method definition. 5535 (Output_data_group::Output_data_group): Adjust call to 5536 Output_section_data. 5537 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once. 5538 (Output_symtab_xindex::do_write): Add array bound check. 5539 (Output_section::Input_section::print_to_mapfile): Handle 5540 RELAXED_INPUT_SECTION_CODE. 5541 (Output_section::Output_section): Initialize data member checkpoint_. 5542 (Output_section::~Output_section): Delete checkpoint object pointed 5543 by checkpoint_. 5544 (Output_section::add_input_section): Always add an Input_section if 5545 relaxing. 5546 (Output_section::add_merge_input_section): Add assert. 5547 (Output_section::relax_input_section): New method definition. 5548 (Output_section::set_final_data_size): Set load address to zero for 5549 an unallocated section. 5550 (Output_section::do_address_and_file_offset_have_reset_values): 5551 New method definition. 5552 (Output_section::Input_section_sort_enty::Input_section_sort_enty): 5553 Handle relaxed input section. 5554 (Output_section::sort_attached_input_sections): Checkpoint input 5555 section list lazily. 5556 (Output_section::get_input_sections): Change type of input_sections to 5557 list of Simple_input_section pointers. Checkpoint input section list 5558 lazily. Also handle relaxed input sections. 5559 (Output_section::add_input_section_for_script): Take a reference to 5560 a Simple_input_section object instead of Relobj pointer and section 5561 index as parameter. Handle relaxed input sections. 5562 (Output_section::save_states, Output_section::restore_states): New 5563 method definitions. 5564 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_. 5565 (Output_data::is_data_size_fixed): New method definition. 5566 (Output_data::reset_addresss_and_file_offset): Do not reset data size 5567 if it is fixed. 5568 (Output_data::address_and_file_offset_have_reset_values): New method 5569 definition. 5570 (Output_data::do_address_and_file_offset_have_reset_values): New method 5571 definition. 5572 (Output_data::set_data_size): Check that data size is not fixed. 5573 (Output_data::fix_data_size): New method definition. 5574 (Output_data::is_data_size_fixed_): New data member. 5575 (Output_section_headers::set_final_data_size): New method definition. 5576 (Output_section_headers::do_size): New method declaration. 5577 (Output_segment_headers::set_final_data_size): New method definition. 5578 (Output_segment_headers::do_size): New method declaration. 5579 (Output_file_header::set_final_data_size)::New method definition. 5580 (Output_file_header::do_size)::New method declaration. 5581 (Output_section_data::Output_section_data): Add new parameter 5582 is_data_size_fixed and use it to fix data size. 5583 (Output_data_const::Output_data_const): Adjust call to base class 5584 constructor and fix data size. 5585 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to 5586 base class constructor and fix data size. 5587 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to 5588 base class constructor and fix data size. 5589 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base 5590 class constructor and fix data size. 5591 (Output_data_group::set_final_data_size): New method definition. 5592 (Output_data_dynamic::Dynamic_entry::tag): New method definition. 5593 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base 5594 class constructor and fix data size. 5595 (Output_relaxed_input_section): New class definition. 5596 (Output_section::Simple_input_section): New class definition. 5597 (Output_section::get_input_sections): Adjust parameter list. 5598 (Output_section::add_input_section_for_script): Same. 5599 (Output_section::save_states, Output_section::restore_states, 5600 Output_section::do_address_and_file_offset_have_reset_values, 5601 (Output_section::Input_section::Input_section): Handle 5602 RELAXED_INPUT_SECTION_CODE. Add new overload for 5603 Output_relaxed_input_section. 5604 (Output_section::Input_section::is_input_section, 5605 Output_section::Input_section::set_output_section): Handle relaxed 5606 input section. 5607 (Output_section::Input_section::is_relaxed_input_section, 5608 Output_section::Input_section::output_section_data, 5609 Output_section::Input_section::relaxed_input_section): New method 5610 definitions. 5611 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum 5612 value. 5613 (Output_section::Input_section::u1_): Update comments. 5614 (Output_section::Input_section::u2_): Add new union member poris. 5615 (Output_section::Checkpoint_output_section): New classs definition. 5616 (Output_section::relax_input_section): New method declaration. 5617 (Output_section::checkpoint_): New data member. 5618 (Output_segment): Update comments. 5619 (Output_segment::Output_segment): Un-privatize copy constructor. 5620 (Output_segment::operator=): Un-privatize. 5621 * script-sections.cc (Output_section_element::Input_section_list): 5622 Change element type to Output_section::Simple_input_section. 5623 (Output_section_element_dot_assignment::set_section_addresses): 5624 Register output section data for relaxation clean up. 5625 (Output_data_exression::Output_data_expression): Adjust call to base 5626 constructor to fix data size. 5627 (Output_section_element_data::set_section_addresses): Register 5628 Output_data_expression object for relaxation clean up. 5629 (struct Input_section_info): Replace Relobj pointer and section index 5630 pair with Output_section::Simple_input_section and Convert struct to a 5631 class. 5632 (Input_section_sorter::operator()): Adjust access to 5633 Input_section_info data member to use accessors. 5634 (Output_section_element_input::set_section_addresses): Use layout 5635 parameter. Adjust code to use Output_section::Simple_input_section 5636 and Input_secction_info classes. Register filler for relaxation 5637 clean up. 5638 (Orphan_output_section::set_section_addresses): Replace Relobj pointer 5639 and section index pair with Output_section::Simple_input_section 5640 class. Adjust code accordingly. 5641 (Phdrs_element::release_segment): New method definition. 5642 (Script_sections::attach_sections_using_phdrs_clause): Do not modify 5643 segment list. 5644 (Script_sections::release_segments): New method definition. 5645 * gold/script-sections.h (Script_sections::release_segments): New 5646 method declaration. 5647 * gold/target.h (Target::may_relax, Target::relax, 5648 Target::do_may_relax, Target::do_relax): New method definitions. 5649 56502009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com> 5651 5652 * arm.cc (has_signed_unsigned_overflow): New function. 5653 (Arm_relocate_functions::abs8): New function. 5654 (Target_arm::Scan::local): Handle R_ARM_ABS8. 5655 (Target_arm::Scan::global): Likewise. 5656 (Target_arm::relocate::relocate): Likewise. 5657 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): 5658 Likewise. 5659 56602009-09-16 Cary Coutant <ccoutant@google.com> 5661 5662 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files. 5663 * testsuite/Makefile.in: Regenerate. 5664 56652009-09-11 Nick Clifton <nickc@redhat.com> 5666 5667 * po/gold.pot: Updated by the Translation project. 5668 56692009-09-08 Cary Coutant <ccoutant@google.com> 5670 5671 * output.cc (Output_file::open): Add execute permission to empty file. 5672 * testsuite/Makefile.am (permission_test): New test. 5673 * testsuite/Makefile.in: Regenerate. 5674 56752009-09-02 Ian Lance Taylor <iant@google.com> 5676 5677 * output.cc (Output_file::resize): Call map_no_anonymous rather 5678 than map. 5679 56802009-09-01 Mikolaj Zalewski <mikolajz@google.com> 5681 5682 * gold.cc: Include "incremental.h". 5683 (queue_initial_tasks): Call Incremental_checker methods. 5684 * incremental.cc: Include "output.h". 5685 (Incremental_checker::can_incrementally_link_output_file): New 5686 method. 5687 * incremental.h (Incremental_checker): New class. 5688 5689 * output.cc (Output_file::open_for_modification): New method. 5690 (Output_file::map_anonymous): Changed return type to bool. Record 5691 map in base_ field. 5692 (Output_file::map_no_anonymous): New method, broken out of map. 5693 (Output_file::map): Use map_no_anonymous and map_anonymous. 5694 * output.h (class Output_file): Update declarations. 5695 56962009-08-24 Cary Coutant <ccoutant@google.com> 5697 5698 * options.h (Command_line::Pre_options): New class. 5699 (Command_line::pre_options): New member. 5700 * options.cc (gold::options::ready_to_register): New variable. 5701 (One_option::register_option): Do nothing if not registering options. 5702 Assert if same short option registered twice. 5703 (General_options::General_options): Turn off option registration when 5704 done constructing. 5705 (Command_line::Pre_options::Pre_options): New constructor. 5706 57072009-08-24 Cary Coutant <ccoutant@google.com> 5708 5709 * options.h (General_options::no_keep_memory): Remove incorrect 5710 short option. 5711 57122009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 5713 5714 * Makefile.am (am__skiplex, am__skipyacc): New. 5715 * Makefile.in: Regenerate. 5716 57172009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 5718 5719 * Makefile.am (AM_CPPFLAGS): Renamed from ... 5720 (INCLUDES): ... this. 5721 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability. 5722 (AM_CPPFLAGS): Renamed from ... 5723 (INCLUDE): ... this. 5724 * Makefile.in, testsuite/Makefile.in: Regenerate. 5725 5726 * Makefile.in: Regenerate. 5727 * aclocal.m4: Likewise. 5728 * config.in: Likewise. 5729 * configure: Likewise. 5730 * testsuite/Makefile.in: Likewise. 5731 5732 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign. 5733 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign. 5734 * Makefile.in: Regenerate. 5735 * testsuite/Makefile.in: Regenerate. 5736 57372009-08-19 Cary Coutant <ccoutant@google.com> 5738 5739 * resolve.cc (Symbol_table::resolve): Don't complain about defined 5740 symbols in shared libraries overridden by hidden or internal symbols 5741 in the main program. 5742 57432009-08-19 Chris Demetriou <cgd@google.com> 5744 5745 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when 5746 checking source file names in error messages. 5747 57482009-08-18 Doug Kwan <dougkwan@google.com> 5749 5750 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of 5751 an elcpp::Ehdr as parameter. Adjust call to set_target. 5752 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of 5753 an elfcpp::Ehdr as parameter. 5754 * object.cc (Object::set_target): Remove the version that looks up 5755 a target and sets it. 5756 (Sized_relobj::setup): Take a Target object instead of 5757 an elfcpp::Ehdr as parameter. Adjust call to set_target. 5758 (make_elf_sized_object): Find target and ask target to 5759 make an ELF object. 5760 * object.h: (Object::set_target): Remove the version that looks up 5761 a target and sets it. 5762 (Sized_relobj::setup): Take a Target object instead of 5763 an elfcpp:Ehdr as parameter. 5764 * target.cc: Include dynobj.h. 5765 (Target::do_make_elf_object_implementation): New. 5766 (Target::do_make_elf_object): New. 5767 * target.h (Target::make_elf_object): New template declaration. 5768 (Target::do_make_elf_object): New method declarations. 5769 (Target::do_make_elf_object_implementation): New template declaration. 5770 57712009-08-14 Ian Lance Taylor <iant@google.com> 5772 5773 * gold.h (FUNCTION_NAME): Define. 5774 (gold_unreachable): Use FUNCTION_NAME. 5775 57762009-08-12 Sriraman Tallam <tmsriram@google.com> 5777 5778 * icf.cc (Icf::find_identical_sections): Issue a warning when a 5779 symbol in the --keep-unique list is not found. 5780 57812009-08-12 Sriraman Tallam <tmsriram@google.com> 5782 5783 * icf.cc (Icf::find_identical_sections): Unfold symbols that have 5784 been maked as --keep-unique. 5785 (Icf::unfold_section): New function. 5786 * icf.h (Icf::unfold_section): New function. 5787 * options.h (General_options::keep_unique): New option. 5788 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test. 5789 * testsuite/Makefile.in: Regenerate. 5790 * testsuite/icf_keep_unique_test.sh: New file. 5791 * testsuite/icf_keep_unique_test.cc: New file. 5792 57932009-08-12 Cary Coutant <ccoutant@google.com> 5794 5795 PR 10471 5796 * resolve.cc (Symbol_table::resolve): Check for references from 5797 dynamic objects to hidden and internal symbols. 5798 * testsuite/Makefile.am (hidden_test.sh): New test. 5799 * testsuite/Makefile.in: Regenerate. 5800 * testsuite/hidden_test.sh: New script. 5801 * testsuite/hidden_test_1.c: New test source. 5802 * testsuite/hidden_test_main.c: New test source. 5803 58042009-08-11 Doug Kwan <dougkwan@google.com> 5805 5806 * arm.cc: Update comments. 5807 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX 5808 segment to locate the .ARM.exidx section if present. 5809 58102009-08-09 Doug Kwan <dougkwan@google.com> 5811 5812 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous 5813 patch. 5814 58152009-08-07 Sriraman Tallam <tmsriram@google.com> 5816 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid 5817 compiler warnings. 5818 58192009-08-06 Sriraman Tallam <tmsriram@google.com> 5820 5821 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a 5822 valid tls_segment only for non-debug-section relocations. 5823 * testsuite/Makefile.am: Add gc_tls_test. 5824 * testsuite/Makefile.in: Regenerate. 5825 * testsuite/gc_tls_test.cc: New file. 5826 * testsuite/gc_tls_test.sh: New file. 5827 58282009-08-05 Sriraman Tallam <tmsriram@google.com> 5829 5830 * icf.cc: New file. 5831 * icf.h: New file. 5832 * Makefile.am (CCFILES): Add icf.cc. 5833 (HFILES): Add icf.h 5834 * Makefile.in: Regenerate. 5835 * dynobj.h (Sized_dynobj::do_section_entsize): New function. 5836 * gc.h (gc_process_relocs): Populate lists used by icf to contain 5837 section, symbol and addend information for the relocs. 5838 * gold.cc (queue_middle_tasks): Call identical code folding. 5839 * gold.h: Add defines for multimap. 5840 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter 5841 to the call of finalize_local_symbols. 5842 * main.cc (main): Create object of class Icf. 5843 * object.cc (Sized_relobj::do_layout): Allow this function to be 5844 called twice during icf. 5845 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding 5846 to sections marked as identical by icf. 5847 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data 5848 when available. 5849 (Sized_relobj::do_section_entsize): New function. 5850 * object.h (Object::section_entsize): New function. 5851 (Object::do_section_entsize): New pure virtual function. 5852 (Relobj::finalize_local_symbols): Add new parameter. 5853 (Relobj::do_section_entsize): New function. 5854 * options.h (General_options::icf): New option. 5855 (General_options::icf_iterations): New option. 5856 (General_options::print_icf_sections): New option. 5857 * plugin.cc (Sized_pluginobj::do_section_entsize): New function. 5858 * plugin.h (Sized_pluginobj::do_section_entsize): New function. 5859 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing 5860 icf. 5861 * symtab.cc (Symbol_table::is_section_folded): New function. 5862 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding 5863 to sections marked as identical by icf. 5864 * symtab.h (Symbol_table::set_icf): New function. 5865 (Symbol_table::icf): New function. 5866 (Symbol_table::is_section_folded): New function. 5867 (Symbol_table::icf_): New data member. 5868 * target-reloc.h (relocate_section): Ignore sections folded by icf. 5869 * testsuite/Makefile.am: Add commands to build icf_test. 5870 * testsuite/Makefile.in: Regenerate. 5871 * testsuite/icf_test.sh: New file. 5872 * testsuite/icf_test.cc: New file. 5873 58742009-07-24 Chris Demetriou <cgd@google.com> 5875 5876 * layout.cc (is_compressible_debug_section): Fix incorrect 5877 comment about compressed section names. 5878 58792009-07-20 Ian Lance Taylor <ian@airs.com> 5880 5881 PR 10419 5882 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences. 5883 58842009-07-16 Ian Lance Taylor <iant@google.com> 5885 5886 PR 10400 5887 * layout.h: #include <map>. 5888 (class Kept_section): Change from struct to class. Add accessors 5889 and setters. Add section size to Comdat_group mapping. Change 5890 Comdat_group to std::map. Add is_comdat_ field. Add 5891 linkonce_size field in union. 5892 (class Layout): Update declaration of find_or_add_kept_section. 5893 Don't declare find_kept_object. 5894 * layout.cc (Layout::find_or_add_kept_section): Remove candidate 5895 parameter. Add object, shndx, is_comdat, and is_group_name 5896 parameters. Change all callers. Adjust for new Kept_section. 5897 (Layout::find_kept_object): Remove. 5898 * object.cc (Sized_relobj::include_section_group): Update use of 5899 Kept_section. Rename secnum to shndx. Only record 5900 Kept_comdat_section if sections are the same size. 5901 (Sized_relobj::include_linkonce_section): Update use of 5902 Kept_section. Only record Kept_comdat_section if sections are the 5903 same size. Set size of linkonce section. 5904 (Sized_relobj::map_to_kept_section): Update call to 5905 get_kept_comdat_section. 5906 * object.h (class Sized_relobj): Rename fields in 5907 Kept_comdat_section to drop trailing underscores; change object 5908 field to Relobj*. Change Kept_comdat_section_table to store 5909 struct rather than pointer. 5910 (Sized_relobj::set_kept_comdat_section): Remove kept parameter. 5911 Add kept_object and kept_shndx parameters. Change all callers. 5912 (Sized_relobj::get_kept_comdat_section): Change return type to 5913 bool. Add kept_object and kept_shndx parameters. Change all 5914 callers. 5915 * plugin.cc (Pluginobj::include_comdat_group): Update call to 5916 Layout::find_or_add_kept_section. 5917 59182009-07-09 Ian Lance Taylor <iant@google.com> 5919 5920 * merge.cc (Object_merge_map::initialize_input_to_output_map): 5921 Reserve space in the hash table. 5922 59232009-07-06 Mikolaj Zalewski <mikolajz@google.com> 5924 5925 * fileread.cc (File_read::get_mtime): New method. 5926 * fileread.h (Timespec): New structure. 5927 (File_read::get_mtime): New method. 5928 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec): 5929 Renamed from timestamp_nsec. 5930 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to 5931 Elf_Xword. 5932 (Incremental_inputs_entry_write::timestamp_usec): Renamed from 5933 timestamp_nsec. 5934 (Incremental_inputs::report_archive): Save mtime; style fix. 5935 (Incremental_inputs::report_obejct): Save mtime; style fix. 5936 (Incremental_inputs::report_script): Save mtime; style fix. 5937 (Incremental_inputs::finalize_inputs): Style fix. 5938 (Incremental_inputs::finalize): Style fix. 5939 (Incremental_inputs::create_input_section_data): Store inputs 5940 mtime. 5941 * incremental.h (Incremental_inputs::report_script): Add mtime 5942 argument. 5943 (Incremental_inputs::Input_info::Input_info): Intialize only one 5944 union member. 5945 (Incremental_inputs::Input_info::archive): Move to nameless 5946 union. 5947 (Incremental_inputs::Input_info::obejct): Move to nameless union. 5948 (Incremental_inputs::Input_info::script): Move to nameless union. 5949 (Incremental_inputs::mtime): New field. 5950 * script.cc (read_input_script): Pass file mtime to 5951 Incremental_input. 5952 * script.h (Script_info::inputs): Style fix. 5953 59542009-07-01 Ian Lance Taylor <ian@airs.com> 5955 5956 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size 5957 instead of 32. 5958 59592009-06-24 Ian Lance Taylor <iant@google.com> 5960 5961 PR 10156 5962 * layout.cc (Layout::choose_output_section): If we find an 5963 existing section, update the flags. 5964 (Layout::create_notes): New function, broken out of 5965 Layout::finalize. 5966 (Layout::finalize): Don't create note sections. 5967 (Layout::create_note): Don't crash if linker script discards 5968 section. 5969 (Layout::create_gold_note): Likewise. 5970 (Layout::create_build_id): Likewise. Don't set 5971 after_input_sections on the section. 5972 (Layout::create_executable_stack_info): Remove target parameter. 5973 Change caller. 5974 * layout.h (class Layout): Declare create_notes. Update 5975 declaration of create_executable_stack_info. 5976 * gold.cc (queue_middle_tasks): Call create_notes. 5977 * output.cc (Output_section::update_flags_for_input_section): Move 5978 here from output.h. If SHF_ALLOC flag is newly set, mark address 5979 invalid. 5980 * output.h (Output_data::mark_address_invalid): New function. 5981 (class Output_section): Only declare, not define, 5982 update_flags_for_input_section. Remove set_flags. 5983 59842009-06-24 Ian Lance Taylor <iant@google.com> 5985 5986 * script-sections.cc (Output_section_definition:: 5987 set_section_addresses): Rename shadowing local load_address to 5988 laddr. 5989 59902009-06-24 Ian Lance Taylor <iant@google.com> 5991 5992 PR 10244 5993 * reloc.cc (relocate_sections): Skip empty relocation sections. 5994 59952009-06-23 Ian Lance Taylor <iant@google.com> 5996 5997 PR 10156 5998 * layout.cc (Layout::create_note): Use choose_output_section 5999 rather than make_output_section. 6000 60012009-06-23 Ian Lance Taylor <iant@google.com> 6002 6003 PR 10237 6004 * options.cc (General_options::parse_V): Set printed_version_. 6005 (General_options::General_options): Initialize printed_version_. 6006 * options.h (class General_options): Add printed_version_ field. 6007 * gold.cc (queue_initial_tasks): If there are no input files, 6008 don't give a fatal error if we printed the version information. 6009 (queue_middle_tasks): If using -r with a shared object, give a 6010 fatal error rather than an ordinary error. 6011 60122009-06-23 Ian Lance Taylor <iant@google.com> 6013 6014 PR 10219 6015 * layout.cc (Layout::Layout): Initialize have_stabstr_section_. 6016 (Layout::make_output_section): Set have_stabstr_section_ if we see 6017 a .stab*str section. 6018 (Layout::finalize): Call link_stabs_sections. 6019 (Layout::link_stabs_sections): New file. 6020 * layout.h (class Layout): Add have_stabstr_section_ field. 6021 Declare link_stabs_sections. 6022 60232009-06-23 Doug Kwan <dougkwan@google.com> 6024 6025 * Makefile.am (libgold_a_LIBADD): New. 6026 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS 6027 * Makefile.in: Regenerate. 6028 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New. 6029 * configure: Regenerate. 6030 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem. 6031 * fileread.cc: Include sys/state.h 6032 * gold.h: Declare memmem and strndup if found missing. 6033 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined. 6034 60352009-06-23 Ian Lance Taylor <iant@google.com> 6036 6037 * configure.ac: Call AC_CHECK_DECLS using C, not C++. 6038 * configure: Rebuild. 6039 60402009-06-23 Ian Lance Taylor <iant@google.com> 6041 6042 PR 10147 6043 * object.cc (Object::section_contents): Don't try to get a view if 6044 the section has length zero. 6045 (Object::handle_gnu_warning_section): If the section is empty, use 6046 the name of the section as the warning. 6047 60482009-06-23 Ian Lance Taylor <iant@google.com> 6049 6050 PR 10133 6051 * stringpool.h (class Stringpool_template): Add optimize_ field. 6052 (Stringpool_template::set_optimize): New function. 6053 * stringpool.cc (Stringpool_template::Stringpool_template): 6054 Initialize optimize_ field. 6055 (Stringpool_template::set_string_offsets): Test local optimize 6056 fild rather than parameter. 6057 * layout.cc (Layout::Layout): Call set_optimize on the section 6058 name stringpool. 6059 60602009-06-22 Ian Lance Taylor <iant@google.com> 6061 6062 PR 10030 6063 * yyscript.y: Parse TARGET. 6064 * script.cc (script_set_target): New function. 6065 * script-c.h (script_set_target): Declare. 6066 * options.cc (General_options::string_to_object_format): Rename 6067 from string_to_object_format in anonymous namespace. Change 6068 callers. 6069 * options.h (class General_options): Declare 6070 string_to_object_format. 6071 60722009-06-22 Ian Lance Taylor <iant@google.com> 6073 6074 * script-sections.cc (Script_sections::create_segments): Don't put 6075 program headers in a PT_LOAD segment if -n or -N. 6076 60772009-06-22 Ian Lance Taylor <iant@google.com> 6078 6079 PR 10141 6080 * options.h (class General_options): Add -z lazy and -z now. Sort 6081 -z options into alphabetical order. 6082 * layout.cc (Layout::finish_dynamic_section): Handle -z now. 6083 60842009-06-21 Ian Lance Taylor <iant@google.com> 6085 6086 * layout.cc (Layout::make_output_section): Call 6087 Target::new_output_section. 6088 (Layout::attach_allocated_section_to_segment): Put large section 6089 sections in a separate load segment with the large segment flag 6090 set. 6091 (Layout::segment_precedes): Sort large data segments after other 6092 load segments. 6093 (align_file_offset): New static function. 6094 (Layout::set_segment_offsets): Use align_file_offset. 6095 * output.h (class Output_section): Add is_small_section_ and 6096 is_large_section_ fields. 6097 (Output_section::is_small_section): New function. 6098 (Output_section::set_is_small_section): New function. 6099 (Output_section::is_large_section): New function. 6100 (Output_section::set_is_large_section): New function. 6101 (Output_section::is_large_data_section): New function. 6102 (class Output_segment): Add is_large_data_segment_ field. 6103 (Output_segment::is_large_data_segment): New function. 6104 (Output_segment::set_is_large_data_segment): New function. 6105 * output.cc (Output_section::Output_section): Initialize new 6106 fields. 6107 (Output_segment::Output_segment): Likewise. 6108 (Output_segment::add_output_section): Add assertion that large 6109 data sections always go in large data segments. Force small data 6110 sections to the end of the list of data sections. Force small BSS 6111 sections to the start of the list of BSS sections. For large BSS 6112 sections to the end of the list of BSS sections. 6113 * symtab.h (class Symbol): Declare is_common_shndx. 6114 (Symbol::is_defined): Check Symbol::is_common_shndx. 6115 (Symbol::is_common): Likewise. 6116 (class Symbol_table): Define enum Commons_section_type. Update 6117 declarations. Add small_commons_ and large_commons_ fields. 6118 * symtab.cc (Symbol::is_common_shndx): New function. 6119 (Symbol_table::Symbol_table): Initialize new fields. 6120 (Symbol_table::add_from_object): Put small and large common 6121 symbols in the right list. 6122 (Symbol_table::sized_finalized_symbol): Check 6123 Symbol::is_common_shndx. 6124 (Symbol_table::sized_write_globals): Likewise. 6125 * common.cc (Symbol_table::do_allocate_commons): Allocate new 6126 common symbol lists. Don't call do_allocate_commons_list if the 6127 list is empty. 6128 (Symbol_table::do_allocate_commons_list): Remove is_tls 6129 parameter. Add comons_section_type parameter. Change all 6130 callers. Handle small and large common symbols. 6131 * object.cc (Sized_relobj::do_finalize_local_symbols): Check 6132 Symbol::is_common_shndx. 6133 * resolve.cc (symbol_to_bits): Likewise. 6134 * target.h (Target::small_common_shndx): New function. 6135 (Target::small_common_section_flags): New function. 6136 (Target::large_common_shndx): New function. 6137 (Target::large_common_section_flags): New function. 6138 (Target::new_output_section): New function. 6139 (Target::Target_info): Add small_common_shndx, large_common_shndx, 6140 small_common_section_flags, and large_common_section_flags 6141 fields. 6142 (Target::do_new_output_section): New virtual function. 6143 * arm.cc (Target_arm::arm_info): Initialize new fields. 6144 * i386.cc (Target_i386::i386_info): Likewise. 6145 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]: 6146 Likewise. 6147 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise. 6148 * x86_64.cc (Target_x86_64::x86_64_info): Likewise. 6149 (Target_x86_64::do_new_output_section): New function. 6150 * configure.ac: Define conditional MCMODEL_MEDIUM. 6151 * testsuite/Makefile.am (check_PROGRAMS): Add large. 6152 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define. 6153 (large_LDFLAGS): Define. 6154 * testsuite/large.c: New file. 6155 * testsuite/testfile.cc (Target_test::test_target_info): 6156 Initialize new fields. 6157 * configure, testsuite/Makefile.in: Rebuild. 6158 61592009-06-05 Doug Kwan <dougkwan@google.com> 6160 6161 * Makefile.am (CCFILES): Add target.cc. 6162 * Makefile.in: Regenerate. 6163 * i386.cc (class Target_i386): Define new virtual method to 6164 override do_is_local_label_name in parent. 6165 * object.cc (Sized_relobj::do_count_local_symbols): Discard 6166 local symbols if --discard-locals or -X is given. 6167 * options.h (class General_options): Declare new options 6168 '--discard-locals' and '-X' for discarding locals. 6169 * target.h (class Target): Define new methods is_local_label_name. 6170 Declare new virtual method do_is_local_label_name. 6171 * target.cc: New file. 6172 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test. 6173 (check_SCRIPTS): Add discard_locals_test.sh. 6174 (check_DATA): Add discard_local_tests.syms. 6175 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define. 6176 (discard_local_tests.syms, discard_locals_test.o): New make rules. 6177 * testsuite/Makefile.in: Regenerate. 6178 * testsuite/discard_locals_test.c: New file. 6179 * testsuite/discard_locals_test.sh: Same. 6180 61812009-06-05 Doug Kwan <dougkwan@google.com> 6182 6183 * object.cc (Sized_relobj::Sized_relobj): Initialize 6184 discarded_eh_frame_shndx_ to -1U. 6185 (Sized_relobj::do_layout): Record index of a discard .eh_frame 6186 section. 6187 (Sized_relobj::do_count_local_symbols): Skip local symbols in 6188 a discarded .eh_frame section. 6189 (Sized_relobj::do_finalize_local_symbols): Ditto. 6190 * object.h (class Sized_relobj): Declare new member 6191 discarded_eh_frame_shndx_. 6192 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test. 6193 (local_labels_test.o, local_labels_test): New rules. 6194 * testsuite/Makefile.in: Regenerate. 6195 61962009-06-04 Doug Kwan <dougkwan@google.com> 6197 6198 * layout.cc (Layout::section_name_mapping): Add mapping for 6199 special ARM sections. 6200 62012009-06-03 Doug Kwan <dougkwan@google.com> 6202 6203 * arm.cc (utils::sign_extend): Reverse test in gold_assert. 6204 (utils::has_overflow): Same. 6205 62062009-06-03 Ian Lance Taylor <iant@google.com> 6207 6208 * layout.cc (Layout::section_name_mapping): New array, replacing 6209 Layout::linkonce_mapping. 6210 (Layout::section_name_mapping_count): New variable, replacing 6211 Layout::linkonce_mapping_count. 6212 (Layout::linkonce_output_name): Remove. 6213 (Layout::output_section_name): Rewrite. 6214 * layout.h (class Layout): Rename Linkonce_mapping to 6215 Section_name_mapping, linkonce_mapping to section_name_mapping, 6216 linkonce_mapping_count to section_name_mapping_count. Don't 6217 declare linkonce_output_name. 6218 62192009-06-03 Doug Kwan <dougkwan@google.com> 6220 6221 * gold/arm.cc (namespace utils): New. 6222 (Target_arm::reloc_is_non_pic): Define new method. 6223 (class Arm_relocate_functions): New. 6224 (Target_arm::Relocate::relocate): Handle relocation types used by 6225 Android. 6226 62272009-06-03 Ian Lance Taylor <iant@google.com> 6228 6229 * arm.cc (Target_arm::scan::global): Use || instead of |. 6230 62312009-06-02 Doug Kwan <dougkwan@google.com> 6232 6233 * gold/arm.cc (Target_arm::Scan::Scan): Initialize 6234 issued_non_pic_error_. 6235 (class Target_arm::Scan): Declare new method check_non_pic. 6236 Define new method symbol_needs_plt_entry. 6237 Declare new data member issued_non_pic_error_. 6238 (class Target_arm::Relocate): Declare new method 6239 should_apply_static_reloc. 6240 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC. 6241 (Target_arm::Scan::check_non_pic): Define new method. 6242 (Target_arm::Scan::local): Handle a small subset of reloc types used 6243 by Android. 6244 (Target_arm::Scan::local): Same. 6245 (Target_arm::Relocate::should_apply_statci_reloc): Define new method. 6246 62472009-05-31 Mikolaj Zalewski <mikolajz@google.com> 6248 6249 * incremental.cc (Incremental_inputs::report_command_line): Filter 6250 out --incremental-* options. 6251 62522009-05-29 Doug Kwan <dougkwan@google.com> 6253 6254 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new 6255 template class. 6256 (class Target_arm): Update comment. 6257 (Target_arm::Target_arm): Initialize new data members GOT_, 6258 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_. 6259 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry 6260 and Target_arm::rel_dyn_section. 6261 Declare new_enum Target_arm::Got_type. 6262 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ 6263 and DYNBSS_. 6264 Update commments for member do_dynsym_value. 6265 (Target_arm::got_size, Target_arm::plt_section, 6266 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define 6267 new methods inside class defintion. 6268 (Target_arm::got_section): Define new method. 6269 (Target_arm::rel_dyn_section): Same. 6270 (Output_data_plt_arm): New template class. 6271 (Output_data_plt_arm::Output_data_plt_arm): Define constructor. 6272 (Output_data_plt_arm:do_adjust_output_section): Define new method. 6273 (Output_data_plt_arm::add_entry): Same. 6274 (Output_data_plt_arm::first_plt_entry): Define new 6275 static data member for PLT instruction template. 6276 (Output_data_plt_arm::plt_entry): Same. 6277 (Output_data_plt_arm::do_write): Define new method. 6278 (Target_arm::make_plt_entry): Same. 6279 (Target_arm::do_finalize_sections): Same. 6280 (Target_arm::do_dynsym_value): Same. 6281 62822009-05-28 Doug Kwan <dougkwan@google.com> 6283 6284 * Makefile.am (TARGETSOURCES): Add arm.cc. 6285 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT) 6286 * Makefile.in: Regenerate. 6287 * arm.cc: New file. 6288 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets. 6289 62902009-05-26 Doug Kwan <dougkwan@google.com> 6291 6292 * options.cc (General_options::parse_exclude_libs). Fix a comment. 6293 (General_options::check_excluded_libs): Strip off directories in 6294 archive name before matching like GNU ld does. 6295 * testsuite/Makefile.am (MOSTLYCLEANFILES, 6296 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a 6297 (exclude_libs_test_LDFLAGS): Add linker option 6298 -Wl,--exclude-libs,libexclude_libs_test_3 6299 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as 6300 an explicit archive without using -l. 6301 (alt/libexclude_libs_test_3.a): New make rule. 6302 * testsuite/Makefile.in: Regenerate. 6303 * testsuite/exclude_libs_test.c : Declare lib3_default(). 6304 (main): Call it. 6305 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a. 6306 * exclude_libs_test_3.c: New file. 6307 63082009-05-26 Nick Clifton <nickc@redhat.com> 6309 6310 * po/id.po: New Indonesian translation. 6311 * po/gold.pot: Updated template file. 6312 63132009-05-22 Sriraman Tallam <tmsriram@google.com> 6314 6315 * testsuite/Makefile.am: Add -ffunction-sections to compile 6316 gc_comdat_test files. Add -Wl,--gc-sections to build 6317 gc_comdat_test. 6318 * testsuite/Makefile.in: Regenerate. 6319 * testsuite/gc_comdat_test.sh: Fix the condition around grep. 6320 63212009-05-21 Sriraman Tallam <tmsriram@google.com> 6322 6323 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the 6324 kept comdat section was garbage collected. 6325 * testsuite/Makefile.am: Add test gc_comdat_test.sh. 6326 * testsuite/Makefile.in: Regenerate. 6327 * testsuite/gc_comdat_test.sh: New file. 6328 * testsuite/gc_comdat_test_1.cc: New file. 6329 * testsuite/gc_comdat_test_2.cc: New file. 6330 63312009-05-19 Doug Kwan <dougkwan@google.com> 6332 6333 * archive.cc (Archive::Archive): Move constructor from archive.h 6334 to here. Initialize no_export_. 6335 (Archive::get_elf_object_for_member): Set no_export flag of object. 6336 * archive.h (Archive::Archive): Move constructor body to 6337 archive.cc. 6338 (Archive::no_export): New method. 6339 (Archive::no_export_): New field. 6340 * object.h (Object::Object): Initialize no_export_ to false. 6341 (Object::no_export, Object::set_no_export): New methods. 6342 (Object::no_export_): New field. 6343 * options.cc (General_options::parse_exclude_libs): New method. 6344 (General_options::check_excluded_libs) Same. 6345 * options.h (exclude_libs): New option. 6346 (General_options::check_excluded_libs): New method declaration. 6347 (General_options::excluded_libs_): New field. 6348 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with 6349 default or protected visibility if an object has no-export flag set. 6350 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test. 6351 (check_SCRIPTS): Add exclude_libs_test.sh. 6352 (check_DATA): Add exclude_libs_test.syms. 6353 (MOSTLYCLEANFILES): Add exclude_libs_test.syms, 6354 libexclude_libs_test_1.a and libexclude_libs_test_2.a. 6355 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES, 6356 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define. 6357 (exclude_libs_test.syms, libexclude_libs_test_1.a, 6358 libexclude_libs_test_2.a): New rules. 6359 * testsuite/Makefile.in: Regenerate. 6360 * testsuite/exclude_libs_test.c: New file. 6361 * testsuite/exclude_libs_test.sh: Ditto. 6362 * testsuite/exclude_libs_test_1.c: Ditto. 6363 * testsuite/exclude_libs_test_2.c: Ditto. 6364 63652009-05-15 Ian Lance Taylor <iant@google.com> 6366 6367 * configure.ac: Check for declarations for cases where libiberty.h 6368 checks HAVE_DECL_xxx. 6369 * configure, config.in: Rebuild. 6370 63712009-05-15 Mikolaj Zalewski <mikolajz@google.com> 6372 6373 * gold.h (Incremental_argument_list): Remove (invalid) forward 6374 declaration. 6375 * incremental.cc (Incremental_inputs::report_achive): New method. 6376 (Incremental_inputs::report_object): New method. 6377 (Incremental_inputs::report_script): New method. 6378 (Incremental_inputs::finalize_inputs): New method. 6379 (Incremental_inputs::finalize): Call finalize_inputs(). 6380 (Incremental_inputs::sized_create_incremental_inputs_section_data): 6381 Create inputs entries. 6382 * incremental.h (Incremental_input_type): New enum. 6383 (Incremental_inputs::Incremental_input): Initialize new fields. 6384 (Incremental_inputs::report_inputs): New method. 6385 (Incremental_inputs::report_achive): New method. 6386 (Incremental_inputs::report_object): New method. 6387 (Incremental_inputs::report_script): New method. 6388 (Incremental_inputs::finalize_inputs): New method. 6389 (Incremental_inputs::Input_info): New struct. 6390 (Incremental_inputs::Input_info_map): New typedef. 6391 (Incremental_inputs::lock_): New field. 6392 (Incremental_inputs::Inputs_): New field. 6393 (Incremental_inputs::Inputs_map): New field. 6394 * main.cc (main): Call Incremental_input::report_inputs. 6395 * options.h (Input_argument_list): Typedef moved from 6396 Input_arguments. 6397 (Input_file_group::Files): Remove, use ::Input_argument_list. 6398 (Input_file_group::Input_argument_list): Remove, use 6399 ::Input_argument_list. 6400 * plugin.cc (Plugin_manager::add_input_file): Add error in 6401 incremental build. 6402 * read_syms.cc (do_read_syms): Call Incremental_input::report_* 6403 functions. 6404 * script.cc (read_input_script): Call 6405 Incremental_input::report_script. 6406 * script.h (Script_info): New class. 6407 64082009-04-27 Ian Lance Taylor <iant@google.com> 6409 6410 * x86_64.cc (do_adjust_output_section): Set entsize to 6411 plt_entry_size. 6412 64132009-04-23 Elliott Hughes <enh@google.com> 6414 6415 * output.cc (Output_file::close): After short writes, continue 6416 writing from the correct offset in the buffer being written. 6417 64182009-04-23 Chris Demetriou <cgd@google.com> 6419 6420 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define. 6421 * configure: Regenerate. 6422 * config.in: Regenerate. 6423 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set 6424 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined. 6425 64262009-04-21 Mikolaj Zalewski <mikolajz@google.com> 6427 6428 * incremental.cc (Incremental_inputs_header_data): Renamed from 6429 Incremental_input_header_data. 6430 (Incremental_inputs_header_data::data_size): New field. 6431 (Incremental_inputs_header_data::put_input_file_count): Renamed 6432 from input_file_count. 6433 (Incremental_inputs_header_data::put_command_line_offset): Renamed 6434 from command_line_offset. 6435 (Incremental_inputs_header_data::put_reserved): Renamed from 6436 put_reserved. 6437 (Incremental_inputs_entry_data): Renamed from 6438 Incremental_input_entry_data. 6439 (Incremental_inputs_entry_data::data_size): New field. 6440 (Incremental_inputs::report_command_line): New method. 6441 (Incremental_inputs::finalize): New method. 6442 (Incremental_inputs::create_incremental_inputs_data): New method. 6443 (Incremental_inputs::sized_create_incremental_inputs_data): New method. 6444 * incremental.h: New file. 6445 * layout.cc (Layout::Layout): Handle new incremental_inputs_. 6446 (Layout::finalize): Create incremental inputs section in 6447 incremental builds. 6448 (Layout::create_incremental_info_sections): New method. 6449 * layout.h (Layout::incremental_inputs): New method. 6450 (Layout::create_incremental_info_sections): New method. 6451 (Layout::incremental_inputs_): New field. 6452 * main.cc (main): Notify Incremental_input of the command line. 6453 64542009-04-01 Ian Lance Taylor <iant@google.com> 6455 Mikolaj Zalewski <mikolajz@google.com> 6456 6457 * gold.h (reserve_unordered_map): Define, three versions, one for 6458 each version of Unordered_map. 6459 * layout.cc (Layout::Layout): Remove options parameter. Add 6460 number_of_input_files parameter. Don't initialize options_. 6461 Initialize number_of_input_files_ and resized_signatures_. Move 6462 sections_are_attached_. 6463 (Layout::layout_group): Reserve space for group_signatures_. 6464 (Layout::find_or_add_kept_section): Change name parameter to be a 6465 reference. Resize signatures_ map when it gets large enough. 6466 (Layout::layout_eh_frame): Use parameters->options() instead of 6467 this->options_. 6468 (Layout::make_output_section): Likewise. 6469 (Layout::attach_allocated_section_to_segment): Likewise. 6470 (Layout::finalize, Layout::create_executable_stack): Likewise. 6471 (Layout::set_segment_offsets, Layout::create_interp): Likewise. 6472 (Layout::finish_dynamic_section, Layout::write_binary): Likewise. 6473 * layout.h (class Layout): Update declarations. Remove options_ 6474 field. Add number_of_input_files_ and resized_signatures_ 6475 fields. Move sections_are_attached_ field. 6476 * main.cc (main): Pass number of input files to Layout 6477 constructor. Don't pass options. 6478 64792009-03-30 Ian Lance Taylor <iant@google.com> 6480 6481 * ffsll.c (ffsll): Correct implementation. 6482 64832009-03-27 Ian Lance Taylor <iant@google.com> 6484 6485 * ffsll.c: New file. 6486 * configure.ac: Call AC_REPLACE_FUNCS on ffsll. 6487 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined. 6488 * ftruncate.c (ftruncate): Declare before definition. 6489 * mremap.c (mremap): Likewise. 6490 * pread.c (pread): Likewise. 6491 * configure, Makefile.in, config.in: Rebuild. 6492 6493 * mremap.c: New file. 6494 * configure.ac: Call AC_REPLACE_FUNCS on mremap. 6495 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined. 6496 (mremap): Declare if HAVE_MREMAP is not defined. 6497 * configure, Makefile.in, config.in: Rebuild. 6498 64992009-03-27 Cary Coutant <ccoutant@google.com> 6500 6501 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is 6502 position independent. 6503 * sparc.cc (Target_sparc::check_non_pic): Likewise. 6504 * x86_64.cc (Target_x86_64::check_non_pic): Likewise. 6505 65062009-03-24 Cary Coutant <ccoutant@google.com> 6507 6508 * symtab.h (needs_plt_entry): Check for unsatisfied reference from 6509 an executable. 6510 (needs_dynamic_reloc): Likewise. 6511 65122009-03-24 Ian Lance Taylor <iant@google.com> 6513 6514 * yyscript.y (file_cmd): Recognize EXTERN. 6515 (extern_name_list, extern_name_list_body): New nonterminals. 6516 * script.cc (script_add_extern): Define. 6517 * script-c.h (script_add_extern): Declare. 6518 65192009-03-24 Rafael Avila de Espindola <espindola@google.com> 6520 6521 * object.cc (is_elf_object): Define. 6522 * object.h (is_elf_object): Declare. 6523 * archive.cc (Archive::get_elf_object_for_member): Call 6524 is_elf_object. 6525 * readsyms.cc (Read_symbols::do_read_symbols): Likewise. 6526 65272009-03-24 Elliott Hughes <enh@google.com> 6528 6529 * output.cc (Output_file::map_anonymous): Define. 6530 (Output_file::map): Use map_anonymous. If the regular mmap fails, 6531 try an anonymous one. Report the size if the mmap fails. 6532 * output.h (class Output_file): Declare map_anonymous. 6533 65342009-03-24 Ian Lance Taylor <iant@google.com> 6535 6536 * target-select.cc (instantiate_target): Don't acquire the lock if 6537 the instantiated_target_ field has already been set. 6538 65392009-03-23 Ian Lance Taylor <iant@google.com> 6540 6541 * gold-threads.h (class Initialize_lock): Define. 6542 * gold-threads.cc (class Initialize_lock_once): Define. 6543 (initialize_lock_control): New static variable. 6544 (initialize_lock_pointer): New static variable. 6545 (initialize_lock_once): New static function. 6546 (Initialize_lock::Initialize_lock): Define. 6547 (Initialize_lock::initialize): Define. 6548 * target-select.h: Include "gold-threads.h". 6549 (class Target_selector): Add lock_ and initialize_lock_ fields. 6550 Don't define instantiate_target, just declare it. 6551 * target-select.cc (Target_selector::Target_selector): Initialize 6552 new fields. 6553 (Target_selector::instantiate_target): Define. 6554 * descriptors.h: Include "gold-threads.h". 6555 (class Descriptors): Add initialize_lock_ field. 6556 * descriptors.cc (Descriptors::Descriptors): Initialize new 6557 field. 6558 (Descriptors::open): Use initialize_lock_ field 6559 * errors.h (class Errors): Add initialize_lock_ field. 6560 * errors.cc (Errors::Errors): Initialize new field. 6561 (Errors::initialize_lock): Use initialize_lock_ field. 6562 * powerpc.cc (class Target_selector_powerpc): Remove 6563 instantiated_target_ field. In do_recognize call 6564 instantiate_target rather than do_instantiate_target. In 6565 do_instantiate_target just allocate a new target. 6566 * sparc.cc (class Target_selector_sparc): Likewise. 6567 6568 * freebsd.h: New file. 6569 * i386.cc: Include "freebsd.h". 6570 (Target_i386): Derive from Target_freebsd rather than 6571 Sized_target. 6572 (Target_selector_i386): Derive from Target_selector_freebsd rather 6573 than Target_selector. 6574 * x86_64.cc: Include "freebsd.h". 6575 (Target_x86_64): Derive from Target_freebsd rather than 6576 Sized_target. 6577 (Target_selector_x86_64): Derive from Target_selector_freebsd 6578 rather than Target_selector. 6579 * target.h (class Target): Add adjust_elf_header and 6580 do_adjust_elf_header. 6581 * output.cc (Output_file_header:: do_sized_write): Call target 6582 adjust_elf_header routine. 6583 * configure.tgt: Set targ_osabi. 6584 * configure.ac: Define GOLD_DEFAULT_OSABI. 6585 * parameters.cc (Parameters::default_target): Pass 6586 GOLD_DEFAULT_OSABI to select_target. 6587 * target-select.h (class Target_selector): Make instantiate_target 6588 protected rather than private. 6589 * Makefile.am (HFILES): Add freebsd.h. 6590 * configure, Makefile.in, config.in: Rebuild. 6591 6592 * merge.cc (do_add_input_section): Correct pend value. Change 6593 message about last entry not being null terminated from error to 6594 warning. 6595 65962009-03-20 Mikolaj Zalewski <mikolajz@google.com> 6597 6598 * incremental.cc: New file. 6599 * Makefile.am (CCFILES): Add incremental.cc. 6600 * Makefile.in: Rebuild. 6601 66022009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com> 6603 6604 * layout.cc (Layout::output_section_name): Preserve names 6605 of '.note.' sections. 6606 66072009-03-19 Ian Lance Taylor <iant@google.com> 6608 6609 * descriptors.cc (Descriptors::open): Check that the options are 6610 valid before using them. 6611 66122009-03-18 Ian Lance Taylor <iant@google.com> 6613 6614 * script-sections.h: Include <list>. 6615 (class Script_sections): Change Sections_elements from std::vector 6616 to std::list. Typedef public Elements_iterator. Add 6617 orphan_section_placement_, data_segment_align_start_, and 6618 saw_data_segment_align_ fields. Remove data_segment_align_index_ 6619 field. 6620 * script-sections.cc (class Orphan_section_placement): New class. 6621 (class Sections_element): Add virtual functions is_relro and 6622 orphan_section_init. Remove virtual function place_orphan_here. 6623 (class Output_section_definition): Add is_relro and 6624 orphan_section_init. Remove place_orphan_here. 6625 (class Orphan_output_section): Likewise. 6626 (Script_sections::Script_sections): Update for field changes. 6627 (Script_sections::data_segment_align): Set saw_data_segment_align_ 6628 and data_segment_align_start_, not data_segment_align_index. 6629 (Script_sections::data_segment_relro_end): Check 6630 saw_data_segment_align_. Use data_segment_align_start_ rather 6631 than data_segment_align_index_. 6632 (Script_sections::place_orphan): Rewrite to use 6633 Orphan_section_placement. 6634 66352009-03-17 Ian Lance Taylor <iant@google.com> 6636 6637 * archive.cc (Archive::add_symbols): Check for a version attached 6638 to the symbol name in the archive map. 6639 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11. 6640 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define. 6641 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define. 6642 (ver_test_11.a): New target. 6643 * testsuite/Makefile.in: Rebuild. 6644 6645 * configure.ac: Check for chsize and posix_fallocate. Replace 6646 ftruncate. 6647 * ftruncate.c: New file, from gnulib. 6648 * output.cc (posix_fallocate): Define dummy version if not 6649 HAVE_POSIX_FALLOCATE. 6650 (Output_file::map): Call posix_fallocate rather than lseek and 6651 write. 6652 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE. 6653 * configure, Makefile.in, config.in: Rebuild. 6654 66552009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com> 6656 6657 * layout.h (Layout::create_note): Add section_name parameter. 6658 * layout.cc (Layout::create_note): Likewise. 6659 (Layout::create_build_id, Layout::create_gold_note): Fix callers. 6660 66612009-03-17 Ian Lance Taylor <iant@google.com> 6662 6663 * descriptors.cc: Include "options.h". 6664 (FD_CLOEXEC, O_CLOEXEC): Define if not defined. 6665 (Descriptors::open): Always use O_CLOEXEC when opening a new 6666 descriptor. If we have a plugin, and O_CLOEXEC was not defined, 6667 then set FD_CLOEXEC. 6668 6669 * sparc.cc (class Target_sparc): Add has_got_section. 6670 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_, 6671 make sure we have a GOT section. 6672 6673 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD. 6674 (Target_sparc::Scan::local): Likewise. 6675 (Target_sparc::Scan::global): Likewise. 6676 (Target_sparc::Relocate::relocate): Likewise. 6677 (Target_sparc::Relocate::relocate_tls): Likewise. 6678 6679 * symtab.cc (Symbol_table::define_default_version): New function, 6680 broken out of add_from_object. 6681 (Symbol_table::add_from_object): Call define_default_version. 6682 (Symbol_table::define_special_symbol): Add resolve_oldsym 6683 parameter. Change all callers. If the version for a symbol comes 6684 from a version script, resolve it with the symbol with the same 6685 name with no version. Also add the symbol without a version if 6686 appropriate. 6687 (do_define_in_output_data): If resolving with oldsym, don't delete 6688 sym. 6689 (do_define_in_output_segment): Likewise. 6690 (do_define_as_constant): Likewise. 6691 * symtab.h (class Symbol_table): Update declarations. 6692 66932009-03-13 Ian Lance Taylor <iant@google.com> 6694 6695 * readsyms.cc (Read_symbols::incompatible_warning): New function. 6696 (Read_symbols::requeue): New function. 6697 (Read_symbols::do_read_symbols): If make_elf_object fails because 6698 the target type is not configured, and the file was searched for, 6699 issue a warning and retry with the next directory. 6700 (Add_symbols::run): If the file has an incompatible format, and 6701 it was searched for, requeue the Read_symbols task. On error, 6702 release the object. 6703 * readsyms.h (class Read_symbols): Add dirindex_ field. Add 6704 dirindex parameter to constructor. Change all callers. Declare 6705 incompatible_warning and requeue. 6706 (class Add_symbols): Add dirpath_, dirindex_, mapfile_, 6707 input_argument_ and input_group_ fields. Add them to 6708 constructor. Change all callers. 6709 (class Read_script): Add dirindex_ field. Add it to constructor. 6710 Change all callers. 6711 * archive.cc (Archive::setup): Remove input_objects parameter. 6712 Change all callers. 6713 (Archive::get_file_and_offset): Likewise. 6714 (Archive::read_all_symbols): Likewise. 6715 (Archive::read_symbols): Likewise. 6716 (Archive::get_elf_object_for_member): Remove input_objects 6717 parameter. Add punconfigured parameter. Change all callers. 6718 (Archive::add_symbols): Change return type to bool. Check return 6719 value of include_member. 6720 (Archive::include_all_members): Likewise. 6721 (Archive::include_member): Change return type to bool. Return 6722 false if first included object has incompatible target. Set 6723 included_member_ field. 6724 (Add_archive_symbols::run): If add_symbols returns false, requeue 6725 Read_symbols task. 6726 * archive.h (class Archive): Add included_member_ field. 6727 Initialize it in constructor. Add input_file and searched_for 6728 methods. Update declarations. 6729 (class Add_archive_symbols): Add dirpath_, dirindex_, and 6730 input_argument_ fields. Add them to constructor. Change all 6731 callers. 6732 * script.cc: Include "target-select.h". 6733 (class Parser_closure): Add skip_on_incompatible_target_ and 6734 found_incompatible_target_ fields. Add 6735 skip_on_incompatible_target parameter to constructor. Change all 6736 callers. Add methods skip_on_incompatible_target, 6737 clear_skip_on_incompatible_target, found_incompatible_target, and 6738 set_found_incompatible_target. 6739 (read_input_script): Add dirindex parameter. Change all callers. 6740 If parser finds an incompatible target, requeue Read_symbols 6741 task. 6742 (script_set_symbol): Clear skip_on_incompatible_target in 6743 closure. 6744 (script_add_assertion, script_parse_option): Likewise. 6745 (script_start_sections, script_add_phdr): Likewise. 6746 (script_check_output_format): New function. 6747 * script.h (read_input_script): Update declaration. 6748 * script-c.h (script_check_output_format): Declare. 6749 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT. 6750 (ignore_cmd): Remove OUTPUT_FORMAT. 6751 * fileread.cc (Input_file::Input_file): Add explicit this. 6752 (Input_file::will_search_for): New function. 6753 (Input_file::open): Add pindex parameter. Change all callers. 6754 * fileread.h (class Input_file): Add input_file_argument method. 6755 Declare will_search_for. Update declarations. 6756 * object.cc (make_elf_object): Add punconfigured parameter. 6757 Change all callers. 6758 * object.h (class Object): Make input_file public. Add 6759 searched_for method. 6760 (make_elf_object): Update declaration. 6761 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to 6762 restart search. 6763 * dirsearch.h (class Dirsearch): Update declaration. 6764 * options.h (class General_options): Add --warn-search-mismatch. 6765 * parameters.cc (Parameters::is_compatible_target): New function. 6766 * parameters.h (class Parameters): Declare is_compatible_target. 6767 * workqueue.cc (Workqueue::add_blocker): New function. 6768 * workqueue.h (class Workqueue): Declare add_blocker. 6769 6770 * fileread.cc (Input_file::open): Remove options parameter. 6771 Change all callers. 6772 (Input_file::open_binary): Likewise. 6773 * script.cc (read_input_script): Likewise. 6774 * readsyms.h (class Read_symbols): Remove options_ field. Remove 6775 options parameter from constructor. Change all callers. 6776 (class Read_script): Likewise. 6777 * fileread.h (class Input_file): Update declarations. 6778 * script.h (read_input_script): Update declaration. 6779 67802009-03-10 Nick Clifton <nickc@redhat.com> 6781 6782 * po/es.po: New Spanish translation. 6783 67842009-03-06 Cary Coutant <ccoutant@google.com> 6785 6786 * options.cc (parse_short_option): Keep dash_z from registering itself. 6787 67882009-03-03 Ian Lance Taylor <iant@google.com> 6789 6790 PR 9918 6791 * target-reloc.h (relocate_section): Pass output_section to 6792 relocate. 6793 * i386.cc (Target_i386::should_apply_static_reloc): Add 6794 output_section parameter. Change all callers. 6795 (Target_i386::Relocate::relocate): Add output_section parameter. 6796 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise. 6797 * sparc.cc (Target_sparc::Relocate::relocate): Likewise. 6798 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise. 6799 * testsuite/two_file_shared.sh: New script. 6800 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh. 6801 (check_DATA): Add two_file_shared.dbg. 6802 (two_file_shared.dbg): New target. 6803 * testsuite/Makefile.in: Rebuild. 6804 68052009-03-01 Ian Lance Taylor <iant@google.com> 6806 6807 * configure.ac: Check for byteswap.h. 6808 * configure: Rebuild. 6809 * config.in: Rebuild. 6810 68112009-03-01 Mikolaj Zalewski <mikolajz@google.com> 6812 6813 * layout.cc (Layout::find_or_add_kept_section): New function. 6814 (Layout::add_comdat): Removed. 6815 * layout.h (struct Kept_section): Move out of class Layout. 6816 Remove trailing underscores from field names. Add group_sections 6817 field. Rename group_ field to is_group. Change all uses. 6818 (class Layout): Declare find_or_add_kept_section, not add_comdat. 6819 * object.cc (Sized_relobj::Sized_relobj): Don't initialize 6820 comdat_groups_ field. 6821 (Sized_relobj::include_section_group): Use 6822 find_or_add_kept_section and Kept_section::group_sections. 6823 (Sized_relobj::include_linkonce_section): Likewise. 6824 * object.cc (class Sized_relobj): Don't define Comdat_group or 6825 Comdat_group_table. Remove find_comdat_group and 6826 add_comdat_group. Remove comdat_groups_ field. 6827 * plugin.cc (include_comdat_group): Use 6828 Layout::find_or_add_kept_section. 6829 68302009-02-28 Ian Lance Taylor <iant@google.com> 6831 6832 * README: --gc-sections and map files are now supported. Document 6833 some build requirements. 6834 6835 PR 6992 6836 * symtab.cc (Symbol_table::sized_write_section_symbol): In a 6837 relocatable link set the value of the section symbol to zero. 6838 * object.cc (Sized_relobj::do_finalize_local_symbols): In a 6839 relocatable link don't include the section address in the local 6840 symbol value. 6841 68422009-02-27 Ian Lance Taylor <iant@google.com> 6843 6844 PR 6811 6845 * options.h (class Search_directory): Add is_system_directory. 6846 (class General_options): Declare is_in_system_directory. 6847 * options.cc (get_relative_sysroot): Make static. 6848 (get_default_sysroot): Make static. 6849 (General_optoins::is_in_system_directory): New function. 6850 * fileread.cc (Input_file::is_in_system_directory): New function. 6851 * fileread.h (class Input_file): Declare is_in_system_directory. 6852 * object.h (class Object): Add is_in_system_directory. 6853 (class Input_objects): Remove system_library_directory_ field. 6854 * object.cc (Input_objects::add_object): Don't set 6855 system_library_directory_. 6856 (input_objects::found_in_system_library_directory): Remove. 6857 * symtab.cc (Symbol_table::write_globals): Remove input_objects 6858 parameter. Change all callers. 6859 (Symbol_table::sized_write_globals): Likewise. 6860 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise. 6861 Call Object::is_in_system_directory. 6862 * symtab.h (class Symbol_table): Update declarations. 6863 6864 PR 5990 6865 * descriptors.h (Open_descriptor): Add is_on_stack field. 6866 * descriptors.cc (Descriptors::open): If the descriptor is on the 6867 top of the stack, remove it. Initialize is_on_stack field. 6868 (Descriptors::release): Only add pod to stack if it is not on the 6869 stack already. 6870 (Descriptors::close_some_descriptor): Clear stack_next and 6871 is_on_stack fields. 6872 6873 PR 7091 6874 * output.cc (Output_section::find_starting_output_address): Rename 6875 from starting_output_address; add PADDR parameter; change return 6876 type. 6877 * output.h (class Output_section): Declare 6878 find_starting_output_address instead of starting_output_address. 6879 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a 6880 section symbol for which we can't find a merge section. 6881 6882 PR 9836 6883 * symtab.cc (Symbol_table::add_from_object): If the visibility is 6884 hidden or internal, force the symbol to be local. 6885 * resolve.cc (Symbol::override_visibility): Define. 6886 (Symbol::override_base): Use override_visibility. 6887 (Symbol_table::resolve): Likewise. 6888 (Symbol::override_base_with_special): Likewise. 6889 (Symbol_table::override_with_special): If the visibility is hidden 6890 or internal, force the symbol to be local. 6891 * symtab.h (class Symbol): Add set_visibility and 6892 override_visibility. 6893 * testsuite/ver_test_1.sh: New file. 6894 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh. 6895 (check_DATA): Add ver_test_1.syms. 6896 (ver_test_1.syms): New target. 6897 * testsuite/Makefile.in: Rebuild. 6898 68992009-02-25 Cary Coutant <ccoutant@google.com> 6900 6901 * layout.cc (Layout::choose_output_section): Don't rename sections 6902 when using a linker script that has a SECTIONS clause. 6903 * Makefile.in: Regenerate. 6904 6905 * testsuite/Makefile.am (script_test_5.sh): New test case. 6906 * testsuite/Makefile.in: Regenerate. 6907 * testsuite/script_test_5.cc: New file. 6908 * testsuite/script_test_5.sh: New file. 6909 * testsuite/script_test_5.t: New file. 6910 69112009-02-13 Rafael Avila de Espindola <espindola@google.com> 6912 6913 * archive.cc (Archive::include_member): Update calls to add_symbols. 6914 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add 6915 the Layout argument. 6916 * dynobj.h (do_add_symbols): Add the Layout argument. 6917 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the 6918 Layout argument. 6919 * object.h (Object::add_symbols): Add the Layout argument. 6920 (Object::do_add_symbols): Add the Layout argument. 6921 (Sized_relobj::do_add_symbols): Add the Layout argument. 6922 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols): 6923 Unify the two versions. 6924 (Add_plugin_symbols): Remove. 6925 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove. 6926 (Sized_pluginobj::do_add_symbols): Unify the two versions. 6927 (Add_plugin_symbols): Remove. 6928 * readsyms.cc (Read_symbols::do_read_symbols): Update call to 6929 Add_symbols. Use Add_symbols instead of Add_plugin_symbols. 6930 (Add_symbols::run): Make it work with Pulginobj. 6931 69322009-02-06 Ian Lance Taylor <iant@google.com> 6933 6934 * object.cc (Sized_relobj::do_layout): Make info message start 6935 with lower case letter. 6936 69372009-02-06 Mikolaj Zalewski <mikolajz@google.com> 6938 6939 * binary.cc: Fix file comment. 6940 6941 * options.h (enum Incremental_disposition): Define. 6942 (class General_options): Add new options: --incremental, 6943 --incremental_changed, --incremental_unchanged, 6944 --incremental_unknown. Add incremental_disposition_ and 6945 implicit_incremental_ fields. 6946 (General_options::incremental_disposition): New function. 6947 (class Position_dependent_options): Add incremental_disposition 6948 option. 6949 (Position_dependent_options::copy_from_options): Set incremental 6950 dispositions. 6951 * options.cc (General_options::parse_incremental_changed): New 6952 function. 6953 (General_options::parse_incremental_unchanged): New function. 6954 (General_options::parse_incremental_unknown): New function. 6955 (General_options::General_options): Initialize new fields 6956 incremental_disposition_ and implicit_incremental_. 6957 (General_options::finalize): Check for uasge of --incremental-* 6958 without --incremental. 6959 69602009-02-06 Chris Demetriou <cgd@google.com> 6961 6962 * gold.h (gold_undefined_symbol): Change to take only a Symbol 6963 pointer and to report location as the file name associated with 6964 the symbol. 6965 (gold_undefined_symbol_at_location): New function to replace the 6966 old gold_undefined_symbol functionality. 6967 * target-reloc.h (relocate_section): Update to use 6968 gold_undefined_symbol_at_location. 6969 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol): 6970 Call gold_undefined_symbol function rather than gold_error. 6971 * errors.h (Errors::undefined_symbol): Take location as a 6972 string, rather than calculating it from a relocation. 6973 * errors.cc (Errors::fatal): Print "fatal error:" before the 6974 formatted message. 6975 (Errors::error, Errors::error_at_location): Print "error: " 6976 before the formatted message. 6977 (Errors::undefined_symbol): Take location as a string, rather 6978 than calculating it from a relocation. 6979 (gold_undefined_symbol_at_location): New function akin to 6980 old gold_undefined_symbol, calculates location from relocation. 6981 (gold_undefined_symbol): Change to take only a Symbol pointer 6982 and to report location as the file name associated with the symbol. 6983 * testsuite/debug_msg.sh: Update for changed error messages. 6984 * testsuite/undef_symbol.sh: Likewise. 6985 69862009-02-04 Duncan Sands <baldrick@free.fr> 6987 6988 PR 9812 6989 * reduced_debug_output.h 6990 (Output_reduced_debug_abbrev_section::failed): Use format for 6991 gold_warning. 6992 (Output_reduced_debug_info_section::faild): Likewise. 6993 69942009-01-31 Mikolaj Zalewski <mikolajz@google.com> 6995 6996 * script.cc (Lazy_demangler): New class. 6997 (Version_script_info::get_symbol_version_helper): Demangle a 6998 symbol only once. 6999 70002009-01-29 Cary Coutant <ccoutant@google.com> 7001 7002 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls 7003 to __tls_get_addr. 7004 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise. 7005 70062009-01-28 Ian Lance Taylor <iant@google.com> 7007 7008 * version.cc (version_string): Bump to 1.9. 7009 7010 * gold.h: Include <cstring> and <stdint.h>. 7011 * version.cc: Include <cstdio>. 7012 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a 7013 warning. 7014 * reduced_debug_output.cc (insert_into_vector): Rename from 7015 Insert_into_vector; change all callers. Use Swap_unaligned to 7016 avoid aliasing issue; remove union since it is unnecessary. 7017 70182009-01-27 Sriraman Tallam <tmsriram@google.com> 7019 7020 * Makefile.am (CCFILES): Add gc.cc. 7021 (HFILES): Add gc.h. 7022 * Makefile.in: Regenerate. 7023 * gold.cc (Gc_runner): New class. 7024 (queue_initial_tasks): Call garbage collection related tasks 7025 when corresponding options are invoked. 7026 (queue_middle_gc_tasks): New function. 7027 (queue_middle_tasks): Reorder tasks to allow relocs to be read and 7028 processed early before laying out sections during garbage collection. 7029 * gold.h (queue_middle_gc_tasks): New function. 7030 (is_prefix_of): Move from "layout.cc". 7031 * i386.cc (Target_i386::gc_process_relocs): New function. 7032 * layout.cc (is_prefix_of): Remove. Move to "gold.h" 7033 * main.cc (main): Create object of class "Garbage_collection". 7034 * object.cc (Relobj::copy_symbols_data): New function. 7035 (Relobj::is_section_name_included): New function. 7036 (Sized_relobj::do_layout): Allow this function to be called twice 7037 during garbage collection and defer layout of section during the 7038 first call. 7039 * object.h (Relobj::get_symbols_data): New function. 7040 (Relobj::is_section_name_included): New function. 7041 (Relobj::copy_symbols_data): New function. 7042 (Relobj::set_symbols_data): New function. 7043 (Relobj::get_relocs_data): New function. 7044 (Relobj::set_relocs_data): New function. 7045 (Relobj::is_output_section_offset_invalid): New pure virtual function. 7046 (Relobj::gc_process_relocs): New function. 7047 (Relobj::do_gc_process_relocs): New pure virtual function. 7048 (Relobj::sd_): New data member. 7049 (Sized_relobj::is_output_section_offset_invalid): New function. 7050 (Sized_relobj::do_gc_process_relocs): New function. 7051 * options.h (General_options::gc_sections): Modify to not be a no-op. 7052 (General_options::print_gc_sections): New option. 7053 * plugin.cc (Plugin_finish::run): Remove function call to 7054 Plugin_manager::layout_deferred_objects. Move it to "gold.cc". 7055 * powerpc.cc (Target_powerpc::gc_process_relocs): New function. 7056 * reloc.cc (Read_relocs::run): Add task to process relocs and 7057 determine unreferenced sections when doing garbage collection. 7058 (Gc_process_relocs): New class. 7059 (Sized_relobj::do_gc_process_relocs): New function. 7060 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for 7061 sections that are garbage collected. 7062 * reloc.h (Gc_process_relocs): New class. 7063 * sparc.cc (Target_sparc::gc_process_relocs): New function. 7064 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for 7065 symbols whose corresponding sections are garbage collected. 7066 (Symbol_table::Symbol_table): Add new parameter for the garbage 7067 collection object. 7068 (Symbol_table::gc_mark_undef_symbols): New function. 7069 (Symbol_table::gc_mark_symbol_for_shlib): New function. 7070 (Symbol_table::gc_mark_dyn_syms): New function. 7071 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects 7072 as garbage. 7073 (Symbol_table::add_from_object): Likewise. 7074 (Symbol_table::add_from_relobj): When building shared objects, do not 7075 treat externally visible symbols as garbage. 7076 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol 7077 table information for static and relocatable links. 7078 * symtab.h (Symbol_table::set_gc): New function. 7079 (Symbol_table::gc): New function. 7080 (Symbol_table::gc_mark_undef_symbols): New function. 7081 (Symbol_table::gc_mark_symbol_for_shlib): New function. 7082 (Symbol_table::gc_mark_dyn_syms): New function. 7083 (Symbol_table::gc_): New data member. 7084 * target.h (Sized_target::gc_process_relocs): New pure virtual 7085 function. 7086 * x86_64.cc (Target_x86_64::gc_process_relocs): New function. 7087 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function. 7088 70892009-01-20 Chris Faylor <me.sourceware@sourceware.org> 7090 7091 * options.h (General_options::gc_sections): Define as a no-op for now. 7092 (General_options::no_keep_memory): Ditto. 7093 (General_options::Bshareable): Define. 7094 * options.cc (General_options::finalize): Honor -Bshareable. 7095 70962009-01-20 Andreas Schwab <schwab@suse.de> 7097 7098 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to 7099 read the value in the contents, since we don't use it. Use the 7100 template endianness when writing. 7101 (Relocate::relocate): Use it for R_PPC_REL16_HA. 7102 71032009-01-19 Andreas Schwab <schwab@suse.de> 7104 7105 * configure.tgt (powerpc64-*): Fix targ_obj. 7106 71072009-01-15 Ian Lance Taylor <iant@google.com> 7108 7109 * object.cc (Sized_relobj::write_local_symbols): Don't write out 7110 local symbols when stripping all symbols. 7111 71122009-01-14 Cary Coutant <ccoutant@google.com> 7113 7114 * output.cc (Output_reloc): Add explicit instantiations. 7115 71162009-01-14 Cary Coutant <ccoutant@google.com> 7117 7118 * archive.cc (Archive::get_elf_object_for_member): Remove call 7119 to File_read::claim_for_plugin. 7120 * descriptors.cc (Descriptors::open): Remove reference to 7121 is_claimed. 7122 (Descriptors::claim_for_plugin): Remove. 7123 * descriptors.h (Descriptors::claim_for_plugin): Remove. 7124 (Descriptors::is_claimed): Remove. 7125 (claim_descriptor_for_plugin): Remove. 7126 * fileread.cc (File_read::claim_for_plugin): Remove. 7127 * fileread.h (File_read::claim_for_plugin): Remove. 7128 (File_read::descriptor): Reopen descriptor if necessary. 7129 * plugin.cc (Plugin::load): Add two new APIs to transfer vector. 7130 (Plugin_manager::all_symbols_read): Add task parameter. Change 7131 all callers. 7132 (Plugin_manager::get_input_file): New function. 7133 (Plugin_manager::release_input_file): New function. 7134 (Pluginobj::Pluginobj): Add filesize parameter and initialize 7135 corresponding data member. 7136 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter 7137 and pass to base constructor. Change all callers. 7138 (get_input_file, release_input_file): New functions. 7139 (make_sized_plugin_object): Add filesize parameter. Change all callers. 7140 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member. 7141 (Plugin_manager::all_symbols_read): Add task parameter. 7142 (Plugin_manager::get_input_file): New function. 7143 (Plugin_manager::release_input_file): New function. 7144 (Plugin_manager::task_): New data member. 7145 (Pluginobj::Pluginobj): Add filesize parameter. 7146 (Pluginobj::filename): New function. 7147 (Pluginobj::descriptor): New function. 7148 (Pluginobj::filesize): New function. 7149 (Pluginobj::filesize_): New data member. 7150 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter. 7151 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to 7152 File_read::claim_for_plugin; use Object::unlock to unlock the file. 7153 7154 * testsuite/Makefile.am (plugin_test_4): New test case for plugins 7155 with archive libraries. 7156 * testsuite/Makefile.in: Regenerate. 7157 * testsuite/plugin_test.c (struct sym_info): New type. 7158 (get_input_file, release_input_file): New static variables. 7159 (onload): Capture new transfer vector entries. 7160 (claim_file_hook): Stop reading at end of file according to filesize. 7161 Factor out parsing of readelf output into separate function. 7162 (all_symbols_read_hook): Exercise get_input_file and release_input_file 7163 APIs and get the source file name from the symbol table. Convert 7164 source file name to corresponding object file name. Print info 7165 message when adding new input files. 7166 (parse_readelf_line): New function. 7167 * testsuite/plugin_test_1.sh: Add checks for new info messages. 7168 * testsuite/plugin_test_2.sh: Likewise. 7169 * testsuite/plugin_test_3.sh: Likewise. 7170 * testsuite/plugin_test_4.sh: New test case. 7171 71722009-01-07 Ian Lance Taylor <iant@google.com> 7173 7174 * version.cc (version_string): Bump to 1.8. 7175 71762008-12-23 Cary Coutant <ccoutant@google.com> 7177 7178 * gold.cc (gold_exit): Call plugin cleanup handlers on exit. 7179 * plugin.cc (Plugin_manager::finish): Rename as 7180 layout_deferred_objects. Move cleanup to separate function. 7181 (Plugin_manager::cleanup): New function. 7182 (Plugin_finish::run): Call layout_deferred_objects and cleanup 7183 separately. 7184 * plugin.h (Plugin_manager::finish): Rename as 7185 layout_deferred_objects. 7186 (Plugin_manager::cleanup): New function. 7187 (Plugin_manager::cleanup_done): New field. 7188 71892008-12-23 Cary Coutant <ccoutant@google.com> 7190 7191 * plugin.cc (is_visible_from_outside): New function. 7192 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside 7193 so we don't return "IR only" status for exported symbols or -r links. 7194 7195 * testsuite/Makefile.am (plugin_test_3): New test case. 7196 * testsuite/Makefile.in: Regenerate. 7197 * testsuite/plugin_test_3.sh: New file. 7198 71992008-12-22 Cary Coutant <ccoutant@google.com> 7200 7201 * object.cc (Sized_relobj::layout_section): New function. 7202 (Sized_relobj::do_layout): Defer layout of input sections until after 7203 plugin has provided replacement files. 7204 (Sized_relobj::do_layout_deferred_sections): New function. 7205 * object.h (Relobj::set_section_offset): Remove virtual keyword. 7206 (Relobj::layout_deferred_sections): New function. 7207 (Relobj::do_layout_deferred_sections): New function. 7208 (Sized_relobj::do_layout_deferred_sections): New function. 7209 (Sized_relobj::layout_section): New function. 7210 (Sized_relobj::Deferred_layout): New structure. 7211 (Sized_relobj::deferred_layout_): New field. 7212 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup. 7213 Change all callers. Layout deferred sections. 7214 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all 7215 references. 7216 (Plugin_hook::run): Move code from do_plugin_hook inline. 7217 (Plugin_hook::do_plugin_hook): Remove. 7218 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers. 7219 (Plugin_manager::finish): Renamed, was cleanup. 7220 (Plugin_manager::should_defer_layout): New function. 7221 (Plugin_manager::add_deferred_layout_object): New function. 7222 (Plugin_manager::Deferred_layout_list): New type. 7223 (Plugin_manager::deferred_layout_objects_): New field. 7224 (Plugin_hook::do_plugin_hook): Remove. 7225 72262008-12-17 Ian Lance Taylor <iant@google.com> 7227 7228 * options.h (class General_options): Add --no case for 7229 --export-dynamic. 7230 72312008-12-16 Cary Coutant <ccoutant@google.com> 7232 7233 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer 7234 vector. 7235 (Plugin_manager::claim_file): Create plugin object even if 7236 plugin did not call the add_symbols callback. 7237 (Plugin_obj::get_symbol_resolution_info): Guard against plugin 7238 asking for more symbols than were added. 7239 * testsuite/Makefile.am (plugin_test_1): Add test case with 7240 no global symbols. 7241 (empty.syms): New target. 7242 * testsuite/Makefile.in: Regenerate. 7243 * testsuite/plugin_test.c (claim_file_hook): Add new debug 7244 message. Don't call add_symbols if no globals. 7245 (all_symbols_read_hook): Don't provide replacement for empty 7246 claimed file. 7247 72482008-12-12 Ian Lance Taylor <iant@google.com> 7249 7250 * target-reloc.h (Default_scan_relocatable_relocs): Only discard 7251 r_type == 0 for a local symbol with r_sym == 0. 7252 (scan_relocatable_relocs): Pass r_sym to 7253 local_non_section_strategy. 7254 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add 7255 r_sym parameter. 7256 7257 * configure.ac: Update test for TLS descriptors: they are 7258 supported as of glibc 2.9. 7259 * configure: Rebuild. 7260 72612008-12-11 Ian Lance Taylor <iant@google.com> 7262 7263 PR 7091 7264 * target-reloc.h (Default_scan_relocatable_relocs): For each 7265 function, map r_type == 0 to RELOC_DISCARD. 7266 72672008-12-10 Cary Coutant <ccoutant@google.com> 7268 7269 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement 7270 object to override a kept COMDAT group from a plugin object. 7271 72722008-12-09 Ian Lance Taylor <iant@google.com> 7273 7274 PR 7088 7275 * yyscript.y (file_cmd): Handle INPUT. 7276 7277 * testsuite/initpri1.c: Change all declarations to be full 7278 prototypes by adding void, to avoid compiler warnings. 7279 72802008-12-05 Rafael Avila de Espindola <espindola@google.com> 7281 7282 * options.cc (General_options::parse_plugin_opt): New. 7283 (General_options::add_plugin): The argument now is just the filename. 7284 (General_options::add_plugin_option): New. 7285 * options.h (plugin_opt): New. 7286 (add_plugin): Change argument name. 7287 (add_plugin_option): New. 7288 * plugin.cc (Plugin::load): Don't parse the plugin option. 7289 * plugin.h (Plugin::Plugin): Rename argument. Init filename_. 7290 (Plugin::add_option): New. 7291 (Plugin::args_): Change type. 7292 (Plugin::filename_): New. 7293 (Plugin_manager::add_plugin_option): New. 7294 * testsuite/Makefile.am (plugin_test_1): Use new syntax. 7295 * testsuite/Makefile.in: Regenerate. 7296 72972008-12-05 Cary Coutant <ccoutant@google.com> 7298 7299 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE. 7300 Handle --strip-lto-sections option. 7301 * options.h (strip_lto_sections): New option. 7302 73032008-12-01 Cary Coutant <ccoutant@google.com> 7304 7305 * plugin.cc (ld_plugin_message): Change format parameter to const. 7306 Fix mismatch between new[] and delete. 7307 73082008-11-14 Cary Coutant <ccoutant@google.com> 7309 7310 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address 7311 instead of -1U. 7312 73132008-11-05 Craig Silverstein <csilvers@google.com> 7314 7315 * options.cc (General_options::parse_dynamic_list): New function. 7316 * options.h (General_options): New flags dynamic_list, 7317 dynamic_list_data, dynamic_list_cpp_new, and 7318 dynamic_list_cpp_typeinfo. New variable dynamic_list_. 7319 (General_options::in_dynamic_list): New function. 7320 * script.cc (Lex::Mode): New enum DYNAMIC_LIST. 7321 (Lex::can_start_name): Add support for DYNAMIC_LIST mode. 7322 (Lex::can_continue_name): Likewise. 7323 (yylex): Likewise. 7324 (read_script_file): New parameter script_options. 7325 (read_dynamic_list): New function. 7326 (Script_options::define_dynamic_list): New function. 7327 (dynamic_list_keyword_parsecodes): New variable. 7328 (dynamic_list_keywords): New variable. 7329 * script.h (Script_options::define_dynamic_list): New function 7330 prototype. 7331 (read_dynamic_list): New function prototype. 7332 * symtab.cc (strprefix): New macro. 7333 (Symbol::should_add_dynsym_entry): Support dynamic_list, 7334 dynamic_list_data, dynamic_list_cpp_new, and 7335 dynamic_list_cpp_typeinfo. 7336 * yyscript.y (PARSING_DYNAMIC_LIST): New token. 7337 (dynamic_list_expr): New rule. 7338 (dynamic_list_nodes): Likewise. 7339 (dynamic_list_node): Likewise. 7340 * testsuite/Makefile.am (dynamic_list): New test. 7341 * testsuite/Makefile.in: Regenerated. 7342 * testsuite/dynamic_list.t: New file. 7343 * testsuite/dynamic_list.sh: New file. 7344 73452008-11-05 Craig Silverstein <csilvers@google.com> 7346 7347 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last. 7348 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype. 7349 (t11_last): Likewise. 7350 * testsuite/ver_test_6.c (main): Likewise. 7351 73522008-10-07 Cary Coutant <ccoutant@google.com> 7353 7354 * options.c (General_options::finalize): Add check for -static and 7355 -shared. 7356 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects 7357 is not empty. 7358 73592008-10-02 Cary Coutant <ccoutant@google.com> 7360 7361 * plugin.cc (make_sized_plugin_object): Fix conditional 7362 compilation to work when not all targets are enabled. 7363 73642008-09-29 Cary Coutant <ccoutant@google.com> 7365 7366 * archive.cc (Archive::get_file_and_offset): Use filename instead 7367 of name to get library path. 7368 (Archive::include_member): Unlock external member of a thin archive. 7369 7370 * testsuite/Makefile.am (TEST_AR): New variable. 7371 (thin_archive_test_1): New test. 7372 (thin_archive_test_2): New test. 7373 * testsuite/Makefile.in: Regenerate. 7374 * testsuite/thin_archive_main.cc: New file. 7375 * testsuite/thin_archive_test_1.cc: New file. 7376 * testsuite/thin_archive_test_2.cc: New file. 7377 * testsuite/thin_archive_test_3.cc: New file. 7378 * testsuite/thin_archive_test_4.cc: New file. 7379 73802008-09-29 Cary Coutant <ccoutant@google.com> 7381 7382 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL. 7383 * object.cc (Sized_relobj::do_layout): Use constant invalid_address 7384 instead of -1U. 7385 (Sized_relobj::do_finalize_local_symbols): Likewise. 7386 (Sized_relobj::map_to_kept_section): Likewise. 7387 * object.h (Sized_relobj::invalid_address): New constant. 7388 (Sized_relobj::do_output_section_offset): Check for invalid_address 7389 and return -1ULL. 7390 * output.cc (Output_reloc::local_section_offset): Use constant 7391 invalid_address instead of -1U. 7392 (Output_reloc::get_address): Likewise. 7393 (Output_section::output_address): Change -1U to -1ULL. 7394 * output.h (Output_reloc::invalid_address): New constant. 7395 * reloc.cc (Sized_relobj::write_sections): Use constant 7396 invalid_address instead of -1U. 7397 (Sized_relobj::relocate_sections): Likewise. 7398 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol 7399 values for merge sections. 7400 * target-reloc.h (relocate_for_relocatable): Use constant 7401 invalid_address instead of -1U. 7402 74032008-09-19 Cary Coutant <ccoutant@google.com> 7404 7405 Add plugin functionality for link-time optimization (LTO). 7406 * configure.ac (plugins): Add --enable-plugins option. 7407 * configure: Regenerate. 7408 * config.in: Regenerate. 7409 * Makefile.am (LIBDL): New variable. 7410 (CCFILES): Add plugin.cc. 7411 (HFILES): Add plugin.h. 7412 (ldadd_var): Add LIBDL. 7413 * Makefile.in: Regenerate. 7414 7415 * archive.cc: Include "plugin.h". 7416 (Archive::setup): Don't preread archive symbols when using a plugin. 7417 (Archive::get_file_and_offset): Add memsize parameter. Change callers. 7418 (Archive::get_elf_object_for_member): Call plugin hooks for claiming 7419 files. 7420 (Archive::include_member): Add symbols from plugin objects. 7421 * archive.h (Archive::get_file_and_offset): Add memsize parameter. 7422 * descriptors.cc (Descriptors::open): Check for file descriptors 7423 abandoned by plugins. 7424 (Descriptors::claim_for_plugin): New function. 7425 * descriptors.h (Descriptors::claim_for_plugin): New function. 7426 (Open_descriptor::is_claimed): New field. 7427 (claim_descriptor_for_plugin): New function. 7428 * fileread.cc (File_read::claim_for_plugin): New function. 7429 * fileread.h (File_read::claim_for_plugin): New function. 7430 (File_read::descriptor): New function. 7431 * gold.cc: Include "plugin.h". 7432 (queue_initial_tasks): Add task to call plugin hooks for generating 7433 new object files. 7434 * main.cc: Include "plugin.h". 7435 (main): Load plugin libraries. 7436 * object.h (Pluginobj): Declare. 7437 (Object::pluginobj): New function. 7438 (Object::do_pluginobj): New function. 7439 (Object::set_target): New function. 7440 * options.cc: Include "plugin.h". 7441 (General_options::parse_plugin): New function. 7442 (General_options::General_options): Initialize plugins_ field. 7443 (General_options::add_plugin): New function. 7444 * options.h (Plugin_manager): Declare. 7445 (General_options): Add --plugin option. 7446 (General_options::has_plugins): New function. 7447 (General_options::plugins): New function. 7448 (General_options::add_plugin): New function. 7449 (General_options::plugins_): New field. 7450 * plugin.cc: New file. 7451 * plugin.h: New file. 7452 * readsyms.cc: Include "plugin.h". 7453 (Read_symbols::do_read_symbols): Check for archive before checking 7454 for ELF file. Call plugin hooks to claim files. 7455 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced 7456 from a real object file; force override when processing replacement 7457 files. 7458 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field. 7459 (Symbol::init_base_object): Likewise. 7460 (Symbol::init_base_output_data): Likewise. 7461 (Symbol::init_base_output_segment): Likewise. 7462 (Symbol::init_base_constant): Likewise. 7463 (Symbol::init_base_undefined): Likewise. 7464 (Symbol::output_section): Assert that object is not a plugin. 7465 (Symbol_table::add_from_pluginobj): New function. 7466 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as 7467 undefined. 7468 (Symbol_table::sized_write_globals): Likewise. 7469 (Symbol_table::add_from_pluginobj): Instantiate template. 7470 * symtab.h (Sized_pluginobj): Declare. 7471 (Symbol::in_real_elf): New function. 7472 (Symbol::set_in_real_elf): New function. 7473 (Symbol::in_real_elf_): New field. 7474 (Symbol_table::add_from_pluginobj): New function. 7475 7476 * testsuite/Makefile.am (AM_CFLAGS): New variable. 7477 (LIBDL): New variable. 7478 (LDADD): Add LIBDL. 7479 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2. 7480 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh. 7481 (check_DATA): Add plugin_test_1.err and plugin_test_2.err. 7482 (MOSTLYCLEANFILES): Likewise. 7483 * testsuite/Makefile.in: Regenerate. 7484 * testsuite/plugin_test.c: New file. 7485 * testsuite/plugin_test_1.sh: New file. 7486 * testsuite/plugin_test_2.sh: New file. 7487 74882008-09-16 Ian Lance Taylor <iant@google.com> 7489 7490 * target-reloc.h (relocate_section): Check whether a symbol is 7491 defined by the ABI before reporting an undefined symbol error. 7492 * target.h (Target::is_defined_by_abi): Make parameter const. 7493 (Target::do_is_defined_by_abi): Likewise. 7494 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise. 7495 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise. 7496 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise. 7497 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise. 7498 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs. 7499 * testsuite/Makefile.in: Rebuild. 7500 7501 * fileread.cc (make_view): Add casts to avoid warning. 7502 75032008-09-16 Alexandre Oliva <aoliva@redhat.com> 7504 7505 * i386.cc (Target_i386::define_tls_base_symbol): Update comments. 7506 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise. 7507 75082008-09-16 Alexandre Oliva <aoliva@redhat.com> 7509 7510 * options.h (General_options::output_is_executable): New. 7511 (General_options::output_is_pie): New. 7512 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START 7513 for shared libraries. 7514 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise. 7515 75162008-09-11 Chris Demetriou <cgd@google.com> 7517 7518 * options.h (origin): New -z option. 7519 * layout.cc (Layout:finish_dynamic_section): If "-z origin" 7520 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN 7521 in DT_FLAGS_1. 7522 75232008-09-05 Cary Coutant <ccoutant@google.com> 7524 7525 * fileread.cc (File_read::make_view): Add check for attempt to map 7526 beyond end of file. 7527 75282008-09-05 Cary Coutant <ccoutant@google.com> 7529 7530 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in 7531 explicit instantiations. 7532 75332008-08-28 Kris Van Hees <kris.van.hees@oracle.com> 7534 7535 PR gold/6858 7536 * options.cc (General_options::finalize): Allow undefined symbols 7537 in shlibs if linking -shared. 7538 7539 PR gold/6859 7540 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined 7541 symbols as not needing a dynsym entry. 7542 75432008-08-20 Craig Silverstein <csilvers@google.com> 7544 7545 * fileread.cc (File_read::open): Do not lock the file unless it 7546 was successfully opened. 7547 75482008-08-14 Cary Coutant <ccoutant@google.com> 7549 7550 * x86_64.cc (Target_x86_64::Relocate::relocat_tls): 7551 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs. 7552 * testsuite/tls_test.cc (struct int128): 128-bit struct 7553 for testing TLS relocs with non-zero addend. 7554 (v12): New TLS variable. 7555 (t12): New test. 7556 (t_last): Add check for v12. 7557 * testsuite/tls_test.h (t12): New function. 7558 * testsuite/tls_test_main.cc (thread_routine): Call new test. 7559 75602008-08-13 Ian Lance Taylor <iant@google.com> 7561 7562 * layout.cc (Layout::attach_allocated_section_to_segment): Don't 7563 set tls_segment_ or relro_segment_. 7564 (Layout::make_output_segment): Set tls_segment_ and relro_segment_ 7565 when appropriate. 7566 * output.h (Output_section::clear_is_relro): New function. 7567 * output.cc (Output_segment::add_output_section): Handle SHF_TLS 7568 sections specially even when output_data_ is empty. 7569 (Output_segment::maximum_alignment): When first section is relro, 7570 only force alignment for PT_LOAD segments. 7571 * script.cc (script_data_segment_align): New function. 7572 (script_data_segment_relro_end): New function. 7573 * script-c.h (script_data_segment_align): Declare. 7574 (script_data_segment_relro_end): Declare. 7575 * script-sections.h (class Script_sections): Declare 7576 data_segment_align and data_segment_relro_end. Add fields 7577 segment_align_index_ and saw_relro_end_. 7578 * script-sections.cc (class Sections_element): Add set_is_relro 7579 virtual function. Add new bool* parameter to place_orphan_here. 7580 Add get_output_section virtual function. 7581 (class Output_section_definition): Add set_is_relro. Add new 7582 bool* parameter to place_orphan_here. Add get_output_section. 7583 Add is_relro_ field. 7584 (Output_section_definition::Output_section_definition): Initialize 7585 evaluated_address_, evaluated_load_address, evaluated_addralign_, 7586 and is_relro_ fields. 7587 (Output_section_definition::place_orphan_here): Add is_relro 7588 parameter. 7589 (Output_section_definition::set_section_addresses): Set relro for 7590 output section. 7591 (Output_section_definition::alternate_constraint): Likewise. 7592 (class Orphan_output_section): Add new bool* parameter to 7593 place_orphan_here. Add get_output_section. 7594 (Orphan_output_section::place_orphan_here): Add is_relro 7595 parameter. 7596 (Script_sections::Script_sections): Initialize 7597 data_segment_align_index_ and saw_relro_end_. 7598 (Script_sections::data_segment_align): New function. 7599 (Script_sections::data_segment_relro_end): New function. 7600 (Script_sections::place_orphan): Set or clear is_relro. 7601 (Script_sections::set_section_addresses): Force alignment of first 7602 TLS section. 7603 * yyscript.y (exp): Call script_data_segment_align and 7604 script_data_segment_relro_end. 7605 * testsuite/relro_script_test.t: New file. 7606 * testsuite/relro_test.cc (using_script): Declare. 7607 (t1, t2): Test using_script. 7608 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test. 7609 (relro_script_test_SOURCES): Define. 7610 (relro_script_test_DEPENDENCIES): Define. 7611 (relro_script_test_LDFLAGS): Define. 7612 (relro_script_test_LDADD): Define. 7613 (relro_script_test.so): New target. 7614 * testsuite/Makefile.in: Rebuild. 7615 76162008-08-06 Cary Coutant <ccoutant@google.com> 7617 7618 * archive.cc (Archive::total_archives, Archive::total_members) 7619 (Archive::total_members_loaded): New variables. 7620 (Archive::setup): Add parameter. Add option to preread 7621 archive symbols. 7622 (Archive::read_armap): Add counter. 7623 (Archive::get_file_and_offset): New function. 7624 (Archive::get_elf_object_for_member): New function. 7625 (Archive::read_all_symbols): New function. 7626 (Archive::read_symbols): New function. 7627 (Archive::add_symbols): Add counters. 7628 (Archive::include_all_members): Use armap to find members if it's 7629 already built. 7630 (Archive::include_member): Skip reading symbols if already read. 7631 Factored code into Archive::get_file_and_offset and 7632 Archive::get_elf_object_for_member. Changed call to 7633 Mapfile::report_include_archive_member. 7634 (Archive::print_stats): New function. 7635 * archive.h: Declare Object and Read_symbols_data classes. 7636 (Archive::Archive): Add initializers for new members. 7637 (Archive::setup): Add parameter. 7638 (Archive::print_stats): New function. 7639 (Archive::total_archives, Archive::total_members) 7640 (Archive::total_members_loaded): New variables. 7641 (Archive::get_file_and_offset): New function. 7642 (Archive::get_elf_object_for_member): New function. 7643 (Archive::read_all_symbols): New function. 7644 (Archive::read_symbols): New function. 7645 (Archive::Archive_member): New class. 7646 (Archive::members_): New member. 7647 (Archive::num_members_): New member. 7648 * main.cc: Include archive.h. 7649 (main): Call Archive::print_stats. 7650 * mapfile.cc (Mapfile::report_include_archive_member): Delete 7651 archive parameter; member_name is now the fully-decorated name. 7652 * mapfile.h (Mapfile::report_include_archive_member): Likewise. 7653 * options.h: (General_options): Add --preread-archive-symbols option. 7654 * readsyms.cc (Read_symbols::do_read_symbols): Change call to 7655 Archive::setup. 7656 76572008-08-04 Ian Lance Taylor <iant@google.com> 7658 7659 * symtab.h (Symbol::use_plt_offset): New function. 7660 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset. 7661 * powerpc.cc (Relocate::relocate): Likewise. 7662 * sparc.cc (Relocate::relocate): Likewise. 7663 * x86_64.cc (Relocate::relocate): Likewise. 7664 * testsuite/weak_plt.sh: New test. 7665 * testsuite/weak_plt_main.cc: New test. 7666 * testsuite/weak_plt_shared.cc: New test. 7667 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh. 7668 (check_PROGRAMS): Add weak_plt. 7669 (check_DATA): Add weak_plt_shared.so. 7670 (weak_plt_main_pic.o, weak_plt): New targets. 7671 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets. 7672 * testsuite/Makefile.in: Rebuild. 7673 7674 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon 7675 gcctestdir/ld. 7676 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise. 7677 * testsuite/Makefile.in: Rebuild. 7678 76792008-08-04 Alan Modra <amodra@bigpond.net.au> 7680 7681 * Makefile.am (POTFILES.in): Set LC_ALL=C. 7682 * Makefile.in: Regenerate. 7683 * po/POTFILES.in: Regenerate. 7684 76852008-07-29 Ian Lance Taylor <iant@google.com> 7686 7687 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS 7688 symbols before other symbols. 7689 * testsuite/script_test_2.cc (test_addr): Declare. 7690 (test_addr_alias): Declare. 7691 (main): Check that test_addr and test_addr_alias have the right 7692 values. 7693 * testsuite/script_test_2.t: Define test_addr_alias and 7694 test_addr. 7695 76962008-07-24 Ian Lance Taylor <iant@google.com> 7697 7698 PR 5990 7699 * descriptors.cc: New file. 7700 * descriptors.h: New file. 7701 * gold-threads.h (class Hold_optional_lock): New class. 7702 * fileread.cc: Include "descriptors.h". 7703 (File_read::~File_read): Release descriptor rather than closing 7704 it. 7705 (File_read::open) [file]: Call open_descriptor rather than open. 7706 Set is_descriptor_opened_. 7707 (File_read::open) [memory]: Assert that descriptor is not open. 7708 (File_read::reopen_descriptor): New function. 7709 (File_read::release): Release descriptor. 7710 (File_read::do_read): Make non-const. Reopen descriptor. 7711 (File_read::read): Make non-const. 7712 (File_read::make_view): Reopen descriptor. 7713 (File_read::do_readv): Likewise. 7714 * fileread.h (class File_read): Add is_descriptor_opened_ field. 7715 Update declarations. 7716 * layout.cc: Include "descriptors.h". 7717 (Layout::create_build_id): Use open_descriptor rather than open. 7718 * output.cc: Include "descriptors.h". 7719 (Output_file::open): Use open_descriptor rather than open. 7720 * archive.cc (Archive::const_iterator): Change Archive to be 7721 non-const. 7722 (Archive::begin, Archive::end): Make non-const. 7723 (Archive::count_members): Likewise. 7724 * archive.h (class Archive): Update declarations. 7725 * object.h (Object::read): Make non-const. 7726 * Makefile.am (CCFILES): Add descriptors.cc. 7727 (HFILES): Add descriptors.h. 7728 * Makefile.in: Rebuild. 7729 7730 PR 6716 7731 * gold.h: Always include <clocale>. Add Solaris workarounds 7732 following code in binutils/sysdep.h. 7733 7734 PR 6048 7735 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether 7736 this->eh_frame_hdr_ is NULL before using it. 7737 7738 * dynobj.cc (Versions::Versions): Update comment. 7739 7740 * dynobj.cc (Versions::Versions): If there is an soname, use it as 7741 the base version name. 7742 7743 * stringpool.cc (Stringpool_template::add_with_length): Set key to 7744 array size plus one. 7745 (Stringpool_template::set_string_offsets): Subtract one from key 7746 before using it as an array index. 7747 (Stringpool_template::get_offset_with_length): Likewise. 7748 (Stringpool_template::write_to_buffer): Likewise. 7749 * stringpool.h (Stringpool_template::get_offset_from_key): 7750 Likewise. 7751 77522008-07-23 Ian Lance Taylor <iant@google.com> 7753 7754 PR 6658 7755 * object.h (Merged_symbol_value::value): Do our best to handle a 7756 negative addend. 7757 7758 PR 6647 7759 * script.cc (Version_script_info::get_versions): Don't add empty 7760 version tag to return value. 7761 (Version_script_info::get_symbol_version_helper): Change return 7762 type to bool. Add pversion parameter. Change all callers. 7763 (script_register_vers_node): Don't require a non-NULL tag. 7764 * script.h (class Version_script_info): Update declarations. 7765 (Version_script_info::get_symbol_version): Change return type to 7766 bool. Add version parameter. Change all callers. 7767 * symtab.cc (Sized_symbol::add_from_relobj): Rework version 7768 handling. Handle an empty version from a version script. 7769 (Symbol_table::define_special_symbol): Likewise. 7770 * testsuite/ver_test_10.script: New file. 7771 * testsuite/ver_test_10.sh: New file. 7772 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh. 7773 (check_DATA): Add ver_test_10.syms. 7774 (ver_test_10.syms, ver_test_10.so): New target. 7775 * testsuite/Makefile.in: Rebuild. 7776 77772008-07-23 Simon Baldwin <simonb@google.com> 7778 7779 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size 7780 to zero for undefined symbols from dynamic libraries. 7781 77822008-07-23 Ian Lance Taylor <iant@google.com> 7783 7784 * symtab.cc (Symbol_table::resolve): Remove version parameter. 7785 Change all callers. 7786 * symtab.h (class Symbol_table): Update declaration. 7787 * testsuite/ver_test_9.cc: New file. 7788 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9. 7789 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define. 7790 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define. 7791 (ver_test_9.so, ver_test_9.o): New targets. 7792 * testsuite/Makefile.in: Rebuild. 7793 77942008-07-22 Ian Lance Taylor <iant@google.com> 7795 7796 * options.h (class General_options): Define --check-sections. 7797 * layout.cc (Layout::set_segment_offsets): Handle 7798 --check-sections. 7799 7800 * options.h (class General_options): Define -n/--nmagic and 7801 -N/--omagic. 7802 * options.cc (General_options::finalize): For -n/--nmagic or 7803 -N/--omagic, set -static. 7804 * layout.cc (Layout::attach_allocated_section_to_segment): If 7805 -N/--omagic, don't put read-only and read-write sections in 7806 different segments. 7807 (Layout::find_first_load_seg): If -N/--omagic, don't insist on 7808 finding a read-only segment. 7809 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic, 7810 don't set the minimum segment alignment to the common page size, 7811 and don't set the file offset to the address modulo the page size. 7812 * script-sections.cc (Script_sections::create_segments): If 7813 -n/--omagic, don't put read-only and read-write sections in 7814 different segments. 7815 7816 * cref.cc: New file. 7817 * cref.h: New file. 7818 * options.h (class General_options): Add --print-symbol-counts. 7819 * main.cc (main): Issue defined symbol report if requested. 7820 * archive.cc (Archive::interpret_header): Make into a const member 7821 function. 7822 (Archive::add_symbols): Call Input_objects::archive_start and 7823 archive_stop. 7824 (Archive::const_iterator): Define new class. 7825 (Archive::begin, Archive::end): New functions. 7826 (Archive::include_all_members): Rewrite to use iterator. 7827 (Archive::count_members): New function. 7828 * archive.h (class Archive): Update declarations. 7829 (Archive::filename): New function. 7830 * object.cc: Include "cref.h". 7831 (Sized_relobj::Sized_relobj): Initialize defined_count_. 7832 (Sized_relobj::do_get_global_symbol_counts): New function. 7833 (Input_objects::add_object): Add object to cross-referencer. 7834 (Input_objects::archive_start): New function. 7835 (Input_objects::archive_stop): New function. 7836 (Input_objects::print_symbol_counts): New function. 7837 * object.h: Declare Cref and Archive. 7838 (Object::get_global_symbol_counts): New function. 7839 (Object::do_get_global_symbol_counts): New pure virtual function. 7840 (class Sized_relobj): Add defined_count_ field. Update 7841 declarations. 7842 (class Input_objects): Add cref_ field. Update constructor. 7843 Update declarations. 7844 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and 7845 defined_count_. 7846 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing 7847 symbol counts. 7848 (Sized_dynobj::do_get_global_symbol_counts): New function. 7849 * dynobj.h (class Sized_dynobj): Add fields symbols_ and 7850 defined_count_. Update declarations. Define Symbols typedef. 7851 * symtab.cc (Symbol_table::add_from_relobj): Add defined 7852 parameter. Change all callers. 7853 (Symbol_table::add_from_dynobj): Add sympointers and defined 7854 parameters. Change all callers. 7855 * symtab.h (class Symbol_table): Update declarations. 7856 * Makefile.am (CCFILES): Add cref.cc. 7857 (HFILES): Add cref.h. 7858 * Makefile.in: Rebuild. 7859 78602008-07-22 Simon Baldwin <simonb@google.com> 7861 7862 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size 7863 to zero when writing undefined symbols. 7864 78652008-07-22 Ian Lance Taylor <iant@google.com> 7866 7867 * output.cc (Output_section::add_input_section): Don't try to 7868 merge empty merge sections. 7869 78702008-07-21 Craig Silverstein <csilvers@google.com> 7871 7872 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol): 7873 Include symbol version in error message. 7874 78752008-07-20 Chris Demetriou <cgd@google.com> 7876 7877 * configure.ac (gold_cv_c_random_seed): New configured variable. 7878 (RANDOM_SEED_CFLAGS): New substituted variable. 7879 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS). 7880 * configure: Rebuild. 7881 * Makefile.in: Likewise. 7882 * testsuite/Makefile.in: Likewise. 7883 78842008-07-18 Ian Lance Taylor <iant@google.com> 7885 7886 * symtab.cc (Symbol_table::add_from_object): Rewrite the case 7887 where we see NAME/NULL and NAME/VERSION as separate symbols. 7888 * testsuite/ver_test_main.cc (main): Call t4. 7889 (t4, t4_2a): Define. 7890 * testsuite/ver_test_2.cc (t4_2): Define. 7891 * testsuite/ver_test_2.script: Put t4_2a in VER2. 7892 * testsuite/ver_test_4.cc (t4_2a): Define. 7893 * testsuite/ver_test_4.script: Put t4_2a in VER2. 7894 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare. 7895 78962008-07-17 Ian Lance Taylor <iant@google.com> 7897 7898 * dynobj.cc (Versions::add_def): If we give an error about a 7899 missing version, go ahead and create the version anyhow. 7900 79012008-07-10 Ian Lance Taylor <iant@google.com> 7902 7903 Handle output sections with more than 0x7fffffff bytes. 7904 * object.h (class Relobj): Change map_to_output_ to 7905 output_sections_, and just keep a section pointer. Change all 7906 uses. Move comdat group support to Sized_relobj. 7907 (Relobj::is_section_specially_mapped): Remove. 7908 (Relobj::output_section): Remove poff parameter. Change all 7909 callers. 7910 (Relobj::output_section_offset): New function. 7911 (Relobj::set_section_offset): Rewrite. 7912 (Relobj::map_to_output): Remove. 7913 (Relobj::output_sections): New function. 7914 (Relobj::do_output_section_offset): New pure virtual function. 7915 (Relobj::do_set_section_offset): Likewise. 7916 (class Sized_relobj): Add section_offsets_ field. Add comdat 7917 group support from Relobj. Update declarations. 7918 (Sized_relobj::get_output_section_offset): New function. 7919 (Sized_relobj::do_output_section_offset): New function. 7920 (Sized_relobj::do_set_section_offset): New function. 7921 * object.cc (Relobj::output_section_address): Remove. 7922 (Sized_relobj::Sized_relobj): Initialize new fields. 7923 (Sized_relobj::include_section_group): Cast find_kept_object to 7924 Sized_relobj. 7925 (Sized_relobj::include_linkonce_section): Likewise. 7926 (Sized_relobj::do_layout): Use separate arrays for output section 7927 and output offset. 7928 (Sized_relobj::do_count_local_symbols): Change map_to_output to 7929 output_sections. 7930 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to 7931 output_sections and section_offsets. 7932 (Sized_relobj::write_local_symbols): Likewise. 7933 (map_to_kept_section): Compute output address directly. 7934 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to 7935 output_sections and section_offsets. 7936 (Sized_relobj::write_sections): Likewise. 7937 (Sized_relobj::relocate_sections): Likewise. 7938 * symtab.cc (sized_finalize_symbol): Use output_section_offset. 7939 * output.h (class Output_reloc): Update declarations. Change 7940 u2_.relobj to Sized_relobj*. 7941 (class Output_data_reloc): Change add functions to use 7942 Sized_relobj*. 7943 * output.cc (Output_reloc::Output_reloc): Change relobj to 7944 Sized_relobj*. 7945 (Output_reloc::local_section_offset): Change return type to 7946 Elf_Addr. Use get_output_section_offset. 7947 (Output_reloc::get_address): Likewise. 7948 (Output_section::is_input_address_mapped): Don't call 7949 is_section_specially_mapped. 7950 (Output_section::output_offset): Likewise. 7951 (Output_section::output_address): Likewise. 7952 (Output_section::starting_output_address): Likewise. 7953 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object 7954 parameter to Sized_relobj*. 7955 (Copy_relocs::need_copy_reloc): Likewise. 7956 (Copy_relocs::save): Likewise. 7957 * copy-relocs.h (class Copy_relocs): Update declarations. 7958 (class Copy_relocs::Copy_reloc_entry): Change constructor to use 7959 Sized_relobj*. Change relobj_ field to Sized_relobj*. 7960 * target-reloc.h (relocate_for_relocatable): Change 7961 offset_in_output_section type to Elf_Addr. Change code that uses 7962 it as well. 7963 * layout.cc (Layout::layout): Always set *off. 7964 * mapfile.cc (Mapfile::print_input_section): Use 7965 output_section_offset. 7966 * i386.cc (Target_i386::copy_reloc): Change object parameter to 7967 Sized_relobj*. 7968 * powerpc.cc (Target_powerpc::copy_reloc): Likewise. 7969 * sparc.cc (Target_sparc::copy_reloc): Likewise. 7970 * x86_64.cc (Target_x86_64::copy_reloc): Likewise. 7971 79722008-07-03 Ian Lance Taylor <iant@google.com> 7973 7974 * layout.cc (Layout::include_section): Do not discard unrecognized 7975 SHT_STRTAB sections. 7976 79772008-06-30 Craig Silverstein <csilvers@cs.stanford.edu> 7978 7979 * script.cc (Lex::can_continue_name): Make '?' allowable in 7980 version-script names. 7981 * testsuite/version_script.map: Change glob pattern to use '?' 7982 79832008-06-30 Manish Singh <yosh@gimp.org> 7984 7985 PR 6585 7986 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line): 7987 Correct typo. 7988 79892008-06-30 Ian Lance Taylor <iant@google.com> 7990 7991 PR 6660 7992 PR 6682 7993 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both 7994 versions]: Don't try to read the value in the contents, since we 7995 don't use it. Use the template endianness when writing. 7996 79972008-06-25 Cary Coutant <ccoutant@google.com> 7998 7999 * fileread.cc (File_read::make_view): Assert on zero-length view. 8000 * object.cc (Sized_relobj::do_read_symbols): Don't try to read 8001 symbol table when there are no symbols to read. 8002 80032008-06-23 Craig Silverstein <csilvers@google.com> 8004 8005 * version.cc (version_string): Bump to 1.7 8006 80072008-06-18 Craig Silverstein <csilvers@google.com> 8008 8009 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast 8010 constant 0xFFFF to type Valtype. 8011 (Powerpc_relocate_functions::rel16_ha): Likewise. 8012 80132008-06-17 Ian Lance Taylor <iant@google.com> 8014 8015 * output.h (Output_section::Input_section): Initialize p2align_ to 8016 zero for Output_section_data constructors. 8017 (Output_section::Input_section::addralign): If not an input 8018 section, return the alignment of the Output_section_data. 8019 * testsuite/copy_test.cc: New file. 8020 * testsuite/copy_test_1.cc: New file. 8021 * testsuite/copy_test_2.cc: New file. 8022 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test. 8023 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables. 8024 (copy_test_LDFLAGS, copy_test_LDADD): New variables. 8025 (copy_test_1_pic.o, copy_test_1.so): New targets. 8026 (copy_test_2_pic.o, copy_test_2.so): New targets. 8027 * testsuite/Makefile.in: Rebuild. 8028 8029 * script-sections.cc (Script_sections::place_orphan): Initialize 8030 local variable exact. 8031 80322008-06-13 David Edelsohn <edelsohn@gnu.org> 8033 8034 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC. 8035 80362008-06-12 David Edelsohn <edelsohn@gnu.org> 8037 David S. Miller <davem@davemloft.net> 8038 8039 * powerpc.cc: New file. 8040 * Makefile.am (TARGETSOURCES): Add powerpc.cc 8041 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT) 8042 * configure.tgt: Add entries for powerpc-* and powerpc64-*. 8043 * Makefile.in: Rebuild. 8044 80452008-06-09 Ian Lance Taylor <iant@google.com> 8046 8047 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and 8048 <exception>. 8049 (throwing, orig_terminate): New static variables. 8050 (terminate_handler): New static function. 8051 (t2): Set terminate handler. 8052 80532008-06-05 Kris Van Hees <kris.van.hees@oracle.com> 8054 8055 PR 6584 8056 * binary.cc (Binary_to_elf::sized_convert): Fix .data 8057 alignment. 8058 80592008-05-30 Cary Coutant <ccoutant@google.com> 8060 8061 * archive.cc (Archive::include_all_members) Correct to step 8062 over symbol table and extended name table in thin archives. 8063 80642008-05-29 Kris Van Hees <kris.van.hees@oracle.com> 8065 8066 PR 6407 8067 * target-reloc.h (relocate_for_relocatable): Fix new_offset 8068 calculation. 8069 80702008-05-28 Caleb Howe <cshowe@google.com> 8071 8072 * reduced_debug_output.cc: New file. 8073 * reduced_debug_output.h: New file. 8074 * options.h (class General_options): Add --strip-debug-non-line. 8075 * options.cc (General_options::finalize): Add strip_debug_non_line 8076 to the strip heirarchy. 8077 * layout.h (class Layout): Add debug_abbrev_ and debug_info_ 8078 fields. 8079 * layout.cc: Include "reduced_debug_output.h". 8080 (Layout::Layout): Initialize new fields. 8081 (line_only_debug_sections): New static array. 8082 (is_lines_only_debug_sections): New static inline function. 8083 (Layout::include_section): Handle --strip-debug-non-line. 8084 (Layout::make_output_section): If --strip-debug-non-line, build 8085 new output sections for .debug_abbrev and .debug_info. 8086 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace 8087 gold. Warn about possible overflow. 8088 (read_signed_LEB_128): Likewise. 8089 * dwarf_reader.h: (read_unsigned_LEB_128): Declare. 8090 (read_signed_LEB_128): Declare. 8091 * Makefile.am (CCFILES): Add reduced_debug_output.cc. 8092 (HFILES): Add reduced_debug_output.h. 8093 * Makefile.in: Rebuild. 8094 80952008-05-21 Ian Lance Taylor <iant@google.com> 8096 8097 * mapfile.cc: New file. 8098 * mapfile.h: New file. 8099 * options.h (class General_options): Add -M/--print-map and -Map. 8100 * options.cc (General_options::finalize): Make -M equivalent to 8101 -Map -. 8102 * main.cc: Include <cstdio> and "mapfile.h". 8103 (main): Open mapfile if requested. 8104 * gold.cc (class Middle_runner): Add mapfile_ field. Update 8105 constructor. Change caller. 8106 (queue_initial_tasks): Add mapfile parameter. Change caller. 8107 (queue_middle_tasks): Likewise. 8108 * gold.h (queue_initial_tasks, queue_middle_tasks): Update 8109 declarations. 8110 * archive.cc: Include "mapfile.h". 8111 (Archive::add_symbols): Add mapfile parameter. Change all 8112 callers. Pass mapfile, symbol, and reason to include_member. 8113 (Archive::include_all_members): Add mapfile parameter. Change all 8114 callers. 8115 (Archive::include_member): Add mapfile, sym, and why parameters. 8116 Change all callers. Report inclusion to map file. 8117 * archive.h: Include "fileread.h". 8118 (class Archive): Update declarations. 8119 (Archive::file): New const method. 8120 (class Add_archive_symbols): Add mapfile_ field. Update 8121 constructor. Change all callers. 8122 * readsyms.h (class Read_symbols): Likewise. 8123 (class Finish_group): Likewise. 8124 (class Read_script): Likewise. 8125 * common.cc: Include "mapfile.h". 8126 (Symbol_table::allocate_commons): Add mapfile parameter. Change 8127 all callers. 8128 (Symbol_table::do_allocate_commons): Likewise. 8129 (Symbol_table::do_allocate_commons_list): Likewise. Report common 8130 symbol allocation to mapfile. 8131 * common.h (class Allocate_commons_task): Add mapfile_ field. 8132 Update constructor. Change all callers. 8133 * symtab.h (class Symbol_table): Update declarations. 8134 * layout.cc: Include "mapfile.h". 8135 (Layout_task_runner::run): Print information to mapfile. 8136 (Layout::create_gold_note): Change Output_data_fixed_space to 8137 Output_data_zero_fill. 8138 (Layout::create_build_id): Likewise. 8139 (Layout::print_to_mapfile): New function. 8140 * layout.h (class Layout_task_runner): Add mapfile_ field. Update 8141 constructor. Change caller. 8142 (class Layout): Declare print_to_mapfile. 8143 * output.cc (Output_section::Input_section::print_to_mapfile): New 8144 function. 8145 (Output_section::add_input_section): If producing a map, always 8146 add to input_sections_ list. 8147 (Output_section::do_print_to_mapfile): New function. 8148 (Output_segment::print_sections_to_mapfile): New function. 8149 (Output_segment::print_section_list_to_mapfile): New function. 8150 * output.h: Include "mapfile.h". 8151 (Output_data::print_to_mapfile): New function. 8152 (Output_data::do_print_to_mapfile): New virtual function. 8153 (Output_segment_headers::do_print_to_mapfile): New function. 8154 (Output_file_header::do_print_to_mapfile): New function. 8155 (Output_data_const::do_print_to_mapfile): New function. 8156 (class Output_data_const_buffer): Add map_name_ field. Update 8157 constructor. Change all callers. Add do_print_to_mapfile 8158 function. 8159 (class Output_data_fixed_space): Likewise. 8160 (class Output_data_space): Likewise. 8161 (class Output_data_zero_fill): New class. 8162 (Output_data_strtab::do_print_to_mapfile): New function. 8163 (Output_data_reloc_base::do_print_to_mapfile): New function. 8164 (Output_relocatable_relocs::do_print_to_mapfile): New function. 8165 (Output_data_group::do_print_to_mapfile): New function. 8166 (Output_data_got::do_print_to_mapfile): New function. 8167 (Output_data_dynamic::do_print_to_mapfile): New function. 8168 (Output_symtab_xindex::do_print_to_mapfile): New function. 8169 (class Output_section): Declare do_print_to_mapflie. Declare 8170 print_to_mapfile in Input_section. 8171 (class Output_segment): Declare new functions. 8172 * object.h (Sized_relobj::symbol_count): New function. 8173 * script-sections.cc 8174 (Output_section_element_dot_assignment::set_section_addresses): 8175 Change Output_data_fixed_space to Output_data_zero_fill. 8176 (Output_data_expression::do_print_to_mapfile): New function. 8177 * script.cc (read_input_script): Add mapfile parameter. Change 8178 all callers. 8179 * script.h (read_input_script): Update declaration. 8180 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function. 8181 (Eh_frame::do_print_to_mapfile): New function. 8182 * merge.h (Output_merge_data::do_print_to_mapfile): New function. 8183 (Output_merge_string::do_print_to_mapfile): New function. 8184 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New 8185 function. 8186 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New 8187 function. 8188 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New 8189 function. 8190 * Makefile.am (CCFILES): Add mapfile.cc. 8191 (HFILES): Add mapfile.h. 8192 * Makefile.in: Rebuild. 8193 81942008-05-19 Ian Lance Taylor <iant@google.com> 8195 8196 * options.h (class General_options): Add -z relro. 8197 * layout.cc (Layout::Layout): Initialize relro_segment_. 8198 (Layout::add_output_section_data): Return the output section. 8199 (Layout::make_output_section): Rcognize relro sections and mark 8200 them appropriately. 8201 (Layout::attach_allocated_section_to_segment): Put relro sections 8202 in a PT_GNU_RELRO segment. 8203 (Layout::create_initial_dynamic_sections): Mark the .dynamic 8204 section as relro. 8205 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after 8206 PT_TLS segments. 8207 (Layout::linkonce_mapping): Map d.rel.ro.local to 8208 .data.rel.ro.local. 8209 (Layout::output_section_name): Us .data.rel.ro.local for any 8210 section which begins with that. 8211 * layout.h (class Layout): Update add_output_section_data 8212 declaration. Add relro_segment_ field. 8213 * output.cc (Output_section::Output_section): Initialize is_relro_ 8214 and is_relro_local_ fields. 8215 (Output_segment::add_output_section): Group relro sections. 8216 (Output_segment::is_first_section_relro): New function. 8217 (Output_segment::maximum_alignment): If there is a relro section, 8218 align the segment to the common page size. 8219 (Output_segment::set_section_addresses): Track whether we are 8220 looking at relro sections. If the last section is a relro 8221 section, align to the common page size. 8222 (Output_segment::set_section_list_addresses): Add in_relro 8223 parameter. Change all callers. Align to the page size when 8224 moving from relro to non-relro section. 8225 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO 8226 segment. 8227 * output.h (class Output_section): Add is_relro_ and 8228 is_relro_local_ fields. 8229 (Output_section::is_relro): New function. 8230 (Output_section::set_is_relro): New function. 8231 (Output_section::is_relro_local): New function. 8232 (Output_section::set_is_relro_local): New function. 8233 (class Output_segment): Update declarations. 8234 * i386.cc (Target_i386::got_section): Mark .got section as relro. 8235 * sparc.cc (Target_sparc::got_section): Likewise. 8236 * x86_64.cc (Target_x86_64::got_section): Likewise. 8237 * testsuite/relro_test_main.cc: New file. 8238 * testsuite/relro_test.cc: New file. 8239 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test. 8240 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables. 8241 (relro_test_LDFLAGS, relro_test_LDADD): New variables. 8242 (relro_test.so, relro_test_pic.o): New targets. 8243 * testsuite/Makefile.in: Rebuild. 8244 82452008-05-16 Ian Lance Taylor <iant@google.com> 8246 8247 * output.cc (Output_segment::add_output_section): Remove front 8248 parameter. 8249 * output.h (class Output_segment): Remove 8250 add_initial_output_section and overloaded add_output_section. 8251 Update declaration of remaining add_output_section. 8252 * layout.cc (Layout::create_interp): Call add_output_section 8253 rather than add_initial_output_section. 8254 (Layout::finish_dynamic_section): Likewise. 8255 8256 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type 8257 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we 8258 know the dynamic type. 8259 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_ 8260 field. Initialize it in constructor. 8261 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS 8262 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD. 8263 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block 8264 reloc. 8265 8266 * output.cc (Output_reloc::get_address): Change return type to 8267 Elf_Addr. 8268 * output.h (class Output_reloc): Update get_address declaration. 8269 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types 8270 for section addresses. 8271 82722008-05-09 Ian Lance Taylor <iant@google.com> 8273 8274 PR 6493 8275 * gold.cc (gold_nomem): Use return value of write. 8276 82772008-05-08 Ian Lance Taylor <iant@google.com> 8278 8279 * symtab.c (Symbol::init_base_output_data): Add version 8280 parameter. Change all callers. 8281 (Symbol::init_base_output_segment): Likewise. 8282 (Symbol::init_base_constant): Likewise. 8283 (Symbol::init_base_undefined): Likewise. 8284 (Sized_symbol::init_output_data): Likewise. 8285 (Sized_symbol::init_output_segment): Likewise. 8286 (Sized_symbol::init_constant): Likewise. 8287 (Sized_symbol::init_undefined): Likewise. 8288 (Symbol_table::do_define_in_output_data): If the new symbol has a 8289 version, mark it as the default. 8290 (Symbol_table::do_define_in_output_segment): Likewise. 8291 (Symbol_table::do_define_as_constant): Likewise. 8292 * symtab.h (class Symbol): Update declarations. 8293 (class Sized_symbol): Likewise. 8294 * resolve.cc (Symbol::override_version): New function. 8295 (Symbol::override_base): Call override_version. 8296 (Symbol::override_base_with_special): Likewise. 8297 * testsuite/ver_script_8.script: New file. 8298 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8. 8299 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define. 8300 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define. 8301 (ver_test_8_1.so, ver_test_8_2.so): New targets. 8302 83032008-05-06 Ian Lance Taylor <iant@google.com> 8304 8305 PR 6049 8306 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end 8307 functions. 8308 (class General_options): Remove existing --undefined, and add 8309 --no-undefined instead. Add new --undefined as synonym for -u. 8310 * archive.cc (Archive::add_symbols): Check whether symbol was 8311 named with -u. 8312 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table. 8313 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change 8314 all uses. Add IS_UNDEFINED. Update declarations to split 8315 different versions of init_base. Declare init_base_undefined. 8316 (Symbol::is_defined): Handle IS_UNDEFINED. 8317 (Symbol::is_undefined): Likewise. 8318 (Symbol::is_weak_undefined): Call is_undefined. 8319 (Symbol::is_absolute): Handle IS_CONSTANT. 8320 (class Sized_symbol): Update declarations to split different 8321 versions of init. Declare init_undefined. 8322 (class Symbol_table): Declare new functions. 8323 * symtab.cc (Symbol::init_base_object): Rename from init_base. 8324 Change all callers. 8325 (Symbol::init_base_output_data): Likewise. 8326 (Symbol::init_base_output_segment): Likewise. 8327 (Symbol::init_base_constant): Likewise. 8328 (Symbol::init_base_undefined): New function. 8329 (Sized_symbol::init_object): Rename from init. Change all 8330 callers. 8331 (Sized_symbol::init_output_data): Likewise. 8332 (Sized_symbol::init_output_segment): Likewise. 8333 (Sized_symbol::init_constant): Likewise. 8334 (Sized_symbol::init_undefined): New function. 8335 (Symbol_table::add_undefined_symbols_from_command_line): New 8336 function. 8337 (Symbol_table::do_add_undefined_symbols_from_command_line): New 8338 function. 8339 (Symbol::final_value_is_known): Handle IS_UNDEFINED. 8340 (Symbol::output_section): Likewise. 8341 (Symbol::set_output_section): Likewise. 8342 (Symbol_table::sized_finalize_symbol): Likewise. 8343 (Symbol_table::sized_write_globals): Likewise. 8344 * resolve.cc (Symbol_table::should_override): Likewise. 8345 (Symbol::override_base_with_special): Likewise. 8346 8347 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected 8348 symbol, change it to have default visibility. 8349 * testsuite/protected_1.cc: New file. 8350 * testsuite/protected_2.cc: New file. 8351 * testsuite/protected_3.cc: New file. 8352 * testsuite/protected_main_1.cc: New file. 8353 * testsuite/protected_main_2.cc: New file. 8354 * testsuite/protected_main_3.cc: New file. 8355 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1. 8356 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define. 8357 (protected_1_LDFLAGS, protected_1_LDADD): Define. 8358 (protected_1.so): New target. 8359 (protected_1_pic.o, protected_2_pic.o): New targets. 8360 (protected_3_pic.o): New target. 8361 (check_PROGRAMS): Add protected_2. 8362 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define. 8363 (protected_2_LDFLAGS, protected_2_LDADD): Define. 8364 * testsuite/Makefile.in: Rebuild. 8365 8366 * options.h (DEFINE_var): Add set_user_set_##varname__. 8367 (DEFINE_bool_alias): New macro. 8368 (class General_options): Define -Bstatic using DEFINE_bool_alias 8369 rather than DEFINE_special. Add --undefined as an alias for -z 8370 defs. 8371 * options.cc (General_options::parse_Bstatic): Remove. 8372 8373 * options.h (class General_options): Add --fatal-warnings. 8374 * main.cc (main): Implement --fatal-warnings. 8375 * errors.h (Errors::warning_count): New function. 8376 8377 * options.h (class General_options): Add -Bsymbolic-functions. 8378 * symtab.h (Symbol::is_preemptible): Check for 8379 -Bsymbolic-functions. 8380 83812008-05-05 Ian Lance Taylor <iant@google.com> 8382 8383 * options.h (DEFINE_bool): For DASH_Z, create the negative option 8384 as noVARNAME rather than no-VARNAME. 8385 (class General_options): Add option -z combreloc. 8386 * output.h (class Output_reloc) [SHT_REL]: Declare compare and 8387 get_address. 8388 (Output_reloc::sort_before) [SHT_REL]: New function. 8389 (Output_reloc::sort_before) [SHT_RELA]: New function. 8390 (class Output_data_reloc_base): Add sort_relocs_ field. Define 8391 Sort_relocs_comparison. 8392 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs 8393 parameter. Change all callers. 8394 (Output_data_reloc::Output_data_reloc) [both versions]: Add 8395 sort_relocs parameter. Change all callers. 8396 * output.cc (Output_reloc::get_address): New function, broken out 8397 of write_rel. 8398 (Output_reloc::write_rel): Call it. 8399 (Output_reloc::compare): New function. 8400 (Output_data_reloc_base::do_write): Optionally sort relocs. 8401 8402 * configure.ac: If targ_extra_obj is set, link it in. 8403 * configure.tgt: Initialize all variables. 8404 (x86_64*): Set targ_extra_obj and targ_extra_size. 8405 * configure: Rebuild. 8406 8407 * object.cc (Sized_relobj::include_section_group): Adjust section 8408 indexes read from group data. Build vector to pass to 8409 layout_group. 8410 * layout.cc (Layout::layout_group): Add flags and shndxes 8411 parameters. Remove contents parameter. Change caller. Update 8412 explicit instantiations. 8413 * layout.h (class Layout): Update layout_group declaration. 8414 * output.cc (Output_data_group::Output_data_group): Add flags and 8415 input_shndxes parameters. Remove contents parameter. Change 8416 caller. 8417 (Output_data_group::do_write): Change input_sections_ to 8418 input_shndxes_. 8419 * output.h (class Output_data_group): Update constructor 8420 declaration. Rename input_sections_ to input_shndxes_. 8421 * testsuite/many_sections_test.cc: Add template. 8422 84232008-04-30 Cary Coutant <ccoutant@google.com> 8424 8425 * target-reloc.h (relocate_section): Fix dead-pointer bug. 8426 8427 * layout.cc (Layout::include_section): Refactored check for debug 8428 info section. 8429 (Layout::add_comdat): Add new parameters. Change type 8430 of signature parameter. Add object and shndx to signatures table. 8431 (Layout::find_kept_object): New function. 8432 * layout.h: Include <cstring>. 8433 (Layout::is_debug_info_section): New function. 8434 (Layout::add_comdat): Add new parameters. 8435 (Layout::find_kept_object): New function. 8436 (Layout::Kept_section): New struct. 8437 (Layout::Signatures): Change type of map range. 8438 * object.cc (Relobj::output_section_address): New function. 8439 (Sized_relobj::include_section_group): Add new parameters. Change 8440 calls to Layout::add_comdat. Change to build table of kept comdat 8441 groups and table mapping discarded sections to kept sections. 8442 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter. 8443 (Sized_relobj::do_layout): Change calls to include_section_group and 8444 include_linkonce_section. 8445 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol 8446 value to zero when section is discarded. 8447 (Sized_relobj::map_to_kept_section): New function. 8448 * object.h (Relobj::output_section_address): New function. 8449 (Relobj::Comdat_group): New type. 8450 (Relobj::find_comdat_group): New function. 8451 (Relobj::Comdat_group_table): New type. 8452 (Relobj::Kept_comdat_section): New type. 8453 (Relobj::Kept_comdat_section_table): New type. 8454 (Relobj::add_comdat_group): New function. 8455 (Relobj::set_kept_comdat_section): New function. 8456 (Relobj::get_kept_comdat_section): New function. 8457 (Relobj::comdat_groups_): New field. 8458 (Relobj::kept_comdat_sections_): New field. 8459 (Symbol_value::input_value): Update comment. 8460 (Sized_relobj::map_to_kept_section) New function. 8461 (Sized_relobj::include_linkonce_section): Add new parameter. 8462 * target-reloc.h (Comdat_behavior): New type. 8463 (get_comdat_behavior): New function. 8464 (relocate_section): Add code to map a discarded section to the 8465 corresponding kept section when applying a relocation. 8466 84672008-04-30 Craig Silverstein <csilvers@google.com> 8468 8469 * dwarf_reader.cc (next_generation_count): New static var. 8470 (Addr2line_cache_entry): New struct. 8471 (addr2line_cache): New static var. 8472 (Dwarf_line_info::one_addr2line): Added caching. 8473 (Dwarf_line_info::clear_addr2line_cache): New function. 8474 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add 8475 cache-size parameter. 8476 (Dwarf_line_info::one_addr2line_cache): New function. 8477 * symtab.cc (Symbol_table::detect_odr_violations): Pass 8478 new cache-size argument to one_addr2line(), and clear cache. 8479 84802008-04-28 Cary Coutant <ccoutant@google.com> 8481 8482 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and 8483 R_386_PC8 relocations. 8484 84852008-04-23 Ian Lance Taylor <iant@google.com> 8486 8487 * object.cc (Sized_relobj::include_section_group): Check for 8488 invalid section group. 8489 8490 * object.cc (make_elf_object): Correct test for 64-bit ELF file 8491 header size. 8492 8493 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather 8494 than read for file header. 8495 * archive.cc (Archive::include_member): Likewise. 8496 84972008-04-23 Paolo Bonzini <bonzini@gnu.org> 8498 8499 * aclocal.m4: Regenerate. 8500 * configure: Regenerate. 8501 85022008-04-19 Ian Lance Taylor <iant@google.com> 8503 8504 * version.cc (version_string): Bump to 1.6. 8505 8506 * testsuite/Makefile.am (many_sections_r_test): New target. 8507 (many_sections_r_test_SOURCES): Remove. 8508 (many_sections_r_test_DEPENDENCIES): Remove. 8509 (many_sections_r_test_LDFLAGS): Remove. 8510 (many_sections_r_test_LDADD): Remove. 8511 8512 * object.cc (Sized_relobj::do_add_symbols): Always pass 8513 local_symbol_count_ to add_from_relobj. 8514 8515 * testsuite/Makefile.am (many_sections_check.h): Only check one in 8516 every thousand variables. 8517 * testsuite/Makefile.in: Rebuild. 8518 8519 * object.cc (Xindex::initialize_symtab_xindex): New function. 8520 (Xindex::read_symtab_xindex): New function. 8521 (Xindex::sym_xindex_to_shndx): New function. 8522 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if 8523 available. 8524 (Sized_relobj::do_initialize_xindex): New function. 8525 (Sized_relobj::do_read_symbols): Adjust section links. 8526 (Sized_relobj::symbol_section_and_value): Add is_ordinary 8527 parameter. Change all callers. 8528 (Sized_relobj::include_section_group): Adjust section links and 8529 symbol section indexes. 8530 (Sized_relobj::do_layout): Adjust section links. 8531 (Sized_relobj::do_count_local_symbols): Adjust section links and 8532 symbol section indexes. 8533 (Sized_relobj::do_finalize_local_symbols): Distinguish between 8534 ordinary and special symbols. 8535 (Sized_relobj::write_local_symbols): Add symtab_xindex and 8536 dynsym_xindex parameters. Change all callers. Adjust section 8537 links. Use SHN_XINDEX when needed. 8538 (Sized_relobj::get_symbol_location_info): Adjust section links. 8539 Don't get fooled by special symbols. 8540 * object.h (class Xindex): Define. 8541 (class Object): Add xindex_ parameter. Declare virtual functoin 8542 do_initialize_xindex. 8543 (Object::adjust_sym_shndx): New function. 8544 (Object::set_xindex): New protected function. 8545 (class Symbol_value): Add is_ordinary_shndx_ field. 8546 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_. 8547 (Symbol_value::value): Assert ordinary section. 8548 (Symbol_value::initialize_input_to_output_map): Likewise. 8549 (Symbol_value::set_input_shndx): Add is_ordinary parameter. 8550 Change all callers. 8551 (Symbol_value::input_shndx): Add is_ordinary parameter. Change 8552 all callers. 8553 (class Sized_relobj): Update declarations. 8554 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary 8555 parameter. Change all callers. 8556 (Sized_relobj::adjust_shndx): New function. 8557 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_ 8558 field. 8559 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx 8560 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section 8561 for SHT_DYNSYM section if available. Set dynsym_shndx_ field. 8562 (Sized_dynobj::read_dynsym_section): Adjust section links. 8563 (Sized_dynobj::read_dynamic): Likewise. 8564 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust 8565 section links. 8566 (Sized_dynobj::do_initialize_xindex): New function. 8567 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare 8568 do_initialize_xindex. 8569 (Sized_dynobj::adjust_shndx): New function. 8570 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and 8571 dynsym_xindex_ fields. 8572 (Layout::finalize): Add a call to set_section_indexes before 8573 creating the symtab sections. 8574 (Layout::set_section_indexes): Don't do anything if the section 8575 already has a section index. 8576 (Layout::create_symtab_sections): Add shnum parameter. Change 8577 caller. Create .symtab_shndx section if needed. 8578 (Layout::create_shdrs): Add shstrtab_section parameter. Change 8579 caller. 8580 (Layout::allocated_output_section_count): New function. 8581 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if 8582 needed. 8583 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_ 8584 fields. Update declarations. 8585 (Layout::symtab_xindex): New function. 8586 (Layout::dynsym_xindex): New function. 8587 (class Write_symbols_task): Add layout_ field. 8588 (Write_symbols_task::Write_symbols_task): Add layout parameter. 8589 Change caller. 8590 * output.cc (Output_section_headers::Output_section_headers): Add 8591 shstrtab_section parameter. Change all callers. 8592 (Output_section_headers::do_sized_write): Store overflow values 8593 for section count and section string table section index in 8594 section header zero. 8595 (Output_file_header::do_sized_write): Check for overflow of 8596 section count and section string table section index. 8597 (Output_symtab_xindex::do_write): New function. 8598 (Output_symtab_xindex::endian_do_write): New function. 8599 * output.h (class Output_section_headers): Add shstrtab_section_. 8600 Update declarations. 8601 (class Output_symtab_xindex): Define. 8602 (Output_section::has_out_shndx): New function. 8603 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_ 8604 field. 8605 (Symbol::init_base): Add st_shndx and is_ordinary parameters. 8606 Change all callers. 8607 (Sized_symbol::init): Likewise. 8608 (Symbol::output_section): Check for ordinary symbol. 8609 (Symbol_table::add_from_object): Remove orig_sym parameter. Add 8610 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all 8611 callers. 8612 (Symbol_table::add_from_relobj): Add symndx_offset parameter. 8613 Change all callers. Simplify handling of symbols from sections 8614 not included in the link. 8615 (Symbol_table::add_from_dynobj): Handle ordinary symbol 8616 distinction. 8617 (Weak_alias_sorter::operator()): Assert that symbols are 8618 ordinary. 8619 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol 8620 distinction. 8621 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex 8622 parameters. Change all callers. 8623 (Symbol_table::sized_write_globals): Likewise. Handle ordinary 8624 symbol distinction. Use SHN_XINDEX when needed. 8625 (Symbol_table::write_section_symbol): Add symtab_xindex 8626 parameter. Change all callers. 8627 (Symbol_table::sized_write_section_symbol): Likewise. Use 8628 SHN_XINDEX when needed. 8629 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update 8630 declarations. 8631 (Symbol::shndx): Add is_ordinary parameter. Change all callers. 8632 (Symbol::is_defined): Check is_ordinary. 8633 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise. 8634 (Symbol::is_absolute, Symbol::is_common): Likewise. 8635 (class Sized_symbol): Update declarations. 8636 (class Symbol_table): Update declarations. 8637 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary 8638 parameters. Change all callers. 8639 (Sized_symbol::override): Likewise. 8640 (Symbol_table::override): Likewise. 8641 (symbol_to_bits): Add is_ordinary parameter. Change all callers. 8642 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx, 8643 is_ordinary, and orig_st_shndx parameters. Change all callers. 8644 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol 8645 to be in an ordinary section. 8646 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add 8647 object and is_ordinary parameters. Change all callers. 8648 (Sized_dwarf_line_info::read_relocs): Add object parameter. 8649 Change all callers. Don't add undefined or non-ordinary symbols 8650 to reloc_map_. 8651 (Sized_dwarf_line_info::read_line_mappings): Add object parameter. 8652 Change all callers. 8653 * dwarf_reader.h (class Sized_dwarf_line_info): Update 8654 declarations. 8655 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol. 8656 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links. 8657 (Sized_relobj::relocate_sections): Likewise. 8658 * target-reloc.h (scan_relocs): Adjust section symbol index. 8659 (scan_relocatable_relocs): Likewise. 8660 * i386.cc (Scan::local): Check for ordinary symbols. 8661 * sparc.cc (Scan::local): Likewise. 8662 * x86_64.cc (Scan::local): Likewise. 8663 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls 8664 to symbol_section_and_value. 8665 * testsuite/many_sections_test.cc: New file. 8666 * testsuite/Makefile.am (BUILT_SOURCES): Define. 8667 (check_PROGRAMS): Add many_sections_test. 8668 (many_sections_test_SOURCES): Define. 8669 (many_sections_test_DEPENDENCIES): Define. 8670 (many_sections_test_LDFLAGS): Define. 8671 (BUILT_SOURCES): Add many_sections_define.h. 8672 (many_sections_define.h): New target. 8673 (BUILT_SOURCES): Add many_sections_check.h. 8674 (many_sections_check.h): New target. 8675 (check_PROGRAMS): Add many_sections_r_test. 8676 (many_sections_r_test_SOURCES): Define. 8677 (many_sections_r_test_DEPENDENCIES): Define. 8678 (many_sections_r_test_LDFLAGS): Define. 8679 (many_sections_r_test_LDADD): Define. 8680 (many_sections_r_test.o): New target. 8681 * testsuite/Makefile.in: Rebuild. 8682 86832008-04-17 Cary Coutant <ccoutant@google.com> 8684 8685 * errors.cc (Errors::info): New function. 8686 (gold_info): New function. 8687 * errors.h (Errors::info): New function. 8688 * gold.h (gold_info): New function. 8689 * object.cc (Input_objects::add_object): Print trace output. 8690 * options.cc (options::parse_set): New function. 8691 (General_options::parse_wrap): Deleted. 8692 (General_options::General_options): Deleted initializer. 8693 * options.h (options::String_set): New typedef. 8694 (options::parse_set): New function. 8695 (DEFINE_set): New macro. 8696 (General_options::wrap): Changed to use DEFINE_set. Changed 8697 callers of any_wrap_symbols and is_wrap_symbol. 8698 (General_options::trace, General_options::trace_symbol): 8699 New options. 8700 (General_options::any_wrap_symbols, General_options::is_wrap_symbol) 8701 (General_options::wrap_symbols_): Deleted. 8702 * symtab.cc (Symbol_table::add_from_object): Print trace output. 8703 87042008-04-17 David S. Miller <davem@davemloft.net> 8705 8706 * options.cc (General_options::parse_V): New function. 8707 * options.h: Add entries for -V and -Qy. 8708 87092008-04-17 Ian Lance Taylor <iant@google.com> 8710 8711 * common.cc (Symbol_table::allocate_commons): Remove options 8712 parameter. Change caller. 8713 (Symbol_table::do_allocate_commons): Remove options parameter. 8714 Change caller. Just call do_allocate_commons_list twice. 8715 (Symbol_table::do_allocate_commons_list): New function, broken out 8716 of do_allocate_commons. 8717 * common.h (class Allocate_commons_task): Remove options_ field. 8718 Update constructor. 8719 * symtab.cc (Symbol_table::Symbol_table): Initialize 8720 tls_commons_. 8721 (Symbol_table::add_from_object): Put TLS common symbols on 8722 tls_commons_ list. 8723 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols 8724 which are IN_OUTPUT_DATA. 8725 * symtab.h (class Symbol_table): Add tls_commons_ field. Update 8726 allocate_commons and do_allocate_commons declarations. Declare 8727 do_allocate_commons_list. 8728 * gold.cc (queue_middle_tasks): Update creation of 8729 Allocate_commons_task to not pass options. 8730 * testsuite/Makefile.am (INCLUDES): Add -I.. . 8731 (TLS_TEST_C_FLAGS): New variable. 8732 (tls_test_c_pic.o): New target. 8733 (tls_test_shared.so): Link in tls_test_c_pic.o. 8734 (tls_test_c_pic_ie.o): New target. 8735 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o. 8736 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o. 8737 (tls_test_c.o): New target. 8738 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o. 8739 (tls_pic_test_LDADD): Likewise. 8740 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o. 8741 (tls_shared_gd_to_ie_test_LDADD): Likewise. 8742 (tls_test_c_gnu2.o): New target. 8743 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add 8744 tls_test_c_gnu2.o. 8745 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise. 8746 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o. 8747 (tls_test_shared_nonpic.so): Link in tls_test_c.o. 8748 * testsuite/tls_test.cc: Include "config.h". 8749 (t_last): Call t11_last. 8750 * testsuite/tls_test.h (t11, t11_last): Declare. 8751 * testsuite/tls_test_c.c: New file. 8752 * testsuite/tls_test_main.cc (thread_routine): Call t11. 8753 * configure.ac: Check for OpenMP support. 8754 * configure, config.in, Makefile.in: Rebuild. 8755 * testsuite/Makefile.in: Rebuild. 8756 87572008-04-16 Cary Coutant <ccoutant@google.com> 8758 8759 * i386.cc (Target_i386::define_tls_base_symbol): New function. 8760 (Target_i386::tls_base_symbol_defined_): New field. 8761 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol. 8762 (Target_i386::Scan::global): Likewise. 8763 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol. 8764 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function. 8765 (Target_x86_64::tls_base_symbol_defined_): New field. 8766 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol. 8767 (Target_x86_64::Scan::global): Likewise. 8768 87692008-04-16 Cary Coutant <ccoutant@google.com> 8770 8771 * symtab.h (Symbol::is_strong_undefined): Removed unused function. 8772 (Symbol::needs_plt_entry): Allow weak undefined symbols. 8773 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when 8774 building shared libraries. 8775 * testsuite/Makefile.am (weak_undef_nonpic_test): New target. 8776 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o) 8777 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets. 8778 * testsuite/Makefile.in: Rebuild. 8779 * testsuite/weak_undef.h: New file. 8780 * testsuite/weak_undef_file1.cc: Add extra test cases. 8781 * testsuite/weak_undef_file2.cc: Likewise. 8782 * testsuite/weak_undef_test.cc: Likewise. 8783 87842008-04-16 David S. Miller <davem@davemloft.net> 8785 8786 * sparc.cc (Target_sparc::Scan): Change from struct to class. 8787 Add issued_non_pic_error_ field. Declare check_non_pic. 8788 (Target_sparc::Scan::check_non_pic): New function. 8789 (Target_sparc::Scan::local): Call check_non_pic as appropriate. 8790 (Target_sparc::Scan::global): Likewise. 8791 8792 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64. 8793 * configure: Rebuild. 8794 8795 * options.h (DEFINE_enable): New macro. 8796 (new_dtags): New enable option. 8797 (initfirst, interpose, loadfltr, nodefaultlib, 8798 nodelete, nodlopen, nodump): New -z options. 8799 * layout.cc (Layout:finish_dynamic_section): If new 8800 dtags enabled, emit DT_RUNPATH. Also, emit a 8801 DT_FLAGS_1 containing any specified -z flags. 8802 88032008-04-16 Ian Lance Taylor <iant@google.com> 8804 8805 * copy-relocs.cc: New file. 8806 * copy-relocs.h: New file. 8807 * reloc.cc: Remove Copy_relocs code. 8808 * reloc.h: Likewise. 8809 * reloc-types.h (struct Reloc_types) [both versions]: Add 8810 get_reloc_addend_noerror. 8811 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add 8812 variants of add_global which take an addend which must be zero. 8813 * i386.cc: Include "copy-relocs.h". 8814 (class Target_i386): Change type of copy_relocs_ to variable, 8815 update initializer. 8816 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class. 8817 Change all callers. 8818 (Target_i386::do_finalize_sections): Change handling of 8819 copy_relocs_. 8820 * sparc.cc: Include "copy-relocs.h". 8821 (class Target_sparc): Change type of copy_relocs_ to variable, 8822 update initializer. 8823 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class. 8824 Change all callers. 8825 (Target_sparc::do_finalize_sections): Change handling of 8826 copy_relocs_. 8827 * x86_64.cc: Include "copy-relocs.h". 8828 (class Target_x86_64): Change type of copy_relocs_ to variable, 8829 update initializer. 8830 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs 8831 class. Change all callers. 8832 (Target_x86_64::do_finalize_sections): Change handling of 8833 copy_relocs_. 8834 * Makefile.am (CCFILES): Add copy-relocs.cc. 8835 (HFILES): Add copy-relocs.h. 8836 8837 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild. 8838 8839 * testsuite/script_test_4.sh: Permit leading zeroes. 8840 88412008-04-15 Ian Lance Taylor <iant@google.com> 8842 8843 * script-sections.cc (Script_sections::create_segments): Use 8844 header_size_adjustment even when there is enough room for the 8845 headers. 8846 * testsuite/script_test_4.sh: New file. 8847 * testsuite/script_test_4.t: New file. 8848 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh. 8849 (check_DATA): Add script_test_4.stdout. 8850 (MOSTLYCLEANFILES): Likewise. 8851 (script_test_4): New target. 8852 (script_test_4.stdout): New target. 8853 * testsuite/Makefile.in: Rebuild. 8854 8855 * sparc.cc: Add definitions for Output_data_plt_sparc class 8856 constants. 8857 88582008-04-14 David S. Miller <davem@davemloft.net> 8859 8860 * sparc.cc: New file. 8861 * Makefile.am (TARGETSOURCES): Add sparc.cc 8862 (ALL_TARGETOBJS): Add sparc.$(OBJEXT) 8863 * configure.tgt: Document targ_extra_size and 8864 targ_extra_big_endian. Add entries for sparc-* and 8865 sparc64-*. 8866 * configure.ac: Handle targ_extra_size and 8867 targ_extra_big_endian. 8868 * Makefile.in: Rebuild. 8869 * configure: Likewise. 8870 * po/POTFILES.in: Likewise. 8871 * po/gold.pot: Likewise. 8872 88732008-04-14 Ian Lance Taylor <iant@google.com> 8874 8875 * layout.cc (Layout::Layout): Initialize sections_are_attached_. 8876 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR 8877 in the name/type/flags to section mapping. Don't call 8878 allocate_output_section. 8879 (Layout::choose_output_section): Change parameter from adjust_name 8880 to is_input_section. Don't permit input sections after sections 8881 are attached to segments. Don't call allocate_output_section. 8882 (Layout::layout_eh_frame): Call update_flags_for_input_section, 8883 not write_enable_output_section. 8884 (Layout::make_output_section): Don't push to 8885 unattached_section_list_ nor call attach_to_segment. Call 8886 attach_section_to_segment if sections are attached. 8887 (Layout::attach_sections_to_segments): New function. 8888 (Layout::attach_section_to_segment): New function. 8889 (Layout::attach_allocated_section_to_segment): Rename from 8890 attach_to_segment. Remove flags parameter. 8891 (Layout::allocate_output_section): Remove function. 8892 (Layout::write_enable_output_section): Remove function. 8893 * layout.h (class Layout): Update for above changes. Add new 8894 field sections_are_attached_. 8895 * output.h (Output_section::update_flags_for_input_section): New 8896 function. 8897 * output.cc (Output_section::add_input_section): Call 8898 update_flags_for_input_section. 8899 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments. 8900 89012008-04-11 Cary Coutant <ccoutant@google.com> 8902 8903 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously 8904 thought unnecessary. 8905 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise. 8906 89072008-04-11 Ian Lance Taylor <iant@google.com> 8908 8909 * output.h (class Output_section_data): Remove inline definition 8910 of set_addralign. 8911 * output.cc (Output_section_data::set_addralign): New function. 8912 89132008-04-11 Cary Coutant <ccoutant@google.com> 8914 8915 Add support for TLS descriptors for i386 and x86_64. 8916 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function. 8917 (Target_i386::Relocate::tls_desc_gd_to_le): New function. 8918 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and 8919 GOT_TYPE_TLS_DESC. 8920 (Target_i386::got_mod_index_entry): Remove unnecessary code. 8921 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and 8922 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec 8923 relocations. 8924 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation. 8925 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations; 8926 Fix problem with initial-exec relocations. 8927 (Target_i386::Relocate::relocate_tls): Likewise. 8928 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE 8929 relaxation. 8930 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add 8931 support for section-plus-offset dynamic table entries. 8932 * output.h (Output_data_dynamic::add_section_plus_offset): New function. 8933 (Output_data_dynamic::Dynamic_entry): Add support for 8934 section-plus-offset dynamic table entries. 8935 (Output_data_dynamic::Classification): Likewise. 8936 (Output_data_dynamic::classification_): Renamed offset_. 8937 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function. 8938 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function. 8939 (Target_x86_64::make_plt_section): New function. 8940 (Target_x86_64::reserve_tlsdesc_entries): New function. 8941 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter. 8942 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function. 8943 (Output_data_plt_x86_64::has_tlsdesc_entry): New function. 8944 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function. 8945 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function. 8946 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field. 8947 (Output_data_plt_x86_64::set_final_data_size): Move out of line; 8948 add extra PLT entry for TLS descriptors. 8949 (Output_data_plt_x86_64::got_): New field. 8950 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field. 8951 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new 8952 fields. 8953 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS 8954 descriptors. 8955 (Target_x86_64::make_plt_entry): Factor out make_plt_section. 8956 (Target_x86_64::got_mod_index_entry): Remove unnecessary code. 8957 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and 8958 R_386_TLS_DESC_CALL relocations. 8959 (Target_x86_64::Scan::global): Likewise. 8960 (Target_x86_64::do_finalize_sections): Add dynamic table entries 8961 for TLS descriptors. 8962 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation. 8963 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations. 8964 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with 8965 GD-to-IE relaxation. 8966 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT 8967 and TLS_DESCRIPTORS. 8968 * Makefile.in: Rebuild. 8969 * configure: Rebuild. 8970 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target. 8971 (tls_test_shared2.so): New target. 8972 (tls_shared_gd_to_ie_test_SOURCES): New variable. 8973 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable. 8974 (tls_shared_gd_to_ie_test_LDFLAGS): New variable. 8975 (tls_shared_gd_to_ie_test_LDADD): New variable. 8976 (tls_shared_gnu2_gd_to_ie_test): New target. 8977 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so): 8978 New targets. 8979 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable. 8980 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable. 8981 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable. 8982 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable. 8983 (tls_shared_gnu2_test): New target. 8984 (tls_test_gnu2_shared.so): New target. 8985 (tls_shared_gnu2_test_SOURCES): New variable. 8986 (tls_shared_gnu2_test_DEPENDENCIES): New variable. 8987 (tls_shared_gnu2_test_LDFLAGS): New variable. 8988 (tls_shared_gnu2_test_LDADD): New variable. 8989 * testsuite/Makefile.in: Rebuild. 8990 * testsuite/Makefile. 8991 89922008-04-11 Ian Lance Taylor <iant@google.com> 8993 8994 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on 8995 justsyms.t. 8996 * testsuite/Makefile.in: Rebuild. 8997 8998 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes 8999 long. 9000 * testsuite/script_test_2.cc (main): Adjust test. 9001 90022008-04-11 David S. Miller <davem@davemloft.net> 9003 Ian Lance Taylor <iant@google.com> 9004 9005 * options.h (General_options): Add entries for '-Y' and 9006 '-relax'. 9007 * options.cc (General_options:finalize): If -Y was used, add those 9008 entries to the library path instead of the default "/lib" and 9009 "/usr/lib". 9010 90112008-04-11 David S. Miller <davem@davemloft.net> 9012 9013 * testsuite/justsyms.t: Start at 0x100. 9014 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion. 9015 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes 9016 long. 9017 * testsuite/script_test_2.cc: Adjust string and section length 9018 checks. 9019 90202008-04-09 Ian Lance Taylor <iant@google.com> 9021 9022 PR gold/5996 9023 * script-sections.cc (Sections_element::allocate_to_segment): Add 9024 orphan parameter. 9025 (Output_section_definition::allocate_to_segment): Likewise. 9026 (Orphan_output_section::allocate_to_segment): Likewise. 9027 (Script_sections::attach_sections_using_phdrs_clause): Don't 9028 propagate non-PT_LOAD segments to orphan sections. 9029 * testsuite/Makefile.am (script_test_3.stdout): Generate using 9030 readelf rather than objdump. 9031 * testsuite/script_test_3.sh: Adjust accordingly. Test that 9032 .interp section and PT_INTERP segment are the same size. 9033 * testsuite/Makefile.in: Rebuild. 9034 9035 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak 9036 aliases for symbols defined in the same object. 9037 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test. 9038 (weak_alias_test_SOURCES): New variable. 9039 (weak_alias_test_DEPENDENCIES): New variable. 9040 (weak_alias_test_LDFLAGS): New variable. 9041 (weak_alias_test_LDADD): New variable. 9042 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets. 9043 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets. 9044 (weak_alias_test_3.o): New target. 9045 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets. 9046 * testsuite/weak_alias_test_main.cc: New file. 9047 * testsuite/weak_alias_test_1.cc: New file. 9048 * testsuite/weak_alias_test_2.cc: New file. 9049 * testsuite/weak_alias_test_3.cc: New file. 9050 90512008-04-08 Ian Lance Taylor <iant@google.com> 9052 9053 * options.h (class General_options): Add --noinhibit-exec option. 9054 * main.cc (main): Check --noinhibit-exec. 9055 9056 * options.h (class General_options): Define --wrap as a special 9057 option. Add wrap_symbols_ field. 9058 (General_options::any_wrap_symbols): New function. 9059 (General_options::is_wrap_symbol): New function. 9060 * options.cc (General_options::parse_wrap): New function. 9061 (General_options::General_options): Initialize wrap_symbols_. 9062 * symtab.cc (Symbol_table::wrap_symbol): New function. 9063 (Symbol_table::add_from_object): Handle --wrap. 9064 * symtab.h (class Symbol_table): Declare wrap_symbol. 9065 * target.h (Target::wrap_char): New function. 9066 (Target::Target_info): Add wrap_char field. 9067 * i386.cc (Target_i386::i386_info): Initialize wrap_char. 9068 * x86_64.cc (Target_x86_64::x86_64_info): Likewise. 9069 * testsuite/testfile.cc (Target_test::test_target_info): 9070 Likewise. 9071 9072 * errors.cc (Errors::undefined_symbol): Mention symbol version if 9073 there is one. 9074 9075 * layout.h (class Layout): Add added_eh_frame_data_ field. 9076 * layout.cc (Layout::Layout): Initialize new field. 9077 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame 9078 output section until we find a section we merged successfully. 9079 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require 9080 that the size be non-zero. 9081 9082 * merge.cc (Object_merge_map::get_output_offset): Remove inline 9083 qualifier. 9084 90852008-04-08 Craig Silverstein <csilvers@google.com> 9086 9087 * configure.ac: Export new conditional variable HAVE_ZLIB. 9088 * testsuite/Makefile.am (flagstest_o_specialfile): Condition 9089 on HAVE_ZLIB. 9090 (flagstest_o_specialfile_and_compress_debug_sections): Likewise. 9091 * configure, Makefile.in, testsuite/Makefile.in: Rebuild. 9092 90932008-04-07 Ian Lance Taylor <iant@google.com> 9094 9095 * version.cc (version_string): Set to "1.5". 9096 9097 * x86_64.cc (Target_x86_64::Scan): Change from struct to class. 9098 Add issued_non_pic_error_ field. Declare check_non_pic. 9099 (Target_x86_64::Scan::check_non_pic): New function. 9100 (Target_x86_64::Scan::local): Call check_non_pic as appropriate. 9101 (Target_x86_64::Scan::global): Likewise. 9102 9103 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add 9104 addend parameter. Change caller. Handle merge sections. 9105 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from 9106 Address to Addend. Don't add in the result of 9107 local_section_offset, pass down the addend and use the returned 9108 value. 9109 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef. 9110 Update declarations of local_section_offset and symbol_value. 9111 * testsuite/two_file_test_1.cc (t18): New function. 9112 * testsuite/two_file_test_2.cc (f18): New function. 9113 * testsuite/two_file_test_main.cc (main): Call t18. 9114 * testsuite/two_file_test.h (t18, f18): Declare. 9115 9116 * configure.ac: Don't test for objdump, c++filt, or readelf. 9117 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT 9118 conditionals. 9119 (TEST_READELF): New variable. 9120 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables. 9121 (check_PROGRAMS): Add two_file_strip_test. 9122 (two_file_strip_test): New target. 9123 (check_PROGRAMS): Add two_file_same_shared_strip_test. 9124 (two_file_same_shared_strip_test_SOURCES): New variable. 9125 (two_file_same_shared_strip_test_DEPENDENCIES): New variable. 9126 (two_file_same_shared_strip_test_LDFLAGS): New variable. 9127 (two_file_same_shared_strip_test_LDADD): New variable. 9128 (two_file_shared_strip.so): New target. 9129 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF. 9130 (ver_test_5.syms, ver_test_7.syms): Likewise. 9131 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT. 9132 (strip_test_3.stdout): Use TEST_OBJDUMP. 9133 * configure, Makefile.in, testsuite/Makefile.in: Rebuild. 9134 91352008-04-04 Cary Coutant <ccoutant@google.com> 9136 9137 * symtab.h (Symbol::is_weak_undefined): New function. 9138 (Symbol::is_strong_undefined): New function. 9139 (Symbol::is_absolute): New function. 9140 (Symbol::needs_plt_entry): Exclude weak undefined symbols. 9141 (Symbol::needs_dynamic_reloc): Exclude weak undefined and 9142 absolute symbols. 9143 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test. 9144 (weak_undef_test): New target. 9145 * testsuite/Makefile.in: Rebuild. 9146 * testsuite/weak_undef_file1.cc: New file. 9147 * testsuite/weak_undef_file2.cc: New file. 9148 * testsuite/weak_undef_test.cc: New file. 9149 91502008-04-03 Craig Silverstein <csilvers@google.com> 9151 9152 * compressed_output.h (class Output_compressed_section): Use 9153 unsigned buffer. 9154 * compressed_output.cc (zlib_compress): Use unsigned buffers, 9155 add zlib header. 9156 (zlib_compressed_suffix): Removed. 9157 (Output_compressed_section::set_final_data_size): Use unsigned 9158 buffers. 9159 * testsuite/Makefile.am (flagstest_compress_debug_sections): 9160 Fix linker invocation. 9161 (flagstest_o_specialfile_and_compress_debug_sections): 9162 Likewise. 9163 * testsuite/Makefile.in: Regenerated. 9164 91652008-04-02 David S. Miller <davem@davemloft.net> 9166 9167 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog, 9168 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned. 9169 91702008-04-02 Craig Silverstein <csilvers@google.com> 9171 9172 * TODO: New file. 9173 91742008-04-02 Ian Lance Taylor <iant@google.com> 9175 9176 * fileread.cc (File_read::find_view): Add byteshift and vshifted 9177 parameters. Update for new key type to views_. Change all 9178 callers. 9179 (File_read::read): Adjust for byteshift in returned view. 9180 (File_read::add_view): New function, broken out of 9181 find_and_make_view. 9182 (File_read::make_view): New function, broken out of 9183 find_and_make_view. 9184 (File_read::find_or_make_view): Add offset and aligned 9185 parameters. Rewrite accordingly. Change all callers. 9186 (File_read::get_view): Add offset and aligned parameters. Adjust 9187 for byteshift in return value. 9188 (File_read::get_lasting_view): Likewise. 9189 * fileread.h (class File_read): Update declarations. 9190 (class File_read::View): Add byteshift_ field. Add byteshift to 9191 constructor. Add byteshift method. 9192 * archive.h (Archive::clear_uncached_views): New function. 9193 (Archive::get_view): Add aligned parameter. Change all callers. 9194 * object.h (Object::get_view): Add aligned parameter. Change all 9195 callers. 9196 (Object::get_lasting_view): Likewise. 9197 9198 * fileread.cc (File_read::release): Don't call clear_views if 9199 there are multiple objects. 9200 * fileread.h (File_read::clear_uncached_views): New function. 9201 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views 9202 on the archive. 9203 92042008-03-31 Cary Coutant <ccoutant@google.com> 9205 9206 Add thin archive support. 9207 * archive.cc (Archive::armagt): New const. 9208 (Archive::setup): Remove task parameter and calls to unlock. 9209 (Archive::unlock_nested_archives): New function. 9210 (Archive::read_header): Add nested_off parameter. Change 9211 all callers. 9212 (Archive::interpret_header): Likewise. 9213 (Archive::include_all_members): Change to handle thin 9214 archives. 9215 (Archive::include_member): Likewise. 9216 * archive.h (Archive::Archive): Add new parameters and 9217 initializers. 9218 (Archive::armagt): New const. 9219 (Archive::setup): Remove task parameter. 9220 (Archive::unlock_nested_archives): New function. 9221 (Archive::read_header): Add nested_off parameter. 9222 (Archive::interpret_header): Likewise. 9223 (Archive::Nested_archive_table): New typedef. 9224 (Archive::is_thin_archive_): New field. 9225 (Archive::nested_archives_): New field. 9226 (Archive::options_): New field. 9227 (Archive::dirpath_): New field. 9228 (Archive::task_): New field. 9229 * readsyms.cc (Read_symbols::do_read_symbols): Add check 9230 for thin archives. Pass additional parameters to 9231 Archive::Archive. Unlock the archive file after calling 9232 Archive::setup. 9233 92342008-03-29 Ian Lance Taylor <iant@google.com> 9235 9236 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a 9237 version symbol to be local. 9238 * testsuite/ver_test_4.sh: New file. 9239 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh. 9240 (check_DATA): Add ver_test_4.syms. 9241 (ver_test_4.syms): New target. 9242 * testsuite/Makefile.in: Rebuild. 9243 9244 * output.cc 9245 (Output_section::Input_section_sort_entry::has_priority): New 9246 function. 9247 (Output_section::Input_section_sort_entry::match_file_name): New 9248 function. 9249 (Output_section::Input_section_sort_entry::match_section_name): 9250 Remove. 9251 (Output_section::Input_section_sort_entry::match_section_name_prefix): 9252 Remove. 9253 (Output_section::Input_section_sort_entry::match_section_file): 9254 Remove. 9255 (Output_section::Input_section_sort_compare::operator()): Rewrite 9256 using new Input_section_sort_entry functions. Sort crtbegin and 9257 crtend first. Sort sections with no priority before sections with 9258 a priority. 9259 * testsuite/initpri1.c (d3): Check j != 4. 9260 (cd5): New constructor/destructor function. 9261 (main): Check j != 2. 9262 9263 * symtab.cc (Symbol_table::add_from_object): If we don't use the 9264 new symbol when resolving, don't call set_is_default. 9265 * testsuite/ver_test_7.cc: New file. 9266 * testsuite/ver_test_7.sh: New file. 9267 * testsuite/Makefile.am (ver_test_7.so): New target. 9268 (ver_test_7.o): New target. 9269 (check_SCRIPTS): Add ver_test_7.sh. 9270 (check_DATA): Add ver_test_7.syms. 9271 (ver_test_7.syms): New target. 9272 92732008-03-28 Ian Lance Taylor <iant@google.com> 9274 9275 * layout.cc (Layout::layout): If we see an input section with a 9276 name that needs sorting, set the must_sort flag for the output 9277 section. 9278 (Layout::make_output_section): If the name of the output section 9279 indicates that it might require sorting, set the may_sort flag. 9280 * output.h (Output_section::may_sort_attached_input_sections): New 9281 function. 9282 (Output_section::set_may_sort_attached_input_sections): New 9283 function. 9284 (Output_section::must_sort_attached_input_sections): New 9285 function. 9286 (Output_section::set_must_sort_attached_input_sections): New 9287 function. 9288 (class Output_section): Declare Input_section_sort_entry. Define 9289 Input_section_sort_compare. Declare 9290 sort_attached_input_sections. Add new fields: 9291 may_sort_attached_input_sections_, 9292 must_sort_attached_input_sections_, 9293 attached_input_sections_are_sorted_. 9294 * output.cc (Output_section::Output_section): Initialize new 9295 fields. 9296 (Output_section::add_input_section): Add an entry to 9297 input_sections_ if may_sort or must_sort are true. 9298 (Output_section::set_final_data_size): Call 9299 sort_attached_input_sections if necessary. 9300 (Output_section::Input_section_sort_entry): Define new class. 9301 (Output_section::Input_section_sort_compare::operator()): New 9302 function. 9303 (Output_section::sort_attached_input_sections): New function. 9304 * configure.ac: Check whether the compiler supports constructor 9305 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional. 9306 * testsuite/initpri1.c: New file. 9307 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if 9308 CONSTRUCTOR_PRIORITY. 9309 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables. 9310 (initpri1_LDFLAGS): New variable. 9311 * configure, Makefile.in, testsuite/Makefile.in: Rebuild. 9312 93132008-03-27 Ian Lance Taylor <iant@google.com> 9314 9315 * common.cc (Sort_commons::operator): Correct sorting algorithm. 9316 * testsuite/common_test_1.c: New file. 9317 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1. 9318 (common_test_1_SOURCES): New variable. 9319 (common_test_1_DEPENDENCIES): New variable. 9320 (common_test_1_LDFLAGS): New variable. 9321 9322 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_ 9323 and commons_ correctly when NAME/VERSION does not override 9324 NAME/NULL. 9325 * testsuite/ver_test_6.c: New file. 9326 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6 9327 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables. 9328 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables. 9329 93302008-03-26 Ian Lance Taylor <iant@google.com> 9331 9332 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version 9333 of an undefined symbol from a version script. 9334 * testsuite/Makefile.am (ver_test_5.so): New target. 9335 (ver_test_5.o): New target. 9336 (check_SCRIPTS): Add ver_test_5.sh. 9337 (check_DATA): Add ver_test_5.syms. 9338 (ver_test_5.syms): New target. 9339 * testsuite/ver_test_5.cc: New file. 9340 * testsuite/ver_test_5.script: New file. 9341 * testsuite/ver_test_5.sh: New file. 9342 * Makefile.in, testsuite/Makefile.in: Rebuild. 9343 9344 PR gold/5986 9345 Fix problems building gold with gcc 4.3.0. 9346 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define. 9347 (gold_error_at_location, gold_warning_at_location): Use it. 9348 * configure.ac: Check whether we can compile and use a template 9349 function with a printf attribute. 9350 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value 9351 when jumping over bytes. 9352 * object.cc: Instantiate Object::read_section_data. 9353 * debug.h: Include <cstring> 9354 * dwarf_reader.cc: Include <algorithm> 9355 * main.cc: Include <cstring>. 9356 * options.cc: Include <cstring>. 9357 * output.cc: Include <cstring>. 9358 * script.cc: Include <cstring>. 9359 * script.h: Include <string>. 9360 * symtab.cc: Include <cstring> and <algorithm>. 9361 * target-select.cc: Include <cstring>. 9362 * version.cc: Include <string>. 9363 * testsuite/testmain.cc: Include <cstdlib>. 9364 * configure, config.in: Rebuild. 9365 93662008-03-25 Ian Lance Taylor <iant@google.com> 9367 9368 * options.cc: Include "../bfd/bfdver.h". 9369 (options::help): Print bug reporting address. 9370 9371 * version.cc (print_version): Adjust output for current value of 9372 BFD_VERSION_STRING. 9373 9374 * NEWS: New file. 9375 9376 * options.cc (options::help): Print list of supported targets. 9377 * target-select.h: Include <vector>. 9378 (class Target_selector): Make machine_, size_, and is_big_endian_ 9379 fields const. Add bfd_name_ and instantiated_target_ fields. 9380 (Target_selector::Target_selector): Add bfd_name parameter. 9381 (Target_selector::recognize): Make non-virtual, call 9382 do_recognize. 9383 (Target_selector::recognize_by_name): Make non-virtual, call 9384 do_recognize_by_name. 9385 (Target_selector::supported_names): New function. 9386 (Target_selector::bfd_name): New function. 9387 (Target_selector::do_instantiate_target): New pure virtual 9388 function. 9389 (Target_selector::do_recognize): New virtual function. 9390 (Target_selector::do_recognize_by_name): New virtual function. 9391 (Target_selector::instantiate_target): New private function. 9392 (supported_target_names): Declare. 9393 * target-select.cc (Target_selector::Target_selector): Update for 9394 new parameter and fields. 9395 (select_target_by_name): Check that the name matches before 9396 calling recognize_by_name. 9397 (supported_target_names): New function. 9398 * i386.cc (class Target_selector_i386): Update Target_selector 9399 constructor call. Remove recognize and recognize_by_name. Add 9400 do_instantiate_target. 9401 * x86_64.cc (class Target_selector_x86_64): Likewise. 9402 * testsuite/testfile.cc (class Target_selector_test): Update for 9403 changes to Target_selector. 9404 9405 * README: Rewrite, with some notes on unsupported features. 9406 94072008-03-24 Cary Coutant <ccoutant@google.com> 9408 9409 * i386.cc (Target_i386::Got_type): New enum declaration. 9410 (Target_i386::Scan::local): Updated callers of Output_data_got 9411 member functions. 9412 (Target_i386::Scan::global): Likewise. 9413 (Target_i386::Relocate::relocate): Likewise. 9414 (Target_i386::Relocate::relocate_tls): Likewise. 9415 * object.h (Got_offset_list): New class. 9416 (Sized_relobj::local_has_got_offset): Added got_type parameter. 9417 (Sized_relobj::local_got_offset): Likewise. 9418 (Sized_relobj::set_local_got_offset): Likewise. 9419 (Sized_relobj::local_has_tls_got_offset): Removed. 9420 (Sized_relobj::local_tls_got_offset): Removed. 9421 (Sized_relobj::set_local_tls_got_offset): Removed. 9422 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets. 9423 * output.cc (Output_data_got::add_global): Added got_type parameter. 9424 (Output_data_got::add_global_with_rel): Likewise. 9425 (Output_data_got::add_global_with_rela): Likewise. 9426 (Output_data_got::add_global_pair_with_rel): New function. 9427 (Output_data_got::add_global_pair_with_rela): New function. 9428 (Output_data_got::add_local): Added got_type parameter. 9429 (Output_data_got::add_local_with_rel): Likewise. 9430 (Output_data_got::add_local_with_rela): Likewise. 9431 (Output_data_got::add_local_pair_with_rel): New function. 9432 (Output_data_got::add_local_pair_with_rela): New function. 9433 (Output_data_got::add_global_tls): Removed. 9434 (Output_data_got::add_global_tls_with_rel): Removed. 9435 (Output_data_got::add_global_tls_with_rela): Removed. 9436 (Output_data_got::add_local_tls): Removed. 9437 (Output_data_got::add_local_tls_with_rel): Removed. 9438 (Output_data_got::add_local_tls_with_rela): Removed. 9439 * output.h (Output_data_got::add_global): Added got_type parameter. 9440 (Output_data_got::add_global_with_rel): Likewise. 9441 (Output_data_got::add_global_with_rela): Likewise. 9442 (Output_data_got::add_global_pair_with_rel): New function. 9443 (Output_data_got::add_global_pair_with_rela): New function. 9444 (Output_data_got::add_local): Added got_type parameter. 9445 (Output_data_got::add_local_with_rel): Likewise. 9446 (Output_data_got::add_local_with_rela): Likewise. 9447 (Output_data_got::add_local_pair_with_rel): New function. 9448 (Output_data_got::add_local_pair_with_rela): New function. 9449 (Output_data_got::add_global_tls): Removed. 9450 (Output_data_got::add_global_tls_with_rel): Removed. 9451 (Output_data_got::add_global_tls_with_rela): Removed. 9452 (Output_data_got::add_local_tls): Removed. 9453 (Output_data_got::add_local_tls_with_rel): Removed. 9454 (Output_data_got::add_local_tls_with_rela): Removed. 9455 * resolve.cc (Symbol::override_base_with_special): Removed 9456 reference to has_got_offset_ field. 9457 * symtab.cc (Symbol::init_fields): Replaced initialization 9458 of got_offset_ with got_offsets_. Removed initialization 9459 of has_got_offset_ 9460 * symtab.h (Symbol::has_got_offset): Aded got_type parameter. 9461 (Symbol::got_offset): Likewise. 9462 (Symbol::set_got_offset): Likewise. 9463 (Symbol::has_tls_got_offset): Removed. 9464 (Symbol::tls_got_offset): Removed. 9465 (Symbol::set_tls_got_offset): Removed. 9466 (Symbol::got_offset_): Removed. 9467 (Symbol::tls_mod_got_offset_): Removed. 9468 (Symbol::tls_pair_got_offset_): Removed. 9469 (Symbol::got_offsets_): New field. 9470 (Symbol::has_got_offset): Removed. 9471 (Symbol::has_tls_mod_got_offset): Removed. 9472 (Symbol::has_tls_pair_got_offset): Removed. 9473 * x86_64.cc (Target_x86_64::Got_type): New enum declaration. 9474 (Target_x86_64::Scan::local): Updated callers of Output_data_got 9475 member functions. 9476 (Target_x86_64::Scan::global): Likewise. 9477 (Target_x86_64::Relocate::relocate): Likewise. 9478 (Target_x86_64::Relocate::relocate_tls): Likewise. 9479 94802008-03-25 Ben Elliston <bje@au.ibm.com> 9481 9482 * yyscript.y: Fix spelling error in comment. 9483 94842008-03-24 Ian Lance Taylor <iant@google.com> 9485 9486 * options.h (class General_options): Define build_id option. 9487 * layout.h (class Layout): Declare write_build_id, create_note, 9488 create_build_id. Add build_id_note_ member. 9489 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>, 9490 "libiberty.h", "md5.h", "sha1.h". 9491 (Layout::Layout): Initialize eh_frame_data_, 9492 eh_frame_hdr_section_, and build_id_note_. 9493 (Layout::finalize): Call create_build_id. 9494 (Layout::create_note): New function, broken out of 9495 Layout::create_gold_note. 9496 (Layout::create_gold_note): Call create_note. 9497 (Layout::create_build_id): New function. 9498 (Layout::write_build_id): New function. 9499 (Close_task_runner::run): Call write_build_id. 9500 9501 * x86_64.cc: Correct license to GPLv3. 9502 95032008-03-23 Ian Lance Taylor <iant@google.com> 9504 9505 * options.cc: Include "demangle.h". 9506 (parse_optional_string): New function. 9507 (parse_long_option): Handle takes_optional_argument. 9508 (parse_short_option): Update dash_z initializer. Handle 9509 takes_optional_argument. 9510 (General_options::General_options): Initialize do_demangle_. 9511 (General_options::finalize): Set do_demangle_. Handle demangling 9512 style. 9513 * options.h (parse_optional_string): Declare. 9514 (struct One_option): Add optional_arg field. Update constructor. 9515 Update call constructor calls. Add takes_optional_argument 9516 function. 9517 (DEFINE_var): Add optional_arg__ parameter. Change all callers. 9518 (DEFINE_optional_string): Define. 9519 (General_options::demangle): Change from DEFINE_bool to 9520 DEFINE_optional_string. 9521 (General_options::no_demangle): New function. 9522 (General_options::do_demangle): New function. 9523 (General_options::set_do_demangle): New function. 9524 (General_options::execstack_status_): Move definition to end of 9525 class definition. 9526 (General_options::static_): Likewise. 9527 (General_options::do_demangle_): New field. 9528 * object.cc (big_endian>::get_symbol_location_info): Call 9529 Options::do_demangle, not Options::demangle. 9530 * symtab.cc (demangle): Likewise. 9531 95322008-03-22 Ian Lance Taylor <iant@google.com> 9533 9534 * gold.h: Include <cstddef> and <sys/types.h> 9535 * options.h: Include <cstring>. 9536 95372008-03-21 Ian Lance Taylor <iant@google.com> 9538 9539 * Added source code to GNU binutils. 9540