mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 10:34:21 +08:00
nios2: recognize %gotoff relocation in assembler
The nios2 ABI documentation lists %gotoff as assembler syntax for the R_NIOS2_GOTOFF relocation, used to represent a 32-bit GOT-relative offset in data sections. This was previously unimplemented in GAS. 2020-01-31 Sandra Loosemore <sandra@codesourcery.com> gas/ * config/tc-nios2.c (nios2_cons): Handle %gotoff as well as %tls_ldo.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2020-01-31 Sandra Loosemore <sandra@codesourcery.com>
|
||||||
|
|
||||||
|
* config/tc-nios2.c (nios2_cons): Handle %gotoff as well as
|
||||||
|
%tls_ldo.
|
||||||
|
|
||||||
2020-01-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
|
2020-01-31 Andre Vieira <andre.simoesdiasvieira@arm.com>
|
||||||
|
|
||||||
PR gas/25472
|
PR gas/25472
|
||||||
|
@ -4011,31 +4011,48 @@ nios2_elf_section_flags (flagword flags, int attr, int type ATTRIBUTE_UNUSED)
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement TC_PARSE_CONS_EXPRESSION to handle %tls_ldo(...) */
|
/* Implement TC_PARSE_CONS_EXPRESSION to handle %tls_ldo(...) and
|
||||||
|
%gotoff(...). */
|
||||||
bfd_reloc_code_real_type
|
bfd_reloc_code_real_type
|
||||||
nios2_cons (expressionS *exp, int size)
|
nios2_cons (expressionS *exp, int size)
|
||||||
{
|
{
|
||||||
bfd_reloc_code_real_type nios2_tls_ldo_reloc = BFD_RELOC_NONE;
|
bfd_reloc_code_real_type explicit_reloc = BFD_RELOC_NONE;
|
||||||
|
const char *reloc_name = NULL;
|
||||||
|
|
||||||
SKIP_WHITESPACE ();
|
SKIP_WHITESPACE ();
|
||||||
if (input_line_pointer[0] == '%')
|
if (input_line_pointer[0] == '%')
|
||||||
{
|
{
|
||||||
if (strprefix (input_line_pointer + 1, "tls_ldo"))
|
if (strprefix (input_line_pointer + 1, "tls_ldo"))
|
||||||
{
|
{
|
||||||
|
reloc_name = "%tls_ldo";
|
||||||
if (size != 4)
|
if (size != 4)
|
||||||
as_bad (_("Illegal operands: %%tls_ldo in %d-byte data field"),
|
as_bad (_("Illegal operands: %%tls_ldo in %d-byte data field"),
|
||||||
size);
|
size);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
input_line_pointer += 8;
|
input_line_pointer += 8;
|
||||||
nios2_tls_ldo_reloc = BFD_RELOC_NIOS2_TLS_DTPREL;
|
explicit_reloc = BFD_RELOC_NIOS2_TLS_DTPREL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nios2_tls_ldo_reloc != BFD_RELOC_NONE)
|
else if (strprefix (input_line_pointer + 1, "gotoff"))
|
||||||
|
{
|
||||||
|
reloc_name = "%gotoff";
|
||||||
|
if (size != 4)
|
||||||
|
as_bad (_("Illegal operands: %%gotoff in %d-byte data field"),
|
||||||
|
size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
input_line_pointer += 7;
|
||||||
|
explicit_reloc = BFD_RELOC_NIOS2_GOTOFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (explicit_reloc != BFD_RELOC_NONE)
|
||||||
{
|
{
|
||||||
SKIP_WHITESPACE ();
|
SKIP_WHITESPACE ();
|
||||||
if (input_line_pointer[0] != '(')
|
if (input_line_pointer[0] != '(')
|
||||||
as_bad (_("Illegal operands: %%tls_ldo requires arguments in ()"));
|
as_bad (_("Illegal operands: %s requires arguments in ()"),
|
||||||
|
reloc_name);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
@ -4053,29 +4070,32 @@ nios2_cons (expressionS *exp, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (c != ')')
|
if (c != ')')
|
||||||
as_bad (_("Illegal operands: %%tls_ldo requires arguments in ()"));
|
as_bad (_("Illegal operands: %s requires arguments in ()"),
|
||||||
|
reloc_name);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
expression (exp);
|
expression (exp);
|
||||||
*end = c;
|
*end = c;
|
||||||
if (input_line_pointer != end)
|
if (input_line_pointer != end)
|
||||||
as_bad (_("Illegal operands: %%tls_ldo requires arguments in ()"));
|
as_bad (_("Illegal operands: %s requires arguments in ()"),
|
||||||
|
reloc_name);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
input_line_pointer++;
|
input_line_pointer++;
|
||||||
SKIP_WHITESPACE ();
|
SKIP_WHITESPACE ();
|
||||||
c = *input_line_pointer;
|
c = *input_line_pointer;
|
||||||
if (! is_end_of_line[c] && c != ',')
|
if (! is_end_of_line[c] && c != ',')
|
||||||
as_bad (_("Illegal operands: garbage after %%tls_ldo()"));
|
as_bad (_("Illegal operands: garbage after %s()"),
|
||||||
|
reloc_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nios2_tls_ldo_reloc == BFD_RELOC_NONE)
|
if (explicit_reloc == BFD_RELOC_NONE)
|
||||||
expression (exp);
|
expression (exp);
|
||||||
return nios2_tls_ldo_reloc;
|
return explicit_reloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement HANDLE_ALIGN. */
|
/* Implement HANDLE_ALIGN. */
|
||||||
|
Reference in New Issue
Block a user