* external.h (GET_LINENO_LNNO): Use H_GET_32/16.

(PUT_LINENO_LNNO): Use H_PUT_32/16.
	* m88k.h (GET_LNSZ_SIZE, GET_LNSZ_LNNO, GET_SCN_NRELOC,
	GET_SCN_NLINNO): Use H_GET_32.
	(PUT_LNSZ_LNNO, PUT_LNSZ_SIZE, PUT_SCN_NRELOC, PUT_SCN_NLINNO):
	Use H_PUT_32.
	* ti.h: Formatting fixes.  Make use of H_GET_* and H_PUT_* throughout.
	* xcoff.h: White space changes.
This commit is contained in:
Alan Modra 2001-09-18 10:01:08 +00:00
parent 09cc7651e5
commit 44346d6912
5 changed files with 117 additions and 86 deletions

View File

@ -1,3 +1,14 @@
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* external.h (GET_LINENO_LNNO): Use H_GET_32/16.
(PUT_LINENO_LNNO): Use H_PUT_32/16.
* m88k.h (GET_LNSZ_SIZE, GET_LNSZ_LNNO, GET_SCN_NRELOC,
GET_SCN_NLINNO): Use H_GET_32.
(PUT_LNSZ_LNNO, PUT_LNSZ_SIZE, PUT_SCN_NRELOC, PUT_SCN_NLINNO):
Use H_PUT_32.
* ti.h: Formatting fixes. Make use of H_GET_* and H_PUT_* throughout.
* xcoff.h: White space changes.
2001-09-05 Tom Rix <trix@redhat.com> 2001-09-05 Tom Rix <trix@redhat.com>
* xcoff.h : Add XCOFF_SYSCALL32 and XCOFF_SYSCALL64 hash table flags. * xcoff.h : Add XCOFF_SYSCALL32 and XCOFF_SYSCALL64 hash table flags.

View File

@ -113,12 +113,12 @@ struct external_lineno
#define LINESZ (4 + L_LNNO_SIZE) #define LINESZ (4 + L_LNNO_SIZE)
#if L_LNNO_SIZE == 4 #if L_LNNO_SIZE == 4
#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32 (abfd, (bfd_byte *) (ext->l_lnno)); #define GET_LINENO_LNNO H_GET_32
#define PUT_LINENO_LNNO(abfd, val, ext) bfd_h_put_32 (abfd, val, (bfd_byte *) (ext->l_lnno)); #define PUT_LINENO_LNNO H_PUT_32
#endif #endif
#if L_LNNO_SIZE == 2 #if L_LNNO_SIZE == 2
#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16 (abfd, (bfd_byte *) (ext->l_lnno)); #define GET_LINENO_LNNO H_GET_16
#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16 (abfd,val, (bfd_byte *) (ext->l_lnno)); #define PUT_LINENO_LNNO H_PUT_16
#endif #endif
#endif /* not DO_NOT_DEFINE_LINENO */ #endif /* not DO_NOT_DEFINE_LINENO */

View File

@ -158,20 +158,22 @@ union external_auxent
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */ } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
}; };
#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *)ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) #define GET_LNSZ_SIZE(abfd, ext) \
#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
#define PUT_FCN_LNNOPTR(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) #define GET_LNSZ_LNNO(abfd, ext) \
#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) #define PUT_LNSZ_LNNO(abfd, in, ext) \
#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) #define PUT_LNSZ_SIZE(abfd, in, ext) \
#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen) #define GET_SCN_NRELOC(abfd, ext) \
#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nreloc) H_GET_32 (abfd, ext->x_scn.x_nreloc)
#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nlinno) #define GET_SCN_NLINNO(abfd, ext) \
#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen) H_GET_32 (abfd, ext->x_scn.x_nlinno)
#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc) #define PUT_SCN_NRELOC(abfd, in, ext) \
#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_32(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno) H_PUT_32 (abfd, in, ext->x_scn.x_nreloc)
#define PUT_SCN_NLINNO(abfd, in, ext) \
H_PUT_32 (abfd,in, ext->x_scn.x_nlinno)
#define SYMENT struct external_syment #define SYMENT struct external_syment
#define SYMESZ 20 #define SYMESZ 20

View File

@ -92,16 +92,22 @@ struct external_filehdr
/* we need to read/write an extra field in the coff file header */ /* we need to read/write an extra field in the coff file header */
#ifndef COFF_ADJUST_FILEHDR_IN_POST #ifndef COFF_ADJUST_FILEHDR_IN_POST
#define COFF_ADJUST_FILEHDR_IN_POST(abfd, src, dst) \ #define COFF_ADJUST_FILEHDR_IN_POST(abfd, src, dst) \
do { ((struct internal_filehdr *)(dst))->f_target_id = \ do \
bfd_h_get_16(abfd, (bfd_byte *)(((FILHDR *)(src))->f_target_id)); \ { \
} while(0) ((struct internal_filehdr *)(dst))->f_target_id = \
H_GET_16 (abfd, ((FILHDR *)(src))->f_target_id); \
} \
while (0)
#endif #endif
#ifndef COFF_ADJUST_FILEHDR_OUT_POST #ifndef COFF_ADJUST_FILEHDR_OUT_POST
#define COFF_ADJUST_FILEHDR_OUT_POST(abfd, src, dst) \ #define COFF_ADJUST_FILEHDR_OUT_POST(abfd, src, dst) \
do { bfd_h_put_16(abfd, ((struct internal_filehdr *)(src))->f_target_id, \ do \
(bfd_byte *)(((FILHDR *)(dst))->f_target_id)); \ { \
} while(0) H_PUT_16 (abfd, ((struct internal_filehdr *)(src))->f_target_id, \
((FILHDR *)(dst))->f_target_id); \
} \
while (0)
#endif #endif
#define FILHDR struct external_filehdr #define FILHDR struct external_filehdr
@ -201,35 +207,39 @@ struct external_scnhdr {
accordingly accordingly
*/ */
#define GET_SCNHDR_NRELOC(ABFD, PTR) \ #define GET_SCNHDR_NRELOC(ABFD, PTR) \
(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, PTR)) (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, PTR))
#define PUT_SCNHDR_NRELOC(ABFD, VAL, PTR) \ #define PUT_SCNHDR_NRELOC(ABFD, VAL, PTR) \
(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,PTR)) (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, PTR))
#define GET_SCNHDR_NLNNO(ABFD, PTR) \ #define GET_SCNHDR_NLNNO(ABFD, PTR) \
(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, (PTR)-2)) (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, (PTR) -2))
#define PUT_SCNHDR_NLNNO(ABFD, VAL, PTR) \ #define PUT_SCNHDR_NLNNO(ABFD, VAL, PTR) \
(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,(PTR)-2)) (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, (PTR) -2))
#define GET_SCNHDR_FLAGS(ABFD, PTR) \ #define GET_SCNHDR_FLAGS(ABFD, PTR) \
(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, (PTR)-4)) (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, (PTR) -4))
#define PUT_SCNHDR_FLAGS(ABFD, VAL, PTR) \ #define PUT_SCNHDR_FLAGS(ABFD, VAL, PTR) \
(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,(PTR)-4)) (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, (PTR) -4))
#define GET_SCNHDR_PAGE(ABFD, PTR) \ #define GET_SCNHDR_PAGE(ABFD, PTR) \
(COFF2_P(ABFD) ? bfd_h_get_16 (ABFD,PTR) : bfd_h_get_8 (ABFD, (PTR)-7)) (COFF2_P (ABFD) ? H_GET_16 (ABFD, PTR) : H_GET_8 (ABFD, (PTR) -7))
/* on output, make sure that the "reserved" field is zero */ /* on output, make sure that the "reserved" field is zero */
#define PUT_SCNHDR_PAGE(ABFD, VAL, PTR) \ #define PUT_SCNHDR_PAGE(ABFD, VAL, PTR) \
(COFF2_P(ABFD) ? bfd_h_put_16 (ABFD,VAL,PTR) : \ (COFF2_P (ABFD) \
bfd_h_put_8 (ABFD,VAL,(PTR)-7), bfd_h_put_8 (ABFD, 0, (PTR)-8)) ? H_PUT_16 (ABFD, VAL, PTR) \
: H_PUT_8 (ABFD, VAL, (PTR) -7), H_PUT_8 (ABFD, 0, (PTR) -8))
/* TI COFF stores section size as number of bytes (address units, not octets), /* TI COFF stores section size as number of bytes (address units, not octets),
so adjust to be number of octets, which is what BFD expects */ so adjust to be number of octets, which is what BFD expects */
#define GET_SCNHDR_SIZE(ABFD, SZP) \ #define GET_SCNHDR_SIZE(ABFD, SZP) \
(bfd_h_get_32(ABFD,SZP)*bfd_octets_per_byte(ABFD)) (H_GET_32 (ABFD, SZP) * bfd_octets_per_byte (ABFD))
#define PUT_SCNHDR_SIZE(ABFD, SZ, SZP) \ #define PUT_SCNHDR_SIZE(ABFD, SZ, SZP) \
bfd_h_put_32(ABFD,(SZ)/bfd_octets_per_byte(ABFD),SZP) H_PUT_32 (ABFD, (SZ) / bfd_octets_per_byte (ABFD), SZP)
#define COFF_ADJUST_SCNHDR_IN_POST(ABFD, EXT, INT) \ #define COFF_ADJUST_SCNHDR_IN_POST(ABFD, EXT, INT) \
do { ((struct internal_scnhdr *)(INT))->s_page = \ do \
GET_SCNHDR_PAGE(ABFD,(bfd_byte *)((SCNHDR *)(EXT))->s_page); \ { \
} while(0) ((struct internal_scnhdr *)(INT))->s_page = \
GET_SCNHDR_PAGE (ABFD, ((SCNHDR *)(EXT))->s_page); \
} \
while (0)
/* The line number and reloc overflow checking in coff_swap_scnhdr_out in /* The line number and reloc overflow checking in coff_swap_scnhdr_out in
coffswap.h doesn't use PUT_X for s_nlnno and s_nreloc. coffswap.h doesn't use PUT_X for s_nlnno and s_nreloc.
@ -237,16 +247,18 @@ GET_SCNHDR_PAGE(ABFD,(bfd_byte *)((SCNHDR *)(EXT))->s_page); \
fields. fields.
*/ */
#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD, INT, EXT) \ #define COFF_ADJUST_SCNHDR_OUT_POST(ABFD, INT, EXT) \
do { \ do \
{ \
PUT_SCNHDR_NLNNO (ABFD, ((struct internal_scnhdr *)(INT))->s_nlnno, \ PUT_SCNHDR_NLNNO (ABFD, ((struct internal_scnhdr *)(INT))->s_nlnno, \
(bfd_byte *)((SCNHDR *)(EXT))->s_nlnno); \ ((SCNHDR *)(EXT))->s_nlnno); \
PUT_SCNHDR_NRELOC (ABFD, ((struct internal_scnhdr *)(INT))->s_nreloc,\ PUT_SCNHDR_NRELOC (ABFD, ((struct internal_scnhdr *)(INT))->s_nreloc,\
(bfd_byte *)((SCNHDR *)(EXT))->s_nreloc); \ ((SCNHDR *)(EXT))->s_nreloc); \
PUT_SCNHDR_FLAGS (ABFD, ((struct internal_scnhdr *)(INT))->s_flags, \ PUT_SCNHDR_FLAGS (ABFD, ((struct internal_scnhdr *)(INT))->s_flags, \
(bfd_byte *)((SCNHDR *)(EXT))->s_flags); \ ((SCNHDR *)(EXT))->s_flags); \
PUT_SCNHDR_PAGE (ABFD, ((struct internal_scnhdr *)(INT))->s_page, \ PUT_SCNHDR_PAGE (ABFD, ((struct internal_scnhdr *)(INT))->s_page, \
(bfd_byte *)((SCNHDR *)(EXT))->s_page); \ ((SCNHDR *)(EXT))->s_page); \
} while(0) } \
while (0)
/* Page macros /* Page macros
@ -387,32 +399,37 @@ union external_auxent {
/* section lengths are in target bytes (not host bytes) */ /* section lengths are in target bytes (not host bytes) */
#define GET_SCN_SCNLEN(ABFD, EXT) \ #define GET_SCN_SCNLEN(ABFD, EXT) \
(bfd_h_get_32(ABFD,(bfd_byte *)(EXT)->x_scn.x_scnlen)*bfd_octets_per_byte(ABFD)) (H_GET_32 (ABFD, (EXT)->x_scn.x_scnlen) * bfd_octets_per_byte (ABFD))
#define PUT_SCN_SCNLEN(ABFD, INT, EXT) \ #define PUT_SCN_SCNLEN(ABFD, INT, EXT) \
bfd_h_put_32(ABFD,(INT)/bfd_octets_per_byte(ABFD),\ H_PUT_32 (ABFD, (INT) / bfd_octets_per_byte (ABFD), (EXT)->x_scn.x_scnlen)
(bfd_byte *)(EXT)->x_scn.x_scnlen)
/* lnsz size is in bits in COFF file, in bytes in BFD */ /* lnsz size is in bits in COFF file, in bytes in BFD */
#define GET_LNSZ_SIZE(abfd, ext) \ #define GET_LNSZ_SIZE(abfd, ext) \
(bfd_h_get_16(abfd, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size) / \ (H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) / (class != C_FIELD ? 8 : 1))
(class != C_FIELD ? 8 : 1))
#define PUT_LNSZ_SIZE(abfd, in, ext) \ #define PUT_LNSZ_SIZE(abfd, in, ext) \
bfd_h_put_16(abfd, ((class != C_FIELD) ? (in)*8 : (in)), \ H_PUT_16 (abfd, ((class != C_FIELD) ? (in) * 8 : (in)), \
(bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size) ext->x_sym.x_misc.x_lnsz.x_size)
/* TI COFF stores offsets for MOS and MOU in bits; BFD expects bytes */ /* TI COFF stores offsets for MOS and MOU in bits; BFD expects bytes */
#define COFF_ADJUST_SYM_IN_POST(ABFD, EXT, INT) \ #define COFF_ADJUST_SYM_IN_POST(ABFD, EXT, INT) \
do { struct internal_syment *dst = (struct internal_syment *)(INT); \ do \
if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU) dst->n_value /= 8; \ { \
} while (0) struct internal_syment *dst = (struct internal_syment *)(INT); \
if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU) \
dst->n_value /= 8; \
} \
while (0)
#define COFF_ADJUST_SYM_OUT_POST(ABFD, INT, EXT) \ #define COFF_ADJUST_SYM_OUT_POST(ABFD, INT, EXT) \
do { struct internal_syment *src = (struct internal_syment *)(INT); \ do \
{ \
struct internal_syment *src = (struct internal_syment *)(INT); \
SYMENT *dst = (SYMENT *)(EXT); \ SYMENT *dst = (SYMENT *)(EXT); \
if (src->n_sclass == C_MOU || src->n_sclass == C_MOS) \ if (src->n_sclass == C_MOU || src->n_sclass == C_MOS) \
bfd_h_put_32(abfd,src->n_value * 8,(bfd_byte *)dst->e_value); \ H_PUT_32 (abfd, src->n_value * 8, dst->e_value); \
} while (0) } \
while (0)
/* Detect section-relative absolute symbols so they get flagged with a sym /* Detect section-relative absolute symbols so they get flagged with a sym
index of -1. index of -1.

View File

@ -1,6 +1,7 @@
/* Internal format of XCOFF object file data structures for BFD. /* Internal format of XCOFF object file data structures for BFD.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support. Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.