mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-01 06:14:47 +08:00
* config/tc-hppa.c (md_apply_fix): Delete old wrapper function.
(md_apply_fix_1): Rename to md_apply_fix. Fix argument decls. Fix comments in various places. Always return a value. Avoid dereferencing a NULL fx_addsy. (hppa_force_relocation): Avoid dereferencing a NULL fx_addsy.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
Fri Dec 3 10:56:40 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
|
||||||
|
|
||||||
|
* config/tc-hppa.c (md_apply_fix): Delete old wrapper function.
|
||||||
|
(md_apply_fix_1): Rename to md_apply_fix. Fix argument decls.
|
||||||
|
Fix comments in various places. Always return a value.
|
||||||
|
Avoid dereferencing a NULL fx_addsy.
|
||||||
|
(hppa_force_relocation): Avoid dereferencing a NULL fx_addsy.
|
||||||
|
|
||||||
Thu Dec 2 11:52:21 1993 Ken Raeburn (raeburn@cygnus.com)
|
Thu Dec 2 11:52:21 1993 Ken Raeburn (raeburn@cygnus.com)
|
||||||
|
|
||||||
* config/tc-sparc.c (tc_gen_reloc): Make adjustment to addend be
|
* config/tc-sparc.c (tc_gen_reloc): Make adjustment to addend be
|
||||||
|
@ -610,7 +610,6 @@ static void fix_new_hppa PARAMS ((fragS *, int, short int, symbolS *,
|
|||||||
bfd_reloc_code_real_type,
|
bfd_reloc_code_real_type,
|
||||||
enum hppa_reloc_field_selector_type,
|
enum hppa_reloc_field_selector_type,
|
||||||
int, long, char *));
|
int, long, char *));
|
||||||
static void md_apply_fix_1 PARAMS ((fixS *, long));
|
|
||||||
static int is_end_of_statement PARAMS ((void));
|
static int is_end_of_statement PARAMS ((void));
|
||||||
static int reg_name_search PARAMS ((char *));
|
static int reg_name_search PARAMS ((char *));
|
||||||
static int pa_chk_field_selector PARAMS ((char **));
|
static int pa_chk_field_selector PARAMS ((char **));
|
||||||
@ -2989,28 +2988,25 @@ md_operand (expressionP)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function for md_apply_fix. Actually determine if the fix
|
/* Apply a fixup to an instruction. */
|
||||||
can be applied, and if so, apply it.
|
|
||||||
|
|
||||||
If a fix is applied, then set fx_addsy to NULL which indicates
|
int
|
||||||
the fix was applied and need not be emitted into the object file. */
|
md_apply_fix (fixP, valp)
|
||||||
|
|
||||||
static void
|
|
||||||
md_apply_fix_1 (fixP, val)
|
|
||||||
fixS *fixP;
|
fixS *fixP;
|
||||||
long val;
|
valueT *valp;
|
||||||
{
|
{
|
||||||
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
|
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
|
||||||
struct hppa_fix_struct *hppa_fixP = fixP->tc_fix_data;
|
struct hppa_fix_struct *hppa_fixP = fixP->tc_fix_data;
|
||||||
long new_val, result;
|
long new_val, result;
|
||||||
unsigned int w1, w2, w;
|
unsigned int w1, w2, w;
|
||||||
|
valueT val = *valp;
|
||||||
|
|
||||||
/* SOM uses R_HPPA_ENTRY and R_HPPA_EXIT relocations which can
|
/* SOM uses R_HPPA_ENTRY and R_HPPA_EXIT relocations which can
|
||||||
never be "applied". They must always be emitted. */
|
never be "applied" (they are just markers). */
|
||||||
#ifdef OBJ_SOM
|
#ifdef OBJ_SOM
|
||||||
if (fixP->fx_r_type == R_HPPA_ENTRY
|
if (fixP->fx_r_type == R_HPPA_ENTRY
|
||||||
|| fixP->fx_r_type == R_HPPA_EXIT)
|
|| fixP->fx_r_type == R_HPPA_EXIT)
|
||||||
return;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* There should have been an HPPA specific fixup associated
|
/* There should have been an HPPA specific fixup associated
|
||||||
@ -3032,8 +3028,9 @@ md_apply_fix_1 (fixP, val)
|
|||||||
if ((fixP->fx_addsy && fixP->fx_addsy->bsym->section == &bfd_und_section)
|
if ((fixP->fx_addsy && fixP->fx_addsy->bsym->section == &bfd_und_section)
|
||||||
|| (fixP->fx_subsy
|
|| (fixP->fx_subsy
|
||||||
&& fixP->fx_subsy->bsym->section == &bfd_und_section))
|
&& fixP->fx_subsy->bsym->section == &bfd_und_section))
|
||||||
return;
|
return 1;
|
||||||
|
|
||||||
|
/* PLABEL field selectors should not be passed to hppa_field_adjust. */
|
||||||
if (fmt != 0 && hppa_fixP->fx_r_field != R_HPPA_PSEL
|
if (fmt != 0 && hppa_fixP->fx_r_field != R_HPPA_PSEL
|
||||||
&& hppa_fixP->fx_r_field != R_HPPA_LPSEL
|
&& hppa_fixP->fx_r_field != R_HPPA_LPSEL
|
||||||
&& hppa_fixP->fx_r_field != R_HPPA_RPSEL)
|
&& hppa_fixP->fx_r_field != R_HPPA_RPSEL)
|
||||||
@ -3090,21 +3087,22 @@ md_apply_fix_1 (fixP, val)
|
|||||||
result = ((w1 << 2) | w);
|
result = ((w1 << 2) | w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#define stub_needed(CALLER, CALLEE) \
|
|
||||||
((CALLEE) && (CALLER) && ((CALLEE) != (CALLER)))
|
|
||||||
|
|
||||||
/* Handle some of the opcodes with the 'W' operand type. */
|
/* Handle some of the opcodes with the 'W' operand type. */
|
||||||
case 17:
|
case 17:
|
||||||
/* If a long-call stub or argument relocation stub is
|
|
||||||
needed, then we can not apply this relocation, instead
|
|
||||||
the linker must handle it. */
|
|
||||||
if (new_val > 262143 || new_val < -262144
|
|
||||||
|| stub_needed (((obj_symbol_type *)
|
|
||||||
fixP->fx_addsy->bsym)->tc_data.hppa_arg_reloc,
|
|
||||||
hppa_fixP->fx_arg_reloc))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* No stubs were needed, we can perform this relocation. */
|
#define stub_needed(CALLER, CALLEE) \
|
||||||
|
((CALLEE) && (CALLER) && ((CALLEE) != (CALLER)))
|
||||||
|
/* It is necessary to force PC-relative calls/jumps to have a
|
||||||
|
relocation entry if they're going to need either a argument
|
||||||
|
relocation or long call stub. FIXME. Can't we need the same
|
||||||
|
for absolute calls? */
|
||||||
|
if (fixP->fx_addsy
|
||||||
|
&& (stub_needed (((obj_symbol_type *)
|
||||||
|
fixP->fx_addsy->bsym)->tc_data.hppa_arg_reloc,
|
||||||
|
hppa_fixP->fx_arg_reloc)))
|
||||||
|
return 1;
|
||||||
|
#undef stub_needed
|
||||||
|
|
||||||
CHECK_FIELD (new_val, 262143, -262144, 0);
|
CHECK_FIELD (new_val, 262143, -262144, 0);
|
||||||
|
|
||||||
/* Mask off 17 bits to be changed. */
|
/* Mask off 17 bits to be changed. */
|
||||||
@ -3116,9 +3114,6 @@ md_apply_fix_1 (fixP, val)
|
|||||||
result = ((w2 << 2) | (w1 << 16) | w);
|
result = ((w2 << 2) | (w1 << 16) | w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#undef too_far
|
|
||||||
#undef stub_needed
|
|
||||||
|
|
||||||
case 32:
|
case 32:
|
||||||
#ifdef OBJ_ELF
|
#ifdef OBJ_ELF
|
||||||
/* These are ELF specific relocations. ELF unfortunately
|
/* These are ELF specific relocations. ELF unfortunately
|
||||||
@ -3132,35 +3127,28 @@ md_apply_fix_1 (fixP, val)
|
|||||||
result = 0;
|
result = 0;
|
||||||
fixP->fx_addnumber = fixP->fx_offset;
|
fixP->fx_addnumber = fixP->fx_offset;
|
||||||
bfd_put_32 (stdoutput, 0, buf);
|
bfd_put_32 (stdoutput, 0, buf);
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
return;
|
return 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
as_bad ("Unknown relocation encountered in md_apply_fix.");
|
as_bad ("Unknown relocation encountered in md_apply_fix.");
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the relocation. */
|
/* Insert the relocation. */
|
||||||
bfd_put_32 (stdoutput, bfd_get_32 (stdoutput, buf) | result, buf);
|
bfd_put_32 (stdoutput, bfd_get_32 (stdoutput, buf) | result, buf);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf ("no hppa_fixup entry for this fixup (fixP = 0x%x, type = 0x%x)\n",
|
{
|
||||||
(unsigned int) fixP, fixP->fx_r_type);
|
printf ("no hppa_fixup entry for this fixup (fixP = 0x%x, type = 0x%x)\n",
|
||||||
}
|
(unsigned int) fixP, fixP->fx_r_type);
|
||||||
|
return 0;
|
||||||
/* Apply a fix into a frag's data (if possible). */
|
}
|
||||||
|
|
||||||
int
|
|
||||||
md_apply_fix (fixP, valp)
|
|
||||||
fixS *fixP;
|
|
||||||
valueT *valp;
|
|
||||||
{
|
|
||||||
md_apply_fix_1 (fixP, (long) *valp);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Exactly what point is a PC-relative offset relative TO?
|
/* Exactly what point is a PC-relative offset relative TO?
|
||||||
@ -6319,7 +6307,7 @@ hppa_force_relocation (fixp)
|
|||||||
/* It is necessary to force PC-relative calls/jumps to have a relocation
|
/* It is necessary to force PC-relative calls/jumps to have a relocation
|
||||||
entry if they're going to need either a argument relocation or long
|
entry if they're going to need either a argument relocation or long
|
||||||
call stub. FIXME. Can't we need the same for absolute calls? */
|
call stub. FIXME. Can't we need the same for absolute calls? */
|
||||||
if (fixp->fx_pcrel
|
if (fixp->fx_pcrel && fixp->fx_addsy
|
||||||
&& (stub_needed (((obj_symbol_type *)
|
&& (stub_needed (((obj_symbol_type *)
|
||||||
fixp->fx_addsy->bsym)->tc_data.hppa_arg_reloc,
|
fixp->fx_addsy->bsym)->tc_data.hppa_arg_reloc,
|
||||||
hppa_fixp->fx_arg_reloc)))
|
hppa_fixp->fx_arg_reloc)))
|
||||||
|
Reference in New Issue
Block a user