start-sanitize-powerpc-netware

* nlmconv.c (powerpc_build_stubs): Take new outbfd argument.
	Change caller.  Create custom header for new PowerPC NetWare
	format.
end-sanitize-powerpc-netware

	* Makefile.in (nlmheader.o, nlmconv.o): Update dependencies.
	* nlmconv.c: Include bfd.h and libiberty.h with "", not <>.
	* nlmheader.y: Include bfd.h with "", not <>.
This commit is contained in:
Ian Lance Taylor 1994-04-20 18:37:13 +00:00
parent 276971d7d3
commit c59fa195b8
2 changed files with 40 additions and 12 deletions

View File

@ -344,10 +344,14 @@ objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
is-strip.o: is-strip.c
is-ranlib.o: is-ranlib.c
not-strip.o: not-strip.c
nlmheader.o: nlmheader.c nlmconv.h $(INCDIR)/nlm/common.h \
$(INCDIR)/nlm/internal.h
nlmconv.o: $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
$(BFDDIR)/libnlm.h bucomm.h
nlmheader.o: nlmheader.c ../bfd/bfd.h ../bfd/sysdep.h \
$(BFDDIR)/hosts/std-host.h $(INCDIR)/fopen-same.h bucomm.h \
$(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h nlmconv.h
nlmconv.o: nlmconv.c ../bfd/bfd.h $(INCDIR)/libiberty.h ../bfd/sysdep.h \
$(BFDDIR)/hosts/std-host.h $(INCDIR)/fopen-same.h bucomm.h \
$(BFDDIR)/libnlm.h $(INCDIR)/nlm/common.h \
$(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmconv.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h
stage1: force
- mkdir stage1
@ -487,10 +491,16 @@ install: all
done; \
else true; fi
# Use binutils.info as the target so that VPATH will DTRT.
# (Use "$<*" in case the output is multiple files, though.)
# This little path search is required because in the FSF net releases,
# the info files are included in the source tree, and that may not be
# the same as the build directory.
install-info: binutils.info
for i in $<* ; do \
if [ -r binutils.info ]; then \
dir=. ; \
else \
dir=$(srcdir) ; \
fi ; \
for i in $$dir/binutils.info* ; do \
$(INSTALL_DATA) $$i $(infodir)/$$i ; \
done

View File

@ -35,8 +35,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/file.h>
#include <assert.h>
#include <getopt.h>
#include <bfd.h>
#include <libiberty.h>
#include "bfd.h"
#include "libiberty.h"
#include "sysdep.h"
#include "bucomm.h"
/* Internal BFD NLM header. */
@ -125,7 +125,7 @@ static void alpha_mangle_relocs PARAMS ((bfd *, asection *, arelent ***,
long *, char *,
bfd_size_type));
/* start-sanitize-powerpc-netware */
static void powerpc_build_stubs PARAMS ((bfd *, asymbol ***, long *));
static void powerpc_build_stubs PARAMS ((bfd *, bfd *, asymbol ***, long *));
static void powerpc_resolve_stubs PARAMS ((bfd *, bfd *));
static void powerpc_mangle_relocs PARAMS ((bfd *, asection *, arelent ***,
long *, char *,
@ -384,7 +384,7 @@ main (argc, argv)
section, we must do this before determining where the TOC section
goes in setup_sections. */
if (bfd_get_arch (inbfd) == bfd_arch_powerpc)
powerpc_build_stubs (inbfd, &symbols, &symcount);
powerpc_build_stubs (inbfd, outbfd, &symbols, &symcount);
/* end-sanitize-powerpc-netware */
/* Set up the sections. */
@ -1661,8 +1661,9 @@ static bfd_size_type powerpc_initial_got_size;
build a stub for each one. */
static void
powerpc_build_stubs (inbfd, symbols_ptr, symcount_ptr)
powerpc_build_stubs (inbfd, outbfd, symbols_ptr, symcount_ptr)
bfd *inbfd;
bfd *outbfd;
asymbol ***symbols_ptr;
long *symcount_ptr;
{
@ -1774,6 +1775,23 @@ powerpc_build_stubs (inbfd, symbols_ptr, symcount_ptr)
* POWERPC_STUB_TOC_ENTRY_SIZE))))
bfd_fatal ("stub section sizes");
}
/* PowerPC NetWare requires a custom header. We create it here.
The first word is the header version number, currently 1. The
second word is the timestamp of the input file. */
memcpy (nlm_custom_header (outbfd)->stamp, "CuStHeAd", 8);
nlm_custom_header (outbfd)->dataLength = 8;
nlm_custom_header (outbfd)->data = xmalloc (8);
bfd_h_put_32 (outbfd, (bfd_vma) 1,
(bfd_byte *) nlm_custom_header (outbfd)->data);
{
struct stat s;
if (stat (bfd_get_filename (inbfd), &s) < 0)
s.st_mtime = 0;
bfd_h_put_32 (outbfd, (bfd_vma) s.st_mtime,
(bfd_byte *) nlm_custom_header (outbfd)->data + 4);
}
}
/* Resolve all the stubs for PowerPC NetWare. We fill in the contents