Commit Graph

136 Commits

Author SHA1 Message Date
Alan Modra db09f25b32 * deffilep.y (def_stash_module): Constify "name" param.
* pe-dll.c: Replace CONST with const throughout.
	(quick_symbol): Constify "n1", "n2", "n3" params.
	(make_singleton_name_thunk): Constify "import" param.  Make
	"buffer_len" a size_t.
	(make_import_fixup_entry): Constify "name", "fixup_name",
	"dll_symname" params.
	(pe_get16): Cast args of bfd_seek.  Replace bfd_read with bfd_bread.
	(pe_get32): Likewise.
	(pe_implied_import_dll): Likewise.

	* emultempl/beos.em (sort_by_file_name): Constify "ra", "rb".
	(sort_by_section_name): Likewise.

	* emultempl/pe.em: Move defines for arm_epoc_pe before bfd.h included.
	(make_import_fixup): Cast printf arg, rel->address to long rather
	than int.
	(gld_${EMULATION_NAME}_after_open): Don't compare NULL against int.
2001-09-18 10:10:21 +00:00
Charles Wilson 0d888aac30 2001-09-12 Paul Sokolovsky <Paul.Sokolovsky@technologist.com>
* emultempl/pe.em(make_import_fixup): change signature to
        take asection as well as arelec; we need this for proper
        error reporting.  Only call pe_create_import_fixup() if
        there is no attempt to add a constant addend to the reloc;
        otherwise, report error condition.
        * pe-dll.c(pe_walk_relocs_of_symbol): change signature,
        since final argument is a pointer to make_import_fixup().
        Change call to cb() to match make_import_fixup() signature.
        (make_import_fixup_mark): make buffer_len unsigned.
        * pe-dll.h: change signature of pe_walk_relocs_of_symbol.
2001-09-12  Charles Wilson  <cwilson@ece.gatech.edu>
        * ld.texinfo: add verbose documentation for auto-import
        direct-addressing workaround, to compliment the terse
        error message.
2001-09-12 15:58:10 +00:00
Tom Rix 1fdf02497c Fix import symbols for AIX. 2001-09-06 15:20:01 +00:00
Andreas Jaeger 9b5799b87b * emultempl/beos.em: Declare prototypes for comparions functions,
adjust definitions.
2001-09-03 07:29:50 +00:00
Andreas Jaeger 48f6162b7a * emultempl/aix.em: Add missing prototype.
* emultempl/lnk960.em: Likewise.
	* emultempl/vanilla.em: Likewise.
	* emultempl/armcoff.em: Likewise.
	* emultempl/armelf_oabi.em: Likewise.
	* emultempl/beos.em: Likewise.
	* emultempl/gld960c.em: Likewise.
	* emultempl/gld960.em: Likewise.

	* emulparams/elf64alpha.sh (PARSE_AND_LIST_PROLOGUE): Add parameter
	for prototype declaration.
2001-09-03 06:43:37 +00:00
Andreas Jaeger 3fc90ddbe3 * emultempl/pe.em: Add missing prototypes.
(gld_${EMULATION_NAME}_after_open): Remove extra args to
	pe_find_data_imports.
	(pr_sym): Add unused attribute.
2001-08-31 13:30:13 +00:00
Jakub Jelinek db6751f2e7 * elf-bfd.h (enum elf_reloc_type_class): New.
(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-23 15:14:18 +00:00
Alan Modra bba1a0c062 * ldlang.c: When traversing lang_statement_union_type lists,
consistently use "header.next" rather than "next".
	* mpw-eppcmac.c: Likewise.
	* emultempl/beos.em: Likewise.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* ldlang.h (union lang_statement_union): Remove "next" field.
2001-08-20 02:14:50 +00:00
Alan Modra c0c330a70f * ldlang.c (insert_pad): Use offsetof macro.
(lang_size_sections): Always neuter padding statements.
	* emultempl/hppaelf.em (hppaelf_delete_padding_statements): Delete.
2001-08-20 01:21:08 +00:00
Alan Modra ae7fb08f1a * pe-dll.c (pe_dll_fill_sections): Correct type of "relax" param
passed to lang_size_sections.
	(pe_exe_fill_sections): Likewise.
	* emultempl/pe.em (output_prev_sec_find): Copied from elf32.em.
	(gld_${EMULATION_NAME}_place_orphan): Merge from elf32.em.
2001-08-20 00:22:41 +00:00
Alan Modra fab80407fe * emultempl/aix.em: Formatting fixes. 2001-08-18 15:42:26 +00:00
Alan Modra cde43e70f1 * emultempl/elf32.em: Formatting fixes.
(output_prev_sec_find): Test for bfd_ind_section too;  do so by
	looking at sec->owner.
	(output_rel_find): Move function inside LDEMUL_PLACE_ORPHAN test.
	(gld${EMULATION_NAME}_place_orphan): Add a few comments.  Remove
	unused code, and reorganize orphan section placement code.
2001-08-14 04:40:38 +00:00
Alan Modra 39dcfe18ca (wild_doit): Rename to lang_add_section. 2001-08-14 02:01:31 +00:00
Richard Henderson 908d20b308 * emultempl/needrelax.em: New file.
* emulparams/elf64_ia64.sh (EXTRA_EM_FILE): Reference it.
        * Makefile.am (eelf64_ia64.c): Depend on it.
        * Makefile.in: Rebuild.
2001-08-13 20:40:31 +00:00
Alan Modra 22af9fd35c * emultempl/elf32.em: For SEC_EXCLUDE sections, ensure that
output_section is set non-NULL.
2001-08-13 14:28:57 +00:00
Alan Modra 0f33d40bfc * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Return
`true' for SEC_EXCLUDE sections so that the generic code doesn't
	needlessly create an output_section_statement.  Treat a correctly
	named output_section_statement with NULL bfd_section as compatible.
2001-08-13 10:56:21 +00:00
Hans-Peter Nilsson 738472a889 Update copyright notice 2001-08-13 07:31:29 +00:00
Hans-Peter Nilsson 55ab6103c5 * emultempl/generic.em: Support EXTRA_EM_FILE.
(ld_${EMULATION_NAME}_emulation): Support emulation parameters
	LDEMUL_BEFORE_PARSE, LDEMUL_SYSLIB, LDEMUL_HLL,
	LDEMUL_AFTER_PARSE, LDEMUL_AFTER_OPEN, LDEMUL_AFTER_ALLOCATION,
	LDEMUL_SET_OUTPUT_ARCH, LDEMUL_CHOOSE_TARGET,
	LDEMUL_BEFORE_ALLOCATION, LDEMUL_GET_SCRIPT, LDEMUL_FINISH,
	LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS,
	LDEMUL_OPEN_DYNAMIC_ARCHIVE, LDEMUL_PLACE_ORPHAN,
	LDEMUL_SET_SYMBOLS, LDEMUL_PARSE_ARGS, LDEMUL_UNRECOGNIZED_FILE,
	LDEMUL_LIST_OPTIONS, LDEMUL_RECOGNIZED_FILE,
	LDEMUL_FIND_POTENTIAL_LIBRARIES.
2001-08-13 07:24:58 +00:00
Alan Modra 738108961e * emultempl/elf32.em (output_prev_sec_find): Add missing prototype. 2001-08-09 14:44:18 +00:00
Alan Modra 20713691c2 * emultempl/aix.em: ldexp.h,ldlang.h,ldfile.h,ldemul.h go in this
order.
2001-08-04 04:14:10 +00:00
Alan Modra 3fd367102d * emultempl/beos.em (sort_sections): Modify for 2001-08-03 change,
ie. iterate over wild_statement.section_list.
	(gld${EMULATION_NAME}_place_orphan): Likewise.
2001-08-04 01:21:43 +00:00
H.J. Lu ff7e6f8868 2001-08-03 H.J. Lu <hjl@gnu.org>
* emultempl/beos.em (init): Add the missing initialization.
2001-08-03 19:19:42 +00:00
Charles Wilson decc363800 2001-08-02 Charles Wilson <cwilson@ece.gatech.edu>
* ldmain.c (main): initialize link_info.pei386_auto_import
        * pe-dll.c: new tables for auto-export filtering
        (auto_export): change API, pass abfd for contextual filtering.
        Loop thru tables of excluded symbols instead of comparing
        "by hand".
2001-08-02  Paul Sokolovsky  <paul.sokolovsky@technologist.com>
        * pe-dll.c: new variable pe_dll_enable_extra_debug. New
        static variable current_sec (static struct sec *). Add
        forward declaration for add_bfd_to_link.
        (process_def_file): Don't export undefined symbols. Do not
        export symbols starting with  "_imp__".  Call auto_export()
        with new API.
        (pe_walk_relocs_of_symbol): New function.
        (generate_reloc): add optional extra debugging
        (pe_dll_generate_def_file): eliminate extraneous initial blank
        line in output
        (make_one): enlarge symtab to make room for __nm__ symbols
        (DATA auto-import support).
        (make_singleton_name_thunk): New function.
        (make_import_fixup_mark): New function.
        (make_import_fixup_entry): New function.
        (pe_create_import_fixup): New function.
        (add_bfd_to_link): Specify that 'name' argument is a CONST
        char *.
        * pe-dll.h: declare new variable pe_dll_extra_pe_debug;
        declare new functions pe_walk_relocs_of_symbol and
        pe_create_import_fixup.
        * emultempl/pe.em: add new options --enable-auto-import,
        --disable-auto-import, and --enable-extra-pe-debug.
        (make_import_fixup): New function.
        (pe_find_data_imports): New function.
        (pr_sym): New function.
        (gld_${EMULATION_NAME}_after_open): Add optional extra pe
        debugging. Call pe_find_data_imports.  Mark .idata as DATA, not
        CODE.
2001-08-02  Charles Wilson  <cwilson@ece.gatech.edu>
        * ld.texinfo: add additional documentation for
        --export-all-symbols.  Document --out-implib,
        --enable-auto-image-base, --disable-auto-image-base,
        --dll-search-prefix, --enable-auto-import, and
        --disable-auto-import.
        * ldint.texinfo: Add detailed documentation on auto-import
        implementation.
2001-08-02 23:03:10 +00:00
H.J. Lu 5030876b5d 2001-07-14 H.J. Lu <hjl@gnu.org>
* emultempl/elf32.em (output_prev_sec_find): Never return
	bfd_abs_section_ptr, bfd_com_section_ptr nor
	bfd_und_section_ptr.
2001-07-14 16:36:25 +00:00
Jakub Jelinek 95500e1ca4 * emultempl/elf32.em (output_prev_sec_find): New.
(place_orphan): Use it.
2001-07-13 07:25:18 +00:00
Nick Clifton d29d80f20c Check for the output_bfd not having any coff_data structure allocated to it. 2001-07-11 08:11:16 +00:00
David O'Brien c2a1a436ff 2001-07-09 David O'Brien <obrien@FreeBSD.org>
* emultempl/elf32.em: Do not assuming that contents of the buffer
	returned from basename function will remain unchanged accross other
	function calls.

NOTE: DJ Delorie recomends doing a basename()->lbasename() conversion.

Approved by:  DJ Delorie
              <200107100030.UAA01223@envy.delorie.com>
2001-07-10 00:38:16 +00:00
Hans-Peter Nilsson 605d9b3a4f * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
Update for API change in bfd_elf${ELFSIZE}_size_dynamic_sections.
	* mpw-elfmips.c (gldelf32ebmip_before_allocation): Ditto.
	* ld.h (args_type): Remove member export_dynamic.  All users
	changed to use struct bfd_link_info member.
2001-06-18 22:20:57 +00:00
Alan Modra 8529105a0e * ldlang.c (record_bfd_errors): Remove.
* emultempl/aix.em: Fix copyright dates.
2001-06-08 01:58:20 +00:00
DJ Delorie 3763134dca * emultempl/pe.em (init): Reduce default stack reserve to 0x200000. 2001-06-05 00:48:41 +00:00
H.J. Lu db8d4f2320 2001-05-25 H.J. Lu <hjl@gnu.org>
* emultempl/beos.em (gld${EMULATION_NAME}_before_parse): Move
	setting of output_filename after bfd_scan_arch.
	* emultempl/pe.em: Likewise.
2001-05-25 22:48:14 +00:00
H.J. Lu 5f64210127 2001-05-25 H.J. Lu <hjl@gnu.org>
* emulparams/aixrs6.sh: Add SYSCALL_MASK and SYMBOL_MODE_MASK
	like emulparams/aixppc.sh.

	* emultempl/aix.em (sc): Use ${srcdir}/emultempl/ostring.sed
	instead of ${srcdir}/emultempl/stringify.sed.
2001-05-25 21:19:46 +00:00
H.J. Lu 6cbdcc6fa9 2001-05-24 H.J. Lu <hjl@gnu.org>
* emultempl/stringify.sed: Removed again.
2001-05-25 05:56:38 +00:00
H.J. Lu 86af25fe1d 2001-05-24 H.J. Lu <hjl@gnu.org>
* emultempl/aix.em (OUTPUT_ARCH): Defined.
	(gld${EMULATION_NAME}_before_parse): Initialize
	ldfile_output_architecture, ldfile_output_machine and
	ldfile_output_machine_name from ${OUTPUT_ARCH} if possible.
	* emultempl/beos.em: Likewise.
	* emultempl/elf32.em: Likewise.
	* emultempl/linux.em: Likewise.
	* emultempl/mipsecoff.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/sunos.em: Likewise.
2001-05-25 05:39:22 +00:00
Tom Rix 3b1b01cf25 Support for xcoff64 2001-05-24 20:59:23 +00:00
Alexandre Oliva 57e6abd277 * emultempl/elf32.em (ELF_INTERPRETER_SET_DEFAULT): Use this new
variable to avoid non-portable shell construct.
2001-05-24 02:44:06 +00:00
Nick Clifton 506eee2253 Improve Solaris compatability 2001-05-22 14:00:18 +00:00
H.J. Lu 1c9acd948f 2001-05-03 H.J. Lu <hjl@gnu.org>
* emultempl/elf32.em: Include "libiberty.h".
	(gld${EMULATION_NAME}_vercheck): Call basename () to get the
	basename of the bfd filename.
	(gld${EMULATION_NAME}_stat_needed): Likewise.
	(gld${EMULATION_NAME}_try_needed): Likewise.
	(gld${EMULATION_NAME}_open_dynamic_archive): Likewise.
2001-05-03 06:26:26 +00:00
H.J. Lu 14fe918ef2 2001-05-02 H.J. Lu <hjl@gnu.org>
* emultempl/pe.em: Include <ctype.h>.
2001-05-02 21:01:03 +00:00
Nick Clifton c7e4034828 Add gas and ld support for openrisc 2001-05-02 18:14:31 +00:00
Ulrich Drepper cc5ce05235 * emultmpl/elf32.em (gld${EMULATION_NAME}_search_needed): If NAME
is an absolute path look only for this file and not along the path.
2001-03-20 18:39:21 +00:00
Ulrich Drepper a1ab1d2aa3 * emultempl/elf32.em (OPTION_GROUP): New macro.
Add new option Bgroup to longopts.
	(gld*_parse_args): Handle GROUP_OPTION and recognize -z defs.
	(gld*_list_options): Add -Bgroup and -z defs.
	* ld.1: Document -Bgroup and -z defs.
	* ld.texinfo: Likewise.
2001-03-17 21:24:26 +00:00
Nick Clifton a2b64bede3 Fixtypos in ChangeLogs, fix copyright dates in files 2001-03-13 06:14:29 +00:00
Alan Modra 1c7566d167 * emultempl/m68kelf.em (m68k_elf_after_allocation): Call
after_allocation_default, not gld..._before_allocation.
2001-03-05 05:02:03 +00:00
Hans-Peter Nilsson f813923cf3 * emultempl/elf32.em: Correct spelling in comments and listed
options.
2001-01-24 06:14:09 +00:00
Alan Modra ffd6e9debc Automatically enable --unique=.text for elf32-hppa. 2001-01-14 07:39:01 +00:00
Alan Modra 577a062318 Extend "ld --unique" functionality. 2001-01-14 04:36:35 +00:00
David O'Brien 482e8b3206 2000-01-07 David O'Brien <obrien@BSDi.com>
* emultempl/elf32.em: Only perform Linux ld hints processing when
	targeting Linux.

Approved by:  Nick Clifton <nickc@redhat.com>
              Message-Id: <200101040127.RAA15127@elmo.cygnus.com>
2001-01-08 05:25:58 +00:00
Nick Clifton 1122a5fc50 Add --no-default-excludes option for PE targets 2000-12-26 20:55:30 +00:00
Nick Clifton 6d02a66752 Remove spurious whitespace 2000-12-12 19:37:01 +00:00