aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
AgeCommit message (Collapse)AuthorFilesLines
2003-06-28Convert to C90Alan Modra1-43/+29
2003-06-25Correct spelling of "relocatable".Alan Modra1-4/+4
2003-05-30bfd/Jakub Jelinek1-0/+14
* 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-05-07* ldmain.h (overflow_cutoff_limit): Declare.Alexandre Oliva1-0/+1
* ldmain.c (overflow_cutoff_limit): Define, initialized to 10. (reloc_overflow): Limit error messages based on it. * lexsup.c (parse_args) <OPTION_VERBOSE>: Set cutoff to unlimited.
2003-03-31Fix memory leaksNick Clifton1-2/+6
2003-02-28 * ldemul.c (ldemul_add_options, ldemul_handle_option): New functions.Alan Modra1-3/+14
(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.
2003-02-17Fix the behaviour of --allow-shlib-undefined, so that it does what it claimsNick Clifton1-3/+9
to do. Add an inverse switch. Update the documentation.
2002-12-23 * ldmain.c (main): Init "strip_discarded".Alan Modra1-1/+13
* lexsup.c (OPTION_STRIP_DISCARDED): Define. (OPTION_NO_STRIP_DISCARDED): Define. (ld_options): Add "strip-discarded" and "no-strip-discarded". (parse_args): Handle them.
2002-12-23Change linker's default behaviour - it will now reject binary files whoesNick Clifton1-0/+12
architecture it does not recognise, unless it has explicitly told to accept them.
2002-11-30s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. SimplifyAlan Modra1-74/+74
comparisons of bfd_boolean vars with TRUE/FALSE. Formatting.
2002-10-30 * emultempl/aix.em: Use include <> for generated headers.Daniel Jacobowitz1-1/+1
* emultempl/beos.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/pe.em: Likewise. * ldctor.c: Likewise. * ldexp.c: Likewise. * ldfile.c: Likewise. * ldlang.c: Likewise. * ldlex.c: Likewise. * ldlex.l: Likewise. * ldmain.c: Likewise. * ldmisc.c: Likewise. * ldwrite.c: Likewise. * lexsup.c: Likewise. * mri.c: Likewise. * pe-dll.c: Likewise.
2002-10-23Add new command line option "--no-omagic" which undoes the effects of -N.Nick Clifton1-0/+9
2002-10-082002-10-08 H.J. Lu <hjl@gnu.org>H.J. Lu1-2/+0
* ldlang.c (lang_file_exist): Removed. (new_afile): Revert the last change. * ldlang.h (lang_file_exist): Removed. * lexsup.c (parse_args): Revert the last change.
2002-10-07Abort if the filename to be added matches the linker output filename.Nick Clifton1-15/+17
2002-08-08Check symbols with undefine version.H.J. Lu1-1/+7
2002-05-222002-05-21 H.J. Lu (hjl@gnu.org)H.J. Lu1-1/+7
* emultempl/elf32.em (gld${EMULATION_NAME}_parse_args): Handle "-z muldefs". (gld${EMULATION_NAME}_list_options): Add "-z muldefs". * ld.texinfo: Updated for --allow-multiple-definition and "-z muldefs". * ldmain.c (main): Initialize the allow_multiple_definition field to false. * lexsup.c (OPTION_ALLOW_MULTIPLE_DEFINITION): New. (ld_options): Add --allow-multiple-definition. (parse_args): Support OPTION_ALLOW_MULTIPLE_DEFINITION.
2002-05-03 * ld.h: Fix formatting.Kazu Hirata1-5/+5
* ldexp.c: Likewise. * ldfile.c: Likewise. * ldlang.c: Likewise. * ldmain.c: Likewise. * lexsup.c: Likewise. * pe-dll.c: Likewise.
2002-02-112002-02-10 Daniel Jacobowitz <drow@mvista.com>Daniel Jacobowitz1-7/+0
* lexsup.c: Remove strtoul declaration.
2002-02-102002-02-10 Daniel Jacobowitz <drow@mvista.com>Daniel Jacobowitz1-1/+4
* ldmain.c: Add prototype for main (). * lexsup.c: Guard declaration of strtoul with HAVE_STDLIB_H. * emultempl/lnk960.em (lnk960_choose_target): Function should take two arguments.
2001-12-13 * lexsup.c (parse_args): Don't pass shortopts to second call toAlan Modra1-10/+7
getopt functions. Restore optind rather than decrementing before second call. Remove errind as it now duplicates last_optind.
2001-12-07Insert 'PROGRAM' into the text string describing the -N option so that it isNick Clifton1-1/+1
easier to translate into foreign languages.
2001-11-022001-11-01 Chris Demetriou <cgd@broadcom.com>Chris Demetriou1-0/+6
* ld.texinfo (Options): Document new option, -nostdlib. * lexsup.c (OPTION_NOSTDLIB): New definition. (ld_options): Add entry for "nostdlib". (parse_args): Handle OPTIONS_NOSTDLIB. * ldfile.c (ldfile_add_library_path): Don't add directories to the search path if they weren't specified on the command line and -nostdlib was specified. * ld.h (ld_config_type): New member only_cmd_line_lib_dirs.
2001-10-31Fix infinite parsing loopNick Clifton1-38/+27
2001-10-02 * ldver.h (ld_program_version): Remove declaration.Alan Modra1-16/+1
* lexsup.c (parse_args): Move printing of copyright message.. * ldver.c (ldversion): .. to here. Use BFD_VERSION_STRING in place of BFD_VERSION. (ld_program_version): Remove. * Makefile.am (Makefile): Depend on bfd/configure.in Run "make dep-am" * Makefile.in: Regenerate.
2001-09-29From John Reiser <jreiser@BitWagon.com>Alan Modra1-0/+6
* ldlang.c (lang_common): Conditionally inhibit Common allocation. * lexsup.c: Add --no-define-common commandline option. * ldgram.y: Add INHIBIT_COMMON_ALLOCATION script command. * ldlex.l: Likewise. * ld.h: Add command_line.inhibit_common_definition. * ldmain.c (main): Initialize. * ld.texinfo: Document.
2001-09-19Locale changes from Bruno Haible <haible@clisp.cons.org>.H.J. Lu1-3/+3
2001-08-23 * elf-bfd.h (enum elf_reloc_type_class): New.Jakub Jelinek1-0/+6
(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-12Make --verbose always display linker scriptNick Clifton1-3/+3
2001-06-18 * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):Hans-Peter Nilsson1-1/+0
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-162001-06-15 H.J. Lu <hjl@gnu.org>H.J. Lu1-2/+3
* lexsup.c (parse_args); Save optind to report unrecognized option.
2001-06-15 * lexsup.c (parse_args) <case OPTION_EXPORT_DYNAMIC, case 'E'>:Hans-Peter Nilsson1-0/+1
Set new link_info member export_dynamic. * ldmain.c (main): Initialize new link_info member export_dynamic.
2001-05-22Improve Solaris compatabilityNick Clifton1-2/+3
2001-05-022001-05-02 H.J. Lu <hjl@gnu.org>H.J. Lu1-2/+2
* ldfile.c: Include "libiberty.h". * ldlex.l: Likewise. * ldmisc.c (buystring): Removed. * ldmisc.h: Likewise. * ldfile.c: Replace buystring with xstrdup. * ldlang.c: Likewise. * ldlex.l: Likewise. * ldmain.c: Likewise. * ldmisc.c: Likewise. * lexsup.c: Likewise. * mpw-eppcmac.c: Likewise.
2001-04-13* ld.texinfo: Document --fatal-warnings.J.T. Conklin1-1/+8
* ld.1: Regenerate. * ldmisc.c (vfinfo): Set flag to inhibit making executable if warnings have been turned into errors. * lexsup.c (OPTION_WARN_FATAL): Define. (ld_options): Entry for --fatal-warnings. (parse_args): Handle OPTION_WARN_FATAL. * ld.h (ld_config_type): Add fatal_warnings field.
2001-04-13bfd/Jakub Jelinek1-1/+7
* libbfd-in.h (_bfd_merge_section): New. (_bfd_write_merged_section): New. (_bfd_merged_section_offset): New. * libbfd.h: Rebuilt. * linker.c (_bfd_generic_link_output_symbols): Handle discard_sec_merge. * aoutx.h (aout_link_write_symbols): Likewise. * pdp11.c (aout_link_write_symbols): Likewise. * elflink.h (elf_link_add_object_symbols): Call _bfd_merge_section. (elf_bfd_final_link): Adjust global symbols pointing into SEC_MERGE sections. (elf_link_sec_merge_syms): New. (elf_link_input_bfd): Call _bfd_merged_section_offset and _bfd_write_merged_section. Handle discard_sec_merge. * elf-bfd.h (struct elf_link_hash_table): Add merge_info field. (struct bfd_elf_section_data): Likewise. * elf.c (_bfd_elf_make_section_from_shdr): Set SEC_MERGE and SEC_STRINGS section flags and entsize from their ELF counterparts. (_bfd_elf_link_hash_table_init): Initialize merge_info. (elf_fake_sections): Set SHF_MERGE, SHF_STRINGS and sh_entsize from their BFD counterparts. * merge.c: New file. * Makefile.am: Add strtab.lo. * Makefile.in: Rebuilt. include/ * bfdlink.h (bfd_link_discard): Add discard_sec_merge. gas/ * config/obj-elf.c (obj_elf_change_section): Add entsize argument, handle SHF_MERGE and SHF_STRINGS. (obj_elf_parse_section_letters): Set SHF_MERGE and SHF_STRINGS. (obj_elf_section): Allow additional argument specifying entity size. * write.c (adjust_reloc_syms): Keep relocations against local symbols in SEC_MERGE sections. ld/ * ldmain.c (main): Default to discard_sec_merge. * lexsup.c (OPTION_DISCARD_NONE): Define. (ld_options): Add --discard-none. (parse_args): Handle OPTION_DISCARD_NONE. * ldlang.c (wild_doit): SEC_MERGE should be set in the output section only if SEC_MERGE and SEC_STRINGS flags and entsize of all its input sections match.
2001-03-13Fixtypos in ChangeLogs, fix copyright dates in filesNick Clifton1-1/+2
2001-01-14Extend "ld --unique" functionality.Alan Modra1-3/+6
2001-01-13formatting fixNick Clifton1-1/+1
2001-01-12Update copyright date to 2001Nick Clifton1-2/+2
2000-12-31Fix problems with new EXACTLY_TWO_DASHES command line switch option.Nick Clifton1-3/+11
2000-12-28Requre that long options starting with 'o' only accept a double dash prefix.Nick Clifton1-12/+40
2000-12-12Add link option to allow undefiedn symbols in shared librariesNick Clifton1-2/+10
2000-10-17Added new option --target-help.Chandra Chavva1-0/+7
2000-10-112000-10-10 Kazu Hirata <kazu@hxi.com>Kazu Hirata1-30/+27
* deffile.h: Fix formatting. * lexsup.c: Likewise. * mri.c: Likewise.
2000-09-292000-09-29 Kazu Hirata <kazu@hxi.com>Kazu Hirata1-11/+11
* 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-09-05--split-by-reloc, --split-by-file extensions. --unique option.Alan Modra1-6/+18
2000-09-02Add .gnu.linkonce.wi.* to .debug_info sections.Nick Clifton1-11/+0
2000-07-20Add optional style argument to --demangle switch.Nick Clifton1-2/+14
2000-07-202000-07-19 H.J. Lu <hjl@gnu.org>H.J. Lu1-0/+4
* emulparams/elf32mcore.sh (PARSE_AND_LIST_ARGS): Removed. (PARSE_AND_LIST_PROLOGUE): New. (PARSE_AND_LIST_LONGOPTS): Likewise. (PARSE_AND_LIST_OPTIONS): Likewise. (PARSE_AND_LIST_ARGS_CASES): Likewise. * ldmain.c (main): Clear link_info.flags and link_info.flags_1. * lexsup.c (ld_options): Comment out 'z'. (parse_args): Likewise. * emultempl/elf32.em: Include "elf/common.h". (gld_${EMULATION_NAME}_parse_args): Defined. Handle some -z options. (gld_${EMULATION_NAME}_list_options): Likewise. * ld.texinfo: Add documentation for the recognized -z options.
2000-07-08Fix --section-start=xxxxAlan Modra1-4/+9