This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PING: PATCH: Move disable_target_specific_optimizations to bfd_link_info
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Mon, 17 Sep 2012 14:19:21 -0700
- Subject: PING: PATCH: Move disable_target_specific_optimizations to bfd_link_info
On Sun, Sep 2, 2012 at 8:51 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> This patch moves to disable_target_specific_optimizations to
> bfd_link_info so that a user can inform a backend to disable
> target specific optimizations. OK to install?
>
> Thanks.
>
>
> H.J.
> ---
> include/
>
> 2012-09-02 H.J. Lu <hongjiu.lu@intel.com>
>
> * bfdlink.h (bfd_link_info): Add
> disable_target_specific_optimizations.
>
> ld/
>
> 2012-09-02 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.
>
> diff --git a/include/bfdlink.h b/include/bfdlink.h
> index d900b47..daa9dff 100644
> --- a/include/bfdlink.h
> +++ b/include/bfdlink.h
> @@ -416,6 +416,24 @@ struct bfd_link_info
> /* Separator between archive and filename in linker script filespecs. */
> char path_separator;
>
> + /* 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;
>
> diff --git a/ld/ld.h b/ld/ld.h
> index b8273a4..d527885 100644
> --- 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;
> diff --git a/ld/ldmain.c b/ld/ldmain.c
> index 15f8ebf..b2c4589 100644
> --- a/ld/ldmain.c
> +++ b/ld/ldmain.c
> @@ -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
> @@ -937,7 +937,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;
> diff --git a/ld/ldmain.h b/ld/ldmain.h
> index 8363833..0f5430a 100644
> --- a/ld/ldmain.h
> +++ b/ld/ldmain.h
> @@ -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_keepsyms_file (const char *);
Ping.
--
H.J.