#include "libnlm.h"
#include "nlmconv.h"
-/* Needed for Alpha support. */
+#ifdef NLMCONV_ALPHA
#include "coff/sym.h"
#include "coff/ecoff.h"
+#endif
/* If strerror is just a macro, we want to use the one from libiberty
since it will handle undefined values. */
static void mangle_relocs PARAMS ((bfd *, asection *, arelent ***,
long *, char *,
bfd_size_type));
+static void default_mangle_relocs PARAMS ((bfd *, asection *, arelent ***,
+ long *, char *,
+ bfd_size_type));
+static char *link_inputs PARAMS ((struct string_list *, char *));
+static const char *choose_temp_base_try PARAMS ((const char *,
+ const char *));
+static void choose_temp_base PARAMS ((void));
+static int pexecute PARAMS ((char *, char *[]));
+
+#ifdef NLMCONV_I386
static void i386_mangle_relocs PARAMS ((bfd *, asection *, arelent ***,
long *, char *,
bfd_size_type));
+#endif
+
+#ifdef NLMCONV_ALPHA
static void alpha_mangle_relocs PARAMS ((bfd *, asection *, arelent ***,
long *, char *,
bfd_size_type));
+#endif
+
+#ifdef NLMCONV_POWERPC
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 *,
bfd_size_type));
-static void default_mangle_relocs PARAMS ((bfd *, asection *, arelent ***,
- long *, char *,
- bfd_size_type));
-static char *link_inputs PARAMS ((struct string_list *, char *));
-static const char *choose_temp_base_try PARAMS ((const char *,
- const char *));
-static void choose_temp_base PARAMS ((void));
-static int pexecute PARAMS ((char *, char *[]));
+#endif
\f
/* The main routine. */
if (! bfd_set_section_flags (outbfd, secsec, SEC_HAS_CONTENTS))
bfd_fatal ("set .nlmsections flags");
+#ifdef NLMCONV_POWERPC
/* For PowerPC NetWare we need to build stubs for calls to undefined
symbols. Because each stub requires an entry in the TOC section
which must be at the same location as other entries in the TOC
goes in setup_sections. */
if (bfd_get_arch (inbfd) == bfd_arch_powerpc)
powerpc_build_stubs (inbfd, outbfd, &symbols, &symcount);
+#endif
/* Set up the sections. */
bfd_map_over_sections (inbfd, setup_sections, (PTR) outbfd);
endsym = sym;
}
+#ifdef NLMCONV_POWERPC
/* For PowerPC NetWare, we define __GOT0. This is the start
of the .got section. */
if (bfd_get_arch (inbfd) == bfd_arch_powerpc
sym->value = got_sec->output_offset;
sym->section = got_sec->output_section;
}
+#endif
}
/* If this is a global symbol, check the export list. */
strncpy (version_hdr->stamp, "VeRsIoN#", 8);
}
+#ifdef NLMCONV_POWERPC
/* Resolve the stubs we build for PowerPC NetWare. */
if (bfd_get_arch (inbfd) == bfd_arch_powerpc)
powerpc_resolve_stubs (inbfd, outbfd);
+#endif
/* Copy over the sections. */
bfd_map_over_sections (inbfd, copy_sections, (PTR) outbfd);
{
switch (arch)
{
+#ifdef NLMCONV_I386
case bfd_arch_i386:
return "nlm32-i386";
+#endif
+#ifdef NLMCONV_SPARC
case bfd_arch_sparc:
return "nlm32-sparc";
+#endif
+#ifdef NLMCONV_ALPHA
case bfd_arch_alpha:
return "nlm32-alpha";
+#endif
+#ifdef NLMCONV_POWERPC
case bfd_arch_powerpc:
return "nlm32-powerpc";
+#endif
default:
- fprintf (stderr, "%s: no default NLM format for %s\n",
+ fprintf (stderr, "%s: support not compiled in for %s\n",
program_name, bfd_printable_arch_mach (arch, mach));
exit (1);
/* Avoid warning. */
{
switch (bfd_get_arch (outbfd))
{
+#ifdef NLMCONV_I386
case bfd_arch_i386:
i386_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr,
contents, contents_size);
break;
+#endif
+#ifdef NLMCONV_ALPHA
case bfd_arch_alpha:
alpha_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr,
contents, contents_size);
break;
+#endif
+#ifdef NLMCONV_POWERPC
case bfd_arch_powerpc:
powerpc_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr,
contents, contents_size);
break;
+#endif
default:
default_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr,
contents, contents_size);
(*relocs)->address += insec->output_offset;
}
}
+\f
+#ifdef NLMCONV_I386
/* NetWare on the i386 supports a restricted set of relocs, which are
different from those used on other i386 targets. This routine
}
}
+#endif /* NLMCONV_I386 */
+\f
+#ifdef NLMCONV_ALPHA
+
/* On the Alpha the first reloc for every section must be a special
relocs which hold the GP address. Also, the first reloc in the
file must be a special reloc which holds the address of the .lita
}
}
+#endif /* NLMCONV_ALPHA */
+\f
+#ifdef NLMCONV_POWERPC
+
/* We keep a linked list of stubs which we must build. Because BFD
requires us to know the sizes of all sections before we can set the
contents of any, we must figure out which stubs we want to build
rel->address += insec->output_offset;
}
}
+
+#endif /* NLMCONV_POWERPC */
\f
/* Name of linker. */
#ifndef LD_NAME