This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PDP-11 port: bfd (1/2)
Here comes what is probably the most controversial patch in the PDP-11
series. It adds support for ARCH_SIZE==16 in libaout.h and also adds
two new macros called GET_MAGIC and PUT_MAGIC. GET_MAGIC is then used
in aout-target.h instead of bfd_h_get_32.
This has been built and tested on armv4l-corel-linux-gnu.
2001-02-15 lars brinkhoff <lars@nocrew.org>
* libaout.h (GET_WORD) [ARCH_SIZE==16]: Define.
(GET_SWORD) [ARCH_SIZE==16]: Likewise.
(GET_SWORD) [ARCH_SIZE==16]: Likewise.
(PUT_WORD) [ARCH_SIZE==16]: Likewise.
(GET_MAGIC): New macro.
(PUT_MAGIC): Likewise.
* aout-target.h (MY(object_p)): Use GET_MAGIC to read magic word.
Index: libaout.h
===================================================================
RCS file: /cvs/src/src/bfd/libaout.h,v
retrieving revision 1.2
diff -u -r1.2 libaout.h
--- libaout.h 2000/07/20 16:21:07 1.2
+++ libaout.h 2001/02/15 13:06:43
@@ -33,22 +33,39 @@
#if ARCH_SIZE==64
#define GET_WORD bfd_h_get_64
#define GET_SWORD bfd_h_get_signed_64
+#define GET_MAGIC bfd_h_get_32
#define PUT_WORD bfd_h_put_64
+#define PUT_MAGIC bfd_h_put_32
#ifndef NAME
#define NAME(x,y) CAT3(x,_64_,y)
#endif
#define JNAME(x) CAT(x,_64)
#define BYTES_IN_WORD 8
+#else
+#if ARCH_SIZE==16
+#define GET_WORD bfd_h_get_16
+#define GET_SWORD bfd_h_get_signed_16
+#define GET_MAGIC bfd_h_get_16
+#define PUT_WORD bfd_h_put_16
+#define PUT_MAGIC bfd_h_put_16
+#ifndef NAME
+#define NAME(x,y) CAT3(x,_16_,y)
+#endif
+#define JNAME(x) CAT(x,_16)
+#define BYTES_IN_WORD 2
#else /* ARCH_SIZE == 32 */
#define GET_WORD bfd_h_get_32
#define GET_SWORD bfd_h_get_signed_32
+#define GET_MAGIC bfd_h_get_32
#define PUT_WORD bfd_h_put_32
+#define PUT_MAGIC bfd_h_put_32
#ifndef NAME
#define NAME(x,y) CAT3(x,_32_,y)
#endif
#define JNAME(x) CAT(x,_32)
#define BYTES_IN_WORD 4
#endif /* ARCH_SIZE==32 */
+#endif /* ARCH_SIZE==64 */
/* Declare at file level, since used in parameter lists, which have
weird scope. */
@@ -566,6 +583,8 @@
NAME(aout,bfd_free_cached_info) PARAMS ((bfd *));
/* A.out uses the generic versions of these routines... */
+
+#define aout_16_get_section_contents _bfd_generic_get_section_contents
#define aout_32_get_section_contents _bfd_generic_get_section_contents
Index: aout-target.h
===================================================================
RCS file: /cvs/src/src/bfd/aout-target.h,v
retrieving revision 1.8
diff -u -r1.8 aout-target.h
--- aout-target.h 2000/11/20 19:05:12 1.8
+++ aout-target.h 2001/02/15 13:06:42
@@ -156,7 +156,7 @@
#ifdef SWAP_MAGIC
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#else
- exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
+ exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
#endif /* SWAP_MAGIC */
if (N_BADMAG (exec)) return 0;