Move disable_target_specific_optimizations to bfd_link_info
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 24 Oct 2012 11:09:28 +0000 (11:09 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 24 Oct 2012 11:09:28 +0000 (11:09 +0000)
include/

* bfdlink.h (bfd_link_info): Add
disable_target_specific_optimizations.

ld/

* ld.h (command_line): Remove
disable_target_specific_optimizations.
(RELAXATION_DISABLED_BY_DEFAULT): Removed.
(RELAXATION_DISABLED_BY_USER): Likewise.
(RELAXATION_ENABLED): Likewise.
(DISABLE_RELAXATION): Likewise.
(ENABLE_RELAXATION): Likewise.

* ldmain.c (main): Updated.

* ldmain.h (RELAXATION_DISABLED_BY_DEFAULT): New macro.
(RELAXATION_DISABLED_BY_USER): Likewise.
(RELAXATION_ENABLED): Likewise.
(DISABLE_RELAXATION): Likewise.
(ENABLE_RELAXATION): Likewise.

include/ChangeLog
include/bfdlink.h
ld/ChangeLog
ld/ld.h
ld/ldmain.c
ld/ldmain.h

index e4b1a2dc53d57f43b9511b2193579494e5f20c9e..d83ca9cdbd57ac85b17670736026ce939b490a7f 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * bfdlink.h (bfd_link_info): Add
+       disable_target_specific_optimizations.
+
 2012-10-23  Nathan Sidwell  <nathan@codesourcery.com>
 
        * bfdlink.h (struct bfd_link_info): Add stacksize option.
index 3ff1c92849c5d33a8a499ecb0eee4534cca67eb7..bf44dee82572992e4f34fa4df3119efacd299e78 100644 (file)
@@ -420,6 +420,24 @@ struct bfd_link_info
      means explicitly zero-sized.  */
   bfd_signed_vma stacksize;
 
+  /* 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;
+
   /* Function callbacks.  */
   const struct bfd_link_callbacks *callbacks;
 
index 870fe1a0b31afd347cf5dbedbf6f559c4be159f0..4c37e0130f6719cbcc54a9c218af302dd26127bc 100644 (file)
@@ -1,3 +1,21 @@
+2012-10-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ld.h (command_line): Remove
+       disable_target_specific_optimizations.
+       (RELAXATION_DISABLED_BY_DEFAULT): Removed.
+       (RELAXATION_DISABLED_BY_USER): Likewise.
+       (RELAXATION_ENABLED): Likewise.
+       (DISABLE_RELAXATION): Likewise.
+       (ENABLE_RELAXATION): Likewise.
+
+       * ldmain.c (main): Updated.
+
+       * ldmain.h (RELAXATION_DISABLED_BY_DEFAULT): New macro.
+       (RELAXATION_DISABLED_BY_USER): Likewise.
+       (RELAXATION_ENABLED): Likewise.
+       (DISABLE_RELAXATION): Likewise.
+       (ENABLE_RELAXATION): Likewise.
+
 2012-10-23  Nathan Sidwell  <nathan@codesourcery.com>
 
        * ld.texinfo (stack-size): New option.
diff --git a/ld/ld.h b/ld/ld.h
index b8273a42e6614cf731c0d1403a399d8536140ba6..d527885ab494f047e85fb68c2c0078fc891a1dfd 100644 (file)
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -149,29 +149,6 @@ typedef struct {
   /* 1 => do not assign addresses to common symbols.  */
   bfd_boolean inhibit_common_definition;
 
-  /* 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.  */
   bfd_boolean embedded_relocs;
index a784670ad89d4058b6a480b15a730ea87f73a199..3ba19b9fb47629ba51efa5705fad5d346be21cbb 100644 (file)
@@ -260,11 +260,11 @@ main (int argc, char **argv)
   config.make_executable = TRUE;
   config.magic_demand_paged = TRUE;
   config.text_read_only = TRUE;
+  link_info.disable_target_specific_optimizations = -1;
 
   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
@@ -954,7 +954,7 @@ multiple_definition (struct bfd_link_info *info,
   if (RELAXATION_ENABLED)
     {
       einfo (_("%P: Disabling relaxation: it will not work with multiple definitions\n"));
-      command_line.disable_target_specific_optimizations = -1;
+      link_info.disable_target_specific_optimizations = -1;
     }
 
   return TRUE;
index 4d6bb04000938093b7199b5019dc64084d90b357..69928f820793a1fdf81d3b8e65a1a2f84e2ee712 100644 (file)
@@ -39,6 +39,17 @@ extern const char *output_filename;
 extern struct bfd_link_info link_info;
 extern int overflow_cutoff_limit;
 
+#define RELAXATION_DISABLED_BY_DEFAULT \
+  (link_info.disable_target_specific_optimizations < 0)
+#define RELAXATION_DISABLED_BY_USER    \
+  (link_info.disable_target_specific_optimizations > 0)
+#define RELAXATION_ENABLED             \
+  (link_info.disable_target_specific_optimizations == 0)
+#define DISABLE_RELAXATION             \
+  do { link_info.disable_target_specific_optimizations = 1; } while (0)
+#define ENABLE_RELAXATION              \
+  do { link_info.disable_target_specific_optimizations = 0; } while (0)
+
 extern void add_ysym (const char *);
 extern void add_wrap (const char *);
 extern void add_ignoresym (struct bfd_link_info *, const char *);