Fix PR 17042 - Do not attempt to resolve offsets to symbols in other sections

at assembly time.
This commit is contained in:
Nick Clifton
1998-09-30 18:12:57 +00:00
parent 40dac6318f
commit b481c113bb
3 changed files with 74 additions and 52 deletions

View File

@ -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

View File

@ -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;
@ -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,6 +1446,8 @@ md_begin ()
bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
/* start-sanitize-v850e */
applicable = bfd_applicable_section_flags (stdoutput);
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
@ -1450,12 +1455,12 @@ md_begin ()
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));
applicable & (SEC_ALLOC | SEC_LOAD | SEC_READONLY
| SEC_CODE));
/* Restore text section as the current default. */
subseg_set (text_section, 0);
/* end-sanitize-v850e */
}
@ -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;
}
@ -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;
}

View File

@ -20,6 +20,8 @@
#define TC_V850
#include <elf/v850.h>
#define TARGET_BYTES_BIG_ENDIAN 0
#ifndef BFD_ASSEMBLER
@ -65,14 +67,16 @@ extern const struct relax_type md_relax_table[];
{ ".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 }, \
{ ".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_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \
{ ".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_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 ();