PR ld/10956
authorNick Clifton <nickc@redhat.com>
Thu, 26 Nov 2009 13:45:25 +0000 (13:45 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 26 Nov 2009 13:45:25 +0000 (13:45 +0000)
        * ld.h (struct args_type): Rename 'relax' field to
        'disable_target_specific_optimizations' and turn it into a
        tri-state variable.
        (RELAXATION_DISABLED_BY_DEFAULT): New macro.
        (RELAXATION_DISABLED_BY_USER): New macro.
        (RELAXATION_ENABLED): New macro.
        (DISABLE_RELAXATION): New macro.
        (ENABLE_RELAXATION): New macro.
        * lexsup (enum option_values): Add OPTION_NO_RELAX.
        (struct ld_options): Add --no-relax.
        (parse_args): Handle OPTION_NO_RELAX.  Use DISABLE_RELAXATION and
        ENABLE_RELAXATION macros.
        * ldlang.c (lang_relax_sections): Use RELAXATION_ENABLED macro.
        (lang_process): Likewise.
        * ldmain.c (main): Initialise
        disable_target_specific_optimizations field.
        (multiple_definition): Use RELAXATION_ENABLED macro.
        * ld.texinfo: Document new command line option.
        * emultempl/alphaelf.em: Remove --no-relax option.
        (before_allocation): Test RELAXATION_DISABLED_BY_USER macro.
        Use ENABLE_RELAXATION macro.
        * emultempl/avrelf.em: (after_allocation): Test RELAXATION_ENABLED
        macro.
        * emultempl/cr16elf.em: Remove --no-relax option.
        (before_allocation): Test RELAXATION_DISABLED_BY_USER macro.
        Use ENABLE_RELAXATION macro.
        * emultempl/crxelf.em: Remove --no-relax option.
        (before_allocation): Test RELAXATION_DISABLED_BY_USER macro.
        Use ENABLE_RELAXATION macro.
        * emultempl/mmix-elfnmmo.em: (before_allocation): Use
        ENABLE_RELAXATION macro.
        * emultempl/needrelax.em: (before_allocation): Use
        ENABLE_RELAXATION macro.
        * emultempl/ppc32elf.em: (before_allocation): Test
        RELAXATION_DISABLED_BY_DEFAULT macro. Use
        ENABLE_RELAXATION macro.
        * emultempl/sh64elf.em: (before_allocation): Test
        RELAXATION_ENABLED macro. Use DISABLE_RELAXATION macro.
        * emultempl/xtensaelf.em: Remove --no-relax option.
        (before_allocation): Test RELAXATION_ENABLED macro.
        Use ENABLE_RELAXATION macro.

15 files changed:
ld/ChangeLog
ld/emultempl/alphaelf.em
ld/emultempl/avrelf.em
ld/emultempl/cr16elf.em
ld/emultempl/crxelf.em
ld/emultempl/mmix-elfnmmo.em
ld/emultempl/needrelax.em
ld/emultempl/ppc32elf.em
ld/emultempl/sh64elf.em
ld/emultempl/xtensaelf.em
ld/ld.h
ld/ld.texinfo
ld/ldlang.c
ld/ldmain.c
ld/lexsup.c

index cd88318c5d97e67c524fec9dbac5e2fc25ce6857..904262fb9f51a910f1e8fcaa9e3c5390480c520b 100644 (file)
@@ -1,3 +1,48 @@
+2009-11-26  Nick Clifton  <nickc@redhat.com>
+
+       PR ld/10956
+       * ld.h (struct args_type): Rename 'relax' field to
+       'disable_target_specific_optimizations' and turn it into a
+       tri-state variable.
+       (RELAXATION_DISABLED_BY_DEFAULT): New macro.
+       (RELAXATION_DISABLED_BY_USER): New macro.
+       (RELAXATION_ENABLED): New macro.
+       (DISABLE_RELAXATION): New macro.
+       (ENABLE_RELAXATION): New macro.
+       * lexsup (enum option_values): Add OPTION_NO_RELAX.
+       (struct ld_options): Add --no-relax.
+       (parse_args): Handle OPTION_NO_RELAX.  Use DISABLE_RELAXATION and
+       ENABLE_RELAXATION macros.
+       * ldlang.c (lang_relax_sections): Use RELAXATION_ENABLED macro.
+       (lang_process): Likewise.
+       * ldmain.c (main): Initialise
+       disable_target_specific_optimizations field.
+       (multiple_definition): Use RELAXATION_ENABLED macro.
+       * ld.texinfo: Document new command line option.
+       * emultempl/alphaelf.em: Remove --no-relax option.
+       (before_allocation): Test RELAXATION_DISABLED_BY_USER macro.
+       Use ENABLE_RELAXATION macro.
+       * emultempl/avrelf.em: (after_allocation): Test RELAXATION_ENABLED
+       macro.
+       * emultempl/cr16elf.em: Remove --no-relax option.
+       (before_allocation): Test RELAXATION_DISABLED_BY_USER macro.
+       Use ENABLE_RELAXATION macro.
+       * emultempl/crxelf.em: Remove --no-relax option.
+       (before_allocation): Test RELAXATION_DISABLED_BY_USER macro.
+       Use ENABLE_RELAXATION macro.
+       * emultempl/mmix-elfnmmo.em: (before_allocation): Use
+       ENABLE_RELAXATION macro.
+       * emultempl/needrelax.em: (before_allocation): Use
+       ENABLE_RELAXATION macro.
+       * emultempl/ppc32elf.em: (before_allocation): Test
+       RELAXATION_DISABLED_BY_DEFAULT macro. Use
+       ENABLE_RELAXATION macro.
+       * emultempl/sh64elf.em: (before_allocation): Test
+       RELAXATION_ENABLED macro. Use DISABLE_RELAXATION macro.
+       * emultempl/xtensaelf.em: Remove --no-relax option.
+       (before_allocation): Test RELAXATION_ENABLED macro.
+       Use ENABLE_RELAXATION macro.
+       
 2009-11-25  Kai Tietz  <kai.tietz@onevision.com>
 
        * scripttempl/pe.sc: (.note.GNU-stack): Mark as discardable.
index 864e6998acb5455064f94f06e12ba3d5b612e40a..7b7c8d7072308a302f894e25f5fc53c42b70e285 100644 (file)
@@ -30,7 +30,6 @@ fragment <<EOF
 #include "elf-bfd.h"
 
 static bfd_boolean limit_32bit;
-static bfd_boolean disable_relaxation;
 
 extern bfd_boolean elf64_alpha_use_secureplt;
 
@@ -91,8 +90,8 @@ alpha_before_allocation (void)
   gld${EMULATION_NAME}_before_allocation ();
 
   /* Add -relax if -O, not -r, and not explicitly disabled.  */
-  if (link_info.optimize && !link_info.relocatable && !disable_relaxation)
-    command_line.relax = TRUE;
+  if (link_info.optimize && !link_info.relocatable && ! RELAXATION_DISABLED_BY_USER)
+    ENABLE_RELAXATION;
 }
 
 static void
@@ -110,14 +109,12 @@ EOF
 #
 PARSE_AND_LIST_PROLOGUE='
 #define OPTION_TASO            300
-#define OPTION_NO_RELAX                (OPTION_TASO + 1)
-#define OPTION_SECUREPLT       (OPTION_NO_RELAX + 1)
+#define OPTION_SECUREPLT       (OPTION_TASO + 1)
 #define OPTION_NO_SECUREPLT    (OPTION_SECUREPLT + 1)
 '
 
 PARSE_AND_LIST_LONGOPTS='
   { "taso", no_argument, NULL, OPTION_TASO },
-  { "no-relax", no_argument, NULL, OPTION_NO_RELAX },
   { "secureplt", no_argument, NULL, OPTION_SECUREPLT },
   { "no-secureplt", no_argument, NULL, OPTION_NO_SECUREPLT },
 '
@@ -126,7 +123,6 @@ PARSE_AND_LIST_OPTIONS='
   fprintf (file, _("\
   --taso                      Load executable in the lower 31-bit addressable\n\
                                 virtual address range.\n\
-  --no-relax                  Do not relax call and gp sequences.\n\
   --secureplt                 Force PLT in text segment.\n\
   --no-secureplt              Force PLT in data segment.\n\
 "));
@@ -136,9 +132,6 @@ PARSE_AND_LIST_ARGS_CASES='
     case OPTION_TASO:
       limit_32bit = 1;
       break;
-    case OPTION_NO_RELAX:
-      disable_relaxation = TRUE;
-      break;
     case OPTION_SECUREPLT:
       elf64_alpha_use_secureplt = TRUE;
       break;
index f0807ddea392733fb427a9b9f89b4e26e0510b0d..84f163325ed360b653d7fcd29f309c7b34f02d5d 100644 (file)
@@ -146,7 +146,7 @@ avr_elf_create_output_section_statements (void)
 static void
 avr_elf_after_allocation (void)
 {
-  if (!avr_no_stubs && !command_line.relax)
+  if (!avr_no_stubs && ! RELAXATION_ENABLED)
     {
       /* If relaxing, elf32_avr_size_stubs will be called from
         elf32_avr_relax_section.  */
index 83f07834b5ce6e3c4ca700b9fe910b8b0c6a0c27..9850bda6b129fe9cecc81d12911e08e60fab8845 100644 (file)
@@ -27,9 +27,6 @@ fragment <<EOF
 
 #include "ldctor.h"
 
-/* Flag for the emulation-specific "--no-relax" option.  */
-static bfd_boolean disable_relaxation = FALSE;
-
 static void check_sections (bfd *, asection *, void *);
 
 
@@ -173,34 +170,12 @@ cr16elf_before_allocation (void)
      specified.  This is done here instead of in the before_parse hook
      because there is a check in main() to prohibit use of --relax and
      -r together.  */
-
-  if (!disable_relaxation)
-    command_line.relax = TRUE;
+  if (RELAXATION_DISABLED_BY_DEFAULT)
+    ENABLE_RELAXATION;
 }
 
 EOF
 
-# Define some shell vars to insert bits of code into the standard elf
-# parse_args and list_options functions.
-#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_NO_RELAX                        301
-'
-
-PARSE_AND_LIST_LONGOPTS='
-  { "no-relax", no_argument, NULL, OPTION_NO_RELAX},
-'
-
-PARSE_AND_LIST_OPTIONS='
-  fprintf (file, _("  --no-relax                  Do not relax branches\n"));
-'
-
-PARSE_AND_LIST_ARGS_CASES='
-    case OPTION_NO_RELAX:
-      disable_relaxation = TRUE;
-      break;
-'
-
 # Put these extra cr16-elf routines in ld_${EMULATION_NAME}_emulation
 #
 LDEMUL_AFTER_OPEN=cr16_elf_after_open
index a257c06d5809fab243d54139a02a81a0664691ed..c6d5a8dd64678b5ad17685c0271a099202a1ded5 100644 (file)
@@ -27,9 +27,6 @@ fragment <<EOF
 
 #include "ldctor.h"
 
-/* Flag for the emulation-specific "--no-relax" option.  */
-static bfd_boolean disable_relaxation = FALSE;
-
 static void crxelf_after_parse (void);
 
 static void
@@ -62,34 +59,12 @@ crxelf_before_allocation (void)
      specified.  This is done here instead of in the before_parse hook
      because there is a check in main() to prohibit use of --relax and
      -r together.  */
-
-  if (!disable_relaxation)
-    command_line.relax = TRUE;
+  if (RELAXATION_DISABLED_BY_DEFAULT)
+    ENABLE_RELAXATION;
 }
 
 EOF
 
-# Define some shell vars to insert bits of code into the standard elf
-# parse_args and list_options functions.
-#
-PARSE_AND_LIST_PROLOGUE='
-#define OPTION_NO_RELAX                        301
-'
-
-PARSE_AND_LIST_LONGOPTS='
-  { "no-relax", no_argument, NULL, OPTION_NO_RELAX},
-'
-
-PARSE_AND_LIST_OPTIONS='
-  fprintf (file, _("  --no-relax                  Do not relax branches\n"));
-'
-
-PARSE_AND_LIST_ARGS_CASES='
-    case OPTION_NO_RELAX:
-      disable_relaxation = TRUE;
-      break;
-'
-
 # Put these extra crx-elf routines in ld_${EMULATION_NAME}_emulation
 #
 LDEMUL_AFTER_PARSE=crxelf_after_parse
index 6a7b295406e96c0b56f64139873967a79bdc5d4b..0059792022776f3f0b5b56ff8bfe2df302f9560f 100644 (file)
@@ -42,7 +42,7 @@ mmix_before_allocation (void)
 
   /* Force -relax on (regardless of whether we're doing a relocatable
      link).  */
-  command_line.relax = TRUE;
+  ENABLE_RELAXATION;
 
   if (!_bfd_mmix_before_linker_allocation (link_info.output_bfd, &link_info))
     einfo ("%X%P: Internal problems setting up section %s",
index 4c475db707a9d038d5996b043048d22b89653ddb..7f9022463f8a65abb750235d7ef5a803a827c4f5 100644 (file)
@@ -34,6 +34,6 @@ need_relax_${EMULATION_NAME}_before_allocation (void)
 
   /* Force -relax on if not doing a relocatable link.  */
   if (! link_info.relocatable)
-    command_line.relax = TRUE;
+    ENABLE_RELAXATION;
 }
 EOF
index 3befe75091a325f17e51665e135189eb48243a10..9ff81f58a103a5e18a16deafd79af69c88425c4a 100644 (file)
@@ -121,7 +121,7 @@ ppc_before_allocation (void)
 
   /* Turn on relaxation if executable sections have addresses that
      might make branches overflow.  */
-  if (!command_line.relax)
+  if (RELAXATION_DISABLED_BY_DEFAULT)
     {
       bfd_vma low = (bfd_vma) -1;
       bfd_vma high = 0;
@@ -148,7 +148,7 @@ ppc_before_allocation (void)
            high = o->vma + o->rawsize - 1;
        }
       if (high > low && high - low > (1 << 25) - 1)
-       command_line.relax = TRUE;
+       ENABLE_RELAXATION;
     }
 }
 
index 0c5dc4e9ed00da7c4b181a48c5f67d056225460a..88035b0dc51177a4c2771e131f8c0aa57102ca02 100644 (file)
@@ -59,7 +59,7 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
 
   if (cranges != NULL)
     {
-      if (command_line.relax)
+      if (RELAXATION_ENABLED)
        {
          /* FIXME: Look through incoming sections with .cranges
             descriptors, build up some kind of descriptors that the
@@ -82,7 +82,7 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
              }
          }
 
-         command_line.relax = FALSE;
+         DISABLE_RELAXATION;
        }
 
       /* We wouldn't need to do anything when there's already a .cranges
@@ -91,13 +91,14 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
         .cranges section.  */
     }
 
-  if (command_line.relax)
+  if (RELAXATION_ENABLED)
     {
       LANG_FOR_EACH_INPUT_STATEMENT (f)
        {
          if (bfd_get_flavour (f->the_bfd) == bfd_target_elf_flavour)
            {
              asection *isec;
+
              for (isec = f->the_bfd->sections;
                   isec != NULL;
                   isec = isec->next)
@@ -107,7 +108,7 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
                    {
                      einfo (_("%P: Sorry, turning off relaxing: SHmedia sections present.\n"));
                      einfo ("  %I\n", f);
-                     command_line.relax = FALSE;
+                     DISABLE_RELAXATION;
                      goto done_scanning_shmedia_sections;
                    }
                }
index acc329098245b47407d6a9fa71fe50f68e79e5b7..0ae0d1c0d70b3ae1a95e964af3f33c463b7a88a4 100644 (file)
@@ -42,9 +42,6 @@ static void xtensa_strip_inconsistent_linkonce_sections
   (lang_statement_list_type *);
 
 
-/* Flag for the emulation-specific "--no-relax" option.  */
-static bfd_boolean disable_relaxation = FALSE;
-
 /* This number is irrelevant until we turn on use_literal_pages */
 static bfd_vma xtensa_page_power = 12; /* 4K pages.  */
 
@@ -527,16 +524,16 @@ elf_xtensa_before_allocation (void)
      specified.  This is done here instead of in the before_parse hook
      because there is a check in main() to prohibit use of --relax and
      -r together and that combination should be allowed for Xtensa.  */
-
-  if (!disable_relaxation)
-    command_line.relax = TRUE;
+  if (RELAXATION_DISABLED_BY_DEFAULT)
+    ENABLE_RELAXATION;
 
   xtensa_strip_inconsistent_linkonce_sections (stat_ptr);
 
   gld${EMULATION_NAME}_before_allocation ();
 
   xtensa_wild_group_interleave (stat_ptr->head);
-  if (command_line.relax)
+
+  if (RELAXATION_ENABLED)
     xtensa_colocate_output_literals (stat_ptr->head);
 
   /* TBD: We need to force the page alignments to here and only do
@@ -1983,8 +1980,7 @@ EOF
 #
 PARSE_AND_LIST_PROLOGUE='
 #define OPTION_OPT_SIZEOPT              (300)
-#define OPTION_NO_RELAX                        (OPTION_OPT_SIZEOPT + 1)
-#define OPTION_LITERAL_MOVEMENT                (OPTION_NO_RELAX + 1)
+#define OPTION_LITERAL_MOVEMENT                (OPTION_OPT_SIZEOPT + 1)
 #define OPTION_NO_LITERAL_MOVEMENT     (OPTION_LITERAL_MOVEMENT + 1)
 extern int elf32xtensa_size_opt;
 extern int elf32xtensa_no_literal_movement;
@@ -1992,7 +1988,6 @@ extern int elf32xtensa_no_literal_movement;
 
 PARSE_AND_LIST_LONGOPTS='
   { "size-opt", no_argument, NULL, OPTION_OPT_SIZEOPT},
-  { "no-relax", no_argument, NULL, OPTION_NO_RELAX},
   { "literal-movement", no_argument, NULL, OPTION_LITERAL_MOVEMENT},
   { "no-literal-movement", no_argument, NULL, OPTION_NO_LITERAL_MOVEMENT},
 '
@@ -2001,17 +1996,12 @@ PARSE_AND_LIST_OPTIONS='
   fprintf (file, _("\
   --size-opt                  When relaxing longcalls, prefer size\n\
                                 optimization over branch target alignment\n"));
-  fprintf (file, _("\
-  --no-relax                  Do not relax branches or coalesce literals\n"));
 '
 
 PARSE_AND_LIST_ARGS_CASES='
     case OPTION_OPT_SIZEOPT:
       elf32xtensa_size_opt = 1;
       break;
-    case OPTION_NO_RELAX:
-      disable_relaxation = TRUE;
-      break;
     case OPTION_LITERAL_MOVEMENT:
       elf32xtensa_no_literal_movement = 0;
       break;
diff --git a/ld/ld.h b/ld/ld.h
index 10d2b3382730e8ff7d871083ba6c69450c5e6bbf..aa0979d6f272ab9e7d895945b284bab743739686 100644 (file)
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -146,7 +146,29 @@ typedef struct {
 
   /* 1 => do not assign addresses to common symbols.  */
   bfd_boolean inhibit_common_definition;
-  bfd_boolean relax;
+
+  /* Enable or disable target specific optimizations.
+
+     Not all targets have optimizations to enable.
+
+     Normally these optimizations are disabled by default but some targets
+     prefer to enable them by default.  So this field is a tri-state variable.
+     The values are:
+     
+     zero: Enable the optimizations (either from --relax being specified on
+       the command line or the backend's before_allocation emulation function.
+       
+     positive: The user has requested that these optimizations be disabled.
+       (Via the --no-relax command line option).
+
+     negative: The optimizations are disabled.  (Set when initializing the
+       args_type structure in ldmain.c:main.  */
+  signed int disable_target_specific_optimizations;
+#define RELAXATION_DISABLED_BY_DEFAULT (command_line.disable_target_specific_optimizations < 0)
+#define RELAXATION_DISABLED_BY_USER    (command_line.disable_target_specific_optimizations > 0)
+#define RELAXATION_ENABLED (command_line.disable_target_specific_optimizations == 0)
+#define DISABLE_RELAXATION do { command_line.disable_target_specific_optimizations = 1; } while (0)
+#define ENABLE_RELAXATION  do { command_line.disable_target_specific_optimizations = 0; } while (0)
 
   /* If TRUE, build MIPS embedded PIC relocation tables in the output
      file.  */
index 8ac4c7d7d1f9b03058d057bc38639b812cfd9448..aa9a2239d09bffd11f97a0cd1b1b15e3f6a16708 100644 (file)
@@ -1563,7 +1563,9 @@ This option is ignored for SVR4 compatibility.
 @kindex --relax
 @cindex synthesizing linker
 @cindex relaxing addressing modes
+@cindex --no-relax
 @item --relax
+@itemx --no-relax
 An option with machine dependent effects.
 @ifset GENERIC
 This option is only supported on a few targets.
@@ -1584,16 +1586,17 @@ This option is only supported on a few targets.
 @xref{PowerPC ELF32,,@command{ld} and PowerPC 32-bit ELF Support}.
 @end ifset
 
-On some platforms, the @samp{--relax} option performs global
-optimizations that become possible when the linker resolves addressing
-in the program, such as relaxing address modes and synthesizing new
-instructions in the output object file.
+On some platforms the @samp{--relax} option performs target specific,
+global optimizations that become possible when the linker resolves
+addressing in the program, such as relaxing address modes,
+synthesizing new instructions, selecting shorter version of current
+instructions, and combinig constant values.
 
 On some platforms these link time global optimizations may make symbolic
 debugging of the resulting executable impossible.
 @ifset GENERIC
-This is known to be
-the case for the Matsushita MN10200 and MN10300 family of processors.
+This is known to be the case for the Matsushita MN10200 and MN10300
+family of processors.
 @end ifset
 
 @ifset GENERIC
@@ -1601,6 +1604,9 @@ On platforms where this is not supported, @samp{--relax} is accepted,
 but ignored.
 @end ifset
 
+On platforms where @samp{--relax} is accepted the option
+@samp{--no-relax} can be used to disable the feature.
+
 @cindex retaining specified symbols
 @cindex stripping all but some symbols
 @cindex symbols, retaining selectively
@@ -7146,12 +7152,6 @@ control the linker:
 
 @cindex Xtensa options
 @table @option
-@kindex --no-relax
-@item --no-relax
-Since the Xtensa version of @code{ld} enables the @option{--relax} option
-by default, the @option{--no-relax} option is provided to disable
-relaxation.
-
 @item --size-opt
 When optimizing indirect calls to direct calls, optimize for code size
 more than performance.  With this option, the linker will not insert
index 2d792f88c72716a063090be259c85a781ece99e6..019fe0ef48fd3e6ec9f05ba0586e70887b57e272 100644 (file)
@@ -6212,7 +6212,7 @@ lang_find_relro_sections (void)
 void
 lang_relax_sections (bfd_boolean need_layout)
 {
-  if (command_line.relax)
+  if (RELAXATION_ENABLED)
     {
       /* We may need more than one relaxation pass.  */
       int i = link_info.relax_pass;
@@ -6364,7 +6364,7 @@ lang_process (void)
     lang_find_relro_sections ();
 
   /* Size up the sections.  */
-  lang_size_sections (NULL, !command_line.relax);
+  lang_size_sections (NULL, ! RELAXATION_ENABLED);
 
   /* See if anything special should be done now we know how big
      everything is.  This is where relaxation is done.  */
index 3ba0592b78f1f3c7f82b1ef81e839e383e871f3b..e0917f66858926278319421916fb7b079619b1cd 100644 (file)
@@ -253,6 +253,7 @@ main (int argc, char **argv)
   command_line.warn_mismatch = TRUE;
   command_line.warn_search_mismatch = TRUE;
   command_line.check_section_addresses = -1;
+  command_line.disable_target_specific_optimizations = -1;
 
   /* We initialize DEMANGLING based on the environment variable
      COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
@@ -906,10 +907,10 @@ multiple_definition (struct bfd_link_info *info ATTRIBUTE_UNUSED,
   if (obfd != NULL)
     einfo (_("%D: first defined here\n"), obfd, osec, oval);
 
-  if (command_line.relax)
+  if (RELAXATION_ENABLED)
     {
       einfo (_("%P: Disabling relaxation: it will not work with multiple definitions\n"));
-      command_line.relax = 0;
+      command_line.disable_target_specific_optimizations = -1;
     }
 
   return TRUE;
index 71b426a59f97a0e1e14050a301afb571adc4fcf6..20aef7b8cee9aebc27053573b53f64bb9af04fef 100644 (file)
@@ -90,6 +90,7 @@ enum option_values
   OPTION_NO_WHOLE_ARCHIVE,
   OPTION_OFORMAT,
   OPTION_RELAX,
+  OPTION_NO_RELAX,
   OPTION_RETAIN_SYMBOLS_FILE,
   OPTION_RPATH,
   OPTION_RPATH_LINK,
@@ -479,7 +480,9 @@ static const struct ld_option ld_options[] =
     '\0', NULL, N_("Reduce memory overheads, possibly taking much longer"),
     TWO_DASHES },
   { {"relax", no_argument, NULL, OPTION_RELAX},
-    '\0', NULL, N_("Relax branches on certain targets"), TWO_DASHES },
+    '\0', NULL, N_("Reduce code size by using target specific optimizations"), TWO_DASHES },
+  { {"no-relax", no_argument, NULL, OPTION_NO_RELAX},
+    '\0', NULL, N_("Do not use relaxation techniques to reduce code size"), TWO_DASHES },
   { {"retain-symbols-file", required_argument, NULL,
      OPTION_RETAIN_SYMBOLS_FILE},
     '\0', N_("FILE"), N_("Keep only symbols listed in FILE"), TWO_DASHES },
@@ -1132,8 +1135,11 @@ parse_args (unsigned argc, char **argv)
              command_line.rpath_link = buf;
            }
          break;
+       case OPTION_NO_RELAX:
+         DISABLE_RELAXATION;
+         break;
        case OPTION_RELAX:
-         command_line.relax = TRUE;
+         ENABLE_RELAXATION;
          break;
        case OPTION_RETAIN_SYMBOLS_FILE:
          add_keepsyms_file (optarg);