diff options
author | Ken Raeburn <raeburn@cygnus> | 1994-05-27 16:58:05 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@cygnus> | 1994-05-27 16:58:05 +0000 |
commit | c06e55d99ac38bd32492481f46b69ec62ee1e433 (patch) | |
tree | 7567d7ea926780a1d5242d47399b3a267283bb3a /bfd | |
parent | 60e8a534070c8dc181b2fb4971b8199597a168f1 (diff) | |
download | gdb-c06e55d99ac38bd32492481f46b69ec62ee1e433.zip gdb-c06e55d99ac38bd32492481f46b69ec62ee1e433.tar.gz gdb-c06e55d99ac38bd32492481f46b69ec62ee1e433.tar.bz2 |
changes from gas-2.3/binutils-2.4 dist (details in branch log msgs, changelogs)
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/.Sanitize | 1 | ||||
-rw-r--r-- | bfd/ChangeLog | 30 | ||||
-rw-r--r-- | bfd/Makefile.in | 15 | ||||
-rw-r--r-- | bfd/configure.bat | 36 | ||||
-rw-r--r-- | bfd/makefile.dos | 46 | ||||
-rw-r--r-- | bfd/mipsbsd.c | 60 | ||||
-rw-r--r-- | bfd/nlmcode.h | 320 |
7 files changed, 366 insertions, 142 deletions
diff --git a/bfd/.Sanitize b/bfd/.Sanitize index 7702062..9c81237 100644 --- a/bfd/.Sanitize +++ b/bfd/.Sanitize @@ -71,6 +71,7 @@ cisco-core.c coff-a29k.c coff-alpha.c coff-apollo.c +coff-go32.c coff-h8300.c coff-h8500.c coff-i386.c diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8cfc521..61f28db 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,33 @@ +Thu May 26 13:56:03 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * nlmcode.h (nlm_swap_auxiliary_headers_in): Cast bfd_byte pointer + to char pointer to avoid compiler warnings. + + * dep-in.sed: Remove spaces before colons. + + Merged changes back in from FSF gas release 2.3: + + * Makefile.in (stmp-bfd.h): Wrap `if' block around grep + invocation, to avoid a bug in BSD 4.4 make. + + From Ralph Campbell: + * mipsbsd.c (mips_fix_jmp_addr): If symbol is undefined, return an + error. + (mips_fix_hi16_s): Ditto. + + Fri May 13 21:21:00 1994 DJ Delorie (dj@ctron.com) + + * makefile.dos: define a default target, or archives won't work + due to multiple matches. + + Wed May 11 22:32:00 1994 DJ Delorie (dj@ctron.com) + + * configure.bat: update for latest files + * makefile.dos: update for correct targets and sources + * coff-go32.c: [new] go32's COFF format (i386coff with underscores) + * targets.c: add go32coff target + * makefile.in: add coff-go32.c support + Thu May 26 10:10:21 1994 Jeff Law (law@snake.cs.utah.edu) * som.c (som_prep_headers): Do not set the system_id here, private diff --git a/bfd/Makefile.in b/bfd/Makefile.in index a275712..ccdda11 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -124,6 +124,7 @@ BFD32_BACKENDS = \ coff-h8300.o \ coff-h8500.o \ coff-i386.o \ + coff-go32.o \ coff-i960.o \ coff-m68k.o \ coff-m88k.o \ @@ -220,7 +221,7 @@ ALL_CFLAGS=$(CFLAGS) $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHES) # C source files that correspond to .o's. CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c \ - archures.c coff-i386.c aout64.c aout32.c sunos.c demo64.c \ + archures.c coff-i386.c coff-go32.c aout64.c aout32.c sunos.c demo64.c \ coff-i960.c srec.c tekhex.c oasys.c ieee.c aout0.c \ ecoff.c ecofflink.c coff-m68k.c coff-u68k.c coff-apollo.c \ coff-a29k.c coff-rs6000.c coff-sparc.c coffgen.c format.c \ @@ -474,9 +475,17 @@ $(BFD_H): stmp-bfd.h ; @true # The file ../include/bfd.h is from earlier attempts to get this right. # If the file is still there, kill it. +# The weird sh*t with grep is to avoid printing "exit 1 (ignored)" type +# messages from make, and avoid various ways in which different versions +# of make will screw up exit status checks. +# -grep... -> make prints "exit 1" message +# grep ... ; exit 0 -> sun(?) make notices grep failure +# grep ... || exit 0 -> bsd4.4 make still notices +# if grep ... -> seems okay so far stmp-bfd.h : $(srcdir)/bfd-in2.h Makefile rm -f bfd.h-new 64 ../include/bfd.h - grep BFD_HOST_64_BIT sysdep.h > 64 2>/dev/null || exit 0 + if grep BFD_HOST_64_BIT sysdep.h > 64 2>/dev/null; then true; \ + else true; fi sed -e 's/@WORDSIZE@/$(WORDSIZE)/' \ -e "s/@VERSION@/`cat $(srcdir)/VERSION`/" \ -e '/64-bit.*sysdep.h/ r 64' \ @@ -522,6 +531,8 @@ cache.o: cache.c archures.o: archures.c coff-i386.o: coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h \ libcoff.h coffcode.h coffswap.h +coff-go32.o: coff-go32.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h \ + libcoff.h coffcode.h coffswap.h aout64.o: aout64.c aoutx.h $(INCDIR)/bfdlink.h libaout.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ $(INCDIR)/aout/ar.h diff --git a/bfd/configure.bat b/bfd/configure.bat index 6cb35f0..78fe79e 100644 --- a/bfd/configure.bat +++ b/bfd/configure.bat @@ -1,18 +1,18 @@ -@echo off -if "%1" == "go32" goto h8300 -if "%1" == "h8/300" goto h8300 -echo Specify one of [ go32 h8/300 ] on command line -goto exit - -:go32 -echo Configuring bfd for go32 -copy hosts/h-go32.h sysdep.h -copy Makefile.dos Makefile -goto exit - -:h8300 -echo Configuring bfd for H8/300 -copy hosts\h-go32.h sysdep.h -copy Makefile.dos Makefile - -:exit +@echo off
+if "%1" == "h8/300" goto h8300
+
+echo Configuring bfd for go32
+update hosts\go32.h sysdep.h
+update Makefile.dos Makefile
+echo s/@WORDSIZE@/32/g>config.sed
+sed -e s/^/s\/@VERSION@\// -e s/$/\/g/g version >>config.sed
+sed -f config.sed < bfd-in2.h > bfd.h2
+update bfd.h2 bfd.h
+goto exit
+
+:h8300
+echo Configuring bfd for H8/300
+update hosts\h-go32.h sysdep.h
+update Makefile.dos Makefile
+
+:exit
diff --git a/bfd/makefile.dos b/bfd/makefile.dos new file mode 100644 index 0000000..c062b5f --- /dev/null +++ b/bfd/makefile.dos @@ -0,0 +1,46 @@ +CFLAGS=-O2 + +.c.o : + gcc $(CFLAGS) -I. -I../include -c $< + +all : libbfd.a + +targets.o : targets.c + gcc $(CFLAGS) -I. -I../include -DSELECT_VECS=&go32coff_vec,&i386aout_vec -DDEFAULT_VECTOR=go32coff_vec -c $*.c + +archures.o : archures.c + gcc $(CFLAGS) -I. -I../include -DSELECT_ARCHITECTURES=bfd_i386_arch -c $*.c + +OBJS = \ + libbfd.o \ + opncls.o \ + bfd.o \ + archive.o \ + targets.o \ + cache.o \ + archures.o \ + core.o \ + section.o \ + format.o \ + syms.o \ + reloc.o \ + init.o \ + ctor.o \ + coffgen.o \ + srec.o \ + hash.o \ + linker.o \ + ecoff.o \ + ecofflink.o \ + elf.o \ + aout32.o \ + stab-sym.o \ + i386aout.o \ + cpu-i386.o \ + coff-go32.o \ + $E + +libbfd.a : $(OBJS) + -rm libbfd.a + ar rvs libbfd.a $(OBJS) + ranlib libbfd.a diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index 020e5a2..29a41fb 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -178,6 +178,56 @@ MY(write_object_contents) (abfd) #define MIPS_RELOC_LO16 5 /* + * This is only called when performing a BFD_RELOC_MIPS_JMP relocation. + * The jump destination address is formed from the upper 4 bits of the + * "current" program counter concatenated with the jump instruction's + * 26 bit field and two trailing zeros. + * If the destination address is not in the same segment as the "current" + * program counter, then we need to signal an error. + */ +static bfd_reloc_status_type +mips_fix_jmp_addr (abfd,reloc_entry,symbol,data,input_section,output_bfd) + bfd *abfd; + arelent *reloc_entry; + struct symbol_cache_entry *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; +{ + bfd_vma relocation, pc; + + /* If this is a partial relocation, just continue. */ + if (output_bfd != (bfd *)NULL) + return bfd_reloc_continue; + + /* If this is an undefined symbol, return error */ + if (symbol->section == &bfd_und_section + && (symbol->flags & BSF_WEAK) == 0) + return bfd_reloc_undefined; + + /* + * Work out which section the relocation is targetted at and the + * initial relocation command value. + */ + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + pc = input_section->output_section->vma + input_section->output_offset + + reloc_entry->address + 4; + + if ((relocation & 0xF0000000) != (pc & 0xF0000000)) + return bfd_reloc_overflow; + + return bfd_reloc_continue; +} + +/* * This is only called when performing a BFD_RELOC_HI16_S relocation. * We need to see if bit 15 is set in the result. If it is, we add * 0x10000 and continue normally. This will compensate for the sign extension @@ -204,11 +254,16 @@ mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section, if (output_bfd != (bfd *)NULL) return bfd_reloc_continue; + /* If this is an undefined symbol, return error */ + if (symbol->section == &bfd_und_section + && (symbol->flags & BSF_WEAK) == 0) + return bfd_reloc_undefined; + /* * Work out which section the relocation is targetted at and the * initial relocation command value. */ - if (symbol->section == &bfd_com_section) + if (bfd_is_com_section (symbol->section)) relocation = 0; else relocation = symbol->value; @@ -226,7 +281,8 @@ mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section, static reloc_howto_type mips_howto_table_ext[] = { {MIPS_RELOC_32, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "32", false, 0, 0xffffffff, false}, - {MIPS_RELOC_JMP, 2, 2, 26, false, 0, complain_overflow_bitfield, 0, + {MIPS_RELOC_JMP, 2, 2, 26, false, 0, complain_overflow_dont, + mips_fix_jmp_addr, "MIPS_JMP", false, 0, 0x03ffffff, false}, {MIPS_RELOC_WDISP16, 2, 1, 16, true, 0, complain_overflow_signed, 0, "WDISP16", false, 0, 0x0000ffff, false}, diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h index 63b2b5c..4658a13 100644 --- a/bfd/nlmcode.h +++ b/bfd/nlmcode.h @@ -38,8 +38,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define Nlm_External_Copyright_Header NlmNAME(External_Copyright_Header) #define Nlm_External_Extended_Header NlmNAME(External_Extended_Header) #define Nlm_External_Custom_Header NlmNAME(External_Custom_Header) -#define Nlm_External_Cygnus_Section_Header \ - NlmNAME(External_Cygnus_Section_Header) +#define Nlm_External_Cygnus_Ext_Header NlmNAME(External_Cygnus_Ext_Header) #define nlm_symbol_type nlmNAME(symbol_type) #define nlm_get_symtab_upper_bound nlmNAME(get_symtab_upper_bound) @@ -180,7 +179,7 @@ nlm_object_p (abfd) /* Add the sections supplied by all NLM's, and then read in the auxiliary headers. Reading the auxiliary headers may create - additional sections described in the cygnus_sections header. + additional sections described in the cygnus_ext header. From this point on we assume that we have an NLM, and do not treat errors as indicating the wrong format. */ @@ -505,24 +504,6 @@ nlm_swap_auxiliary_headers_in (abfd) nlm_extended_header (abfd)->reserved5 = get_word (abfd, (bfd_byte *) thdr.reserved5); } - else if (strncmp (tempstr, "CuStHeAd", 8) == 0) - { - Nlm_External_Custom_Header thdr; - if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) - return false; - memcpy (nlm_custom_header (abfd)->stamp, thdr.stamp, - sizeof (thdr.stamp)); - nlm_custom_header (abfd)->dataLength = - get_word (abfd, (bfd_byte *) thdr.dataLength); - nlm_custom_header (abfd)->data = - bfd_alloc (abfd, nlm_custom_header (abfd)->dataLength); - if (nlm_custom_header (abfd)->data == NULL) - return false; - if (bfd_read (nlm_custom_header (abfd)->data, 1, - nlm_custom_header (abfd)->dataLength, abfd) - != nlm_custom_header (abfd)->dataLength) - return false; - } else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0) { if (bfd_read ((PTR) nlm_copyright_header (abfd)->stamp, @@ -541,83 +522,160 @@ nlm_swap_auxiliary_headers_in (abfd) nlm_copyright_header (abfd)->copyrightMessageLength + 1) return (false); } - else if (strncmp (tempstr, "CyGnUsSeCs", 10) == 0) + else if (strncmp (tempstr, "CuStHeAd", 8) == 0) { - Nlm_External_Cygnus_Section_Header thdr; - bfd_size_type len; - file_ptr pos; - bfd_byte *contents; - bfd_byte *p, *pend; - - if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) + Nlm_External_Custom_Header thdr; + bfd_size_type hdrLength; + file_ptr dataOffset; + bfd_size_type dataLength; + char dataStamp[8]; + PTR hdr; + + /* Read the stamp ("CuStHeAd"). */ + if (bfd_read ((PTR) thdr.stamp, 1, sizeof (thdr.stamp), abfd) + != sizeof (thdr.stamp)) return false; - memcpy (nlm_cygnus_section_header (abfd)->stamp, thdr.stamp, - sizeof (thdr.stamp)); - nlm_cygnus_section_header (abfd)->offset = - get_word (abfd, (bfd_byte *) thdr.offset); - len = get_word (abfd, (bfd_byte *) thdr.length); - nlm_cygnus_section_header (abfd)->length = len; - - /* This data this header points to provides a list of the - sections which were in the original object file which was - converted to become an NLM. We locate those sections and - add them to the BFD. Note that this is likely to create - a second .text, .data and .bss section; retrieving the - sections by name will get the actual NLM sections, which - is what we want to happen. The sections from the - original file, which may be subsets of the NLM section, - can only be found using bfd_map_over_sections. */ - - contents = (bfd_byte *) bfd_alloc (abfd, len); - if (contents == (bfd_byte *) NULL) + /* Read the length of this custom header. */ + if (bfd_read ((PTR) thdr.length, 1, sizeof (thdr.length), abfd) + != sizeof (thdr.length)) + return false; + hdrLength = get_word (abfd, (bfd_byte *) thdr.length); + /* Read further fields if we have them. */ + if (hdrLength < NLM_TARGET_LONG_SIZE) + dataOffset = 0; + else { - bfd_set_error (bfd_error_no_memory); - return false; + if (bfd_read ((PTR) thdr.dataOffset, 1, + sizeof (thdr.dataOffset), abfd) + != sizeof (thdr.dataOffset)) + return false; + dataOffset = get_word (abfd, (bfd_byte *) thdr.dataOffset); } - pos = bfd_tell (abfd); - if (bfd_seek (abfd, nlm_cygnus_section_header (abfd)->offset, - SEEK_SET) != 0 - || bfd_read (contents, len, 1, abfd) != len) - return false; - p = contents; - pend = p + len; - while (p < pend) + if (hdrLength < 2 * NLM_TARGET_LONG_SIZE) + dataLength = 0; + else + { + if (bfd_read ((PTR) thdr.dataLength, 1, + sizeof (thdr.dataLength), abfd) + != sizeof (thdr.dataLength)) + return false; + dataLength = get_word (abfd, (bfd_byte *) thdr.dataLength); + } + if (hdrLength < 2 * NLM_TARGET_LONG_SIZE + 8) + memset (dataStamp, 0, sizeof (dataStamp)); + else { - char *name; - size_t l; - file_ptr filepos; - bfd_size_type size; - asection *newsec; + if (bfd_read ((PTR) dataStamp, 1, sizeof (dataStamp), abfd) + != sizeof (dataStamp)) + return false; + } + + /* Read the rest of the header, if any. */ + if (hdrLength <= 2 * NLM_TARGET_LONG_SIZE + 8) + { + hdr = NULL; + hdrLength = 0; + } + else + { + hdrLength -= 2 * NLM_TARGET_LONG_SIZE + 8; + hdr = bfd_alloc (abfd, hdrLength); + if (hdr == NULL) + { + bfd_set_error (bfd_error_no_memory); + return false; + } + if (bfd_read (hdr, 1, hdrLength, abfd) != hdrLength) + return false; + } + + /* If we have found a Cygnus header, process it. Otherwise, + just save the associated data without trying to interpret + it. */ + if (strncmp (dataStamp, "CyGnUsEx", 8) == 0) + { + file_ptr pos; + bfd_byte *contents; + bfd_byte *p, *pend; - /* The format of this information is + BFD_ASSERT (hdrLength == 0 && hdr == NULL); + + pos = bfd_tell (abfd); + if (bfd_seek (abfd, dataOffset, SEEK_SET) != 0) + return false; + contents = (bfd_byte *) bfd_alloc (abfd, dataLength); + if (contents == NULL) + { + bfd_set_error (bfd_error_no_memory); + return false; + } + if (bfd_read (contents, 1, dataLength, abfd) != dataLength) + return false; + if (bfd_seek (abfd, pos, SEEK_SET) != 0) + return false; + + memcpy (nlm_cygnus_ext_header (abfd), "CyGnUsEx", 8); + nlm_cygnus_ext_header (abfd)->offset = dataOffset; + nlm_cygnus_ext_header (abfd)->length = dataLength; + + /* This data this header points to provides a list of + the sections which were in the original object file + which was converted to become an NLM. We locate + those sections and add them to the BFD. Note that + this is likely to create a second .text, .data and + .bss section; retrieving the sections by name will + get the actual NLM sections, which is what we want to + happen. The sections from the original file, which + may be subsets of the NLM section, can only be found + using bfd_map_over_sections. */ + p = contents; + pend = p + dataLength; + while (p < pend) + { + char *name; + size_t l; + file_ptr filepos; + bfd_size_type size; + asection *newsec; + + /* The format of this information is null terminated section name zeroes to adjust to 4 byte boundary 4 byte section data file pointer 4 byte section size - */ - - name = p; - l = strlen (name) + 1; - l = (l + 3) &~ 3; - p += l; - filepos = bfd_h_get_32 (abfd, p); - p += 4; - size = bfd_h_get_32 (abfd, p); - p += 4; - - newsec = bfd_make_section_anyway (abfd, name); - if (newsec == (asection *) NULL) - return false; - newsec->_raw_size = size; - if (filepos != 0) - { - newsec->filepos = filepos; - newsec->flags |= SEC_HAS_CONTENTS; + */ + + name = (char *) p; + l = strlen (name) + 1; + l = (l + 3) &~ 3; + p += l; + filepos = bfd_h_get_32 (abfd, p); + p += 4; + size = bfd_h_get_32 (abfd, p); + p += 4; + + newsec = bfd_make_section_anyway (abfd, name); + if (newsec == (asection *) NULL) + return false; + newsec->_raw_size = size; + if (filepos != 0) + { + newsec->filepos = filepos; + newsec->flags |= SEC_HAS_CONTENTS; + } } } - - if (bfd_seek (abfd, pos, SEEK_SET) != 0) - return false; + else + { + memcpy (nlm_custom_header (abfd)->stamp, thdr.stamp, + sizeof (thdr.stamp)); + nlm_custom_header (abfd)->hdrLength = hdrLength; + nlm_custom_header (abfd)->dataOffset = dataOffset; + nlm_custom_header (abfd)->dataLength = dataLength; + memcpy (nlm_custom_header (abfd)->dataStamp, dataStamp, + sizeof (dataStamp)); + nlm_custom_header (abfd)->hdr = hdr; + } } else { @@ -771,26 +829,6 @@ nlm_swap_auxiliary_headers_out (abfd) return false; } - /* Write out the custom header if there is one. */ - if (find_nonzero ((PTR) nlm_custom_header (abfd), - sizeof (Nlm_Internal_Custom_Header))) - { - Nlm_External_Custom_Header thdr; - - /* Right now we assume the custom header is always the suggested - format for alternate debugging records. */ - BFD_ASSERT (nlm_custom_header (abfd)->dataLength == 8); - - memcpy (thdr.stamp, "CuStHeAd", 8); - put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->dataLength, - (bfd_byte *) thdr.dataLength); - if (bfd_write ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) - return false; - if (bfd_write (nlm_custom_header (abfd)->data, 1, - nlm_custom_header (abfd)->dataLength, abfd) - != nlm_custom_header (abfd)->dataLength) - return false; - } /* Write out the copyright header if there is one. */ if (find_nonzero ((PTR) nlm_copyright_header (abfd), @@ -814,17 +852,59 @@ nlm_swap_auxiliary_headers_out (abfd) return false; } + /* Write out the custom header if there is one. */ + if (find_nonzero ((PTR) nlm_custom_header (abfd), + sizeof (Nlm_Internal_Custom_Header))) + { + Nlm_External_Custom_Header thdr; + boolean ds; + bfd_size_type hdrLength; + + ds = find_nonzero ((PTR) nlm_custom_header (abfd)->dataStamp, + sizeof (nlm_custom_header (abfd)->dataStamp)); + memcpy (thdr.stamp, "CuStHeAd", 8); + hdrLength = (2 * NLM_TARGET_LONG_SIZE + (ds ? 8 : 0) + + nlm_custom_header (abfd)->hdrLength); + put_word (abfd, hdrLength, thdr.length); + put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->dataOffset, + thdr.dataOffset); + put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->dataLength, + thdr.dataLength); + if (! ds) + { + BFD_ASSERT (nlm_custom_header (abfd)->hdrLength == 0); + if (bfd_write ((PTR) &thdr, 1, + sizeof (thdr) - sizeof (thdr.dataStamp), abfd) + != sizeof (thdr) - sizeof (thdr.dataStamp)) + return false; + } + else + { + memcpy (thdr.dataStamp, nlm_custom_header (abfd)->dataStamp, + sizeof (thdr.dataStamp)); + if (bfd_write ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) + return false; + if (bfd_write (nlm_custom_header (abfd)->hdr, 1, + nlm_custom_header (abfd)->hdrLength, abfd) + != nlm_custom_header (abfd)->hdrLength) + return false; + } + } + /* Write out the Cygnus debugging header if there is one. */ - if (find_nonzero ((PTR) nlm_cygnus_section_header (abfd), - sizeof (Nlm_Internal_Cygnus_Section_Header))) + if (find_nonzero ((PTR) nlm_cygnus_ext_header (abfd), + sizeof (Nlm_Internal_Cygnus_Ext_Header))) { - Nlm_External_Cygnus_Section_Header thdr; + Nlm_External_Custom_Header thdr; - memcpy (thdr.stamp, "CyGnUsSeCs", 10); - put_word (abfd, (bfd_vma) nlm_cygnus_section_header (abfd)->offset, - (bfd_byte *) thdr.offset); - put_word (abfd, (bfd_vma) nlm_cygnus_section_header (abfd)->length, + memcpy (thdr.stamp, "CuStHeAd", 8); + put_word (abfd, (bfd_vma) 2 * NLM_TARGET_LONG_SIZE + 8, (bfd_byte *) thdr.length); + put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->offset, + (bfd_byte *) thdr.dataOffset); + put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->length, + (bfd_byte *) thdr.dataLength); + memcpy (thdr.dataStamp, "CyGnUsEx", 8); if (bfd_write ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) return false; } @@ -1361,17 +1441,17 @@ nlm_compute_section_file_positions (abfd) if (find_nonzero ((PTR) nlm_extended_header (abfd), sizeof (Nlm_Internal_Extended_Header))) sofar += sizeof (Nlm_External_Extended_Header); - if (find_nonzero ((PTR) nlm_custom_header (abfd), - sizeof (Nlm_Internal_Custom_Header))) - sofar += (sizeof (Nlm_External_Custom_Header) - + nlm_custom_header (abfd)->dataLength); if (find_nonzero ((PTR) nlm_copyright_header (abfd), sizeof (Nlm_Internal_Copyright_Header))) sofar += (sizeof (Nlm_External_Copyright_Header) + nlm_copyright_header (abfd)->copyrightMessageLength + 1); - if (find_nonzero ((PTR) nlm_cygnus_section_header (abfd), - sizeof (Nlm_Internal_Cygnus_Section_Header))) - sofar += sizeof (Nlm_External_Cygnus_Section_Header); + if (find_nonzero ((PTR) nlm_custom_header (abfd), + sizeof (Nlm_Internal_Custom_Header))) + sofar += (sizeof (Nlm_External_Custom_Header) + + nlm_custom_header (abfd)->hdrLength); + if (find_nonzero ((PTR) nlm_cygnus_ext_header (abfd), + sizeof (Nlm_Internal_Cygnus_Ext_Header))) + sofar += sizeof (Nlm_External_Custom_Header); /* Compute the section file positions in two passes. First get the sizes of the text and data sections, and then set the file |