Using the following chars caused a compiler warning on HIUX (so I replaced
them with octal escapes), and isn't useful without an understanding of what
character set it is.
- Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
+ Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
and John Gilmore.
Archive support from Damon A. Permezel.
Contributed by IBM Corporation and Cygnus Support.
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#define TARGET_SYM rs6000coff_vec
#include "xcoff-target.h"
-
/* The main body of code is in coffcode.h. */
static const char *normalize_filename PARAMS ((bfd *));
return false;
}
\f
-
-
void
_bfd_xcoff_swap_sym_in (abfd, ext1, in1)
bfd *abfd;
SYMENT *ext = (SYMENT *)ext1;
struct internal_syment *in = (struct internal_syment *)in1;
-
- if(ext->e.e_name[0] != 0)
+ if (ext->e.e_name[0] != 0)
{
memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
}
- else
+ else
{
in->_n._n_n._n_zeroes = 0;
- in->_n._n_n._n_offset =
+ in->_n._n_n._n_offset =
bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset);
}
- in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
+ in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
struct internal_syment *in = (struct internal_syment *)inp;
SYMENT *ext =(SYMENT *)extp;
- if(in->_n._n_name[0] != 0)
+ if (in->_n._n_name[0] != 0)
{
memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
}
else
{
bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
- bfd_h_put_32(abfd, in->_n._n_n._n_offset,
+ bfd_h_put_32(abfd, in->_n._n_n._n_offset,
(bfd_byte *) ext->e.e.e_offset);
}
case C_FILE:
if (ext->x_file.x_fname[0] == 0) {
in->x_file.x_n.x_zeroes = 0;
- in->x_file.x_n.x_offset =
+ in->x_file.x_n.x_offset =
bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
} else {
if (numaux > 1)
case C_HIDEXT:
if (indx + 1 == numaux)
{
- in->x_csect.x_scnlen.l =
+ in->x_csect.x_scnlen.l =
bfd_h_get_32 (abfd, ext->x_csect.x_scnlen);
in->x_csect.x_parmhash = bfd_h_get_32 (abfd,
ext->x_csect.x_parmhash);
case C_LEAFSTAT:
case C_HIDDEN:
if (type == T_NULL) {
- in->x_scn.x_scnlen = bfd_h_get_32(abfd,
+ in->x_scn.x_scnlen = bfd_h_get_32(abfd,
(bfd_byte *) ext->x_scn.x_scnlen);
- in->x_scn.x_nreloc = bfd_h_get_16(abfd,
+ in->x_scn.x_nreloc = bfd_h_get_16(abfd,
(bfd_byte *) ext->x_scn.x_nreloc);
- in->x_scn.x_nlinno = bfd_h_get_16(abfd,
+ in->x_scn.x_nlinno = bfd_h_get_16(abfd,
(bfd_byte *) ext->x_scn.x_nlinno);
/* PE defines some extra fields; we zero them out for
safety. */
end: ;
/* the semicolon is because MSVC doesn't like labels at
- end of block. */
+ end of block. */
}
-
-
unsigned int
_bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
bfd *abfd;
}
PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
- PUTWORD(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
+ bfd_h_put_16 (abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
- bfd_h_put_32(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
+ bfd_h_put_32(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
- PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
+ PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
else
(bfd_byte *) ext->x_sym.x_misc.x_fsize);
else
{
- bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
+ bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
(bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno);
- bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size,
+ bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size,
(bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size);
}
end:
return bfd_coff_auxesz (abfd);
}
-
-
\f
/* The XCOFF reloc table. Actually, XCOFF relocations specify the
bitsize and whether they are signed or not, along with a
reloc_howto_type xcoff_howto_table[] =
{
/* Standard 32 bit relocation. */
- HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_POS", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* 32 bit relocation, but store negative value. */
- HOWTO (1, /* type */
- 0, /* rightshift */
- -2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (1, /* type */
+ 0, /* rightshift */
+ -2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_NEG", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_NEG", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* 32 bit PC relative relocation. */
- HOWTO (2, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_REL", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* 16 bit TOC relative relocation. */
- HOWTO (3, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (3, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TOC", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_TOC", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* I don't really know what this is. */
- HOWTO (4, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (4, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RTB", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_RTB", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* External TOC relative symbol. */
- HOWTO (5, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (5, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_GL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_GL", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Local TOC relative symbol. */
- HOWTO (6, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (6, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TCL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_TCL", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
EMPTY_HOWTO (7),
-
+
/* Non modifiable absolute branch. */
- HOWTO (8, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (8, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_BA", /* name */
- true, /* partial_inplace */
- 0x3fffffc, /* src_mask */
- 0x3fffffc, /* dst_mask */
+ 0, /* special_function */
+ "R_BA", /* name */
+ true, /* partial_inplace */
+ 0x3fffffc, /* src_mask */
+ 0x3fffffc, /* dst_mask */
false), /* pcrel_offset */
-
+
EMPTY_HOWTO (9),
/* Non modifiable relative branch. */
- HOWTO (0xa, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0xa, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_BR", /* name */
- true, /* partial_inplace */
- 0x3fffffc, /* src_mask */
- 0x3fffffc, /* dst_mask */
+ 0, /* special_function */
+ "R_BR", /* name */
+ true, /* partial_inplace */
+ 0x3fffffc, /* src_mask */
+ 0x3fffffc, /* dst_mask */
false), /* pcrel_offset */
-
+
EMPTY_HOWTO (0xb),
/* Indirect load. */
- HOWTO (0xc, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0xc, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_RL", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Load address. */
- HOWTO (0xd, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0xd, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RLA", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_RLA", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
EMPTY_HOWTO (0xe),
-
+
/* Non-relocating reference. */
- HOWTO (0xf, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0xf, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_REF", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
+ 0, /* special_function */
+ "R_REF", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
false), /* pcrel_offset */
-
+
EMPTY_HOWTO (0x10),
EMPTY_HOWTO (0x11),
-
+
/* TOC relative indirect load. */
- HOWTO (0x12, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x12, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_TRL", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* TOC relative load address. */
- HOWTO (0x13, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x13, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_TRLA", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_TRLA", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Modifiable relative branch. */
- HOWTO (0x14, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x14, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBI", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_RRTBI", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Modifiable absolute branch. */
- HOWTO (0x15, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x15, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RRTBA", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_RRTBA", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Modifiable call absolute indirect. */
- HOWTO (0x16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_CAI", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_CAI", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Modifiable call relative. */
- HOWTO (0x17, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x17, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_CREL", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_CREL", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Modifiable branch absolute. */
- HOWTO (0x18, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x18, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBA", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_RBA", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Modifiable branch absolute. */
- HOWTO (0x19, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x19, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBAC", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_RBAC", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Modifiable branch relative. */
- HOWTO (0x1a, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x1a, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBR", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_RBR", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* Modifiable branch absolute. */
- HOWTO (0x1b, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0x1b, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_RBRC", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0, /* special_function */
+ "R_RBRC", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (0, /* type */
0, /* rightshift */
static reloc_howto_type xcoff_howto_table_16[] =
{
/* Standard 16 bit relocation. */
- HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS_16", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_POS_16", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* 16 bit relocation, but store negative value. */
- HOWTO (1, /* type */
- 0, /* rightshift */
- -2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (1, /* type */
+ 0, /* rightshift */
+ -2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_NEG_16", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_NEG_16", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* 16 bit PC relative relocation. */
- HOWTO (2, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL_16", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_REL_16", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false) /* pcrel_offset */
};
-
+
void
_bfd_xcoff_rtype2howto (relent, internal)
arelent *relent;
relent->howto = xcoff_howto_table + internal->r_type;
if (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x1f) + 1
- && (internal->r_type
- < sizeof(xcoff_howto_table_16)/sizeof(xcoff_howto_table_16[0])))
+ && (internal->r_type
+ < sizeof (xcoff_howto_table_16)/sizeof (xcoff_howto_table_16[0])))
relent->howto = xcoff_howto_table_16 + internal->r_type;
/* The r_size field of an XCOFF reloc encodes the bitsize of the
relocation, as well as indicating whether it is signed or not.
Doublecheck that the relocation information gathered from the
- type matches this information. */
- if (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x1f) + 1)
+ type matches this information. The bitsize is not significant
+ for R_REF relocs. */
+ if (relent->howto->dst_mask != 0
+ && (relent->howto->bitsize
+ != ((unsigned int) internal->r_size & 0x3f) + 1))
abort ();
#if 0
if ((internal->r_size & 0x80) != 0
return NULL;
}
}
-
\f
/* XCOFF archive support. The original version of this code was by
Damon A. Permezel. It was enhanced to permit cross support, and
#define SIZEOF_AR_FILE_HDR_BIG (6 * 20 + SXCOFFARMAG)
-
/* Each XCOFF archive member starts with this (printable) structure. */
struct xcoff_ar_hdr
#define SIZEOF_AR_HDR_BIG (3 * 20 + 4 * 12 + 4)
-
/* We often have to distinguish between the old and big file format.
Make it a bit cleaner. We can use `xcoff_ardata' here because the
`hdr' member has the same size and position in both formats. */
size_t namlen;
bfd_size_type sz;
bfd_byte *contents, *cend;
- unsigned int c, i;
+ bfd_vma c, i;
carsym *arsym;
bfd_byte *p;
return false;
sz = strtol (hdr.size, (char **) NULL, 10);
+
+ /* Read in the entire symbol table. */
+ contents = (bfd_byte *) bfd_alloc (abfd, sz);
+ if (contents == NULL)
+ return false;
+ if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
+ return false;
+
+ /* The symbol table starts with a four byte count. */
+ c = bfd_h_get_32 (abfd, contents);
+
+ if (c * 4 >= sz)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+
+ bfd_ardata (abfd)->symdefs = ((carsym *)
+ bfd_alloc (abfd, c * sizeof (carsym)));
+ if (bfd_ardata (abfd)->symdefs == NULL)
+ return false;
+
+ /* After the count comes a list of four byte file offsets. */
+ for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
+ i < c;
+ ++i, ++arsym, p += 4)
+ arsym->file_offset = bfd_h_get_32 (abfd, p);
}
else
{
machines) since the field width is 20 and there numbers with more
than 32 bits can be represented. */
sz = strtol (hdr.size, (char **) NULL, 10);
- }
- /* Read in the entire symbol table. */
- contents = (bfd_byte *) bfd_alloc (abfd, sz);
- if (contents == NULL)
- return false;
- if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
- return false;
+ /* Read in the entire symbol table. */
+ contents = (bfd_byte *) bfd_alloc (abfd, sz);
+ if (contents == NULL)
+ return false;
+ if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
+ return false;
- /* The symbol table starts with a four byte count. */
- c = bfd_h_get_32 (abfd, contents);
+ /* The symbol table starts with an eight byte count. */
+ c = bfd_h_get_64 (abfd, contents);
- if (c * 4 >= sz)
- {
- bfd_set_error (bfd_error_bad_value);
- return false;
- }
+ if (c * 8 >= sz)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
- bfd_ardata (abfd)->symdefs = ((carsym *)
- bfd_alloc (abfd, c * sizeof (carsym)));
- if (bfd_ardata (abfd)->symdefs == NULL)
- return false;
+ bfd_ardata (abfd)->symdefs = ((carsym *)
+ bfd_alloc (abfd, c * sizeof (carsym)));
+ if (bfd_ardata (abfd)->symdefs == NULL)
+ return false;
- /* After the count comes a list of four byte file offsets. */
- for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
- i < c;
- ++i, ++arsym, p += 4)
- arsym->file_offset = bfd_h_get_32 (abfd, p);
+ /* After the count comes a list of eight byte file offsets. */
+ for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
+ i < c;
+ ++i, ++arsym, p += 8)
+ arsym->file_offset = bfd_h_get_64 (abfd, p);
+ }
/* After the file offsets come null terminated symbol names. */
cend = contents + sz;
/* Write out an XCOFF armap. */
-/*ARGSUSED*/
static boolean
xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
bfd *abfd;
return true;
}
-/*ARGSUSED*/
+/* Write a single armap in the big format. */
static boolean
-xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64,
+ prevoff, nextoff)
bfd *abfd;
- unsigned int elength ATTRIBUTE_UNUSED;
struct orl *map;
unsigned int orl_count;
- int stridx;
+ unsigned int orl_ccount;
+ unsigned int stridx;
+ int bits64;
+ const char *prevoff;
+ char *nextoff;
{
struct xcoff_ar_hdr_big hdr;
char *p;
unsigned char buf[4];
+ const bfd_arch_info_type *arch_info = NULL;
bfd *sub;
file_ptr fileoff;
+ bfd *object_bfd;
unsigned int i;
memset (&hdr, 0, sizeof hdr);
/* XXX This call actually should use %lld (at least on 32-bit
machines) since the fields's width is 20 and there numbers with
more than 32 bits can be represented. */
- sprintf (hdr.size, "%ld", (long) (4 + orl_count * 4 + stridx));
- sprintf (hdr.nextoff, "%d", 0);
- memcpy (hdr.prevoff, xcoff_ardata (abfd)->memoff, 12);
+ sprintf (hdr.size, "%ld", (long) (4 + orl_ccount * 4 + stridx));
+ if (bits64)
+ sprintf (hdr.nextoff, "%d", 0);
+ else
+ sprintf (hdr.nextoff, "%ld", (strtol (prevoff, (char **) NULL, 10)
+ + 4 + orl_ccount * 4 + stridx));
+ memcpy (hdr.prevoff, prevoff, sizeof (hdr.prevoff));
sprintf (hdr.date, "%d", 0);
sprintf (hdr.uid, "%d", 0);
sprintf (hdr.gid, "%d", 0);
if (*p == '\0')
*p = ' ';
+ memcpy (nextoff, hdr.nextoff, sizeof (hdr.nextoff));
+
if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) != SIZEOF_AR_HDR_BIG
|| bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
return false;
- bfd_h_put_32 (abfd, orl_count, buf);
+ bfd_h_put_32 (abfd, orl_ccount, buf);
if (bfd_write (buf, 1, 4, abfd) != 4)
return false;
{
size_t namlen;
- while (((bfd *) (map[i]).pos) == sub)
- {
- bfd_h_put_32 (abfd, fileoff, buf);
- if (bfd_write (buf, 1, 4, abfd) != 4)
- return false;
- ++i;
- }
+ if ((bfd_arch_bits_per_address ((bfd *) map[i].pos) == 64) == bits64)
+ while (((bfd *) (map[i]).pos) == sub)
+ {
+ bfd_h_put_32 (abfd, fileoff, buf);
+ if (bfd_write (buf, 1, 4, abfd) != 4)
+ return false;
+ i++;
+ }
+ else
+ while (((bfd *) (map[i]).pos) == sub)
+ i++;
+
namlen = strlen (normalize_filename (sub));
namlen = (namlen + 1) &~ 1;
fileoff += (SIZEOF_AR_HDR_BIG
sub = sub->next;
}
+ object_bfd = NULL;
for (i = 0; i < orl_count; i++)
{
const char *name;
size_t namlen;
+ bfd *ob = (bfd *)map[i].pos;
+
+ if (ob != object_bfd)
+ arch_info = bfd_get_arch_info (ob);
+
+ if (arch_info && (arch_info->bits_per_address == 64) != bits64)
+ continue;
name = *map[i].name;
namlen = strlen (name);
return true;
}
-/*ARGSUSED*/
+static boolean
+xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ bfd *abfd;
+ unsigned int elength ATTRIBUTE_UNUSED;
+ struct orl *map;
+ unsigned int orl_count;
+ int stridx;
+{
+ unsigned int i;
+ unsigned int orl_count_32, orl_count_64;
+ unsigned int stridx_32, stridx_64;
+ const bfd_arch_info_type *arch_info = NULL;
+ bfd *object_bfd;
+
+ /* First, we look through the symbols and work out which are
+ from 32-bit objects and which from 64-bit ones. */
+ orl_count_32 = 0;
+ orl_count_64 = 0;
+ stridx_32 = 0;
+ stridx_64 = 0;
+ object_bfd = NULL;
+ for (i = 0; i < orl_count; i++)
+ {
+ bfd *ob = (bfd *)map[i].pos;
+ unsigned int len;
+ if (ob != object_bfd)
+ arch_info = bfd_get_arch_info (ob);
+ len = strlen (*map[i].name) + 1;
+ if (arch_info && arch_info->bits_per_address == 64)
+ {
+ orl_count_64++;
+ stridx_64 += len;
+ }
+ else
+ {
+ orl_count_32++;
+ stridx_32 += len;
+ }
+ object_bfd = ob;
+ }
+ /* A quick sanity check... */
+ BFD_ASSERT (orl_count_64 + orl_count_32 == orl_count);
+ BFD_ASSERT (stridx_64 + stridx_32 == stridx);
+
+ /* Now write out each map. */
+ if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_32,
+ stridx_32, false,
+ xcoff_ardata_big (abfd)->memoff,
+ xcoff_ardata_big (abfd)->symoff))
+ return false;
+ if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_64,
+ stridx_64, true,
+ xcoff_ardata_big (abfd)->symoff,
+ xcoff_ardata_big (abfd)->symoff64))
+ return false;
+
+ return true;
+}
+
boolean
_bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx)
bfd *abfd;
/* XXX This call actually should use %lld (at least on 32-bit
machines) since the fields's width is 20 and there numbers with
more than 32 bits can be represented. */
- sprintf (fhdr.symoff, "%ld", (long) nextoff);
bfd_ardata (abfd)->tdata = (PTR) &fhdr;
if (! _bfd_compute_and_write_armap (abfd, 0))
return false;
/* We can't use the usual coff_sizeof_headers routine, because AIX
always uses an a.out header. */
-/*ARGSUSED*/
int
_bfd_xcoff_sizeof_headers (abfd, reloc)
bfd *abfd;
size += abfd->section_count * SCNHSZ;
return size;
}
-\f
-