aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1997-12-16 20:03:53 +0000
committerFred Fish <fnf@specifix.com>1997-12-16 20:03:53 +0000
commit37f82cb4dc3135b6d072b47348c6c108a8830c72 (patch)
treeb79a5e8f193a205b2cc5f1643655f7c2e4ef346a /gas/config
parent47d1c515b03b6ec4f1b3fd25dbceb6b680fca5a7 (diff)
downloadgdb-37f82cb4dc3135b6d072b47348c6c108a8830c72.zip
gdb-37f82cb4dc3135b6d072b47348c6c108a8830c72.tar.gz
gdb-37f82cb4dc3135b6d072b47348c6c108a8830c72.tar.bz2
* config/tc-tic80.c (tic80_relax): New static variable.
(md_longopts): Add new OPTION_RELAX and OPTION_NO_RELAX options. (md_parse_option): Handle new relax options. (md_show_usage): Document new relax options. (find_opcode): Don't use short forms of PC relative branches if tic80_relax is set. PR 12927
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-tic80.c43
1 files changed, 37 insertions, 6 deletions
diff --git a/gas/config/tc-tic80.c b/gas/config/tc-tic80.c
index b77681d..4f83395 100644
--- a/gas/config/tc-tic80.c
+++ b/gas/config/tc-tic80.c
@@ -75,6 +75,12 @@ static void build_insn PARAMS ((struct tic80_opcode *, expressionS *));
static int get_operands PARAMS ((expressionS exp[]));
static int const_overflow PARAMS ((unsigned long num, int bits, int flags));
+/* Replace short PC relative instructions with long form when necessary. Currently
+ this is off by default or when given the -no-relax option. Turning it on by using
+ the -relax option forces all PC relative instructions to use the long form, which
+ is why it is currently not the default. */
+static int tic80_relax = 0;
+
int
md_estimate_size_before_relax (fragP, segment_type)
@@ -393,16 +399,19 @@ find_opcode (opcode, myops)
}
break;
case O_symbol:
- if ((bits < 32) && (flags & TIC80_OPERAND_PCREL))
+ if ((bits < 32) && (flags & TIC80_OPERAND_PCREL) && !tic80_relax)
{
- /* For now we only allow PC relative relocations in the
- short immediate fields, like the TI assembler.
+ /* The default is to prefer the short form of PC relative relocations.
+ This is the only form that the TI assembler supports.
+ If the -relax option is given, we never use the short forms.
FIXME: Should be able to choose "best-fit". */
}
else if ((bits == 32) /* && (flags & TIC80_OPERAND_BASEREL) */)
{
- /* For now we only allow base relative relocations in
- the long immediate fields, like the TI assembler.
+ /* The default is to prefer the long form of base relative relocations.
+ This is the only form that the TI assembler supports.
+ If the -no-relax option is given, we always use the long form of
+ PC relative relocations.
FIXME: Should be able to choose "best-fit". */
}
else
@@ -896,6 +905,13 @@ CONST char *md_shortopts = "";
that are passed to getopt. */
struct option md_longopts[] = {
+
+#define OPTION_RELAX (OPTION_MD_BASE)
+ {"relax", no_argument, NULL, OPTION_RELAX},
+
+#define OPTION_NO_RELAX (OPTION_RELAX + 1)
+ {"no-relax", no_argument, NULL, OPTION_NO_RELAX},
+
{NULL, no_argument, NULL, 0}
};
@@ -910,7 +926,18 @@ md_parse_option (c, arg)
int c;
char *arg;
{
- return (0);
+ switch (c)
+ {
+ case OPTION_RELAX:
+ tic80_relax = 1;
+ break;
+ case OPTION_NO_RELAX:
+ tic80_relax = 0;
+ break;
+ default:
+ return (0);
+ }
+ return (1);
}
/* The md_show_usage function will be called whenever a usage message is
@@ -921,6 +948,10 @@ void
md_show_usage (stream)
FILE *stream;
{
+ fprintf (stream, "\
+TIc80 options:\n\
+-relax alter PC relative branch instructions to use long form when needed\n\
+-no-relax always use short PC relative branch instructions, error on overflow\n");
}