+Mon Jul 3 15:58:16 1995 Jeff Law (law@snake.cs.utah.edu)
+
+ * config/tc-hppa.h (MAX_RELOC_EXPANSION): Bump to 6.
+ * config/tc-hppa.c (tc_gen_reloc, SOM version): Handle
+ relocations for the difference of two (possibly external)
+ symbols.
+ (hppa_fix_adjustable): For SOM, reject reductions involving
+ the difference of two symbols.
+ (hppa_force_relocation): Force relocations for expressions
+ involving the difference of two symbols.
+
Mon Jul 3 14:22:59 1995 Steve Chamberlain <sac@slash.cygnus.com>
* configure[.in] (i386-*-win32): New host and target.
codes = (bfd_reloc_code_real_type **) hppa_gen_reloc_type (stdoutput,
fixp->fx_r_type,
hppa_fixp->fx_r_format,
- hppa_fixp->fx_r_field);
+ hppa_fixp->fx_r_field,
+ fixp->fx_subsy != NULL);
for (n_relocs = 0; codes[n_relocs]; n_relocs++)
;
switch (code)
{
+ case R_COMP2:
+ /* The only time we ever use a R_COMP2 fixup is for the difference
+ of two symbols. With that in mind we fill in all four
+ relocs now and break out of the loop. */
+ assert (i == 1);
+ relocs[0]->sym_ptr_ptr = &bfd_abs_symbol;
+ relocs[0]->howto = bfd_reloc_type_lookup (stdoutput, *codes[0]);
+ relocs[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ relocs[0]->addend = 0;
+ relocs[0]->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+ relocs[1]->howto = bfd_reloc_type_lookup (stdoutput, *codes[1]);
+ relocs[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ relocs[1]->addend = 0;
+ relocs[2]->sym_ptr_ptr = &fixp->fx_subsy->bsym;
+ relocs[2]->howto = bfd_reloc_type_lookup (stdoutput, *codes[2]);
+ relocs[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ relocs[2]->addend = 0;
+ relocs[3]->sym_ptr_ptr = &bfd_abs_symbol;
+ relocs[3]->howto = bfd_reloc_type_lookup (stdoutput, *codes[3]);
+ relocs[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ relocs[3]->addend = 0;
+ relocs[4]->sym_ptr_ptr = &bfd_abs_symbol;
+ relocs[4]->howto = bfd_reloc_type_lookup (stdoutput, *codes[4]);
+ relocs[4]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ relocs[4]->addend = 0;
+ goto done;
case R_PCREL_CALL:
case R_ABS_CALL:
relocs[i]->addend = HPPA_R_ADDEND (hppa_fixp->fx_arg_reloc, 0);
}
#endif
+done:
return relocs;
}
/* Get some space to hold relocation information for the unwind
descriptor. */
p = frag_more (4);
- md_number_to_chars (p, 0.opcode, 4);
+ md_number_to_chars (p, 0, 4);
/* Relocation info. for start offset of the function. */
fix_new_hppa (frag_now, p - frag_now->fr_literal, 4,
(expressionS *) NULL, 0, R_PARISC_DIR32, e_fsel, 32, 0, NULL);
p = frag_more (4);
- md_number_to_chars (p, 0.opcode, 4);
+ md_number_to_chars (p, 0, 4);
/* Relocation info. for end offset of the function.
/* Reject reductions of symbols in 32bit relocs. */
if (fixp->fx_r_type == R_HPPA && hppa_fix->fx_r_format == 32)
return 0;
+
+ /* Reject reductions of symbols in sym1-sym2 expressions when
+ the fixup will occur in a CODE subspace.
+
+ XXX FIXME: Long term we probably want to reject all of these;
+ for example reducing in the debug section would lose if we ever
+ supported using the optimizing hp linker. */
+ if (fixp->fx_addsy
+ && fixp->fx_subsy
+ && (hppa_fix->segment->flags & SEC_CODE))
+ {
+ /* Apparently sy_used_in_reloc never gets set for sub symbols. */
+ fixp->fx_subsy->sy_used_in_reloc = 1;
+ return 0;
+ }
#endif
/* Reject reductions of symbols in DLT relative relocs,
hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data;
#ifdef OBJ_SOM
- if (fixp->fx_r_type == R_HPPA_ENTRY || fixp->fx_r_type == R_HPPA_EXIT)
+ if (fixp->fx_r_type == R_HPPA_ENTRY || fixp->fx_r_type == R_HPPA_EXIT
+ || (fixp->fx_addsy != NULL && fixp->fx_subsy != NULL
+ && (hppa_fixp->segment->flags & SEC_CODE) != 0))
return 1;
#endif
/* FIXME. The lack of a place to put things which are both target cpu
and target format dependent makes hacks like this necessary. */
#ifdef OBJ_ELF
-#include "../bfd/elf32-hppa.h"
+#include "bfd/elf32-hppa.h"
#define TARGET_FORMAT "elf32-hppa"
#endif
#ifdef OBJ_SOM
-#include "../bfd/som.h"
+#include "bfd/som.h"
#define TARGET_FORMAT "som"
#endif
/* Labels are not required to have a colon for a suffix. */
#define LABELS_WITHOUT_COLONS
-extern void hppa_tc_make_sections PARAMS ((bfd *));
-extern void hppa_tc_symbol PARAMS ((bfd *, elf_symbol_type *, int));
-
/* FIXME. This should be static and declared in tc-hppa.c, but
pa_define_label gets used outside of tc-hppa.c via tc_frob_label.
Should also be PARAMized, but symbolS isn't available here. */
extern void cons_fix_new_hppa ();
extern int hppa_force_relocation ();
+/* This gets called before writing the object file to make sure
+ things like entry/exit and proc/procend pairs match. */
+extern void pa_check_eof PARAMS ((void));
+#define tc_frob_file pa_check_eof
+
#define tc_frob_label(sym) pa_define_label (sym)
/* The PA does not need support for either of these. */
#define tc_headers_hook(headers) {;}
#define RELOC_EXPANSION_POSSIBLE
-#define MAX_RELOC_EXPANSION 5
+#define MAX_RELOC_EXPANSION 6
/* FIXME. More things which are both HPPA and ELF specific. There is
nowhere to put such things. */
#ifdef OBJ_ELF
-#define elf_tc_symbol hppa_tc_symbol
-#define elf_tc_make_sections hppa_tc_make_sections
#define elf_tc_final_processing elf_hppa_final_processing
+void elf_hppa_final_processing PARAMS ((void));
#endif
/* The PA needs to parse field selectors in .byte, etc. */
normally appear safe to handle it completely within GAS. */
#define TC_FORCE_RELOCATION(FIXP) hppa_force_relocation (FIXP)
+#ifdef OBJ_SOM
/* If a symbol is imported, but never used, then the symbol should
*not* end up in the symbol table. Likewise for absolute symbols
with local scope. */
|| (S_GET_SEGMENT (sym) == &bfd_abs_section \
&& (sym->bsym->flags & BSF_EXPORT) == 0)) \
punt = 1
+#endif
+
+#ifdef OBJ_ELF
+/* Arggg. The generic BFD ELF code always adds in the section->vma
+ to non-common symbols. This is a lose on the PA. To make matters
+ worse, the generic ELF code already defined obj_frob_symbol. */
+#define tc_frob_symbol(sym,punt) \
+ { \
+ if (S_GET_SEGMENT (sym) != &bfd_com_section \
+ && S_GET_SEGMENT (sym) != &bfd_und_section) \
+ S_SET_VALUE ((sym), (S_GET_VALUE (sym) - (sym)->bsym->section->vma)); \
+ if ((S_GET_SEGMENT (sym) == &bfd_und_section && sym->sy_used == 0) \
+ || (S_GET_SEGMENT (sym) == &bfd_abs_section \
+ && (sym->bsym->flags & BSF_EXPORT) == 0)) \
+ punt = 1; \
+ }
+#endif
+
+#define md_operand(x)
#endif /* _TC_HPPA_H */