aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog10
-rw-r--r--ld/ldlang.c14
-rw-r--r--ld/ldmain.c4
-rw-r--r--ld/lexsup.c8
4 files changed, 33 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 5266bf9..8167892 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,13 @@
+2001-04-13 Jakub Jelinek <jakub@redhat.com>
+
+ * 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-04-05 Steven J. Hill <sjhill@cotw.com>
* Makefile.am (ALL_EMULATIONS): Add eelf32ltsmip.o.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index f417a30..dbe0697 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1176,8 +1176,22 @@ wild_doit (ptr, section, output, file)
if (! first && (section->output_section->flags & SEC_READONLY) == 0)
flags &= ~ SEC_READONLY;
+ /* Keep SEC_MERGE and SEC_STRINGS only if they are the same. */
+ if (! first
+ && ((section->output_section->flags & (SEC_MERGE | SEC_STRINGS))
+ != (flags & (SEC_MERGE | SEC_STRINGS))
+ || ((flags & SEC_MERGE)
+ && section->output_section->entsize != section->entsize)))
+ {
+ section->output_section->flags &= ~ (SEC_MERGE | SEC_STRINGS);
+ flags &= ~ (SEC_MERGE | SEC_STRINGS);
+ }
+
section->output_section->flags |= flags;
+ if (flags & SEC_MERGE)
+ section->output_section->entsize = section->entsize;
+
/* If SEC_READONLY is not set in the input section, then clear
it from the output section. */
if ((section->flags & SEC_READONLY) == 0)
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 0113453..4e9827f 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -225,7 +225,7 @@ main (argc, argv)
link_info.no_undefined = false;
link_info.allow_shlib_undefined = false;
link_info.strip = strip_none;
- link_info.discard = discard_none;
+ link_info.discard = discard_sec_merge;
link_info.keep_memory = true;
link_info.input_bfds = NULL;
link_info.create_object_symbols_section = NULL;
@@ -278,7 +278,7 @@ main (argc, argv)
if (link_info.relocateable && link_info.strip == strip_all)
{
link_info.strip = strip_debugger;
- if (link_info.discard == discard_none)
+ if (link_info.discard == discard_sec_merge)
link_info.discard = discard_all;
}
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 3664a85..0d931b1 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -129,6 +129,7 @@ int parsing_defsym = 0;
#define OPTION_UNIQUE (OPTION_SECTION_START + 1)
#define OPTION_TARGET_HELP (OPTION_UNIQUE + 1)
#define OPTION_ALLOW_SHLIB_UNDEFINED (OPTION_TARGET_HELP + 1)
+#define OPTION_DISCARD_NONE (OPTION_ALLOW_SHLIB_UNDEFINED + 1)
/* The long options. This structure is used for both the option
parsing and the help text. */
@@ -248,7 +249,9 @@ static const struct ld_option ld_options[] =
{ {"discard-all", no_argument, NULL, 'x'},
'x', NULL, N_("Discard all local symbols"), TWO_DASHES },
{ {"discard-locals", no_argument, NULL, 'X'},
- 'X', NULL, N_("Discard temporary local symbols"), TWO_DASHES },
+ 'X', NULL, N_("Discard temporary local symbols (default)"), TWO_DASHES },
+ { {"discard-none", no_argument, NULL, OPTION_DISCARD_NONE},
+ '\0', NULL, N_("Don't discard any local symbols"), TWO_DASHES },
{ {"trace-symbol", required_argument, NULL, 'y'},
'y', N_("SYMBOL"), N_("Trace mentions of SYMBOL"), TWO_DASHES },
{ {NULL, required_argument, NULL, '\0'},
@@ -1044,6 +1047,9 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
case OPTION_WRAP:
add_wrap (optarg);
break;
+ case OPTION_DISCARD_NONE:
+ link_info.discard = discard_none;
+ break;
case 'X':
link_info.discard = discard_l;
break;