* tc-h8300.c (tc_gen_reloc): Give an error if we try to take the

address of two symbols in different sections.
This commit is contained in:
Jeff Law
2001-09-05 02:01:08 +00:00
parent 9ea0568f79
commit de342d07b9
2 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Tue Sep 4 20:01:19 2001 Jeffrey A Law (law@cygnus.com)
* tc-h8300.c (tc_gen_reloc): Give an error if we try to take the
address of two symbols in different sections.
2001-08-31 Eric Christopher <echristo@redhat.com> 2001-08-31 Eric Christopher <echristo@redhat.com>
Jason Eckhardt <jle@redhat.com> Jason Eckhardt <jle@redhat.com>

View File

@ -1147,9 +1147,8 @@ build_bytes (this_try, operand)
want the relocation's offset to point to the first byte want the relocation's offset to point to the first byte
that will be modified, not to the start of the instruction. */ that will be modified, not to the start of the instruction. */
where += 1; where += 1;
#endif #endif
/* This jmp may be a jump or a branch. */ /* This jmp may be a jump or a branch. */
check_operand (operand + i, Hmode ? 0xffffff : 0xffff, "@"); check_operand (operand + i, Hmode ? 0xffffff : 0xffff, "@");
@ -1624,6 +1623,17 @@ tc_gen_reloc (section, fixp)
arelent *rel; arelent *rel;
bfd_reloc_code_real_type r_type; bfd_reloc_code_real_type r_type;
if (fixp->fx_addsy && fixp->fx_subsy)
{
if ((S_GET_SEGMENT (fixp->fx_addsy) != S_GET_SEGMENT (fixp->fx_subsy))
|| S_GET_SEGMENT (fixp->fx_addsy) == undefined_section)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
"Difference of symbols in different sections is not supported");
return NULL;
}
}
rel = (arelent *) xmalloc (sizeof (arelent)); rel = (arelent *) xmalloc (sizeof (arelent));
rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);