This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH AIX5.0 for IA64 support
- To: binutils at sources dot redhat dot com
- Subject: PATCH AIX5.0 for IA64 support
- From: Timothy Wall <twall at oculustech dot com>
- Date: Tue, 20 Feb 2001 17:08:06 -0500
- Organization: Oculus Technologies
- Reply-To: twall at oculustech dot com
This patch adds BFD support for AIX5.0 on IA-64.
Index: bfd/config.bfd
===================================================================
RCS file: /cvs/src/src/bfd/config.bfd,v
retrieving revision 1.52
diff -d -c -p -b -w -r1.52 config.bfd
*** config.bfd 2001/02/19 06:33:41 1.52
--- config.bfd 2001/02/20 21:53:28
*************** case "${targ}" in
*** 86,91 ****
--- 86,95 ----
alpha*-*-*)
targ_defvec=ecoffalpha_little_vec
;;
+ ia64*-*-aix*)
+ targ_defvec=bfd_elf64_ia64_aix_little_vec
+ targ_selvecs="bfd_elf64_ia64_aix_big_vec bfd_efi_app_ia64_vec"
+ ;;
ia64*-*-freebsd* | ia64*-*-linux-gnu* | ia64*-*-elf*)
targ_defvec=bfd_elf64_ia64_little_vec
targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
Index: bfd/configure
===================================================================
RCS file: /cvs/src/src/bfd/configure,v
retrieving revision 1.58
diff -d -c -p -b -w -r1.58 configure
*** configure 2001/02/19 06:33:41 1.58
--- configure 2001/02/20 21:53:33
*************** do
*** 5945,5950 ****
--- 5945,5955 ----
target64=true ;;
bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
target64=true ;;
+ bfd_elf64_ia64_aix_little_vec)
+ tb="$tb elf64-ia64.lo elf64.lo $elf"
+ target64=true ;;
+ bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
+ target64=true ;;
bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
Index: bfd/configure.host
===================================================================
RCS file: /cvs/src/src/bfd/configure.host,v
retrieving revision 1.4
diff -d -c -p -b -w -r1.4 configure.host
*** configure.host 2000/07/25 19:29:42 1.4
--- configure.host 2001/02/20 21:53:33
*************** hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;
*** 28,33 ****
--- 28,34 ----
hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
ia64-*-linux*) host64=true; HOST_64BIT_TYPE=long ;;
+ ia64-*-aix*) host64=true; HOST_64BIT_TYPE=long ;;
i[3456]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
i[3456]86-sequent-sysv4*) ;;
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.44
diff -d -c -p -b -w -r1.44 configure.in
*** configure.in 2001/02/19 06:33:41 1.44
--- configure.in 2001/02/20 21:53:33
*************** do
*** 496,501 ****
--- 496,506 ----
target64=true ;;
bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
target64=true ;;
+ bfd_elf64_ia64_aix_little_vec)
+ tb="$tb elf64-ia64.lo elf64.lo $elf"
+ target64=true ;;
+ bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
+ target64=true ;;
bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.12
diff -d -c -p -b -w -r1.12 elfxx-ia64.c
*** elfxx-ia64.c 2001/02/13 23:08:09 1.12
--- elfxx-ia64.c 2001/02/20 21:53:36
*************** static boolean elfNN_ia64_add_symbol_hoo
*** 169,174 ****
--- 169,182 ----
PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym,
const char **namep, flagword *flagsp, asection **secp,
bfd_vma *valp));
+ static boolean elfNN_ia64_aix_vec
+ PARAMS ((const bfd_target *vec));
+ static boolean elfNN_ia64_aix_add_symbol_hook
+ PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym,
+ const char **namep, flagword *flagsp, asection **secp,
+ bfd_vma *valp));
+ static boolean elfNN_ia64_aix_link_add_symbols
+ PARAMS ((bfd *abfd, struct bfd_link_info *info));
static int elfNN_ia64_additional_program_headers
PARAMS ((bfd *abfd));
static boolean elfNN_ia64_is_local_label_name
*************** static const bfd_byte plt_full_entry[PLT
*** 558,563 ****
--- 566,574 ----
};
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+ #define AIX_DYNAMIC_INTERPRETER "/usr/lib/ia64l64/libc.so.1"
+ #define DYNAMIC_INTERPRETER(abfd) \
+ (elfNN_ia64_aix_vec (abfd->xvec) ? AIX_DYNAMIC_INTERPRETER : ELF_DYNAMIC_INTERPRETER)
/* Select out of range branch fixup type. Note that Itanium does
not support brl, and so it gets emulated by the kernel. */
*************** elfNN_ia64_add_symbol_hook (abfd, info,
*** 1111,1116 ****
--- 1122,1245 ----
return true;
}
+ static boolean
+ elfNN_ia64_aix_vec (const bfd_target *vec)
+ {
+ extern const bfd_target bfd_elfNN_ia64_aix_little_vec;
+ extern const bfd_target bfd_elfNN_ia64_aix_big_vec;
+
+ return (/**/vec == & bfd_elfNN_ia64_aix_little_vec
+ || vec == & bfd_elfNN_ia64_aix_big_vec);
+ }
+
+ /* Hook called by the linker routine which adds symbols from an object
+ file. We use it to handle OS-specific symbols. */
+
+ static boolean
+ elfNN_ia64_aix_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ const Elf_Internal_Sym *sym;
+ const char **namep;
+ flagword *flagsp;
+ asection **secp;
+ bfd_vma *valp;
+ {
+ if (strcmp (*namep, "__GLOB_DATA_PTR") == 0)
+ {
+ /* Define __GLOB_DATA_PTR. This is expected to be a linker-defined
+ symbol by the Aix C runtime startup code. Define the symbol
+ when it is encountered. IBM sez no one else should use it b/c it is
+ undocumented. */
+ struct elf_link_hash_entry *h;
+
+ h = (struct elf_link_hash_entry *) bfd_link_hash_lookup (info->hash, *namep, false, false, false);
+ if (h == NULL)
+ {
+ struct elf_backend_data *bed;
+ struct elfNN_ia64_link_hash_table *ia64_info;
+
+ bed = get_elf_backend_data (abfd);
+ ia64_info = elfNN_ia64_hash_table (info);
+
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, *namep, BSF_GLOBAL, ia64_info->got_sec,
+ bed->got_symbol_offset, (const char *) NULL, false,
+ bed->collect, (struct bfd_link_hash_entry **) &h)))
+ return false;
+
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->type = STT_OBJECT;
+
+ if (info->shared
+ && ! _bfd_elf_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ return true;
+ }
+ else if (sym->st_shndx == SHN_LOOS)
+ {
+ int i;
+
+ /* SHN_MONTEREY_SYSCALL (Description from IBM):
+ Special symbols on AIX; if the value is non-zero, the value
+ should be put in the gp member of the function descriptor. the
+ function address member should be set to the address of the entry
+ point of the user-space portion of the system call (epc insn in a
+ priviledged page). If the symbol value is zero, look in the special
+ table for extended system calls. The number for extended system
+ calls will come from that table. The index is set when the linker
+ sees an export file that contains the syscall attribute after an
+ exported symbol. Kernel extensions indicate extended system calls
+ they define by having STO_MONTEREY_SYSCALL in their st_other symbol
+ table member. This is used by the system loader to add extended
+ system calls to its table, which is subsequently provided to the
+ runtime linker at each process startup. */
+ for (i = 1; i < elf_elfheader (abfd)->e_shnum; i++)
+ {
+ asection * sec = bfd_section_from_elf_index (abfd, i);
+
+ if (sec && strcmp (sec->name, ".text") == 0)
+ {
+ *secp = sec;
+ break;
+ }
+ }
+
+ /* FIXME need to determine the proper section instead of defaulting to
+ .text. */
+ if (*secp == NULL)
+ *secp = bfd_abs_section_ptr;
+
+ *valp = sym->st_size;
+
+ return true;
+ }
+ else
+ {
+ return elfNN_ia64_add_symbol_hook (abfd, info, sym,
+ namep, flagsp, secp, valp);
+ }
+ }
+
+ boolean
+ elfNN_ia64_aix_link_add_symbols (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ {
+ /* Make sure dynamic sections are always created. */
+ if (! elf_hash_table (info)->dynamic_sections_created
+ && abfd->xvec == info->hash->creator)
+ {
+ if (! bfd_elfNN_link_create_dynamic_sections (abfd, info))
+ return false;
+ }
+
+ /* Now do the standard call. */
+ return bfd_elfNN_bfd_link_add_symbols (abfd, info);
+ }
+
/* Return the number of additional phdrs we will need. */
static int
*************** elfNN_ia64_check_relocs (abfd, info, sec
*** 1861,1867 ****
maybe_dynamic = false;
if (h && ((info->shared && ! info->symbolic)
|| ! (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
! || h->root.type == bfd_link_hash_defweak))
maybe_dynamic = true;
need_entry = 0;
--- 1990,1997 ----
maybe_dynamic = false;
if (h && ((info->shared && ! info->symbolic)
|| ! (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
! || h->root.type == bfd_link_hash_defweak
! || elfNN_ia64_aix_vec (abfd->xvec)))
maybe_dynamic = true;
need_entry = 0;
*************** elfNN_ia64_check_relocs (abfd, info, sec
*** 1885,1891 ****
case R_IA64_FPTR32LSB:
case R_IA64_FPTR64MSB:
case R_IA64_FPTR64LSB:
! if (info->shared || h)
need_entry = NEED_FPTR | NEED_DYNREL;
else
need_entry = NEED_FPTR;
--- 2015,2023 ----
case R_IA64_FPTR32LSB:
case R_IA64_FPTR64MSB:
case R_IA64_FPTR64LSB:
! if (elfNN_ia64_aix_vec (abfd->xvec))
! need_entry = NEED_FPTR | NEED_DYNREL;
! else if (info->shared || h)
need_entry = NEED_FPTR | NEED_DYNREL;
else
need_entry = NEED_FPTR;
*************** elfNN_ia64_check_relocs (abfd, info, sec
*** 1934,1940 ****
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Shared objects will always need at least a REL relocation. */
! if (info->shared || maybe_dynamic)
need_entry = NEED_DYNREL;
dynrel_type = R_IA64_DIR64LSB;
break;
--- 2066,2077 ----
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Shared objects will always need at least a REL relocation. */
! if (info->shared || maybe_dynamic
! /* On AIX, we always need a relocation, but make sure
! __GLOB_DATA_PTR doesn't get an entry. */
! || (elfNN_ia64_aix_vec (abfd->xvec)
! && (!h || strcmp (h->root.root.string,
! "__GLOB_DATA_PTR") != 0)))
need_entry = NEED_DYNREL;
dynrel_type = R_IA64_DIR64LSB;
break;
*************** elfNN_ia64_check_relocs (abfd, info, sec
*** 1998,2004 ****
/* FPTRs for shared libraries are allocated by the dynamic
linker. Make sure this local symbol will appear in the
dynamic symbol table. */
! if (!h && info->shared)
{
if (! (_bfd_elfNN_link_record_local_dynamic_symbol
(info, abfd, r_symndx)))
--- 2135,2143 ----
/* FPTRs for shared libraries are allocated by the dynamic
linker. Make sure this local symbol will appear in the
dynamic symbol table. */
! if (!h && (info->shared
! /* AIX also needs one */
! || elfNN_ia64_aix_vec (abfd->xvec)))
{
if (! (_bfd_elfNN_link_record_local_dynamic_symbol
(info, abfd, r_symndx)))
*************** allocate_global_data_got (dyn_i, data)
*** 2054,2060 ****
if (dyn_i->want_got
&& ! dyn_i->want_fptr
! && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
--- 2193,2200 ----
if (dyn_i->want_got
&& ! dyn_i->want_fptr
! && (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
! || elfNN_ia64_aix_vec (x->info->hash->creator)))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
*************** allocate_global_fptr_got (dyn_i, data)
*** 2073,2079 ****
if (dyn_i->want_got
&& dyn_i->want_fptr
! && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
--- 2213,2220 ----
if (dyn_i->want_got
&& dyn_i->want_fptr
! && (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
! || elfNN_ia64_aix_vec (x->info->hash->creator)))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
*************** allocate_local_got (dyn_i, data)
*** 2091,2097 ****
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
if (dyn_i->want_got
! && ! elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
--- 2232,2239 ----
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
if (dyn_i->want_got
! && ! (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
! || elfNN_ia64_aix_vec (x->info->hash->creator)))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
*************** allocate_fptr (dyn_i, data)
*** 2137,2143 ****
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
! if (x->info->shared)
{
if (h && h->dynindx == -1)
{
--- 2279,2290 ----
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
! if (x->info->shared
! /* AIX needs an FPTR in this case. */
! || (elfNN_ia64_aix_vec (x->info->hash->creator)
! && (!h
! || h->root.type == bfd_link_hash_defined
! || h->root.type == bfd_link_hash_defweak)))
{
if (h && h->dynindx == -1)
{
*************** allocate_dynrel_entries (dyn_i, data)
*** 2260,2266 ****
boolean dynamic_symbol, shared;
ia64_info = elfNN_ia64_hash_table (x->info);
! dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info);
shared = x->info->shared;
/* Take care of the normal data relocations. */
--- 2407,2414 ----
boolean dynamic_symbol, shared;
ia64_info = elfNN_ia64_hash_table (x->info);
! dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
! || elfNN_ia64_aix_vec (x->info->hash->creator);
shared = x->info->shared;
/* Take care of the normal data relocations. */
*************** elfNN_ia64_size_dynamic_sections (output
*** 2377,2384 ****
{
sec = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (sec != NULL);
! sec->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
! sec->_raw_size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
}
/* Allocate the GOT entries. */
--- 2525,2532 ----
{
sec = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (sec != NULL);
! sec->contents = (bfd_byte *) DYNAMIC_INTERPRETER (output_bfd);
! sec->_raw_size = strlen (DYNAMIC_INTERPRETER (output_bfd)) + 1;
}
/* Allocate the GOT entries. */
*************** set_got_entry (abfd, info, dyn_i, dynind
*** 2884,2889 ****
--- 3032,3038 ----
/* Install a dynamic relocation if needed. */
if (info->shared
|| elfNN_ia64_dynamic_symbol_p (dyn_i->h, info)
+ || elfNN_ia64_aix_vec (abfd->xvec)
|| (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB))
{
if (dynindx == -1)
*************** elfNN_ia64_relocate_section (output_bfd,
*** 3373,3379 ****
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Install a dynamic relocation for this reloc. */
! if ((dynamic_symbol_p || info->shared)
&& (input_section->flags & SEC_ALLOC) != 0)
{
unsigned int dyn_r_type;
--- 3522,3534 ----
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Install a dynamic relocation for this reloc. */
! if ((dynamic_symbol_p || info->shared
! || (elfNN_ia64_aix_vec (info->hash->creator)
! /* We want REL relocation for _GLOB_DATA_PTR, which would
! otherwise be an IMM64, which isn't handled below. The
! symbol comes from the C runtime. */
! && (!h ||
! strcmp (h->root.root.string, "__GLOB_DATA_PTR") != 0)))
&& (input_section->flags & SEC_ALLOC) != 0)
{
unsigned int dyn_r_type;
*************** elfNN_ia64_relocate_section (output_bfd,
*** 3425,3430 ****
--- 3580,3587 ----
addend = value;
}
+ if (elfNN_ia64_aix_vec (info->hash->creator))
+ rel->r_addend = value;
elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
srel, rel->r_offset, dyn_r_type,
dynindx, addend);
*************** elfNN_ia64_relocate_section (output_bfd,
*** 3564,3570 ****
case R_IA64_PCREL64MSB:
case R_IA64_PCREL64LSB:
/* Install a dynamic relocation for this reloc. */
! if (dynamic_symbol_p)
{
BFD_ASSERT (srel != NULL);
--- 3721,3728 ----
case R_IA64_PCREL64MSB:
case R_IA64_PCREL64LSB:
/* Install a dynamic relocation for this reloc. */
! if (dynamic_symbol_p
! || elfNN_ia64_aix_vec (info->hash->creator))
{
BFD_ASSERT (srel != NULL);
*************** elfNN_ia64_print_private_bfd_data (abfd,
*** 4216,4220 ****
--- 4374,4399 ----
#define elf_backend_want_dynbss 0
#define elf_backend_copy_indirect_symbol elfNN_ia64_hash_copy_indirect
#define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol
+
+ #include "elfNN-target.h"
+
+ /* AIX-specific vectors. */
+
+ #undef TARGET_LITTLE_SYM
+ #define TARGET_LITTLE_SYM bfd_elfNN_ia64_aix_little_vec
+ #undef TARGET_LITTLE_NAME
+ #define TARGET_LITTLE_NAME "elfNN-ia64-aix-little"
+ #undef TARGET_BIG_SYM
+ #define TARGET_BIG_SYM bfd_elfNN_ia64_aix_big_vec
+ #undef TARGET_BIG_NAME
+ #define TARGET_BIG_NAME "elfNN-ia64-aix-big"
+
+ #undef elf_backend_add_symbol_hook
+ #define elf_backend_add_symbol_hook elfNN_ia64_aix_add_symbol_hook
+
+ #undef bfd_elfNN_bfd_link_add_symbols
+ #define bfd_elfNN_bfd_link_add_symbols elfNN_ia64_aix_link_add_symbols
+
+ #define elfNN_bed elfNN_ia64_aix_bed
#include "elfNN-target.h"
Index: bfd/targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.36
diff -d -c -p -b -w -r1.36 targets.c
*** targets.c 2001/02/18 23:32:57 1.36
--- targets.c 2001/02/20 21:53:38
*************** extern const bfd_target bfd_elf64_big_ge
*** 557,562 ****
--- 557,564 ----
extern const bfd_target bfd_elf64_bigmips_vec;
extern const bfd_target bfd_elf64_hppa_linux_vec;
extern const bfd_target bfd_elf64_hppa_vec;
+ extern const bfd_target bfd_elf64_ia64_aix_big_vec;
+ extern const bfd_target bfd_elf64_ia64_aix_little_vec;
extern const bfd_target bfd_elf64_ia64_big_vec;
extern const bfd_target bfd_elf64_ia64_little_vec;
extern const bfd_target bfd_elf64_little_generic_vec;
*************** static const bfd_target * const _bfd_tar
*** 725,730 ****
--- 727,734 ----
&bfd_elf64_alpha_vec,
&bfd_elf64_hppa_vec,
&bfd_elf64_hppa_linux_vec,
+ &bfd_elf64_ia64_aix_little_vec,
+ &bfd_elf64_ia64_aix_big_vec,
&bfd_elf64_ia64_little_vec,
&bfd_elf64_ia64_big_vec,
#endif