From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Mitchell To: hjl@lucon.org Cc: ian@zembu.com, binutils@sourceware.cygnus.com Subject: Re: A 32bit BFD patch Date: Sun, 11 Jul 1999 09:30:00 -0000 Message-id: <19990711093401Q.mitchell@codesourcery.com> References: <19990710235053Q.mitchell@codesourcery.com> <19990711072608.BB14157B9@ocean.lucon.org> X-SW-Source: 1999-q3/msg00131.html > If you can tell me where the problems lie, I bet I conditionalize the > right sections. Here's a patch, which I checked in, which should fix the issues reported so far with the MIPS changes. BTW, we could consider compiling with `-W -Wall' by default, as in EGCS. Don't know how much noise this would generate at present. -- Mark Mitchell mark@codesourcery.com CodeSourcery, LLC http://www.codesourcery.com 1999-07-11 Mark Mitchell * libbfd.c (bfd_put_8): Make it of type `void'. * bfd-in2.h: Regenerated. * elf32-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Conditionalize for 32-bit hosts. (_bfd_mips_elf_final_link): Likewise. Index: libbfd.c =================================================================== RCS file: /cvs/binutils/binutils/bfd/libbfd.c,v retrieving revision 1.3 diff -u -p -r1.3 libbfd.c --- libbfd.c 1999/07/07 17:50:51 1.3 +++ libbfd.c 1999/07/11 16:23:51 @@ -792,7 +792,7 @@ DESCRIPTION .{* Byte swapping macros for user section data. *} . .#define bfd_put_8(abfd, val, ptr) \ -. (*((unsigned char *)(ptr)) = (unsigned char)(val)) +. ((void) (*((unsigned char *)(ptr)) = (unsigned char)(val))) .#define bfd_put_signed_8 \ . bfd_put_8 .#define bfd_get_8(abfd, ptr) \ Index: bfd-in2.h =================================================================== RCS file: /cvs/binutils/binutils/bfd/bfd-in2.h,v retrieving revision 1.10 diff -u -p -r1.10 bfd-in2.h --- bfd-in2.h 1999/07/07 17:50:52 1.10 +++ bfd-in2.h 1999/07/11 16:23:44 @@ -768,7 +768,7 @@ bfd_make_readable PARAMS ((bfd *abfd)); /* Byte swapping macros for user section data. */ #define bfd_put_8(abfd, val, ptr) \ - (*((unsigned char *)(ptr)) = (unsigned char)(val)) + ((void) (*((unsigned char *)(ptr)) = (unsigned char)(val))) #define bfd_put_signed_8 \ bfd_put_8 #define bfd_get_8(abfd, ptr) \ Index: elf32-mips.c =================================================================== RCS file: /cvs/binutils/binutils/bfd/elf32-mips.c,v retrieving revision 1.14 diff -u -p -r1.14 elf32-mips.c --- elf32-mips.c 1999/07/07 19:23:19 1.14 +++ elf32-mips.c 1999/07/11 16:23:50 @@ -269,10 +269,17 @@ typedef enum { : bfd_put_32 (abfd, val, ptr)) /* Add a dynamic symbol table-entry. */ +#ifdef BFD64 #define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ (ABI_64_P (elf_hash_table (info)->dynobj) \ ? bfd_elf64_add_dynamic_entry (info, tag, val) \ : bfd_elf32_add_dynamic_entry (info, tag, val)) +#else +#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ + (ABI_64_P (elf_hash_table (info)->dynobj) \ + ? bfd_elf64_add_dynamic_entry (info, tag, val) \ + : (abort (), false)) +#endif /* The number of local .got entries we reserve. */ #define MIPS_RESERVED_GOTNO (2) @@ -4891,10 +4898,18 @@ _bfd_mips_elf_final_link (abfd, info) } /* Invoke the regular ELF backend linker to do all the work. */ - if (!(ABI_64_P (abfd) - ? bfd_elf64_bfd_final_link (abfd, info) - : bfd_elf32_bfd_final_link (abfd, info))) + if (ABI_64_P (abfd)) + { +#ifdef BFD64 + if (!bfd_elf64_bfd_final_link (abfd, info)) + return false; +#else + abort (); return false; +#endif /* BFD64 */ + } + else if (!bfd_elf32_bfd_final_link (abfd, info)) + return false; /* Now write out the computed sections. */