This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/RFC] Add support for PEF, Mach-O, xSYM


The following patch adds support for the PEF, Mach-O, and xSYM file formats. I've appended the patch to the existing code, as well as attached a .tgz containing the new files.

Attachment: bfd-formats.tar.gz
Description: GNU Zip compressed data



Two cautions:

* Support for writing binaries is not provided for PEF or xSYM, and has had only light use in the Mach-O target.
* Mach-O supports "fat" binaries with support for multiple platforms. We've represented a fat binary as an archive (where each architecture is a sub-file), which can lead to problems if you try to process an archive of fat binaries (the current BFD code can only handle one level of archive-ness). (We've got internal patches to BFD to support infinite nesting of archives, but that's a matter for a different patch.)

2002-10-07 Klee Dienes <kdienes@apple.com>

* Makefile.am (BFD32_BACKENDS): Add mach-o.lo, pef.lo, and sym.lo.
(BFD32_BACKENDS_CFILES): Add mach-o.c, pef.c, and sym.lo.
archures.c (enum bfd_architecture): Add bfd_arch_m98k.
bfd-in2.h: Regenerate.
bfd.c (struct bfd): Add private data for mach-o, pef, and sym.
targets.c (enum bfd_flavour): Add flavours for mach-o, pef, and sym.
(_bfd_target_vector): Add target vectors for mach-o, pef, and sym.
sym.c: New file. Contains support for the Apple/Metrowerks xSYM
debugging format.
sym.h: New file.
pef.c: New file. Contains support for the Apple Code Fragment
Manager Preferred Executable Format
pef.h: New file.
pef-traceback.h: New file. Contains support for parsing PowerPC
traceback tables as used by PEF executables (and perhaps other
systems as well).
mach-o.c: New file. Contains support for the Mach-O object file format.
mach-o.h: New file.
mach-o-target.c: New file. Declares the mach-o targets
themselves. Included three times by mach-o.c; each time with a
different set of macros set.

Index: Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.102
diff -u -r1.102 Makefile.am
--- Makefile.am 21 Sep 2002 09:59:19 -0000 1.102
+++ Makefile.am 11 Oct 2002 08:38:11 -0000
@@ -274,6 +274,7 @@
m68klynx.lo \
m68knetbsd.lo \
m88kmach3.lo \
+ mach-o.lo \
mipsbsd.lo \
newsos3.lo \
nlm.lo \
@@ -285,6 +286,7 @@
oasys.lo \
pc532-mach.lo \
pdp11.lo \
+ pef.lo \
pe-arm.lo \
pei-arm.lo \
pe-i386.lo \
@@ -305,6 +307,7 @@
sparclynx.lo \
sparcnetbsd.lo \
sunos.lo \
+ sym.lo \
vaxnetbsd.lo \
vax1knetbsd.lo \
vaxbsd.lo \
@@ -436,6 +439,7 @@
m68klynx.c \
m68knetbsd.c \
m88kmach3.c \
+ mach-o.c \
mipsbsd.c \
newsos3.c \
nlm.c \
@@ -447,6 +451,7 @@
oasys.c \
pc532-mach.c \
pdp11.c \
+ pef.c \
pe-arm.c \
pei-arm.c \
pe-i386.c \
@@ -466,6 +471,7 @@
sparclynx.c \
sparcnetbsd.c \
sunos.c \
+ sym.c \
vaxnetbsd.c \
vax1knetbsd.c \
vaxbsd.c \
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.in,v
retrieving revision 1.111
diff -u -r1.111 Makefile.in
--- Makefile.in 21 Sep 2002 09:59:19 -0000 1.111
+++ Makefile.in 11 Oct 2002 08:38:12 -0000
@@ -402,6 +402,7 @@
m68klynx.lo \
m68knetbsd.lo \
m88kmach3.lo \
+ mach-o.lo \
mipsbsd.lo \
newsos3.lo \
nlm.lo \
@@ -413,6 +414,7 @@
oasys.lo \
pc532-mach.lo \
pdp11.lo \
+ pef.lo \
pe-arm.lo \
pei-arm.lo \
pe-i386.lo \
@@ -433,6 +435,7 @@
sparclynx.lo \
sparcnetbsd.lo \
sunos.lo \
+ sym.lo \
vaxnetbsd.lo \
vax1knetbsd.lo \
vaxbsd.lo \
@@ -565,6 +568,7 @@
m68klynx.c \
m68knetbsd.c \
m88kmach3.c \
+ mach-o.c \
mipsbsd.c \
newsos3.c \
nlm.c \
@@ -576,6 +580,7 @@
oasys.c \
pc532-mach.c \
pdp11.c \
+ pef.c \
pe-arm.c \
pei-arm.c \
pe-i386.c \
@@ -595,6 +600,7 @@
sparclynx.c \
sparcnetbsd.c \
sunos.c \
+ sym.c \
vaxnetbsd.c \
vax1knetbsd.c \
vaxbsd.c \
@@ -798,7 +804,7 @@

DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)

-TAR = tar
+TAR = gtar
GZIP_ENV = --best
SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS)
Index: archures.c
===================================================================
RCS file: /cvs/src/src/bfd/archures.c,v
retrieving revision 1.56
diff -u -r1.56 archures.c
--- archures.c 30 Sep 2002 11:53:56 -0000 1.56
+++ archures.c 11 Oct 2002 08:38:12 -0000
@@ -160,6 +160,7 @@
. bfd_arch_alliant, {* Alliant *}
. bfd_arch_convex, {* Convex *}
. bfd_arch_m88k, {* Motorola 88xxx *}
+. bfd_arch_m98k, {* Motorola 98xxx *}
. bfd_arch_pyramid, {* Pyramid Technology *}
. bfd_arch_h8300, {* Hitachi H8/300 *}
.#define bfd_mach_h8300 1
Index: bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.173
diff -u -r1.173 bfd-in2.h
--- bfd-in2.h 30 Sep 2002 11:53:56 -0000 1.173
+++ bfd-in2.h 11 Oct 2002 08:38:12 -0000
@@ -1555,6 +1555,7 @@
bfd_arch_alliant, /* Alliant */
bfd_arch_convex, /* Convex */
bfd_arch_m88k, /* Motorola 88xxx */
+ bfd_arch_m98k, /* Motorola 98xxx */
bfd_arch_pyramid, /* Pyramid Technology */
bfd_arch_h8300, /* Hitachi H8/300 */
#define bfd_mach_h8300 1
@@ -3529,6 +3530,11 @@
struct cisco_core_struct *cisco_core_data;
struct versados_data_struct *versados_data;
struct netbsd_core_struct *netbsd_core_data;
+ struct mach_o_data_struct *mach_o_data;
+ struct mach_o_fat_data_struct *mach_o_fat_data;
+ struct bfd_pef_data_struct *pef_data;
+ struct bfd_pef_xlib_data_struct *pef_xlib_data;
+ struct bfd_sym_data_struct *sym_data;
PTR any;
}
tdata;
@@ -3791,7 +3797,11 @@
bfd_target_msdos_flavour,
bfd_target_ovax_flavour,
bfd_target_evax_flavour,
- bfd_target_mmo_flavour
+ bfd_target_mmo_flavour,
+ bfd_target_mach_o_flavour,
+ bfd_target_pef_flavour,
+ bfd_target_pef_xlib_flavour,
+ bfd_target_sym_flavour
};

enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
Index: bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.37
diff -u -r1.37 bfd.c
--- bfd.c 18 Sep 2002 02:39:43 -0000 1.37
+++ bfd.c 11 Oct 2002 08:38:12 -0000
@@ -180,6 +180,11 @@
. struct cisco_core_struct *cisco_core_data;
. struct versados_data_struct *versados_data;
. struct netbsd_core_struct *netbsd_core_data;
+. struct mach_o_data_struct *mach_o_data;
+. struct mach_o_fat_data_struct *mach_o_fat_data;
+. struct bfd_pef_data_struct *pef_data;
+. struct bfd_pef_xlib_data_struct *pef_xlib_data;
+. struct bfd_sym_data_struct *sym_data;
. PTR any;
. }
. tdata;
Index: targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.77
diff -u -r1.77 targets.c
--- targets.c 17 Sep 2002 02:24:35 -0000 1.77
+++ targets.c 11 Oct 2002 08:38:12 -0000
@@ -155,7 +155,11 @@
. bfd_target_msdos_flavour,
. bfd_target_ovax_flavour,
. bfd_target_evax_flavour,
-. bfd_target_mmo_flavour
+. bfd_target_mmo_flavour,
+. bfd_target_mach_o_flavour,
+. bfd_target_pef_flavour,
+. bfd_target_pef_xlib_flavour,
+. bfd_target_sym_flavour
.};
.
.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
@@ -648,6 +652,9 @@
extern const bfd_target m68ksysvcoff_vec;
extern const bfd_target m88kbcs_vec;
extern const bfd_target m88kmach3_vec;
+extern const bfd_target mach_o_be_vec;
+extern const bfd_target mach_o_le_vec;
+extern const bfd_target mach_o_fat_vec;
extern const bfd_target mcore_pe_big_vec;
extern const bfd_target mcore_pe_little_vec;
extern const bfd_target mcore_pei_big_vec;
@@ -664,6 +671,8 @@
extern const bfd_target pc532machaout_vec;
extern const bfd_target pc532netbsd_vec;
extern const bfd_target pdp11_aout_vec;
+extern const bfd_target pef_vec;
+extern const bfd_target pef_xlib_vec;
extern const bfd_target pmac_xcoff_vec;
extern const bfd_target ppcboot_vec;
extern const bfd_target riscix_vec;
@@ -683,6 +692,7 @@
extern const bfd_target sparclynx_coff_vec;
extern const bfd_target sparcnetbsd_vec;
extern const bfd_target sunos_big_vec;
+extern const bfd_target sym_vec;
extern const bfd_target tic30_aout_vec;
extern const bfd_target tic30_coff_vec;
extern const bfd_target tic4x_coff0_beh_vec;
@@ -959,6 +969,9 @@
&m68ksysvcoff_vec,
&m88kbcs_vec,
&m88kmach3_vec,
+ &mach_o_be_vec,
+ &mach_o_le_vec,
+ &mach_o_fat_vec,
&mcore_pe_big_vec,
&mcore_pe_little_vec,
&mcore_pei_big_vec,
@@ -986,6 +999,8 @@
&pc532machaout_vec,
&pc532netbsd_vec,
&pdp11_aout_vec,
+ &pef_vec,
+ &pef_xlib_vec,
#if 0
/* This has the same magic number as RS/6000. */
&pmac_xcoff_vec,
@@ -1014,6 +1029,7 @@
&sparclynx_aout_vec,
&sparclynx_coff_vec,
&sparcnetbsd_vec,
+ &sym_vec,
&sunos_big_vec,
&tic30_aout_vec,
&tic30_coff_vec,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]