Add support for ia64-hpux target.

This commit is contained in:
Nick Clifton
2002-01-11 09:27:39 +00:00
parent 1951c6f7f8
commit 1cd8ff3882
3 changed files with 80 additions and 23 deletions

View File

@ -1,3 +1,19 @@
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> 2002-01-10 Richard Earnshaw <rearnsha@arm.com>
* tc-arm.c (struct reg_entry): Move before prototypes. * tc-arm.c (struct reg_entry): Move before prototypes.

View File

@ -1,5 +1,5 @@
/* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture. /* 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> Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -950,23 +950,28 @@ ia64_elf_section_type (str, len)
const char *str; const char *str;
size_t len; size_t len;
{ {
len = sizeof (ELF_STRING_ia64_unwind_info) - 1; #define STREQ(s) ((len == sizeof (s) - 1) && (strncmp (str, s, sizeof (s) - 1) == 0))
if (strncmp (str, ELF_STRING_ia64_unwind_info, len) == 0)
if (STREQ (ELF_STRING_ia64_unwind_info))
return SHT_PROGBITS; return SHT_PROGBITS;
len = sizeof (ELF_STRING_ia64_unwind_info_once) - 1; if (STREQ (ELF_STRING_ia64_unwind_info_once))
if (strncmp (str, ELF_STRING_ia64_unwind_info_once, len) == 0)
return SHT_PROGBITS; return SHT_PROGBITS;
len = sizeof (ELF_STRING_ia64_unwind) - 1; if (STREQ (ELF_STRING_ia64_unwind))
if (strncmp (str, ELF_STRING_ia64_unwind, len) == 0)
return SHT_IA_64_UNWIND; return SHT_IA_64_UNWIND;
len = sizeof (ELF_STRING_ia64_unwind_once) - 1; if (STREQ (ELF_STRING_ia64_unwind_once))
if (strncmp (str, ELF_STRING_ia64_unwind_once, len) == 0)
return SHT_IA_64_UNWIND; return SHT_IA_64_UNWIND;
if (STREQ ("init_array"))
return SHT_INIT_ARRAY;
if (STREQ ("fini_array"))
return SHT_FINI_ARRAY;
return -1; return -1;
#undef STREQ
} }
static unsigned int static unsigned int
@ -2791,6 +2796,7 @@ static int
setup_unwind_header (int size, unsigned char **mem) setup_unwind_header (int size, unsigned char **mem)
{ {
int x, extra = 0; int x, extra = 0;
valueT flag_value;
/* pad to pointer-size boundry. */ /* pad to pointer-size boundry. */
x = size % md.pointer_size; x = size % md.pointer_size;
@ -2803,13 +2809,22 @@ setup_unwind_header (int size, unsigned char **mem)
/* Clear the padding area and personality. */ /* Clear the padding area and personality. */
memset (*mem + 8 + size, 0 , extra + md.pointer_size); memset (*mem + 8 + size, 0 , extra + md.pointer_size);
/* Initialize the header area. */
md_number_to_chars (*mem, (((bfd_vma) 1 << 48) /* version */ /* Initialize the header area. */
| (unwind.personality_routine if (unwind.personality_routine)
? ((bfd_vma) 3 << 32) /* U & E handler flags */ {
: 0) if (md.flags & EF_IA_64_ABI64)
| ((size + extra) / md.pointer_size)), /* length */ 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. */
| flag_value /* U & E handler flags. */
| ((size + extra) / md.pointer_size)), /* Length. */
8); 8);
return extra; return extra;
@ -3220,6 +3235,7 @@ generate_unwind_image (text_name)
unsigned char *where; unsigned char *where;
char *sec_name; char *sec_name;
expressionS exp; expressionS exp;
bfd_reloc_code_real_type reloc;
make_unw_section_name (SPECIAL_SECTION_UNWIND_INFO, text_name, sec_name); make_unw_section_name (SPECIAL_SECTION_UNWIND_INFO, text_name, sec_name);
set_section (sec_name); set_section (sec_name);
@ -3249,8 +3265,24 @@ generate_unwind_image (text_name)
exp.X_op = O_symbol; exp.X_op = O_symbol;
exp.X_add_symbol = unwind.personality_routine; exp.X_add_symbol = unwind.personality_routine;
exp.X_add_number = 0; 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; unwind.personality_routine = 0;
} }
} }
@ -6614,9 +6646,7 @@ ia64_init (argc, argv)
int argc ATTRIBUTE_UNUSED; int argc ATTRIBUTE_UNUSED;
char **argv ATTRIBUTE_UNUSED; char **argv ATTRIBUTE_UNUSED;
{ {
md.flags = EF_IA_64_ABI64; md.flags = MD_FLAGS_DEFAULT;
if (TARGET_BYTES_BIG_ENDIAN)
md.flags |= EF_IA_64_BE;
} }
/* Return a string for the target object file format. */ /* Return a string for the target object file format. */
@ -6629,14 +6659,18 @@ ia64_target_format ()
if (md.flags & EF_IA_64_BE) if (md.flags & EF_IA_64_BE)
{ {
if (md.flags & EF_IA_64_ABI64) if (md.flags & EF_IA_64_ABI64)
#ifdef TE_AIX50 #if defined(TE_AIX50)
return "elf64-ia64-aix-big"; return "elf64-ia64-aix-big";
#elif defined(TE_HPUX)
return "elf64-ia64-hpux-big";
#else #else
return "elf64-ia64-big"; return "elf64-ia64-big";
#endif #endif
else else
#ifdef TE_AIX50 #if defined(TE_AIX50)
return "elf32-ia64-aix-big"; return "elf32-ia64-aix-big";
#elif defined(TE_HPUX)
return "elf32-ia64-hpux-big";
#else #else
return "elf32-ia64-big"; return "elf32-ia64-big";
#endif #endif
@ -10024,6 +10058,9 @@ ia64_gen_real_reloc_type (sym, r_type)
} }
break; break;
case FUNC_IPLT_RELOC:
break;
default: default:
abort (); abort ();
} }

View File

@ -1,5 +1,5 @@
/* tc-ia64.h -- Header file for tc-ia64.c. /* 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> Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of GAS, the GNU Assembler. This file is part of GAS, the GNU Assembler.
@ -28,9 +28,11 @@
#ifdef TE_HPUX #ifdef TE_HPUX
#define md_number_to_chars number_to_chars_bigendian #define md_number_to_chars number_to_chars_bigendian
#define TARGET_BYTES_BIG_ENDIAN 1 #define TARGET_BYTES_BIG_ENDIAN 1
#define MD_FLAGS_DEFAULT EF_IA_64_BE
#else #else
#define md_number_to_chars number_to_chars_littleendian #define md_number_to_chars number_to_chars_littleendian
#define TARGET_BYTES_BIG_ENDIAN 0 #define TARGET_BYTES_BIG_ENDIAN 0
#define MD_FLAGS_DEFAULT EF_IA_64_ABI64
#endif /* TE_HPUX */ #endif /* TE_HPUX */
/* We need to set the default object file format in ia64_init and not in /* We need to set the default object file format in ia64_init and not in
@ -122,6 +124,8 @@ extern void ia64_after_parse_args PARAMS ((void));
#define WORKING_DOT_WORD /* don't do broken word processing for now */ #define WORKING_DOT_WORD /* don't do broken word processing for now */
#define ELF_TC_SPECIAL_SECTIONS \ #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 }, \ { ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, \
{ ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },