From: Ian Lance Taylor Date: Mon, 22 Apr 1996 21:32:58 +0000 (+0000) Subject: * ldlang.c (lang_size_sections): If _cooked_size is not 0, then X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6799c638e59e6861940dd4eec6c59f6466db1f69;p=binutils-gdb.git * ldlang.c (lang_size_sections): If _cooked_size is not 0, then don't clobber it when not relaxing. * ld.h (ld_config_type): Remove traditional_format field. * ldmain.c (main): Use link_info.traditional_format rather than config.traditional_format. * ldlang.c (ldlang_open_output): Likewise. * lexsup.c (parse_args): Likewise. * emultempl/aix.em (gld${EMULATION_NAME}_parse_args): Likewise. * mpw-eppcmac.c (gldppcmacos_parse_args): Likewise. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index e30a0afceb4..f29bf9a75a7 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,16 @@ Mon Apr 22 12:07:32 1996 Ian Lance Taylor + * ldlang.c (lang_size_sections): If _cooked_size is not 0, then + don't clobber it when not relaxing. + + * ld.h (ld_config_type): Remove traditional_format field. + * ldmain.c (main): Use link_info.traditional_format rather than + config.traditional_format. + * ldlang.c (ldlang_open_output): Likewise. + * lexsup.c (parse_args): Likewise. + * emultempl/aix.em (gld${EMULATION_NAME}_parse_args): Likewise. + * mpw-eppcmac.c (gldppcmacos_parse_args): Likewise. + * ldlang.c (wild_doit): Discard debugging sections if we are stripping debugging information. diff --git a/ld/ld.h b/ld/ld.h index 048734cd887..c776de62784 100644 --- a/ld/ld.h +++ b/ld/ld.h @@ -1,6 +1,6 @@ /* ld.h - - Copyright (C) 1991, 1993 Free Software Foundation, Inc. + Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -21,6 +21,17 @@ #ifndef LD_H #define LD_H +/* Look in this environment name for the linker to pretend to be */ +#define EMULATION_ENVIRON "LDEMULATION" +/* If in there look for the strings: */ + +/* Look in this variable for a target format */ +#define TARGET_ENVIRON "GNUTARGET" + +/* Input sections which are put in a section of this name are actually + discarded. */ +#define DISCARD_SECTION_NAME "/DISCARD/" + /* Extra information we hold on sections */ typedef struct user_section_struct { @@ -59,6 +70,10 @@ typedef struct /* Runtime library search path from the -rpath argument. */ char *rpath; + /* Link time runtime library search path from the -rpath-link + argument. */ + char *rpath_link; + /* Big or little endian as set on command line. */ enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian; @@ -81,20 +96,25 @@ typedef struct boolean magic_demand_paged; boolean make_executable; - /* If true, request BFD to use the traditional format. */ - boolean traditional_format; - /* If true, doing a dynamic link. */ boolean dynamic_link; + /* If true, build constructors. */ boolean build_constructors; + /* If true, warn about any constructors. */ + boolean warn_constructors; + /* If true, warn about merging common symbols with others. */ boolean warn_common; /* If true, only warn once about a particular undefined symbol. */ boolean warn_once; + /* If true, warn if multiple global-pointers are needed (Alpha + only). */ + boolean warn_multiple_gp; + boolean sort_common; boolean text_read_only; @@ -120,6 +140,9 @@ typedef enum extern boolean had_script; extern boolean force_make_executable; +/* Non-zero if we are processing a --defsym from the command line. */ +extern int parsing_defsym; + extern int yyparse PARAMS ((void)); #endif diff --git a/ld/ldlang.c b/ld/ldlang.c index 3288fe1bce0..f9e0e7124be 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1110,7 +1110,7 @@ ldlang_open_output (statement) output_bfd->flags |= WP_TEXT; else output_bfd->flags &= ~WP_TEXT; - if (config.traditional_format) + if (link_info.traditional_format) output_bfd->flags |= BFD_TRADITIONAL_FORMAT; else output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT; @@ -2139,7 +2139,10 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax) i = (*prev)->input_section.section; if (! relax) - i->_cooked_size = i->_raw_size; + { + if (i->_cooked_size == 0) + i->_cooked_size = i->_raw_size; + } else { boolean again; diff --git a/ld/ldmain.c b/ld/ldmain.c index 1096368a9d9..aee02e7cb41 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -169,7 +169,6 @@ main (argc, argv) /* Initialize the data about options. */ trace_files = trace_file_tries = version_printed = false; whole_archive = false; - config.traditional_format = false; config.build_constructors = true; config.dynamic_link = false; command_line.force_common_definition = false; @@ -181,6 +180,7 @@ main (argc, argv) link_info.shared = false; link_info.symbolic = false; link_info.static_link = false; + link_info.traditional_format = false; link_info.strip = strip_none; link_info.discard = discard_none; link_info.lprefix_len = 1; @@ -660,6 +660,17 @@ multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval) asection *nsec; bfd_vma nval; { + /* If either section has the output_section field set to + bfd_abs_section_ptr, it means that the section is being + discarded, and this is not really a multiple definition at all. + FIXME: It would be cleaner to somehow ignore symbols defined in + sections which are being discarded. */ + if ((osec->output_section != NULL + && bfd_is_abs_section (osec->output_section)) + || (nsec->output_section != NULL + && bfd_is_abs_section (nsec->output_section))) + return true; + einfo ("%X%C: multiple definition of `%T'\n", nbfd, nsec, nval, name); if (obfd != (bfd *) NULL) diff --git a/ld/lexsup.c b/ld/lexsup.c index 85dc568ca5e..0459dc609a0 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -141,11 +141,11 @@ static const struct ld_option ld_options[] = 'E', NULL, "Export all dynamic symbols", TWO_DASHES }, { {NULL, optional_argument, NULL, '\0'}, 'F', "[FORMAT]", "Ignored", ONE_DASH }, + { {NULL, no_argument, NULL, '\0'}, + 'g', NULL, "Ignored", ONE_DASH }, { {"gpsize", required_argument, NULL, 'G'}, 'G', "SIZE", "Small data size (if no size, same as --shared)", TWO_DASHES }, - { {NULL, no_argument, NULL, '\0'}, - 'g', NULL, "Ignored", ONE_DASH }, { {"soname", required_argument, NULL, OPTION_SONAME}, 'h', "FILENAME", "Set internal name of shared library", ONE_DASH }, { {"library", required_argument, NULL, 'l'}, @@ -204,10 +204,10 @@ static const struct ld_option ld_options[] = '\0', "KEYWORD", "Ignored for SunOS compatibility", ONE_DASH }, { {"Bdynamic", no_argument, NULL, OPTION_CALL_SHARED}, '\0', NULL, "Link against shared libraries", ONE_DASH }, - { {"call_shared", no_argument, NULL, OPTION_CALL_SHARED}, - '\0', NULL, NULL, ONE_DASH }, { {"dy", no_argument, NULL, OPTION_CALL_SHARED}, '\0', NULL, NULL, ONE_DASH }, + { {"call_shared", no_argument, NULL, OPTION_CALL_SHARED}, + '\0', NULL, NULL, ONE_DASH }, { {"Bstatic", no_argument, NULL, OPTION_NON_SHARED}, '\0', NULL, "Do not link against shared libraries", ONE_DASH }, { {"dn", no_argument, NULL, OPTION_NON_SHARED}, @@ -630,7 +630,7 @@ parse_args (argc, argv) set_section_start (".text", optarg); break; case OPTION_TRADITIONAL_FORMAT: - config.traditional_format = true; + link_info.traditional_format = true; break; case OPTION_UR: link_info.relocateable = true; diff --git a/ld/mpw-eppcmac.c b/ld/mpw-eppcmac.c index b25b371fe7a..99d2b4dc05e 100644 --- a/ld/mpw-eppcmac.c +++ b/ld/mpw-eppcmac.c @@ -335,7 +335,7 @@ gldppcmacos_parse_args (argc, argv) break; case OPTION_NOSTRCMPCT: - config.traditional_format = true; + link_info.traditional_format = true; break; case OPTION_PD: @@ -384,7 +384,7 @@ gldppcmacos_parse_args (argc, argv) break; case OPTION_STRCMPCT: - config.traditional_format = false; + link_info.traditional_format = false; break; case OPTION_UNIX: