aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl/elf.sc
AgeCommit message (Collapse)AuthorFilesLines
2004-05-19 * ldgram.y (sect_constraint): New.Jakub Jelinek1-2/+4
(ONLY_IF_RO, ONLY_IF_RW): New tokens. (section): Add sect_constraint. Pass additional argument to lang_enter_output_section_statement. * mri.c (mri_draw_tree): Pass additional argument to lang_enter_output_section_statement. * emultempl/pe.em (place_orphan): Likewise. (output_prev_sec_find): Disregard output section statements with constraint == -1. * emultempl/mmo.em (output_prev_sec_find): Likewise. (mmo_place_orphan): Pass additional argument to lang_enter_output_section_statement. * emultempl/elf32.em (output_prev_sec_find): Disregard output section statements with constraint == -1. (place_orphan): Pass additional argument to lang_enter_output_section_statement. * ldlang.c (lang_enter_overlay_section): Likewise. (lang_output_section_find_1): New. (lang_output_section_find): Use it. (lang_output_section_statement_lookup_1): New. (lang_output_section_statement_lookup): Use it. (check_section_callback, check_input_sections): New. (map_input_to_output_sections): Check if all input sections are readonly if ONLY_IF_RO or ONLY_IF_RW was seen. (strip_excluded_output_sections): Disregard output section statements with constraint == -1. (lang_record_phdrs): Likewise. (lang_enter_output_section_statement): Add constraint argument. Use lang_output_section_statement_lookup_1. * ldlang.h (lang_output_section_statement_type): Add constraint and all_input_readonly fields. (lang_enter_output_section_statement): Adjust prototype. * ldlex.l (ONLY_IF_RO, ONLY_IF_RW): New tokens. * scripttempl/elf.sc (.eh_frame, .gcc_except_table): Move into text segment if all input sections are readonly.
2004-05-11bfd/Jakub Jelinek1-11/+52
* elflink.c (elf_bfd_final_link): Don't output STT_SECTION symbol into .dynsym if elf_section_data (sec)->dynindx <= 0. Adjust counting of last_local. (_bfd_elf_link_renumber_dynsyms): Don't assign dynindx to sections other than SHT_PROGBITS/SHT_NOBITS and neither for .got/.got.plt/.plt created by the linker nor !SHF_ALLOC. * elf32-i386.c (elf_i386_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. Set sh_entsize for .got section in addition to .got.plt. (elf_i386_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. (elf64_x86_64_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. Set sh_entsize for .got section in addition to .got.plt. * elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_RELRO. (bfd_section_from_phdr): Likewise. (map_sections_to_segments): Likewise. (assign_file_positions_for_segments): Likewise. (get_program_header_size): Likewise. * elflink.c (bfd_elf_size_dynamic_sections): Set elf_tdata (output_bfd)->relro from info->relro. * elf-bfd.h (struct elf_obj_tdata): Add relro field. include/ * bfdlink.h (struct bfd_link_info): Add relro, relro_start and relro_end fields. * elf/common.h (PT_GNU_EH_FRAME, PT_GNU_STACK): Add comments. (PT_GNU_RELRO): Define. binutils/ * readelf.c (get_segment_type): Handle PT_GNU_RELRO. ld/ * genscripts.sh: Generate -z combreloc -z now -z relro scripts for binaries, -shared and -pie. * emulparams/elf_i386.sh (SEPARATE_GOTPLT): Set. * emulparams/elf_x86_64.sh (SEPARATE_GOTPLT): Set. * emulparams/elf32ppc.sh (OTHER_READWRITE_SECTIONS): Rename to... (OTHER_RELRO_SECTIONS): ... this. * ldlex.l (DATA_SEGMENT_RELRO_END): Add. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z relro and -z norelro. (gld${EMULATION_NAME}_list_options): Add it to usage. (gld${EMULATION_NAME}_get_script): Return -z combreloc -z now -z relro scripts when appropriate. * scripttempl/elf.sc: Unset SEPARATE_GOTPLT if RELRO_NOW is set. Create separate .got.plt section if SEPARATE_GOTPLT. Move sections which are only written during relocation handling to the beginning of RW segment. If NO_SMALL_DATA, move .got before .data. Add DATA_SEGMENT_RELRO_END directive. Include OTHER_RELRO_SECTIONS. * ldgram.y (DATA_SEGMENT_RELRO_END): Add. * ldexp.c (exp_print_token): Handle DATA_SEGMENT_RELRO_END. (fold_unary): Likewise. (fold_binary): Handle -z relro. * ldexp.h (struct exp_data_seg): Add exp_dataseg_relro_seen and exp_dataseg_relro_adjust phases. Add relro_end field. * ldmain.c (main): Initialize link_info.relro to FALSE. * ldlang.c (lang_size_sections): Handle -z relro. ld/testsuite/ * ld-i386/tlspic.rd: Adjust for section reordering changes and removal of unneeded STT_SECTION symbols from .dynsym. * ld-i386/tlspic.dd: Likewise. * ld-i386/tlspic.sd: Likewise. * ld-i386/tlsbin.rd: Likewise. * ld-i386/tlsbinpic.s: Likewise. * ld-i386/tlsbin.dd: Likewise. * ld-i386/tlsbin.sd: Likewise. * ld-i386/tlsnopic.rd: Likewise. * ld-i386/tlsnopic1.s: Likewise. * ld-i386/combreloc.d: Likewise. * ld-i386/tlsnopic.dd: Likewise. * ld-i386/tlsnopic.sd: Likewise. * ld-x86-64/tlspic.rd: Likewise. * ld-x86-64/tlspic.dd: Likewise. * ld-x86-64/tlsbin.dd: Likewise. * ld-x86-64/tlspic.sd: Likewise. * ld-x86-64/tlsbin.sd: Likewise. * ld-x86-64/tlspic.td: Likewise. * ld-x86-64/tlsbin.td: Likewise. * ld-x86-64/tlsbin.rd: Likewise. * ld-s390/tlspic1.s: Likewise. * ld-s390/tlsbinpic.s: Likewise. * ld-s390/tlspic.rd: Likewise. * ld-s390/tlsbin.rd: Likewise. * ld-s390/tlspic.dd: Likewise. * ld-s390/tlsbin.dd: Likewise. * ld-s390/tlsbin.sd: Likewise. * ld-s390/tlsbin.td: Likewise. * ld-s390/tlspic.sd: Likewise. * ld-s390/tlspic.td: Likewise. * ld-s390/tlspic1_64.s: Likewise. * ld-s390/tlsbinpic_64.s: Likewise. * ld-s390/tlspic_64.rd: Likewise. * ld-s390/tlsbin_64.rd: Likewise. * ld-s390/tlspic_64.dd: Likewise. * ld-s390/tlsbin_64.dd: Likewise. * ld-s390/tlspic_64.sd: Likewise. * ld-s390/tlspic_64.td: Likewise. * ld-s390/tlsbin_64.td: Likewise. * ld-s390/tlsbin_64.sd: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.t: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlstocso.r: Likewise. * ld-powerpc/tlstocso.g: Likewise. * ld-ia64/tlspic.rd: Likewise. * ld-ia64/tlspic.dd: Likewise. * ld-ia64/tlspic.sd: Likewise. * ld-ia64/tlspic.td: Likewise. * ld-ia64/tlsbin.rd: Likewise. * ld-ia64/tlsbin.sd: Likewise. * ld-ia64/tlsbin.td: Likewise. * ld-elfvsb/elfvsb.exp: XFAIL non-PIC load offset tests on s390x. * ld-shared/shared.exp: Likewise.
2004-04-21 * scripttempl/elf.sc (.text): Add KEEP for .text.*personality*.Eric Botcazou1-1/+3
(.data): Add KEEP for .gnu.linkonce.d.*personality*. (.gcc_except_table): Add KEEP for self and accept .gcc_except_table.*.
2003-10-102003-10-09 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-1/+1
* scripttempl/elf.sc (__executable_start): Provide.
2003-07-10 * emulparams/elf64ppc.sh (OTHER_GOT_SECTIONS): Don't define.Alan Modra1-1/+2
(GOT): Define. * emultempl/ppc64elf.em (stub_added): New static var. (ppc_create_output_section_statements): Call ppc64_elf_init_stub_bfd. (ppc_add_stub_section): Set stub_added. (gld${EMULATION_NAME}_finish): Look for .got rather than .toc. Adjust ppc64_elf_size_stubs call and test for stubs. * scripttempl/elf.sc (GOT): Define and use.
2003-07-04bfd/Jakub Jelinek1-3/+4
* elfxx-ia64.c (struct elfNN_ia64_link_hash_table): Add rel_fptr_sec. (elfNN_ia64_dynamic_symbol_p): Change info->shared into !info->executable. (get_fptr): For -pie create .opd as writable section and create .rela.opd as well. (elfNN_ia64_check_relocs): Change info->shared into !info->executable. (allocate_fptr): Likewise. (allocate_dynrel_entries): Account for a relative reloc for -pie @fptr(). Don't account for a relative reloc if -pie want_ltoff_fptr for undefweak symbol. Account for an IPLT reloc in .rela.opd section if -pie. (set_got_entry): Don't create a relative reloc if -pie want_ltoff_fptr for undefweak symbol. (set_fptr_entry): Emit an IPLT reloc in .rela.opd for -pie. (elfNN_ia64_relocate_section): Emit a relative reloc for -pie @fptr(). * elfxx-ia64.c (elfNN_ia64_relocate_section): Issue undefined_symbol even if -pie. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. ld/ * emulparams/elf64_ia64.sh (OTHER_READONLY_SECTIONS): Don't include .opd if -pie. (OTHER_READWRITE_SECTIONS): Include .opd if -pie. * scripttempl/elf.sc: Use SHLIB_DATA_ADDR instead of DATA_ADDR if -pie.
2003-06-03binutils/Jakub Jelinek1-0/+2
* readelf.c (get_segment_type): Handle PT_GNU_STACK. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_STACK. (bfd_section_from_phdr): Likewise. (map_sections_to_segments): Create PT_GNU_STACK segment header. (get_program_header_size): Count with PT_GNU_STACK. * elf-bfd.h (struct elf_obj_tdata): Add stack_flags. * elflink.h (bfd_elfNN_size_dynamic_sections): Set stack_flags. include/ * bfdlink.h (struct bfd_link_info): Add execstack and noexecstack. * elf/common.h (PT_GNU_STACK): Define. ld/ * ldgram.y (phdr_type): Grok PT_GNU_STACK. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add -z execstack and -z noexecstack. (gld${EMULATION_NAME}_list_options): Likewise. * scripttempl/elf.sc: If not -r, discard .note.GNU-stack section.
2003-05-30bfd/Jakub Jelinek1-1/+2
* elflink.h (elf_link_add_object_symbols): Use !info->executable instead of info->shared where appropriate. (bfd_elfNN_size_dynamic_sections, elf_link_output_extsym): Likewise. * elflink.c (_bfd_elf_create_got_section): Likewise. (_bfd_elf_link_create_dynamic_sections): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. * elf32-i386.c (elf_i386_size_dynamic_sections): Create .interp section and DT_DEBUG dynamic tag even for position independent executables. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise. * elf32-s390.c (elf_s390_size_dynamic_sections: Likewise. * elf64-ppc.c (ppc64_elf_size_dynamic_sections: Likewise. * elf64-s390.c (elf_s390_size_dynamic_sections: Likewise. * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections: Likewise. * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections: Likewise. * elf32-sparc.c (elf32_sparc_size_dynamic_sections: Likewise. * elf64-alpha.c (elf64_alpha_size_dynamic_sections: Likewise. * elf64-sparc.c (sparc64_elf_size_dynamic_sections: Likewise. include/ * bfdlink.h (struct bfd_link_info): Add pie and executable bits. ld/ * lexsup.c (OPTION_PIE): Define. (ld_options): Add -pie and --pic-executable options. (parse_args): Handle OPTION_PIE. * ldmain.c (main): Initialize link_info.pie and link_info.executable. * genscripts.sh: Generate PIE scripts. * ld.texinfo: Document -pie and --pic-executable options. * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): (gld${EMULATION_NAME}_place_orphan): Likewise. (gld${EMULATION_NAME}_get_script): Include PIE scripts. * scripttempl/elf.sc: In PIE scripts set . the same way as in shared scripts. * emulparams/elf_i386.sh (GENERATE_PIE_SCRIPT): Set to yes. * emulparams/elf64_ia64.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf32ppc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64ppc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf_x86_64.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf_s390.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf32_sparc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64_sparc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64alpha.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64_s390.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf_i386.sh (GENERATE_PIE_SCRIPT): Likewise.
2003-04-14 * scripttempl/elf.sc (CTOR): Handle crtbeginS.o, crtendS.o andAlan Modra1-4/+4
other variants of crtbegin.o, crtend.o. (DTOR): Likewise. * scripttempl/crisaout.sc (ctors, dtors): Likewise. * scripttempl/elf_chaos.sc (CTOR, DTOR): Likewise. * scripttempl/elfd10v.sc (CTOR, DTOR): Likewise. * scripttempl/elfd30v.sc (CTOR, DTOR): Likewise. * scripttempl/elfxtensa.sc (CTOR, DTOR): Likewise. * scripttempl/iq2000.sc (CTOR, DTOR): Likewise. * scripttempl/mmo.sc (ctors, dtors): Likewise. * scripttempl/xstormy16.sc (CTOR, DTOR): Likewise.
2002-09-25 * genscripts.sh (SEGMENT_SIZE): Use MAXPAGESIZE beforeAlan Modra1-2/+2
TARGET_PAGE_SIZE. * scripttempl/elf.sc (DATA_SEGMENT_ALIGN): Incorporate SEGMENT_SIZE alignment. * emulparams/elf64ppc.sh (DATA_ADDR): Delete. (SEGMENT_SIZE): Define.
2002-08-01Revert Adam Nemet's THUMB PLT patchNick Clifton1-4/+0
2002-07-31Add support for Thumb PLT entries with interworkingNick Clifton1-0/+4
2002-06-07 * scripttempl/elf.sc (.tbss): Fix mismatched parentheses/braces.Alan Modra1-1/+1
2002-05-23 * elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCALJakub Jelinek1-0/+8
for symbols from SHF_TLS section. (_bfd_elf_print_private_bfd_data): Add PT_TLS. (elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections. (map_sections_to_segments): Build PT_TLS segment if necessary. (assign_file_positions_for_segments): Likewise. (get_program_header_size): Account for PT_TLS segment. (swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from SEC_THREAD_LOCAL sections to STT_TLS. * reloc.c: Add 386 and IA-64 TLS relocs. * section.c (SEC_THREAD_LOCAL): Define. (SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS): Remove. * elflink.h (elf_link_add_object_symbols): Support .tcommon. (size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS unconditionally. (struct elf_final_link_info): Add first_tls_sec. (elf_bfd_final_link): Set first_tls_sec. Compute elf_hash_table (info)->tls_segment. (elf_link_output_extsym): Handle STT_TLS symbols. (elf_link_input_bfd): Likewise. * syms.c (BSF_THREAD_LOCAL): Define. * bfd-in2.h: Rebuilt. * libbfd.h: Rebuilt. * elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff, elf_i386_mkobject, elf_i386_object_p): New functions. (elf_howto_table): Add TLS relocs. (elf_i386_reloc_type_lookup): Support TLS relocs. (elf_i386_info_to_howto_rel): Likewise. (struct elf_i386_link_hash_entry): Add tls_type. (struct elf_i386_obj_tdata): New. (elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type): New macros. (struct elf_i386_link_hash_table): Add tls_ldm_got. (link_hash_newfunc): Clear tls_type. (elf_i386_check_relocs): Support TLS relocs. (elf_i386_gc_sweep_hook): Likewise. (allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (bfd_elf32_mkobject, elf_backend_object_p): Define. * elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset, dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done, want_tprel, want_dtpmod, want_dtprel. (elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions. (ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to R_IA64_LTOFF_TPREL22. (elf_code_to_howto_index): Add TLS relocs. (elfNN_ia64_check_relocs): Support TLS relocs. (allocate_global_data_got): Account for TLS .got data. (allocate_dynrel_entries): Account for TLS dynamic relocations. (elfNN_ia64_install_value): Supprt TLS relocs. (set_got_entry): Support TLS relocs. (elfNN_ia64_relocate_section): Likewise. * config/obj-elf.c (elf_common): Renamed from obj_elf_common. (obj_elf_common): Call elf_common. (obj_elf_tls_common): New function. (elf_pseudo_tab): Support .tls_common. (special_sections): Add .tdata and .tbss. (obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS sections. (obj_elf_parse_section_letters): Support T in section flags (SHF_TLS). (obj_elf_parse_section_letters): Include T in error message. * config/tc-ppc.c (ppc_section_letter): Likewise. * config/tc-alpha.c (alpha_elf_section_letter): Likewise. (tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as SEC_MERGE. * config/tc-sparc.c (md_apply_fix3): Likewise. * config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs. Define them if not BFD_ASSEMBLER. (lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF and @NTPOFF. (md_apply_fix3): Add TLS relocs. * config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE, FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE, FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE. (pseudo_func): Support @dtpmod(), @dtprel() and @tprel(). (ia64_elf_section_letter): Include T in error message. (md_begin): Support TLS operators. (md_operand): Likewise. (ia64_gen_real_reloc_type): Support TLS relocs. * testsuite/gas/i386/tlspic.s: New file. * testsuite/gas/i386/tlsd.s: New file. * testsuite/gas/i386/tlsnopic.s: New file. * testsuite/gas/i386/tlsd.d: New file. * testsuite/gas/i386/tlsnopic.d: New file. * testsuite/gas/i386/tlspic.d: New file. * testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests. * testsuite/gas/ia64/tls.s: New file. * testsuite/gas/ia64/tls.d: New file. * testsuite/gas/ia64/ia64.exp: Add tls test. * write.c (adjust_reloc_syms): Don't change symbols in SEC_THREAD_LOCAL sections to STT_SECTION + addend. * elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define. * elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22. * elf/i386.h: Add TLS relocs. * scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss. * ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for output section if necessary. Handle .tbss. (lang_size_sections): Clear _raw_size for .tbss section (it allocates space in PT_TLS segment only). * ldwrite.c (build_link_order): Build link order for .tbss too. * readelf.c (get_segment_type): Add PT_TLS. (get_elf_section_flags): Add SHF_TLS. (get_dynamic_flags): Optimize. Add DF_STATIC_TLS. (process_dynamic_segment): Use puts instead of printf. (get_symbol_type): Support STT_TLS. * objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS. Add SEC_THREAD_LOCAL.
2002-03-05 * scripttempl/elf.sc: Only use DATA_SEGMENT_END() together withJakub Jelinek1-2/+6
DATA_SEGMENT_ALIGN.
2002-03-042002-03-04 H.J. Lu <hjl@gnu.org>H.J. Lu1-17/+17
* scripttempl/elf.sc: Put .preinit_array, .init_array and .fini_array in the data segment.
2002-03-04 * scripttempl/elf.sc: Correct syntax errors in 2002-03-01 commit.Alan Modra1-2/+2
2002-03-02 * scripttempl/elf.sc (SECTIONS): Add entries for .preinit_array,Richard Henderson1-0/+17
.init_array, and .fini_array.
2002-02-12 * ldlex.l (DATA_SEGMENT_ALIGN, DATA_SEGMENT_END): New tokens.Jakub Jelinek1-2/+7
* ldgram.y (DATA_SEGMENT_ALIGN, DATA_SEGMENT_END): New tokens. (exp): Add DATA_SEGMENT_ALIGN (exp, exp) and DATA_SEGMENT_END (exp). * ldexp.c (exp_data_seg): New variable. (exp_print_token): Handle DATA_SEGMENT_ALIGN and DATA_SEGMENT_END. (fold_binary): Handle DATA_SEGMENT_ALIGN. (exp_fold_tree): Handle DATA_SEGMENT_END. Pass allocation_done when recursing instead of hardcoding lang_allocating_phase_enum. * ldexp.h (exp_data_seg): New. * ldlang.c (lang_size_sections_1): Renamed from lang_size_sections. (lang_size_sections): New. * ld.texinfo (DATA_SEGMENT_ALIGN, DATA_SEGMENT_END): Document. * scripttempl/elf.sc: Use DATA_SEGMENT_ALIGN and DATA_SEGMENT_END if COMMONPAGESIZE is defined. * emulparams/elf_i386.sh (COMMONPAGESIZE): Set to 4K. * emulparams/elf32_sparc.sh (COMMONPAGESIZE): Set to 8K. * emulparams/elf64_sparc.sh (COMMONPAGESIZE): Set to 8K. * emulparams/elf64alpha.sh (COMMONPAGESIZE): Set to 8K. * emulparams/elf64_ia64.sh (COMMONPAGESIZE): Set to 16K for shared libraries only.
2001-12-13 * elf-bfd.h (enum elf_link_info_type): New.Jakub Jelinek1-0/+1
(struct bfd_elf_section_data): Remove stab_info and merge_info fields, add sec_info and sec_info_type. (struct elf_obj_tdata): Add eh_frame_hdr field. (_bfd_elf_discard_section_eh_frame): New prototype. (_bfd_elf_discard_section_eh_frame_hdr): Likewise. (_bfd_elf_eh_frame_section_offset): Likewise. (_bfd_elf_write_section_eh_frame): Likewise. (_bfd_elf_write_section_eh_frame_hdr): Likewise. * Makefile.am (BFD32_BACKENDS): Add elf-eh-frame.lo. (BFD32_BACKENDS_CFILES): Add elf-eh-frame.c. (elf-eh-frame.lo): New. * Makefile.in: Rebuilt. * configure.in (elf): Add elf-eh-frame.lo. * configure: Rebuilt. * elf.c (_bfd_elf_print_private_bfd_data): Support PT_GNU_EH_FRAME. (map_sections_to_segments): Create PT_GNU_EH_FRAME if requested. (get_program_header_size): Take into account PT_GNU_EH_FRAME segment. (_bfd_elf_rela_local_sym): Use sec_info_type and sec_info. (_bfd_elf_rel_local_sym): Likewise. (_bfd_elf_section_offset): Likewise. Call _bfd_elf_eh_frame_section_offset too. * elfxx-ia64.c (elfNN_ia64_relocate_section): Use sec_info_type and sec_info. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf-eh-frame.c: New file. * elflink.h (elf_link_add_object_symbols): Don't optimize SHF_MERGE .stab sections. Set sec_info_type, use sec_info instead of merge_info and stab_info. (elf_link_create_dynamic_sections): Create .eh_frame_hdr section if --eh-frame-hdr. (elf_bfd_final_link): Write .eh_frame_hdr section. (elf_link_sec_merge_syms): Use sec_info_type and sec_info. (elf_link_input_bfd): Likewise. Call _bfd_elf_write_section_eh_frame to write .eh_frame sections. (elf_bfd_discard_info): Add output_bfd argument. Call _bfd_elf_discard_section_eh_frame and _bfd_elf_discard_section_eh_frame_hdr. (elf_section_ignore_discarded_relocs): Use sec_info_type, not section names. * bfd-in.h (bfd_elf32_discard_info, bfd_elf64_discard_info): Adjust prototypes. * bfd-in2.h (bfd_elf32_discard_info, bfd_elf64_discard_info): Likewise. * elf/common.h (PT_GNU_EH_FRAME): Define. * bfdlink.h (struct bfd_link_info): Add eh_frame_hdr field. * emultempl/elf32.em (finish): Supply output_bfd to bfd_elf*_discard_info. (OPTION_EH_FRAME_HDR): Define. (longopts): Add --eh-frame-hdr. (parse_args): Handle it. (list_options): Add --eh-frame-hdr to help. * emultempl/hppaelf.em (finish): Supply output_bfd to bfd_elf*_discard_info. * scripttempl/elf.sc (.eh_frame_hdr): Add. * readelf.c (get_segment_type): Support PT_GNU_EH_FRAME.
2001-11-272001-11-27 H.J. Lu <hjl@gnu.org>H.J. Lu1-28/+38
* emulparams/elf_i386.sh (NO_SMALL_DATA): Set to yes. * emulparams/elf_i386_be.sh (NO_SMALL_DATA): Likewise. * emulparams/elf_i386_chaos.sh (NO_SMALL_DATA): Likewise. * emulparams/elf_i386_ldso.sh (NO_SMALL_DATA): Likewise. * emulparams/elf_x86_64.sh (NO_SMALL_DATA): Likewise. * emulparams/m68kelf.sh (NO_SMALL_DATA): Likewise. * emulparams/elf32_sparc.sh (NO_SMALL_DATA): Likewise. * emulparams/elf64_sparc.sh (NO_SMALL_DATA): Likewise. * scripttempl/elf.sc (SBSS): New. Define if ${NO_SMALL_DATA} is not empty. (SDATA): Likewise. (REL_SDATA): Likewise. (REL_SBSS): Likewise. (REL_SDATA2): Likewise. (REL_SBSS2): Likewise. (SBSS2): Define if ${NO_SMALL_DATA} is not empty. (SDATA2): Likewise.
2001-11-22 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Define.Alan Modra1-169/+84
(config.status): Delete rule. Add extra dependencies to cover sourced emulparams files. * Makefile.in: Regenerate. * scripttempl/elf.sc: Order <section>, <section>.* and corresponding linkonce sections as seen in input files. Formatting fixes. Zero vma of all sections if not relocating. (STACK): Define and insert if STACK_ADDR defined. (OTHER_RELOCATING_SECTIONS): Delete. (OTHER_END_SYMBOLS): Define. (OTHER_READONLY_SECTIONS): Always insert, not just when relocating. (OTHER_READWRITE_SECTIONS): Likewise. (OTHER_GOT_SECTIONS): Likewise. (OTHER_SDATA_SECTIONS): Likewise. (OTHER_BSS_SECTIONS): Likewise. * scripttempl/elfi370.sc (OTHER_READONLY_SECTIONS): Likewise. (OTHER_READWRITE_SECTIONS): Likewise. * scripttempl/nw.sc (OTHER_READONLY_SECTIONS): Likewise. (OTHER_READWRITE_SECTIONS): Likewise * emulparams/armelf.sh (OTHER_RELOCATING_SECTIONS): Delete. (STACK_ADDR): Define. * emulparams/armelf_oabi.sh: As for armelf.sh. * emulparams/elf32mcore.sh: As for armelf.sh. * emulparams/h8300elf.sh: As for armelf.sh. * emulparams/mn10200.sh: As for armelf.sh. * emulparams/shelf.sh: As for armelf.sh. * emulparams/elf32fr30.sh (OTHER_RELOCATING_SECTIONS): Delete. (OTHER_END_SYMBOLS): Define. * emulparams/m32relf.sh: As for elf32fr30.sh. * emulparams/h8300helf.sh: As for elf32fr30.sh. * emulparams/h8300self.sh: As for elf32fr30.sh. * emulparams/criself.sh (OTHER_READONLY_SECTIONS): Protect symbol defines with RELOCATING test. (OTHER_SDATA_SECTIONS): Likewise. (OTHER_RELOCATING_SECTIONS): Delete, replacing with.. (OTHER_END_SYMBOLS): ..this. * emulparams/crislinux.sh: As for criself.sh. * emulparams/elf32bmipn32.sh (OTHER_SDATA_SECTIONS): Zero vma if not relocating. (OTHER_RELOCATING_SECTIONS): Delete, replacing with.. (OTHER_SECTIONS): ..this. Zero vma if not relocating. Order normal and linkonce sections as seen in input files. * emulparams/elf32bmip.sh (DATA_ADDR): Don't define if EMBEDDED. (TEXT_DYNAMIC): Likewise. (INITIAL_READONLY_SECTIONS): Zero vma if not relocating. (OTHER_SDATA_SECTIONS): Likewise. * emulparams/elf32ppc.sh (OTHER_READWRITE_SECTIONS): Likewise. * emulparams/shlelf_linux.sh (OTHER_READWRITE_SECTIONS): Likewise. * emulparams/elf64alpha.sh (OTHER_READONLY_SECTIONS): Likewise. * emulparams/hppalinux.sh (OTHER_READONLY_SECTIONS): Likewise. * emulparams/elf64_aix.sh (OTHER_GOT_SECTIONS): Likewise. (OTHER_PLT_RELOC_SECTIONS): Likewise. (OTHER_READONLY_SECTIONS): Likewise. Order normal and linkonce sections as seen in input files. * emulparams/elf64_ia64.sh: As for emulparams/elf64_aix.sh. * emulparams/hppa64linux.sh (OTHER_READONLY_SECTIONS): Zero vma if not relocating. (OTHER_READWRITE_SECTIONS, OTHER_BSS_SECTIONS): Likewise. (OTHER_BSS_END_SYMBOLS): Merge from elf64hppa.sh. * emulparams/elf64mmix.sh (OTHER_RELOCATING_SECTIONS): Delete. (OTHER_SECTIONS): Instead, use this.. (OTHER_END_SYMBOLS): ..and this. * emulparams/elf32b4300.sh: Source elf32bmip.sh, remove duplicates. * emulparams/elf32bsmip.sh: Likewise. * emulparams/elf32btsmip.sh: Likewise. * emulparams/elf32ebmip.sh: Likewise. * emulparams/elf32lmip.sh: Likewise. * emulparams/elf32elmip.sh: Source elf32lmip.sh, remove duplicates. * emulparams/elf32lsmip.sh: Likewise. * emulparams/elf32ltsmip.sh: Source elf32btsmip.sh, remove duplicates. * emulparams/elf32l4300.sh: Source elf32b4300.sh, remove duplicates. * emulparams/elf64bmip.sh: Source elf32bmipn32.sh, remove duplicates. * emulparams/elf64btsmip.sh: Likewise. * emulparams/elf64ltsmip.sh: Source elf64btsmip.sh, remove duplicates. * emulparams/elf32lppc.sh: Source elf32ppc.sh, remove duplicates. * emulparams/elf32ppclinux.sh: Likewise. * emulparams/elf32ppcsim.sh: Likewise. * emulparams/elf32lppcsim.sh: Source elf32lppc.sh, remove duplicates. * emulparams/elf64hppa.sh: Source hppa64linux.sh, remove duplicates. * emulparams/h8300helf.sh: Source h8300elf.sh, remove duplicates. * emulparams/h8300self.sh: Likewise. * emulparams/mn10300.sh: Source mn10200.sh, remove duplicates. * emulparams/sh.sh: Comment. * emulparams/shl.sh: Source sh.sh, remove duplicates. * emulparams/shlelf.sh: Source shelf.sh, remove duplicates. * emulparams/shelf_linux.sh: Source shlelf_linux.sh, remove duplicates.
2001-08-23 * elf-bfd.h (enum elf_reloc_type_class): New.Jakub Jelinek1-1/+26
(struct elf_backend_data): Add elf_backend_reloc_type_class. (_bfd_elf_reloc_type_class): New. * elfxx-target.h (elf_backend_reloc_type_class): Define. (elfNN_bed): Add elf_backend_reloc_type_class. * elf.c (_bfd_elf_reloc_type_class): New. * elf32-i386.c (elf_i386_check_relocs): Set DF_TEXTREL if the reloc is against read-only section. (elf_i386_size_dynamic_sections): Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. (elf_i386_reloc_type_class): New. (elf_backend_reloc_type_class): Define. * elf32-sparc.c (elf32_sparc_check_relocs): Set DF_TEXTREL if the reloc is against read-only section. (elf32_sparc_size_dynamic_sections): Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. (elf32_sparc_reloc_type_class): New. (elf_backend_reloc_type_class): Define. * elf64-sparc.c (sparc64_elf_check_relocs): Set DF_TEXTREL if the reloc is against read-only section. (sparc64_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. (sparc64_elf_reloc_type_class): New. (elf_backend_reloc_type_class): Define. * elfxx-ia64.c (struct elfNN_ia64_link_hash_table): Add reltext field. (elfNN_ia64_hash_table_create): Clear ia64_info. (get_reloc_section): Set DF_TEXTREL if the reloc is against read-only section. (elfNN_ia64_size_dynamic_sections): Use ia64_info->reltext flag instead of looking up section names for DT_TEXTREL. (elfNN_ia64_reloc_type_class): New. (elf_backend_reloc_type_class): Define. * elflink.h (size_dynamic_sections): Add spare DT_NULL tags. (struct elf_link_sort_rela): New. (elf_link_sort_cmp1, elf_link_sort_cmp2, elf_link_sort_relocs): New. (elf_bfd_final_link): Call elf_link_sort_relocs. Convert one spare DT_NULL into DT_RELCOUNT resp. DT_RELACOUNT if necessary. * bfdlink.h (struct bfd_link_info): Add combreloc and spare_dynamic_tags fields. * emultempl/elf32.em (place_orphan): Place orphan .rel* sections into .rel.dyn resp. .rela.dyn if combreloc. (get_script): If .x linker script is equal to .xn, only put it once into the binary. Add .xc and .xsc scripts. (parse_args): Handle -z combreloc and -z nocombreloc. * scripttempl/elf.sc (.rela.sbss): Fix a typo. For .xc and .xsc scripts put all .rel* or .rela* input sections but .rel*.plt and PLT-like sections into .rel.dyn resp. .rela.dyn. * genscripts.sh (GENERATE_COMBRELOC_SCRIPT): Set if SCRIPT_NAME is elf. Strip trailing whitespace from script. Generate .xc and .xsc scripts if requested. * ldmain.c (main): Initialize link_info.combreloc and link_info.spare_dynamic_tags. * lexsup.c (OPTION_SPARE_DYNAMIC_TAGS): Define. (ld_options): Add --spare-dynamic-tags option. (parse_args): Likewise. * ld.texinfo: Document -z combreloc and -z nocombreloc. * ldint.texinfo: Document .xc and .xsc linker scripts. * NEWS: Add notes about -z combreloc and SHF_MERGE.
2001-08-17 * ld.texinfo: Document that fill values now use the four leastAlan Modra1-1/+1
significant bytes. * emulparams/elf32fr30.sh (NOP): Update. * emulparams/elf32mcore.sh: Likewise. * emulparams/elf64_s390.sh: Likewise. * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_be.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_s390.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emulparams/i386moss.sh: Likewise. * emulparams/i386nw.sh: Likewise. * emulparams/m68kelf.sh: Likewise. * scripttempl/elf.sc: Update NOP comment. * scripttempl/elfi370.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/nw.sc: Likewise.
2001-08-12 * scripttempl/elf.sc, scripttempl/elfd30v.sc,Richard Henderson1-0/+1
scripttempl/elfm68hc11.sc, scripttempl/elfm68hc12.sc, scripttempl/v850.sc: Keep .jcr data.
2001-08-09 * scripttempl/elf.sc: Move non-text .dynamic section beforeAlan Modra1-3/+5
.plt/.got/.sdata* group. (OTHER_GOT_SECTIONS): Move to immediately after .got. (OTHER_SDATA_SECTIONS): Add. * emulparams/criself.sh: Use OTHER_SDATA_SECTIONS rather than OTHER_GOT_SECTIONS. * emulparams/crislinux.sh: Likewise. * emulparams/elf32b4300.sh: Likewise. * emulparams/elf32bmip.sh: Likewise. * emulparams/elf32bmipn32.sh: Likewise. * emulparams/elf32bsmip.sh: Likewise. * emulparams/elf32btsmip.sh: Likewise. * emulparams/elf32ebmip.sh: Likewise. * emulparams/elf32elmip.sh: Likewise. * emulparams/elf32l4300.sh: Likewise. * emulparams/elf32lmip.sh: Likewise. * emulparams/elf32lsmip.sh: Likewise. * emulparams/elf32ltsmip.sh: Likewise. * emulparams/elf64bmip.sh: Likewise. * emulparams/elf64btsmip.sh: Likewise. * emulparams/elf64ltsmip.sh: Likewise.
2001-07-032001-07-03 H.J. Lu <hjl@gnu.org>H.J. Lu1-10/+1
* scripttempl/elf.sc (DYNAMIC_PAD): Revert the change made on 2001-07-03. It creates dynamic entries even for static binaries.
2001-07-032001-07-03 Jakub Jelinek <jakub@redhat.com>H.J. Lu1-1/+10
* scripttempl/elf.sc (DYNAMIC_PAD): New variable. (DYNAMIC): Use it to reserve few dynamic entries for post-linking tools.
2000-09-02Add .gnu.linkonce.wi.* to .debug_info sections.Nick Clifton1-1/+1
2000-08-14* scripttempl/elf.sc: Fix last change to use correct commentAndreas Schwab1-20/+19
syntax.
2000-08-10* scripttempl/elf.sc: Add a comment giving the correspondenceGeoffrey Keating1-21/+84
between sections, per-datum sections, and linkonce sections. Make the comment true even for .bss, .sdata, .sdata2, .sbss, and .sbss2.
2000-07-17 * scripttempl/elf.sc (.init): Only do ${INIT_START} andHans-Peter Nilsson1-4/+4
${INIT_END} if relocating. (.fini): Likewise ${FINI_START} and ${FINI_END}.
2000-06-19Update list of targets supporting --gc-sections.Alan Modra1-1/+1
KEEP .eh_frame contents.
2000-04-13Correct previous misapplied patch.Geoffrey Keating1-10/+9
2000-04-13* scripttempl/elf.sc: Add support for .sbss2 and .sdata2 sections.Geoffrey Keating1-13/+31
Add new BSS_PLT variable for when .plt need not be contained in the file. Move _etext so that it is also after .fini, and provide both etext and _etext with a leading underscore. Mark the start and end of .sbss.
2000-02-16 * scripttempl/elf.sc: Place OTHER_PLT_RELOC_SECTION.Richard Henderson1-0/+1
2000-01-05 * ld.h (wildcard_spec): Change exclude_name to exclude_name_list.Catherine Moore1-2/+2
(name_list): New. * ld.texinfo (EXCLUDE_FILE): Update documentation. * ldgram.y (wildcard_spec): Support a list of excluded_files. (exclude_name_list): New. ldlang.c (walk_wild_section): Support list of excluded files. (print_wild_statement): Likewise. (lang_add_wild): Likewise. * ldlang.h (lang_wild_statement_type): Likewise. * scripttempl/elf.sc (OTHER_EXCLUDE_FILES): Support.
1999-10-07* scripttempl/elf.sc (.rel.sdata): Combine all the sdata relocsGeoffrey Keating1-3/+25
being .rel.sdata, .rel.sdata.*, .rel.gnu.linkonce.s*. (.rela.sdata): Likewise for .rela.sdata.* and .rela.gnu.linkonce.s*. (.rel.sbss): Make like .rel.bss. (.rela.sbss): Make like .rel.bss. (.sdata): Don't include .gnu.linkonce.s.* or .sdata.* when ld -r. (.sbss): Do the same things as for .bss: include SDATA_START_SYMBOLS, .dynsbss.
1999-09-28* scripttempl/elf.sc (.sdata): Include .gnu.linkonce.s.* sectionsGeoffrey Keating1-1/+1
in .sdata too.
1999-09-26Merge sections named .bss.* into .bss section. Similarly for .sbss.Nick Clifton1-1/+6
1999-09-10 * emulparms/elf64hppa.sh (OTHER_READONLY_SECTIONS): Put stubs beforeJeff Law1-2/+19
unwinders so that they are closer to the text section. (OTHER_BSS_SECTIONS): Define. (EXECUTABLE_SYMBOLS): Provide __SYSTEM_ID and _FPU_STATUS. (INIT_START, INIT_END): Define. (FINI_START, FINI_END): Define. * scripttempl/elf.sc: Add support for INIT_START, INIT_END, FINI_START, FINI_END and OTHER_BSS_SECTIONS.
1999-07-14 * scripttempl/elf.sc: Re-order .rel[a].foo outputs to theRichard Henderson1-20/+24
same order seen for the main sections. Add OTHER_READONLY_RELOC_SECTIONS and OTHER_GOT_RELOC_SECTIONS.
1999-06-21 * scripttempl/elf.sc (WRITABLE_RODATA): New variable forMark Mitchell1-7/+4
controlling whether or not .rodata is in the data segment or the text segment.
1999-05-0319990502 sourceware importbinu_ss_19990502Richard Henderson1-0/+286