aboutsummaryrefslogtreecommitdiff
path: root/ld/ldemul.h
AgeCommit message (Collapse)AuthorFilesLines
2024-01-04Update year range in copyright notice of binutils filesAlan Modra1-1/+1
Adds two new external authors to etc/update-copyright.py to cover bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then updates copyright messages as follows: 1) Update cgen/utils.scm emitted copyrights. 2) Run "etc/update-copyright.py --this-year" with an extra external author I haven't committed, 'Kalray SA.', to cover gas testsuite files (which should have their copyright message removed). 3) Build with --enable-maintainer-mode --enable-cgen-maint=yes. 4) Check out */po/*.pot which we don't update frequently.
2023-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
The newer update-copyright.py fixes file encoding too, removing cr/lf on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
2022-03-09ld: Add a before_plugin_all_symbols_read hookH.J. Lu1-0/+5
Add a before_plugin_all_symbols_read hook to load symbol references from DT_NEEDED entries, included from --copy-dt-needed-entries, before reading plugin symbols to properly resolve plugin symbol references. bfd/ PR ld/28849 * elf-bfd.h (elf_link_hash_table): Add handling_dt_needed. * elflink.c (_bfd_elf_merge_symbol): Don't set non_ir_ref_dynamic before plugin 'all symbols read' hook is called. ld/ PR ld/28849 * ldelf.c (ldelf_handle_dt_needed): New function. (ldelf_before_plugin_all_symbols_read): Likewise. (ldelf_after_open): Call ldelf_handle_dt_needed. * ldelf.h (ldelf_before_plugin_all_symbols_read): New. * ldemul.c (ldemul_before_plugin_all_symbols_read): Likewise. * ldemul.h (ldemul_before_plugin_all_symbols_read): Likewise. (ld_emulation_xfer_struct): Add before_plugin_all_symbols_read. * ldlang.c (lang_process): Call ldemul_before_plugin_all_symbols_read before calling plugin_call_all_symbols_read. * emultempl/elf.em (gld${EMULATION_NAME}_before_plugin_all_symbols_read): New. (LDEMUL_BEFORE_PLUGIN_ALL_SYMBOLS_READ): New. * emultempl/emulation.em (ld_${EMULATION_NAME}_emulation): Initialize the before_plugin_all_symbols_read field. * testsuite/ld-plugin/lto.exp: Run PR ld/28849 tests. * testsuite/ld-plugin/pr28849.d: New file. * testsuite/ld-plugin/pr28849a.c: Likewise. * testsuite/ld-plugin/pr28849b.c: Likewise.
2022-01-02Update year range in copyright notice of binutils filesAlan Modra1-1/+1
The result of running etc/update-copyright.py --this-year, fixing all the files whose mode is changed by the script, plus a build with --enable-maintainer-mode --enable-cgen-maint=yes, then checking out */po/*.pot which we don't update frequently. The copy of cgen was with commit d1dd5fcc38ead reverted as that commit breaks building of bfp opcodes files.
2021-03-31Use bool in ldAlan Modra1-12/+12
* sysdep.h (POISON_BFD_BOOLEAN): Define. * configure.ac (elf_list_options, elf_shlib_list_options=false), (elf_plt_unwind_list_options=false): Replace FALSE with false, and TRUE with true. * emulparams/call_nop.sh, * emulparams/cet.sh, * emulparams/dynamic_undefined_weak.sh, * emulparams/elf32b4300.sh, * emulparams/elf32lm32.sh, * emulparams/elf32lr5900.sh, * emulparams/elf32lr5900n32.sh, * emulparams/elf32visium.sh, * emulparams/elf_x86_64.sh, * emulparams/extern_protected_data.sh, * emulparams/plt_unwind.sh, * emulparams/reloc_overflow.sh, * emulparams/static.sh, * emulparams/x86-64-lam.sh, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/alphaelf.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/avrelf.em, * emultempl/beos.em, * emultempl/bfin.em, * emultempl/cr16elf.em, * emultempl/crxelf.em, * emultempl/cskyelf.em, * emultempl/elf.em, * emultempl/genelf.em, * emultempl/hppaelf.em, * emultempl/linux.em, * emultempl/m68hc1xelf.em, * emultempl/metagelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmixelf.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pdp11.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc32elf.em, * emultempl/ppc64elf.em, * emultempl/rxelf.em, * emultempl/rxlinux.em, * emultempl/scoreelf.em, * emultempl/solaris2.em, * emultempl/spuelf.em, * emultempl/ticoff.em, * emultempl/v850elf.em, * emultempl/vms.em, * emultempl/xtensaelf.em, * emultempl/z80.em, * ld.h, * ldbuildid.c, * ldbuildid.h, * ldcref.c, * ldctor.c, * ldctor.h, * ldelf.c, * ldelf.h, * ldelfgen.c, * ldelfgen.h, * ldemul.c, * ldemul.h, * ldexp.c, * ldexp.h, * ldfile.c, * ldfile.h, * ldgram.y, * ldlang.c, * ldlang.h, * ldmain.c, * ldmain.h, * ldmisc.c, * ldmisc.h, * ldwrite.c, * lexsup.c, * mri.c, * pe-dll.c, * pe-dll.h, * pep-dll.h, * plugin.c, * plugin.h, * testplug.c, * testplug2.c, * testplug3.c, * testplug4.c: Replace bfd_boolean with bool, FALSE with false, and TRUE with true. * configure: Regenerate.
2021-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2020-11-20bfd, include, ld, binutils, libctf: CTF should use the dynstr/symNick Alcock1-10/+20
This is embarrassing. The whole point of CTF is that it remains intact even after a binary is stripped, providing a compact mapping from symbols to types for everything in the externally-visible interface of an ELF object: it has connections to the symbol table for that purpose, and to the string table to avoid duplicating symbol names. So it's a shame that the hooks I implemented last year served to hook it up to the .symtab and .strtab, which obviously disappear on strip, leaving any accompanying the CTF dict containing references to strings (and, soon, symbols) which don't exist any more because their containing strtab has been vaporized. The original Solaris design used .dynsym and .dynstr (well, actually, .ldynsym, which has more symbols) which do not disappear. So should we. Thankfully the work we did before serves as guide rails, and adjusting things to use the .dynstr and .dynsym was fast and easy. The only annoyance is that the dynsym is assembled inside elflink.c in a fairly piecemeal fashion, so that the easiest way to get the symbols out was to hook in before every call to swap_symbol_out (we also leave in a hook in front of symbol additions to the .symtab because it seems plausible that we might want to hook them in future too: for now that hook is unused). We adjust things so that rather than being offered a whole hash table of symbols at once, libctf is now given symbols one at a time, with st_name indexes already resolved and pointing at their final .dynstr offsets: it's now up to libctf to resolve these to names as needed using the strtab info we pass it separately. Some bits might be contentious. The ctf_new_dynstr callback takes an elf_internal_sym, and this remains an elf_internal_sym right down through the generic emulation layers into ldelfgen. This is no worse than the elf_sym_strtab we used to pass down, but in the future when we gain non-ELF CTF symtab support we might want to lower the elf_internal_sym to some other representation (perhaps a ctf_link_symbol) in bfd or in ldlang_ctf_new_dynsym. We rename the 'apply_strsym' hooks to 'acquire_strings' instead, becuse they no longer have anything to do with symbols. There are some API changes to pieces of API which are technically public but actually totally unused by anything and/or unused by anything but ld so they can change freely: the ctf_link_symbol gains new fields to allow symbol names to be given as strtab offsets as well as strings, and a symidx so that the symbol index can be passed in. ctf_link_shuffle_syms loses its callback parameter: the idea now is that linkers call the new ctf_link_add_linker_symbol for every symbol in .dynsym, feed in all the strtab entries with ctf_link_add_strtab, and then a call to ctf_link_shuffle_syms will apply both and arrange to use them to reorder the CTF symtab at CTF serialization time (which is coming in the next commit). Inside libctf we have a new preamble flag CTF_F_DYNSTR which is always set in v3-format CTF dicts from this commit forwards: CTF dicts without this flag are associated with .strtab like they used to be, so that old dicts' external strings don't turn to garbage when loaded by new libctf. Dicts with this flag are associated with .dynstr and .dynsym instead. (The flag is not the next in sequence because this commit was written quite late: the missing flags will be filled in by the next commit.) Tests forthcoming in a later commit in this series. bfd/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * elflink.c (elf_finalize_dynstr): Call examine_strtab after dynstr finalization. (elf_link_swap_symbols_out): Don't call it here. Call ctf_new_symbol before swap_symbol_out. (elf_link_output_extsym): Call ctf_new_dynsym before swap_symbol_out. (bfd_elf_final_link): Likewise. * elf.c (swap_out_syms): Pass in bfd_link_info. Call ctf_new_symbol before swap_symbol_out. (_bfd_elf_compute_section_file_positions): Adjust. binutils/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * readelf.c (dump_section_as_ctf): Use .dynsym and .dynstr, not .symtab and .strtab. include/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * bfdlink.h (struct elf_sym_strtab): Replace with... (struct elf_internal_sym): ... this. (struct bfd_link_callbacks) <examine_strtab>: Take only a symstrtab argument. <ctf_new_symbol>: New. <ctf_new_dynsym>: Likewise. * ctf-api.h (struct ctf_link_sym) <st_symidx>: New. <st_nameidx>: Likewise. <st_nameidx_set>: Likewise. (ctf_link_iter_symbol_f): Removed. (ctf_link_shuffle_syms): Remove most parameters, just takes a ctf_dict_t now. (ctf_link_add_linker_symbol): New, split from ctf_link_shuffle_syms. * ctf.h (CTF_F_DYNSTR): New. (CTF_F_MAX): Adjust. ld/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ldelfgen.c (struct ctf_strsym_iter_cb_arg): Rename to... (struct ctf_strtab_iter_cb_arg): ... this, changing fields: <syms>: Remove. <symcount>: Remove. <symstrtab>: Rename to... <strtab>: ... this. (ldelf_ctf_strtab_iter_cb): Adjust. (ldelf_ctf_symbols_iter_cb): Remove. (ldelf_new_dynsym_for_ctf): New, tell libctf about a single symbol. (ldelf_examine_strtab_for_ctf): Rename to... (ldelf_acquire_strings_for_ctf): ... this, only doing the strtab portion and not symbols. * ldelfgen.h: Adjust declarations accordingly. * ldemul.c (ldemul_examine_strtab_for_ctf): Rename to... (ldemul_acquire_strings_for_ctf): ... this. (ldemul_new_dynsym_for_ctf): New. * ldemul.h: Adjust declarations accordingly. * ldlang.c (ldlang_ctf_apply_strsym): Rename to... (ldlang_ctf_acquire_strings): ... this. (ldlang_ctf_new_dynsym): New. (lang_write_ctf): Call ldemul_new_dynsym_for_ctf with NULL to do the actual symbol shuffle. * ldlang.h (struct elf_strtab_hash): Adjust accordingly. * ldmain.c (bfd_link_callbacks): Wire up new/renamed callbacks. libctf/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctf-link.c (ctf_link_shuffle_syms): Adjust. (ctf_link_add_linker_symbol): New, unimplemented stub. * libctf.ver: Add it. * ctf-create.c (ctf_serialize): Set CTF_F_DYNSTR on newly-serialized dicts. * ctf-open-bfd.c (ctf_bfdopen_ctfsect): Check for the flag: open the symtab/strtab if not present, dynsym/dynstr otherwise. * ctf-archive.c (ctf_arc_bufpreamble): New, get the preamble from some arbitrary member of a CTF archive. * ctf-impl.h (ctf_arc_bufpreamble): Declare it.
2020-11-20libctf, include, binutils, gdb, ld: rename ctf_file_t to ctf_dict_tNick Alcock1-2/+2
The naming of the ctf_file_t type in libctf is a historical curiosity. Back in the Solaris days, CTF dictionaries were originally generated as a separate file and then (sometimes) merged into objects: hence the datatype was named ctf_file_t, and known as a "CTF file". Nowadays, raw CTF is essentially never written to a file on its own, and the datatype changed name to a "CTF dictionary" years ago. So the term "CTF file" refers to something that is never a file! This is at best confusing. The type has also historically been known as a 'CTF container", which is even more confusing now that we have CTF archives which are *also* a sort of container (they contain CTF dictionaries), but which are never referred to as containers in the source code. So fix this by completing the renaming, renaming ctf_file_t to ctf_dict_t throughout, and renaming those few functions that refer to CTF files by name (keeping compatibility aliases) to refer to dicts instead. Old users who still refer to ctf_file_t will see (harmless) pointer-compatibility warnings at compile time, but the ABI is unchanged (since C doesn't mangle names, and ctf_file_t was always an opaque type) and things will still compile fine as long as -Werror is not specified. All references to CTF containers and CTF files in the source code are fixed to refer to CTF dicts instead. Further (smaller) renamings of annoyingly-named functions to come, as part of the process of souping up queries across whole archives at once (needed for the function info and data object sections). binutils/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * objdump.c (dump_ctf_errs): Rename ctf_file_t to ctf_dict_t. (dump_ctf_archive_member): Likewise. (dump_ctf): Likewise. Use ctf_dict_close, not ctf_file_close. * readelf.c (dump_ctf_errs): Rename ctf_file_t to ctf_dict_t. (dump_ctf_archive_member): Likewise. (dump_section_as_ctf): Likewise. Use ctf_dict_close, not ctf_file_close. gdb/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctfread.c: Change uses of ctf_file_t to ctf_dict_t. (ctf_fp_info::~ctf_fp_info): Call ctf_dict_close, not ctf_file_close. include/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctf-api.h (ctf_file_t): Rename to... (ctf_dict_t): ... this. Keep ctf_file_t around for compatibility. (struct ctf_file): Likewise rename to... (struct ctf_dict): ... this. (ctf_file_close): Rename to... (ctf_dict_close): ... this, keeping compatibility function. (ctf_parent_file): Rename to... (ctf_parent_dict): ... this, keeping compatibility function. All callers adjusted. * ctf.h: Rename references to ctf_file_t to ctf_dict_t. (struct ctf_archive) <ctfa_nfiles>: Rename to... <ctfa_ndicts>: ... this. ld/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ldlang.c (ctf_output): This is a ctf_dict_t now. (lang_ctf_errs_warnings): Rename ctf_file_t to ctf_dict_t. (ldlang_open_ctf): Adjust comment. (lang_merge_ctf): Use ctf_dict_close, not ctf_file_close. * ldelfgen.h (ldelf_examine_strtab_for_ctf): Rename ctf_file_t to ctf_dict_t. Change opaque declaration accordingly. * ldelfgen.c (ldelf_examine_strtab_for_ctf): Adjust. * ldemul.h (examine_strtab_for_ctf): Likewise. (ldemul_examine_strtab_for_ctf): Likewise. * ldeuml.c (ldemul_examine_strtab_for_ctf): Likewise. libctf/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctf-impl.h: Rename ctf_file_t to ctf_dict_t: all declarations adjusted. (ctf_fileops): Rename to... (ctf_dictops): ... this. (ctf_dedup_t) <cd_id_to_file_t>: Rename to... <cd_id_to_dict_t>: ... this. (ctf_file_t): Fix outdated comment. <ctf_fileops>: Rename to... <ctf_dictops>: ... this. (struct ctf_archive_internal) <ctfi_file>: Rename to... <ctfi_dict>: ... this. * ctf-archive.c: Rename ctf_file_t to ctf_dict_t. Rename ctf_archive.ctfa_nfiles to ctfa_ndicts. Rename ctf_file_close to ctf_dict_close. All users adjusted. * ctf-create.c: Likewise. Refer to CTF dicts, not CTF containers. (ctf_bundle_t) <ctb_file>: Rename to... <ctb_dict): ... this. * ctf-decl.c: Rename ctf_file_t to ctf_dict_t. * ctf-dedup.c: Likewise. Rename ctf_file_close to ctf_dict_close. Refer to CTF dicts, not CTF containers. * ctf-dump.c: Likewise. * ctf-error.c: Likewise. * ctf-hash.c: Likewise. * ctf-inlines.h: Likewise. * ctf-labels.c: Likewise. * ctf-link.c: Likewise. * ctf-lookup.c: Likewise. * ctf-open-bfd.c: Likewise. * ctf-string.c: Likewise. * ctf-subr.c: Likewise. * ctf-types.c: Likewise. * ctf-util.c: Likewise. * ctf-open.c: Likewise. (ctf_file_close): Rename to... (ctf_dict_close): ...this. (ctf_file_close): New trivial wrapper around ctf_dict_close, for compatibility. (ctf_parent_file): Rename to... (ctf_parent_dict): ... this. (ctf_parent_file): New trivial wrapper around ctf_parent_dict, for compatibility. * libctf.ver: Add ctf_dict_close and ctf_parent_dict.
2020-05-18Show AIX gc'd symbol address adjustments in map fileDouglas B Rupp1-0/+8
* ldemul.h (ldemul_print_symbol): New. (ld_emulation_xfer_type) <print_symbol): Likewise. * ldemul.c (ldemul_print_symbol): New. * ldlang.c (SECTION_NAME_MAP_LANGTH): Move to ... (print_one_symbol): Make global and move declaration to ... (print_all_symbols): Rename print_one_symbol to ldemul_print_symbol (print_input_section): Likewise * ldlang.h: ... here. * emultempl/aix.em (gld${EMULATION_NAME}_print_symbol): New. (ld_emulation_xfer_struct): Use it. * emultempl/armcoff.em (ld_emulation_xfer_struct): Add print_symbol and default to NULL. * emultempl/beos.em (ld_emulation_xfer_struct): Likewise * emultempl/elf.em (ld_emulation_xfer_struct): Likewise * emultempl/generic.em (ld_emulation_xfer_struct): Likewise * emultempl/linux.em (ld_emulation_xfer_struct): Likewise * emultempl/msp430.em (ld_emulation_xfer_struct): Likewise * emultempl/pe.em (ld_emulation_xfer_struct): Likewise * emultempl/pep.em (ld_emulation_xfer_struct): Likewise * emultempl/ticoff.em (ld_emulation_xfer_struct): Likewise * emultempl/vanilla.em (ld_emulation_xfer_struct): Likewise
2020-02-06ELF: Discard a section if any of its linked-to sections has been discardedH.J. Lu1-0/+7
Add ldelf_before_place_orphans to call before lang_place_orphans to discard a section if any of its linked-to sections has been discarded. PR ld/25022 * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Add before_place_orphans_default. * emultempl/armcoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/beos.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/linux.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/msp430.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pe.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pep.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/ticoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/vanilla.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Use ldelf_before_place_orphans. * ldelf.c (ldelf_before_place_orphans): New. * ldelf.h (ldelf_before_place_orphans): Likewise. * ldemul.c (ldemul_before_place_orphans): Likewise. (before_place_orphans_default): Likewise. * ldemul.h (ldemul_before_place_orphans): Likewise. (before_place_orphans_default): Likewise. (ld_emulation_xfer_struct): Add before_place_orphans. * ldlang.c (lang_process): Call ldemul_before_place_orphans before lang_place_orphans. * testsuite/ld-elf/pr25022.d: New file. * testsuite/ld-elf/pr25022.s: Likewise. * testsuite/ld-elf/pr25022.t: Likewise.
2020-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2019-10-03bfd, ld: add CTF section linkingNick Alcock1-0/+21
This is quite complicated because the CTF section's contents depend on the final contents of the symtab and strtab, because it has two sections whose contents are shuffled to be in 1:1 correspondence with the symtab, and an internal strtab that gets deduplicated against the ELF strtab (with offsets adjusted to point into the ELF strtab instead). It is also compressed if large enough, so its size depends on its contents! So we cannot construct it as early as most sections: we cannot even *begin* construction until after the symtab and strtab are finalized. Thankfully there is already one section treated similarly: compressed debugging sections: the only differences are that compressed debugging sections have extra handling to deal with their changing name if compressed (CTF sections are always called ".ctf" for now, though we have reserved ".ctf.*" against future use), and that compressed debugging sections have previously-uncompressed content which has to be stashed away for later compression, while CTF sections have no content at all until we generate it (very late). BFD also cannot do the link itself: libctf knows how to do it, and BFD cannot call libctf directly because libctf already depends on bfd for file I/O. So we have to use a pair of callbacks, one, examine_strtab, which allows a caller to examine the symtab and strtab after finalization (called from elf_link_swap_symbols_out(), right before the symtabs are written, and after the strtab has been finalized), and one which actually does the emission (called emit_ctf simply because it is grouped with a bunch of section-specific late-emission function calls at the bottom of bfd_elf_final_link, and a section-specific name seems best for that). emit_ctf is actually called *twice*: once from lang_process if the emulation suggests that this bfd target does not examine the symtab or strtab, and once via a bfd callback if it does. (This means that non-ELF targets still get CTF emitted, even though the late CTF emission stage is never called for them). v2: merged with non-ELF support patch: slight commit message adjustments. v3: do not spend time merging CTF, or crash, if the CTF section is explicitly discarded. Do not try to merge or compress CTF unless linking. v4: add CTF_COMPRESSION_THRESHOLD. Annul the freed input ctf_file_t's after writeout: set SEC_IN_MEMORY on the output contents so a future bfd enhancement knows it could free it. Add SEC_LINKER_CREATED | SEC_KEEP to avoid having to add .ctf to the linker script. Drop now-unnecessary ldlang.h-level elf-bfd.h include and hackery around it. Adapt to elf32.em->elf.em and elf-generic.em->ldelf*.c changes. v5: fix tabdamage. Drop #inclusions in .h files: include in .c files, .em files, and use struct forwards instead. Use bfd_section_is_ctf inline function rather than SECTION_IS_CTF macro. Move a few comments. * Makefile.def (dependencies): all-ld depends on all-libctf. * Makefile.in: Regenerated. include/ * bfdlink.h (elf_strtab_hash): New forward. (elf_sym_strtab): Likewise. (struct bfd_link_callbacks <examine_strtab>): New. (struct bfd_link_callbacks <emit_ctf>): Likewise. bfd/ * elf-bfd.h (bfd_section_is_ctf): New inline function. * elf.c (special_sections_c): Add ".ctf". (assign_file_positions_for_non_load_sections): Note that compressed debugging sections etc are not assigned here. Treat CTF sections like SEC_ELF_COMPRESS sections when is_linker_output: sh_offset -1. (assign_file_positions_except_relocs): Likewise. (find_section_in_list): Note that debugging and CTF sections, as well as reloc sections, are assigned later. (_bfd_elf_assign_file_positions_for_non_load): CTF sections get their size and contents updated. (_bfd_elf_set_section_contents): Skip CTF sections: unlike compressed sections, they have no uncompressed content to copy at this stage. * elflink.c (elf_link_swap_symbols_out): Call the examine_strtab callback right before the strtab is written out. (bfd_elf_final_link): Don't cache the section contents of CTF sections: they are not populated yet. Call the emit_ctf callback right at the end, after all the symbols and strings are flushed out. ld/ * ldlang.h: (struct lang_input_statement_struct): Add the_ctf. (struct elf_sym_strtab): Add forward. (struct elf_strtab_hash): Likewise. (ldlang_ctf_apply_strsym): Declare. (ldlang_write_ctf_late): Likewise. * ldemul.h (ldemul_emit_ctf_early): New. (ldemul_examine_strtab_for_ctf): Likewise. (ld_emulation_xfer_type) <emit_ctf_early>: Likewise. (ld_emulation_xfer_type) <examine_strtab_for_ctf>: Likewise. * ldemul.c (ldemul_emit_ctf_early): New. (ldemul_examine_strtab_for_ctf): Likewise. * ldlang.c: Include ctf-api.h. (CTF_COMPRESSION_THRESHOLD): New. (ctf_output): New. Initialized in... (ldlang_open_ctf): ... this new function. Open all the CTF sections in the input files: mark them non-loaded and empty so as not to copy their contents to the output, but linker-created so the section gets created in the target. (ldlang_merge_ctf): New, merge types via ctf_link_add_ctf and ctf_link. (ldlang_ctf_apply_strsym): New, an examine_strtab callback: wrap ldemul_examine_strtab_for_ctf. (lang_write_ctf): New, write out the CTF section. (ldlang_write_ctf_late): New, late call via bfd's emit_ctf hook. (lang_process): Call ldlang_open_ctf, ldlang_merge_ctf, and lang_write_ctf. * ldmain.c (link_callbacks): Add ldlang_ctf_apply_strsym, ldlang_write_ctf_late. * emultempl/aix.em: Add ctf-api.h. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/elf.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/msp430.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * ldcref.c: Likewise. * ldctor.c: Likewise. * ldelf.c: Likewise. * ldelfgen.c: Likewise. * ldemul.c: Likewise. * ldexp.c: Likewise. * ldfile.c: Likewise. * ldgram.c: Likewise. * ldlex.l: Likewise. * ldmain.c: Likewise. * ldmisc.c: Likewise. * ldver.c: Likewise. * ldwrite.c: Likewise. * lexsup.c: Likewise. * mri.c: Likewise. * pe-dll.c: Likewise. * plugin.c: Likewise. * ldelfgen.c (ldelf_emit_ctf_early): New. (ldelf_examine_strtab_for_ctf): tell libctf about the symtab and strtab. (struct ctf_strsym_iter_cb_arg): New, state to do so. (ldelf_ctf_strtab_iter_cb): New: tell libctf about each string in the strtab in turn. (ldelf_ctf_symbols_iter_cb): New, tell libctf about each symbol in the symtab in turn. * ldelfgen.h (struct elf_sym_strtab): Add forward. (struct elf_strtab_hash): Likewise. (struct ctf_file): Likewise. (ldelf_emit_ctf_early): Declare. (ldelf_examine_strtab_for_ctf): Likewise. * emultempl/elf-generic.em (LDEMUL_EMIT_CTF_EARLY): Set it. (LDEMUL_EXAMINE_STRTAB_FOR_CTF): Likewise. * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Add emit_ctf_early and examine_strtab_for_ctf, NULL by default. * emultempl/armcoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/beos.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/linux.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/msp430.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pe.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pep.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/ticoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/vanilla.em (ld_vanilla_emulation): Likewise. * Makefile.am: Pull in libctf (and zlib, a transitive requirement for compressed CTF section emission). Pass it on to DejaGNU. * configure.ac: Add AM_ZLIB. * aclocal.m4: Added zlib.m4. * Makefile.in: Regenerated. * testsuite/ld-bootstrap/bootstrap.exp: Use it when relinking ld.
2019-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2018-01-03Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2017-10-16ELF: Call check_relocs after opening all inputsH.J. Lu1-0/+7
For all ELF targers, call check_relocs after opening all inputs and garbage collection. Since the symbol resolution is known, check_relocs can be simplified. Also garbage collection doesn't need to undo what check_relocs has done for symbols which have been garbage collected. Since ELF targets never see the removed sections, gc_sweep_hook can be removed from elf_backend_data and we can avoid GOT/PLT with garbage collection now. Set link_info.check_relocs_after_open_input to TRUE for all linker targets which use ELF linker and update garbage collection tests to remove unused GOT section. ldemul_after_check_relocs is added for powerpc to support --secure-plt, --bss-plt and --sdata-got. Tested natively without regressions on i686, x86-64 and x32. Tested cross binutils on x86-64 without regressions for aarch64-linux, alpha-linux, arm-linux, bfin-elf, cr16-elf, cris-elf, crx-elf, frv-linux, hppa64-linux, hppa-linux, ia64-linux, lm32-elf, m32r-elf, m68k-linux, mcore-elf, metag-elf, microblaze-linux, mips-linux, mmix, mn10300-elf, nds32le-linux, nios2-linux, or1k-elf, powerpc64-linux, powerpc-linux, riscv32-linux, riscv64-linux, s390-linux, s390x-linux, score-elf, sh3-linux, sparc64-linux, sparc-linux, tic6x-elf, tilegx-linux, tilepro-linux, vax-linux, x86_64-mingw32 and xtensa-linux. bfd/ * elf-bfd.h (elf_backend_data): Remove gc_sweep_hook. * elf32-arm.c (elf32_arm_gc_sweep_hook): Removed. (elf_backend_gc_sweep_hook): Likewise. * elf32-bfin.c (bfin_gc_sweep_hook): Likewise. (bfinfdpic_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-cr16.c (elf32_cr16_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-cris.c (cris_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-lm32.c (lm32_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-m68k.c (elf_m68k_got_entry): Remove elf_m68k_gc_sweep_hook from comments. (elf_m68k_remove_got_entry_type): Removed. (elf_m68k_find_got_entry_ptr): Likewise. (elf_m68k_remove_got_entry): Likewise. (elf_m68k_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-mcore.c (mcore_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-metag.c (elf_metag_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-microblaze.c (elf_backend_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-mips.c (elf_backend_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-nds32.c (nds32_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-nios2.c (nios2_elf32_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-or1k.c (or1k_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-ppc.c (ppc_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-sparc.c (elf_backend_gc_sweep_hook): Likewise. * elf32-tic6x.c (elf32_tic6x_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-tilegx.c (elf_backend_gc_sweep_hook): Likewise. * elf32-tilepro.c (tilepro_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-alpha.c (elf64_alpha_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-mips.c (elf_backend_gc_sweep_hook): Likewise. * elf64-mmix.c (mmix_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-ppc.c (elf_backend_gc_sweep_hook): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-sparc.c (elf_backend_gc_sweep_hook): Likewise. * elf64-tilegx.c (elf_backend_gc_sweep_hook): Likewise. * elflink.c (elf_link_add_object_symbols): Don't call _bfd_elf_link_check_relocs here. (gc_sweep_hook_fn): Removed. (elf_gc_sweep): Remove gc_sweep_hook. * elfnn-aarch64.c (elfNN_aarch64_gc_sweep_hook): Removed. (elf_backend_gc_sweep_hook): Likewise. * elfnn-riscv.c (riscv_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_gc_sweep_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_gc_sweep_hook): Likewise. * elfxx-sparc.h (_bfd_sparc_elf_gc_sweep_hook): Likewise. * elfxx-target.h (elf_backend_gc_sweep_hook): Likewise. (elfNN_bed): Remove elf_backend_gc_sweep_hook. * elfxx-tilegx.c (tilegx_elf_gc_sweep_hook): Removed. * elfxx-tilegx.h (tilegx_elf_gc_sweep_hook): Likewise. ld/ * emulparams/elf32_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Removed. * emulparams/elf_i386_be.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_chaos.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_ldso.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_vxworks.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_iamcu.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_k1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_l1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386lynx.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386moss.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386nw.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf32.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf_nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf_vxworks.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shlelf32_linux.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shlelf_linux.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shlelf_nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emultempl/aarch64elf.em (gld${EMULATION_NAME}_before_parse): Set link_info.check_relocs_after_open_input to TRUE. * emultempl/armelf.em (gld${EMULATION_NAME}_before_parse): Likewise. * emultempl/scoreelf.em (gld${EMULATION_NAME}_before_parse): Likewise. * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Add after_parse_default. * emultempl/armcoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/beos.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/gld960.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/gld960c.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/lnk960.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/m68kcoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/msp430.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pe.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pep.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/sunos.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/ticoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/vanilla.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Always set link_info.check_relocs_after_open_input to TRUE. (ld_${EMULATION_NAME}_emulation): Add $LDEMUL_AFTER_CHECK_RELOCS. * emultempl/linux.em (gld${EMULATION_NAME}_before_parse): Set link_info.check_relocs_after_open_input to TRUE. (ld_${EMULATION_NAME}_emulation): Add after_check_relocs_default. * emultempl/mmix-elfnmmo.em (mmix_before_parse): New function. (LDEMUL_BEFORE_PARSE): New. * emultempl/mmixelf.em (elfmmix_before_parse): Replace gld${EMULATION_NAME}_before_parse with mmix_before_parse. * emultempl/ppc32elf.em (ppc_after_open): Renamed to ... (ppc_after_check_relocs): This. Call after_check_relocs_default instead of gld${EMULATION_NAME}_after_open. (LDEMUL_AFTER_OPEN): Removed. (LDEMUL_AFTER_CHECK_RELOCS): New. * ldemul.c (ldemul_after_check_relocs): New. (after_check_relocs_default): Likewise. * ldemul.h (ldemul_after_check_relocs): Likewise. (after_check_relocs_default): Likewise. (ld_emulation_xfer_struct): Add after_check_relocs. * ldlang.c (lang_process): Call ldemul_after_check_relocs after lang_check_relocs. * testsuite/ld-aarch64/gc-got-relocs.d: Don't expect GOT section. * testsuite/ld-aarch64/gc-tls-relocs.d: Likewise. * testsuite/ld-cris/tls-gc-68.d: Likewise. * testsuite/ld-cris/tls-gc-69.d: Likewise. * testsuite/ld-cris/tls-gc-70.d: Likewise. * testsuite/ld-cris/tls-gc-75.d: Likewise. * testsuite/ld-cris/tls-gc-79.d: Likewise. * testsuite/ld-mmix/bpo-10.d: Don't expect .MMIX.reg_contents section.
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-05-27Add new link-map-text hook and RX auto-vector support.DJ Delorie1-0/+7
* bfd/elf32-rx.c (get_symbol_value_maybe): New. (rx_elf_relocate_section): If we find a reloc against $tableentry$default$<name>, redirect it to the appropriate $tableentry$<n>$. (RX_Table_Info): New. (rx_table_find): New. Check all tables and SEC_KEEP all sections with table parts in them. (rx_check_directives): New. (rx_table_map_2): New. (rx_table_map): New. (rx_additional_link_map_text): New. Called to dump tables to the map file. * bfd/elf32-rx.h: New. * ld/ldemul.h (extra_map_file_text): New field. (ldemul_extra_map_file_text): Declare. * ld/ldemul.c (ldemul_extra_map_file_text): Define. * ld/ldlang.c (lang_map): Call it. * ld/emultempl/rxelf.em: Add extra_map_file_text hook. * ld/emultempl/aix.em: Add NULL extra_map_file_text hook. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/vanilla.em: Likewise.
2014-03-05Update copyright yearsAlan Modra1-3/+1
2009-09-02update copyright datesAlan Modra1-1/+1
2008-10-20 * ldemul.h (ldemul_place_orphan): Update prototype.Alan Modra1-2/+2
(struct ld_emulation_xfer_struct <place_orphan>): Likewise. * ldemul.c (ldemul_place_orphan): Return pointer to output section statement. * emultempl/beos.em (gld${EMULATION_NAME}_place_orphan): Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
2008-10-04 * ldemul.c (ldemul_place_orphan): Add "constraint" param.Alan Modra1-2/+2
* ldemul.h (ldemul_place_orphan): Update prototype. (struct ld_emulation_xfer_struct <place_orphan>): Likewise add param. * ldlang.c (unique_section_p): Make static. (lang_output_section_statement_lookup): Optimise creation of SPECIAL sections. (lang_insert_orphan): Add "constraint" param. Pass to lang_enter_output_section_statement. (init_os): Don't use an existing bfd section for SPECIAL sections. (lang_place_orphans): Don't rename unique output sections, instead mark their output section statements SPECIAL. * ldlang.h (lang_insert_orphan): Update prototype. (unique_section_p): Delete. * emultempl/beos.em (place_orphan): Add "constraint" param. * emultempl/elf32.em (place_orphan): Likewise. Don't match existing output sections if set. * emultempl/pe.em (place_orphan): Likewise. * emultempl/pep.em (place_orphan): Likewise. * emultempl/mmo.em (mmo_place_orphan): Update. * emultempl/spuelf.em (spu_place_special_section): Update.
2008-10-03bfd/Alan Modra1-2/+2
* elf.c (bfd_elf_set_group_contents): Assign sh_info for ld -r when the signature symbol is global. * elflink.c (elf_link_input_bfd): Ensure group signature symbol is output when ld -r. Set group sh_info when local. * linker.c (default_indirect_link_order): Handle group sections specially. ld/ * ldemul.c (ldemul_place_orphan): Add "name" param. * ldemul.h (ldemul_place_orphan): Update prototype. (struct ld_emulation_xfer_struct <place_orphan>): Likewise. * ldlang.c (lang_place_orphans): Generate unique section names here.. * emultempl/elf32.em (place_orphan): ..rather than here. Don't directly use an existing output section statement that has no bfd section. * emultempl/pe.em (place_orphan): Likewise. * emultempl/pep.em (place_orphan): Likewise. * emultempl/beos.em (place_orphan): Adjust. * emultempl/spuelf.em (spu_place_special_section): Adjust place_orphan call. * emultempl/genelf.em (gld${EMULATION_NAME}_after_open): New function. (LDEMUL_AFTER_OPEN): Define.
2007-07-06Update sources to GPLv3Nick Clifton1-7/+12
2005-11-17 * ldlang.h (lang_input_section_type): Remove "ifile" field.Alan Modra1-2/+2
(lang_insert_orphan, lang_add_section): Update prototypes. * ldlang.c (lang_insert_orphan): Remove "file" param. (lang_add_section): Likewise. Update all callers. (wild_sort): Get an input section's bfd via "section->owner". (size_input_section): Access just_syms_flag via bfd usrdata. (lang_place_orphans): Update ldemul_place_orphan call. * ldemul.h (ldemul_place_orphan): Remove input_statement param. (struct ld_emulation_xfer_struct <place_orphan>): Likewise. * ldemul.c (ldemul_place_orphan): Likewise. * ldwrite.c (build_link_order): Access just_syms_flag via bfd usrdata. * emultempl/armelf.em (arm_elf_set_bfd_for_interworking): Likewise. * emultempl/beos.em (sort_by_file_name): Access bfd by section->owner. (sort_sections): Likewise. (place_orphan): Remove "file" param. Adjust lang_add_section call. * emultempl/elf32.em (place_orphan): Remove "file" param. Adjust lang_add_section and lang_insert_orphan calls. * emultempl/hppaelf.em (hppaelf_add_stub_section): Adjust lang_add_section call. (build_section_lists): Access just_syms_flag via bfd usrdata. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Adjust lang_add_section call. * emultempl/mmo.em (mmo_place_orphan): Remove "file" param. Adjust lang_add_section and lang_insert_orphan calls. * emultempl/pe.em (place_orphan): Likewise. Access bfd via section owner. * emultempl/ppc64elf.em (ppc_add_stub_section): Adjust lang_add_section call. (build_toc_list): Access just_syms_flag via bfd usrdata. (build_section_lists): Likewise. * emultempl/xtensaelf.em (elf_xtensa_place_orphan): Remove "file" param. Adjust place_orphan call. (ld_build_required_section_dependence): Access bfd via section owner.
2005-08-04bfd/Alan Modra1-6/+1
* elf32-ppc.c (struct elf_linker_section): Replace sym_val field with sym. (ppc_elf_relocate_section): Adjust for above. (create_sdata_sym): New function. (ppc_elf_create_linker_section): Call it. (ppc_elf_check_relocs): Correct has_sda_refs and non_got_refs. Create sdata syms for all SDA relocs. (ppc_elf_adjust_dynamic_symbol): Don't special case _SDA_BASE_ and _SDA2_BASE_. (ppc_elf_set_sdata_syms): Delete. * elflink.c (bfd_elf_size_dynamic_sections): Don't create DT_INIT and DT_FINI tags unless associated section has input. (bfd_elf_set_symbol, _bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in.h (_bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in2.h: Regenerate. ld/ * ldemul.c (ldemul_do_assignments, do_assignments_default): Delete. * ldemul.h (ldemul_do_assignments, do_assignments_default): Delete. (struct ld_emulation_xfer_struct): Remove do_assignments field. * ldlang.c (lang_do_assignments): Don't call ldemul_do_assignments. * emulparams/elf32ppc.sh (SDATA_START_SYMBOLS): New. (SDATA2_START_SYMBOLS, SBSS_START_SYMBOLS, SBSS_END_SYMBOLS): New. * emultempl/aix.em (ld_*_emulation): Delete do_assignments init. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/elf32.em: Likewise. (gld*_provide_bound_symbols): Delete. (gld*_provide_init_fini_syms): Delete. (gld*_before_allocation): Don't call ldemul_do_assignments. * emultempl/ppc32elf.em (ppc_do_assignments): Delete. (LDEMUL_DO_ASSIGNMENTS): Delete. * scripttempl/elf.sc: Provide init/fini syms. Add SBSS_START_SYMBOLS, SBSS_END_SYMBOLS, SDATA2_START_SYMBOLS.
2005-08-04bfd/Alan Modra1-0/+2
* elflink.c (fix_syms, _bfd_elf_fix_excluded_sec_syms): Move to.. * linker.c (fix_syms, _bfd_fix_excluded_sec_syms): ..here. * bfd-in.h (_bfd_fix_excluded_sec_syms): Rename. * bfd-in2.h: Regenerate. ld/ * ldemul.c (ldemul_finish): Call ld_emulation->finish unconditionally. (finish_default): New function. * ldemul.h (finish_default): Declare. * emultempl/aix.em (gld*_before_allocation): Call before_allocation_default rather than strip_excluded_output_sections. (ld_*_emulation): Init finish field to finish_default. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/hppaelf.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/mmo.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise.
2005-07-15 * ldemul.c (ldemul_do_assignments): New function.Alan Modra1-1/+8
(do_assignments_default): New function. * ldemul.h (ldemul_do_assignments): Declare. (do_assignments_default): Declare. (struct ld_emulation_xfer_struct): Add do_assignments. * ldlang.c (lang_do_assignments) Call ldemul_do_assignments. * emultempl/aix.em (ld_*_emulation): Init do_assignments field. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/elf32.em: Likewise, to call gld*_provide_init_fini_syms. (gld*_find_exp_assignment): Adjust bfd_elf_record_link_assignment call.
2005-03-03update copyright datesAlan Modra1-1/+2
2004-12-07 * ldemul.h: Forward declare struct option.Ben Elliston1-0/+3
2003-06-28Convert to C90Alan Modra1-59/+58
2003-02-28 * ldemul.c (ldemul_parse_args): Return FALSE by default.Alan Modra1-1/+1
* ldemul.h (struct ld_emulation_xfer_struct): Update parse_args comment.
2003-02-28 * ldemul.c (ldemul_add_options, ldemul_handle_option): New functions.Alan Modra1-4/+17
(ldemul_parse_args): Return bfd_boolean. Formatting. * ldemul.h (ldemul_add_options, ldemul_handle_option): Declare. (ldemul_parse_args): Adjust. (struct ld_emulation_xfer_struct): Add add_options and handle_option. Return bfd_boolean from parse_args. * lexsup.c (parse_args): Malloc shortopts, longopts and really_longopts. Call ldemul_add_options and ldemul_handle_option. * emultempl/aix.em (gld${EMULATION_NAME}_add_options): Split out from gld${EMULATION_NAME}_parse_args. (gld${EMULATION_NAME}_handle_option): Likewise. (ld_${EMULATION_NAME}_emulation): Adjust initializer. * emultempl/armcoff.em: As for aix.em, but remove parse_args. * emultempl/beos.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/elf32.em: Likewise. Don't duplicate long options either. (gld${EMULATION_NAME}_add_sysroot): Prototype. * emultempl/armelf.em (PARSE_AND_LIST_LONGOPTS): Don't duplicate options. * emultempl/hppaelf.em (PARSE_AND_LIST_LONGOPTS): Likewise. * emultempl/ppc32elf.em (PARSE_AND_LIST_LONGOPTS): Likewise. * emultempl/ppc64elf.em (PARSE_AND_LIST_LONGOPTS): Likewise. * emultempl/armelf_oabi.em (ld_${EMULATION_NAME}_emulation): Adjust initializer. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/mipsecoff.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/netbsd.em (gldnetbsd_before_parse): Prototype.
2002-11-30s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. SimplifyAlan Modra1-37/+62
comparisons of bfd_boolean vars with TRUE/FALSE. Formatting.
2002-05-22 * ldemul.c (ldemul_new_vers_pattern): New function.Alan Modra1-0/+7
* ldemul.h (ldemul_new_vers_pattern): Declare. (struct ld_emulation_xfer_struct): Add new_vers_pattern. * ldlang.c (lang_new_vers_pattern): Call ldemul_new_vers_pattern. * emultempl/ppc64elf.em (dotsyms): New static var. (gld${EMULATION_NAME}_new_vers_pattern): New function. (LDEMUL_NEW_VERS_PATTERN): Define. (PARSE_AND_LIST_PROLOGUE): Add OPTION_DOTSYMS, OPTION_NO_DOTSYMS. (PARSE_AND_LIST_LONGOPTS): Likewise. (PARSE_AND_LIST_ARGS_CASES): Handle them. * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Update initialiser. * emultempl/armcoff.em: Likewise. * emultempl/armelf_oabi.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/mipsecoff.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise.
2001-12-03Pass argc and argv to ldemul_choose_target.Tom Rix1-3/+3
Support -b64 in AIX
2001-03-13Fixtypos in ChangeLogs, fix copyright dates in filesNick Clifton1-1/+1
2000-10-092000-10-09 Kazu Hirata <kazu@hxi.com>Kazu Hirata1-5/+3
* ldcref.c: Fix formatting. * ldctor.h: Likewise. * ldemul.c: Likewise. * ldemul.h: Likewise. * ldexp.c: Likewise. * ldexp.h: Likewise. * ldfile.c: Likewise. * ldfile.h: Likewise. * ld.h: Likewise. * ldlang.c: Likewise. * ldlang.h: Likewise. * ldmain.c: Likewise.
2000-09-292000-09-29 Kazu Hirata <kazu@hxi.com>Kazu Hirata1-6/+7
* deffile.h: Fix formatting. * ld.h: Likewise. * ldctor.h: Likewise. * ldemul.h: Likewise. * ldexp.h: Likewise. * ldfile.h: Likewise. * ldlang.h: Likewise. * lexsup.c: Likewise. * mri.c: Likewise. * pe-dll.c: Likewise.
2000-07-11Remove some forward declarations in ldemul.h and ldfile.h, andAlan Modra1-5/+0
re-arrange header include order. Fix shadowing warnings in ldlang.h Fix compile errors in mpw-elfmips.c
2000-02-24Add support for WinCE based toolchains.Nick Clifton1-1/+10
1999-05-0319990502 sourceware importbinu_ss_19990502Richard Henderson1-0/+149