bfd/

2006-10-17  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3351
	* elflink.c (_bfd_elf_update_dynamic_flags): New.
	(_bfd_elf_merge_symbol): Update both real and indirect symbol
	dynamic flags.
	(_bfd_elf_add_default_symbol): Make the real symbol dynamic if
	the indirect symbol is defined in a shared library.
	(elf_link_add_object_symbols): Likewise.  If the indirect
	symbol has been forced local, don't make the real symbol
	dynamic.
	(elf_link_check_versioned_symbol): Check indirect symbol.
	(elf_link_output_extsym): Use real symbol definition when
	reporting indirect symbol error.  Check version info for
	dynamic versioned symbol.

ld/testsuite/

2006-10-17  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3351
	* ld-elf/indirect.exp: New file.
	* ld-elf/indirect1a.c: Likewise.
	* ld-elf/indirect1b.c: Likewise.
	* ld-elf/indirect1c.c: Likewise.
	* ld-elf/indirect2.c: Likewise.
	* ld-elf/indirect3.out: Likewise.
	* ld-elf/indirect3a.c: Likewise.
	* ld-elf/indirect3b.c: Likewise.
	* ld-elf/indirect3c.c: Likewise.
	* ld-elf/indirect4.out: Likewise.
	* ld-elf/indirect4a.c: Likewise.
	* ld-elf/indirect4b.c: Likewise.
	* ld-elf/indirect4c.c: Likewise.

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 32575d9..f6f2740 100644
bfd/

2009-12-12  H.J. Lu  <hongjiu.lu@intel.com>

	* elf.c: Fix shadowed variable warnings.
	* elf64-x86-64.c: Likewise.
	* elflink.c: Likewise.

2007-01-23  H.J. Lu  <hongjiu.lu@intel.com>

	* elf-bfd.h (_bfd_elf_sharable_com_section): New.
	(_bfd_elf_add_sharable_symbol): Likewise.
	(_bfd_elf_sharable_section_from_bfd_section): Likewise.
	(_bfd_elf_sharable_symbol_processing): Likewise.
	(_bfd_elf_sharable_common_definition): Likewise.
	(_bfd_elf_sharable_common_section_index): Likewise.
	(_bfd_elf_sharable_common_section): Likewise.
	(_bfd_elf_sharable_merge_symbol): Likewise.

	* elf.c (special_sections_g): Add ".gnu.linkonce.shrb" and
	".gnu.linkonce.shrd".
	(special_sections_s): Add ".sharable_bss" and ".sharable_data".
	(get_program_header_size): Handle PT_GNU_SHR segment.
	(_bfd_elf_map_sections_to_segments): Likewise.
	(assign_file_positions_for_load_sections): Likewise.

	* elf32-i386.c (elf_i386_link_hash_table): Add sdynsharablebss
	and srelsharablebss fields.
	(elf_i386_link_hash_table_create): Initialize sdynsharablebss
	and srelsharablebss.
	(elf_i386_create_dynamic_sections): Handle sdynsharablebss and
	srelsharablebss.
	(elf_i386_adjust_dynamic_symbol): Likewise.
	(elf_i386_size_dynamic_sections): Likewise.
	(elf_i386_finish_dynamic_symbol): Likewise.
	(elf_backend_add_symbol_hook): Defined.
	(elf_backend_section_from_bfd_section): Likewise.
	(elf_backend_symbol_processing): Likewise.
	(elf_backend_common_section_index): Likewise.
	(elf_backend_common_section): Likewise.
	(elf_backend_common_definition): Likewise.
	(elf_backend_merge_symbol): Likewise.

	* elf64-x86-64.c (elf64_x86_64_link_hash_table): Add
	sdynsharablebss and srelsharablebss fields.
	(elf64_x86_64_link_hash_table_create): Initialize sdynsharablebss
	and srelsharablebss.
	(elf64_x86_64_create_dynamic_sections): Handle sdynsharablebss
	and srelsharablebss.
	(elf64_x86_64_adjust_dynamic_symbol): Likewise.
	(elf64_x86_64_size_dynamic_sections): Likewise.
	(elf64_x86_64_finish_dynamic_symbol): Likewise.
	(elf64_x86_64_add_symbol_hook): Handle sharable symbols.
	(elf64_x86_64_elf_section_from_bfd_section): Likewise.
	(elf64_x86_64_symbol_processing): Likewise.
	(elf64_x86_64_merge_symbol): Likewise.
	(elf64_x86_64_common_definition): Handle sharable sections.
	(elf64_x86_64_common_section_index): Likewise.
	(elf64_x86_64_common_section): Likewise.

	* elflink.c (_bfd_elf_create_dynamic_sections): Handle
	.dynsharablebss section.
	(_bfd_elf_sharable_com_section): New.
	(get_sharable_common_section): Likewise.
	(_bfd_elf_add_sharable_symbol): Likewise.
	(_bfd_elf_sharable_section_from_bfd_section): Likewise.
	(_bfd_elf_sharable_symbol_processing): Likewise.
	(_bfd_elf_sharable_common_definition): Likewise.
	(_bfd_elf_sharable_common_section_index): Likewise.
	(_bfd_elf_sharable_common_section): Likewise.
	(_bfd_elf_sharable_merge_symbol): Likewise.

	* elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Handle sharable
	symbols.
	(elf_backend_add_symbol_hook): Defined.
	(elf_backend_section_from_bfd_section): Likewise.
	(elf_backend_symbol_processing): Likewise.
	(elf_backend_common_section_index): Likewise.
	(elf_backend_common_section): Likewise.
	(elf_backend_common_definition): Likewise.
	(elf_backend_merge_symbol): Likewise.

binutils/

2007-01-04  H.J. Lu  <hongjiu.lu@intel.com>

	* readelf.c (dump_relocations): Handle sharable sections.
	(get_segment_type): Handle sharable segment.
	(get_symbol_index_type): Handle sharable sections.

gas/

2007-01-04  H.J. Lu  <hongjiu.lu@intel.com>

	* config/obj-elf.c (obj_elf_sharable_common): New.
	(elf_pseudo_table): Add "sharable_common".
	(obj_elf_change_section): Handle sharable sections.

include/

2007-01-23  H.J. Lu  <hongjiu.lu@intel.com>

	* bfdlink.h (bfd_link_info): Add sharable_sections.

include/elf/

2007-01-04  H.J. Lu  <hongjiu.lu@intel.com>

	* common.h (PT_GNU_SHR): New.
	(SHF_GNU_SHARABLE): Likewise.
	(SHN_GNU_SHARABLE_COMMON): Likewise.

ld/

2011-01-08  H.J. Lu  <hongjiu.lu@intel.com>

	* emulparams/elf32_x86_64.sh (SHARABLE_SECTIONS): Set to yes.

2007-01-04  H.J. Lu  <hongjiu.lu@intel.com>

	* emulparams/elf64_ia64.sh (SHARABLE_SECTIONS): Set to yes.
	* emulparams/elf_i386.sh (SHARABLE_SECTIONS): Likewise.
	* emulparams/elf_x86_64.sh (SHARABLE_SECTIONS): Likewise.

	* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
	link_info.sharable_sections based on $SHARABLE_SECTIONS.
	(gld${EMULATION_NAME}_place_orphan): Don't allow orphaned
	sharable sections.

	* ldmain.c (main): Initialize link_info.sharable_sections.
	* scripttempl/elf.sc: Support sharable sections.

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index cc83588..de441d9 100644
2010-07-01  H.J. Lu  <hongjiu.lu@intel.com>

	* elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Silence unused warning
	on ignored.

	* elf32-tic6x.c (elf32_tic6x_relocate_section): Add an argument for
	error ignored.
	
bfd/

2007-07-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/4409
	* elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Add an argument for
	error ignored.
	* elf-m10200.c (mn10200_elf_relocate_section): Updated.
	* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
	* elf32-arm.c (elf32_arm_relocate_section): Likewise.
	* elf32-avr.c (elf32_avr_relocate_section): Likewise.
	* elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
	(bfin_relocate_section): Likewise.
	* elf32-cr16.c (elf32_cr16_relocate_section): Likewise.
	* elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise.
	* elf32-cris.c (cris_elf_relocate_section): Likewise.
	* elf32-crx.c (elf32_crx_relocate_section): Likewise.
	* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
	* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
	* elf32-frv.c (elf32_frv_relocate_section): Likewise.
	* elf32-h8300.c (elf32_h8_relocate_section): Likewise.
	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	* elf32-i860.c (elf32_i860_relocate_section): Likewise.
	* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
	* elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
	* elf32-lm32.c (lm32_elf_relocate_section): Likewise.
	* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-microblaze.c (microblaze_elf_relocate_section): Likewise.
	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
	* elf32-mep.c (mep_elf_relocate_section): Likewise.
	* elf32-moxie.c (moxie_elf_relocate_section): Likewise.
	* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
	* elf32-mt.c (mt_elf_relocate_section): Likewise.
	* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-rx.c (rx_elf_relocate_section): Likewise.
	* elf32-s390.c (elf_s390_relocate_section): Likewise.
	* elf32-v850.c (v850_elf_relocate_section): Likewise.
	* elf32-vax.c (elf_vax_relocate_section): Likewise.
	* elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise.
	* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
	* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
	* elf64-mmix.c (mmix_elf_relocate_section): Likewise.
	* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
	* elf64-s390.c (elf_s390_relocate_section): Likewise.
	* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.

	* elfxx-ia64.c (elfNN_ia64_relocate_section): Skip if error
	from RELOC_FOR_GLOBAL_SYMBOL in executable is ignored.

ld/

2007-07-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/4409
	* ldmain.c (how_to_report_unresolved_symbols): New.
	(main): Set link_info.unresolved_syms_in_objects and
	link_info.unresolved_syms_in_shared_libs if they aren't set
	yet.

	* ldmain.h (how_to_report_unresolved_symbols): New.

	* lexsup.c (how_to_report_unresolved_symbols): Removed.
	(parse_args): Set link_info.pie to FALSE for -shared. Don't
	set default values for link_info.unresolved_syms_in_objects nor
	link_info.unresolved_syms_in_shared_libs.

ld/testsuite/

2007-07-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/4409
	* ld-ia64/error1.d: New file.
	* ld-ia64/error1.s: Likewise.
	* ld-ia64/error2.d: Likewise.
	* ld-ia64/error3.d: Likewise.
	* ld-ia64/error4.d: Likewise.

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 66dcbcd..7e36cfe 100644
diff --git a/binutils/ChangeLog.addend b/binutils/ChangeLog.addend
new file mode 100644
index 0000000..e0bd096
bfd/

2007-07-19  H.J. Lu  <hongjiu.lu@intel.com>

	* elflink.c (elf_link_add_object_symbols): Check symbol type
	for symbol alias in a dynamic object.

ld/testsuite/

2007-07-19  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/data2.c: New.
	* ld-elf/weakdef1.c: Likewise.

	* ld-elf/shared.exp: Add tests for libdata2 and weakdef1.

2008-03-12  H.J. Lu  <hongjiu.lu@intel.com>

	* elf.c (assign_section_numbers): Check if number of sections
	>= SHN_LORESERVE.
	* elfcode.h (elf_object_p): Likewise.

bfd/

2011-01-05  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12248
	PR ld/12277
	PR ld/12291
	PR ld/12323
	PR ld/12365
	PR ld/12369
	* bfd.c (bfd_lto_object_type): New.
	(BFD_PLUGIN): Likewise.
	(BFD_PLUGIN_DUMMY): Likewise.
	(bfd_group_signature): Likewise.
	(BFD_FLAGS_SAVED): Add BFD_PLUGIN and BFD_PLUGIN_DUMMY.
	(BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.
	(bfd): Add object_only_section and lto_type.

	* elf.c (special_sections_g): Add ".gnu_object_only".

	* format.c (bfd_set_lto_type): New.
	(bfd_check_format_matches): Use it.

	* section.c (GNU_OBJECT_ONLY_SECTION_NAME): New.

	* bfd-in2.h: Regenerated.

binutils/

2011-01-05  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12248
	PR ld/12277
	PR ld/12291
	PR ld/12323
	PR ld/12365
	PR ld/12369
	* objcopy.c (group_signature): Removed.
	(is_strip_section): Replace group_signature with
	bfd_group_signature.
	(setup_section): Likewise.

	* readelf.c (get_section_type_name): Handle SHT_GNU_OBJECT_ONLY.

gas/testsuite/

2011-01-05  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12248
	PR ld/12277
	PR ld/12291
	PR ld/12323
	PR ld/12365
	PR ld/12369
	* gas/elf/section9.s: Add the .gnu_object_only test.
	* gas/elf/section9.d: Updated.

include/

2010-12-12  H.J. Lu  <hongjiu.lu@intel.com>

	* bfdlink.h (bfd_link_info): Add emit_gnu_object_only and
	emitting_gnu_object_only.

include/elf/

2011-01-05  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12248
	PR ld/12277
	PR ld/12291
	PR ld/12323
	PR ld/12365
	PR ld/12369
	* common.h (SHT_GNU_OBJECT_ONLY): New.

ld/

2011-01-05  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12248
	PR ld/12277
	PR ld/12291
	PR ld/12323
	PR ld/12365
	PR ld/12369
	* ldfile.c: Updated for 2 stage linking and support for mixed
	IR/non-IR objects.
	* ldlang.c: Likewise.

	* ldgram.y (INPUT): Call lang_enter_input and lang_leave_input.
	(GROUP): Update calls to lang_enter_group and
	lang_leave_group.
	(input_list): Call cmdline_option_append_lang_input.

	* ldlang.h (lang_input_statement_struct): Add stage1.
	(lang_init): Take a bfd_boolean argument.
	(lang_enter_group): Updated to take a boolean argument.
	(lang_leave_group): Likewise.
	(lang_enter_input): New.
	(lang_leave_input): Likewise.
	(cmdline_enum_type): Likewise.
	(cmdline_header_type): Likewise.
	(cmdline_input_statement_type): Likewise.
	(cmdline_file_type): Likewise.
	(cmdline_bfd_type): Likewise.
	(cmdline_union_type): Likewise.
	(cmdline_list_type): Likewise.
	(cmdline_linker_script): Likewise.
	(cmdline_option_append): Likewise.
	(cmdline_option_append_lang_input): Likewise.
	(cmdline_option_insert_claimed_output): Likewise.
	(cmdline_set_next_claimed_output): Likewise.
	(cmdline_claimed_archive_member_list_append): Likewise.
	(cmdline_emit_object_only_section): Likewise.
	(cmdline_check_object_only_section): Likewise.
	(cmdline_remove_object_only_files): Likewise.

	* ldmain.c (main): Pass FALSE to lang_init.  Use
	ld_parse_linker_script.  Set link_info.output_bfd to NULL
	after close.  Call cmdline_emit_object_only_section if needed.
	(ld_parse_linker_script): New.
	(add_archive_element): Updated for 2 stage linking and support
	for mixed IR/non-IR objects.

	* ldmain.h (ld_parse_linker_script): New.

	* lexsup.c (parse_args): Call cmdline_option_append if needed.
	Set and clear cmdline_linker_script before and after parsing
	linker script.  Update calls to lang_enter_group and
	lang_leave_group.

	* plugin.c (IRONLY_SUFFIX): Removed.
	(IRONLY_SUFFIX_LEN): Likewise.
	(plugin_opt_plugin_arg): Ignore -pass-through=.
	(plugin_get_ir_dummy_bfd): Don't use IRONLY_SUFFIX.  Set
	BFD_PLUGIN_DUMMY on dummy IR input.
	(is_ir_dummy_bfd): Check BFD_PLUGIN_DUMMY.
	(get_symbols): Re-indent.
	(add_input_file): Replace lang_add_input_file with
	cmdline_list_insert_claimed_output.
	(add_input_library): Likewise

	* emultempl/alphaelf.em (alpha_finish): Replace finish_default
	with gld${EMULATION_NAME}_finish ().

	* emultempl/armelf.em (gld${EMULATION_NAME}_finish): Renamed
	to ...
	(arm_finish): This.  Replace finish_default with
	gld${EMULATION_NAME}_finish.
	(LDEMUL_FINISH): Set to arm_finish.

	* emultempl/elf32.em (orphan_init_done): Moved out of
	gld${EMULATION_NAME}_place_orphan.
	(gld${EMULATION_NAME}_place_orphan): Initialize hold.
	(gld${EMULATION_NAME}_finish): New.
	(ld_${EMULATION_NAME}_emulation): Use gld${EMULATION_NAME}_finish.

	* emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Renamed
	to ...
	(ppc_finish): This.  Replace finish_default with
	gld${EMULATION_NAME}_finish.
	(LDEMUL_FINISH): Set to ppc_finish.

	* emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Renamed
	to ...
	(spu_finish): This.  Replace finish_default with
	gld${EMULATION_NAME}_finish.
	(LDEMUL_FINISH): Set to spu_finish.

	* scripttempl/armbpabi.sc: Also discard .gnu_object_only
	sections.
	* scripttempl/elf.sc: Likewise.
	* scripttempl/elf32sh-symbian.sc: Likewise.
	* scripttempl/elf64hppa.sc: Likewise.
	* scripttempl/elfxtensa.sc: Likewise.
	* scripttempl/mep.sc: Likewise.
	* scripttempl/pe.sc: Likewise.
	* scripttempl/pep.sc: Likewise.

ld/testsuite/

2011-01-05  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/12248
	PR ld/12277
	PR ld/12291
	PR ld/12323
	PR ld/12365
	PR ld/12369
	* ld-plugin/func1p.c: New.
	* ld-plugin/func2.c: Likewise.
	* ld-plugin/func2i.c: Likewise.
	* ld-plugin/func3h.c: Likewise.
	* ld-plugin/lto-1a.c: Likewise.
	* ld-plugin/lto-1b.c: Likewise.
	* ld-plugin/lto.exp: Likewise.

	* ld-plugin/plugin.exp: Add object files for symbols claimed
	or created by testplugin.
	* ld-plugin/plugin-7.d: Updated.
	* ld-plugin/plugin-8.d: Likewise.
	* ld-plugin/plugin-9.d: Likewise.

diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 84fc75d..1fdcb52 100644
