[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] mac os x port questions
From: |
Aurelien Chanudet |
Subject: |
Re: [Gcl-devel] mac os x port questions |
Date: |
Sun, 15 Feb 2004 14:07:47 +0100 |
The patches below (against CVS head) reflect the changes I had to do in
order to make the local BFD tree knows how to cope with the Mach-O
back-end.
Aurelien
---
Index: configure.in
===================================================================
RCS file: /cvsroot/gcl/gcl/binutils/bfd/configure.in,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 configure.in
--- configure.in 9 Aug 2002 05:35:01 -0000 1.1.1.1
+++ configure.in 15 Feb 2004 12:58:22 -0000
@@ -695,6 +695,9 @@
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;;
+ mach_o_be_vec) tb="$tb mach-o.lo" ;;
+ mach_o_le_vec) tb="$tb mach-o.lo" ;;
+ mach_o_fat_vec) tb="$tb mach-o.lo" ;;
mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo
cofflink.lo" ;;
mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo
cofflink.lo" ;;
mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo
cofflink.lo" ;;
Index: configure
===================================================================
RCS file: /cvsroot/gcl/gcl/binutils/bfd/configure,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 configure
--- configure 9 Aug 2002 05:35:01 -0000 1.1.1.1
+++ configure 15 Feb 2004 12:59:12 -0000
@@ -6188,6 +6188,9 @@
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;;
+ mach_o_be_vec) tb="$tb mach-o.lo" ;;
+ mach_o_le_vec) tb="$tb mach-o.lo" ;;
+ mach_o_fat_vec) tb="$tb mach-o.lo" ;;
mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo
cofflink.lo" ;;
mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo
cofflink.lo" ;;
mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo
cofflink.lo" ;;
Index: Makefile.in
===================================================================
RCS file: /cvsroot/gcl/gcl/binutils/bfd/Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 Makefile.in
--- Makefile.in 13 Aug 2002 03:59:56 -0000 1.3
+++ Makefile.in 15 Feb 2004 12:55:29 -0000
@@ -143,10 +143,10 @@
# The .o files needed by all of the 32 bit vectors that are configured
into
# target_vector in targets.c if configured with --enable-targets=all.
-BFD32_BACKENDS = aout-adobe.lo aout-arm.lo aout-cris.lo
aout-ns32k.lo aout-sparcle.lo aout-tic30.lo aout0.lo
aout32.lo armnetbsd.lo bout.lo cf-i386lynx.lo
cf-m68klynx.lo cf-sparclynx.lo coff-a29k.lo coff-apollo.lo
coff-arm.lo coff-aux.lo coff-h8300.lo coff-h8500.lo
coff-i386.lo coff-go32.lo coff-i860.lo coff-i960.lo
coff-m68k.lo coff-m88k.lo coff-mips.lo coff-or32.lo
coff-rs6000.lo coff-sh.lo coff-sparc.lo coff-stgo32.lo
coff-svm68k.lo coff-tic30.lo coff-tic54x.lo coff-tic80.lo
coff-u68k.lo coff-we32k.lo coff-w65.lo coff-z8k.lo
cofflink.lo dwarf1.lo ecoff.lo ecofflink.lo
efi-app-ia32.lo elf.lo elf32-arc.lo elfarm-oabi.lo
elfarm-nabi.lo elf32-avr.lo elf32-cris.lo elf32-d10v.lo
elf32-d30v.lo elf32-dlx.lo elf32-fr30.lo elf32-frv.lo
elf32-gen.lo elf32-h8300.lo elf32-hppa.lo elf32-i370.lo
elf32-i386.lo elf32-i386qnx.lo elf32-i860.lo elf32-i960.lo
elf32-ia64.lo elf32-ip2k.lo elf32-m32r.lo elf32-m68hc11.lo
elf32-m68hc12.lo elf32-m68k.lo elf32-m88k.lo
elf-m10200.lo elf-m10300.lo elf32-mcore.lo elfxx-mips.lo
elf32-mips.lo elf32-openrisc.lo elf32-or32.lo elf32-pj.lo
elf32-ppc.lo elf32-s390.lo elf32-sh.lo elf32-sh-lin.lo
elf32-sh64.lo elf32-sh64-com.lo elf32-sh-nbsd.lo
elf32-sh64-nbsd.lo elf32-sparc.lo elf32-v850.lo elf32-vax.lo
elf32-xstormy16.lo elf32.lo elflink.lo elf-strtab.lo
elf-eh-frame.lo epoc-pe-arm.lo epoc-pei-arm.lo hp300bsd.lo
hp300hpux.lo som.lo i386aout.lo i386bsd.lo i386dynix.lo
i386freebsd.lo i386linux.lo i386lynx.lo i386msdos.lo
i386netbsd.lo i386mach3.lo i386os9k.lo ieee.lo
m68k4knetbsd.lo m68klinux.lo m68klynx.lo m68knetbsd.lo
m88kmach3.lo mipsbsd.lo newsos3.lo nlm.lo nlm32-i386.lo
nlm32-sparc.lo nlm32-ppc.lo nlm32.lo ns32knetbsd.lo
oasys.lo pc532-mach.lo pdp11.lo pe-arm.lo pei-arm.lo
pe-i386.lo pei-i386.lo pe-mcore.lo pei-mcore.lo
pe-ppc.lo pei-ppc.lo pe-sh.lo pei-sh.lo
pe-mips.lo pei-mips.lo peigen.lo ppcboot.lo
reloc16.lo riscix.lo sparclinux.lo sparclynx.lo
sparcnetbsd.lo sunos.lo vaxnetbsd.lo vax1knetbsd.lo vaxbsd.lo
versados.lo vms.lo vms-gsd.lo vms-hdr.lo vms-misc.lo
vms-tir.lo xcofflink.lo
+BFD32_BACKENDS = aout-adobe.lo aout-arm.lo aout-cris.lo
aout-ns32k.lo aout-sparcle.lo aout-tic30.lo aout0.lo
aout32.lo armnetbsd.lo bout.lo cf-i386lynx.lo
cf-m68klynx.lo cf-sparclynx.lo coff-a29k.lo coff-apollo.lo
coff-arm.lo coff-aux.lo coff-h8300.lo coff-h8500.lo
coff-i386.lo coff-go32.lo coff-i860.lo coff-i960.lo
coff-m68k.lo coff-m88k.lo coff-mips.lo coff-or32.lo
coff-rs6000.lo coff-sh.lo coff-sparc.lo coff-stgo32.lo
coff-svm68k.lo coff-tic30.lo coff-tic54x.lo coff-tic80.lo
coff-u68k.lo coff-we32k.lo coff-w65.lo coff-z8k.lo
cofflink.lo dwarf1.lo ecoff.lo ecofflink.lo
efi-app-ia32.lo elf.lo elf32-arc.lo elfarm-oabi.lo
elfarm-nabi.lo elf32-avr.lo elf32-cris.lo elf32-d10v.lo
elf32-d30v.lo elf32-dlx.lo elf32-fr30.lo elf32-frv.lo
elf32-gen.lo elf32-h8300.lo elf32-hppa.lo elf32-i370.lo
elf32-i386.lo elf32-i386qnx.lo elf32-i860.lo elf32-i960.lo
elf32-ia64.lo elf32-ip2k.lo elf32-m32r.lo elf32-m68hc11.lo
elf32-m68hc12.lo elf32-m68k.lo elf32-m88k.lo
elf-m10200.lo elf-m10300.lo elf32-mcore.lo elfxx-mips.lo
elf32-mips.lo elf32-openrisc.lo elf32-or32.lo elf32-pj.lo
elf32-ppc.lo elf32-s390.lo elf32-sh.lo elf32-sh-lin.lo
elf32-sh64.lo elf32-sh64-com.lo elf32-sh-nbsd.lo
elf32-sh64-nbsd.lo elf32-sparc.lo elf32-v850.lo elf32-vax.lo
elf32-xstormy16.lo elf32.lo elflink.lo elf-strtab.lo
elf-eh-frame.lo epoc-pe-arm.lo epoc-pei-arm.lo hp300bsd.lo
hp300hpux.lo som.lo i386aout.lo i386bsd.lo i386dynix.lo
i386freebsd.lo i386linux.lo i386lynx.lo i386msdos.lo
i386netbsd.lo i386mach3.lo i386os9k.lo ieee.lo
m68k4knetbsd.lo m68klinux.lo m68klynx.lo m68knetbsd.lo
m88kmach3.lo mipsbsd.lo newsos3.lo nlm.lo nlm32-i386.lo
nlm32-sparc.lo nlm32-ppc.lo nlm32.lo ns32knetbsd.lo
oasys.lo pc532-mach.lo pdp11.lo pe-arm.lo pei-arm.lo
pe-i386.lo pei-i386.lo pe-mcore.lo pei-mcore.lo
pe-ppc.lo pei-ppc.lo pe-sh.lo pei-sh.lo
pe-mips.lo pei-mips.lo peigen.lo ppcboot.lo
reloc16.lo riscix.lo sparclinux.lo sparclynx.lo
sparcnetbsd.lo sunos.lo vaxnetbsd.lo vax1knetbsd.lo vaxbsd.lo
versados.lo vms.lo vms-gsd.lo vms-hdr.lo vms-misc.lo
vms-tir.lo xcofflink.lo mach-o.lo
-BFD32_BACKENDS_CFILES = aout-adobe.c aout-arm.c
aout-cris.c aout-ns32k.c aout-sparcle.c aout-tic30.c
aout0.c aout32.c armnetbsd.c bout.c cf-i386lynx.c
cf-m68klynx.c cf-sparclynx.c coff-a29k.c coff-apollo.c
coff-arm.c coff-aux.c coff-h8300.c coff-h8500.c
coff-i386.c coff-i860.c coff-go32.c coff-i960.c
coff-m68k.c coff-m88k.c coff-mips.c coff-or32.c
coff-rs6000.c coff-sh.c coff-sparc.c coff-stgo32.c coff-svm68k.c
coff-tic30.c coff-tic54x.c coff-tic80.c coff-u68k.c
coff-we32k.c coff-w65.c coff-z8k.c cofflink.c
dwarf1.c ecoff.c ecofflink.c efi-app-ia32.c elf.c
elf32-arc.c elfarm-oabi.c elfarm-nabi.c elf32-avr.c
elf32-cris.c elf32-d10v.c elf32-d30v.c elf32-dlx.c
elf32-fr30.c elf32-frv.c elf32-gen.c elf32-h8300.c
elf32-hppa.c elf32-i370.c elf32-i386.c elf32-i386qnx.c
elf32-i860.c elf32-i960.c elf32-ip2k.c elf32-m32r.c
elf32-m68k.c elf32-m68hc11.c elf32-m68hc12.c elf32-m88k.c
elf-m10200.c elf-m10300.c elf32-mcore.c elfxx-mips.c
elf32-mips.c elf32-openrisc.c elf32-or32.c elf32-pj.c
elf32-ppc.c elf32-sh64.c elf32-sh64-com.c elf32-s390.c
elf32-sh.c elf32-sh-lin.c elf32-sh-nbsd.c
elf32-sh64-nbsd.c elf32-sparc.c elf32-v850.c elf32-vax.c
elf32-xstormy16.c elf32.c elflink.c elf-strtab.c
elf-eh-frame.c epoc-pe-arm.c epoc-pei-arm.c hp300bsd.c
hp300hpux.c som.c i386aout.c i386bsd.c i386dynix.c
i386freebsd.c i386linux.c i386lynx.c i386msdos.c
i386netbsd.c i386mach3.c i386os9k.c ieee.c
m68k4knetbsd.c m68klinux.c m68klynx.c m68knetbsd.c
m88kmach3.c mipsbsd.c newsos3.c nlm.c nlm32-i386.c
nlm32-sparc.c nlm32-ppc.c nlm32.c ns32knetbsd.c
oasys.c pc532-mach.c pdp11.c pe-arm.c pei-arm.c
pe-i386.c pei-i386.c pe-mcore.c pei-mcore.c
pe-ppc.c pei-ppc.c pe-sh.c pei-sh.c pe-mips.c
pei-mips.c ppcboot.c reloc16.c riscix.c
sparclinux.c sparclynx.c sparcnetbsd.c sunos.c
vaxnetbsd.c vax1knetbsd.c vaxbsd.c versados.c vms.c
vms-gsd.c vms-hdr.c vms-misc.c vms-tir.c xcofflink.c
+BFD32_BACKENDS_CFILES = aout-adobe.c aout-arm.c
aout-cris.c aout-ns32k.c aout-sparcle.c aout-tic30.c
aout0.c aout32.c armnetbsd.c bout.c cf-i386lynx.c
cf-m68klynx.c cf-sparclynx.c coff-a29k.c coff-apollo.c
coff-arm.c coff-aux.c coff-h8300.c coff-h8500.c
coff-i386.c coff-i860.c coff-go32.c coff-i960.c
coff-m68k.c coff-m88k.c coff-mips.c coff-or32.c
coff-rs6000.c coff-sh.c coff-sparc.c coff-stgo32.c coff-svm68k.c
coff-tic30.c coff-tic54x.c coff-tic80.c coff-u68k.c
coff-we32k.c coff-w65.c coff-z8k.c cofflink.c
dwarf1.c ecoff.c ecofflink.c efi-app-ia32.c elf.c
elf32-arc.c elfarm-oabi.c elfarm-nabi.c elf32-avr.c
elf32-cris.c elf32-d10v.c elf32-d30v.c elf32-dlx.c
elf32-fr30.c elf32-frv.c elf32-gen.c elf32-h8300.c
elf32-hppa.c elf32-i370.c elf32-i386.c elf32-i386qnx.c
elf32-i860.c elf32-i960.c elf32-ip2k.c elf32-m32r.c
elf32-m68k.c elf32-m68hc11.c elf32-m68hc12.c elf32-m88k.c
elf-m10200.c elf-m10300.c elf32-mcore.c elfxx-mips.c
elf32-mips.c elf32-openrisc.c elf32-or32.c elf32-pj.c
elf32-ppc.c elf32-sh64.c elf32-sh64-com.c elf32-s390.c
elf32-sh.c elf32-sh-lin.c elf32-sh-nbsd.c
elf32-sh64-nbsd.c elf32-sparc.c elf32-v850.c elf32-vax.c
elf32-xstormy16.c elf32.c elflink.c elf-strtab.c
elf-eh-frame.c epoc-pe-arm.c epoc-pei-arm.c hp300bsd.c
hp300hpux.c som.c i386aout.c i386bsd.c i386dynix.c
i386freebsd.c i386linux.c i386lynx.c i386msdos.c
i386netbsd.c i386mach3.c i386os9k.c ieee.c
m68k4knetbsd.c m68klinux.c m68klynx.c m68knetbsd.c
m88kmach3.c mipsbsd.c newsos3.c nlm.c nlm32-i386.c
nlm32-sparc.c nlm32-ppc.c nlm32.c ns32knetbsd.c
oasys.c pc532-mach.c pdp11.c pe-arm.c pei-arm.c
pe-i386.c pei-i386.c pe-mcore.c pei-mcore.c
pe-ppc.c pei-ppc.c pe-sh.c pei-sh.c pe-mips.c
pei-mips.c ppcboot.c reloc16.c riscix.c
sparclinux.c sparclynx.c sparcnetbsd.c sunos.c
vaxnetbsd.c vax1knetbsd.c vaxbsd.c versados.c vms.c
vms-gsd.c vms-hdr.c vms-misc.c vms-tir.c xcofflink.c
mach-o.c
# The .o files needed by all of the 64 bit vectors that are configured
into
@@ -183,7 +183,7 @@
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
-SOURCE_HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h
coffswap.h ecoffswap.h elf-bfd.h elf-hppa.h elf32-arm.h
elf32-hppa.h elf64-hppa.h elfcode.h elfcore.h elflink.h
freebsd.h genlink.h go32stub.h libaout.h libbfd.h libcoff.h
libecoff.h libhppa.h libieee.h libnlm.h liboasys.h libpei.h
netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h peicode.h som.h
vms.h libxcoff.h xcoff-target.h version.h
+SOURCE_HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h
coffswap.h ecoffswap.h elf-bfd.h elf-hppa.h elf32-arm.h
elf32-hppa.h elf64-hppa.h elfcode.h elfcore.h elflink.h
freebsd.h genlink.h go32stub.h libaout.h libbfd.h libcoff.h
libecoff.h libhppa.h libieee.h libnlm.h mach-o.h liboasys.h
libpei.h netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h
peicode.h som.h vms.h libxcoff.h xcoff-target.h version.h
BUILD_HFILES = elf32-target.h elf64-target.h targmatch.h
@@ -1341,6 +1341,8 @@
m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \
+ $(INCDIR)/libiberty.h mach-o-target.c
mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
Index: Makefile.am
===================================================================
RCS file: /cvsroot/gcl/gcl/binutils/bfd/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- Makefile.am 13 Aug 2002 03:59:56 -0000 1.2
+++ Makefile.am 15 Feb 2004 12:56:36 -0000
@@ -267,6 +267,7 @@
m68klynx.lo \
m68knetbsd.lo \
m88kmach3.lo \
+ mach-o.lo \
mipsbsd.lo \
newsos3.lo \
nlm.lo \
@@ -424,6 +425,7 @@
m68klynx.c \
m68knetbsd.c \
m88kmach3.c \
+ mach-o.c \
mipsbsd.c \
newsos3.c \
nlm.c \
@@ -566,7 +568,7 @@
elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h \
elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
- libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
+ libieee.h libnlm.h liboasys.h libpei.h mach-o.h netbsd.h
nlm-target.h\
nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \
xcoff-target.h version.h
@@ -1340,6 +1342,8 @@
m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \
+ $(INCDIR)/libiberty.h mach-o-target.c
mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
Index: targets.c
===================================================================
RCS file: /cvsroot/gcl/gcl/binutils/bfd/targets.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 targets.c
--- targets.c 9 Aug 2002 05:35:49 -0000 1.1.1.1
+++ targets.c 15 Feb 2004 12:54:26 -0000
@@ -155,7 +155,8 @@
. 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
.};
.
.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE,
BFD_ENDIAN_UNKNOWN };
@@ -636,6 +637,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;
@@ -931,6 +935,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,
Index: bfd.c
===================================================================
RCS file: /cvsroot/gcl/gcl/binutils/bfd/bfd.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 bfd.c
--- bfd.c 9 Aug 2002 05:34:47 -0000 1.1.1.1
+++ bfd.c 15 Feb 2004 13:01:10 -0000
@@ -177,6 +177,8 @@
. 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;
. PTR any;
. }
. tdata;
@@ -1382,4 +1384,132 @@
}
return false;
+}
+
+
+/*
+CODE_FRAGMENT
+
+.struct bfd_preserve
+.{
+. PTR marker;
+. PTR tdata;
+. flagword flags;
+. const struct bfd_arch_info *arch_info;
+. struct sec *sections;
+. struct sec **section_tail;
+. unsigned int section_count;
+. struct bfd_hash_table section_htab;
+.};
+.
+*/
+
+/*
+FUNCTION
+ bfd_preserve_save
+
+SYNOPSIS
+ boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
+
+DESCRIPTION
+ When testing an object for compatibility with a particular
+ target back-end, the back-end object_p function needs to set
+ up certain fields in the bfd on successfully recognizing the
+ object. This typically happens in a piecemeal fashion, with
+ failures possible at many points. On failure, the bfd is
+ supposed to be restored to its initial state, which is
+ virtually impossible. However, restoring a subset of the bfd
+ state works in practice. This function stores the subset and
+ reinitializes the bfd.
+
+*/
+
+boolean
+bfd_preserve_save (abfd, preserve)
+ bfd *abfd;
+ struct bfd_preserve *preserve;
+{
+ preserve->tdata = abfd->tdata.any;
+ preserve->arch_info = abfd->arch_info;
+ preserve->flags = abfd->flags;
+ preserve->sections = abfd->sections;
+ preserve->section_tail = abfd->section_tail;
+ preserve->section_count = abfd->section_count;
+ preserve->section_htab = abfd->section_htab;
+
+ if (! bfd_hash_table_init (&abfd->section_htab,
bfd_section_hash_newfunc))
+ return false;
+
+ abfd->tdata.any = NULL;
+ abfd->arch_info = &bfd_default_arch_struct;
+ abfd->flags &= BFD_IN_MEMORY;
+ abfd->sections = NULL;
+ abfd->section_tail = &abfd->sections;
+ abfd->section_count = 0;
+
+ return true;
+}
+
+/*
+FUNCTION
+ bfd_preserve_restore
+
+SYNOPSIS
+ void bfd_preserve_restore (bfd *, struct bfd_preserve *);
+
+DESCRIPTION
+ This function restores bfd state saved by bfd_preserve_save.
+ If MARKER is non-NULL in struct bfd_preserve then that block
+ and all subsequently bfd_alloc'd memory is freed.
+
+*/
+
+void
+bfd_preserve_restore (abfd, preserve)
+ bfd *abfd;
+ struct bfd_preserve *preserve;
+{
+ bfd_hash_table_free (&abfd->section_htab);
+
+ abfd->tdata.any = preserve->tdata;
+ abfd->arch_info = preserve->arch_info;
+ abfd->flags = preserve->flags;
+ abfd->section_htab = preserve->section_htab;
+ abfd->sections = preserve->sections;
+ abfd->section_tail = preserve->section_tail;
+ abfd->section_count = preserve->section_count;
+
+ /* bfd_release frees all memory more recently bfd_alloc'd than
+ its arg, as well as its arg. */
+ if (preserve->marker != NULL)
+ {
+ bfd_release (abfd, preserve->marker);
+ preserve->marker = NULL;
+ }
+}
+
+/*
+FUNCTION
+ bfd_preserve_finish
+
+SYNOPSIS
+ void bfd_preserve_finish (bfd *, struct bfd_preserve *);
+
+DESCRIPTION
+ This function should be called when the bfd state saved by
+ bfd_preserve_save is no longer needed. ie. when the back-end
+ object_p function returns with success.
+
+*/
+
+void
+bfd_preserve_finish (abfd, preserve)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ struct bfd_preserve *preserve;
+{
+ /* It would be nice to be able to free more memory here, eg. old
+ tdata, but that's not possible since these blocks are sitting
+ inside bfd_alloc'd memory. The section hash is on a separate
+ objalloc. */
+ bfd_hash_table_free (&preserve->section_htab);
}
- Re: [Gcl-devel] mac os x port questions, (continued)
- Re: [Gcl-devel] mac os x port questions, Aurelien Chanudet, 2004/02/14
- Re: [Gcl-devel] mac os x port questions, Aurelien Chanudet, 2004/02/14
- Re: [Gcl-devel] mac os x port questions, Aurelien Chanudet, 2004/02/14
- Re: [Gcl-devel] mac os x port questions, Aurelien Chanudet, 2004/02/15
- Re: [Gcl-devel] mac os x port questions, Aurelien Chanudet, 2004/02/15
- Re: [Gcl-devel] mac os x port questions,
Aurelien Chanudet <=
- Re: [Gcl-devel] mac os x port questions, Aurelien Chanudet, 2004/02/16
- Re: [Gcl-devel] mac os x port questions, Aurelien Chanudet, 2004/02/18