mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 19:50:13 +08:00
Fix PR 17042 - Do not attempt to resolve offsets to symbols in other sections
at assembly time.
This commit is contained in:
@ -1,3 +1,12 @@
|
||||
Wed Sep 30 10:52:32 1998 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* config/tc-v850.c (md_pcrel_from): Rename to
|
||||
v850_pcrel_from_section.
|
||||
(v850_pcrel_from_section): Do not resolves symbols in other
|
||||
sections.
|
||||
|
||||
* config/tc-v850.h (MD_PCREL_FROM_SECTION): Define.
|
||||
|
||||
Mon Sep 28 11:01:20 1998 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* config/tc-d10v.c (find_opcode): Generate an error if a register
|
||||
|
@ -269,7 +269,7 @@ v850_comm (area)
|
||||
return;
|
||||
}
|
||||
|
||||
input_line_pointer++; /* skip ',' */
|
||||
input_line_pointer ++; /* skip ',' */
|
||||
|
||||
if ((temp = get_absolute_expression ()) < 0)
|
||||
{
|
||||
@ -319,6 +319,7 @@ v850_comm (area)
|
||||
else
|
||||
{
|
||||
temp = get_absolute_expression ();
|
||||
|
||||
if (temp < 0)
|
||||
{
|
||||
temp = 0;
|
||||
@ -748,6 +749,8 @@ reg_name_search (regs, regcount, name, accept_numbers)
|
||||
if (reg >= 0 && reg <= 31)
|
||||
return reg;
|
||||
}
|
||||
|
||||
/* Otherwise drop through and try parsing name normally. */
|
||||
}
|
||||
|
||||
low = 0;
|
||||
@ -1019,11 +1022,11 @@ parse_register_list
|
||||
case 0xfff8000f: regs = type2_regs; break;
|
||||
case 0xfff8001f: regs = type3_regs; break;
|
||||
default:
|
||||
as_bad (_("unknown operand shift: %x\n"), operand->shift );
|
||||
as_bad (_("unknown operand shift: %x\n"), operand->shift);
|
||||
return _("internal failure in parse_register_list");
|
||||
}
|
||||
|
||||
skip_white_space();
|
||||
skip_white_space ();
|
||||
|
||||
/* If the expression starts with a curly brace it is a register list.
|
||||
Otherwise it is a constant expression, whoes bits indicate which
|
||||
@ -1355,8 +1358,8 @@ md_convert_frag (abfd, sec, fragP)
|
||||
target. */
|
||||
md_number_to_chars (buffer + 2, 0x00000780, 4);
|
||||
fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
|
||||
fragP->fr_offset, 1, BFD_RELOC_UNUSED + (int) fragP->fr_opcode
|
||||
+ 1);
|
||||
fragP->fr_offset, 1, BFD_RELOC_UNUSED +
|
||||
(int) fragP->fr_opcode + 1);
|
||||
fragP->fr_var = 0;
|
||||
fragP->fr_fix += 6;
|
||||
}
|
||||
@ -1365,8 +1368,8 @@ md_convert_frag (abfd, sec, fragP)
|
||||
{
|
||||
md_number_to_chars (fragP->fr_fix + fragP->fr_literal, 0x00000780, 4);
|
||||
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
|
||||
fragP->fr_offset, 1, BFD_RELOC_UNUSED + (int) fragP->fr_opcode
|
||||
+ 1);
|
||||
fragP->fr_offset, 1, BFD_RELOC_UNUSED +
|
||||
(int) fragP->fr_opcode + 1);
|
||||
fragP->fr_var = 0;
|
||||
fragP->fr_fix += 4;
|
||||
}
|
||||
@ -1443,19 +1446,21 @@ md_begin ()
|
||||
bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
|
||||
|
||||
/* start-sanitize-v850e */
|
||||
call_table_data_section = subseg_new (".call_table_data", 0);
|
||||
bfd_set_section_flags (stdoutput, call_table_data_section,
|
||||
applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
|
||||
| SEC_DATA | SEC_HAS_CONTENTS));
|
||||
applicable = bfd_applicable_section_flags (stdoutput);
|
||||
|
||||
call_table_text_section = subseg_new (".call_table_text", 0);
|
||||
bfd_set_section_flags (stdoutput, call_table_text_section,
|
||||
applicable & (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE));
|
||||
call_table_data_section = subseg_new (".call_table_data", 0);
|
||||
bfd_set_section_flags (stdoutput, call_table_data_section,
|
||||
applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
|
||||
| SEC_DATA | SEC_HAS_CONTENTS));
|
||||
|
||||
/* Restore text section as the current default. */
|
||||
subseg_set (text_section, 0);
|
||||
/* end-sanitize-v850e */
|
||||
call_table_text_section = subseg_new (".call_table_text", 0);
|
||||
bfd_set_section_flags (stdoutput, call_table_text_section,
|
||||
applicable & (SEC_ALLOC | SEC_LOAD | SEC_READONLY
|
||||
| SEC_CODE));
|
||||
|
||||
/* Restore text section as the current default. */
|
||||
subseg_set (text_section, 0);
|
||||
/* end-sanitize-v850e */
|
||||
}
|
||||
|
||||
|
||||
@ -1857,13 +1862,13 @@ md_assemble (str)
|
||||
break;
|
||||
}
|
||||
|
||||
if (fc > MAX_INSN_FIXUPS)
|
||||
as_fatal (_("too many fixups"));
|
||||
if (fc > MAX_INSN_FIXUPS)
|
||||
as_fatal (_("too many fixups"));
|
||||
|
||||
fixups[ fc ].exp = ex;
|
||||
fixups[ fc ].opindex = * opindex_ptr;
|
||||
fixups[ fc ].reloc = reloc;
|
||||
fc++;
|
||||
fixups[ fc ].exp = ex;
|
||||
fixups[ fc ].opindex = * opindex_ptr;
|
||||
fixups[ fc ].reloc = reloc;
|
||||
fc++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1941,8 +1946,7 @@ md_assemble (str)
|
||||
str = input_line_pointer;
|
||||
input_line_pointer = hold;
|
||||
|
||||
while ( *str == ' ' || *str == ',' || *str == '['
|
||||
|| *str == ']')
|
||||
while (*str == ' ' || *str == ',' || *str == '[' || *str == ']')
|
||||
++ str;
|
||||
continue;
|
||||
}
|
||||
@ -2012,7 +2016,7 @@ md_assemble (str)
|
||||
|
||||
input_line_pointer = str;
|
||||
|
||||
c = get_symbol_end();
|
||||
c = get_symbol_end ();
|
||||
|
||||
if (symbol_find (str) != NULL)
|
||||
exists = 1;
|
||||
@ -2251,7 +2255,7 @@ md_assemble (str)
|
||||
/* XXX This will abort on an R_V850_8 reloc -
|
||||
is this reloc actually used ? */
|
||||
if (size != 2 && size != 4)
|
||||
abort();
|
||||
abort ();
|
||||
|
||||
address = (f - frag_now->fr_literal) + insn_size - size;
|
||||
|
||||
@ -2311,7 +2315,7 @@ tc_gen_reloc (seg, fixp)
|
||||
as_bad_where (fixp->fx_file, fixp->fx_line,
|
||||
/* xgettext:c-format */
|
||||
_("reloc %d not supported by object file format"),
|
||||
(int)fixp->fx_r_type);
|
||||
(int) fixp->fx_r_type);
|
||||
|
||||
xfree (reloc);
|
||||
|
||||
@ -2339,16 +2343,21 @@ md_estimate_size_before_relax (fragp, seg)
|
||||
}
|
||||
|
||||
long
|
||||
md_pcrel_from (fixp)
|
||||
v850_pcrel_from_section (fixp, section)
|
||||
fixS * fixp;
|
||||
segT section;
|
||||
{
|
||||
/* If the symbol is undefined, or in a section other than our own,
|
||||
then let the linker figure it out. */
|
||||
if (fixp->fx_addsy != (symbolS *) NULL && ! S_IS_DEFINED (fixp->fx_addsy))
|
||||
if (fixp->fx_addsy != (symbolS *) NULL
|
||||
&& (! S_IS_DEFINED (fixp->fx_addsy)
|
||||
|| (S_GET_SEGMENT (fixp->fx_addsy) != section)))
|
||||
{
|
||||
/* The symbol is undefined. Let the linker figure it out. */
|
||||
/* The symbol is undefined/not in our section.
|
||||
Let the linker figure it out. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fixp->fx_frag->fr_address + fixp->fx_where;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#define TC_V850
|
||||
|
||||
#include <elf/v850.h>
|
||||
|
||||
#define TARGET_BYTES_BIG_ENDIAN 0
|
||||
|
||||
#ifndef BFD_ASSEMBLER
|
||||
@ -62,17 +64,19 @@ extern const struct relax_type md_relax_table[];
|
||||
#define SHF_V850_R0REL 0x40000000
|
||||
|
||||
#define ELF_TC_SPECIAL_SECTIONS \
|
||||
{ ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, \
|
||||
{ ".rosdata", SHT_PROGBITS, SHF_ALLOC + SHF_V850_GPREL }, \
|
||||
{ ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, \
|
||||
{ ".scommon", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, \
|
||||
{ ".tdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, \
|
||||
{ ".tbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, \
|
||||
{ ".tcommon", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \
|
||||
{ ".zdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \
|
||||
{ ".rozdata", SHT_PROGBITS, SHF_ALLOC + SHF_V850_R0REL }, \
|
||||
{ ".zbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \
|
||||
{ ".zcommon", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \
|
||||
{ ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, \
|
||||
{ ".rosdata", SHT_PROGBITS, SHF_ALLOC + SHF_V850_GPREL }, \
|
||||
{ ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, \
|
||||
{ ".scommon", SHT_V850_SCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, \
|
||||
{ ".tdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, \
|
||||
{ ".tbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, \
|
||||
{ ".tcommon", SHT_V850_TCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \
|
||||
{ ".zdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \
|
||||
{ ".rozdata", SHT_PROGBITS, SHF_ALLOC + SHF_V850_R0REL }, \
|
||||
{ ".zbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \
|
||||
{ ".zcommon", SHT_V850_ZCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \
|
||||
{ ".call_table_data", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
|
||||
{ ".call_table_text", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_EXECINSTR },
|
||||
|
||||
#define MD_PCREL_FROM_SECTION(fixP,section) v850_pcrel_from_section (fixP, section)
|
||||
extern long v850_pcrel_from_section ();
|
||||
|
Reference in New Issue
Block a user