+2002-01-11 Steve Ellcey <sje@cup.hp.com>
+
+ * gas/config/tc-ia64.h (MD_FLAGS_DEFAULT): New Macro for
+ setting default md.flags.
+ (SHT_INIT_ARRAY): New elf special section used by HP-UX.
+ (SHT_FINI_ARRAY): New elf special section used by HP-UX.
+ * gas/config/tc-ia64.c (setup_unwind_header): Add support
+ for 32 bit unwind info blocks.
+ (generate_unwind_image): Add support for different types
+ of unwind images (32 bits and/or big-endian).
+ (ia64_init): Use MD_FLAGS_DEFAULT to set md.flags.
+ (ia64_target_format): Add support for hpux target formats.
+ (ia64_gen_real_reloc_type): Add support for FUNC_IPLT_RELOC.
+ (ia64_elf_section_type): Add support for SHT_INIT_ARRAY and
+ SHT_FINI_ARRAY elf section types.
+
2002-01-10 Richard Earnshaw <rearnsha@arm.com>
* tc-arm.c (struct reg_entry): Move before prototypes.
/* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture.
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of GAS, the GNU Assembler.
const char *str;
size_t len;
{
- len = sizeof (ELF_STRING_ia64_unwind_info) - 1;
- if (strncmp (str, ELF_STRING_ia64_unwind_info, len) == 0)
+#define STREQ(s) ((len == sizeof (s) - 1) && (strncmp (str, s, sizeof (s) - 1) == 0))
+
+ if (STREQ (ELF_STRING_ia64_unwind_info))
return SHT_PROGBITS;
- len = sizeof (ELF_STRING_ia64_unwind_info_once) - 1;
- if (strncmp (str, ELF_STRING_ia64_unwind_info_once, len) == 0)
+ if (STREQ (ELF_STRING_ia64_unwind_info_once))
return SHT_PROGBITS;
- len = sizeof (ELF_STRING_ia64_unwind) - 1;
- if (strncmp (str, ELF_STRING_ia64_unwind, len) == 0)
+ if (STREQ (ELF_STRING_ia64_unwind))
return SHT_IA_64_UNWIND;
- len = sizeof (ELF_STRING_ia64_unwind_once) - 1;
- if (strncmp (str, ELF_STRING_ia64_unwind_once, len) == 0)
+ if (STREQ (ELF_STRING_ia64_unwind_once))
return SHT_IA_64_UNWIND;
+ if (STREQ ("init_array"))
+ return SHT_INIT_ARRAY;
+
+ if (STREQ ("fini_array"))
+ return SHT_FINI_ARRAY;
+
return -1;
+#undef STREQ
}
static unsigned int
setup_unwind_header (int size, unsigned char **mem)
{
int x, extra = 0;
+ valueT flag_value;
/* pad to pointer-size boundry. */
x = size % md.pointer_size;
/* Clear the padding area and personality. */
memset (*mem + 8 + size, 0 , extra + md.pointer_size);
+
/* Initialize the header area. */
+ if (unwind.personality_routine)
+ {
+ if (md.flags & EF_IA_64_ABI64)
+ flag_value = (bfd_vma) 3 << 32;
+ else
+ /* 32-bit unwind info block. */
+ flag_value = (bfd_vma) 0x1003 << 32;
+ }
+ else
+ flag_value = 0;
- md_number_to_chars (*mem, (((bfd_vma) 1 << 48) /* version */
- | (unwind.personality_routine
- ? ((bfd_vma) 3 << 32) /* U & E handler flags */
- : 0)
- | ((size + extra) / md.pointer_size)), /* length */
+ md_number_to_chars (*mem, (((bfd_vma) 1 << 48) /* Version. */
+ | flag_value /* U & E handler flags. */
+ | ((size + extra) / md.pointer_size)), /* Length. */
8);
return extra;
unsigned char *where;
char *sec_name;
expressionS exp;
+ bfd_reloc_code_real_type reloc;
make_unw_section_name (SPECIAL_SECTION_UNWIND_INFO, text_name, sec_name);
set_section (sec_name);
exp.X_op = O_symbol;
exp.X_add_symbol = unwind.personality_routine;
exp.X_add_number = 0;
- fix_new_exp (frag_now, frag_now_fix () - 8, 8,
- &exp, 0, BFD_RELOC_IA64_LTOFF_FPTR64LSB);
+
+ if (md.flags & EF_IA_64_BE)
+ {
+ if (md.flags & EF_IA_64_ABI64)
+ reloc = BFD_RELOC_IA64_LTOFF_FPTR64MSB;
+ else
+ reloc = BFD_RELOC_IA64_LTOFF_FPTR32MSB;
+ }
+ else
+ {
+ if (md.flags & EF_IA_64_ABI64)
+ reloc = BFD_RELOC_IA64_LTOFF_FPTR64LSB;
+ else
+ reloc = BFD_RELOC_IA64_LTOFF_FPTR32LSB;
+ }
+
+ fix_new_exp (frag_now, frag_now_fix () - md.pointer_size,
+ md.pointer_size, & exp, 0, reloc);
unwind.personality_routine = 0;
}
}
int argc ATTRIBUTE_UNUSED;
char **argv ATTRIBUTE_UNUSED;
{
- md.flags = EF_IA_64_ABI64;
- if (TARGET_BYTES_BIG_ENDIAN)
- md.flags |= EF_IA_64_BE;
+ md.flags = MD_FLAGS_DEFAULT;
}
/* Return a string for the target object file format. */
if (md.flags & EF_IA_64_BE)
{
if (md.flags & EF_IA_64_ABI64)
-#ifdef TE_AIX50
+#if defined(TE_AIX50)
return "elf64-ia64-aix-big";
+#elif defined(TE_HPUX)
+ return "elf64-ia64-hpux-big";
#else
return "elf64-ia64-big";
#endif
else
-#ifdef TE_AIX50
+#if defined(TE_AIX50)
return "elf32-ia64-aix-big";
+#elif defined(TE_HPUX)
+ return "elf32-ia64-hpux-big";
#else
return "elf32-ia64-big";
#endif
}
break;
+ case FUNC_IPLT_RELOC:
+ break;
+
default:
abort ();
}
/* tc-ia64.h -- Header file for tc-ia64.c.
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of GAS, the GNU Assembler.
#ifdef TE_HPUX
#define md_number_to_chars number_to_chars_bigendian
#define TARGET_BYTES_BIG_ENDIAN 1
+#define MD_FLAGS_DEFAULT EF_IA_64_BE
#else
#define md_number_to_chars number_to_chars_littleendian
#define TARGET_BYTES_BIG_ENDIAN 0
+#define MD_FLAGS_DEFAULT EF_IA_64_ABI64
#endif /* TE_HPUX */
/* We need to set the default object file format in ia64_init and not in
#define WORKING_DOT_WORD /* don't do broken word processing for now */
#define ELF_TC_SPECIAL_SECTIONS \
+{ ".init_array",SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, \
+{ ".fini_array",SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, \
{ ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, \
{ ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },