aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-11-26 13:45:25 +0000
committerNick Clifton <nickc@redhat.com>2009-11-26 13:45:25 +0000
commit28d5f6774058f4c7d5141b1dda8b76ee81f8cf4f (patch)
treed2a5b9ce35ec5ae61d04c98564ff51460d3ec818 /ld/emultempl
parentf1b9c60a8f8a6471f328fd1e1744c8592f63dd59 (diff)
downloadgdb-28d5f6774058f4c7d5141b1dda8b76ee81f8cf4f.zip
gdb-28d5f6774058f4c7d5141b1dda8b76ee81f8cf4f.tar.gz
gdb-28d5f6774058f4c7d5141b1dda8b76ee81f8cf4f.tar.bz2
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.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/alphaelf.em13
-rw-r--r--ld/emultempl/avrelf.em2
-rw-r--r--ld/emultempl/cr16elf.em29
-rw-r--r--ld/emultempl/crxelf.em29
-rw-r--r--ld/emultempl/mmix-elfnmmo.em2
-rw-r--r--ld/emultempl/needrelax.em2
-rw-r--r--ld/emultempl/ppc32elf.em4
-rw-r--r--ld/emultempl/sh64elf.em9
-rw-r--r--ld/emultempl/xtensaelf.em20
9 files changed, 22 insertions, 88 deletions
diff --git a/ld/emultempl/alphaelf.em b/ld/emultempl/alphaelf.em
index 864e699..7b7c8d7 100644
--- a/ld/emultempl/alphaelf.em
+++ b/ld/emultempl/alphaelf.em
@@ -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;
diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em
index f0807dd..84f1633 100644
--- a/ld/emultempl/avrelf.em
+++ b/ld/emultempl/avrelf.em
@@ -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. */
diff --git a/ld/emultempl/cr16elf.em b/ld/emultempl/cr16elf.em
index 83f0783..9850bda 100644
--- a/ld/emultempl/cr16elf.em
+++ b/ld/emultempl/cr16elf.em
@@ -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
diff --git a/ld/emultempl/crxelf.em b/ld/emultempl/crxelf.em
index a257c06..c6d5a8d 100644
--- a/ld/emultempl/crxelf.em
+++ b/ld/emultempl/crxelf.em
@@ -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
diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em
index 6a7b295..0059792 100644
--- a/ld/emultempl/mmix-elfnmmo.em
+++ b/ld/emultempl/mmix-elfnmmo.em
@@ -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",
diff --git a/ld/emultempl/needrelax.em b/ld/emultempl/needrelax.em
index 4c475db..7f90224 100644
--- a/ld/emultempl/needrelax.em
+++ b/ld/emultempl/needrelax.em
@@ -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
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index 3befe75..9ff81f5 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -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;
}
}
diff --git a/ld/emultempl/sh64elf.em b/ld/emultempl/sh64elf.em
index 0c5dc4e..88035b0 100644
--- a/ld/emultempl/sh64elf.em
+++ b/ld/emultempl/sh64elf.em
@@ -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;
}
}
diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em
index acc3290..0ae0d1c 100644
--- a/ld/emultempl/xtensaelf.em
+++ b/ld/emultempl/xtensaelf.em
@@ -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;