From e0151f38e1579b8f043603060c2ff0f84846652c Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Thu, 15 Jun 1995 21:18:17 +0000 Subject: [PATCH] * bfd-in.h, bfd-in2.h (bfd_boolean): Rename bfd_true, bfd_false to bfd_tttrue, bfd_fffalse so as not to conflict with functions. * coffswap.h (coff_swap_scnhdr_out): Remove version that was hacked for MPW C. * mpw-config.in: Set shell vars instead of pasting to makefile for each configuration, edit coffswap.h to make MPW C not choke. (i386-unknown-coff, sh-hitachi-hms): Recognize. * mpw-make.in (BFD_LIBS): Add versados.c.o. * versados.c (versados_scan): Properly cast results from bfd_alloc. --- bfd/ChangeLog | 19 +++++++++++++++ bfd/bfd-in.h | 7 +++--- bfd/bfd-in2.h | 7 +++--- bfd/mpw-config.in | 59 ++++++++++++++++++++++++++++++++++++----------- bfd/mpw-make.in | 3 ++- bfd/versados.c | 7 +++--- 6 files changed, 78 insertions(+), 24 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 75fbc8db9b..57ac7eb3d2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,22 @@ +Thu Jun 15 14:03:47 1995 Stan Shebs + + * bfd-in.h, bfd-in2.h (bfd_boolean): Rename bfd_true, bfd_false + to bfd_tttrue, bfd_fffalse so as not to conflict with functions. + * coffswap.h (coff_swap_scnhdr_out): Remove version that was + hacked for MPW C. + * mpw-config.in: Set shell vars instead of pasting to makefile + for each configuration, edit coffswap.h to make MPW C not choke. + (i386-unknown-coff, sh-hitachi-hms): Recognize. + * mpw-make.in (BFD_LIBS): Add versados.c.o. + + * versados.c (versados_scan): Properly cast results from bfd_alloc. + +Wed Jun 14 15:27:32 1995 Steve Chamberlain + + * cofflink.c (process_embedded_commands): New function + reads and handles .drectve sections for PE. + (coff_link_input_bfd): Call new function if PE. + Mon Jun 12 12:09:39 1995 Jeff Law (law@snake.cs.utah.edu) * bfd-in.h (bfd_set_section_vma): Case true to a boolean. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 2c333c9c9f..7af736c28d 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -90,7 +90,8 @@ typedef struct _bfd bfd; typedef enum bfd_boolean {false, true} boolean; #define BFD_TRUE_FALSE #else -typedef enum bfd_boolean {bfd_false, bfd_true} boolean; +/* Use enum names that will appear nowhere else. */ +typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean; #endif /* A pointer to a position in a file. */ @@ -297,7 +298,7 @@ typedef struct sec *sec_ptr; #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) -#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = true), true) +#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true) #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true) #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true) @@ -504,7 +505,7 @@ typedef struct _bfd_link_stack_heap bfd_link_stack_heap; #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) -#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (bool)), true) +#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true) /* Byte swapping routines. */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index a0708f7217..11dcae8035 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -90,7 +90,8 @@ typedef struct _bfd bfd; typedef enum bfd_boolean {false, true} boolean; #define BFD_TRUE_FALSE #else -typedef enum bfd_boolean {bfd_false, bfd_true} boolean; +/* Use enum names that will appear nowhere else. */ +typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean; #endif /* A pointer to a position in a file. */ @@ -297,7 +298,7 @@ typedef struct sec *sec_ptr; #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) -#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = true), true) +#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true) #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true) #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true) @@ -504,7 +505,7 @@ typedef struct _bfd_link_stack_heap bfd_link_stack_heap; #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) -#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (bool)), true) +#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true) /* Byte swapping routines. */ diff --git a/bfd/mpw-config.in b/bfd/mpw-config.in index b04a0176b0..89deaa7b00 100644 --- a/bfd/mpw-config.in +++ b/bfd/mpw-config.in @@ -2,26 +2,57 @@ forward-include "{srcdir}"hosts:mpw.h sysdep.h +# We can only handle 32-bit targets right now. + sed -e 's/@WORDSIZE@/32/' -e "s/@VERSION@/`Catenate {srcdir}VERSION`/" {srcdir}bfd-in2.h >bfd.h-new MoveIfChange bfd.h-new bfd.h -Echo '# From mpw-config.in' > "{o}"mk.tmp +# Pre-expand some macros in coffswap.h, so MPW C doesn't choke. + +sed -e 's/^ PUT_AOUTHDR_TSIZE (/ bfd_h_put_32 (/' -e 's/^ PUT_AOUTHDR_DSIZE (/ bfd_h_put_32 (/' -e 's/^ PUT_AOUTHDR_BSIZE (/ bfd_h_put_32 (/' -e 's/^ PUT_AOUTHDR_ENTRY (/ bfd_h_put_32 (/' -e 's/^ PUT_AOUTHDR_TEXT_START (/ bfd_h_put_32 (/' -e 's/^ PUT_AOUTHDR_DATA_START (/ bfd_h_put_32 (/' {srcdir}coffswap.h >coffswap.h-new +MoveIfChange coffswap.h-new coffswap.h + +# This is almost always correct. + +Set selarchs bfd_{target_cpu}_arch +Set defvec "" +Set selvecs "" If "{target_canonical}" =~ /m68k-apple-macos/ - Echo 'WORDSIZE = 32' >> "{o}"mk.tmp - Echo 'BFD_BACKENDS = "{o}"coff-m68k.c.o "{o}"cofflink.c.o' >>"{o}"mk.tmp - Echo 'BFD_MACHINES = "{o}"cpu-m68k.c.o' >>"{o}"mk.tmp - Echo 'TDEFAULTS = -d DEFAULT_VECTOR=m68kcoff_vec -d SELECT_VECS=&m68kcoff_vec -d SELECT_ARCHITECTURES=bfd_m68k_arch' >> "{o}"mk.tmp -Else If "{target_canonical}" =~ /ppc-apple-macos/ - Echo 'WORDSIZE = 32' >> "{o}"mk.tmp - Echo 'BFD_BACKENDS = "{o}"elf32-ppc.c.o "{o}"elf32.c.o' >> "{o}"mk.tmp - Echo 'BFD_MACHINES = "{o}"cpu-powerpc.c.o' >>"{o}"mk.tmp - Echo 'TDEFAULTS = -d DEFAULT_VECTOR=bfd_elf32_powerpc_vec -d SELECT_VECS= -d SELECT_ARCHITECTURES=bfd_ppc_arch' >> "{o}"mk.tmp + Set BFD_BACKENDS '"{o}"coff-m68k.c.o "{o}"cofflink.c.o' + Set defvec m68kcoff_vec + Set selvecs '&m68kcoff_vec' +Else If "{target_canonical}" =~ /powerpc-apple-macos/ + Set BFD_BACKENDS '"{o}"coff-rs6000.c.o' + Set defvec rs6000coff_vec + Set selvecs '&rs6000coff_vec' + Set selarchs bfd_powerpc_arch +Else If "{target_canonical}" =~ /i386-unknown-go32/ + Set BFD_BACKENDS '"{o}"coff-i386.c.o' + Set defvec i386coff_vec + Set selvecs '&i386coff_vec' Else If "{target_canonical}" =~ /mips-idt-ecoff/ - Echo 'WORDSIZE = 32' >> "{o}"mk.tmp - Echo 'BFD_BACKENDS = "{o}"coff-mips.c.o "{o}"ecoff.c.o "{o}"ecofflink.c.o' >> "{o}"mk.tmp - Echo 'BFD_MACHINES = "{o}"cpu-mips.c.o' >> "{o}"mk.tmp - Echo 'TDEFAULTS = -d DEFAULT_VECTOR=ecoff_big_vec -d SELECT_VECS=&ecoff_big_vec,&ecoff_little_vec -d SELECT_ARCHITECTURES=bfd_mips_arch' >> "{o}"mk.tmp + Set BFD_BACKENDS '"{o}"coff-mips.c.o "{o}"ecoff.c.o "{o}"ecofflink.c.o' + Set defvec ecoff_big_vec + Set selvecs '&ecoff_big_vec,&ecoff_little_vec' +Else If "{target_canonical}" =~ /sh-hitachi-hms/ + Set BFD_BACKENDS '"{o}"coff-sh.c.o "{o}"cofflink.c.o' + Set defvec shcoff_vec + Set selvecs '&shcoff_vec,&shlcoff_vec' End If +Set ta `echo {selarchs} | sed -e 's/bfd_/{o}cpu-/g' -e 's/_arch/.c.o/g'` + +Set tdefaults "-d DEFAULT_VECTOR={defvec} -d SELECT_VECS={selvecs} -d SELECT_ARCHITECTURES={selarchs}" + +Echo '# From mpw-config.in' > "{o}"mk.tmp + +Echo 'WORDSIZE = 32' >> "{o}"mk.tmp + +Echo 'BFD_MACHINES = ' {ta} >>"{o}"mk.tmp + +Echo 'BFD_BACKENDS = ' {BFD_BACKENDS} >> "{o}"mk.tmp + +Echo 'TDEFAULTS = ' {tdefaults} >> "{o}"mk.tmp + Echo '# End from mpw-config.in' >> "{o}"mk.tmp diff --git a/bfd/mpw-make.in b/bfd/mpw-make.in index fb00fdcc1c..a0d2b7fdf0 100644 --- a/bfd/mpw-make.in +++ b/bfd/mpw-make.in @@ -104,7 +104,7 @@ BFD_LIBS = \Option-d "{o}"archive.c.o "{o}"archures.c.o "{o}"bfd.c.o "{o}"cache.c.o "{o}"coffgen.c.o "{o}"core.c.o \Option-d "{o}"format.c.o "{o}"init.c.o "{o}"libbfd.c.o "{o}"opncls.c.o "{o}"reloc.c.o \Option-d "{o}"section.c.o "{o}"syms.c.o "{o}"targets.c.o "{o}"hash.c.o "{o}"linker.c.o \Option-d - "{o}"elf.c.o "{o}"srec.c.o "{o}"binary.c.o + "{o}"elf.c.o "{o}"srec.c.o "{o}"binary.c.o "{o}"tekhex.c.o "{o}"versados.c.o # This list is alphabetized to make it easier to keep in sync # with the decls and initializer in archures.c. @@ -380,6 +380,7 @@ saber \Option-f "{o}"srec.c.o \Option-f "{s}"srec.c "{o}"binary.c.o \Option-f "{s}"binary.c "{o}"tekhex.c.o \Option-f "{s}"tekhex.c +"{o}"versados.c.o \Option-f "{s}"versados.c "{o}"oasys.c.o \Option-f "{s}"oasys.c {INCDIR}:oasys.h liboasys.h "{o}"ieee.c.o \Option-f "{s}"ieee.c {INCDIR}:ieee.h libieee.h "{o}"ecoff.c.o \Option-f "{s}"ecoff.c {INCDIR}:aout:ar.h {INCDIR}:aout:ranlib.h \Option-d diff --git a/bfd/versados.c b/bfd/versados.c index d77bb5efd5..ad89ccd477 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -489,10 +489,10 @@ versados_scan (abfd) if (esdid->section) { esdid->section->relocation - = bfd_alloc (abfd, sizeof (arelent) * esdid->relocs); + = (arelent *) bfd_alloc (abfd, sizeof (arelent) * esdid->relocs); esdid->contents - = bfd_alloc (abfd, esdid->section->_raw_size); + = (unsigned char *) bfd_alloc (abfd, esdid->section->_raw_size); esdid->pc = 0; esdid->section->reloc_count = esdid->relocs; @@ -505,7 +505,7 @@ versados_scan (abfd) VDATA (abfd)->stringlen += strlen (esdid->section->name) + 1; } } - VDATA (abfd)->symbols = bfd_alloc (abfd, + VDATA (abfd)->symbols = (asymbol *) bfd_alloc (abfd, sizeof (asymbol) * abfd->symcount); VDATA (abfd)->strings = bfd_alloc (abfd, VDATA (abfd)->stringlen); abfd->symcount = VDATA (abfd)->nsyms; @@ -788,6 +788,7 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols) #define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols #define versados_bfd_final_link _bfd_generic_final_link +#define versados_bfd_link_split_section _bfd_generic_link_split_section const bfd_target versados_vec = {